From 550d9853e19179d961b2f803c1fba72716a9da4c Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Wed, 19 Nov 2008 21:22:51 -0500 Subject: Fixed a few code nags --- includes/functions_quotes.php | 128 +++++++++++++++++++++--------------------- pages/admin.php | 1 + theme/header.tpl | 3 +- 3 files changed, 66 insertions(+), 66 deletions(-) diff --git a/includes/functions_quotes.php b/includes/functions_quotes.php index e3ca2c0..2b05cab 100755 --- a/includes/functions_quotes.php +++ b/includes/functions_quotes.php @@ -8,7 +8,7 @@ 4::::4 4::::4 4::::4 4::::4 Written and maintained by Starla Insigna 4::::444444::::444 -4::::::::::::::::4 includes/functions_quotes.inc +4::::::::::::::::4 includes/functions_quotes.php 4444444444:::::444 4::::4 Please do not use, reproduce or steal the 4::::4 contents of this file without explicit @@ -29,7 +29,7 @@ function quote_generation($query, $origin, $page = 1, $quote_limit = 50, $page_l { $template->adds_block('PAGENUMBERS',array('exi'=>1)); page_numbers($template, $origin, $quote_limit, $page, $page_limit); - $up_lim = ($quote_limit * $page); + $up_lim = ($quote_limit * $page); $low_lim = $up_lim - $quote_limit; $query .= "LIMIT $low_lim,$quote_limit"; } @@ -110,86 +110,86 @@ function page_numbers($template, $origin, $quote_limit, $page_default, $page_lim $template->add('LASTPAGE',$pagenum); } -function user_quote_status($where, $quote_num, $template) -{ - $tracking_verdict = ip_track($where, $quote_num); +function user_quote_status($where, $quote_num, $template) +{ + $tracking_verdict = ip_track($where, $quote_num); if ($where != 'flag') - { + { switch ($tracking_verdict) - { - case 1: - $template->add('TRACKING',"Quote has been modified, and data of your action has been recorded in the database."); - break; - case 2: - $template->add('TRACKING',"Quote has been modified, your IP has been logged, and data of your action has been recorded in the database."); - break; - case 3: - $template->add('TRACKING',"You have already voted on this quote, please try again later."); - break; - } - } - return $tracking_verdict; -} - -function ip_track($where, $quote_num) -{ + { + case 1: + $template->add('TRACKING',"Quote has been modified, and data of your action has been recorded in the database."); + break; + case 2: + $template->add('TRACKING',"Quote has been modified, your IP has been logged, and data of your action has been recorded in the database."); + break; + case 3: + $template->add('TRACKING',"You have already voted on this quote, please try again later."); + break; + } + } + return $tracking_verdict; +} + +function ip_track($where, $quote_num) +{ switch ($where) - { - case 'flag': - $where2 = 'vote'; - break; - case 'vote': - $where2 = 'flag'; - break; - } + { + case 'flag': + $where2 = 'vote'; + break; + case 'vote': + $where2 = 'flag'; + break; + } $getip = "SELECT * FROM rash_tracking WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; $getip2 = mysql_query($getip); - $getip3 = mysql_fetch_array($getip2); - + $getip3 = mysql_fetch_array($getip2); + if ($getip3['ip'] == $_SERVER['REMOTE_ADDR']) { - $quote_array = explode(",", $getip3['quote_id']); - $quote_place = array_search($quote_num, $quote_array); + $quote_array = explode(",", $getip3['quote_id']); + $quote_place = array_search($quote_num, $quote_array); if (in_array($quote_num, $quote_array)) - { - $where_result = explode(",", $getip3[$where]); + { + $where_result = explode(",", $getip3[$where]); if (!isset($where_result[$quote_place])) - { - $where_result[$quote_place] = 1; + { + $where_result[$quote_place] = 1; $where_result = implode(",", $where_result); $setip = "UPDATE rash_tracking SET " . $where . " = \"" . $where_result . "\" WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; - $setip2 = mysql_query($getip); - return 1; - } else { - return 3; - } + $setip2 = mysql_query($getip); + return 1; + } else { + return 3; + } } else { $setip = "UPDATE rash_tracking SET " . $where . " = CONCAT(" . $where . ",\",1\"), " . $where2 . " = CONCAT(" . $where2 . ",\",0\"), quote_id = CONCAT(quote_id,\"," . $quote_num . "\") WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; - $setip2 = mysql_query($setip); - return 1; - } + $setip2 = mysql_query($setip); + return 1; + } } else { $insip = "INSERT INTO rash_tracking (ip, quote_id, " . $where . ", " . $where2 . ") VALUES (\"" . $_SERVER['REMOTE_ADDR'] . "\", \"" . $quote_num . "\", 1, 0)"; - $insip2 = mysql_query($insip); - return 2; - } + $insip2 = mysql_query($insip); + return 2; + } } -function verify_int($subject) -{ - $ymax = strlen($subject); - $y = 0; - while($y < $ymax) - { - if ((is_int((int)($subject{$y})) && (int)($subject{$y})) || (int)($subject{$y}) === 0 ) - { - $y++; - } else { - return false; - } - } - return true; +function verify_int($subject) +{ + $ymax = strlen($subject); + $y = 0; + while($y < $ymax) + { + if ((is_int((int)($subject{$y})) && (int)($subject{$y})) || (int)($subject{$y}) === 0 ) + { + $y++; + } else { + return false; + } + } + return true; } ?> diff --git a/pages/admin.php b/pages/admin.php index e0c8d3f..195ac64 100755 --- a/pages/admin.php +++ b/pages/admin.php @@ -548,6 +548,7 @@ if (isLoggedIn()) $template->adds_block('QUOTE', array( 'ID' => $getpending3[$i]['id'], 'TEXT' => nl2br($getpending3[$i]['quote']))); } + $i++; } } else if ($_GET['page'] == 'actionPendingQuotes') diff --git a/theme/header.tpl b/theme/header.tpl index e818e69..d296a6c 100755 --- a/theme/header.tpl +++ b/theme/header.tpl @@ -46,8 +46,7 @@