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']) . '&tag=' . urlencode($_GET['tag']) . '&tags=' . urlencode($_GET['tags']) . '&order=' . urlencode($_GET['order']) . '&sort='. urlencode($_GET['sort']);
- if($_GET['showall']){
+ $this->URL = ( isset($_GET['search']) ? 'search=' . urlencode($_GET['search']) . '&' : '' ).
+ ( isset($_GET['tag']) ? 'tag=' . urlencode($_GET['tag']) . '&' : '' ).
+ ( isset($_GET['tags']) ? 'tags=' . urlencode($_GET['tags']) . '&' : '' ).
+ ( isset($_GET['order']) ? 'order=' . urlencode($_GET['order']) . '&' : '' ).
+ ( isset($_GET['sort']) ? 'sort='. urlencode($_GET['sort']) : '' );
+ if(isset($_GET['showall'])){
$this->URL .= '&showall=1';
}
- if($_GET['type']){
+ if(isset($_GET['type'])){
$this->URL .= '&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 @@
| Search terms: |
-
+
|
@@ -109,7 +113,7 @@
| Include filled: |
- checked="checked" } ?> />
+ checked="checked" } ?> />
|
} ?>
@@ -125,7 +129,7 @@
//---------------------------------------------------
- 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);
//-------------------------------------------------------
?>
@@ -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 @@
//---------------------------------------------------
- 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);
//--------------------------------------------------------
?>
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']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 @@