From bdf49b33cbcbaef3a456fd158fb85d435ef4421e Mon Sep 17 00:00:00 2001 From: jgen Date: Sat, 19 Apr 2014 01:18:49 -0400 Subject: [PATCH 1/6] Some more linting thanks to scrutinizer-ci --- ext/danbooru_api/main.php | 1 + ext/sitemap/main.php | 2 ++ ext/statsd/main.php | 3 ++- ext/tag_editcloud/script.js | 2 +- ext/tag_history/main.php | 14 +++++++------- ext/upload/main.php | 2 ++ 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ext/danbooru_api/main.php b/ext/danbooru_api/main.php index 987ee8c4..2b475a9e 100644 --- a/ext/danbooru_api/main.php +++ b/ext/danbooru_api/main.php @@ -208,6 +208,7 @@ class DanbooruApi extends Extension { // Fire off an event which should process the new file and add it to the db $fileinfo = pathinfo($filename); + $metadata = array(); $metadata['filename'] = $fileinfo['basename']; $metadata['extension'] = $fileinfo['extension']; $metadata['tags'] = $posttags; diff --git a/ext/sitemap/main.php b/ext/sitemap/main.php index 3044ffe7..056d07fe 100644 --- a/ext/sitemap/main.php +++ b/ext/sitemap/main.php @@ -62,7 +62,9 @@ class XMLSitemap extends Extension { private function handle_full_sitemap() { global $database, $config; + // add index + $index = array(); $index[0] = $config->get_string("front_page"); $this->add_sitemap_queue($index, "weekly", "1"); diff --git a/ext/statsd/main.php b/ext/statsd/main.php index 4a9e4b81..a365183a 100644 --- a/ext/statsd/main.php +++ b/ext/statsd/main.php @@ -99,7 +99,7 @@ class StatsDInterface extends Extension { // Wrap this in a try/catch - failures in any of this should be silently ignored try { - $parts = explode(":", STATSD_HOST); + $parts = explode(":", STATSD_HOST); $host = $parts[0]; $port = $parts[1]; $fp = fsockopen("udp://$host", $port, $errno, $errstr); @@ -109,6 +109,7 @@ class StatsDInterface extends Extension { } fclose($fp); } catch (Exception $e) { + // ignore any failures. } } } diff --git a/ext/tag_editcloud/script.js b/ext/tag_editcloud/script.js index ae4d8eb1..b71818c4 100644 --- a/ext/tag_editcloud/script.js +++ b/ext/tag_editcloud/script.js @@ -20,7 +20,7 @@ Array.prototype.editcloud_remove = function (ele) { var hide_text = null; function tageditcloud_toggle_extra(hide) { - if (hide_text == null) { + if (hide_text === null) { hide_text = hide.innerHTML; } diff --git a/ext/tag_history/main.php b/ext/tag_history/main.php index 9550215f..b6e6605c 100644 --- a/ext/tag_history/main.php +++ b/ext/tag_history/main.php @@ -135,13 +135,13 @@ class Tag_History extends Extension { // there is no history entry with that id so either the image was deleted // while the user was viewing the history, someone is playing with form // variables or we have messed up in code somewhere. - /* calling die() is probably not a good idea, we should throw an Exception */ + /* FIXME: calling die() is probably not a good idea, we should throw an Exception */ die("Error: No tag history with specified id was found."); } // lets get the values out of the result $stored_result_id = $result['id']; - $stored_image_id = $result['image_id']; + $stored_image_id = int_escape($result['image_id']); $stored_tags = $result['tags']; log_debug("tag_history", 'Reverting tags of Image #'.$stored_image_id.' to ['.$stored_tags.']'); @@ -267,7 +267,7 @@ class Tag_History extends Extension { log_info("tag_history", 'Attempting to revert edits where '.implode(" and ", $select_code)." (".implode(" / ", $select_args).")"); - // Get all the images that the given IP has changed tags on (within the timeframe) that were last editied by the given IP + // Get all the images that the given IP has changed tags on (within the timeframe) that were last edited by the given IP $result = $database->get_col(' SELECT t1.image_id FROM tag_histories t1 @@ -304,8 +304,8 @@ class Tag_History extends Extension { } // lets get the values out of the result - $stored_result_id = $result['id']; - $stored_image_id = $result['image_id']; + $stored_result_id = int_escape($result['id']); + $stored_image_id = int_escape($result['image_id']); $stored_tags = $result['tags']; log_debug("tag_history", 'Reverting tags of Image #'.$stored_image_id.' to ['.$stored_tags.']'); @@ -350,8 +350,8 @@ class Tag_History extends Extension { $entries++; } - // add a history entry - $row = $database->execute(" + // add a history entry + $database->execute(" INSERT INTO tag_histories(image_id, tags, user_id, user_ip, date_set) VALUES (?, ?, ?, ?, now())", array($image->id, $new_tags, $user->id, $_SERVER['REMOTE_ADDR'])); diff --git a/ext/upload/main.php b/ext/upload/main.php index 4c3d19b4..e6b8dfaa 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -277,6 +277,7 @@ class Upload extends Extension { } $pathinfo = pathinfo($file['name']); + $metadata = array(); $metadata['filename'] = $pathinfo['basename']; $metadata['extension'] = $pathinfo['extension']; $metadata['tags'] = $tags; @@ -347,6 +348,7 @@ class Upload extends Extension { }else{ global $user; $pathinfo = pathinfo($url); + $metadata = array(); $metadata['filename'] = $filename; $metadata['extension'] = getExtension($headers['Content-Type']) ?: $pathinfo['extension']; $metadata['tags'] = $tags; From 2da8c19a07d61bfb4307c9aebc452556c1f5d13e Mon Sep 17 00:00:00 2001 From: jgen Date: Sat, 19 Apr 2014 01:36:18 -0400 Subject: [PATCH 2/6] More linting! --- core/database.class.php | 2 +- core/util.inc.php | 58 ++++++++++++++++++++-------------------- ext/chatbox/js/yshout.js | 9 ++++--- ext/pools/main.php | 24 +++++++++-------- 4 files changed, 48 insertions(+), 45 deletions(-) diff --git a/core/database.class.php b/core/database.class.php index eb00e1ab..a22c838c 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -229,7 +229,7 @@ class MemcacheCache implements CacheEngine { class APCCache implements CacheEngine { var $hits=0, $misses=0; - public function __construct($args) {} + public function __construct() {} public function get($key) { assert(!is_null($key)); diff --git a/core/util.inc.php b/core/util.inc.php index 587f66a0..8eae8fbb 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -10,7 +10,7 @@ require_once "lib/context.php"; /** * Make some data safe for printing into HTML * - * @retval string + * @return string */ function html_escape($input) { return htmlentities($input, ENT_QUOTES, "UTF-8"); @@ -19,7 +19,7 @@ function html_escape($input) { /** * Make sure some data is safe to be used in integer context * - * @retval int + * @return int */ function int_escape($input) { /* @@ -32,7 +32,7 @@ function int_escape($input) { /** * Make sure some data is safe to be used in URL context * - * @retval string + * @return string */ function url_escape($input) { /* @@ -66,7 +66,7 @@ function url_escape($input) { /** * Make sure some data is safe to be used in SQL context * - * @retval string + * @return string */ function sql_escape($input) { global $database; @@ -77,7 +77,7 @@ function sql_escape($input) { /** * Turn all manner of HTML / INI / JS / DB booleans into a PHP one * - * @retval boolean + * @return boolean */ function bool_escape($input) { /* @@ -112,7 +112,7 @@ function bool_escape($input) { * Some functions require a callback function for escaping, * but we might not want to alter the data * - * @retval string + * @return string */ function no_escape($input) { return $input; @@ -156,7 +156,7 @@ function truncate($string, $limit, $break=" ", $pad="...") { /** * Turn a human readable filesize into an integer, eg 1KB -> 1024 * - * @retval int + * @return int */ function parse_shorthand_int($limit) { if(is_numeric($limit)) { @@ -167,8 +167,8 @@ function parse_shorthand_int($limit) { $value = $m[1]; if (isset($m[2])) { switch(strtolower($m[2])) { - case 'g': $value *= 1024; # fallthrough - case 'm': $value *= 1024; # fallthrough + case 'g': $value *= 1024; // fall through + case 'm': $value *= 1024; // fall through case 'k': $value *= 1024; break; default: $value = -1; } @@ -182,7 +182,7 @@ function parse_shorthand_int($limit) { /** * Turn an integer into a human readable filesize, eg 1024 -> 1KB * - * @retval string + * @return string */ function to_shorthand_int($int) { if($int >= pow(1024, 3)) { @@ -203,7 +203,7 @@ function to_shorthand_int($int) { /** * Turn a date into a time, a date, an "X minutes ago...", etc * - * @retval string + * @return string */ function autodate($date, $html=true) { $cpu = date('c', strtotime($date)); @@ -214,7 +214,7 @@ function autodate($date, $html=true) { /** * Check if a given string is a valid date-time. ( Format: yyyy-mm-dd hh:mm:ss ) * - * @retval boolean + * @return boolean */ function isValidDateTime($dateTime) { if (preg_match("/^(\d{4})-(\d{2})-(\d{2}) ([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/", $dateTime, $matches)) { @@ -229,7 +229,7 @@ function isValidDateTime($dateTime) { /** * Check if a given string is a valid date. ( Format: yyyy-mm-dd ) * - * @retval boolean + * @return boolean */ function isValidDate($date) { if (preg_match("/^(\d{4})-(\d{2})-(\d{2})$/", $date, $matches)) { @@ -248,7 +248,7 @@ function isValidDate($date) { * * FIXME: also check that IP ban ext is installed * - * @retval string + * @return string */ function show_ip($ip, $ban_reason) { global $user; @@ -264,7 +264,7 @@ function show_ip($ip, $ban_reason) { * * @param $haystack String to examine. * @param $needle String to look for. - * @retval bool + * @return bool */ function startsWith(/*string*/ $haystack, /*string*/ $needle) { $length = strlen($needle); @@ -276,7 +276,7 @@ function startsWith(/*string*/ $haystack, /*string*/ $needle) { * * @param $haystack String to examine. * @param $needle String to look for. - * @retval bool + * @return bool */ function endsWith(/*string*/ $haystack, /*string*/ $needle) { $length = strlen($needle); @@ -295,7 +295,7 @@ function endsWith(/*string*/ $haystack, /*string*/ $needle) { * * eg make_link("post/list") becomes "/v2/index.php?q=post/list" * - * @retval string + * @return string */ function make_link($page=null, $query=null) { global $config; @@ -331,7 +331,7 @@ function make_link($page=null, $query=null) { /** * Take the current URL and modify some paramaters * - * @retval string + * @return string */ function modify_current_url($changes) { return modify_url($_SERVER['QUERY_STRING'], $changes); @@ -372,7 +372,7 @@ function modify_url($url, $changes) { /** * Turn a relative link into an absolute one, including hostname * - * @retval string + * @return string */ function make_http(/*string*/ $link) { if(strpos($link, "ttp://") > 0) return $link; @@ -639,7 +639,7 @@ function _count_execs($db, $sql, $inputarray) { /** * Compare two Block objects, used to sort them before being displayed * - * @retval int + * @return int */ function blockcmp(Block $a, Block $b) { if($a->position == $b->position) { @@ -653,7 +653,7 @@ function blockcmp(Block $a, Block $b) { /** * Figure out PHP's internal memory limit * - * @retval int + * @return int */ function get_memory_limit() { global $config; @@ -702,7 +702,7 @@ function get_memory_limit() { * Get the currently active IP, masked to make it not change when the last * octet or two change, for use in session cookies and such * - * @retval string + * @return string */ function get_session_ip(Config $config) { $mask = $config->get_string("session_hash_mask", "255.255.0.0"); @@ -765,7 +765,7 @@ function flash_message(/*string*/ $text, /*string*/ $type="info") { * * PHP really, really sucks. * - * @retval string + * @return string */ function get_base_href() { $possible_vars = array('SCRIPT_NAME', 'PHP_SELF', 'PATH_INFO', 'ORIG_PATH_INFO'); @@ -788,7 +788,7 @@ function get_base_href() { * A shorthand way to send a TextFormattingEvent and get the * results * - * @retval string + * @return string */ function format_text(/*string*/ $string) { $tfe = new TextFormattingEvent($string); @@ -1001,7 +1001,7 @@ function get_request_id() { /** * Remove an item from an array * - * @retval array + * @return array */ function array_remove($array, $to_remove) { $array = array_unique($array); @@ -1019,7 +1019,7 @@ function array_remove($array, $to_remove) { * * Also removes duplicate values from the array. * - * @retval array + * @return array */ function array_add($array, $element) { // Could we just use array_push() ? @@ -1032,7 +1032,7 @@ function array_add($array, $element) { /** * Return the unique elements of an array, case insensitively * - * @retval array + * @return array */ function array_iunique($array) { $ok = array(); @@ -1055,7 +1055,7 @@ function array_iunique($array) { * * from http://uk.php.net/network * - * @retval bool + * @return bool */ function ip_in_range($IP, $CIDR) { list ($net, $mask) = explode("/", $CIDR); @@ -1204,7 +1204,7 @@ $_load_start = microtime(true); * Collects some debug information (execution time, memory usage, queries, etc) * and formats it to stick in the footer of the page. * - * @retval String of debug info to add to the page. + * @return String of debug info to add to the page. */ function get_debug_info() { global $config, $_event_count, $database, $_execs, $_load_start; diff --git a/ext/chatbox/js/yshout.js b/ext/chatbox/js/yshout.js index 69f13e2e..b60f189f 100644 --- a/ext/chatbox/js/yshout.js +++ b/ext/chatbox/js/yshout.js @@ -374,12 +374,13 @@ YShout.prototype = { if (!$.browser.safari) return; var same = []; - for (var i = 0; i < this.p.length; i++) + for (var i = 0; i < this.p.length; i++) { if (this.p[i].adminInfo.ip == ip) same.push(this.p[i]); - - for (var i = 0; i < same.length; i++) { - $('#' + same[i].id).fadeTo(this.animSpeed, .8).fadeTo(this.animSpeed, 1); + } + + for (var j = 0; j < same.length; j++) { + $('#' + same[j].id).fadeTo(this.animSpeed, .8).fadeTo(this.animSpeed, 1); } }, diff --git a/ext/pools/main.php b/ext/pools/main.php index 9d8fa386..e8637e1b 100644 --- a/ext/pools/main.php +++ b/ext/pools/main.php @@ -342,7 +342,7 @@ class Pools extends Extension { /** * Check if the given user has permission to edit/change the pool. * TODO: Should the user variable be global? - * @retval bool + * @return bool */ private function have_permission($user, $pool) { // If the pool is public and user is logged OR if the user is admin OR if the pool is owned by the user. @@ -415,12 +415,13 @@ class Pools extends Extension { throw new PoolCreationException("A pool using this title already exists."); } - $public = $_POST["public"] == "Y" ? "Y" : "N"; + $public = $_POST["public"] === "Y" ? "Y" : "N"; $database->execute(" INSERT INTO pools (user_id, public, title, description, date) VALUES (:uid, :public, :title, :desc, now())", array("uid"=>$user->id, "public"=>$public, "title"=>$_POST["title"], "desc"=>$_POST["description"])); - + + $result = array(); $result['poolID'] = $database->get_last_insert_id('pools_id_seq'); log_info("pools", "Pool {$result["poolID"]} created by {$user->name}"); @@ -429,9 +430,9 @@ class Pools extends Extension { } /** - * Retrieve information about pools given mulitiple pool IDs. + * Retrieve information about pools given multiple pool IDs. * @param $poolID Array of integers - * @retval 2D Array + * @return 2D Array */ private function get_pool(/*int*/ $poolID) { global $database; @@ -441,7 +442,7 @@ class Pools extends Extension { /** * Retrieve information about a pool given a pool ID. * @param $poolID Integer - * @retval 2D array (with only 1 element in the one dimension) + * @return 2D array (with only 1 element in the one dimension) */ private function get_single_pool(/*int*/ $poolID) { global $database; @@ -451,7 +452,7 @@ class Pools extends Extension { /** * Retrieve information about a pool given a pool title. * @param $poolTitle Integer - * @retval 2D array (with only 1 element in the one dimension) + * @return 2D array (with only 1 element in the one dimension) */ private function get_single_pool_from_title(/*string*/ $poolTitle) { global $database; @@ -461,7 +462,7 @@ class Pools extends Extension { /** * Get all of the pool IDs that an image is in, given an image ID. * @param $imageID Integer - * @retval 2D array + * @return 2D array */ private function get_pool_id(/*int*/ $imageID) { global $database; @@ -581,7 +582,7 @@ class Pools extends Extension { * @see add_posts() * @param $poolID integer * @param $imageID integer - * @retval bool + * @return bool */ private function check_post(/*int*/ $poolID, /*int*/ $imageID) { global $database; @@ -594,7 +595,7 @@ class Pools extends Extension { * * @param $pool Array for the given pool * @param $imageID Integer - * @retval Integer which is the next Image ID or NULL if none. + * @return Integer which is the next Image ID or NULL if none. */ private function get_next_post(/*array*/ $pool, /*int*/ $imageID) { global $database; @@ -684,7 +685,7 @@ class Pools extends Extension { /** * This function gets the current order of images from a given pool. * @param $poolID integer - * @retval Array of image objects. + * @return Array of image objects. */ private function edit_posts(/*int*/ $poolID) { global $database; @@ -750,6 +751,7 @@ class Pools extends Extension { */ private function add_history(/*int*/ $poolID, $action, $images, $count) { global $user, $database; + $database->execute(" INSERT INTO pool_history (pool_id, user_id, action, images, count, date) VALUES (:pid, :uid, :act, :img, :count, now())", From 28d83fda0dab65a5a9384a653aed2e1f635d8b3e Mon Sep 17 00:00:00 2001 From: jgen Date: Sat, 19 Apr 2014 02:33:34 -0400 Subject: [PATCH 3/6] Even more linting and cleaning. --- core/database.class.php | 2 +- core/util.inc.php | 3 +++ ext/artists/main.php | 2 +- ext/blotter/theme.php | 2 +- ext/chatbox/js/yshout.js | 2 +- ext/pools/main.php | 5 +++++ ext/tag_list/main.php | 4 ++-- 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/core/database.class.php b/core/database.class.php index a22c838c..eb00e1ab 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -229,7 +229,7 @@ class MemcacheCache implements CacheEngine { class APCCache implements CacheEngine { var $hits=0, $misses=0; - public function __construct() {} + public function __construct($args) {} public function get($key) { assert(!is_null($key)); diff --git a/core/util.inc.php b/core/util.inc.php index 8eae8fbb..b2dfa436 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -867,6 +867,9 @@ function transload($url, $mfile) { fwrite($fp, $data); fclose($fp); + // Scrutinizer-ci complains that $http_response_header not defined. + // However, it is auto defined by PHP. + // See: http://us2.php.net/manual/en/reserved.variables.httpresponseheader.php $headers = http_parse_headers(implode("\n", $http_response_header)); return $headers; diff --git a/ext/artists/main.php b/ext/artists/main.php index 7aea77ad..f74022d5 100644 --- a/ext/artists/main.php +++ b/ext/artists/main.php @@ -805,7 +805,7 @@ class Artists extends Extension { $urls = $_POST["urls"]; $userID = $user->id; - $artistID = ""; + //$artistID = ""; //// WE CHECK IF THE ARTIST ALREADY EXISTS ON DATABASE; IF NOT WE CREATE if(!$this->artist_exists($name)) diff --git a/ext/blotter/theme.php b/ext/blotter/theme.php index 872f550a..23395bc5 100644 --- a/ext/blotter/theme.php +++ b/ext/blotter/theme.php @@ -106,7 +106,7 @@ class BlotterTheme extends Themelet { // Reset variables: $i_open = ""; $i_close = ""; - $id = $entries[$i]['id']; + //$id = $entries[$i]['id']; $messy_date = $entries[$i]['entry_date']; $clean_date = date("y/m/d", strtotime($messy_date)); $entry_text = $entries[$i]['entry_text']; diff --git a/ext/chatbox/js/yshout.js b/ext/chatbox/js/yshout.js index b60f189f..be4fb4b9 100644 --- a/ext/chatbox/js/yshout.js +++ b/ext/chatbox/js/yshout.js @@ -380,7 +380,7 @@ YShout.prototype = { } for (var j = 0; j < same.length; j++) { - $('#' + same[j].id).fadeTo(this.animSpeed, .8).fadeTo(this.animSpeed, 1); + $('#' + same[j].id).fadeTo(this.animSpeed, 0.8).fadeTo(this.animSpeed, 1); } }, diff --git a/ext/pools/main.php b/ext/pools/main.php index e8637e1b..965fb98e 100644 --- a/ext/pools/main.php +++ b/ext/pools/main.php @@ -806,6 +806,7 @@ class Pools extends Extension { $images = explode(" ", $images); $poolID = $entry['pool_id']; $imageArray = ""; + $newAction = -1; if($entry['action'] == 0) { // READ ENTRIES @@ -826,6 +827,10 @@ class Pools extends Extension { $imageArray .= " ".$imageID; $newAction = 0; } + } else { + // FIXME: should this throw an exception instead? + log_error("pools", "Invalid history action."); + continue; // go on to the next one. } $count = $database->get_one("SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid", array("pid"=>$poolID)); diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index bb4c39fb..3677c98a 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -48,7 +48,7 @@ class TagList extends Extension { else if($event->page_matches("api/internal/tag_list/complete")) { if(!isset($_GET["s"])) return; - $limit = 0; + //$limit = 0; $limitSQL = ""; $SQLarr = array("search"=>$_GET["s"]."%"); if(isset($_GET["limit"]) && $_GET["limit"] !== 0){ @@ -321,7 +321,7 @@ class TagList extends Extension { private function build_tag_list() { global $database; - $tags_min = $this->get_tags_min(); + //$tags_min = $this->get_tags_min(); $tag_data = $database->get_all("SELECT tag,count FROM tags ORDER BY count DESC, tag ASC LIMIT 9"); $html = ""; From be385deaabab2fa9b6f360297c1ddbb56e90234b Mon Sep 17 00:00:00 2001 From: jgen Date: Sat, 19 Apr 2014 02:58:36 -0400 Subject: [PATCH 4/6] Clean up this js file as well. --- ext/update/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/update/script.js b/ext/update/script.js index 56117653..dea04c24 100644 --- a/ext/update/script.js +++ b/ext/update/script.js @@ -2,9 +2,9 @@ $(function() { if($('#updatecheck').length !== 0){ $.getJSON('https://api.github.com/repos/shish/shimmie2/commits', function(data){ var c = data[0]; - $('#updatecheck').html(''+c['sha']+'' + " ("+c['commit']['message']+")"); + $('#updatecheck').html(''+ c.sha+'' + " ("+ c.commit.message+")"); - var params = $.param({sha: c['sha'], date: c['commit']['committer']['date']}); + var params = $.param({sha: c.sha, date: c.commit.committer.date}); $('#updatelink').attr('href', function(i, val){ return val + "?" + params; }); $('#updatelink').text("Update"); }).fail(function(){ From c527ae91d6e004a81e785de1e095c779c51335a9 Mon Sep 17 00:00:00 2001 From: jgen Date: Sat, 19 Apr 2014 04:17:28 -0400 Subject: [PATCH 5/6] More linting and cleanup. --- ext/chatbox/history/index.php | 5 ++++- themes/danbooru/layout.class.php | 10 ++++------ themes/danbooru2/layout.class.php | 14 ++++++-------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/ext/chatbox/history/index.php b/ext/chatbox/history/index.php index 94642523..fd5c0f42 100644 --- a/ext/chatbox/history/index.php +++ b/ext/chatbox/history/index.php @@ -1,4 +1,4 @@ -banned($post['adminInfo']['ip']); $html .= '
' . "\n"; + + $ts = ''; + switch($prefs['timestamp']) { case 12: $ts = date('h:i', $post['timestamp']); diff --git a/themes/danbooru/layout.class.php b/themes/danbooru/layout.class.php index 4598f66b..27af8810 100644 --- a/themes/danbooru/layout.class.php +++ b/themes/danbooru/layout.class.php @@ -47,7 +47,7 @@ class Layout { global $config, $user; $theme_name = $config->get_string('theme'); - $base_href = $config->get_string('base_href'); + //$base_href = $config->get_string('base_href'); $data_href = get_base_href(); $contact_link = $config->get_string('contact_link'); @@ -122,11 +122,9 @@ class Layout { $custom_sublinks = ""; // hack - global $user; $username = url_escape($user->name); // hack $qp = explode("/", ltrim(@$_GET["q"], "/")); - $hw = class_exists("Wiki"); // php sucks switch($qp[0]) { default: @@ -142,10 +140,10 @@ class Layout { case "upload": if(class_exists("NumericScore")){ $custom_sublinks .= "
  • Popular by Day/Month/Year
  • ";} $custom_sublinks .= "
  • All
  • "; - if(class_exists("Favorites")){ $custom_sublinks .= "
  • My Favorites
  • ";} + if(class_exists("Favorites")){ $custom_sublinks .= "
  • My Favorites
  • ";} if(class_exists("RSS_Images")){ $custom_sublinks .= "
  • Feed
  • ";} if(class_exists("RandomImage")){ $custom_sublinks .= "
  • Random Image
  • ";} - if($hw){ $custom_sublinks .= "
  • Help
  • "; + if(class_exists("Wiki")){ $custom_sublinks .= "
  • Help
  • "; }else{ $custom_sublinks .= "
  • Help
  • ";} break; case "comment": @@ -252,7 +250,7 @@ EOD; $re1='.*?'; $re2='((?:[a-z][a-z_]+))'; - if ($c=preg_match_all ("/".$re1.$re2."/is", $url, $matches)) { + if (preg_match_all("/".$re1.$re2."/is", $url, $matches)) { $url=$matches[1][0]; } diff --git a/themes/danbooru2/layout.class.php b/themes/danbooru2/layout.class.php index 728af1cd..d7e108b2 100644 --- a/themes/danbooru2/layout.class.php +++ b/themes/danbooru2/layout.class.php @@ -46,9 +46,9 @@ class Layout { public function display_page($page) { global $config, $user; - $theme_name = $config->get_string('theme'); - $base_href = $config->get_string('base_href'); - $data_href = get_base_href(); + //$theme_name = $config->get_string('theme'); + //$base_href = $config->get_string('base_href'); + //$data_href = get_base_href(); $contact_link = $config->get_string('contact_link'); @@ -124,11 +124,9 @@ class Layout { $custom_sublinks = ""; // hack - global $user; $username = url_escape($user->name); // hack $qp = explode("/", ltrim(@$_GET["q"], "/")); - $hw = class_exists("Wiki"); // php sucks switch($qp[0]) { default: @@ -156,11 +154,11 @@ class Layout { case "upload": if(class_exists("NumericScore")){ $custom_sublinks .= "
  • Popular by Day/Month/Year
  • ";} $custom_sublinks .= "
  • Listing
  • "; - if(class_exists("Favorites")){ $custom_sublinks .= "
  • My Favorites
  • ";} + if(class_exists("Favorites")){ $custom_sublinks .= "
  • My Favorites
  • ";} if(class_exists("RSS_Images")){ $custom_sublinks .= "
  • Feed
  • ";} if(class_exists("RandomImage")){ $custom_sublinks .= "
  • Random
  • ";} $custom_sublinks .= "
  • Upload
  • "; - if($hw){ $custom_sublinks .= "
  • Help
  • "; + if(class_exists("Wiki")){ $custom_sublinks .= "
  • Help
  • "; }else{ $custom_sublinks .= "
  • Help
  • ";} break; case "comment": @@ -278,7 +276,7 @@ EOD; $re1='.*?'; $re2='((?:[a-z][a-z_]+))'; - if ($c=preg_match_all ("/".$re1.$re2."/is", $url, $matches)) { + if (preg_match_all("/".$re1.$re2."/is", $url, $matches)) { $url=$matches[1][0]; } From e838fc2a03c94647e9d6317aac83d2f2f6dbdddc Mon Sep 17 00:00:00 2001 From: jgen Date: Sat, 19 Apr 2014 04:17:58 -0400 Subject: [PATCH 6/6] Comment this in case someone else wonders why its there. --- core/database.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/database.class.php b/core/database.class.php index eb00e1ab..5a889878 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -229,7 +229,9 @@ class MemcacheCache implements CacheEngine { class APCCache implements CacheEngine { var $hits=0, $misses=0; - public function __construct($args) {} + public function __construct($args) { + // $args is not used, but is passed in when APC cache is created. + } public function get($key) { assert(!is_null($key));