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;