From 57aeaf50209b74d0cf5d9e9a1bd8eeecf6ecf366 Mon Sep 17 00:00:00 2001 From: mcfly Date: Thu, 22 Jan 2009 01:58:29 +0000 Subject: [PATCH] Fixes for MYSQL_ASSOC change in db_Fetch --- comment.php | 450 ++++++++++++++++++++++++------------------------- email.php | 90 +++++----- online.php | 22 +-- print.php | 10 +- submitnews.php | 288 +++++++++++++++---------------- userposts.php | 8 +- 6 files changed, 434 insertions(+), 434 deletions(-) diff --git a/comment.php b/comment.php index 32bb7430a..9a5b340a7 100644 --- a/comment.php +++ b/comment.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/comment.php,v $ -| $Revision: 1.8 $ -| $Date: 2008-11-05 21:17:50 $ -| $Author: e107steved $ +| $Revision: 1.9 $ +| $Date: 2009-01-22 01:58:29 $ +| $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ require_once("class2.php"); @@ -21,7 +21,7 @@ require_once(e_HANDLER."news_class.php"); require_once(e_HANDLER."comment_class.php"); define("PAGE_NAME", COMLAN_99); -if (!e_QUERY) +if (!e_QUERY) { header("location:".e_BASE."index.php"); exit; @@ -33,7 +33,7 @@ $temp_query = explode(".", e_QUERY); $action = $temp_query[0]; // Usually says 'comment' - may say 'reply' $table = $temp_query[1]; // Table containing item associated with comment(s) $id = intval(varset($temp_query[2], "")); // ID of item associated with comments (e.g. news ID) - // For reply with nested comments, its the ID of the comment +// For reply with nested comments, its the ID of the comment $nid = intval(varset($temp_query[3], "")); // Action - e.g. 'edit'. Or news ID for reply with nested comments $xid = intval(varset($temp_query[4], "")); // ID of target comment global $comment_edit_query; @@ -41,29 +41,29 @@ $comment_edit_query = $temp_query[0].".".$temp_query[1].".".$temp_query[2]; unset($temp_query); $redirectFlag = 0; -if (isset($_POST['commentsubmit']) || isset($_POST['editsubmit'])) +if (isset($_POST['commentsubmit']) || isset($_POST['editsubmit'])) { // New comment, or edited comment, being posted. if(!ANON && !USER) { - header("location: ".e_BASE."index.php"); - exit; + header("location: ".e_BASE."index.php"); + exit; } - if($table == "poll") + if($table == "poll") { - if (!$sql->db_Select("polls", "poll_title", "`poll_id` = '{$id}' AND `poll_comment` = 1")) - { - header("location: ".e_BASE."index.php"); - exit; - } - } - elseif($table == "news") + if (!$sql->db_Select("polls", "poll_title", "`poll_id` = '{$id}' AND `poll_comment` = 1")) + { + header("location: ".e_BASE."index.php"); + exit; + } + } + elseif($table == "news") { - if (!$sql->db_Select("news", "news_allow_comments", "`news_id` = '{$id}' AND `news_allow_comments` = 0")) - { - header("location: ".e_BASE."index.php"); - exit; - } + if (!$sql->db_Select("news", "news_allow_comments", "`news_id` = '{$id}' AND `news_allow_comments` = 0")) + { + header("location: ".e_BASE."index.php"); + exit; + } } $pid = intval(varset($_POST['pid'], 0)); // ID of the specific comment being edited (nested comments - replies) @@ -75,19 +75,19 @@ if (isset($_POST['commentsubmit']) || isset($_POST['editsubmit'])) $clean_subject = $_POST['subject']; $cobj->enter_comment($clean_authorname, $clean_comment, $table, $id, $pid, $clean_subject); - if ($table == "news") + if ($table == "news") { $e107cache->clear("news"); - } - else + } + else { $e107cache->clear("comment.php?{$table}.{$id}"); } - if($editpid) + if($editpid) { - $redirectFlag = $id; -/* $redir = preg_replace("#\.edit.*#si", "", e_QUERY); + $redirectFlag = $id; + /* $redir = preg_replace("#\.edit.*#si", "", e_QUERY); header("Location: ".e_SELF."?{$redir}"); exit; */ } @@ -96,151 +96,151 @@ if (isset($_POST['commentsubmit']) || isset($_POST['editsubmit'])) if (isset($_POST['replysubmit'])) { // Reply to nested comment being posted - if ($table == "news" && !$sql->db_Select("news", "news_allow_comments", "news_id='{$nid}' ")) + if ($table == "news" && !$sql->db_Select("news", "news_allow_comments", "news_id='{$nid}' ")) { - header("location:".e_BASE."index.php"); - exit; - } - else + header("location:".e_BASE."index.php"); + exit; + } + else { - $row = $sql->db_Fetch(); - if (!$row['news_id']) - { - $pid = (isset($_POST['pid']) ? $_POST['pid'] : 0); - $pid = intval($pid); + $row = $sql->db_Fetch(); + if (!$row['news_id']) + { + $pid = (isset($_POST['pid']) ? $_POST['pid'] : 0); + $pid = intval($pid); - $clean_authorname = $_POST['author_name']; - $clean_comment = $_POST['comment']; - $clean_subject = $_POST['subject']; + $clean_authorname = $_POST['author_name']; + $clean_comment = $_POST['comment']; + $clean_subject = $_POST['subject']; - $cobj->enter_comment($clean_authorname, $clean_comment, $table, $nid, $pid, $clean_subject); - $e107cache->clear("comment.php?{$table}.{$id}"); - } - $redirectFlag = $nid; + $cobj->enter_comment($clean_authorname, $clean_comment, $table, $nid, $pid, $clean_subject); + $e107cache->clear("comment.php?{$table}.{$id}"); + } + $redirectFlag = $nid; } } if ($redirectFlag) { // Need to go back to original page -// Check plugin e_comment.php files - $plugin_redir = false; - $e_comment = $cobj->get_e_comment(); - if ($table == $e_comment[$table]['eplug_comment_ids']) - { - $plugin_redir = TRUE; - $reply_location = str_replace("{NID}", $redirectFlag, $e_comment[$table]['reply_location']); - } - - if ($plugin_redir) - { - echo "\n"; - exit; - } - else - { - switch ($table) + // Check plugin e_comment.php files + $plugin_redir = false; + $e_comment = $cobj->get_e_comment(); + if ($table == $e_comment[$table]['eplug_comment_ids']) { - case "news" : - case "poll" : - echo "\n"; - exit; - break; - case "download" : - echo "\n"; - exit; - break; - case "page" : - echo "\n"; - exit; - break; + $plugin_redir = TRUE; + $reply_location = str_replace("{NID}", $redirectFlag, $e_comment[$table]['reply_location']); + } + + if ($plugin_redir) + { + echo "\n"; + exit; + } + else + { + switch ($table) + { + case "news" : + case "poll" : + echo "\n"; + exit; + break; + case "download" : + echo "\n"; + exit; + break; + case "page" : + echo "\n"; + exit; + break; + } } - } } $comment_ob_start = FALSE; -if ($action == "reply") +if ($action == "reply") { - if (!$pref['nested_comments']) + if (!$pref['nested_comments']) { header("Location: ".e_BASE."comment.php?comment.{$table}.{$nid}"); exit; } - + $query = "`comment_id` = '{$id}' LIMIT 0,1"; - if ($sql->db_Select("comments", "comment_subject", "`comment_id` = '{$id}'")) + if ($sql->db_Select("comments", "comment_subject", "`comment_id` = '{$id}'")) { - list($comments['comment_subject']) = $sql->db_Fetch(); + $comments = $sql->db_Fetch(); $subject = $comments['comment_subject']; $subject_header = $tp->toHTML($comments['comment_subject']); } - - if ($subject == "") + + if ($subject == "") { - switch ($table) - { - case "news" : - if (!$sql->db_Select("news", "news_title", "news_id='{$nid}' ")) - { - header("location: ".e_BASE."index.php"); - exit; - } - else - { - list($news['news_title']) = $sql->db_Fetch(); - $subject = $news['news_title']; - $title = COMLAN_100; - } - case "poll" : - if (!$sql->db_Select("polls", "poll_title", "poll_id='{$nid}' ")) - { - header("location:".e_BASE."index.php"); - exit; - } - else - { - list($poll['poll_title']) = $sql->db_Fetch(); - $subject = $poll['poll_title']; - $title = COMLAN_101; - } - break; - case 'download' : - if ($sql->db_Select('download','download_name',"download_id={$nid} ")) - { - $row = $sql->db_Fetch(); - $subject = $row['download_name']; - $title = COMLAN_106; - } - else - { - header("location:".e_BASE."index.php"); - exit; - } - break; - } + switch ($table) + { + case "news" : + if (!$sql->db_Select("news", "news_title", "news_id='{$nid}' ")) + { + header("location: ".e_BASE."index.php"); + exit; + } + else + { + $news = $sql->db_Fetch(); + $subject = $news['news_title']; + $title = COMLAN_100; + } + case "poll" : + if (!$sql->db_Select("polls", "poll_title", "poll_id='{$nid}' ")) + { + header("location:".e_BASE."index.php"); + exit; + } + else + { + $poll = $sql->db_Fetch(); + $subject = $poll['poll_title']; + $title = COMLAN_101; + } + break; + case 'download' : + if ($sql->db_Select('download','download_name',"download_id={$nid} ")) + { + $row = $sql->db_Fetch(); + $subject = $row['download_name']; + $title = COMLAN_106; + } + else + { + header("location:".e_BASE."index.php"); + exit; + } + break; + } } define('e_PAGETITLE', $title." / ".COMLAN_99." / ".COMLAN_102.$subject.""); require_once(HEADERF); -} +} elseif ($action == 'comment') { // Default code if not reply // Check cache - if ($cache = $e107cache->retrieve("comment.php?{$table}.{$id}")) + if ($cache = $e107cache->retrieve("comment.php?{$table}.{$id}")) { - require_once(HEADERF); - echo $cache; - require_once(FOOTERF); - exit; - } - else + require_once(HEADERF); + echo $cache; + require_once(FOOTERF); + exit; + } + else { - switch ($table) - { - case "news" : - if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) - { - $query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n + switch ($table) + { + case "news" : + if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) + { + $query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id LEFT JOIN #trackback AS tb ON tb.trackback_pid = n.news_id @@ -248,100 +248,100 @@ elseif ($action == 'comment') AND n.news_id={$id} AND n.news_allow_comments=0 GROUP by n.news_id"; - } - else - { - $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n + } + else + { + $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND n.news_id={$id} AND n.news_allow_comments=0"; - } - - if (!$sql->db_Select_gen($query)) - { - header("location:".e_BASE."index.php"); - exit; - } - else - { - $news = $sql->db_Fetch(); - $subject = $tp->toForm($news['news_title']); - define("e_PAGETITLE", COMLAN_100." / ".COMLAN_99." / {$subject}"); - require_once(HEADERF); - ob_start(); - $comment_ob_start = TRUE; - $ix = new news; - $ix->render_newsitem($news, "extend"); // extend so that news-title-only news text is displayed in full when viewing comments. - $field = $news['news_id']; - } - break; - case "poll" : - if (!$sql->db_Select("polls", "*", "poll_id='{$id}'")) - { - header("location:".e_BASE."index.php"); - exit; - } - else - { - $row = $sql->db_Fetch(); - $comments_poll = $row['poll_comment']; - $subject = $row['poll_title']; - define("e_PAGETITLE", COMLAN_101." / ".COMLAN_99." / ".$subject.""); - $poll_to_show = $id; // Need to pass poll number through to display routine - require_once(HEADERF); - require(e_PLUGIN."poll/poll_menu.php"); - $field = $row['poll_id']; - if(!$comments_poll) - { - require_once(FOOTERF); - exit; } - } - break; - case 'download' : - if ($sql->db_Select('download','download_name',"download_id={$id} ")) - { - $row = $sql->db_Fetch(); - $subject = $row['download_name']; - $title = COMLAN_106; - $field = $id; - require_once(HEADERF); - } - else - { - header("location:".e_BASE."index.php"); - exit; - } - break; - default : // Hope its a plugin table - $e_comment = $cobj->get_e_comment(); - if ($table == $e_comment[$table]['eplug_comment_ids']) - { - if ($sql->db_Select($table,$e_comment[$table]['db_title'],$e_comment[$table]['db_id']."={$id} ")) + + if (!$sql->db_Select_gen($query)) { - $row = $sql->db_Fetch(); - $subject = $row[$e_comment[$table]['db_title']]; - $title = $e_comment[$table]['plugin_name']; - $field = $id; - require_once(HEADERF); + header("location:".e_BASE."index.php"); + exit; } else { - header("location:".e_BASE."index.php"); - exit; + $news = $sql->db_Fetch(); + $subject = $tp->toForm($news['news_title']); + define("e_PAGETITLE", COMLAN_100." / ".COMLAN_99." / {$subject}"); + require_once(HEADERF); + ob_start(); + $comment_ob_start = TRUE; + $ix = new news; + $ix->render_newsitem($news, "extend"); // extend so that news-title-only news text is displayed in full when viewing comments. + $field = $news['news_id']; } - } - else - { // Error - emit some debug code - require_once(HEADERF); - echo "Comment error: {$table} Field: {$e_comment['db_id']} ID {$id} Title: {$e_comment['db_title']}
"; - echo "
";
-			var_dump($e_comment);
-			echo "
"; - } - } + break; + case "poll" : + if (!$sql->db_Select("polls", "*", "poll_id='{$id}'")) + { + header("location:".e_BASE."index.php"); + exit; + } + else + { + $row = $sql->db_Fetch(); + $comments_poll = $row['poll_comment']; + $subject = $row['poll_title']; + define("e_PAGETITLE", COMLAN_101." / ".COMLAN_99." / ".$subject.""); + $poll_to_show = $id; // Need to pass poll number through to display routine + require_once(HEADERF); + require(e_PLUGIN."poll/poll_menu.php"); + $field = $row['poll_id']; + if(!$comments_poll) + { + require_once(FOOTERF); + exit; + } + } + break; + case 'download' : + if ($sql->db_Select('download','download_name',"download_id={$id} ")) + { + $row = $sql->db_Fetch(); + $subject = $row['download_name']; + $title = COMLAN_106; + $field = $id; + require_once(HEADERF); + } + else + { + header("location:".e_BASE."index.php"); + exit; + } + break; + default : // Hope its a plugin table + $e_comment = $cobj->get_e_comment(); + if ($table == $e_comment[$table]['eplug_comment_ids']) + { + if ($sql->db_Select($table,$e_comment[$table]['db_title'],$e_comment[$table]['db_id']."={$id} ")) + { + $row = $sql->db_Fetch(); + $subject = $row[$e_comment[$table]['db_title']]; + $title = $e_comment[$table]['plugin_name']; + $field = $id; + require_once(HEADERF); + } + else + { + header("location:".e_BASE."index.php"); + exit; + } + } + else + { // Error - emit some debug code + require_once(HEADERF); + echo "Comment error: {$table} Field: {$e_comment['db_id']} ID {$id} Title: {$e_comment['db_title']}
"; + echo "
";
+				var_dump($e_comment);
+				echo "
"; + } + } } } else @@ -352,7 +352,7 @@ else if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'] && $table == "news") { - echo "".$pref['trackbackString']." ".$e107->http_path.e_PLUGIN."trackback/trackback.php?pid={$id}"; + echo "".$pref['trackbackString']." ".$e107->http_path.e_PLUGIN."trackback/trackback.php?pid={$id}"; } $field = ($field ? $field : ($id ? $id : "")); // ID of associated source item @@ -403,12 +403,12 @@ if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'] && $table == "n } -//if (!strstr(e_QUERY, "poll")) +//if (!strstr(e_QUERY, "poll")) // If output buffering started, cache the result -if ($comment_ob_start) +if ($comment_ob_start) { - $cache = ob_get_contents(); - $e107cache->set("comment.php?{$table}.{$field}", $cache); + $cache = ob_get_contents(); + $e107cache->set("comment.php?{$table}.{$field}", $cache); ob_end_flush(); // dump the buffer we started } diff --git a/email.php b/email.php index 8997f4985..2f87df689 100644 --- a/email.php +++ b/email.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/email.php,v $ -| $Revision: 1.2 $ -| $Date: 2007-01-07 15:59:41 $ -| $Author: e107steved $ +| $Revision: 1.3 $ +| $Date: 2009-01-22 01:58:29 $ +| $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ require_once("class2.php"); @@ -122,14 +122,14 @@ if (isset($_POST['emailsubmit'])) { $emailurl = $_POST['referer']; - $message = ""; - if($sql->db_Select("news", "*", "news_id='".intval($parms)."'")) - { - list($news_id, $news_title, $news_body, $news_extended, $news_datestamp, $news_author, $news_source, $news_url, $news_category, $news_allow_comments) = $sql->db_Fetch(); - $message = "

".$news_title."


".$news_body."
".$news_extended."

{e_BASE}news.php?extend.".$parms."
"; - $message = $tp->toEmail($message); + $message = ''; + if($sql->db_Select('news', 'news_title, news_body, news_extended', 'news_id='(int)$parms)) + { + $row = $sql->db_Fetch(); + $message = "

".$row['news_title']."


".$row['news_body']."
".$row['news_extended']."

{e_BASE}news.php?extend.".$parms."
"; + $message = $tp->toEmail($message); - } + } if($message == "") { @@ -141,9 +141,9 @@ if (isset($_POST['emailsubmit'])) if ($error == "") { - // Load Mail Handler and Email Template. + // Load Mail Handler and Email Template. require_once(e_HANDLER."mail.php"); - $email_body = $EMAIL_HEADER; + $email_body = $EMAIL_HEADER; $email_body .= (trim($comments) != "") ? $tp->toEmail($comments)."
" : ""; $email_body .= $tp->toEmail($message).$EMAIL_FOOTER; @@ -169,23 +169,23 @@ if (isset($_POST['emailsubmit'])) $text = "
\n - "; +
"; if (USER != TRUE) { $text .= " - - - "; + + + "; } $text .= " - - - + + - - - - - "; + + + + +"; - if($use_imagecode) - { - $text .= ""; - } +if($use_imagecode) +{ + $text .= ""; +} $text .= " - - - + + - -
".LAN_EMAIL_15." - -
".LAN_EMAIL_15." + +
".LAN_EMAIL_8." - -
".LAN_EMAIL_187." - -
".LAN_EMAIL_187." + +
".LAN_EMAIL_190.""; - $text .= $sec_img->r_image(); - $text .= " -
".LAN_EMAIL_190.""; + $text .= $sec_img->r_image(); + $text .= " +
- - +
+ +
-
"; + + +"; $ns->tablerender(LAN_EMAIL_5, $text); diff --git a/online.php b/online.php index b5b686124..317747b42 100644 --- a/online.php +++ b/online.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/online.php,v $ -| $Revision: 1.6 $ -| $Date: 2008-08-01 19:23:35 $ -| $Author: e107steved $ +| $Revision: 1.7 $ +| $Date: 2009-01-22 01:58:29 $ +| $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ require_once("class2.php"); @@ -158,7 +158,7 @@ Think these are no longer used $tmp = explode(".", substr(strrchr($online_location, "php."), 2)); if ($tmp[0] == "article") { $sql->db_Select("content", "content_heading, content_class", "content_id='".intval($tmp[1])."'"); - list($content['content_heading'], $content['content_class']) = $sql->db_Fetch(); + $content = $sql->db_Fetch(); $online_location_page = ARTICLE.": ".$content['content_heading']; $online_location = str_replace("php.", "php?", $online_location); if (!check_class($content['content_class'])) { @@ -167,7 +167,7 @@ Think these are no longer used } } elseif($tmp[0] == "review") { $sql->db_Select("content", "content_heading, content_class", "content_id='".intval($tmp[1])."'"); - list($content['content_heading'], $content['content_class']) = $sql->db_Fetch(); + $content = $sql->db_Fetch(); $online_location_page = REVIEW.": ".$content['content_heading']; $online_location = str_replace("php.", "php?", $online_location); if (!check_class($content['content_class'])) { @@ -176,7 +176,7 @@ Think these are no longer used } } elseif($tmp[0] == "content") { $sql->db_Select("content", "content_heading, content_class", "content_id='".intval($tmp[1])."'"); - list($content['content_heading'], $content['content_class']) = $sql->db_Fetch(); + $content = $sql->db_Fetch(); $online_location_page = CONTENT.": ".$content['content_heading']; $online_location = str_replace("php.", "php?", $online_location); if (!check_class($content['content_class'])) { @@ -193,7 +193,7 @@ Think these are no longer used if ($tmp[1] == "news") { $id = ($tmp[0] == "reply" ? $tmp[3] : $tmp[2]); $sql->db_Select("news", "news_title, news_class", "news_id=".intval($id)); - list($news['news_title'], $news['news_class']) = $sql->db_Fetch(); + $news = $sql->db_Fetch(); $online_location_page = ($tmp[0] == "reply" ? COMMENT.": ".ONLINE_EL12." > ".$news['news_title'] : COMMENT.": ".$news['news_title']); $online_location = "comment.php?comment.news.$id"; if (!check_class($news['news_class'])) { @@ -203,7 +203,7 @@ Think these are no longer used } elseif($tmp[1] == "poll") { $id = ($tmp[0] == "reply" ? $tmp[3] : $tmp[2]); $sql->db_Select("poll", "poll_title", "poll_id=".intval($id)); - list($poll['poll_title']) = $sql->db_Fetch(); + $poll = $sql->db_Fetch(); $online_location_page = POLLCOMMENT.": ".$poll['poll_title']; $online_location = "comment.php?comment.poll.$id"; } else { @@ -237,7 +237,7 @@ Think these are no longer used } } elseif(strstr($online_location, "_viewforum")) { $sql->db_Select("forum", "forum_name, forum_class", "forum_id=".intval($tmp[0])); - list($forum['forum_name'], $forum['forum_class']) = $sql->db_Fetch(); + $forum = $sql->db_Fetch(); $online_location_page = ONLINE_EL13." .:. ".$forum['forum_name']; $online_location = str_replace("php.", "php?", $online_location); if (!check_class($forum['forum_class'])) { @@ -246,9 +246,9 @@ Think these are no longer used } } elseif(strstr($online_location, "_post")) { $sql->db_Select("forum_t", "thread_name, thread_forum_id", "thread_forum_id=".intval($tmp[0])." AND thread_parent=0"); - list($forum_t['thread_name'], $forum_t['thread_forum_id']) = $sql->db_Fetch(); + $forum_t = $sql->db_Fetch(); $sql->db_Select("forum", "forum_name", "forum_id=".$forum_t['thread_forum_id']); - list($forum['forum_name']) = $sql->db_Fetch(); + $forum = $sql->db_Fetch(); $online_location_page = ONLINE_EL12.": ".ONLINE_EL13." .:. ".$forum['forum_name']."->".ONLINE_EL14." .:. ".$forum_t['thread_name']; $online_location = e_PLUGIN."forum/forum_viewtopic.php?$tmp[0].$tmp[1]"; } diff --git a/print.php b/print.php index 012cfc364..935afd38a 100644 --- a/print.php +++ b/print.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/print.php,v $ -| $Revision: 1.7 $ -| $Date: 2008-01-09 22:06:22 $ -| $Author: e107steved $ +| $Revision: 1.8 $ +| $Date: 2009-01-22 01:58:29 $ +| $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ require_once("class2.php"); @@ -65,9 +65,9 @@ else else { $sql->db_Select("news_category", "category_id, category_name", "category_id='{$news_category}'"); - list($category_id, $category_name) = $sql->db_Fetch(); + list($category_id, $category_name) = $sql->db_Fetch(MYSQL_NUM); $sql->db_Select("user", "user_id, user_name", "user_id='{$news_author}'"); - list($a_id, $a_name) = $sql->db_Fetch(); + list($a_id, $a_name) = $sql->db_Fetch(MYSQL_NUM); } $news_datestamp = $con->convert_date($news_datestamp, "long"); $print_text = " diff --git a/submitnews.php b/submitnews.php index f68bb980b..6e46e09fe 100644 --- a/submitnews.php +++ b/submitnews.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/submitnews.php,v $ -| $Revision: 1.7 $ -| $Date: 2008-06-02 18:28:58 $ -| $Author: e107steved $ +| $Revision: 1.8 $ +| $Date: 2009-01-22 01:58:29 $ +| $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ require_once("class2.php"); @@ -24,13 +24,13 @@ require_once(HEADERF); if (!isset($pref['subnews_class'])) { - $pref['subnews_class'] = "0"; + $pref['subnews_class'] = "0"; } if (!check_class($pref['subnews_class'])) { - $ns->tablerender(NWSLAN_12, NWSLAN_11); - require_once(FOOTERF); - exit; + $ns->tablerender(NWSLAN_12, NWSLAN_11); + require_once(FOOTERF); + exit; } $author_name = $tp->toDB($_POST['author_name']); @@ -38,199 +38,199 @@ $author_email = $tp->toDB(check_email($_POST['author_email'])); if (isset($_POST['submit'])) { - $user = (USER ? USERNAME : $author_name); - $email = (USER ? USEREMAIL : $author_email); + $user = (USER ? USERNAME : $author_name); + $email = (USER ? USEREMAIL : $author_email); - if ($user && $email) - { - $ip = $e107->getip(); - $fp = new floodprotect; - if ($fp->flood("submitnews", "submitnews_datestamp") == false) - { - header("location:" . e_BASE . "index.php"); - exit; - } - $itemtitle = $tp->toDB($_POST['itemtitle']); - $item = $tp->toDB($_POST['e107_submitnews_item']); - $item = str_replace("src="e107_images", "src="" . SITEURL . "e107_images", $item); - // Process File Upload ================================================= - if ($_FILES['file_userfile'] && $pref['subnews_attach'] && $pref['upload_enabled'] && check_class($pref['upload_class']) && FILE_UPLOADS) - { - require_once(e_HANDLER . "upload_handler.php"); - $uploaded = file_upload(e_IMAGE . "newspost_images/"); - $file = $uploaded[0]['name']; - $filetype = $uploaded[0]['type']; - $filesize = $uploaded[0]['size']; - $fileext = substr(strrchr($file, "."), 1); + if ($user && $email) + { + $ip = $e107->getip(); + $fp = new floodprotect; + if ($fp->flood("submitnews", "submitnews_datestamp") == false) + { + header("location:" . e_BASE . "index.php"); + exit; + } + $itemtitle = $tp->toDB($_POST['itemtitle']); + $item = $tp->toDB($_POST['e107_submitnews_item']); + $item = str_replace("src="e107_images", "src="" . SITEURL . "e107_images", $item); + // Process File Upload ================================================= + if ($_FILES['file_userfile'] && $pref['subnews_attach'] && $pref['upload_enabled'] && check_class($pref['upload_class']) && FILE_UPLOADS) + { + require_once(e_HANDLER . "upload_handler.php"); + $uploaded = file_upload(e_IMAGE . "newspost_images/"); + $file = $uploaded[0]['name']; + $filetype = $uploaded[0]['type']; + $filesize = $uploaded[0]['size']; + $fileext = substr(strrchr($file, "."), 1); - if (!$pref['upload_maxfilesize']) - { - $pref['upload_maxfilesize'] = ini_get('upload_max_filesize') * 1048576; - } + if (!$pref['upload_maxfilesize']) + { + $pref['upload_maxfilesize'] = ini_get('upload_max_filesize') * 1048576; + } - if ($uploaded && $fileext != "jpg" && $fileext != "gif" && $fileext != "png") - { - $message = SUBNEWSLAN_3; - $error = true; - } + if ($uploaded && $fileext != "jpg" && $fileext != "gif" && $fileext != "png") + { + $message = SUBNEWSLAN_3; + $error = true; + } - if ($filesize > $pref['upload_maxfilesize']) - { - $message = SUBNEWSLAN_4; - $error = true; - } + if ($filesize > $pref['upload_maxfilesize']) + { + $message = SUBNEWSLAN_4; + $error = true; + } - if (!$error) - { - // $numberoffiles = count($uploaded); - $today = getdate(); - $newname = USERID . "_" . $today[0] . "_" . str_replace(" ", "_", substr($itemtitle, 0, 6)) . "." . $fileext; - if ($file && $pref['subnews_resize']) - { - require_once(e_HANDLER . "resize_handler.php"); - $rezwidth = $pref['subnews_resize']; - if (!resize_image(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname, $rezwidth)) - { - rename(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname); - } - } elseif ($file) - { - rename(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname); - } - } - } + if (!$error) + { + // $numberoffiles = count($uploaded); + $today = getdate(); + $newname = USERID . "_" . $today[0] . "_" . str_replace(" ", "_", substr($itemtitle, 0, 6)) . "." . $fileext; + if ($file && $pref['subnews_resize']) + { + require_once(e_HANDLER . "resize_handler.php"); + $rezwidth = $pref['subnews_resize']; + if (!resize_image(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname, $rezwidth)) + { + rename(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname); + } + } elseif ($file) + { + rename(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname); + } + } + } - if ($error == false) - { - if (!file_exists(e_IMAGE . "newspost_images/" . $newname)) - { - $newname = ""; - } - $sql->db_Insert("submitnews", "0, '$user', '$email', '$itemtitle', '".intval($_POST['cat_id'])."','$item', '" . time() . "', '$ip', '0', '$newname' "); - $edata_sn = array("user" => $user, "email" => $email, "itemtitle" => $itemtitle, "catid" => intval($_POST['cat_id']), "item" => $item, "ip" => $ip, "newname" => $newname); - $e_event->trigger("subnews", $edata_sn); - $ns->tablerender(LAN_133, "
" . LAN_134 . "
"); - require_once(FOOTERF); - exit; - } - else - { - require_once(e_HANDLER . "message_handler.php"); - message_handler("P_ALERT", $message); - } - } + if ($error == false) + { + if (!file_exists(e_IMAGE . "newspost_images/" . $newname)) + { + $newname = ""; + } + $sql->db_Insert("submitnews", "0, '$user', '$email', '$itemtitle', '".intval($_POST['cat_id'])."','$item', '" . time() . "', '$ip', '0', '$newname' "); + $edata_sn = array("user" => $user, "email" => $email, "itemtitle" => $itemtitle, "catid" => intval($_POST['cat_id']), "item" => $item, "ip" => $ip, "newname" => $newname); + $e_event->trigger("subnews", $edata_sn); + $ns->tablerender(LAN_133, "
" . LAN_134 . "
"); + require_once(FOOTERF); + exit; + } + else + { + require_once(e_HANDLER . "message_handler.php"); + message_handler("P_ALERT", $message); + } + } } if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); } $text = "
-
\n - "; +\n +
"; if (!USER) { - $text .= "\n\n\n\n\n\n\n"; + $text .= "\n\n\n\n\n\n\n"; } if (!empty($pref['news_subheader'])) { - $text .= " + $text .= " "; } $text .= " - - + - - - - "; + + + +"; if (e_WYSIWYG) { - $insertjs = "rows='25' "; + $insertjs = "rows='25' "; } else { - require_once(e_HANDLER."ren_help.php"); - $insertjs = "rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'"; + require_once(e_HANDLER."ren_help.php"); + $insertjs = "rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'"; } $text .= " - - - + + - \n"; +\n"; if ($pref['subnews_attach'] && $pref['upload_enabled'] && check_class($pref['upload_class']) && FILE_UPLOADS) { - $text .= " - - - - \n"; + $text .= " + + + + \n"; } $text .= " - - - -
" . LAN_7 . "\n\n
" . LAN_112 . "\n\n
" . LAN_7 . "\n\n
" . LAN_112 . "\n\n
" . $tp->toHTML($pref['news_subheader'], TRUE,'TITLE') . "
" . NWSLAN_6 . ": "; +" . NWSLAN_6 . ": "; if (!$sql->db_Select("news_category")) { - $text .= NWSLAN_10; + $text .= NWSLAN_10; } else { - $text .= " + $text .= " "; + $text .= ""; + } + $text .= ""; } $text .= "
" . LAN_62 . " - -
" . LAN_62 . " + +
" . LAN_135 . " -
"; +
" . LAN_135 . " +
"; if (!e_WYSIWYG) { - $text .= display_help("helpb","submitnews"); + $text .= display_help("helpb","submitnews"); } $text .= "
" . SUBNEWSLAN_5 . "
" . SUBNEWSLAN_6 . "
- -
" . SUBNEWSLAN_5 . "
" . SUBNEWSLAN_6 . "
+ +
- -
-
-
"; + + + + + + + +"; $ns->tablerender(LAN_136, $text); require_once(FOOTERF); function headerjs() { - $adder = ''; - if (e_WYSIWYG) $adder = 'triggerSave();'; - $script = ""; - return $script; + $adder = ''; + if (e_WYSIWYG) $adder = 'triggerSave();'; + $script = ""; + return $script; } ?> diff --git a/userposts.php b/userposts.php index a980e1081..53f22da3b 100644 --- a/userposts.php +++ b/userposts.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/userposts.php,v $ -| $Revision: 1.8 $ -| $Date: 2008-12-10 21:00:48 $ +| $Revision: 1.9 $ +| $Date: 2009-01-22 01:58:29 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -81,8 +81,8 @@ if ($action == "comments") { $ccaption = UP_LAN_1.$user_name; $sql->db_Select("user", "user_comments", "user_id=".$id); - list($user_comments) = $sql->db_Fetch(); - $ctotal = $user_comments; + $row = $sql->db_Fetch(); + $ctotal = $row['user_comments']; $data = $cobj->getCommentData($amount='10', $from, "comment_author = '".$user_id."'"); } else