All pastes #1191240 Raw Edit

Bug fixes for Project Gazelle

public diff v1 · immutable
#1191240 ·published 2008-09-02 07:28 UTC
rendered paste body
Index: classes/class_cache.php===================================================================--- classes/class_cache.php	(revision 18)+++ classes/class_cache.php	(working copy)@@ -209,6 +209,8 @@  |*************************************************************************/ +if(!class_exists('Memcache'))+	die('Ensure you have read the documentation in the docs directory.');  class CACHE extends Memcache{ 	var $Page = array();@@ -394,7 +396,7 @@  	// Wrapper for Memcache::get. Why? Because wrappers are cool. 	function get_value($Key){-		if($_GET['clearcache'] && check_perms('admin_clear_cache')){+		if(isset($_GET['clearcache']) && check_perms('admin_clear_cache')){ 			$this->delete_value($Key); 			return false; 		}Index: classes/class_mysql.php===================================================================--- classes/class_mysql.php	(revision 18)+++ classes/class_mysql.php	(working copy)@@ -155,8 +155,9 @@ 		//----------------------------------------------------------------------------------------------  		//-- For query debugging ------------------------------------------------------------------------		if (DEBUG_MODE || check_perms('site_debug')) {+		if (defined('DEBUG_MODE') || check_perms('site_debug')) { 			$GLOBALS['queries'][]=array('time'=>number_format($QueryEndTime-$QueryStartTime,5),'sql'=>$Query);+			if (!isset($GLOBALS['querytime'])) $GLOBALS['querytime'] = ''; 			$GLOBALS['querytime']+=number_format($QueryEndTime-$QueryStartTime,5); 		} 		//----------------------------------------------------------------------------------------------@@ -255,6 +256,7 @@  	//  Loops through the result set, collecting the $Key column into an array 	function collect($Key){+		$Return=array(); 		while($Row = mysqli_fetch_array($this->QueryID)){ 			$Return[]=display_str($Row[$Key]); 		}Index: classes/class_requests.php===================================================================--- classes/class_requests.php	(revision 18)+++ classes/class_requests.php	(working copy)@@ -31,11 +31,15 @@ 	 	// Query string, used for pagination 	function make_url(){-		$this->URL = 'search=' . urlencode($_GET['search']) . '&amp;tag=' . urlencode($_GET['tag']) . '&amp;tags=' . urlencode($_GET['tags']) . '&amp;order=' . urlencode($_GET['order']) . '&amp;sort='. urlencode($_GET['sort']);-		if($_GET['showall']){+		$this->URL = ( isset($_GET['search']) ? 'search=' . urlencode($_GET['search']) . '&amp;' : '' ).+					 ( isset($_GET['tag']) ? 'tag=' . urlencode($_GET['tag']) . '&amp;' : '' ).+					 ( isset($_GET['tags']) ? 'tags=' . urlencode($_GET['tags']) . '&amp;' : '' ).+					 ( isset($_GET['order']) ? 'order=' . urlencode($_GET['order']) . '&amp;' : '' ).+					 ( isset($_GET['sort']) ? 'sort='. urlencode($_GET['sort']) : '' );+		if(isset($_GET['showall'])){ 			$this->URL .= '&amp;showall=1'; 		}-		if($_GET['type']){+		if(isset($_GET['type'])){ 			$this->URL .= '&amp;type='.urlencode($_GET['type']); 		} 	}@@ -45,7 +49,7 @@ 		global $DB, $Cache; 		// Try to get everything from cache 		if($this->Cache){-			if($_SESSION['clearnext']){ // If we're meant to be clearing the cache (set by vote.php)+			if(isset($_SESSION['clearnext'])){ // If we're meant to be clearing the cache (set by vote.php) 				$Cache->delete_value('Requests_'.md5($this->SQL)); 				unset($_SESSION['clearnext']); 			} else {@@ -96,7 +100,7 @@ 				<tr> 					<td class="label">Search terms:</td> 					<td>-						<input type="text" name="search" size="75" value="<?= display_str($_GET['search'])?>" />+						<input type="text" name="search" size="75" value="<?= ( isset($_GET['search']) ? display_str($_GET['search']) : '' )?>" /> 					</td> 				</tr> 				<tr>@@ -109,7 +113,7 @@ 				<tr> 					<td class="label">Include filled:</td> 					<td>-						<input type="checkbox" name="showall" <? if($_GET['showall']) {?>checked="checked"<? } ?> />+						<input type="checkbox" name="showall" <? if(isset($_GET['showall'])) {?>checked="checked"<? } ?> /> 					</td> 				</tr> <?		} ?> @@ -125,7 +129,7 @@ 	<div class="linkbox"> <? //----------------------------------------------------		echo get_pages('requests.php',(int)$_GET['page'],$this->Results,REQUESTS_PER_PAGE,$this->URL,true, 11);+		echo get_pages('requests.php',( isset($_GET['page']) ? intval($_GET['page']) : 0 ),$this->Results,REQUESTS_PER_PAGE,$this->URL,true, 11); //------------------------------------------------------- ?> 	</div>@@ -135,11 +139,13 @@ 		// The actual table of requests 		 		global $DB, $LoggedUser;-		$URL = '&search='.urlencode($_GET['search']).'&tag='.urlencode($_GET['tag']).'&tags='.urlencode($_GET['tags']);-		if($_GET['showall']){+		$URL =  ( isset($_GET['search']) ? '&search=' . urlencode($_GET['search']) : '' ).+				( isset($_GET['tag']) ? '&tag=' . urlencode($_GET['tag']) : '' ).+				( isset($_GET['tags']) ? '&tags=' . urlencode($_GET['tags']) : '' );+		if(isset($_GET['showall'])){ 			$URL.='&showall=on'; 		}-		if($_GET['type']){+		if(isset($_GET['type'])){ 			$URL .= '&type='.urlencode($_GET['type']); 		} ?>@@ -250,7 +256,7 @@ 	<div class="linkbox"> <? //----------------------------------------------------		echo get_pages('requests.php',(int)$_GET['page'],$this->Results,REQUESTS_PER_PAGE,$this->URL,true, 11);+		echo get_pages('requests.php',( isset($_GET['page']) ? intval($_GET['page']) : 0 ),$this->Results,REQUESTS_PER_PAGE,$this->URL,true, 11); //-------------------------------------------------------- ?> 	</div>Index: classes/class_text.php===================================================================--- classes/class_text.php	(revision 18)+++ classes/class_text.php	(working copy)@@ -213,7 +213,7 @@ 		$CloseTags = count($Matches['0']);  		// Number of tags that were opened and never closed-		$UnClosedTagsTags = $OpenTags - $CloseTags;+		$UnClosedTags = $OpenTags - $CloseTags;  		//Add close blockquote tag at the end, if need be 		for($i = 0; $i < $UnClosedTags; $i++) {Index: classes/class_validate.php===================================================================--- classes/class_validate.php	(revision 18)+++ classes/class_validate.php	(working copy)@@ -12,13 +12,13 @@ 		$this->Fields[$FieldName]['Type']=strtolower($FieldType); 		$this->Fields[$FieldName]['Required']=$Required; 		$this->Fields[$FieldName]['ErrorMessage']=$ErrorMessage;-		$this->Fields[$FieldName]['MaxLength']=$Options['maxlength'];-		$this->Fields[$FieldName]['MinLength']=$Options['minlength'];-		$this->Fields[$FieldName]['CompareField']=$Options['comparefield'];-		$this->Fields[$FieldName]['AllowPeriod']=$Options['allowperiod'];-		$this->Fields[$FieldName]['AllowComma']=$Options['allowcomma'];-		$this->Fields[$FieldName]['InArray']=$Options['inarray'];-		$this->Fields[$FieldName]['Regex']=$Options['regex'];+		$this->Fields[$FieldName]['MaxLength']=( isset($Options['maxlength']) ? $Options['maxlength'] : '' );+		$this->Fields[$FieldName]['MinLength']=( isset($Options['minlength']) ? $Options['minlength'] : '' );+		$this->Fields[$FieldName]['CompareField']=( isset($Options['comparefield']) ? $Options['comparefield'] : '' );+		$this->Fields[$FieldName]['AllowPeriod']=( isset($Options['allowperiod']) ? $Options['allowperiod'] : '' );+		$this->Fields[$FieldName]['AllowComma']=( isset($Options['allowcomma']) ? $Options['allowcomma'] : '' );+		$this->Fields[$FieldName]['InArray']=( isset($Options['inarray']) ? $Options['inarray'] : '' );+		$this->Fields[$FieldName]['Regex']=( isset($Options['regex']) ? $Options['regex'] : '' ); 	}  	function ValidateForm($ValidateArray) {Index: classes/config.template===================================================================--- classes/config.template	(revision 18)+++ classes/config.template	(working copy)@@ -7,7 +7,7 @@ define('SSL_STATIC_SERVER','static/'); // Same as NONSSL_STATIC_SERVER if you don't use SSL  // You shouldn't have to fuck around with this section-if (!$_SERVER['HTTPS']) {+if (!isset($_SERVER['HTTPS'])) {         define('SITE_URL',NONSSL_SITE_URL);         define('STATIC_SERVER',NONSSL_STATIC_SERVER); } else {Index: classes/script_start.php===================================================================--- classes/script_start.php	(revision 18)+++ classes/script_start.php	(working copy)@@ -39,9 +39,9 @@ ///////////////////////////////////////////////////////////////////////////////////// //-- Load user information ---------------------------------------------------------- -if ($_SESSION['logged_user']!='') {+if (!empty($_SESSION['logged_user'])) { 	// Update user data every 15 minutes-	if ($_SESSION['logged_user']['last_update']<gmmktime()-(60*15) || $_SESSION['logged_user']['last_update']=='') {+	if ($_SESSION['logged_user']['last_update']<gmmktime()-(60*15) || empty($_SESSION['logged_user']['last_update'])) { 		update_user_data(); 	} 	$LoggedUser=$_SESSION['logged_user'];@@ -50,11 +50,11 @@ 		update_ip(); 	} 	// Update short term user data every 3 minutes-	if ($_SESSION['logged_user']['last_short_update']<gmmktime()-(60*3) || $_SESSION['logged_user']['last_short_update']=='') {+	if (isset($_SESSION['logged_user']['last_short_update']) && $_SESSION['logged_user']['last_short_update']<gmmktime()-(60*3) || empty($_SESSION['logged_user']['last_short_update'])) { 		update_short_term_data(); 	} -} elseif ($_COOKIE['keeplogged']!="") {+} elseif (!empty($_COOKIE['keeplogged'])) { 	$LoginCookie=decrypt($_COOKIE['keeplogged']);  	$LoginCookie=explode("|~|",decrypt($LoginCookie));@@ -128,7 +128,7 @@ 	$LoggedUser = $DB->next_record(MYSQLI_ASSOC, array('Permissions', 'CustomPermissions', 'SiteOptions')); 	 	// Cookie management-	if ($_COOKIE['keeplogged']!='') {+	if (!empty($_COOKIE['keeplogged'])) { 		$LoginCookie=decrypt($_COOKIE['keeplogged']); 		$LoginCookie=explode("|~|",decrypt($LoginCookie)); 		$CookieID = $LoginCookie[2];@@ -176,7 +176,7 @@ 	 	custom_permissions(); -	if($LoggedUser['Permissions']['site_torrents_notify']) {+	if(isset($LoggedUser['Permissions']['site_torrents_notify'])) { 		$DB->query("SELECT ID, Label FROM users_notify_filters WHERE UserID='$LoggedUser[ID]'"); 		$LoggedUser['Notify'] = $DB->to_array('ID'); 	}@@ -349,7 +349,7 @@ 	if($PageTitle!='') { $PageTitle.=' :: '; } 	$PageTitle .= SITE_NAME; -	if (!is_array($_SESSION['logged_user'])) { include(SERVER_ROOT.'/design/publicheader.php'); }+	if (empty($_SESSION['logged_user']) || !is_array($_SESSION['logged_user'])) { include(SERVER_ROOT.'/design/publicheader.php'); } 	else { include(SERVER_ROOT.'/design/privateheader.php'); } } @@ -364,7 +364,7 @@ /**************************************************************************/ function show_footer($Options=array()) { 	global $ScriptStartTime, $LoggedUser;-	if (!is_array($_SESSION['logged_user'])) { include(SERVER_ROOT.'/design/publicfooter.php'); }+	if (empty($_SESSION['logged_user']) || !is_array($_SESSION['logged_user'])) { include(SERVER_ROOT.'/design/publicfooter.php'); } 	else { include(SERVER_ROOT.'/design/privatefooter.php'); } } @@ -600,6 +600,8 @@ 		eg. If there are 20 pages that exist, but $ShowPages is only 11, only 11 links will be shown. 	//----------------------------------------------------------------------------*/ 	$StartPage=ceil($StartPage);+	$TotalPages=0;+	$Pages=''; 	if ($StartPage==0) { $StartPage=1; }  	if ($TotalRecords>0) {@@ -664,10 +666,11 @@ 	$Headers.='Content-type: '.$ContentType.'; charset=iso-8859-1'."\r\n"; 	$Headers.='From: '.SITE_URL.' <'.$From.'@'.SITE_URL.'>'."\r\n"; 	$Headers.='Reply-To: '.$From.'@'.SITE_URL."\r\n";-	mail($To,$Subject,$Body,$Headers,"-f ".$From."@".SITE_URL);+	return @mail($To,$Subject,$Body,$Headers,"-f ".$From."@".SITE_URL); }  function get_size($Size) {+	$Steps=0; 	while($Size>=1024) { 		$Steps++; 		$Size=$Size/1024;@@ -718,9 +721,9 @@ 	if ($Day>$Days || $Day=="" || $Days=="" || $Month=="" || $Year=="" || strlen($Year)<4) { return false; } else { return true; } } -function db_string($Str, $DisablUTF8 = false) {+function db_string($Str, $DisableUTF8 = false) { 	global $DB;-	if(!$DisableUTF8) {+	if($DisableUTF8) { 		return $DB->escape_str(trim(make_utf8($Str))); 	} 	else {@@ -838,6 +841,7 @@  function make_secret() { 	$Chars='abcdefghijklmnopqrstuvwxyz0123456789';+	$Secret = ''; 	for($i=0; $i<32; $i++) { 		$rand = mt_rand(0, strlen($Chars)-1); 		$Secret.= substr($Chars, $rand, 1);@@ -1092,7 +1096,7 @@  // Check to see if a user has the permission to perform an action function check_perms($PermissionName,$MinClass = 0) {-	if ($_SESSION['logged_user']['Permissions'][$PermissionName] && $_SESSION['logged_user']['Class']>=$MinClass) { return true; } else { return false; }+	if (isset($_SESSION['logged_user']['Permissions'][$PermissionName]) && $_SESSION['logged_user']['Class']>=$MinClass) { return true; } else { return false; } }  /*-- error function ------------------------------------------------------*/@@ -1122,7 +1126,7 @@ //-- Bit of code that actually generates the displayed page -------------------------  -if($_GLOBALS['DOCUMENT_NAME']) {+if(isset($_GLOBALS['DOCUMENT_NAME'])) { 	$Document = $_GLOBALS['DOCUMENT_NAME']; }else { 	$Path=$_SERVER['PHP_SELF'];Index: design/privatefooter.php===================================================================--- design/privatefooter.php	(revision 18)+++ design/privatefooter.php	(working copy)@@ -1,6 +1,6 @@ </div> <div id="footer">-<? if ($Options['disclaimer']) { ?>+<? if (isset($Options['disclaimer'])) { ?> 	<br /><br /> 	<div id="disclaimer_container" class="thin" style="text-align:center; margin-bottom:20px;"> 		None of the files shown here are actually hosted on this server. The links are provided solely by this site's users. These BitTorrent files are meant for the distribution of backup files. By downloading the BitTorrent file, you are claiming that you own the original file. The administrator of this site (http://<?=NONSSL_SITE_URL?>) holds NO RESPONSIBILITY if these files are misused in any way and cannot be held responsible for what its users post, or any other actions of it.@@ -25,7 +25,7 @@ } ?> 		<a href="http://en.wikipedia.org/wiki/Load_(computing)" target="_blank">Load average</a>:-		<?= ucfirst($Load[1]) ?>+		<?= ( isset($Load[1]) ? ucfirst($Load[1]) : 'unavailable' ) ?> 		<br /> 		(Average over 1 minute, 5 minutes and 15 minutes <?		if(is_numeric($Cores)){ ?> on <?=$Cores?> cores<? } ?>. Load is spiked by <a href="http://en.wikipedia.org/wiki/Cron" target="_blank">cron</a> every 15 minutes.)@@ -38,7 +38,7 @@ 	<table cellpadding="5" cellspacing="1" border="0" class="datatable_cellborder" width="100%" id="footerQueryList"> <? 	if(is_array($GLOBALS['queries'])) {-		if($LoggedUser['ShowQueryList']) { $SwapText="(Hide)"; } else { $SwapText="(Show)"; }+		if(isset($LoggedUser['ShowQueryList'])) { $SwapText="(Hide)"; } else { $SwapText="(Show)"; } ?> 		<tr> 			<td colspan="2" class="datatable_header" align="left"><strong><a href="#" onclick="return toggleDisplay('footerQuery',{masterElem: this, showText: '(Show)', hideText: '(Hide)', prefixParent: 'footerQueryList', prefixElemType: 'tr'})"><?=$SwapText?></a> <?=number_format(count($GLOBALS['queries']))?> querie(s) ran in <?=number_format($GLOBALS['querytime'],5)?> seconds (<?=number_format($GLOBALS['querytime']/count($GLOBALS['queries']),5)?>/seconds per query average)</strong></td>@@ -49,7 +49,7 @@ 		while(list($QueriesKey,$Queries)=each($GLOBALS['queries'])) { 			if ($x%2==0) { $Class="datatable_rowa"; } else { $Class="datatable_rowb"; } ?>-		<tr valign="top" class="footerQuery <? if(!$LoggedUser['ShowQueryList']) { ?>hide<? }?>">+		<tr valign="top" class="footerQuery <? if(!isset($LoggedUser['ShowQueryList'])) { ?>hide<? }?>"> 			<td class="<?=$Class?>" align="left"><pre><?=str_replace("\t", '    ', display_str($Queries['sql']))?></pre></td> 			<td class="<?=$Class?>" style="width:130px;" align="left"><?=number_format($Queries['time'],5)?> second(s)</td> 		</tr>@@ -65,12 +65,12 @@ 	}  	if($Cache) {-		if($LoggedUser['ShowCacheList']) { $SwapText="(Hide)"; } else { $SwapText="(Show)"; }+		if(isset($LoggedUser['ShowCacheList'])) { $SwapText="(Hide)"; } else { $SwapText="(Show)"; } ?> 		<tr> 			<td colspan="2" class="datatable_header" align="left"><strong><a href="#" id="footerCacheLink" onclick="return toggleDisplay('footerCacheList',{masterElem: this, showText: '(Show)',hideText: '(Hide)'})"><?=$SwapText?></a> Cached values:</strong></td> 		</tr>-		<tr id="footerCacheList" <? if(!$LoggedUser['ShowCacheList']) { ?>class="hide"<? } ?>>+		<tr id="footerCacheList" <? if(!isset($LoggedUser['ShowCacheList'])) { ?>class="hide"<? } ?>> 			<td colspan="2" align="left"> 				<pre><?=htmlspecialchars($Cache->dump())?></pre> 			</td>Index: design/privateheader.php===================================================================--- design/privateheader.php	(revision 18)+++ design/privateheader.php	(working copy)@@ -1,7 +1,7 @@ <? global $Document; global $Cache;-define(FOOTER_FILE, SERVER_ROOT.'/design/privatefooter.php');+if(!defined('FOOTER_FILE'))define('FOOTER_FILE', SERVER_ROOT.'/design/privatefooter.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">@@ -15,7 +15,7 @@ 	<link rel="search" type="application/opensearchdescription+xml" title="<?=SITE_NAME?> - Log" href="/opensearch_log.xml" /> 	<link rel="search" type="application/opensearchdescription+xml" title="<?=SITE_NAME?> - Users" href="/opensearch_users.xml" /> 	<link rel="alternate" type="application/rss+xml" href="/feeds.php?feed=torrents_notify_<?=$LoggedUser['torrent_pass']?>&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - P.T.N." />-<? if($LoggedUser['Notify']) {+<? if(isset($LoggedUser['Notify'])) { 	while(list($K, list($FilterID, $FilterName)) = each ($LoggedUser['Notify'])){ ?> 	<link rel="alternate" type="application/rss+xml" href="/feeds.php?feed=torrents_notify_<?=$FilterID?>_<?=$LoggedUser['torrent_pass']?>&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;name=<?=urlencode($FilterName)?>" title="<?=SITE_NAME?> - <?=display_str($FilterName)?>" /> <? 	}@@ -33,7 +33,7 @@ 	<link rel="alternate" type="application/rss+xml" href="/feeds.php?feed=torrents_vinyl&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - Vinyl Sourced Torrents" /> 	<link rel="alternate" type="application/rss+xml" href="/feeds.php?feed=torrents_lossless&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - Lossless Torrents" /> 	<link rel="alternate" type="application/rss+xml" href="/feeds.php?feed=torrents_lossless24&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" title="<?=SITE_NAME?> - 24bit Lossless Torrents" />-<? if (!$LoggedUser['StyleURL']) { ?>+<? if (empty($LoggedUser['StyleURL'])) { ?> 	<link href="<?=STATIC_SERVER?>styles/<?= $LoggedUser['StyleName'] ?>/style.css" title="<?=$LoggedUser['StyleName']?>" rel="stylesheet" type="text/css" media="screen" /> <? } else { ?> 	<link href="<?=$LoggedUser['StyleURL']?>" title="External CSS" rel="stylesheet" type="text/css" media="screen" />@@ -44,7 +44,7 @@ <? //-- Include any javascript files sent to show_header() --------------- -$Scripts=explode(',',$JSIncludes);+$Scripts=( !empty($JSIncludes) ? explode(',',$JSIncludes) : array() ); while(list($ScriptKey,$ScriptVal)=each($Scripts)) { 	if ($ScriptVal!='') { ?>@@ -185,7 +185,7 @@ 	</div> 	<div id="searchbars"> 		<ul>-<? if ($LoggedUser['SearchType']) { // Advanced search ?> +<? if (isset($LoggedUser['SearchType'])) { // Advanced search ?>  			<li> 				<span class="hidden">Torrent/Album Name: </span> 				<form action="torrents.php?action=advanced" method="get">@@ -210,7 +210,7 @@ 				</form> 			</li> <? } ?> -<? if ($LoggedUser['ArtistNoRedirect'] && check_perms('site_advanced_search')) { // Just send the user to the advanced search page ?> +<? if (isset($LoggedUser['ArtistNoRedirect']) && check_perms('site_advanced_search')) { // Just send the user to the advanced search page ?>  			<li> 				<span class="hidden">Artist: </span> 				<form action="torrents.php?action=advanced" method="get">Index: design/publicfooter.php===================================================================--- design/publicfooter.php	(revision 18)+++ design/publicfooter.php	(working copy)@@ -1,6 +1,6 @@ 		</td> 	</tr>-<? if (DEBUG_MODE) { ?>+<? if (defined('DEBUG_MODE')) { ?> 	<tr> 		<td> 			<table cellpadding="5" cellspacing="1" border="0" class="datatable_cellborder" width="100%">Index: design/publicheader.php===================================================================--- design/publicheader.php	(revision 18)+++ design/publicheader.php	(working copy)@@ -1,6 +1,7 @@ <? global $LoggedUser;-define(FOOTER_FILE,SERVER_ROOT.'/design/publicfooter.php');+if(!defined('SERVER_ROOT'))define('SERVER_ROOT','.');+if(!defined('FOOTER_FILE'))define('FOOTER_FILE', SERVER_ROOT.'/design/privatefooter.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">@@ -15,7 +16,7 @@ <? //-- Include any javascript files sent to ShowHeader() ---------------- -$Scripts=explode(',',$JSIncludes);+$Scripts=( !empty($JSIncludes) ? explode(',',$JSIncludes) : array() ); while(list($ScriptKey,$ScriptVal)=each($Scripts)) { 	if ($ScriptVal!='') { ?>@@ -34,7 +35,7 @@ 			<div id="logo"> 				<a href="index.php">Home</a> 				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="login.php">Login</a>-<? if(OPEN_REGISTRATION){ ?> +<? if(defined('OPEN_REGISTRATION')){ ?>  				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="register.php">Register</a> <? } ?>  			</div>\ No newline at end of fileIndex: gazelle.sql===================================================================--- gazelle.sql	(revision 18)+++ gazelle.sql	(working copy)@@ -198,11 +198,9 @@ -- Dumping data for table `forums` -- -LOCK TABLES `forums` WRITE; /*!40000 ALTER TABLE `forums` DISABLE KEYS */; INSERT INTO `forums` VALUES (1,1,'Staff','Staff-only forum',700,700,700,0,0,0,0,0,'0000-00-00 00:00:00'),(2,20,'Chat','General discussion',100,100,100,0,0,0,0,0,'0000-00-00 00:00:00'),(3,100,'Trash','Because you\'re not special and we don\'t love you!',100,700,700,0,0,0,0,0,'0000-00-00 00:00:00'); /*!40000 ALTER TABLE `forums` ENABLE KEYS */;-UNLOCK TABLES;   --@@ -339,12 +337,11 @@ -- Dumping data for table `kb` -- -LOCK TABLES `kb` WRITE; /*!40000 ALTER TABLE `kb` DISABLE KEYS */; INSERT INTO `kb` VALUES (1,'Welcome to the knowledgebase','<div class=\"box pad\">\n			<ul class=\"stats nobullet\">\n				<li> <strong>Revision:</strong> 1 \n \n					<strong>(top)</strong>\n \n				</li>\n				<li> <strong>Last Edited:</strong> by <a href=\"user.php?id=1\">WhatMan</a> on 2008-07-24 07:29:37 </li>\n			</ul>\n		</div>\n	</div>\n	<div class=\"main_column\">\n		<div class=\"box\">\n				<div class=\"head\">Welcome to the knowledgebase</div>\n				<div class=\"pad\">\nThis will be filled up with information soon  <img border=\'0\' src=\'static/common/smileys/smile.gif\' alt=\'\' />\n		</div>\n	</div>\n	</div>'); /*!40000 ALTER TABLE `kb` ENABLE KEYS */;-UNLOCK TABLES; + -- -- Table structure for table `kb_dead_links` --@@ -392,12 +389,11 @@ -- Dumping data for table `kb_revisions` -- -LOCK TABLES `kb_revisions` WRITE; /*!40000 ALTER TABLE `kb_revisions` DISABLE KEYS */; INSERT INTO `kb_revisions` VALUES (1,1,'2008-07-24 07:29:37',1,'Welcome to the knowledgebase','This will be filled up with information soon  :)',0,'Created article'); /*!40000 ALTER TABLE `kb_revisions` ENABLE KEYS */;-UNLOCK TABLES; + -- -- Table structure for table `kb_search` --@@ -414,12 +410,11 @@ -- Dumping data for table `kb_search` -- -LOCK TABLES `kb_search` WRITE; /*!40000 ALTER TABLE `kb_search` DISABLE KEYS */; INSERT INTO `kb_search` VALUES (1,'Welcome to the knowledgebase This will be filled up with information soon'); /*!40000 ALTER TABLE `kb_search` ENABLE KEYS */;-UNLOCK TABLES; + -- -- Table structure for table `log` --@@ -472,11 +467,9 @@ -- Dumping data for table `news` -- -LOCK TABLES `news` WRITE; /*!40000 ALTER TABLE `news` DISABLE KEYS */; INSERT INTO `news` VALUES (1,1,'Welcome to your new Gazelle installation','Please read the documentation in /docs to find out how to complete the installation!','2008-07-24 07:29:14'); /*!40000 ALTER TABLE `news` ENABLE KEYS */;-UNLOCK TABLES;  -- -- Table structure for table `permissions`@@ -497,11 +490,9 @@ -- Dumping data for table `permissions` -- -LOCK TABLES `permissions` WRITE; /*!40000 ALTER TABLE `permissions` DISABLE KEYS */; INSERT INTO `permissions` VALUES (1,900,'Administrator','a:75:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:25:\"site_submit_requests_free\";s:1:\"1\";s:21:\"site_see_old_requests\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:10:\"site_top10\";s:1:\"1\";s:20:\"site_torrents_notify\";s:1:\"1\";s:19:\"site_advanced_top10\";s:1:\"1\";s:19:\"site_make_bookmarks\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";s:23:\"site_edit_knowledgebase\";s:1:\"1\";s:22:\"site_can_invite_always\";s:1:\"1\";s:27:\"site_send_unlimited_invites\";s:1:\"1\";s:22:\"site_moderate_requests\";s:1:\"1\";s:18:\"site_delete_artist\";s:1:\"1\";s:20:\"site_moderate_forums\";s:1:\"1\";s:20:\"site_resolve_tickets\";s:1:\"1\";s:18:\"site_tickets_admin\";s:1:\"1\";s:14:\"site_view_flow\";s:1:\"1\";s:18:\"site_view_full_log\";s:1:\"1\";s:28:\"site_view_torrent_snatchlist\";s:1:\"1\";s:18:\"site_recommend_own\";s:1:\"1\";s:27:\"site_manage_recommendations\";s:1:\"1\";s:15:\"site_delete_tag\";s:1:\"1\";s:23:\"site_disable_ip_history\";s:1:\"1\";s:22:\"site_no_access_logging\";s:1:\"1\";s:20:\"users_edit_usernames\";s:1:\"1\";s:16:\"users_edit_ratio\";s:1:\"1\";s:20:\"users_edit_own_ratio\";s:1:\"1\";s:17:\"users_edit_titles\";s:1:\"1\";s:18:\"users_edit_avatars\";s:1:\"1\";s:18:\"users_edit_invites\";s:1:\"1\";s:22:\"users_edit_watch_hours\";s:1:\"1\";s:21:\"users_edit_reset_keys\";s:1:\"1\";s:19:\"users_edit_profiles\";s:1:\"1\";s:20:\"users_reset_own_keys\";s:1:\"1\";s:19:\"users_edit_password\";s:1:\"1\";s:19:\"users_promote_below\";s:1:\"1\";s:16:\"users_promote_to\";s:1:\"1\";s:16:\"users_give_donor\";s:1:\"1\";s:10:\"users_warn\";s:1:\"1\";s:19:\"users_disable_users\";s:1:\"1\";s:19:\"users_disable_posts\";s:1:\"1\";s:17:\"users_disable_any\";s:1:\"1\";s:18:\"users_delete_users\";s:1:\"1\";s:18:\"users_view_invites\";s:1:\"1\";s:20:\"users_view_seedleech\";s:1:\"1\";s:19:\"users_view_uploaded\";s:1:\"1\";s:15:\"users_view_keys\";s:1:\"1\";s:14:\"users_view_ips\";s:1:\"1\";s:16:\"users_view_email\";s:1:\"1\";s:14:\"users_view_pms\";s:1:\"1\";s:23:\"users_override_paranoia\";s:1:\"1\";s:9:\"users_mod\";s:1:\"1\";s:13:\"torrents_edit\";s:1:\"1\";s:15:\"torrents_delete\";s:1:\"1\";s:18:\"torrents_freeleech\";s:1:\"1\";s:17:\"admin_manage_news\";s:1:\"1\";s:18:\"admin_manage_polls\";s:1:\"1\";s:19:\"admin_manage_forums\";s:1:\"1\";s:16:\"admin_manage_fls\";s:1:\"1\";s:13:\"admin_reports\";s:1:\"1\";s:19:\"admin_watched_users\";s:1:\"1\";s:26:\"admin_advanced_user_search\";s:1:\"1\";s:18:\"admin_create_users\";s:1:\"1\";s:25:\"admin_search_duplicate_ip\";s:1:\"1\";s:15:\"admin_donor_log\";s:1:\"1\";s:19:\"admin_manage_ipbans\";s:1:\"1\";s:9:\"admin_dnu\";s:1:\"1\";s:17:\"admin_clear_cache\";s:1:\"1\";s:15:\"admin_whitelist\";s:1:\"1\";s:16:\"admin_access_log\";s:1:\"1\";s:17:\"admin_login_watch\";s:1:\"1\";}','1'),(2,100,'User','a:5:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";}',''),(3,150,'Member','a:7:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:19:\"site_make_bookmarks\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";}',''),(4,200,'Power User','a:9:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:10:\"site_top10\";s:1:\"1\";s:20:\"site_torrents_notify\";s:1:\"1\";s:19:\"site_make_bookmarks\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";}',''),(5,250,'Elite','a:10:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:10:\"site_top10\";s:1:\"1\";s:20:\"site_torrents_notify\";s:1:\"1\";s:19:\"site_advanced_top10\";s:1:\"1\";s:19:\"site_make_bookmarks\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";}',''),(6,475,'VIP','a:14:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:25:\"site_submit_requests_free\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:10:\"site_top10\";s:1:\"1\";s:20:\"site_torrents_notify\";s:1:\"1\";s:19:\"site_advanced_top10\";s:1:\"1\";s:19:\"site_make_bookmarks\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";s:23:\"site_edit_knowledgebase\";s:1:\"1\";s:22:\"site_can_invite_always\";s:1:\"1\";s:27:\"site_send_unlimited_invites\";s:1:\"1\";}',''),(7,300,'TorrentMaster','a:13:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:25:\"site_submit_requests_free\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:10:\"site_top10\";s:1:\"1\";s:20:\"site_torrents_notify\";s:1:\"1\";s:19:\"site_advanced_top10\";s:1:\"1\";s:19:\"site_make_bookmarks\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";s:23:\"site_edit_knowledgebase\";s:1:\"1\";s:22:\"site_can_invite_always\";s:1:\"1\";}',''),(8,400,'Legend','a:14:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:25:\"site_submit_requests_free\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:10:\"site_top10\";s:1:\"1\";s:20:\"site_torrents_notify\";s:1:\"1\";s:19:\"site_advanced_top10\";s:1:\"1\";s:19:\"site_make_bookmarks\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";s:23:\"site_edit_knowledgebase\";s:1:\"1\";s:22:\"site_can_invite_always\";s:1:\"1\";s:27:\"site_send_unlimited_invites\";s:1:\"1\";}',''),(9,551,'Torrent Celebrity','a:15:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:25:\"site_submit_requests_free\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:10:\"site_top10\";s:1:\"1\";s:20:\"site_torrents_notify\";s:1:\"1\";s:19:\"site_advanced_top10\";s:1:\"1\";s:19:\"site_make_bookmarks\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";s:23:\"site_edit_knowledgebase\";s:1:\"1\";s:22:\"site_can_invite_always\";s:1:\"1\";s:27:\"site_send_unlimited_invites\";s:1:\"1\";s:15:\"site_delete_tag\";s:1:\"1\";}',''),(11,700,'Moderator','a:65:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:25:\"site_submit_requests_free\";s:1:\"1\";s:21:\"site_see_old_requests\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:10:\"site_top10\";s:1:\"1\";s:20:\"site_torrents_notify\";s:1:\"1\";s:19:\"site_advanced_top10\";s:1:\"1\";s:19:\"site_make_bookmarks\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";s:23:\"site_edit_knowledgebase\";s:1:\"1\";s:22:\"site_can_invite_always\";s:1:\"1\";s:27:\"site_send_unlimited_invites\";s:1:\"1\";s:22:\"site_moderate_requests\";s:1:\"1\";s:18:\"site_delete_artist\";s:1:\"1\";s:20:\"site_moderate_forums\";s:1:\"1\";s:20:\"site_resolve_tickets\";s:1:\"1\";s:18:\"site_tickets_admin\";s:1:\"1\";s:14:\"site_view_flow\";s:1:\"1\";s:18:\"site_view_full_log\";s:1:\"1\";s:28:\"site_view_torrent_snatchlist\";s:1:\"1\";s:18:\"site_recommend_own\";s:1:\"1\";s:27:\"site_manage_recommendations\";s:1:\"1\";s:15:\"site_delete_tag\";s:1:\"1\";s:23:\"site_disable_ip_history\";s:1:\"1\";s:22:\"site_no_access_logging\";s:1:\"1\";s:20:\"users_edit_own_ratio\";s:1:\"1\";s:17:\"users_edit_titles\";s:1:\"1\";s:18:\"users_edit_avatars\";s:1:\"1\";s:18:\"users_edit_invites\";s:1:\"1\";s:22:\"users_edit_watch_hours\";s:1:\"1\";s:21:\"users_edit_reset_keys\";s:1:\"1\";s:19:\"users_edit_profiles\";s:1:\"1\";s:20:\"users_reset_own_keys\";s:1:\"1\";s:19:\"users_edit_password\";s:1:\"1\";s:19:\"users_promote_below\";s:1:\"1\";s:16:\"users_give_donor\";s:1:\"1\";s:10:\"users_warn\";s:1:\"1\";s:19:\"users_disable_users\";s:1:\"1\";s:19:\"users_disable_posts\";s:1:\"1\";s:17:\"users_disable_any\";s:1:\"1\";s:18:\"users_view_invites\";s:1:\"1\";s:20:\"users_view_seedleech\";s:1:\"1\";s:19:\"users_view_uploaded\";s:1:\"1\";s:15:\"users_view_keys\";s:1:\"1\";s:14:\"users_view_ips\";s:1:\"1\";s:16:\"users_view_email\";s:1:\"1\";s:14:\"users_view_pms\";s:1:\"1\";s:23:\"users_override_paranoia\";s:1:\"1\";s:9:\"users_mod\";s:1:\"1\";s:13:\"torrents_edit\";s:1:\"1\";s:15:\"torrents_delete\";s:1:\"1\";s:18:\"torrents_freeleech\";s:1:\"1\";s:13:\"admin_reports\";s:1:\"1\";s:19:\"admin_watched_users\";s:1:\"1\";s:26:\"admin_advanced_user_search\";s:1:\"1\";s:25:\"admin_search_duplicate_ip\";s:1:\"1\";s:15:\"admin_donor_log\";s:1:\"1\";s:19:\"admin_manage_ipbans\";s:1:\"1\";s:9:\"admin_dnu\";s:1:\"1\";s:17:\"admin_clear_cache\";s:1:\"1\";s:16:\"admin_access_log\";s:1:\"1\";s:17:\"admin_login_watch\";s:1:\"1\";}','1'),(14,800,'Developer','a:66:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:25:\"site_submit_requests_free\";s:1:\"1\";s:21:\"site_see_old_requests\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:10:\"site_top10\";s:1:\"1\";s:20:\"site_torrents_notify\";s:1:\"1\";s:19:\"site_advanced_top10\";s:1:\"1\";s:19:\"site_make_bookmarks\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";s:23:\"site_edit_knowledgebase\";s:1:\"1\";s:22:\"site_can_invite_always\";s:1:\"1\";s:27:\"site_send_unlimited_invites\";s:1:\"1\";s:22:\"site_moderate_requests\";s:1:\"1\";s:18:\"site_delete_artist\";s:1:\"1\";s:20:\"site_moderate_forums\";s:1:\"1\";s:20:\"site_resolve_tickets\";s:1:\"1\";s:18:\"site_tickets_admin\";s:1:\"1\";s:14:\"site_view_flow\";s:1:\"1\";s:18:\"site_view_full_log\";s:1:\"1\";s:28:\"site_view_torrent_snatchlist\";s:1:\"1\";s:18:\"site_recommend_own\";s:1:\"1\";s:27:\"site_manage_recommendations\";s:1:\"1\";s:15:\"site_delete_tag\";s:1:\"1\";s:23:\"site_disable_ip_history\";s:1:\"1\";s:10:\"site_debug\";s:1:\"1\";s:16:\"users_edit_ratio\";s:1:\"1\";s:20:\"users_edit_own_ratio\";s:1:\"1\";s:17:\"users_edit_titles\";s:1:\"1\";s:18:\"users_edit_avatars\";s:1:\"1\";s:18:\"users_edit_invites\";s:1:\"1\";s:22:\"users_edit_watch_hours\";s:1:\"1\";s:21:\"users_edit_reset_keys\";s:1:\"1\";s:19:\"users_edit_profiles\";s:1:\"1\";s:20:\"users_reset_own_keys\";s:1:\"1\";s:19:\"users_edit_password\";s:1:\"1\";s:19:\"users_promote_below\";s:1:\"1\";s:10:\"users_warn\";s:1:\"1\";s:19:\"users_disable_users\";s:1:\"1\";s:17:\"users_disable_any\";s:1:\"1\";s:18:\"users_delete_users\";s:1:\"1\";s:18:\"users_view_invites\";s:1:\"1\";s:20:\"users_view_seedleech\";s:1:\"1\";s:19:\"users_view_uploaded\";s:1:\"1\";s:15:\"users_view_keys\";s:1:\"1\";s:14:\"users_view_ips\";s:1:\"1\";s:16:\"users_view_email\";s:1:\"1\";s:23:\"users_override_paranoia\";s:1:\"1\";s:9:\"users_mod\";s:1:\"1\";s:13:\"torrents_edit\";s:1:\"1\";s:15:\"torrents_delete\";s:1:\"1\";s:18:\"torrents_freeleech\";s:1:\"1\";s:17:\"admin_manage_news\";s:1:\"1\";s:13:\"admin_reports\";s:1:\"1\";s:19:\"admin_watched_users\";s:1:\"1\";s:26:\"admin_advanced_user_search\";s:1:\"1\";s:18:\"admin_create_users\";s:1:\"1\";s:25:\"admin_search_duplicate_ip\";s:1:\"1\";s:19:\"admin_manage_ipbans\";s:1:\"1\";s:17:\"admin_clear_cache\";s:1:\"1\";s:15:\"admin_whitelist\";s:1:\"1\";s:16:\"admin_access_log\";s:1:\"1\";s:14:\"admin_schedule\";s:1:\"1\";s:17:\"admin_login_watch\";s:1:\"1\";}','1'),(15,1000,'SysOp','a:78:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:25:\"site_submit_requests_free\";s:1:\"1\";s:21:\"site_see_old_requests\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:10:\"site_top10\";s:1:\"1\";s:20:\"site_torrents_notify\";s:1:\"1\";s:19:\"site_advanced_top10\";s:1:\"1\";s:19:\"site_make_bookmarks\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";s:23:\"site_edit_knowledgebase\";s:1:\"1\";s:22:\"site_can_invite_always\";s:1:\"1\";s:27:\"site_send_unlimited_invites\";s:1:\"1\";s:22:\"site_moderate_requests\";s:1:\"1\";s:18:\"site_delete_artist\";s:1:\"1\";s:20:\"site_moderate_forums\";s:1:\"1\";s:20:\"site_resolve_tickets\";s:1:\"1\";s:18:\"site_tickets_admin\";s:1:\"1\";s:14:\"site_view_flow\";s:1:\"1\";s:18:\"site_view_full_log\";s:1:\"1\";s:28:\"site_view_torrent_snatchlist\";s:1:\"1\";s:18:\"site_recommend_own\";s:1:\"1\";s:27:\"site_manage_recommendations\";s:1:\"1\";s:15:\"site_delete_tag\";s:1:\"1\";s:23:\"site_disable_ip_history\";s:1:\"1\";s:22:\"site_no_access_logging\";s:1:\"1\";s:10:\"site_debug\";s:1:\"1\";s:20:\"users_edit_usernames\";s:1:\"1\";s:16:\"users_edit_ratio\";s:1:\"1\";s:20:\"users_edit_own_ratio\";s:1:\"1\";s:17:\"users_edit_titles\";s:1:\"1\";s:18:\"users_edit_avatars\";s:1:\"1\";s:18:\"users_edit_invites\";s:1:\"1\";s:22:\"users_edit_watch_hours\";s:1:\"1\";s:21:\"users_edit_reset_keys\";s:1:\"1\";s:19:\"users_edit_profiles\";s:1:\"1\";s:20:\"users_reset_own_keys\";s:1:\"1\";s:19:\"users_edit_password\";s:1:\"1\";s:19:\"users_promote_below\";s:1:\"1\";s:16:\"users_promote_to\";s:1:\"1\";s:16:\"users_give_donor\";s:1:\"1\";s:10:\"users_warn\";s:1:\"1\";s:19:\"users_disable_users\";s:1:\"1\";s:19:\"users_disable_posts\";s:1:\"1\";s:17:\"users_disable_any\";s:1:\"1\";s:18:\"users_delete_users\";s:1:\"1\";s:18:\"users_view_invites\";s:1:\"1\";s:20:\"users_view_seedleech\";s:1:\"1\";s:19:\"users_view_uploaded\";s:1:\"1\";s:15:\"users_view_keys\";s:1:\"1\";s:14:\"users_view_ips\";s:1:\"1\";s:16:\"users_view_email\";s:1:\"1\";s:14:\"users_view_pms\";s:1:\"1\";s:23:\"users_override_paranoia\";s:1:\"1\";s:9:\"users_mod\";s:1:\"1\";s:13:\"torrents_edit\";s:1:\"1\";s:15:\"torrents_delete\";s:1:\"1\";s:18:\"torrents_freeleech\";s:1:\"1\";s:17:\"admin_manage_news\";s:1:\"1\";s:18:\"admin_manage_polls\";s:1:\"1\";s:19:\"admin_manage_forums\";s:1:\"1\";s:16:\"admin_manage_fls\";s:1:\"1\";s:13:\"admin_reports\";s:1:\"1\";s:19:\"admin_watched_users\";s:1:\"1\";s:26:\"admin_advanced_user_search\";s:1:\"1\";s:18:\"admin_create_users\";s:1:\"1\";s:25:\"admin_search_duplicate_ip\";s:1:\"1\";s:15:\"admin_donor_log\";s:1:\"1\";s:19:\"admin_manage_ipbans\";s:1:\"1\";s:9:\"admin_dnu\";s:1:\"1\";s:17:\"admin_clear_cache\";s:1:\"1\";s:15:\"admin_whitelist\";s:1:\"1\";s:24:\"admin_manage_permissions\";s:1:\"1\";s:16:\"admin_access_log\";s:1:\"1\";s:14:\"admin_schedule\";s:1:\"1\";s:17:\"admin_login_watch\";s:1:\"1\";}','1'),(16,500,'Beta Team','a:20:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:25:\"site_submit_requests_free\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:10:\"site_top10\";s:1:\"1\";s:20:\"site_torrents_notify\";s:1:\"1\";s:19:\"site_advanced_top10\";s:1:\"1\";s:19:\"site_make_bookmarks\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";s:23:\"site_edit_knowledgebase\";s:1:\"1\";s:22:\"site_can_invite_always\";s:1:\"1\";s:27:\"site_send_unlimited_invites\";s:1:\"1\";s:20:\"site_moderate_forums\";s:1:\"1\";s:20:\"site_resolve_tickets\";s:1:\"1\";s:18:\"site_tickets_admin\";s:1:\"1\";s:15:\"site_delete_tag\";s:1:\"1\";s:13:\"torrents_edit\";s:1:\"1\";s:17:\"admin_clear_cache\";s:1:\"1\";}',''),(19,201,'Artist','a:9:{s:10:\"site_leech\";s:1:\"1\";s:11:\"site_upload\";s:1:\"1\";s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:10:\"site_top10\";s:1:\"1\";s:19:\"site_make_bookmarks\";s:1:\"1\";s:14:\"site_edit_wiki\";s:1:\"1\";s:18:\"site_recommend_own\";s:1:\"1\";}',''),(20,202,'Donor','a:5:{s:9:\"site_vote\";s:1:\"1\";s:20:\"site_submit_requests\";s:1:\"1\";s:20:\"site_advanced_search\";s:1:\"1\";s:10:\"site_top10\";s:1:\"1\";s:20:\"site_torrents_notify\";s:1:\"1\";}',''); /*!40000 ALTER TABLE `permissions` ENABLE KEYS */;-UNLOCK TABLES;  -- -- Table structure for table `pm_conversations`@@ -675,11 +666,9 @@ -- Dumping data for table `schedule` -- -LOCK TABLES `schedule` WRITE; /*!40000 ALTER TABLE `schedule` DISABLE KEYS */; INSERT INTO `schedule` VALUES (15,21,22); /*!40000 ALTER TABLE `schedule` ENABLE KEYS */;-UNLOCK TABLES;  -- -- Table structure for table `stylesheets`@@ -698,11 +687,9 @@ -- Dumping data for table `stylesheets` -- -LOCK TABLES `stylesheets` WRITE; /*!40000 ALTER TABLE `stylesheets` DISABLE KEYS */; INSERT INTO `stylesheets` VALUES (1,'Anorex','Simple and sleek stylesheet by WhatMan','1'),(2,'Layer_Cake','Very purty stylesheet by Emm','0'),(4,'Dark','Quick port of the legendary DarkSpace!','0'),(5,'Kuro','Very sleek and dark theme by Stewy, A9, and WhatMan','0'),(6,'Shiro','Pleasing white theme','0'),(7,'WhatLove','','0'),(8,'BlueBit','A port of the classic BlueBit theme to Gazelle','0'),(9,'Proton','Protieks Proton','0'),(10,'Whatnificent','Whatnificent by Paaskehare','0'),(11,'Hydro','Cooling off on a hot summer day. -A9','0'),(12,'Exec','Exec by Huevoos','0'); /*!40000 ALTER TABLE `stylesheets` ENABLE KEYS */;-UNLOCK TABLES;   --@@ -738,11 +725,9 @@ -- Dumping data for table `ticket_categories` -- -LOCK TABLES `ticket_categories` WRITE; /*!40000 ALTER TABLE `ticket_categories` DISABLE KEYS */; INSERT INTO `ticket_categories` VALUES (1,'BitTorrent'),(2,'Encoding'),(3,'Ripping'),(4,'Windows'),(5,'Mac OS'),(6,'Linux'),(7,'IRC'),(8,'Networking'),(9,'Conflict Resolution'),(10,'Other'),(11,'Website Bugs (Style / Layout)'),(12,'Website Bugs (General)'); /*!40000 ALTER TABLE `ticket_categories` ENABLE KEYS */;-UNLOCK TABLES;  -- -- Table structure for table `ticket_comments`@@ -1401,11 +1386,9 @@ -- Dumping data for table `xbt_client_whitelist` -- -LOCK TABLES `xbt_client_whitelist` WRITE; /*!40000 ALTER TABLE `xbt_client_whitelist` DISABLE KEYS */; INSERT INTO `xbt_client_whitelist` VALUES (1,'-AZ25','Azureus 2.5.x'),(2,'-AZ30','Azureus 3.0.x'),(3,'-BG09','btgdaemon 0.9.x'),(5,'-DE05','Deluge 0.5.x'),(7,'-HL029','Halite 0.2.9.x'),(9,'-KT22','KTorrent 2.2.x'),(10,'-lt0B','libtorrent 0.11.x (rtorrent)'),(25,'-UT180B-','uTorrent 1.8 Beta (7928+)'),(26,'T03','BitTornado 0.3.x'),(28,'-KT21','KTorrent 2.1.x'),(29,'btpd/0.13','btpd 0.13'),(35,'-TR104','Transmission 1.04'),(36,'-CD0302-','Enhanced CTorrent (dnh3.2)'),(37,'-UT1610-','uTorrent 1.6.1'),(38,'-HL030','Halite 0.3.0.x'),(39,'-UT1770-','uTorrent 1.7.7'),(40,'-UT1760-','uTorrent 1.7.6'),(41,'-lt0C','libtorrent 0.12.x (rtorrent)'),(42,'-KT30','KTorrent 3.0.x'),(43,'-lt0A4','libtorrent 0.10.4 (rtorrent)'),(44,'-TR105','Transmission 1.05'),(45,'-TR106','Transmission 1.06'),(46,'-DE06','Deluge 0.6.0 (Dev Builds)'),(47,'-TR11','Transmission 1.1x'),(48,'-TR12','Transmission 1.2x'),(49,'-AZ31','Azureus 3.1'),(50,'-KT31','KT'),(51,'-HL031','Halite 3.1'),(52,'-UT1800-','uTorrent 1.8'); /*!40000 ALTER TABLE `xbt_client_whitelist` ENABLE KEYS */;-UNLOCK TABLES;  -- -- Table structure for table `xbt_config`@@ -1421,13 +1404,10 @@ -- Dumping data for table `xbt_config` -- -LOCK TABLES `xbt_config` WRITE; /*!40000 ALTER TABLE `xbt_config` DISABLE KEYS */; INSERT INTO `xbt_config` VALUES ('announce_interval','1800'),('anonymous_connect','0'),('anonymous_announce','0'),('anonymous_scrape','0'),('auto_register','0'),('clean_up_interval','60'),('daemon','1'),('debug','0'),('gzip_announce','1'),('gzip_debug','0'),('gzip_scrape','1'),('listen_check','1'),('listen_ipa','70.47.114.223'),('listen_port','34000'),('log_access','0'),('log_announce','0'),('log_scrape','0'),('pid_file','xbt_tracker.pid'),('read_config_interval','10'),('read_db_interval','30'),('redirect_url',''),('scrape_interval','1800'),('table_announce_log','xbt_announce_log'),('table_files','torrents'),('table_scrape_log','xbt_scrape_log'),('table_users','users_main'),('update_files_method','2'),('write_db_interval','5'),('column_files_fid','ID'),('column_files_completed','Snatched'),('column_users_uid','ID'),('column_users_torrents_limit','maxtorrents'),('column_users_pass','torrent_pass'),('column_files_seeders','seeders'),('column_files_users_fid','fid'),('column_files_leechers','leechers'),('query_log','query_log.txt'),('read_db_users_interval','1800'),('cheater_speed','26214400'),('table_client_whitelist','xbt_client_whitelist'),('client_whitelist','1'); /*!40000 ALTER TABLE `xbt_config` ENABLE KEYS */;-UNLOCK TABLES; - -- -- Table structure for table `xbt_deny_from_hosts` --Index: install/index.php===================================================================--- install/index.php	(revision 18)+++ install/index.php	(working copy)@@ -11,6 +11,7 @@  function make_secret($Len=32, $Safe = false) { 	$Chars='abcdefghijklmnopqrstuvwxyz0123456789';+	$Secret=''; 	if(!$Safe){ 		$Chars.='ABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*(){}[]?+=,.<>;:'; 	}Index: install/install.php===================================================================--- install/install.php	(revision 18)+++ install/install.php	(working copy)@@ -4,7 +4,7 @@ define('SERVER_ROOT', $ServerRoot); define('STATIC_SERVER', $Directory.'/static/'); //$_SESSION['hi'] = 'hi';-print_r($_SESSION);+//print_r($_SESSION);  if($_POST){ 	$Options = $_POST;@@ -33,7 +33,7 @@ 				<td colspan="2"><strong>All settings can be altered in /classes/config.php later. All fields are required. Passwords are displayed in plain text. </strong></td> 			</tr> <?-if($Error) {+if(isset($Error)) { ?> 			<tr> 				<td colspan="2"><strong style="color: #ff0000"><?=$Error?></strong></td>@@ -44,94 +44,87 @@ 			<tr valign="top"> 				<td align="right" width="150">Site name:</td> 				<td align="left">-					<input type="text" name="site_name" class="inputtext" value="<?= display_str($Options['site_name']) ?>" />+					<input type="text" name="site_name" class="inputtext" value="<?= ( isset($Options['site_name']) ? display_str($Options['site_name']) : '' ) ?>" /> 					<br /><em>The name of your site, eg. "Awesome Elite Tracker".</em> 				</td> 			</tr> 			<tr valign="top"> 				<td align="right" width="150">Site URL:</td> 				<td align="left">-					<input type="text" name="site_url" class="inputtext" value="<?= display_str($Options['site_url']) ?>" />+					<input type="text" name="site_url" class="inputtext" value="<?= ( isset($Options['site_url']) ? display_str($Options['site_url']) : '' ) ?>" /> 					<br /><em>No 'http://', no trailing slash.</em> 				</td> 			</tr> 			<tr valign="top"> 				<td align="right" width="150">Announce URL:</td> 				<td align="left">-					<input type="text" name="announce_url" class="inputtext" value="<?= display_str($Options['announce_url']) ?>" />+					<input type="text" name="announce_url" class="inputtext" value="<?= ( isset($Options['announce_url']) ? display_str($Options['announce_url']) : '' ) ?>" /> 					<br /><em>eg. http://tracker.example.com:34000</em> 				</td> 			</tr> 			<tr valign="top"> 				<td align="right" width="150">Server root:</td> 				<td align="left">-					<input type="text" name="server_root" class="inputtext" value="<?= display_str($Options['server_root']) ?>" />+					<input type="text" name="server_root" class="inputtext" value="<?= ( isset($Options['server_root']) ? display_str($Options['server_root']) : '' ) ?>" /> 					<br /><em>No trailing slash.</em> 				</td> 			</tr> 			<tr valign="top"> 				<td align="right" width="150">Session directory:</td> 				<td align="left">-					<input type="text" name="session_dir" class="inputtext" value="<?= display_str($Options['session_dir']) ?>" />+					<input type="text" name="session_dir" class="inputtext" value="<?= ( isset($Options['session_dir']) ? display_str($Options['session_dir']) : '' ) ?>" /> 					<br /><em>The directory where php sessions are stored. Ensure that it's readable. Use default if unsure.</em> 				</td> 			</tr> 			<tr valign="top"> 				<td align="right" width="150">Temporary files:</td> 				<td align="left">-					<input type="text" name="tmp_dir" class="inputtext" value="<?= display_str($Options['tmp_dir']) ?>" />+					<input type="text" name="tmp_dir" class="inputtext" value="<?= ( isset($Options['tmp_dir']) ? display_str($Options['tmp_dir']) : '' ) ?>" /> 					<br /><em>Where to store temporary files. Use default if unsure.</em> 				</td> 			</tr> 			<tr valign="top"> 				<td align="right" width="150">Database name:</td> 				<td align="left">-					<input type="text" name="sqldb" class="inputtext" value="<?= display_str($Options['sqldb']) ?>" />+					<input type="text" name="sqldb" class="inputtext" value="<?= ( isset($Options['sqldb']) ? display_str($Options['sqldb']) : '' ) ?>" /> 				</td> 			</tr> 			<tr valign="top"> 				<td align="right" width="150">MySQL user:</td> 				<td align="left">-					<input type="text" name="sqllogin" class="inputtext" value="<?= display_str($Options['sqllogin']) ?>" />+					<input type="text" name="sqllogin" class="inputtext" value="<?= ( isset($Options['sqllogin']) ? display_str($Options['sqllogin']) : '' ) ?>" /> 					<br /><em>You should create this user yourself (can be done after the installation). This user shouldn't be root, and shouldn't have ridiculously high access.</em> 				</td> 			</tr> 			<tr valign="top"> 				<td align="right" width="150">MySQL password:</td> 				<td align="left">-					<input type="text" name="sqlpass" class="inputtext" value="<?= display_str($Options['sqlpass']) ?>" />+					<input type="text" name="sqlpass" class="inputtext" value="<?= ( isset($Options['sqlpass']) ? display_str($Options['sqlpass']) : '' ) ?>" /> 				</td> 			</tr> 			<tr valign="top"> 				<td align="right" width="150">MySQL host:</td> 				<td align="left">-					<input type="text" name="sqlhost" class="inputtext" value="<?= display_str($Options['sqlhost']) ?>" />+					<input type="text" name="sqlhost" class="inputtext" value="<?= ( isset($Options['sqlhost']) ? display_str($Options['sqlhost']) : '' ) ?>" /> 				</td> 			</tr> 			<tr valign="top"> 				<td align="right" width="150">MySQL port:</td> 				<td align="left">-					<input type="text" name="sqlport" class="inputtext" value="<?= display_str($Options['sqlport']) ?>" />+					<input type="text" name="sqlport" class="inputtext" value="<?= ( isset($Options['sqlport']) ? display_str($Options['sqlport']) : '' ) ?>" /> 				</td> 			</tr> 			<tr valign="top">-				<td align="right" width="150"><span style="color: red;">MySQL root password:</span></td>-				<td align="left">-					<input type="text" name="sqlrootpass" class="inputtext" value="<?= display_str($Options['sqlpass']) ?>" />-					<br /><em>Used for setting up the database only - is not stored.</em>-				</td>-			</tr>-			<tr valign="top"> 				<td align="right" width="150">SysOp username:</td> 				<td align="left">-					<input type="text" name="admin_username" class="inputtext" value="<?= display_str($Options['admin_username']) ?>" />+					<input type="text" name="admin_username" class="inputtext" value="<?= ( isset($Options['admin_username']) ? display_str($Options['admin_username']) : '' ) ?>" /> 					<br /><em>The username of the main sysop, with user id 1.</em> 				</td> 			</tr> 			<tr valign="top"> 				<td align="right" width="150">SysOp password:</td> 				<td align="left">-					<input type="text" name="admin_pass" class="inputtext" value="<?= display_str($Options['admin_pass']) ?>" />+					<input type="text" name="admin_pass" class="inputtext" value="<?= ( isset($Options['admin_pass']) ? display_str($Options['admin_pass']) : '' ) ?>" /> 					<br /><em>Choose something long and complicated.</em> 				</td> 			</tr>Index: install/install_handle.php===================================================================--- install/install_handle.php	(revision 18)+++ install/install_handle.php	(working copy)@@ -16,13 +16,12 @@    ||!$_POST['sqlpass']    ||!$_POST['sqlhost']    ||!$_POST['sqlport']-   ||!$_POST['sqlrootpass']    ||!$_POST['admin_username']    ||!$_POST['admin_pass']        ) { fail('Please fill out all the options'); } if(!is_readable($_POST['server_root'].'/gazelle.sql')) { fail('Could not find gazelle.sql. Did you set the server root correctly?'); }-if(!mysql_connect($_POST['sqlhost'].':'.$_POST['sqlport'], 'root', $_POST['sqlrootpass'])) { fail('Could not connect to MySQL. Check to make sure that MySQL is running, and that the root password is correct. '); }+if(!mysql_connect($_POST['sqlhost'].':'.$_POST['sqlport'], $_POST['sqllogin'], $_POST['sqlpass'])) { fail('Could not connect to MySQL. Check to make sure that MySQL is running, and that the password is correct. '); }  mysql_query("DROP DATABASE ".db_string($_POST['sqldb'])); @@ -32,7 +31,7 @@ }  // Create the tables-exec("mysql -uroot -p$_POST[sqlrootpass] $_POST[sqldb] < $_POST[server_root]/gazelle.sql");+exec("mysql -u$_POST[sqllogin] -p$_POST[sqlpass] $_POST[sqldb] < $_POST[server_root]/gazelle.sql");  mysql_select_db($_POST['sqldb']); mysql_query("SELECT COUNT(ID) FROM permissions");Index: sections/bookmarks/bookmarks.php===================================================================--- sections/bookmarks/bookmarks.php	(revision 18)+++ sections/bookmarks/bookmarks.php	(working copy)@@ -10,13 +10,13 @@   $UserID = (int)$LoggedUser['ID'];-$Sort = (int)$_GET['type'];+$Sort = ( isset($_GET['type']) ? intval($_GET['type']) : 0 );  // Header show_header('Bookmarks');  // SQL limit-if(is_number($_GET['page'])) {+if(isset($_GET['page']) && is_number($_GET['page'])) { 	$Limit=BOOKMARKS_PER_PAGE*$_GET['page']-BOOKMARKS_PER_PAGE . ", " . BOOKMARKS_PER_PAGE; } else { 	$Limit=BOOKMARKS_PER_PAGE;@@ -58,7 +58,7 @@ 	<div class="linkbox"> <? // Pagination-$Pages=get_pages('bookmarks.php',(int)$_GET['page'],$Results,BOOKMARKS_PER_PAGE,'',true, 9);+$Pages=get_pages('bookmarks.php',( isset($_GET['page']) ? $_GET['page'] : '' ),$Results,BOOKMARKS_PER_PAGE,'',true, 9); echo $Pages; ?> 	</div>Index: sections/bookmarks/index.php===================================================================--- sections/bookmarks/index.php	(revision 18)+++ sections/bookmarks/index.php	(working copy)@@ -2,7 +2,7 @@ enforce_login(); // Number of users per page  define('BOOKMARKS_PER_PAGE', '20');-+$_REQUEST['action']=( isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default' ); switch($_REQUEST['action']) { 	case 'add': 		include('add.php');Index: sections/donate/index.php===================================================================--- sections/donate/index.php	(revision 18)+++ sections/donate/index.php	(working copy)@@ -1,5 +1,6 @@ <? //Include all the basic stuff...+$_GET['status']=( isset($_GET['status']) ? $_GET['status'] : 'default' ); switch($_GET['status']) { 	case 'ipn': // Paypal hits this page when a donation is received 		include(SERVER_ROOT.'/sections/donate/ipn.php');Index: sections/forums/forum.php===================================================================--- sections/forums/forum.php	(revision 18)+++ sections/forums/forum.php	(working copy)@@ -18,7 +18,7 @@ 	error('','Invalid form data'); } -if(!$_GET['page']) {+if(!isset($_GET['page'])) { 	$Page = 1; } else { 	if(!is_number($_GET['page'])) {@@ -104,7 +104,7 @@ <? } ?> 	<div class="linkbox"> <?-$Pages=get_pages('forums.php',(int)$_GET['page'],$Forum['Topics'],TOPICS_PER_PAGE,'action=viewforum&amp;forumid='.$ForumID, true, 9);+$Pages=get_pages('forums.php',( isset($_GET['page']) ? intval($_GET['page']) : 0 ),$Forum['Topics'],TOPICS_PER_PAGE,'action=viewforum&amp;forumid='.$ForumID, true, 9); echo $Pages; ?> 	</div>@@ -158,7 +158,7 @@ function create_page(&$Cache) { 	global $ForumID, $DB; 	-	if(is_number($_GET['page'])) {+	if(isset($_GET['page']) && is_number($_GET['page'])) { 		$Limit=TOPICS_PER_PAGE*$_GET['page']-TOPICS_PER_PAGE . ', ' . TOPICS_PER_PAGE; 	} else { 		$Limit=TOPICS_PER_PAGE;Index: sections/forums/index.php===================================================================--- sections/forums/index.php	(revision 18)+++ sections/forums/index.php	(working copy)@@ -9,7 +9,7 @@ */ enforce_login(); -if($_POST['action']){+if(isset($_POST['action'])){ 	switch ($_POST['action']) { 		case 'reply': 		case 'new':@@ -24,6 +24,7 @@ }  else {+	$_GET['action']=( isset($_GET['action']) ? $_GET['action'] : 'default' ); 	switch ($_GET['action']) { 		case '': 			// Forums main pageIndex: sections/forums/main.php===================================================================--- sections/forums/main.php	(revision 18)+++ sections/forums/main.php	(working copy)@@ -55,7 +55,7 @@ 	$ForumID = $Cache->get_row_value('ForumID'); 	echo $Cache->next_part(); // begin topic row 	-	if((!$LastRead[$LastTopicID] || $LastRead[$LastTopicID]['PostID'] < $LastID) && $LastID!=0){+	if((!isset($LastRead[$LastTopicID]) || $LastRead[$LastTopicID]['PostID'] < $LastID) && $LastID!=0){ 		echo 'unread'; 	} else { 		echo 'read';Index: sections/forums/thread.php===================================================================--- sections/forums/thread.php	(revision 18)+++ sections/forums/thread.php	(working copy)@@ -21,7 +21,7 @@ }  -if($_GET['page']) {+if(isset($_GET['page'])) { 	$_GET['page'] = (int)$_GET['page']; 	$Page = $_GET['page']; 	$Limit=POSTS_PER_PAGE*$_GET['page']-POSTS_PER_PAGE . ', ' . POSTS_PER_PAGE;@@ -68,7 +68,7 @@ 	</h2> 	<div class="linkbox"> <?-$Pages=get_pages('forums.php', $_GET['page'],$ThreadInfo['Posts'],POSTS_PER_PAGE,'action=viewthread&amp;threadid='.$ThreadID,true, 9);+$Pages=get_pages('forums.php',( isset( $_GET['page']) ?  $_GET['page'] : '' ),$ThreadInfo['Posts'],POSTS_PER_PAGE,'action=viewthread&amp;threadid='.$ThreadID,true, 9); echo $Pages; ?> 	</div>@@ -98,7 +98,7 @@ $Thread->set_query($sql); $Thread->set_page_type('thread'); $Thread->set_thread_id($ThreadID);-$Thread->set_page((int)$_GET['page']);+$Thread->set_page(isset($_GET['page']) ? intval($_GET['page']) : 0); $Thread->set_highlight_unread(true); //$Thread->set_show_avatars(($LoggedUser['ViewAvatars'])? true : false); $Thread->write(); // Thread is written out hereIndex: sections/friends/friends.php===================================================================--- sections/friends/friends.php	(revision 18)+++ sections/friends/friends.php	(working copy)@@ -16,7 +16,7 @@ show_header('Friends');  // SQL limit-if(is_number($_GET['page'])) {+if(isset($_GET['page']) && is_number($_GET['page'])) { 	$Limit=FRIENDS_PER_PAGE*$_GET['page']-FRIENDS_PER_PAGE . ", " . FRIENDS_PER_PAGE; } else { 	$Limit=FRIENDS_PER_PAGE;@@ -58,7 +58,7 @@ 	<div class="linkbox"> <? // Pagination-$Pages=get_pages('friends.php',(int)$_GET['page'],$Results,FRIENDS_PER_PAGE,'',true, 9);+$Pages=get_pages('friends.php',( isset($_GET['page']) ? intval($_GET['page']) : 0 ),$Results,FRIENDS_PER_PAGE,'',true, 9); echo $Pages; ?> 	</div>Index: sections/friends/index.php===================================================================--- sections/friends/index.php	(revision 18)+++ sections/friends/index.php	(working copy)@@ -1,8 +1,9 @@ <? enforce_login();-if($_REQUEST['friendid'] && !is_number($_REQUEST['friendid'])) {+if(isset($_REQUEST['friendid']) && !is_number($_REQUEST['friendid'])) { 	error(404); }+$_REQUEST['action']=( isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default' ); switch($_REQUEST['action']) { 	case 'add': 		include('add.php');Index: sections/inbox/inbox.php===================================================================--- sections/inbox/inbox.php	(revision 18)+++ sections/inbox/inbox.php	(working copy)@@ -1,7 +1,7 @@ <? show_header('Inbox','inbox'); -if(is_number($_GET['page'])) {+if(isset($_GET['page']) && is_number($_GET['page'])) { 	$Limit=MESSAGES_PER_PAGE*$_GET['page']-MESSAGES_PER_PAGE. ', ' . MESSAGES_PER_PAGE; } else { 	$Limit=MESSAGES_PER_PAGE;@@ -10,8 +10,7 @@ $UserID = $LoggedUser['ID'];  -$Page = $_GET['action']; // either 'inbox' or 'sentbox'-if(!$Page) { $Page = 'inbox'; }+$Page =( isset($_GET['action']) ? $_GET['action'] : 'inbox' ); // either 'inbox' or 'sentbox' if(!in_array($Page, array('inbox', 'sentbox'))) { error(404); }  ?>@@ -53,11 +52,11 @@ $DB->set_query_id($Results);  $QueryString = "action=$Page";-if($_GET['userid']) {+if(isset($_GET['userid'])) { 	$QueryString.='&amp;userid='.$UserID; } -$Pages=get_pages('inbox.php',(int)$_GET['page'],$NumResults,MESSAGES_PER_PAGE,$QueryString,true, 9);+$Pages=get_pages('inbox.php',( isset($_GET['page']) ? intval($_GET['page']) : 0 ),$NumResults,MESSAGES_PER_PAGE,$QueryString,true, 9); echo $Pages; ?> 	</div>Index: sections/inbox/index.php===================================================================--- sections/inbox/index.php	(revision 18)+++ sections/inbox/index.php	(working copy)@@ -1,7 +1,7 @@ <?  enforce_login();-+$_REQUEST['action']=( isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default' ); switch($_REQUEST['action']) { 	case 'takecompose': 		include('takecompose.php');Index: sections/index/index.php===================================================================--- sections/index/index.php	(revision 18)+++ sections/index/index.php	(working copy)@@ -1,5 +1,6 @@ <? if ($LoggedUser['ID']) {+	$_REQUEST['action'] = ( isset($_REQUEST['action']) ? $_REQUEST['action'] : '' ); 	switch($_REQUEST['action']){ 		case 'remove_reseed': 			if($_GET['torrentid'] && is_number($_GET['torrentid'])){@@ -9,7 +10,7 @@ 			} 			break; 		default:-			if ($_REQUEST['response']!='') {+			if (!empty($_REQUEST['response'])) { 				// If the user is voting on a poll 				$PollID=(int)$_REQUEST['pollid']; 				$Response=(int)$_REQUEST['response'];Index: sections/kb/article.php===================================================================--- sections/kb/article.php	(revision 18)+++ sections/kb/article.php	(working copy)@@ -19,7 +19,7 @@ }  -if($_GET['nocache']) create_page($Cache);+if(isset($_GET['nocache'])) create_page($Cache); $Cache->get_page() or create_page($Cache); // creates the page  Index: sections/login/index.php===================================================================--- sections/login/index.php	(revision 18)+++ sections/login/index.php	(working copy)@@ -21,9 +21,9 @@ include_once(SERVER_ROOT."/classes/class_validate.php"); $Validate=NEW VALIDATE; -if ($_REQUEST['act']=="recover") {+if (isset($_REQUEST['act']) && $_REQUEST['act']=="recover") { 	// Recover password-	if ($_REQUEST['key']!="") {+	if (!empty($_REQUEST['key'])) { 		// User has entered a new password, use step 2 		$DB->query("SELECT  			m.ID,@@ -189,7 +189,7 @@ 	} // end log_attempt function 	 	// If user has submitted form-	if(($_POST['username']!='' && $_POST['password']!='') || ($KeepLogged && $_POST['username']!='' && $CookieHash!='')) {+	if((!empty($_POST['username']) && !empty($_POST['password'])) || (isset($KeepLogged) && !empty($_POST['username']) && !empty($CookieHash))) { 		$Err=$Validate->ValidateForm($_POST);  		if(!$Err) {@@ -217,7 +217,7 @@ 					$PassTest = true; 				} -				if ($PassTest == true) {+				if (isset($PassTest) && $PassTest == true) { 					if ($_POST['keeplogged']=='1') { 						if ($_POST['keeplogged']) { 							login_cookie($_POST['username'],$PassHash,$Secret,$UserID);Index: sections/login/login.php===================================================================--- sections/login/login.php	(revision 18)+++ sections/login/login.php	(working copy)@@ -12,7 +12,7 @@ 		$DB->query("UPDATE login_attempts SET BannedUntil='0000-00-00 00:00:00',Attempts='0' WHERE ID='".db_string($AttemptID)."'"); 		$Attempts=0; 	}-	if($Err) {+	if(isset($Err)) { ?> 	<font color="red"><strong><?=$Err?></strong></font><br /><br /> <?	} ?>@@ -28,7 +28,7 @@ 			<td align="left"><input type="password" name="password" id="password" class="inputtext" /></td> 		</tr> 		<tr valign="top">-			<td colspan="2" align="right"><input type="checkbox" name="keeplogged" value="1"<? if($_REQUEST['keeplogged']==1) { ?> checked="checked"<? } ?> />Keep me logged in</td>+			<td colspan="2" align="right"><input type="checkbox" name="keeplogged" value="1"<? if(isset($_REQUEST['keeplogged']) && $_REQUEST['keeplogged']==1) { ?> checked="checked"<? } ?> />Keep me logged in</td> 		</tr> 		<tr> 			<td colspan="2" align="right"><input type="submit" name="login" value="Log In!" class="submit" /></td>Index: sections/register/index.php===================================================================--- sections/register/index.php	(revision 18)+++ sections/register/index.php	(working copy)@@ -2,7 +2,7 @@ include_once(SERVER_ROOT.'/classes/class_validate.php'); $Val=NEW VALIDATE; -if($_REQUEST['confirm']) {+if(isset($_REQUEST['confirm'])) { 	// Confirm registration 	$DB->query("SELECT ID FROM users_main WHERE torrent_pass='".db_string($_REQUEST['confirm'])."' AND Enabled='0'"); 	list($UserID)=$DB->next_record();@@ -12,7 +12,7 @@ 		include('step2.php'); 	} 	-} elseif(OPEN_REGISTRATION || $_REQUEST['invite']) {+} elseif(OPEN_REGISTRATION || isset($_REQUEST['invite'])) { 	$Val->SetFields('username',true,'string','You did not enter a valid username.',array('minlength'=>1,'maxlength'=>20)); 	$Val->SetFields('username',true,'regex','You did not enter a valid username.',array('regex'=>'/^[a-z0-9_?]+$/i')); 	$Val->SetFields('email',true,'email','You did not enter a valid email address.');@@ -23,7 +23,7 @@ 	$Val->SetFields('agereq',true,'checkbox','You did not check the box that says you are 13 or older.'); 	$Val->SetFields('captcha',true,'string','You did not enter a captcha code.',array('minlength'=>6,'maxlength'=>6)); -	if($_REQUEST['submit']) {+	if(isset($_REQUEST['submit'])) { 		// User has submitted registration form 		$Err=$Val->ValidateForm($_REQUEST); 		@@ -46,7 +46,7 @@ 				$_REQUEST['email']=''; 			}  			-			if($_REQUEST['invite']) {+			if(isset($_REQUEST['invite'])) { 				$DB->query("SELECT InviterID, Email FROM invites WHERE InviteKey='".db_string($_REQUEST['invite'])."'"); 				list($InviterID, $OldEmail) = $DB->next_record(); 				if(!$InviterID) {@@ -87,6 +87,7 @@ 			 			// Commented out for hax 			//$UserID=$DB->inserted_id();+			$OldEmail = ( isset($OldEmail) ? $OldEmail : '' ); 			 			$AuthKey = make_secret(); 			@@ -170,11 +171,14 @@ 			$TPL->set('SITE_NAME',SITE_NAME); 			$TPL->set('SITE_URL',SITE_URL); -			send_email($_REQUEST['email'],'New account confirmation at '.SITE_NAME,$TPL->get(),'noreply');-			$Sent=1;+			if(send_email($_REQUEST['email'],'New account confirmation at '.SITE_NAME,$TPL->get(),'noreply')){+				$Sent=1;+			}else{+				$Err = 'Unable to send the email, please contact an admin and inform them of this message.';+			} 		} 		-	} elseif($_GET['invite']) {+	} elseif(isset($_GET['invite'])) { 		// If they haven't submitted the form, check to see if their invite is good 		$DB->query("SELECT InviteKey FROM invites WHERE InviteKey='".db_string($_GET['invite'])."'"); 		if($DB->record_count() == 0){Index: sections/register/step1.php===================================================================--- sections/register/step1.php	(revision 18)+++ sections/register/step1.php	(working copy)@@ -5,22 +5,22 @@ <form name="regform" id="regform" method="post" action="" onsubmit="return formVal();"> <div style="width:500px;"> <?-if(!$Sent) {-	if($_REQUEST['invite']) {+if(!isset($Sent)) {+	if(isset($_REQUEST['invite'])) { 		echo '<input type="hidden" name="invite" value="'.display_str($_REQUEST['invite']).'" />'."\n"; 	}-	if($Err) {+	if(isset($Err)) { ?> 	<font color="red"><strong><?= $Err ?></strong></font><br /><br /> <?	} ?> 	<table cellpadding="2" cellspacing="1" border="0" align="center"> 		<tr valign="top"> 			<td align="right">Username&nbsp;</td>-			<td align="left"><input type="text" name="username" id="username" class="inputtext" value="<?= display_str($_REQUEST['username']) ?>" /></td>+			<td align="left"><input type="text" name="username" id="username" class="inputtext" value="<?= ( isset($_REQUEST['username']) ? $_REQUEST['username'] : '' ) ?>" /></td> 		</tr> 		<tr valign="top"> 			<td align="right">Email&nbsp;</td>-			<td align="left"><input type="text" name="email" id="email" class="inputtext" value="<?= display_str($_REQUEST['email']) ?>" /></td>+			<td align="left"><input type="text" name="email" id="email" class="inputtext" value="<?= ( isset($_REQUEST['email']) ? $_REQUEST['email'] : '' ) ?>" /></td> 		</tr> 		<tr valign="top"> 			<td align="right">Password&nbsp;</td>@@ -32,15 +32,15 @@ 		</tr> 		<tr valign="top"> 			<td></td>-			<td align="left"><input type="checkbox" name="readrules" id="readrules" value="1"<? if ($_REQUEST['readrules']==1) { ?> checked="checked"<? } ?> /> <label for="readrules">I will read the rules.</label></td>+			<td align="left"><input type="checkbox" name="readrules" id="readrules" value="1"<? if (isset($_REQUEST['readrules']) && $_REQUEST['readrules']==1) { ?> checked="checked"<? } ?> /> <label for="readrules">I will read the rules.</label></td> 		</tr> 		<tr valign="top"> 			<td></td>-			<td align="left"><input type="checkbox" name="readfaq" id="readfaq" value="1"<? if ($_REQUEST['readfaq']==1) { ?> checked="checked"<? } ?> /> <label for="readfaq">I will read the FAQ.</label></td>+			<td align="left"><input type="checkbox" name="readfaq" id="readfaq" value="1"<? if (isset($_REQUEST['readfaq']) && $_REQUEST['readfaq']==1) { ?> checked="checked"<? } ?> /> <label for="readfaq">I will read the FAQ.</label></td> 		</tr> 		<tr valign="top"> 			<td></td>-			<td align="left"><input type="checkbox" name="agereq" id="agereq" value="1"<? if ($_REQUEST['agereq']==1) { ?> checked="checked"<? } ?> /> <label for="agereq">I am 13 years of age or older.</label></td>+			<td align="left"><input type="checkbox" name="agereq" id="agereq" value="1"<? if (isset($_REQUEST['agereq']) && $_REQUEST['agereq']==1) { ?> checked="checked"<? } ?> /> <label for="agereq">I am 13 years of age or older.</label></td> 		</tr> 		<tr> 			<td colspan="2" height="10"></td>Index: sections/reports/index.php===================================================================--- sections/reports/index.php	(revision 18)+++ sections/reports/index.php	(working copy)@@ -1,6 +1,7 @@ <? enforce_login(); //if(!check_perms('admin_reports')){error('','Service unavailable at this time.');}+$_REQUEST['action'] = ( isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default' ); switch($_REQUEST['action']){ case 'report': 	include('report.php');Index: sections/reports/reports.php===================================================================--- sections/reports/reports.php	(revision 18)+++ sections/reports/reports.php	(working copy)@@ -51,7 +51,7 @@ }  // SQL limit-if($_GET['page']){+if(isset($_GET['page'])){ 	$Limit=REPORTS_PER_PAGE*$_GET['page']-REPORTS_PER_PAGE . ", " . REPORTS_PER_PAGE; } else { 	$Limit=REPORTS_PER_PAGE;@@ -110,7 +110,7 @@ 	<div class="linkbox"> <? // pagination-$Pages=get_pages('reports.php',$_GET['page'],$Results,REPORTS_PER_PAGE,$URL,true, 11);+$Pages=get_pages('reports.php',( isset($_GET['page']) ? $_GET['page'] : '' ),$Results,REPORTS_PER_PAGE,$URL,true, 11); echo $Pages; ?> 	</div>Index: sections/requests/index.php===================================================================--- sections/requests/index.php	(revision 18)+++ sections/requests/index.php	(working copy)@@ -1,5 +1,6 @@ <? enforce_login();+$_REQUEST['action']=(isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default'); switch($_REQUEST['action']){ 	case 'edit': 	case 'new':Index: sections/requests/requests.php===================================================================--- sections/requests/requests.php	(revision 18)+++ sections/requests/requests.php	(working copy)@@ -5,14 +5,14 @@ $Req = new REQUESTS;  // SQL limit-if(is_number($_GET['page'])) {+if(isset($_GET['page']) && is_number($_GET['page'])) { 	$Limit=REQUESTS_PER_PAGE*$_GET['page']-REQUESTS_PER_PAGE. ', ' . REQUESTS_PER_PAGE; } else { 	$Limit=REQUESTS_PER_PAGE; }  // Array of search words, if they're searching for something-$Words = explode(' ', $_GET['search']);+$Words = ( isset($_GET['search']) ? explode(' ', $_GET['search']) : array() );  // Array of tag names - used for the search bar $TagNames = array();@@ -20,7 +20,7 @@ // $_GET['tag'] is a single tag ID // This code fetches the name of the tag (for the search bar) // Then stores it in $TagNames-if($_GET['tag']) {+if(isset($_GET['tag'])) { 	$TagID = $_GET['tag']; 	if(!is_number($TagID)) { error('','Invalid form data'); } 	@@ -37,7 +37,7 @@  // $_GET['tags'] is a comma-separated list of tags // It gets set if someone enters one or more tags into the search bar. -elseif($_GET['tags']){+elseif(isset($_GET['tags'])){ 	// Sanatize them, for consistency and database usage 	$Tags = explode(',', $_GET['tags']); 	$DBTags = array(); // Escaped list of tag names for database usage@@ -63,12 +63,12 @@ } unset($Words); // Replaced by $SearchWords -if($_GET['order'] == 'name') {+if(isset($_GET['order']) && $_GET['order'] == 'name') { 	// Since the page displays the name as "artist - title", this is the order users expect. 	$Order = 'CONCAT(a.Name, r.Name) ';  } // Make sure they aren't trying some tricky ordering-elseif(in_array($_GET['order'], array('votes', 'bounty', 'id', 'filler.username', 'u.username'))){+elseif(isset($_GET['order']) && in_array($_GET['order'], array('votes', 'bounty', 'id', 'filler.username', 'u.username'))){ 	$Order = $_GET['order'].' '; 	if($Order == 'filler.username ') { 		$Order = 'IF(filler.username IS NULL,1,0),filler.username ';@@ -106,39 +106,39 @@ 	JOIN tags AS t ON t.ID=rt.TagID  	"; // If a user is viewing their own requests-if($_GET['type']=='voted') {+if(isset($_GET['type']) && $_GET['type']=='voted') { 	$sql.=" JOIN requests_votes AS v ON v.RequestID=r.ID "; }  // Requests are hidden after 3 days of being filled-if(($_GET['showall'] || $_GET['type'] == 'filled') && check_perms('site_see_old_requests')) {+if((isset($_GET['showall']) || (isset($_GET['type']) && $_GET['type'] == 'filled')) && check_perms('site_see_old_requests')) { 	$sql.="WHERE true "; } else { 	$sql.="WHERE Visible='1' "; } -if($TagID) {+if(isset($TagID)) { 	$sql.=" AND (SELECT TagID FROM requests_tags WHERE TagID='$TagID' AND RequestID=r.ID) ";-} elseif($DBTags){+} elseif(isset($DBTags)){ 	foreach($DBTags as $Tag){ 		$sql.=" AND (SELECT ID FROM tags JOIN requests_tags ON requests_tags.TagID=tags.ID WHERE Name=$Tag AND RequestID=r.ID) "; 	} }  // If we're searching artist names and titles-if($SearchWords) {+if(isset($SearchWords)) { 	$sql.="AND ".implode("AND ", $SearchWords); } // If a user is viewing their own requests-if($_GET['type']=='created') {+if(isset($_GET['type']) && $_GET['type']=='created') { 	$sql.=" AND r.UserID='$LoggedUser[ID]' "; } // If a user is viewing requests they've voted on-if($_GET['type']=='voted') {+if(isset($_GET['type']) && $_GET['type']=='voted') { 	$sql.=" AND v.UserID='$LoggedUser[ID]' "; } // If we're viewing a user's filled requests-if($_GET['type']=='filled' && is_number($_GET['userid'])) {+if(isset($_GET['type']) && $_GET['type']=='filled' && is_number($_GET['userid'])) { 	$sql.=" AND r.FillerID='".db_string($_GET['userid'])."' "; } @@ -147,10 +147,11 @@ // Ordering (the order was sanatized earlier) $sql .= " ORDER BY $Order "; // Sorting - make sure they aren't doing anything tricky, sort DESC by default-$sql .= (in_array($_GET['sort'], array('asc', 'desc'))) ? db_string($_GET['sort']).' ' : ' DESC ';+$sql .= (isset($_GET['sort']) && in_array($_GET['sort'], array('asc', 'desc'))) ? db_string($_GET['sort']).' ' : ' DESC '; $sql .= " LIMIT $Limit";  // Page title, used for <title> and <h2>+$_GET['type']=( isset($_GET['type']) ? $_GET['type'] : 'default' ); switch($_GET['type']) { 	case 'created': 		$Title = 'My requests';Index: sections/rules/index.php===================================================================--- sections/rules/index.php	(revision 18)+++ sections/rules/index.php	(working copy)@@ -1,6 +1,7 @@ <? //Include all the basic stuff... enforce_login();+$_GET['p']=( isset($_GET['p']) ? $_GET['p'] : 'default' ); switch($_GET['p']) { 	case 'ratio': 		include(SERVER_ROOT.'/sections/rules/ratio.php');Index: sections/staff/index.php===================================================================--- sections/staff/index.php	(revision 18)+++ sections/staff/index.php	(working copy)@@ -76,7 +76,7 @@ 	while(list($ID, $Class, $ClassName, $Username, $Paranoia, $LastAccess) = $DB->next_record()) { 		if($Class!=$CurClass) { // Start new class of staff members 			$Row = 'a';-			if($CloseTable) {+			if(isset($CloseTable)) { 				$CloseTable = false; 				echo "\t</table>"; 			}Index: sections/tickets/browse.php===================================================================--- sections/tickets/browse.php	(revision 18)+++ sections/tickets/browse.php	(working copy)@@ -20,7 +20,7 @@ $URL = '&action=browse';  // calculate SQL limit (for multi-page browsing)-if($_GET['page'])+if(isset($_GET['page'])) 	$Limit = TICKETS_PER_PAGE*$_GET['page']-TICKETS_PER_PAGE. ', ' . TICKETS_PER_PAGE; else 	$Limit = TICKETS_PER_PAGE;@@ -47,7 +47,7 @@  // apply reply-by filter $NoSuchReplyUser = 0;-if($_GET['replies']) {+if(isset($_GET['replies'])) { 	$DB->query("SELECT 			ID 			FROM users_main@@ -70,7 +70,7 @@ // apply category filters $CatFilter = array(); foreach($CatList as $CatID=>$CatName)-	if($_GET['cat'.$CatID]) {+	if(isset($_GET['cat'.$CatID])) { 		$CatFilter[] = 1<<$CatID; 	} if(count($CatFilter)) {@@ -104,7 +104,7 @@   // apply last active filter-if($_GET['la']) {+if(isset($_GET['la'])) { 	if(!$Where)	{ $Query.='WHERE ('; } 	else 		{ $Query.= 'AND ('; } 	$LastActiveFilter = time_minus(abs(intval($_GET['la'])));@@ -115,7 +115,7 @@   // apply search terms-if($_GET['search']) {+if(isset($_GET['search'])) { 	if(!$Where)	{ $Query.='WHERE ('; } 	else 		{ $Query.= 'AND ('; } 	$Query.= "(t.Body LIKE '%".db_string($_GET['search'])."%' @@ -127,7 +127,7 @@  // apply author/opened-by filter $NoSuchUser = 0;-if($_GET['author']) {+if(isset($_GET['author'])) { 	$DB->query("SELECT 			ID 			FROM users_main@@ -147,6 +147,7 @@  // Add grouping, ordering, limit $Query.= 'GROUP BY t.ID ';+$_GET['sort']=( isset($_GET['sort']) ? $_GET['sort'] : 'default' ); switch($_GET['sort']) { case 'la_desc': 	$Query.= 'ORDER BY t.LastActive DESC'; break;@@ -224,7 +225,7 @@ 				Title/description contains: 			</td> 			<td colspan="3">-				<input type="text" name="search" style="width:95%" value="<?= display_str($_GET['search']);?>">+				<input type="text" name="search" style="width:95%" value="<?= ( isset($_GET['search']) ? display_str($_GET['search']) : '' );?>"> 			</td> 		</tr> 		<tr>@@ -232,7 +233,7 @@ 				Opened by: 			</td> 			<td>-				<input type="text" name="author" value="<?= display_str($_GET['author']);?>">+				<input type="text" name="author" value="<?= ( isset($_GET['author']) ? display_str($_GET['author']) : '' );?>"> 				<?= ($NoSuchUser?'(no such user)':''); ?> 			</td> 			<td class="label">@@ -241,10 +242,10 @@ 			<td> 				<select name="la"> 					<option value=""> </option>-					<option value="86400"<? if($_GET['la']==86400) { echo ' selected="selected"'; }?>> Today </option>-					<option value="259200"<? if($_GET['la']==259200) { echo ' selected="selected"'; }?>> Three days </option>-					<option value="604800"<? if($_GET['la']==604800) { echo ' selected="selected"'; }?>> Last week </option>-					<option value="2678400"<? if($_GET['la']==2678400) { echo ' selected="selected"'; }?>> Last month </option>+					<option value="86400"<? if(isset($_GET['la']) && $_GET['la']==86400) { echo ' selected="selected"'; }?>> Today </option>+					<option value="259200"<? if(isset($_GET['la']) && $_GET['la']==259200) { echo ' selected="selected"'; }?>> Three days </option>+					<option value="604800"<? if(isset($_GET['la']) && $_GET['la']==604800) { echo ' selected="selected"'; }?>> Last week </option>+					<option value="2678400"<? if(isset($_GET['la']) && $_GET['la']==2678400) { echo ' selected="selected"'; }?>> Last month </option> 				</select> 			</td> 		</tr>@@ -253,7 +254,7 @@ 				Has replies by: 			</td> 			<td>-				<input type="text" name="replies" value="<?= display_str($_GET['replies']);?>">+				<input type="text" name="replies" value="<?= ( isset($_GET['replies']) ? display_str($_GET['replies']) : '' );?>"> 				<?= ($NoSuchReplyUser?'(no such user)':''); ?> 			</td> 			<td class="label">@@ -287,7 +288,7 @@ // --------------------------------------------------------- // Display header for the tickets list -$Pages=get_pages('tickets.php',$_GET['page'],$TotalRecords,TICKETS_PER_PAGE,$URL,$LinkClass='',true, $ShowPages=11);+$Pages=get_pages('tickets.php',( isset($_GET['page']) ? $_GET['page'] : '' ),$TotalRecords,TICKETS_PER_PAGE,$URL,$LinkClass='',true, $ShowPages=11); echo $Pages; ?> 	</div>Index: sections/tickets/index.php===================================================================--- sections/tickets/index.php	(revision 18)+++ sections/tickets/index.php	(working copy)@@ -10,7 +10,7 @@  $CatList = fetch_category_list(); -+$_REQUEST['action']=( isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default' ); switch($_REQUEST['action']){ case 'my': 	include(SERVER_ROOT.'/sections/tickets/my.php');@@ -55,7 +55,7 @@ 			echo '<tr>'; 		} 		echo "<td><input type='checkbox' name='cat$CatID'";-		if($_REQUEST['cat'.$CatID]){+		if(isset($_REQUEST['cat'.$CatID])){ 			echo ' checked'; 		} 		echo "> $CatName </input></td>";Index: sections/tools/index.php===================================================================--- sections/tools/index.php	(revision 18)+++ sections/tools/index.php	(working copy)@@ -15,7 +15,7 @@  include(SERVER_ROOT.'/classes/class_feed.php'); $Feed = new FEED;-+$_REQUEST['action'] = ( isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default' ); switch ($_REQUEST['action']){  //Managers@@ -151,7 +151,7 @@ 		include("managers/polls_alter.php");  	} else {-		if ($_REQUEST['removeid']) {+		if (isset($_REQUEST['removeid'])) { 			$DB->query("DELETE FROM polls WHERE ID='".db_string($_REQUEST['removeid'])."'"); 			$Message="The poll has been removed."; 			$Cache->delete('poll');@@ -164,7 +164,7 @@ case 'permissions': 	if (!check_perms('admin_manage_permissions')) { error('403'); } -	if ($_REQUEST['id']) {+	if (isset($_REQUEST['id'])) { 		$Val->SetFields('name',true,'string','You did not enter a valid name for this permission set.'); 		$Val->SetFields('level',true,'number','You did not enter a valid level for this permission set.'); 		//$Val->SetFields('test',true,'number','You did not enter a valid level for this permission set.');@@ -177,7 +177,7 @@ 			$Values=unserialize($Values); 		} -		if ($_REQUEST['submit']) {+		if (isset($_REQUEST['submit'])) { 			$Err=$Val->ValidateForm($_REQUEST);  			if (!is_numeric($_REQUEST['id'])) {@@ -210,7 +210,7 @@ 		include('managers/permissions_alter.php');  	} else {-		if ($_REQUEST['removeid']) {+		if (isset($_REQUEST['removeid'])) { 			$DB->query("DELETE FROM permissions WHERE ID='".db_string($_REQUEST['removeid'])."'"); 			$DB->query("UPDATE users_main SET PermissionID='".USER."' WHERE PermissionID='".db_string($_REQUEST['removeid'])."'"); Index: sections/tools/managers/permissions_list.php===================================================================--- sections/tools/managers/permissions_list.php	(revision 18)+++ sections/tools/managers/permissions_list.php	(working copy)@@ -1,7 +1,7 @@ <? show_header('Manage Permissions'); -if ($Message) {+if (isset($Message)) { ?> <div class="save_message"><?=$Message?></div> <? } ?>Index: sections/top10/torrents.php===================================================================--- sections/top10/torrents.php	(revision 18)+++ sections/top10/torrents.php	(working copy)@@ -19,7 +19,7 @@ 				<tr> 					<td class="label">Tags (comma-separated):</td> 					<td>-						<input type="text" name="tags" size="75" value="<?= display_str($_GET['tags'])?>" />+						<input type="text" name="tags" size="75" value="<?= ( isset($_GET['tags']) ? display_str($_GET['tags']) : '' )?>" /> 					</td> 				</tr> 				<tr>@@ -43,7 +43,7 @@ <? } -if($_GET['advanced'] && check_perms('site_advanced_top10')) {+if(isset($_GET['advanced']) && check_perms('site_advanced_top10')) { 	$Details = 'all'; 	$Limit = 10; 	$Where = array();@@ -85,7 +85,7 @@ }  -$WhereSum = md5($Where);+$WhereSum = md5(isset($Where) ? $Where : '');  // cache! $Cache->new_page('top10t_'.$Details.$Limit.$WhereSum,3600*6);@@ -229,7 +229,7 @@ ?> 	<p> 		<strong> Top <?=$Limit.' '.$Caption?> </strong>-<?	if(!$_GET['advanced']){ ?> +<?	if(!isset($_GET['advanced'])){ ?>  		<small> 			- [<a href="top10.php?type=torrents&amp;limit=100&amp;details=<?=$Tag?>">Top 100</a>] 			- [<a href="top10.php?type=torrents&amp;limit=250&amp;details=<?=$Tag?>">Top 250</a>]Index: sections/torrents/browse.php===================================================================--- sections/torrents/browse.php	(revision 18)+++ sections/torrents/browse.php	(working copy)@@ -78,7 +78,7 @@ }  // Setting default search options-if($_GET['setdefault']) {+if(isset($_GET['setdefault'])) { 	$UnsetList[]='/(&?page\=.+?&?)/i'; 	$UnsetList[]='/(&?setdefault\=.+?&?)/i'; @@ -90,7 +90,7 @@ 	update_user_data();  // Clearing default search options-} elseif($_GET['cleardefault']) {+} elseif(isset($_GET['cleardefault'])) { 	$DB->query("SELECT SiteOptions FROM users_info WHERE UserID='".db_string($LoggedUser['ID'])."'"); 	list($SiteOptions)=$DB->next_record(MYSQLI_NUM, true); 	$SiteOptions=unserialize($SiteOptions);@@ -99,13 +99,13 @@ 	update_user_data();  // Use default search options-} elseif(!$_SERVER['QUERY_STRING'] && $LoggedUser['DefaultSearch']) {+} elseif(!$_SERVER['QUERY_STRING'] && isset($LoggedUser['DefaultSearch'])) { 	parse_str($LoggedUser['DefaultSearch'],$_GET); }  // If a user is hammering the search page (either via a script, or just general zeal)-if($_SERVER['QUERY_STRING'] != '' && $_SERVER['QUERY_STRING'] != 'action=basic' && $_SERVER['QUERY_STRING'] != 'action=advanced') {-	if($LoggedUser['last_browse']>time()-1) {+if(!empty($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != 'action=basic' && $_SERVER['QUERY_STRING'] != 'action=advanced') {+	if(isset($LoggedUser['last_browse']) && $LoggedUser['last_browse']>time()-1) { 		error('', 'You can only browse for torrents once every second.', 'Browse quota exceeded', '', true); 	} else { 		$_SESSION['logged_user']['last_browse'] = time();@@ -116,15 +116,15 @@ $OrderWay="DESC"; // We also order descending by default  $StartRecord=0; // The first part of the limit clause-if ($_GET['page']) { $StartRecord=TORRENTS_PER_PAGE*ceil($_GET['page'])-TORRENTS_PER_PAGE; }+if (isset($_GET['page'])) { $StartRecord=TORRENTS_PER_PAGE*ceil($_GET['page'])-TORRENTS_PER_PAGE; } -if (preg_match('/^s[1-7]$/',$_GET['order_by'])) { $OrderBy=strtolower($_GET['order_by']); }-if (in_array(strtolower($_GET['order_way']),array('desc','asc'))) { $OrderWay=strtoupper($_GET['order_way']); }+if (isset($_GET['order_by']) && preg_match('/^s[1-7]$/',$_GET['order_by'])) { $OrderBy=strtolower($_GET['order_by']); }+if (isset($_GET['order_way']) && in_array(strtolower($_GET['order_way']),array('desc','asc'))) { $OrderWay=strtoupper($_GET['order_way']); }  $QueryString="order_by=".$OrderBy."&amp;order_way=".$OrderWay; // The query string, used for pagination  // Uploaded, seeding, leeching, snatched lists-if($_GET['userid'] && is_number($_GET['userid'])) {+if(isset($_GET['userid']) && is_number($_GET['userid'])) { 	$UserID=ceil($_GET['userid']); 	 	$DB->query("SELECT Paranoia FROM users_main WHERE ID='".$UserID."'");@@ -167,7 +167,7 @@ 	} 	 	// If we've set some SQL-	if ($TorrentJoin || $TorrentWhere) {+	if (isset($TorrentJoin) || isset($TorrentWhere)) { 		$_GET['disablegrouping']=1; // We disable grouping on these lists 		$DisableCaching=1; // Caching these lists is a waste of RAM 		$AppendQueryString="&amp;userid=".$UserID."&amp;type=".urlencode($_GET['type']);@@ -175,21 +175,21 @@ }  // If grouping is disabled-if (($LoggedUser['DisableGrouping'] && !$_GET['enablegrouping']) || $_GET['disablegrouping']=='1') {+if ((isset($LoggedUser['DisableGrouping']) && !isset($_GET['enablegrouping'])) || isset($_GET['disablegrouping']) && $_GET['disablegrouping']=='1') { 	$DisableGrouping=1; 	$QueryString.="&amp;disablegrouping=1";  // If grouping is enabled-} elseif ($LoggedUser['DisableGrouping'] && $_GET['enablegrouping']) {+} elseif (isset($LoggedUser['DisableGrouping']) && isset($_GET['enablegrouping'])) { 	$QueryString.="&amp;enablegrouping=1"; }  // Advanced search-if((strtolower($_GET['action'])=="advanced" || ($LoggedUser['SearchType'] && strtolower($_GET['action'])!="basic")) && check_perms('site_advanced_search')) {+if(isset($_GET['action']) && (strtolower($_GET['action'])=="advanced" || ($LoggedUser['SearchType'] && strtolower($_GET['action'])!="basic")) && check_perms('site_advanced_search')) { 	$QueryString.="&amp;action=advanced"; 	 	$TorrentSpecifics=0; // How many options are we searching by? (Disabled grouping only)-	if($DisableGrouping) {+	if(isset($DisableGrouping)) { 		foreach($_GET as $SearchType=>$SearchStr) { 			switch($SearchType) { 				case 'bitrate':@@ -211,7 +211,7 @@ 	} 	 	// And now we start building the mega SQL query-	if($_GET['artistname']!='') {+	if(!empty($_GET['artistname'])) { 		if(!$DisableGrouping) { 			$GroupWhere=build_search($_GET['artistname'],'ArtistName',$_GET['exactartist'],$GroupWhere); 		} else {@@ -221,32 +221,32 @@ 		$QueryString.="&amp;artistname=".urlencode($_GET['artistname']); 	} -	if($_GET['torrentname']!='') {-		if(!$DisableGrouping) {+	if(!empty($_GET['torrentname'])) {+		if(!isset($DisableGrouping)) { 			$GroupWhere=build_search($_GET['torrentname'],'GroupName',$_GET['exacttorrent'],$GroupWhere); 		} else { 			$TorrentWhere=build_search($_GET['torrentname'],'g.Name',$_GET['exacttorrent'],$TorrentWhere); 		} -		if($_GET['exacttorrent']) { $QueryString.="&amp;exacttorrent=1"; }+		if(isset($_GET['exacttorrent'])) { $QueryString.="&amp;exacttorrent=1"; } 		$QueryString.="&amp;torrentname=".urlencode($_GET['torrentname']); 	} -	if($_GET['remastertitle']!='') {+	if(!empty($_GET['remastertitle'])) { 		$RemasterTitle = $_GET['remastertitle'];-		if($_GET['exactremaster']){+		if(isset($_GET['exactremaster'])){ 			$RemasterTitle = '%|'.$RemasterTitle.'|%'; 		} 		$GroupWhere=build_search($RemasterTitle,'RemasterTitleList',$_GET['exactremaster'],$GroupWhere,0,$RemasterRegEx); 		if($TorrentSpecifics>0) { 			$TorrentWhere=build_search($_GET['remastertitle'],'RemasterTitle',$_GET['exactremaster'],$TorrentWhere); 		}-		if($_GET['exactremaster']) { $QueryString.="&amp;exactremaster=1"; }+		if(isset($_GET['exactremaster'])) { $QueryString.="&amp;exactremaster=1"; } 		$QueryString.="&amp;remastertitle=".urlencode($_GET['remastertitle']); 	} -	if($_GET['year']!='' && is_numeric($_GET['year'])) {-		if(!$DisableGrouping) {+	if(!empty($_GET['year']) && is_numeric($_GET['year'])) {+		if(!isset($DisableGrouping)) { 			if($GroupWhere=='') { $GroupWhere="WHERE "; } else { $GroupWhere.=" AND "; } 			$GroupWhere.="GroupYear='".db_string($_GET['year'])."'"; 		} else {@@ -256,7 +256,7 @@ 		$QueryString.="&amp;year=".urlencode($_GET['year']); 	} -	if($_GET['bitrate']!='' && in_array($_GET['bitrate'],$Bitrates)) {+	if(!empty($_GET['bitrate']) && in_array($_GET['bitrate'],$Bitrates)) { 		$GroupWhere=build_search("%|".$_GET['bitrate']."|%",'EncodingList',true,$GroupWhere); 		if($TorrentSpecifics>0) { 			if($TorrentWhere=='') { $TorrentWhere="WHERE "; } else { $TorrentWhere.=" AND "; }@@ -265,7 +265,7 @@ 		$QueryString.="&amp;bitrate=".urlencode($_GET['bitrate']); 	} -	if($_GET['format']!='' && in_array($_GET['format'],$Formats)) {+	if(!empty($_GET['format']) && in_array($_GET['format'],$Formats)) { 		$GroupWhere=build_search("%|".$_GET['format']."|%",'FormatList',true,$GroupWhere); 		if($TorrentSpecifics>0) { 			if($TorrentWhere=='') { $TorrentWhere="WHERE "; } else { $TorrentWhere.=" AND "; }@@ -274,7 +274,7 @@ 		$QueryString.="&amp;format=".urlencode($_GET['format']); 	} -	if($_GET['media']!='' && in_array($_GET['media'],$Media)) {+	if(!empty($_GET['media']) && in_array($_GET['media'],$Media)) { 		$GroupWhere=build_search("%|".$_GET['media']."|%",'MediaList',false,$GroupWhere); 		if($TorrentSpecifics>0) { 			if($TorrentWhere=='') { $TorrentWhere="WHERE "; } else { $TorrentWhere.=" AND "; }@@ -283,12 +283,12 @@ 		$QueryString.="&amp;media=".urlencode($_GET['media']); 	} -	if($_GET['filelist']!='') {+	if(!empty($_GET['filelist'])) { 		$TorrentWhere=build_search("%".$_GET['filelist']."%",'t.FileList',true,$TorrentWhere); 		$QueryString.="&amp;filelist=".urlencode($_GET['filelist']); 	} -	if($_GET['haslog']!='') {+	if(!empty($_GET['haslog'])) { 		$GroupWhere=build_search("%|".$_GET['haslog']."|%",'LogList',true,$GroupWhere); 		if($TorrentSpecifics>0) { 			if($TorrentWhere=='') { $TorrentWhere="WHERE "; } else { $TorrentWhere.=" AND "; }@@ -297,7 +297,7 @@ 		$QueryString.="&amp;haslog=".urlencode(ceil($_GET['haslog'])); 	} -	if($_GET['hascue']!='') {+	if(!empty($_GET['hascue'])) { 		$GroupWhere=build_search("%|".$_GET['hascue']."|%",'CueList',true,$GroupWhere); 		if($TorrentSpecifics>0) { 			if($TorrentWhere=='') { $TorrentWhere="WHERE "; } else { $TorrentWhere.=" AND "; }@@ -306,7 +306,7 @@ 		$QueryString.="&amp;hascue=".urlencode(ceil($_GET['hascue'])); 	} -	if($_GET['scene']!='') {+	if(!empty($_GET['scene'])) { 		$GroupWhere=build_search("%|".$_GET['scene']."|%",'SceneList',true,$GroupWhere); 		if($TorrentSpecifics>0) { 			if($TorrentWhere=='') { $TorrentWhere="WHERE "; } else { $TorrentWhere.=" AND "; }@@ -315,7 +315,7 @@ 		$QueryString.="&amp;scene=".urlencode(ceil($_GET['scene'])); 	} -	if($_GET['freeleech']!='') {+	if(!empty($_GET['freeleech'])) { 		$GroupWhere=build_search("%|".$_GET['freeleech']."|%",'FreeTorrentList',true,$GroupWhere); 		if($TorrentSpecifics>0) { 			if($TorrentWhere=='') { $TorrentWhere="WHERE "; } else { $TorrentWhere.=" AND "; }@@ -324,7 +324,7 @@ 		$QueryString.="&amp;freeleech=".urlencode(ceil($_GET['freeleech'])); 	} -	if($_GET['remastered']!='') {+	if(!empty($_GET['remastered'])) { 		$GroupWhere=build_search("%|".$_GET['remastered']."|%",'RemasterList',true,$GroupWhere); 		if($TorrentSpecifics>0) { 			if($TorrentWhere=='') { $TorrentWhere="WHERE "; } else { $TorrentWhere.=" AND "; }@@ -335,7 +335,7 @@  } else { 	// Basic search-	if($_GET['searchstr']!='') {+	if(!empty($_GET['searchstr'])) { 		// Change special characters into 'normal' characters 		$SpecialSearch = array(); 		$SpecialReplace = array();@@ -346,7 +346,7 @@ 		} 		$SearchStr = str_replace($SpecialSearch, $SpecialReplace, $_GET['searchstr']); -		if(!$DisableGrouping) {+		if(!isset($DisableGrouping)) { 			$GroupWhere=build_search($SearchStr,'SearchText',false,$GroupWhere,1); 		} else { 			$TorrentWhere=build_search($SearchStr,'g.SearchText',false,$TorrentWhere);@@ -354,16 +354,16 @@ 		$QueryString.="&amp;searchstr=".urlencode($_GET['searchstr']); 	} 	-	if($LoggedUser['SearchType'] && strtolower($_GET['action'])=="basic") {+	if(isset($LoggedUser['SearchType']) && ( isset($_GET['action']) && strtolower($_GET['action'])=="basic" )) { 		$QueryString.="&amp;action=basic"; 	} }  // Searching tags is the same for basic and advanced search-if($_GET['searchtags']!='') {-	if($DisableGrouping) { $TagField="g.TagList"; } else { $TagField="h.TagList"; }+if(!empty($_GET['searchtags'])) {+	if(isset($DisableGrouping)) { $TagField="g.TagList"; } else { $TagField="h.TagList"; } 	-	$Tags=explode(',',$_GET['searchtags']);+	$Tags=( isset($_GET['searchtags']) ? explode(',',$_GET['searchtags']) : array() ); 	while(list($Key,$Tag)=each($Tags)) { 		if(trim($Tag)!='') { 			if($TagSearch!='') {@@ -376,8 +376,8 @@ 		} 	} -	if($TagSearch!='') {-		if($DisableGrouping) {+	if(!empty($TagSearch)) {+		if(isset($DisableGrouping)) { 			if($TorrentWhere=='') { $TorrentWhere="WHERE "; } else { $TorrentWhere.=" AND "; } 			$TorrentWhere.="(".$TagSearch.")"; 		} else {@@ -391,8 +391,8 @@ }  // Filtering categories is also the same for basic and advanced search-if($_GET['filter_cat']!='') {-	if($DisableGrouping) { $CategoryField="g.CategoryID"; } else { $CategoryField="GroupCategoryID"; }+if(!empty($_GET['filter_cat'])) {+	if(isset($DisableGrouping)) { $CategoryField="g.CategoryID"; } else { $CategoryField="GroupCategoryID"; }  	while(list($CatKey)=each($_GET['filter_cat'])) { 		if($CatFilter!='') { $CatFilter.=" OR "; }@@ -402,7 +402,7 @@ 		$QueryString.="filter_cat%5B".urlencode($CatKey)."%5D=1"; 	} -	if($DisableGrouping) {+	if(isset($DisableGrouping)) { 		if($TorrentWhere=='') { $TorrentWhere="WHERE "; } else { $TorrentWhere.=" AND "; } 		$TorrentWhere.="(".$CatFilter.")"; 	} else {@@ -412,18 +412,18 @@ }  // Try to get the search results from cache-if(!$DisableCaching) {-	$TorrentCache=$Cache->get_value("browse_".md5($TorrentJoin.$GroupWhere.$TorrentWhere.$DisableGrouping).$StartRecord.$OrderBy.$OrderWay);+if(!isset($DisableCaching)) {+	$TorrentCache=$Cache->get_value("browse_".md5((isset($TorrentJoin) ? $TorrentJoin : '').(isset($GroupWhere) ? $GroupWhere : '').(isset($TorrentWhere) ? $TorrentWhere : '').(isset($DisableGrouping) ? $DisableGrouping : '')).$StartRecord.$OrderBy.$OrderWay); }  // Label for the 'time' column - can also be "seeding time", "leeching time", or "snatched time"-if (!$TimeLabel) { $TimeLabel="Added"; }+if (!isset($TimeLabel)) { $TimeLabel="Added"; } -if(!is_array($TorrentCache)) {-	if (!$DisableGrouping) {+if(isset($TorrentCache) && !is_array($TorrentCache)) {+	if (!isset($DisableGrouping)) { 		// Build SQL query for enabled grouping-		if($TorrentWhere!='') {-			if($GroupWhere=='') { $GroupWhere="WHERE "; } else { $GroupWhere.=" AND "; }+		if(!empty($TorrentWhere)) {+			if(!empty($GroupWhere)) { $GroupWhere="WHERE "; } else { $GroupWhere.=" AND "; } 			$GroupWhere.="(SELECT t.GroupID FROM torrents AS t ".$TorrentWhere." AND t.GroupID=h.GroupID LIMIT 1)"; 		} @@ -459,8 +459,8 @@ 						h.TimeList, 						h.SearchText AS s1 					FROM torrent_hash AS h-					".$TorrentJoin."-					".$GroupWhere."+					".(isset($TorrentJoin) ? $TorrentJoin : '')."+					".(isset($GroupWhere) ? $GroupWhere : '')." 					ORDER BY ".$OrderBy." ".$OrderWay." 					LIMIT ".$StartRecord.", ".TORRENTS_PER_PAGE); @@ -515,57 +515,57 @@ 		$TorrentList=$DB->to_array(); 	} -	if($UserID) {+	if(isset($UserID)) { 		// Get the username, so we can display the title as "<user>'s snatched torrents", etc 		$DB->query("SELECT Username FROM users_main WHERE ID='".db_string($UserID)."'"); 		list($TitleUser)=$DB->next_record(); 	} -	if(!$DisableCaching) {+	if(!isset($DisableCaching)) { 		// Store results in cache-		$Cache->cache_value("browse_".md5($TorrentJoin.$GroupWhere.$TorrentWhere.$DisableGrouping).$StartRecord.$OrderBy.$OrderWay,array($TorrentCount,$TorrentList,$TitleUser),1500);+		$Cache->cache_value("browse_".md5((isset($TorrentJoin) ? $TorrentJoin : '').(isset($GroupWhere) ? $GroupWhere : '').(isset($TorrentWhere) ? $TorrentWhere : '').(isset($DisableGrouping) ? $DisableGrouping : '')).$StartRecord.$OrderBy.$OrderWay,array($TorrentCount,$TorrentList,&$TitleUser),1500); 	}  } else { 	// We got the results from cache-	$TorrentCount=$TorrentCache[0];-	$TorrentList=$TorrentCache[1];-	if($UserID) { $TitleUser=$TorrentCache[2]; }+	$TorrentCount=( isset($TorrentCache[0]) ? $TorrentCache[0] : '' );+	$TorrentList=( isset($TorrentCache[1]) ? $TorrentCache[1] : array() );+	if(isset($UserID)) { $TitleUser=( isset($TorrentCache[2]) ? $TorrentCache[2] : '' ); } }    // List of pages-$Pages=get_pages('torrents.php',$_GET['page'],$TorrentCount,TORRENTS_PER_PAGE,$QueryString);+$Pages=get_pages('torrents.php',( isset($_GET['page']) ? $_GET['page'] : ''),$TorrentCount,TORRENTS_PER_PAGE,$QueryString);  // Gets tacked onto torrent download URLs $DownloadString="&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass']; -if($Title) { $Title=$TitleUser."'s  ".$Title; } else { $Title="Browse Torrents"; }+if(isset($Title)) { $Title=$TitleUser."'s  ".$Title; } else { $Title="Browse Torrents"; }  show_header($Title,'browse'); ?> <form name="filter" method="get" action=''>-<? if($UserID) { ?>-<input type="hidden" name="type" value="<?=display_str($_GET['type'])?>" />-<input type="hidden" name="userid" value="<?=display_str($_GET['userid'])?>" />+<? if(isset($UserID)) { ?>+<input type="hidden" name="type" value="<?=( isset($_GET['type']) ? display_str($_GET['type']) : '' )?>" />+<input type="hidden" name="userid" value="<?=( isset($_GET['userid']) ? display_str($_GET['userid']) : '' )?>" /> <? } ?> <div class="filter_torrents"> 	<h3> 		Filter-<? if(strtolower($_GET['action'])!="advanced" && (!$LoggedUser['SearchType'] || strtolower($_GET['action'])=="basic") && check_perms('site_advanced_search')) { ?>+<? if(isset($_GET['action']) && (strtolower($_GET['action'])!="advanced" && (!$LoggedUser['SearchType'] || strtolower($_GET['action'])=="basic") && check_perms('site_advanced_search'))) { ?> 		(<a href="torrents.php?action=advanced<?=$AppendQueryString?>">Advanced Search</a>)-<? } elseif((strtolower($_GET['action'])=="advanced" || ($LoggedUser['SearchType'] && strtolower($_GET['action'])!="basic")) && check_perms('site_advanced_search')) { ?>+<? } elseif(isset($_GET['action']) && (strtolower($_GET['action'])=="advanced" || ($LoggedUser['SearchType'] && strtolower($_GET['action'])!="basic")) && check_perms('site_advanced_search')) { ?> 		(<a href="torrents.php<? if($LoggedUser['SearchType']) { ?>?action=basic<?=$AppendQueryString?><? } else { ?>?<?=substr($AppendQueryString,5)?><? } ?>">Basic Search</a>) <? } ?> 	</h3> 	<div class="box pad"> 		<table>-<? if((strtolower($_GET['action'])=="advanced" || ($LoggedUser['SearchType'] && strtolower($_GET['action'])!="basic")) && check_perms('site_advanced_search')) {+<? if(isset($_GET['action']) && (strtolower($_GET['action'])=="advanced" || ($LoggedUser['SearchType'] && strtolower($_GET['action'])!="basic")) && check_perms('site_advanced_search')) { 	$AdvancedSearch = true; ?> 			<tr> 				<td class="label">Artist Name:</td> 				<td colspan="3">-					<input type="text" size="40" name="artistname" class="inputtext smaller" value="<?=display_str($_GET['artistname'])?>" />&nbsp;+					<input type="text" size="40" name="artistname" class="inputtext smaller" value="<?=( isset($_GET['artistname']) ? display_str($_GET['artistname']) : '' )?>" />&nbsp; 					<input type="checkbox" name="exactartist" id="exactartist" value="1" <? if($_GET['exactartist']) { ?>checked="checked"<? } ?> /> <label for="exactartist">Exact Phrase</label> 					<input type="hidden" name="action" value="advanced" /> 				</td>@@ -573,14 +573,14 @@ 			<tr> 				<td class="label">Album/Torrent Name:</td> 				<td colspan="3">-					<input type="text" size="40" name="torrentname" class="inputtext smaller" value="<?=display_str($_GET['torrentname'])?>" />&nbsp;+					<input type="text" size="40" name="torrentname" class="inputtext smaller" value="<?=( isset($_GET['torrentname']) ? display_str($_GET['torrentname']) : '' )?>" />&nbsp; 					<input type="checkbox" name="exacttorrent" id="exacttorrent" value="1" <? if($_GET['exacttorrent']) { ?>checked="checked"<? } ?> /> <label for="exacttorrent">Exact Phrase</label> 				</td> 			</tr> 			<tr> 				<td class="label">Remaster Title:</td> 				<td colspan="3">-					<input type="text" size="40" name="remastertitle" class="inputtext smaller" value="<?=display_str($_GET['remastertitle'])?>" />&nbsp;+					<input type="text" size="40" name="remastertitle" class="inputtext smaller" value="<?=( isset($_GET['remastertitle']) ? display_str($_GET['remastertitle']) : '' )?>" />&nbsp; 					<input type="checkbox" name="exactremaster" id="exactremaster" value="1" <? if($_GET['exactremaster']) { ?>checked="checked"<? } ?> /> <label for="exactremaster">Exact Phrase</label> 				</td> 			</tr>@@ -645,8 +645,8 @@ 			<tr> 				<td class="label">Search terms:</td> 				<td colspan="3">-					<input type="text" size="40" name="searchstr" class="inputtext" value="<?=display_str($_GET['searchstr'])?>" />-<?	if($LoggedUser['SearchType']) { ?>+					<input type="text" size="40" name="searchstr" class="inputtext" value="<?=( isset($_GET['searchstr']) ? display_str($_GET['searchstr']) : '' )?>" />+<?	if(isset($LoggedUser['SearchType'])) { ?> 					<input type="hidden" name="action" value="basic" /> <?	} ?> 				</td>@@ -655,9 +655,9 @@ 			<tr> 				<td class="label">Tags (comma-separated):</td> 				<td colspan="3">-					<input type="text" size="40" id="tags" name="searchtags" class="inputtext smaller" value="<?= display_str($_GET['searchtags'])?>" />&nbsp;-					<input type="radio" name="tags_type" id="tags_type0" value="0" <? if($_GET['tags_type']==0) { ?>checked="checked"<? } ?> /> <label for="tags_type0">Any</label>&nbsp;&nbsp;-					<input type="radio" name="tags_type" id="tags_type1" value="1" <? if($_GET['tags_type']==1) { ?>checked="checked"<? } ?> /> <label for="tags_type1">All</label>+					<input type="text" size="40" id="tags" name="searchtags" class="inputtext smaller" value="<?=( isset($_GET['searchtags']) ? display_str($_GET['searchtags']) : '' )?>" />&nbsp;+					<input type="radio" name="tags_type" id="tags_type0" value="0" <? if(isset($_GET['tags_type']) && $_GET['tags_type']==0) { ?>checked="checked"<? } ?> /> <label for="tags_type0">Any</label>&nbsp;&nbsp;+					<input type="radio" name="tags_type" id="tags_type1" value="1" <? if(isset($_GET['tags_type']) && $_GET['tags_type']==1) { ?>checked="checked"<? } ?> /> <label for="tags_type1">All</label> 				</td> 			</tr> 			<tr>@@ -676,10 +676,10 @@ 						<option value="desc" <? if($OrderWay=="DESC") { ?>selected="selected"<? } ?>>Descending</option> 						<option value="asc" <? if($OrderWay=="ASC") { ?>selected="selected"<? } ?>>Ascending</option> 					</select>&nbsp;&nbsp;&nbsp;&nbsp;-<? if ($LoggedUser['DisableGrouping']) { ?>+<? if (isset($LoggedUser['DisableGrouping'])) { ?> 					<input type="checkbox" name="enablegrouping" id="enablegrouping" value="1" <? if(!$DisableGrouping) { ?>checked="checked"<? } ?> /> <label for="enablegrouping"><strong>Enable grouping</strong></label> <? } else { ?>-					<input type="checkbox" name="disablegrouping" id="disablegrouping" value="1" <? if($DisableGrouping) { ?>checked="checked"<? } ?> /> <label for="disablegrouping"><strong>Disable grouping</strong></label>+					<input type="checkbox" name="disablegrouping" id="disablegrouping" value="1" <? if(isset($DisableGrouping)) { ?>checked="checked"<? } ?> /> <label for="disablegrouping"><strong>Disable grouping</strong></label> <? } ?> 				</td> 			</tr>@@ -694,7 +694,7 @@ 			<tr> <?	} ?> 				<td>-					<input type="checkbox" name="filter_cat[<?=($CatKey+1)?>]" id="cat_<?=($CatKey+1)?>" value="1" <? if($_GET['filter_cat'][$CatKey+1]==1) { ?>checked="checked"<? } ?> />+					<input type="checkbox" name="filter_cat[<?=($CatKey+1)?>]" id="cat_<?=($CatKey+1)?>" value="1" <? if(isset($_GET['filter_cat'][$CatKey+1]) && $_GET['filter_cat'][$CatKey+1]==1) { ?>checked="checked"<? } ?> /> 					<label for="cat_<?=($CatKey+1)?>"><?=$CatName?></label> 				</td> <?@@ -739,7 +739,7 @@ 		</table> 		<table class="cat_list" width="100%"> 			<tr>-				<td class="label"><a href="#" onclick="return swapTagList();" id="swaptags"><? if(!$LoggedUser['ShowTags']) { ?>Show<? } else { ?>Hide<? } ?> tags</a></td>+				<td class="label"><a href="#" onclick="return swapTagList();" id="swaptags"><? if(!isset($LoggedUser['ShowTags'])) { ?>Show<? } else { ?>Hide<? } ?> tags</a></td> 			</tr> 		</table> 		<div class="submit">@@ -747,12 +747,12 @@ 			<input type="submit" value="Filter Torrents" /> 			<input type="button" value="Reset" onclick="location.href='torrents.php<? if($_GET['action']=="advanced") { ?>?action=advanced<? } ?>'" /> 			&nbsp;&nbsp;-<? if ($TorrentWhere || $GroupWhere || $OrderBy!="s3" || $OrderWay!="DESC") { ?>+<? if (isset($TorrentWhere) || isset($GroupWhere) || $OrderBy!="s3" || $OrderWay!="DESC") { ?> 			<input type="submit" name="setdefault" value="Make Default" /> <? } -if ($LoggedUser['DefaultSearch']) {+if (isset($LoggedUser['DefaultSearch'])) { ?> 			<input type="submit" name="cleardefault" value="Clear Default" /> <? } ?>@@ -778,12 +778,12 @@ 		<td class="sign"><a href="<?=header_link('s7')?>"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/leechers.png" alt="Leechers" title="Leechers" /></a></td> 	</tr> <?-	if($LoggedUser['TorrentGrouping']==0) {+	if(isset($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==0) { 		$HideGroup=''; 		$ActionTitle="Collapse"; 		$ActionURL="hide"; -	} elseif($LoggedUser['TorrentGrouping']==1) {+	} elseif(isset($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { 		$HideGroup="hide"; 		$ActionTitle="Expand"; 		$ActionURL="show";Index: sections/torrents/index.php===================================================================--- sections/torrents/index.php	(revision 18)+++ sections/torrents/index.php	(working copy)@@ -1,4 +1,5 @@ <?+$_REQUEST['action'] = ( isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default' ); switch($_REQUEST['action']){ 	case 'edit': 		enforce_login();@@ -306,7 +307,7 @@ 	default: 		enforce_login(); 	-		if($_GET['id']) {+		if(isset($_GET['id'])) { 			include('details.php'); 		} else { 			include('browse.php');Index: sections/upload/index.php===================================================================--- sections/upload/index.php	(revision 18)+++ sections/upload/index.php	(working copy)@@ -4,7 +4,7 @@ if($LoggedUser['DisableUpload']) { error('', 'Your upload privileges have been revoked', 'Permission denied', '', true); } //build the page -if ($_POST['submit']) {+if (isset($_POST['submit'])) { 	include('upload_handle.php'); } else { 	include(SERVER_ROOT.'/sections/upload/upload.php');Index: sections/upload/upload.php===================================================================--- sections/upload/upload.php	(revision 18)+++ sections/upload/upload.php	(working copy)@@ -11,7 +11,7 @@  show_header('Upload','upload'); -if($_GET['groupid'] && is_number($_GET['groupid'])) {+if(isset($_GET['groupid']) && is_number($_GET['groupid'])) { 	$DB->query("SELECT  		tg.ID as GroupID, 		tg.CategoryID,@@ -34,15 +34,15 @@ }  require_once(SERVER_ROOT.'/classes/class_torrent_form.php');-$TorentForm = new TORRENT_FORM($Properties, $Err);+$TorentForm = new TORRENT_FORM(&$Properties, &$Err); -if(!$Text) {+if(!isset($Text)) { 	include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class 	$Text = new TEXT; }  $GenreTags = $Cache->get_value('genre_tags');-if(!$GenreTags) {+if(!isset($GenreTags)) { 	$DB->query('SELECT Name FROM tags WHERE TagType=\'genre\' ORDER BY Name'); 	$GenreTags =  $DB->collect('Name'); 	$Cache->cache_value('genre_tags', $GenreTags, 3600*6);@@ -74,6 +74,7 @@ <?  $TorentForm->head();+$UploadForm=( isset($UploadForm) ? $UploadForm : 'default' ); switch ($UploadForm) { 	case 'Music': 	$TorentForm->music_form($GenreTags);Index: sections/user/edit.php===================================================================--- sections/user/edit.php	(revision 18)+++ sections/user/edit.php	(working copy)@@ -5,17 +5,17 @@ show_header("Edit $Username's profile",'validate');  //$Stylesheets = $Cache->get_value('stylesheets');-if (!$Stylesheets) {+if (!isset($Stylesheets)) { 	$DB->query('SELECT ID, Name FROM stylesheets'); 	$Stylesheets = $DB->to_array(false, MYSQLI_BOTH); 	$Cache->cache_value('stylesheets', $Stylesheets, 600); } echo $Val->GenerateJS('userform'); -if ($Err) {+if (isset($Err)) { ?> <div class="error_message"><?=$Err?></div>-<? } elseif ($Message) { ?>+<? } elseif (isset($Message)) { ?> <div class="save_message"><?=$Message?></div> <? } ?> <div class="thin">@@ -61,8 +61,8 @@ 				<td class="label"><strong>Default Search Type</strong></td> 				<td> 					<select name="searchtype" id="searchtype">-						<option value="0"<? if ($SiteOptions['SearchType'] == "0") { ?>selected="selected"<? } ?>>Simple</option>-						<option value="1"<? if ($SiteOptions['SearchType'] == "1") { ?>selected="selected"<? } ?>>Advanced</option>+						<option value="0"<? if (isset($SiteOptions['SearchType']) && $SiteOptions['SearchType'] == "0") { ?>selected="selected"<? } ?>>Simple</option>+						<option value="1"<? if (isset($SiteOptions['SearchType']) && $SiteOptions['SearchType'] == "1") { ?>selected="selected"<? } ?>>Advanced</option> 					</select> 				</td> 			</tr>@@ -70,8 +70,8 @@ 				<td class="label"><strong>Artist search bar</strong></td> 				<td> 					<select name="artistnoredirect" id="artistnoredirect">-						<option value="0"<? if ($SiteOptions['ArtistNoRedirect'] == "0") { ?>selected="selected"<? } ?>>Redirects to artist page on exact match</option>-						<option value="1"<? if ($SiteOptions['ArtistNoRedirect'] == "1") { ?>selected="selected"<? } ?>>Sends to advanced search</option>+						<option value="0"<? if (isset($SiteOptions['ArtistNoRedirect']) && $SiteOptions['ArtistNoRedirect'] == "0") { ?>selected="selected"<? } ?>>Redirects to artist page on exact match</option>+						<option value="1"<? if (isset($SiteOptions['ArtistNoRedirect']) && $SiteOptions['ArtistNoRedirect'] == "1") { ?>selected="selected"<? } ?>>Sends to advanced search</option> 					</select> 				</td> 			</tr>@@ -80,12 +80,12 @@ 				<td class="label"><strong>Torrent Grouping</strong></td> 				<td> 					<select name="disablegrouping" id="disablegrouping">-						<option value="0"<? if ($SiteOptions['DisableGrouping']=="0") { ?>selected="selected"<? } ?>>Group torrents by default</option>-						<option value="1"<? if ($SiteOptions['DisableGrouping']=="1") { ?>selected="selected"<? } ?>>DO NOT Group torrents by default</option>+						<option value="0"<? if (isset($SiteOptions['DisableGrouping']) && $SiteOptions['DisableGrouping']=="0") { ?>selected="selected"<? } ?>>Group torrents by default</option>+						<option value="1"<? if (isset($SiteOptions['DisableGrouping']) && $SiteOptions['DisableGrouping']=="1") { ?>selected="selected"<? } ?>>DO NOT Group torrents by default</option> 					</select>&nbsp; 					<select name="torrentgrouping" id="torrentgrouping">-						<option value="0"<? if ($SiteOptions['TorrentGrouping']=="0") { ?>selected="selected"<? } ?>>Groups are open by default</option>-						<option value="1"<? if ($SiteOptions['TorrentGrouping']=="1") { ?>selected="selected"<? } ?>>Groups are closed by default</option>+						<option value="0"<? if (isset($SiteOptions['TorrentGrouping']) && $SiteOptions['TorrentGrouping']=="0") { ?>selected="selected"<? } ?>>Groups are open by default</option>+						<option value="1"<? if (isset($SiteOptions['TorrentGrouping']) && $SiteOptions['TorrentGrouping']=="1") { ?>selected="selected"<? } ?>>Groups are closed by default</option> 					</select> 				</td> 			</tr>@@ -93,8 +93,8 @@ 				<td class="label"><strong>Discography View</strong></td> 				<td> 					<select name="discogview" id="discogview">-						<option value="0"<? if ($SiteOptions['DiscogView'] == "0") { ?>selected="selected"<? } ?>>Open by default</option>-						<option value="1"<? if ($SiteOptions['DiscogView'] == "1") { ?>selected="selected"<? } ?>>Closed by default</option>+						<option value="0"<? if (isset($SiteOptions['DiscogView']) && $SiteOptions['DiscogView'] == "0") { ?>selected="selected"<? } ?>>Open by default</option>+						<option value="1"<? if (isset($SiteOptions['DiscogView']) && $SiteOptions['DiscogView'] == "1") { ?>selected="selected"<? } ?>>Closed by default</option> 					</select> 				</td> 			</tr>@@ -111,14 +111,14 @@ 			<tr> 				<td class="label"><strong>Show Query List</strong></td> 				<td>-					<input type="checkbox" name="showquerylist" id="showquerylist" <? if ($SiteOptions['ShowQueryList']) { ?>checked="checked"<? } ?> />+					<input type="checkbox" name="showquerylist" id="showquerylist" <? if (isset($SiteOptions['ShowQueryList'])) { ?>checked="checked"<? } ?> /> 					<label for="querylist">Open the query list by default</label> 				</td> 			</tr> 			<tr> 				<td class="label"><strong>Show Cache List</strong></td> 				<td>-					<input type="checkbox" name="showcachelist" id="showcachelist" <? if ($SiteOptions['ShowCacheList']) { ?>checked="checked"<? } ?> />+					<input type="checkbox" name="showcachelist" id="showcachelist" <? if (isset($SiteOptions['ShowCacheList'])) { ?>checked="checked"<? } ?> /> 					<label for="cachelist">Open the cache list by default</label> 				</td> 			</tr>@@ -126,14 +126,14 @@ 			<tr> 				<td class="label"><strong>View avatars</strong></td> 				<td>-					<input type="checkbox" name="viewavatars" id="viewavatars" <? if ($SiteOptions['ViewAvatars']) { ?>checked="checked"<? } ?> />+					<input type="checkbox" name="viewavatars" id="viewavatars" <? if (isset($SiteOptions['ViewAvatars'])) { ?>checked="checked"<? } ?> /> 					<label for="viewavatars">Low bandwidth users might want to turn this off</label> 				</td> 			</tr> 			<tr> 				<td class="label"><strong>Download torrents as text files</strong></td> 				<td>-					<input type="checkbox" name="downloadalt" id="downloadalt" <? if ($LoggedUser['DownloadAlt']) { ?>checked="checked"<? } ?> />+					<input type="checkbox" name="downloadalt" id="downloadalt" <? if (isset($LoggedUser['DownloadAlt'])) { ?>checked="checked"<? } ?> /> 					<label for="downloadalt">For users whose ISP block the downloading of torrent files</label> 				</td> 			</tr>Index: sections/user/index.php===================================================================--- sections/user/index.php	(revision 18)+++ sections/user/index.php	(working copy)@@ -7,6 +7,7 @@ enforce_login(); include(SERVER_ROOT."/classes/class_validate.php"); $Val=NEW VALIDATE;+$_REQUEST['action']=( isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default' );  switch ($_REQUEST['action']) { 	case 'notify':@@ -65,7 +66,7 @@ 		$Val->SetFields('new_pass_1',0,"string","You did not enter a valid password, must be between 6 and 40 characters long.",array('minlength'=>6,'maxlength'=>40)); 		$Val->SetFields('new_pass_2',1,"compare","Your passwords to not match.",array('comparefield'=>'new_pass_1')); -		if ($_POST['action']) {+		if (isset($_POST['action'])) { 			$Err=$Val->ValidateForm($_POST); 			if ($LoggedUser['Email']!=$_POST['email']) { 				$OldEmail = db_string($LoggedUser['Email']);@@ -157,13 +158,19 @@ 					i.Country, 					i.StyleID, 					i.StyleURL,-					i.SiteOptions+					i.SiteOptions,+					i.ViewAvatars,+					i.TorrentGrouping,+					i.ShowTags,+					i.DeletePMs,+					i.SaveSentPMs,+					m.Class 					FROM users_main AS m 					JOIN users_info AS i ON i.UserID = m.ID 					WHERE m.ID = '".db_string($UserID)."'"); 		list($Username,$Email,$IRCKey,$Paranoia,$Info,$Avatar,$Country,$StyleID,$StyleURL,$SiteOptions,$ViewAvatars,$TorrentGrouping,$ShowTags,$DeletePMs,$SavePMs,$Class)=$DB->next_record(MYSQLI_NUM, array(9)); -		if ($Email != $_POST['email']) { }+		if (isset($_POST['email']) && $Email != $_POST['email']) { }  		if ($SiteOptions) { $SiteOptions=unserialize($SiteOptions); } 		else { $SiteOptions=array(); }@@ -173,7 +180,7 @@  	case 'invitetree': 	case 'invite':-		if ($_POST['action']) {+		if (isset($_POST['action'])) { 			include('takeinvite.php'); 		} else { 			include('invite.php');Index: sections/user/invite.php===================================================================--- sections/user/invite.php	(revision 18)+++ sections/user/invite.php	(working copy)@@ -1,5 +1,5 @@ <?-if($_GET['userid'] && check_perms('users_view_invites')){+if(isset($_GET['userid']) && check_perms('users_view_invites')){ 	$UserID=$_GET['userid']; 	if(!is_number($UserID)){ error(403); } 	$Sneaky = true;@@ -21,9 +21,9 @@ 	</div> <? } -if(!$Sneaky && $LoggedUser['DisableInvites'] == '0' && ($LoggedUser['Invites']>0 || check_perms('site_send_unlimited_invites')) && ($NumUsers < USER_LIMIT || check_perms('site_can_invite_always'))){ ?> +if(!isset($Sneaky) && $LoggedUser['DisableInvites'] == '0' && ($LoggedUser['Invites']>0 || check_perms('site_send_unlimited_invites')) && ($NumUsers < USER_LIMIT || check_perms('site_can_invite_always'))){ ?>  	<div class="center">-<?	if($_SESSION['error']){?> +<?	if(isset($_SESSION['error'])){?>  		<p style="color: red;text-align:center;"><?= $_SESSION['error']?></p> <?		unset($_SESSION['error']); 	}?> Index: sections/user/notify_edit.php===================================================================--- sections/user/notify_edit.php	(revision 18)+++ sections/user/notify_edit.php	(working copy)@@ -4,7 +4,7 @@ ?> <div class="thin"> <?-if($_SESSION['error']){+if(isset($_SESSION['error'])){ 	echo '<div class="error_message">'.$_SESSION['error'].'</div>'; 	unset($_SESSION['error']); }Index: sections/user/user.php===================================================================--- sections/user/user.php	(revision 18)+++ sections/user/user.php	(working copy)@@ -322,7 +322,7 @@ 	JOIN requests_tags AS rt ON rt.RequestID=r.ID 	JOIN tags AS t ON t.ID=rt.TagID 	WHERE r.UserID='.$UserID;-if(!$_GET['showall']){+if(!isset($_GET['showall'])){ 	$sql.= ' AND r.Filled=0 '; } $sql .= ' GROUP BY r.IDIndex: sections/userhistory/post_history.php===================================================================--- sections/userhistory/post_history.php	(revision 18)+++ sections/userhistory/post_history.php	(working copy)@@ -12,7 +12,7 @@ 	die('I think not!'); } -if($_GET['page']){+if(isset($_GET['page'])){ 	if(!is_number($_GET['page'])){ 		die('Come on, that was just lame. What did you think we were going to do with the page value? Did you really think that we\'d put an unprocessed "page" value straight into the database? How would that even work? Dumbass. You should be ashamed of yourself.'); 	}@@ -68,14 +68,14 @@ 	JOIN forums_topics AS t ON t.ID         = p.TopicID 	JOIN forums AS f ON f.ID                = t.ForumID '; -if($UserID == $LoggedUser['ID'] && $_GET['showunread']){+if($UserID == $LoggedUser['ID'] && isset($_GET['showunread'])){ 	$sql.=' LEFT JOIN forums_last_read_topics AS l ON l.UserID='.$UserID.' AND l.TopicID=t.ID '; }  $sql .= ' WHERE p.AuthorID = '.$UserID.' 	AND f.MinClassRead<='.$LoggedUser['Class']; -if($UserID == $LoggedUser['ID'] && $_GET['showunread']){+if($UserID == $LoggedUser['ID'] && isset($_GET['showunread'])){ 	$sql.=' AND (l.PostID<t.LastPostID OR l.PostID IS NULL) '; } @@ -116,13 +116,13 @@ 	<div class="linkbox"> <? $URL = 'action=posts&amp;userid='.$UserID;-if($_GET['showunread']) { $URL.='&amp;showunread=1'; }+if(isset($_GET['showunread'])) { $URL.='&amp;showunread=1'; } -$Pages=get_pages('userhistory.php',$_GET['page'],$Results,POSTS_PER_PAGE,$URL,true, 11);+$Pages=get_pages('userhistory.php',( isset($_GET['page']) ? $_GET['page'] : '' ),$Results,POSTS_PER_PAGE,$URL,true, 11); echo $Pages;  if($ViewingOwn){-	if(!$_GET['showunread']){ ?>+	if(!isset($_GET['showunread'])){ ?> 		<br /><br /> 		<a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>&amp;showunread=1">Only display posts with unread replies</a> <?	} else { ?>Index: sections/watchlist/index.php===================================================================--- sections/watchlist/index.php	(revision 18)+++ sections/watchlist/index.php	(working copy)@@ -1,10 +1,11 @@ <? enforce_login(); if(!check_perms('admin_watched_users')) { error(403); }-if($_REQUEST['userid'] && !is_number($_REQUEST['userid'])){+if(isset($_REQUEST['userid']) && !is_number($_REQUEST['userid'])){ 	header('Location: watchlist.php'); 	die(); }+$_REQUEST['action']=( isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default' ); switch($_REQUEST['action']){ case 'add': 	include('add.php');Index: sections/watchlist/watchlist.php===================================================================--- sections/watchlist/watchlist.php	(revision 18)+++ sections/watchlist/watchlist.php	(working copy)@@ -19,7 +19,7 @@ show_header('Watched users');  // SQL limit-if($_GET['page']){+if(isset($_GET['page'])){ 	$Limit=WATCHED_USERS_PER_PAGE*$_GET['page']-WATCHED_USERS_PER_PAGE . ', ' . WATCHED_USERS_PER_PAGE; } else { 	$Limit=WATCHED_USERS_PER_PAGE;@@ -64,7 +64,7 @@ 	<div class="linkbox"> <? // Pagination-$Pages=get_pages('watchlist.php',$_GET['page'],$Results,WATCHED_USERS_PER_PAGE,'',true, 11);+$Pages=get_pages('watchlist.php',( isset($_GET['page']) ? $_GET['page'] : '' ),$Results,WATCHED_USERS_PER_PAGE,'',true, 11); echo $Pages; ?> 	</div>