Created
May 29, 2012 20:35
-
-
Save anonymous/2830544 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ru mybb.orig/archive/global.php mybb/archive/global.php | |
--- mybb.orig/archive/global.php 2011-02-18 12:54:30.000000000 -0500 | |
+++ mybb/archive/global.php 2012-05-29 07:21:13.594792047 -0400 | |
@@ -41,7 +41,7 @@ | |
} | |
// If the server OS is not Windows and not Apache or the PHP is running as a CGI or we have defined ARCHIVE_QUERY_STRINGS, use query strings - DIRECTORY_SEPARATOR checks if running windows | |
-if((DIRECTORY_SEPARATOR == '\\' && stripos($_SERVER['SERVER_SOFTWARE'], 'apache') == false) || stripos(SAPI_NAME, 'cgi') !== false || defined("ARCHIVE_QUERY_STRINGS")) | |
+if((DIRECTORY_SEPARATOR == '\\' && stripos($_SERVER['SERVER_SOFTWARE'], 'apache') == false) || strstr(php_sapi_name(),'cgi') || defined("ARCHIVE_QUERY_STRINGS")) | |
{ | |
$url = $_SERVER['QUERY_STRING']; | |
$base_url = $mybb->settings['bburl']."/archive/index.php?"; | |
@@ -197,4 +197,4 @@ | |
{ | |
archive_error_no_permission(); | |
} | |
-?> | |
\ No newline at end of file | |
+?> | |
diff -ru mybb.orig/forumdisplay.php mybb/forumdisplay.php | |
--- mybb.orig/forumdisplay.php 2012-03-27 13:50:18.000000000 -0400 | |
+++ mybb/forumdisplay.php 2012-05-29 16:10:52.587773157 -0400 | |
@@ -24,6 +24,11 @@ | |
require_once MYBB_ROOT."inc/class_parser.php"; | |
$parser = new postParser; | |
+$orderarrow = $sortsel = array('rating'=>'', 'subject'=>'', 'starter'=>'', 'started'=>'', 'replies'=>'', 'views'=>''); | |
+$ordersel = array('asc'=>'', 'desc'=>''); | |
+$datecutsel = array(1=>'', 5=>'', 10=>'', 20=>'', 50=>'', 75=>'', 100=>'', 365=>'', 9999=>''); | |
+$rules = ''; | |
+ | |
// Load global language phrases | |
$lang->load("forumdisplay"); | |
@@ -144,6 +149,10 @@ | |
$lang->sub_forums_in = $lang->sprintf($lang->sub_forums_in, $foruminfo['name']); | |
eval("\$subforums = \"".$templates->get("forumdisplay_subforums")."\";"); | |
} | |
+else | |
+{ | |
+ $subforums = ''; | |
+} | |
$excols = "forumdisplay"; | |
@@ -178,13 +187,13 @@ | |
if(is_array($forum_stats)) | |
{ | |
- if($forum_stats[-1]['modtools'] || $forum_stats[$fid]['modtools']) | |
+ if(!empty($forum_stats[-1]['modtools']) || !empty($forum_stats[$fid]['modtools'])) | |
{ | |
// Mod tools are specific to forums, not parents | |
$has_modtools = true; | |
} | |
- if($forum_stats[-1]['announcements'] || $forum_stats[$fid]['announcements']) | |
+ if(!empty($forum_stats[-1]['announcements']) || !empty($forum_stats[$fid]['announcements'])) | |
{ | |
// Global or forum-specific announcements | |
$has_announcements = true; | |
@@ -232,7 +241,7 @@ | |
} | |
} | |
- if($forum_stats[$mfid]['announcements']) | |
+ if(!empty($forum_stats[$mfid]['announcements'])) | |
{ | |
$has_announcements = true; | |
} | |
@@ -266,6 +275,7 @@ | |
WHERE s.time > '$timecut' AND location1='$fid' AND nopermission != 1 | |
ORDER BY u.username ASC, s.time DESC | |
"); | |
+ $doneusers = array(); | |
while($user = $db->fetch_array($query)) | |
{ | |
if($user['uid'] == 0) | |
@@ -274,7 +284,7 @@ | |
} | |
else | |
{ | |
- if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']]) | |
+ if(empty($doneusers[$user['uid']]) || $doneusers[$user['uid']] < $user['time']) | |
{ | |
$doneusers[$user['uid']] = $user['time']; | |
++$membercount; | |
@@ -303,12 +313,18 @@ | |
{ | |
$guestsonline = $lang->sprintf($lang->users_browsing_forum_guests, $guestcount); | |
} | |
- | |
+ else | |
+ { | |
+ $guestsonline = ''; | |
+ } | |
if($guestcount && $onlinemembers) | |
{ | |
$onlinesep = $lang->comma; | |
} | |
- | |
+ else | |
+ { | |
+ $onlinesep = ''; | |
+ } | |
$invisonline = ''; | |
if($inviscount && $mybb->usergroup['canviewwolinvis'] != 1 && ($inviscount != 1 && $mybb->user['invisible'] != 1)) | |
{ | |
@@ -319,6 +335,10 @@ | |
{ | |
$onlinesep2 = $lang->comma; | |
} | |
+ else | |
+ { | |
+ $onlinesep2 = ''; | |
+ } | |
eval("\$usersbrowsing = \"".$templates->get("forumdisplay_usersbrowsing")."\";"); | |
} | |
@@ -385,7 +405,7 @@ | |
// Pick out some sorting options. | |
// First, the date cut for the threads. | |
$datecut = 0; | |
-if(!$mybb->input['datecut']) | |
+if(empty($mybb->input['datecut'])) | |
{ | |
// If the user manually set a date cut, use it. | |
if($mybb->user['daysprune']) | |
@@ -427,7 +447,14 @@ | |
$mybb->input['order'] = $foruminfo['defaultsortorder']; | |
} | |
-$mybb->input['order'] = htmlspecialchars($mybb->input['order']); | |
+if(!empty($mybb->input['order'])) | |
+{ | |
+ $mybb->input['order'] = htmlspecialchars($mybb->input['order']); | |
+} | |
+else | |
+{ | |
+ $mybb->input['order'] = ''; | |
+} | |
switch(my_strtolower($mybb->input['order'])) | |
{ | |
@@ -453,7 +480,16 @@ | |
$t = "t."; | |
-$sortby = htmlspecialchars($mybb->input['sortby']); | |
+if(!empty($mybb->input['sortby'])) | |
+{ | |
+ $sortby = htmlspecialchars($mybb->input['sortby']); | |
+} | |
+else | |
+{ | |
+ $mybb->input['sortby'] = ''; | |
+} | |
+$sortfield2 = ''; | |
+ | |
switch($mybb->input['sortby']) | |
{ | |
case "subject": | |
@@ -486,7 +522,7 @@ | |
$sortsel[$mybb->input['sortby']] = "selected=\"selected\""; | |
// Pick the right string to join the sort URL | |
-if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1)) | |
+if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && isset($_SERVER['SEO_SUPPORT']) && $_SERVER['SEO_SUPPORT'] == 1)) | |
{ | |
$string = "?"; | |
} | |
@@ -508,7 +544,7 @@ | |
$threadcount = 0; | |
$useronly = $tuseronly = ""; | |
-if($fpermissions['canonlyviewownthreads'] == 1) | |
+if(isset($fpermissions['canonlyviewownthreads']) && $fpermissions['canonlyviewownthreads'] == 1) | |
{ | |
$useronly = "AND uid={$mybb->user['uid']}"; | |
$tuseronly = "AND t.uid={$mybb->user['uid']}"; | |
@@ -518,7 +554,7 @@ | |
{ | |
// How many posts are there? | |
- if($datecut > 0 || $fpermissions['canonlyviewownthreads'] == 1) | |
+ if($datecut > 0 || isset($fpermissions['canonlyviewownthreads']) && $fpermissions['canonlyviewownthreads'] == 1) | |
{ | |
$query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $useronly $visibleonly $datecutsql"); | |
$threadcount = $db->fetch_field($query, "threads"); | |
@@ -550,7 +586,7 @@ | |
$perpage = $mybb->settings['threadsperpage']; | |
-if(intval($mybb->input['page']) > 0) | |
+if(isset($mybb->input['page']) && intval($mybb->input['page']) > 0) | |
{ | |
$page = intval($mybb->input['page']); | |
$start = ($page-1) * $perpage; | |
@@ -582,7 +618,7 @@ | |
{ | |
$page_url = str_replace("{fid}", $fid, FORUM_URL_PAGED); | |
- if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1)) | |
+ if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && isset($_SERVER['SEO_SUPPORT']) && $_SERVER['SEO_SUPPORT'] == 1)) | |
{ | |
$q = "?"; | |
$and = ''; | |
@@ -737,6 +773,10 @@ | |
eval("\$announcementlist = \"".$templates->get("forumdisplay_announcements")."\";"); | |
$shownormalsep = true; | |
} | |
+ else | |
+ { | |
+ $announcementlist = ''; | |
+ } | |
if(empty($cookie)) | |
{ | |
@@ -748,6 +788,10 @@ | |
my_setcookie("mybb[announcements]", addslashes(serialize($cookie)), -1); | |
} | |
} | |
+else | |
+{ | |
+ $announcementlist = ''; | |
+} | |
$icon_cache = $cache->read("posticons"); | |
@@ -787,7 +831,7 @@ | |
else | |
{ | |
$tids[$thread['tid']] = $thread['tid']; | |
- if($moved_threads[$tid]) | |
+ if(!empty($moved_threads[$tid])) | |
{ | |
unset($moved_threads[$tid]); | |
} | |
@@ -833,7 +877,7 @@ | |
$query = $db->simple_select("posts", "tid,uid", "uid='{$mybb->user['uid']}' AND tid IN ({$tids}) {$visibleonly}"); | |
while($post = $db->fetch_array($query)) | |
{ | |
- if($moved_threads[$post['tid']]) | |
+ if(!empty($moved_threads[$post['tid']])) | |
{ | |
$post['tid'] = $moved_threads[$post['tid']]; | |
} | |
@@ -850,7 +894,7 @@ | |
$query = $db->simple_select("threadsread", "*", "uid='{$mybb->user['uid']}' AND tid IN ({$tids})"); | |
while($readthread = $db->fetch_array($query)) | |
{ | |
- if($moved_threads[$readthread['tid']]) | |
+ if(!empty($moved_threads[$readthread['tid']])) | |
{ | |
$readthread['tid'] = $moved_threads[$readthread['tid']]; | |
} | |
@@ -927,6 +971,7 @@ | |
// If this thread has a prefix, insert a space between prefix and subject | |
$threadprefix = ''; | |
+ $thread['threadprefix'] = ''; | |
if($thread['prefix'] != 0) | |
{ | |
$threadprefix = build_prefixes($thread['prefix']); | |
@@ -958,7 +1003,7 @@ | |
$shownormalsep = true; | |
$donestickysep = true; | |
} | |
- else if($thread['sticky'] == 0 && $shownormalsep) | |
+ else if($thread['sticky'] == 0 && !empty($shownormalsep)) | |
{ | |
eval("\$threads .= \"".$templates->get("forumdisplay_threads_sep")."\";"); | |
$shownormalsep = false; | |
@@ -978,7 +1023,7 @@ | |
$thread['numratings'] = intval($thread['numratings']); | |
$not_rated = ''; | |
- if(!$thread['rated']) | |
+ if(empty($thread['rated'])) | |
{ | |
$not_rated = ' star_rating_notrated'; | |
} | |
@@ -1037,7 +1082,7 @@ | |
if($ismod) | |
{ | |
- if(my_strpos($mybb->cookies[$inlinecookie], "|{$thread['tid']}|")) | |
+ if(isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|{$thread['tid']}|")) | |
{ | |
$inlinecheck = "checked=\"checked\""; | |
++$inlinecount; | |
@@ -1242,7 +1287,7 @@ | |
require_once MYBB_ROOT."inc/functions_indicators.php"; | |
$unread_threads = fetch_unread_count($fid); | |
-if($unread_threads !== false && $unread_threads == 0 && $unread_forums == 0) | |
+if($unread_threads !== false && $unread_threads == 0 && empty($unread_forums)) | |
{ | |
mark_forum_read($fid); | |
} | |
@@ -1274,6 +1319,10 @@ | |
{ | |
eval("\$clearstoredpass = \"".$templates->get("forumdisplay_threadlist_clearpass")."\";"); | |
} | |
+ else | |
+ { | |
+ $clearstoredpass = ''; | |
+ } | |
if($load_inline_edit_js == 1) | |
{ | |
@@ -1307,4 +1356,4 @@ | |
eval("\$forums = \"".$templates->get("forumdisplay")."\";"); | |
output_page($forums); | |
-?> | |
\ No newline at end of file | |
+?> | |
diff -ru mybb.orig/global.php mybb/global.php | |
--- mybb.orig/global.php 2012-01-05 19:53:38.000000000 -0500 | |
+++ mybb/global.php 2012-05-29 15:20:49.511728096 -0400 | |
@@ -61,7 +61,7 @@ | |
$mybb->post_code = generate_post_check(); | |
// Set and load the language | |
-if($mybb->input['language'] && $lang->language_exists($mybb->input['language']) && verify_post_check($mybb->input['my_post_key'], true)) | |
+if(!empty($mybb->input['language']) && $lang->language_exists($mybb->input['language']) && verify_post_check($mybb->input['my_post_key'], true)) | |
{ | |
$mybb->settings['bblanguage'] = $mybb->input['language']; | |
// If user is logged in, update their language selection with the new one | |
@@ -82,7 +82,7 @@ | |
$mybb->user['language'] = $mybb->settings['bblanguage']; | |
} | |
// Cookied language! | |
-else if(!$mybb->user['uid'] && $mybb->cookies['mybblang'] && $lang->language_exists($mybb->cookies['mybblang'])) | |
+else if(!$mybb->user['uid'] && !empty($mybb->cookies['mybblang']) && $lang->language_exists($mybb->cookies['mybblang'])) | |
{ | |
$mybb->settings['bblanguage'] = $mybb->cookies['mybblang']; | |
} | |
@@ -133,7 +133,7 @@ | |
cache_forums(); | |
// If we're accessing a post, fetch the forum theme for it and if we're overriding it | |
- if($mybb->input['pid']) | |
+ if(!empty($mybb->input['pid'])) | |
{ | |
$query = $db->simple_select("posts", "fid", "pid = '".intval($mybb->input['pid'])."'", array("limit" => 1)); | |
$fid = $db->fetch_field($query, "fid"); | |
@@ -146,7 +146,7 @@ | |
} | |
// We have a thread id and a forum id, we can easily fetch the theme for this forum | |
- else if($mybb->input['tid']) | |
+ else if(!empty($mybb->input['tid'])) | |
{ | |
$query = $db->simple_select("threads", "fid", "tid = '".intval($mybb->input['tid'])."'", array("limit" => 1)); | |
$fid = $db->fetch_field($query, "fid"); | |
@@ -209,10 +209,11 @@ | |
// Fetch all necessary stylesheets | |
$theme['stylesheets'] = unserialize($theme['stylesheets']); | |
$stylesheet_scripts = array("global", basename($_SERVER['PHP_SELF'])); | |
+$stylesheets = ''; | |
foreach($stylesheet_scripts as $stylesheet_script) | |
{ | |
$stylesheet_actions = array("global"); | |
- if($mybb->input['action']) | |
+ if(!empty($mybb->input['action'])) | |
{ | |
$stylesheet_actions[] = $mybb->input['action']; | |
} | |
@@ -224,12 +225,12 @@ | |
continue; | |
} | |
- if($theme['stylesheets'][$stylesheet_script][$stylesheet_action]) | |
+ if(!empty($theme['stylesheets'][$stylesheet_script][$stylesheet_action])) | |
{ | |
// Actually add the stylesheets to the list | |
foreach($theme['stylesheets'][$stylesheet_script][$stylesheet_action] as $page_stylesheet) | |
{ | |
- if($already_loaded[$page_stylesheet]) | |
+ if(!empty($already_loaded[$page_stylesheet])) | |
{ | |
continue; | |
} | |
@@ -477,9 +478,10 @@ | |
} | |
$lang->ajax_loading = str_replace("'", "\\'", $lang->ajax_loading); | |
+$pm_notice = ''; | |
// Check if this user has a new private message. | |
-if($mybb->user['pmnotice'] == 2 && $mybb->user['pms_unread'] > 0 && $mybb->settings['enablepms'] != 0 && $mybb->usergroup['canusepms'] != 0 && $mybb->usergroup['canview'] != 0 && ($current_page != "private.php" || $mybb->input['action'] != "read")) | |
+if(isset($mybb->user['pmnotice']) && $mybb->user['pmnotice'] == 2 && $mybb->user['pms_unread'] > 0 && $mybb->settings['enablepms'] != 0 && $mybb->usergroup['canusepms'] != 0 && $mybb->usergroup['canview'] != 0 && ($current_page != "private.php" || $mybb->input['action'] != "read")) | |
{ | |
$query = $db->query(" | |
SELECT pm.subject, pm.pmid, fu.username AS fromusername, fu.uid AS fromuid | |
@@ -547,6 +549,7 @@ | |
// Are we showing the quick language selection box? | |
$lang_select = ''; | |
+$lang_options = ''; | |
if($mybb->settings['showlanguageselect'] != 0) | |
{ | |
$languages = $lang->get_languages(); | |
@@ -570,6 +573,7 @@ | |
} | |
// DST Auto detection enabled? | |
+$auto_dst_detection = ''; | |
if($mybb->user['uid'] > 0 && $mybb->user['dstcorrection'] == 2) | |
{ | |
$auto_dst_detection = "<script type=\"text/javascript\">if(MyBB) { Event.observe(window, 'load', function() { MyBB.detectDSTChange('".($mybb->user['timezone']+$mybb->user['dst'])."'); }); }</script>\n"; | |
@@ -685,9 +689,11 @@ | |
} | |
// work out which items the user has collapsed | |
-$colcookie = $mybb->cookies['collapsed']; | |
+$colcookie = empty($mybb->cookies['collapsed']) ? false : $mybb->cookies['collapsed']; | |
// set up collapsable items (to automatically show them us expanded) | |
+$collapsed = array('boardstats'=>'', 'boardstats_e'=>'', 'quickreply'=>'', 'quickreply_e'=>''); | |
+$collapsedimg = $collapsed; | |
if($colcookie) | |
{ | |
$col = explode("|", $colcookie); | |
@@ -710,4 +716,4 @@ | |
$plugins->run_hooks("global_end"); | |
$globaltime = $maintimer->getTime(); | |
-?> | |
\ No newline at end of file | |
+?> | |
diff -ru mybb.orig/inc/class_core.php mybb/inc/class_core.php | |
--- mybb.orig/inc/class_core.php 2012-03-27 12:52:32.000000000 -0400 | |
+++ mybb/inc/class_core.php 2012-05-28 10:03:03.003585285 -0400 | |
@@ -258,7 +258,7 @@ | |
} | |
} | |
- if(!$this->cookies[$key]) | |
+ if(empty($this->cookies[$key])) | |
{ | |
$this->cookies[$key] = $val; | |
} | |
diff -ru mybb.orig/inc/class_error.php mybb/inc/class_error.php | |
--- mybb.orig/inc/class_error.php 2011-02-14 18:19:46.000000000 -0500 | |
+++ mybb/inc/class_error.php 2012-05-28 10:06:08.235588065 -0400 | |
@@ -591,9 +591,9 @@ | |
foreach($trace as $call) | |
{ | |
- if(!$call['file']) $call['file'] = "[PHP]"; | |
- if(!$call['line']) $call['line'] = " "; | |
- if($call['class']) $call['function'] = $call['class'].$call['type'].$call['function']; | |
+ if(empty($call['file'])) $call['file'] = "[PHP]"; | |
+ if(empty($call['line'])) $call['line'] = " "; | |
+ if(!empty($call['class'])) $call['function'] = $call['class'].$call['type'].$call['function']; | |
$call['file'] = str_replace(MYBB_ROOT, "/", $call['file']); | |
$backtrace .= "<tr>\n"; | |
$backtrace .= "<td style=\"font-size: 11px; padding: 4px; border-bottom: 1px solid #ccc;\">{$call['file']}</td>\n"; | |
diff -ru mybb.orig/inc/class_parser.php mybb/inc/class_parser.php | |
--- mybb.orig/inc/class_parser.php 2011-12-08 18:56:28.000000000 -0500 | |
+++ mybb/inc/class_parser.php 2012-05-29 07:45:36.718814001 -0400 | |
@@ -154,7 +154,7 @@ | |
} | |
// Parse Highlights | |
- if($this->options['highlight']) | |
+ if(!empty($this->options['highlight'])) | |
{ | |
$message = $this->highlight_message($message, $this->options['highlight']); | |
} | |
@@ -197,7 +197,7 @@ | |
), $message); | |
} | |
- if($options['nl2br'] !== 0) | |
+ if(!empty($options['nl2br'])) | |
{ | |
$message = nl2br($message); | |
// Fix up new lines and block level elements | |
@@ -533,7 +533,7 @@ | |
} | |
} | |
} | |
- if($options['strip_tags'] == 1) | |
+ if(isset($options['strip_tags']) && $options['strip_tags'] == 1) | |
{ | |
$message = strip_tags($message); | |
} | |
@@ -1187,4 +1187,4 @@ | |
return $message; | |
} | |
} | |
-?> | |
\ No newline at end of file | |
+?> | |
diff -ru mybb.orig/inc/class_plugins.php mybb/inc/class_plugins.php | |
--- mybb.orig/inc/class_plugins.php 2012-02-22 15:49:22.000000000 -0500 | |
+++ mybb/inc/class_plugins.php 2012-05-28 10:03:46.899585941 -0400 | |
@@ -34,7 +34,7 @@ | |
{ | |
global $cache, $plugins; | |
$pluginlist = $cache->read("plugins"); | |
- if(is_array($pluginlist['active'])) | |
+ if(!empty($pluginlist['active']) && is_array($pluginlist['active'])) | |
{ | |
foreach($pluginlist['active'] as $plugin) | |
{ | |
diff -ru mybb.orig/inc/class_session.php mybb/inc/class_session.php | |
--- mybb.orig/inc/class_session.php 2011-02-14 18:19:44.000000000 -0500 | |
+++ mybb/inc/class_session.php 2012-05-29 11:13:39.595505571 -0400 | |
@@ -67,7 +67,7 @@ | |
} | |
// If we have a valid session id and user id, load that users session. | |
- if($mybb->cookies['mybbuser']) | |
+ if(!empty($mybb->cookies['mybbuser'])) | |
{ | |
$logon = explode("_", $mybb->cookies['mybbuser'], 2); | |
$this->load_user($logon[0], $logon[1]); | |
@@ -101,7 +101,7 @@ | |
// As a token of our appreciation for getting this far (and they aren't a spider), give the user a cookie | |
- if($this->sid && ($mybb->cookies['sid'] != $this->sid) && $this->is_spider != true) | |
+ if($this->sid && (isset($mybb->cookies['sid'] ) && $mybb->cookies['sid'] != $this->sid) && $this->is_spider != true) | |
{ | |
my_setcookie("sid", $this->sid, -1, true); | |
} | |
@@ -140,7 +140,7 @@ | |
$this->logins = $mybb->user['loginattempts']; | |
$this->failedlogin = $mybb->user['failedlogin']; | |
- if($bannedcache[$uid]) | |
+ if(!empty($bannedcache[$uid])) | |
{ | |
$banned_user = $bannedcache[$uid]; | |
$mybb->user['bandate'] = $banned_user['dateline']; | |
@@ -187,8 +187,8 @@ | |
if($mybb->user['lastip'] != $this->ipaddress && array_key_exists('lastip', $mybb->user)) | |
{ | |
- $lastip_add .= ", lastip='".$db->escape_string($this->ipaddress)."', longlastip='".intval(my_ip2long($this->ipaddress))."'"; | |
- } | |
+ $lastip_add = ", lastip='".$db->escape_string($this->ipaddress)."', longlastip='".intval(my_ip2long($this->ipaddress))."'"; | |
+ } else $lastip_add = ''; | |
// If the last visit was over 900 seconds (session time out) ago then update lastvisit. | |
$time = TIME_NOW; | |
@@ -551,4 +551,4 @@ | |
return $array; | |
} | |
} | |
-?> | |
\ No newline at end of file | |
+?> | |
diff -ru mybb.orig/inc/class_templates.php mybb/inc/class_templates.php | |
--- mybb.orig/inc/class_templates.php 2011-02-14 18:19:44.000000000 -0500 | |
+++ mybb/inc/class_templates.php 2012-05-28 10:11:41.755593067 -0400 | |
@@ -69,7 +69,7 @@ | |
// | |
// DEVELOPMENT MODE | |
// | |
- if($mybb->dev_mode == 1) | |
+ if(isset($mybb->dev_mode) && $mybb->dev_mode == 1) | |
{ | |
$template = $this->dev_get($title); | |
if($template !== false) | |
@@ -138,4 +138,4 @@ | |
return $res[0]; | |
} | |
} | |
-?> | |
\ No newline at end of file | |
+?> | |
diff -ru mybb.orig/inc/config.php mybb/inc/config.php | |
--- mybb.orig/inc/config.php 2012-05-24 19:00:00.838443277 -0400 | |
+++ mybb/inc/config.php 2012-05-28 09:59:40.511582244 -0400 | |
@@ -10,6 +10,7 @@ | |
$config['database']['type'] = 'mysqli'; | |
$config['database']['database'] = 'mybb'; | |
$config['database']['table_prefix'] = 'mybb_'; | |
+$config['database']['pconnect'] = 0; | |
$config['database']['hostname'] = 'localhost'; | |
$config['database']['username'] = 'root'; | |
@@ -97,4 +98,4 @@ | |
'promotion_logs' => 180 // Promotion logs | |
); | |
-?> | |
\ No newline at end of file | |
+?> | |
diff -ru mybb.orig/inc/db_mysqli.php mybb/inc/db_mysqli.php | |
--- mybb.orig/inc/db_mysqli.php 2011-02-14 18:19:46.000000000 -0500 | |
+++ mybb/inc/db_mysqli.php 2012-05-28 16:01:40.748738823 -0400 | |
@@ -166,7 +166,7 @@ | |
// Actually connect to the specified servers | |
foreach(array('read', 'write') as $type) | |
{ | |
- if(!is_array($connections[$type])) | |
+ if(!isset($connections[$type]) || !is_array($connections[$type])) | |
{ | |
break; | |
} | |
@@ -196,7 +196,8 @@ | |
$this->get_execution_time(); | |
// Specified a custom port for this connection? | |
- list($hostname, $port) = explode(":", $single_connection['hostname'], 2); | |
+ if(strstr($single_connection['hostname'],':')) list($hostname, $port) = explode(":", $single_connection['hostname'], 2); | |
+ else $port = 0; | |
if($port) | |
{ | |
$this->$link = @$connect_function($persist.$hostname, $single_connection['username'], $single_connection['password'], "", $port); | |
diff -ru mybb.orig/inc/functions_forumlist.php mybb/inc/functions_forumlist.php | |
--- mybb.orig/inc/functions_forumlist.php 2011-12-08 19:27:00.000000000 -0500 | |
+++ mybb/inc/functions_forumlist.php 2012-05-29 11:15:53.723507583 -0400 | |
@@ -24,11 +24,18 @@ | |
$forum_listing = ''; | |
// If no forums exist with this parent, do nothing | |
- if(!is_array($fcache[$pid])) | |
+ if(empty($fcache[$pid]) || !is_array($fcache[$pid])) | |
{ | |
return; | |
} | |
+ $parent_counters['threads'] = 0; | |
+ $parent_counters['posts'] = 0; | |
+ $parent_counters['unapprovedposts'] = 0; | |
+ $parent_counters['unapprovedthreads'] = 0; | |
+ $parent_counters['viewers'] = 0; | |
+ $forum_list = ''; | |
+ | |
// Foreach of the forums in this parent | |
foreach($fcache[$pid] as $parent) | |
{ | |
@@ -58,12 +65,12 @@ | |
$hideinfo = false; | |
$hidelastpostinfo = false; | |
$showlockicon = 0; | |
- if($permissions['canviewthreads'] != 1) | |
+ if(isset($permissions['canviewthreads']) && $permissions['canviewthreads'] != 1) | |
{ | |
$hideinfo = true; | |
} | |
- if($permissions['canonlyviewownthreads'] == 1) | |
+ if(isset($permissions['canonlyviewownthreads']) && $permissions['canonlyviewownthreads'] == 1) | |
{ | |
$hideinfo = true; | |
@@ -133,7 +140,7 @@ | |
$forum['posts'] += $forum_info['counters']['posts']; | |
$forum['unapprovedthreads'] += $forum_info['counters']['unapprovedthreads']; | |
$forum['unapprovedposts'] += $forum_info['counters']['unapprovedposts']; | |
- $forum['viewers'] += $forum_info['counters']['viewing']; | |
+ if(!empty($forum_info['counters']['viewing'])) $forum['viewers'] += $forum_info['counters']['viewing']; | |
// If the child forums' lastpost is greater than the one for this forum, set it as the child forums greatest. | |
if($forum_info['lastpost']['lastpost'] > $lastpost_data['lastpost']) | |
@@ -163,12 +170,12 @@ | |
} | |
// If the current forums lastpost is greater than other child forums of the current parent, overwrite it | |
- if($lastpost_data['lastpost'] > $parent_lastpost['lastpost']) | |
+ if(empty($parent_lastpost['lastpost']) || isset($parent_lastpost['lastpost']) && $lastpost_data['lastpost'] > $parent_lastpost['lastpost']) | |
{ | |
$parent_lastpost = $lastpost_data; | |
} | |
- if(is_array($forum_viewers) && $forum_viewers[$forum['fid']] > 0) | |
+ if(is_array($forum_viewers) && isset($forum_viewers[$forum['fid']]) && $forum_viewers[$forum['fid']] > 0) | |
{ | |
$forum['viewers'] = $forum_viewers[$forum['fid']]; | |
} | |
@@ -180,7 +187,7 @@ | |
$parent_counters['posts'] += $forum['posts']; | |
$parent_counters['unapprovedposts'] += $forum['unapprovedposts']; | |
$parent_counters['unapprovedthreads'] += $forum['unapprovedthreads']; | |
- $parent_counters['viewers'] += $forum['viewers']; | |
+ if(!empty($forum['viewers'])) $parent_counters['viewers'] += $forum['viewers']; | |
} | |
// Done with our math, lets talk about displaying - only display forums which are under a certain depth | |
@@ -433,11 +440,11 @@ | |
else | |
{ | |
// Fetch the last read date for this forum | |
- if($forum['lastread']) | |
+ if(!empty($forum['lastread'])) | |
{ | |
$forum_read = $forum['lastread']; | |
} | |
- elseif($mybb->cookies['mybb']['readallforums']) | |
+ elseif(!empty($mybb->cookies['mybb']['readallforums'])) | |
{ | |
// We've hit the read all forums as a guest, so use the lastvisit of the user | |
$forum_read = $mybb->cookies['mybb']['lastvisit']; | |
@@ -533,4 +540,4 @@ | |
"unapproved_threads" => $unapproved_threads | |
); | |
} | |
-?> | |
\ No newline at end of file | |
+?> | |
diff -ru mybb.orig/inc/functions_indicators.php mybb/inc/functions_indicators.php | |
--- mybb.orig/inc/functions_indicators.php 2012-03-27 13:50:20.000000000 -0400 | |
+++ mybb/inc/functions_indicators.php 2012-05-29 07:41:00.054809850 -0400 | |
@@ -63,7 +63,7 @@ | |
$permissions = forum_permissions($fid); | |
$cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24; | |
- if($permissions['canonlyviewownthreads']) | |
+ if(!empty($permissions['canonlyviewownthreads'])) | |
{ | |
$onlyview = " AND uid = '{$mybb->user['uid']}'"; | |
$onlyview2 = " AND t.uid = '{$mybb->user['uid']}'"; | |
@@ -317,4 +317,4 @@ | |
my_unsetcookie("mybb[forumread]"); | |
} | |
} | |
-?> | |
\ No newline at end of file | |
+?> | |
diff -ru mybb.orig/inc/functions.php mybb/inc/functions.php | |
--- mybb.orig/inc/functions.php 2012-03-27 13:50:20.000000000 -0400 | |
+++ mybb/inc/functions.php 2012-05-29 16:15:14.555777085 -0400 | |
@@ -1237,7 +1237,7 @@ | |
$groups = explode(",", $gid); | |
- if(!$fpermcache[$fid]) // This forum has no custom or inherited permissions so lets just return the group permissions | |
+ if(empty($fpermcache[$fid])) // This forum has no custom or inherited permissions so lets just return the group permissions | |
{ | |
return $groupperms; | |
} | |
@@ -2243,6 +2243,7 @@ | |
function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $showall=false, $permissions="", $name="fid") | |
{ | |
global $forum_cache, $jumpfcache, $permissioncache, $mybb, $selecteddone, $forumjump, $forumjumpbits, $gobutton, $theme, $templates, $lang; | |
+ $jumpsel['default'] = ''; | |
$pid = intval($pid); | |
@@ -2272,7 +2273,7 @@ | |
$permissioncache = forum_permissions(); | |
} | |
- if(is_array($jumpfcache[$pid])) | |
+ if(isset($jumpfcache[$pid]) && is_array($jumpfcache[$pid])) | |
{ | |
foreach($jumpfcache[$pid] as $main) | |
{ | |
@@ -3250,6 +3251,10 @@ | |
{ | |
eval("\$activesep = \"".$templates->get("nav_sep_active")."\";"); | |
} | |
+ else | |
+ { | |
+ $activesep = ''; | |
+ } | |
eval("\$activebit = \"".$templates->get("nav_bit_active")."\";"); | |
eval("\$donenav = \"".$templates->get("nav")."\";"); | |
@@ -3301,7 +3306,7 @@ | |
{ | |
if($fid == $forumnav['fid']) | |
{ | |
- if($pforumcache[$forumnav['pid']]) | |
+ if(!empty($pforumcache[$forumnav['pid']])) | |
{ | |
build_forum_breadcrumb($forumnav['pid']); | |
} | |
@@ -3310,7 +3315,7 @@ | |
// Convert & to & | |
$navbits[$navsize]['name'] = preg_replace("#&(?!\#[0-9]+;)#si", "&", $forumnav['name']); | |
- if(IN_ARCHIVE == 1) | |
+ if(defined("IN_ARCHIVE")) | |
{ | |
// Set up link to forum in breadcrumb. | |
if($pforumcache[$fid][$forumnav['pid']]['type'] == 'f' || $pforumcache[$fid][$forumnav['pid']]['type'] == 'c') | |
@@ -3367,7 +3372,7 @@ | |
global $mybb; | |
// If the server OS is not Windows and not Apache or the PHP is running as a CGI or we have defined ARCHIVE_QUERY_STRINGS, use query strings - DIRECTORY_SEPARATOR checks if running windows | |
- if((DIRECTORY_SEPARATOR == '\\' && is_numeric(stripos($_SERVER['SERVER_SOFTWARE'], "apache")) == false) || is_numeric(stripos(SAPI_NAME, "cgi")) !== false || defined("ARCHIVE_QUERY_STRINGS")) | |
+ if(DIRECTORY_SEPARATOR == '\\' && stristr($_SERVER['SERVER_SOFTWARE'], "apache") || strstr(php_sapi_name(),'cgi') || defined("ARCHIVE_QUERY_STRINGS")) | |
{ | |
$base_url = $mybb->settings['bburl']."/archive/index.php?"; | |
} | |
@@ -5040,10 +5045,10 @@ | |
// Use cookie if possible, otherwise use session | |
// Session stops user clearing cookies to bypass the login | |
// Also use the greater of the two numbers present, stops people using scripts with altered cookie data to stay the same | |
- $cookielogins = intval($mybb->cookies['loginattempts']); | |
- $cookietime = $mybb->cookies['failedlogin']; | |
+ $cookielogins = empty($mybb->cookies['loginattempts']) ? 0 : $mybb->cookies['loginattempts']; | |
+ $cookietime = empty($mybb->cookies['failedlogin']) ? 0 : $mybb->cookies['failedlogin']; | |
- if(empty($cookielogins) || $cookielogins < $session->logins) | |
+ if($cookielogins < $session->logins) | |
{ | |
$loginattempts = $session->logins; | |
} | |
@@ -5052,7 +5057,7 @@ | |
$loginattempts = $cookielogins; | |
} | |
- if(empty($cookietime) || $cookietime < $session->failedlogin) | |
+ if($cookietime < $session->failedlogin) | |
{ | |
$failedlogin = $session->failedlogin; | |
} | |
@@ -6420,4 +6425,4 @@ | |
return $gd_version; | |
} | |
-?> | |
\ No newline at end of file | |
+?> | |
diff -ru mybb.orig/inc/functions_post.php mybb/inc/functions_post.php | |
--- mybb.orig/inc/functions_post.php 2012-03-09 18:51:02.000000000 -0500 | |
+++ mybb/inc/functions_post.php 2012-05-29 14:56:28.355706173 -0400 | |
@@ -25,6 +25,16 @@ | |
$hascustomtitle = 0; | |
+ // Set default values for any fields not provided here | |
+ foreach(array('subject_extra', 'attachments', 'button_warn', 'button_reply_pm', | |
+ 'button_replyall_pm', 'button_forward_pm', 'button_delete_pm') as $key) | |
+ { | |
+ if(empty($post[$key])) | |
+ { | |
+ $post[$key] = ''; | |
+ } | |
+ } | |
+ | |
// Set up the message parser if it doesn't already exist. | |
if(!$parser) | |
{ | |
@@ -220,6 +230,10 @@ | |
$post['groupimage'] .= "<br />"; | |
} | |
} | |
+ else | |
+ { | |
+ $post['groupimage'] = ""; | |
+ } | |
if($post['userusername']) | |
{ // This post was made by a registered user | |
@@ -261,7 +275,7 @@ | |
$post['stars'] = $usergroup['stars']; | |
} | |
- if(!$post['starimage']) | |
+ if(empty($post['starimage'])) | |
{ | |
$post['starimage'] = $usergroup['starimage']; | |
} | |
@@ -270,7 +284,7 @@ | |
{ | |
// Only display stars if we have an image to use... | |
$post['starimage'] = str_replace("{theme}", $theme['imgdir'], $post['starimage']); | |
- | |
+ $post['userstars'] = ''; | |
for($i = 0; $i < $post['stars']; ++$i) | |
{ | |
$post['userstars'] .= "<img src=\"".$post['starimage']."\" border=\"0\" alt=\"*\" />"; | |
@@ -326,6 +340,7 @@ | |
else | |
{ | |
$post['useravatar'] = ""; | |
+ $post['avatar_padding'] = ""; | |
} | |
eval("\$post['button_find'] = \"".$templates->get("postbit_find")."\";"); | |
@@ -458,7 +473,7 @@ | |
$post['editnote'] = $lang->sprintf($lang->postbit_edited, $post['editdate'], $post['edittime']); | |
$post['editedprofilelink'] = build_profile_link($post['editusername'], $post['edituid']); | |
eval("\$post['editedmsg'] = \"".$templates->get("postbit_editedby")."\";"); | |
- } | |
+ } else $post['editedmsg'] = ''; | |
if((is_moderator($fid, "caneditposts") || ($forumpermissions['caneditposts'] == 1 && $mybb->user['uid'] == $post['uid'])) && $mybb->user['uid'] != 0) | |
{ | |
@@ -487,7 +502,7 @@ | |
// Inline moderation stuff | |
if($ismod) | |
{ | |
- if(my_strpos($mybb->cookies[$inlinecookie], "|".$post['pid']."|")) | |
+ if(isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|".$post['pid']."|")) | |
{ | |
$inlinecheck = "checked=\"checked\""; | |
$inlinecount++; | |
@@ -562,7 +577,7 @@ | |
} | |
// If we have incoming search terms to highlight - get it done. | |
- if($mybb->input['highlight']) | |
+ if(!empty($mybb->input['highlight'])) | |
{ | |
$parser_options['highlight'] = $mybb->input['highlight']; | |
$post['subject'] = $parser->highlight_message($post['subject'], $parser_options['highlight']); | |
@@ -627,12 +642,12 @@ | |
$post = $plugins->run_hooks("postbit", $post); | |
// Is this author on the ignore list of the current user? Hide this post | |
- if(is_array($ignored_users) && $post['uid'] != 0 && $ignored_users[$post['uid']] == 1) | |
+ if(is_array($ignored_users) && $post['uid'] != 0 && isset($ignored_users[$post['uid']]) && $ignored_users[$post['uid']] == 1) | |
{ | |
$ignored_message = $lang->sprintf($lang->postbit_currently_ignoring_user, $post['username']); | |
eval("\$ignore_bit = \"".$templates->get("postbit_ignored")."\";"); | |
$post_visibility = "display: none;"; | |
- } | |
+ } else $ignore_bit = ''; | |
break; | |
} | |
@@ -662,7 +677,7 @@ | |
$validationcount = 0; | |
$tcount = 0; | |
- if(is_array($attachcache[$id])) | |
+ if(isset($attachcache[$id]) && is_array($attachcache[$id])) | |
{ // This post has 1 or more attachments | |
foreach($attachcache[$id] as $aid => $attachment) | |
{ | |
@@ -756,4 +771,4 @@ | |
} | |
} | |
} | |
-?> | |
\ No newline at end of file | |
+?> | |
diff -ru mybb.orig/inc/init.php mybb/inc/init.php | |
--- mybb.orig/inc/init.php 2012-05-28 09:36:08.179561054 -0400 | |
+++ mybb/inc/init.php 2012-05-29 15:59:05.431762548 -0400 | |
@@ -10,6 +10,7 @@ | |
*/ | |
// Disallow direct access to this file for security reasons | |
+/* | |
if(!defined("IN_MYBB")) | |
{ | |
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined."); | |
@@ -29,8 +30,8 @@ | |
{ | |
error_reporting(E_ALL & ~E_NOTICE); | |
} | |
- | |
-#error_reporting(-1); | |
+*/ | |
+error_reporting(E_ALL & ~E_NOTICE); | |
/* Defines the root directory for MyBB. | |
@@ -228,7 +229,7 @@ | |
add_shutdown('send_mail_queue'); | |
/* URL Definitions */ | |
-if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1)) | |
+if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && isset($_SERVER['SEO_SUPPORT']) && $_SERVER['SEO_SUPPORT'] == 1)) | |
{ | |
define('FORUM_URL', "forum-{fid}.html"); | |
define('FORUM_URL_PAGED', "forum-{fid}-page-{page}.html"); | |
diff -ru mybb.orig/index.php mybb/index.php | |
--- mybb.orig/index.php 2012-03-27 13:50:20.000000000 -0400 | |
+++ mybb/index.php 2012-05-29 16:11:46.827773969 -0400 | |
@@ -75,6 +75,7 @@ | |
$onlinemembers = ''; | |
$guestcount = 0; | |
$anoncount = 0; | |
+ $botcount = 0; | |
$doneusers = array(); | |
// Fetch spiders | |
@@ -90,7 +91,7 @@ | |
if($user['uid'] > 0) | |
{ | |
// The user is registered. | |
- if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']]) | |
+ if(empty($doneusers[$user['uid']]) || $doneusers[$user['uid']] < $user['time']) | |
{ | |
// If the user is logged in anonymously, update the count for that. | |
if($user['invisible'] == 1) | |
@@ -195,9 +196,16 @@ | |
$cache->update_birthdays(); | |
$bdaycache = $cache->read("birthdays"); | |
} | |
- | |
- $hiddencount = $bdaycache[$bdaydate]['hiddencount']; | |
- $today_bdays = $bdaycache[$bdaydate]['users']; | |
+ | |
+ if(isset($bdaycache[$bdaydate])) { | |
+ $hiddencount = $bdaycache[$bdaydate]['hiddencount']; | |
+ $today_bdays = $bdaycache[$bdaydate]['users']; | |
+ } | |
+ else | |
+ { | |
+ $hiddencount = 0; | |
+ $today_bdays = 0; | |
+ } | |
$comma = ''; | |
if(!empty($today_bdays)) | |
@@ -331,7 +339,6 @@ | |
{ | |
$post_code_string = "&my_post_key=".$mybb->post_code; | |
} | |
- | |
eval("\$boardstats = \"".$templates->get("index_boardstats")."\";"); | |
} | |
@@ -363,7 +370,7 @@ | |
{ | |
if($mybb->user['uid'] == 0) | |
{ | |
- if($forumsread[$forum['fid']]) | |
+ if(!empty($forumsread[$forum['fid']])) | |
{ | |
$forum['lastread'] = $forumsread[$forum['fid']]; | |
} | |
@@ -399,4 +406,4 @@ | |
eval("\$index = \"".$templates->get("index")."\";"); | |
output_page($index); | |
-?> | |
\ No newline at end of file | |
+?> | |
diff -ru mybb.orig/install/resources/mybb_theme.xml mybb/install/resources/mybb_theme.xml | |
--- mybb.orig/install/resources/mybb_theme.xml 2012-03-28 17:22:06.000000000 -0400 | |
+++ mybb/install/resources/mybb_theme.xml 2012-05-29 16:14:27.227776380 -0400 | |
@@ -11316,4 +11316,4 @@ | |
<template name="video_vimeo_embed" version="1600"><![CDATA[<object width="400" height="230"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id={$id}&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id={$id}&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="230"></embed></object>]]></template> | |
<template name="video_yahoo_embed" version="1600"><![CDATA[<div><object width="512" height="322"><param name="movie" value="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40" /><param name="allowFullScreen" value="true" /><param name="AllowScriptAccess" VALUE="always" /><param name="bgcolor" value="#000000" /><param name="flashVars" value="id={$id}&vid={$vid}&lang=en-us&intl=us&embed=1" /><embed src="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40" type="application/x-shockwave-flash" width="512" height="322" allowFullScreen="true" AllowScriptAccess="always" bgcolor="#000000" flashVars="id={$id}&vid={$vid}&lang=en-us&intl=us&embed=1"></embed></object></div>]]></template> | |
</templates> | |
-</theme> | |
\ No newline at end of file | |
+</theme> | |
Only in mybb: mybb.dump | |
diff -ru mybb.orig/showthread.php mybb/showthread.php | |
--- mybb.orig/showthread.php 2012-03-09 19:24:38.000000000 -0500 | |
+++ mybb/showthread.php 2012-05-29 16:12:32.719774662 -0400 | |
@@ -29,7 +29,7 @@ | |
$lang->load("showthread"); | |
// If there is no tid but a pid, trick the system into thinking there was a tid anyway. | |
-if($mybb->input['pid'] && !$mybb->input['tid']) | |
+if(!empty($mybb->input['pid']) && !$mybb->input['tid']) | |
{ | |
// see if we already have the post information | |
if(isset($style) && $style['pid'] == $mybb->input['pid'] && $style['tid']) | |
@@ -108,7 +108,7 @@ | |
error_no_permission(); | |
} | |
-if($forumpermissions['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid']) | |
+if(isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid']) | |
{ | |
error_no_permission(); | |
} | |
@@ -145,7 +145,7 @@ | |
// Limit to only our own threads | |
$uid_only = ''; | |
- if($forumpermissions['canonlyviewownthreads'] == 1) | |
+ if(isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] == 1) | |
{ | |
$uid_only = " AND uid = '".$mybb->user['uid']."'"; | |
@@ -199,7 +199,7 @@ | |
check_forum_password($forum['fid']); | |
// If there is no specific action, we must be looking at the thread. | |
-if(!$mybb->input['action']) | |
+if(empty($mybb->input['action'])) | |
{ | |
$mybb->input['action'] = "thread"; | |
} | |
@@ -388,7 +388,7 @@ | |
exit; | |
} | |
-if($mybb->input['pid']) | |
+if(!empty($mybb->input['pid'])) | |
{ | |
$pid = $mybb->input['pid']; | |
} | |
@@ -600,6 +600,10 @@ | |
{ | |
$adminpolloptions = "<option value=\"deletepoll\">".$lang->delete_poll."</option>"; | |
} | |
+ else | |
+ { | |
+ $adminpolloptions = ''; | |
+ } | |
if($thread['visible'] != 1) | |
{ | |
$approveunapprovethread = "<option value=\"approvethread\">".$lang->approve_thread."</option>"; | |
@@ -612,10 +616,18 @@ | |
{ | |
$closelinkch = ' checked="checked"'; | |
} | |
+ else | |
+ { | |
+ $closelinkch = ''; | |
+ } | |
if($thread['sticky']) | |
{ | |
$stickch = ' checked="checked"'; | |
} | |
+ else | |
+ { | |
+ $stickch = ''; | |
+ } | |
$closeoption = "<br /><label><input type=\"checkbox\" class=\"checkbox\" name=\"modoptions[closethread]\" value=\"1\"{$closelinkch} /> <strong>".$lang->close_thread."</strong></label>"; | |
$closeoption .= "<br /><label><input type=\"checkbox\" class=\"checkbox\" name=\"modoptions[stickthread]\" value=\"1\"{$stickch} /> <strong>".$lang->stick_thread."</strong></label>"; | |
$inlinecount = "0"; | |
@@ -798,6 +810,7 @@ | |
} | |
else // Linear display | |
{ | |
+ $threadexbox = ''; | |
if(!$mybb->settings['postsperpage']) | |
{ | |
$mybb->settings['postperpage'] = 20; | |
@@ -805,11 +818,11 @@ | |
// Figure out if we need to display multiple pages. | |
$perpage = $mybb->settings['postsperpage']; | |
- if($mybb->input['page'] != "last") | |
+ if(isset($mybb->input['page']) && $mybb->input['page'] != "last") | |
{ | |
$page = intval($mybb->input['page']); | |
} | |
- if($mybb->input['pid']) | |
+ if(!empty($mybb->input['pid'])) | |
{ | |
$post = get_post($mybb->input['pid']); | |
$query = $db->query(" | |
@@ -837,8 +850,9 @@ | |
$postcount = intval($thread['replies'])+1; | |
$pages = $postcount / $perpage; | |
$pages = ceil($pages); | |
+ $page = 1; | |
- if($mybb->input['page'] == "last") | |
+ if(isset($mybb->input['page']) && $mybb->input['page'] == "last") | |
{ | |
$page = $pages; | |
} | |
@@ -862,7 +876,7 @@ | |
// Work out if we have terms to highlight | |
$highlight = ""; | |
$threadmode = ""; | |
- if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1)) | |
+ if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && isset($_SERVER['SEO_SUPPORT']) && $_SERVER['SEO_SUPPORT'] == 1)) | |
{ | |
if($mybb->input['highlight']) | |
{ | |
@@ -883,7 +897,7 @@ | |
} | |
else | |
{ | |
- if($mybb->input['highlight']) | |
+ if(!empty($mybb->input['highlight'])) | |
{ | |
if(is_array($mybb->input['highlight'])) | |
{ | |
@@ -919,7 +933,7 @@ | |
// Set the ID of the first post on page to $pid if it doesn't hold any value | |
// to allow this value to be used for Thread Mode/Linear Mode links | |
// and ensure the user lands on the correct page after changing view mode | |
- if(!$pid) | |
+ if(empty($pid)) | |
{ | |
$pid = $getid['pid']; | |
} | |
@@ -972,6 +986,7 @@ | |
} | |
// Show the similar threads table if wanted. | |
+ $similarthreads = ''; | |
if($mybb->settings['showsimilarthreads'] != 0) | |
{ | |
switch($db->type) | |
@@ -1066,6 +1081,7 @@ | |
$last_pid = $db->fetch_field($query, "pid"); | |
// Show captcha image for guests if enabled | |
+ $captcha = ''; | |
if($mybb->settings['captchaimage'] && !$mybb->user['uid']) | |
{ | |
require_once MYBB_ROOT.'inc/class_captcha.php'; | |
@@ -1076,16 +1092,16 @@ | |
$captcha = $post_captcha->html; | |
} | |
} | |
+ $postoptionschecked = array('signature'=>'', 'emailnotify'=>''); | |
if($mybb->user['signature']) | |
{ | |
$postoptionschecked['signature'] = 'checked="checked"'; | |
} | |
- if($mybb->user['emailnotify'] == 1) | |
+ if(isset($mybb->user['emailnotify']) && $mybb->user['emailnotify'] == 1) | |
{ | |
$postoptionschecked['emailnotify'] = 'checked="checked"'; | |
} | |
- $posthash = md5($mybb->user['uid'].random_str()); | |
- | |
+ $posthash = md5($mybb->user['uid'].random_str()); | |
eval("\$quickreply = \"".$templates->get("showthread_quickreply")."\";"); | |
} | |
else | |
@@ -1098,7 +1114,7 @@ | |
{ | |
$customthreadtools = $customposttools = ''; | |
- if(is_moderator($forum['fid'], "canusecustomtools") && ($forum_stats[-1]['modtools'] || $forum_stats[$forum['fid']]['modtools'])) | |
+ if(is_moderator($forum['fid'], "canusecustomtools") && (!empty($forum_stats[-1]['modtools']) || !empty($forum_stats[$forum['fid']]['modtools']))) | |
{ | |
switch($db->type) | |
{ | |
@@ -1140,7 +1156,7 @@ | |
eval("\$moderationoptions = \"".$templates->get("showthread_moderationoptions")."\";"); | |
} | |
- $lang->newthread_in = $lang->sprintf($lang->newthread_in, $forum['name']); | |
+ $lang->newthread_in = $lang->sprintf(isset($lang->newthread_in)?$lang->newthread_in:'', $forum['name']); | |
// Subscription status | |
$add_remove_subscription = 'add'; | |
@@ -1161,6 +1177,10 @@ | |
{ | |
eval("\$classic_header = \"".$templates->get("showthread_classic_header")."\";"); | |
} | |
+ else | |
+ { | |
+ $classic_header = ''; | |
+ } | |
// Get users viewing this thread | |
if($mybb->settings['browsingthisthread'] != 0) | |
@@ -1188,7 +1208,7 @@ | |
{ | |
++$guestcount; | |
} | |
- else if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']]) | |
+ else if(empty($doneusers[$user['uid']]) || $doneusers[$user['uid']] < $user['time']) | |
{ | |
++$membercount; | |
$doneusers[$user['uid']] = $user['time']; | |
@@ -1216,11 +1236,18 @@ | |
{ | |
$guestsonline = $lang->sprintf($lang->users_browsing_thread_guests, $guestcount); | |
} | |
- | |
+ else | |
+ { | |
+ $guestsonline = ''; | |
+ } | |
if($guestcount && $onlinemembers) | |
{ | |
$onlinesep = $lang->comma; | |
} | |
+ else | |
+ { | |
+ $onlinesep = ''; | |
+ } | |
$invisonline = ''; | |
if($inviscount && $mybb->usergroup['canviewwolinvis'] != 1 && ($inviscount != 1 && $mybb->user['invisible'] != 1)) | |
@@ -1232,6 +1259,10 @@ | |
{ | |
$onlinesep2 = $lang->comma; | |
} | |
+ else | |
+ { | |
+ $onlinesep2 = ''; | |
+ } | |
eval("\$usersbrowsing = \"".$templates->get("showthread_usersbrowsing")."\";"); | |
} | |
@@ -1296,4 +1327,4 @@ | |
} | |
return $posts; | |
} | |
-?> | |
\ No newline at end of file | |
+?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment