diff --git a/.scrutinizer.yml b/.scrutinizer.yml
index f1eef101..4ff51349 100644
--- a/.scrutinizer.yml
+++ b/.scrutinizer.yml
@@ -3,4 +3,4 @@ imports:
- php
filter:
- excluded_paths: [lib/*,ext/chatbox/js/jquery.js]
+ excluded_paths: [lib/*,ext/tagger/script.js]
diff --git a/core/basethemelet.class.php b/core/basethemelet.class.php
index 94cfc159..3d62d3da 100644
--- a/core/basethemelet.class.php
+++ b/core/basethemelet.class.php
@@ -1,10 +1,18 @@
add_block(new Block("Error", $message));
}
-
/**
* A specific, common error message
*/
@@ -36,6 +43,9 @@ class BaseThemelet {
/**
* Generic thumbnail code; returns HTML rather than adding
* a block since thumbs tend to go inside blocks...
+ *
+ * @param Image $image
+ * @return string
*/
public function build_thumb_html(Image $image) {
global $config;
@@ -56,18 +66,23 @@ class BaseThemelet {
$custom_classes = "";
if(class_exists("Relationships")){
- if($image->parent_id !== NULL){ $custom_classes .= "shm-thumb-has_parent "; }
- if($image->has_children == TRUE){ $custom_classes .= "shm-thumb-has_child "; }
+ if(property_exists('Image', 'parent_id') && $image->parent_id !== NULL){ $custom_classes .= "shm-thumb-has_parent "; }
+ if(property_exists('Image', 'has_children') && $image->has_children == TRUE){ $custom_classes .= "shm-thumb-has_child "; }
}
return "".
- "
".
- "\n";
+ "
".
+ "\n";
}
-
/**
- * Add a generic paginator
+ * Add a generic paginator.
+ *
+ * @param Page $page
+ * @param string $base
+ * @param string $query
+ * @param int $page_number
+ * @param int $total_pages
*/
public function display_paginator(Page $page, $base, $query, $page_number, $total_pages) {
if($total_pages == 0) $total_pages = 1;
@@ -75,11 +90,28 @@ class BaseThemelet {
$page->add_block(new Block(null, $body, "main", 90, "paginator"));
}
+ /**
+ * Generate a single HTML link.
+ *
+ * @param string $base_url
+ * @param string $query
+ * @param int|string $page
+ * @param string $name
+ * @return string
+ */
private function gen_page_link($base_url, $query, $page, $name) {
$link = make_link($base_url.'/'.$page, $query);
return ''.$name.'';
}
-
+
+ /**
+ * @param string $base_url
+ * @param string $query
+ * @param int|string $page
+ * @param int|string $current_page
+ * @param string $name
+ * @return string
+ */
private function gen_page_link_block($base_url, $query, $page, $current_page, $name) {
$paginator = "";
if($page == $current_page) $paginator .= "";
@@ -87,7 +119,16 @@ class BaseThemelet {
if($page == $current_page) $paginator .= "";
return $paginator;
}
-
+
+ /**
+ * Build the paginator.
+ *
+ * @param int $current_page
+ * @param int $total_pages
+ * @param string $base_url
+ * @param string $query
+ * @return string
+ */
private function build_paginator($current_page, $total_pages, $base_url, $query) {
$next = $current_page + 1;
$prev = $current_page - 1;
@@ -115,4 +156,4 @@ class BaseThemelet {
.'
<< '.$pages_html.' >>';
}
}
-?>
+
diff --git a/core/block.class.php b/core/block.class.php
index 149a0a13..bdbc215f 100644
--- a/core/block.class.php
+++ b/core/block.class.php
@@ -6,39 +6,48 @@ class Block {
/**
* The block's title
*
- * @retval string
+ * @var string
*/
- var $header;
+ public $header;
/**
* The content
*
- * @retval string
+ * @var string
*/
- var $body;
+ public $body;
/**
* Where the block should be placed. The default theme supports
* "main" and "left", other themes can add their own areas
*
- * @retval string
+ * @var string
*/
- var $section;
+ public $section;
/**
* How far down the section the block should appear, higher
* numbers appear lower. The scale is 0-100 by convention,
* though any number or string will work.
*
- * @retval int
+ * @var int
*/
- var $position;
+ public $position;
/**
- *
+ * @var int
*/
- var $id;
+ public $id;
+ /**
+ * Construct a block.
+ *
+ * @param string $header
+ * @param string $body
+ * @param string $section
+ * @param int $position
+ * @param null|int $id
+ */
public function __construct($header, $body, /*string*/ $section="main", /*int*/ $position=50, $id=null) {
$this->header = $header;
$this->body = $body;
@@ -47,6 +56,12 @@ class Block {
$this->id = str_replace(' ', '_', is_null($id) ? (is_null($header) ? md5($body) : $header) . $section : $id);
}
+ /**
+ * Get the HTML for this block.
+ *
+ * @param bool $hidable
+ * @return string
+ */
public function get_html($hidable=false) {
$h = $this->header;
$b = $this->body;
@@ -71,4 +86,4 @@ class NavBlock extends Block {
parent::__construct("Navigation", "Index", "left", 0);
}
}
-?>
+
diff --git a/core/config.class.php b/core/config.class.php
index 96e6e156..7b0f6f1f 100644
--- a/core/config.class.php
+++ b/core/config.class.php
@@ -224,4 +224,4 @@ class MockConfig extends HardcodeConfig {
parent::__construct($config);
}
}
-?>
+
diff --git a/core/database.class.php b/core/database.class.php
index 5a889878..1fbfb2f8 100644
--- a/core/database.class.php
+++ b/core/database.class.php
@@ -45,7 +45,7 @@ class ImgQuerylet {
// }}}
// {{{ db engines
class DBEngine {
- var $name = null;
+ public $name = null;
public function init($db) {}
@@ -58,7 +58,7 @@ class DBEngine {
}
}
class MySQL extends DBEngine {
- var $name = "mysql";
+ public $name = "mysql";
public function init($db) {
$db->exec("SET NAMES utf8;");
@@ -84,7 +84,7 @@ class MySQL extends DBEngine {
}
}
class PostgreSQL extends DBEngine {
- var $name = "pgsql";
+ public $name = "pgsql";
public function init($db) {
$db->exec("SET application_name TO 'shimmie [{$_SERVER['REMOTE_ADDR']}]';");
@@ -123,7 +123,7 @@ function _concat($a, $b) { return $a . $b; }
function _lower($a) { return strtolower($a); }
class SQLite extends DBEngine {
- var $name = "sqlite";
+ public $name = "sqlite";
public function init($db) {
ini_set('sqlite.assoc_case', 0);
@@ -553,4 +553,4 @@ class MockDatabase extends Database {
public function create_table($name, $def) {}
public function connect_engine() {}
}
-?>
+
diff --git a/core/email.class.php b/core/email.class.php
index 63677b09..8dd2db58 100644
--- a/core/email.class.php
+++ b/core/email.class.php
@@ -4,17 +4,17 @@ class Email {
/**
* A generic email.
*/
- var $to;
- var $subject;
- var $header;
- var $style;
- var $header_img;
- var $sitename;
- var $sitedomain;
- var $siteemail;
- var $date;
- var $body;
- var $footer;
+ public $to;
+ public $subject;
+ public $header;
+ public $style;
+ public $header_img;
+ public $sitename;
+ public $sitedomain;
+ public $siteemail;
+ public $date;
+ public $body;
+ public $footer;
public function __construct($to, $subject, $header, $body) {
global $config;
@@ -116,4 +116,4 @@ Copyright (C) '.$this->sitename.'
return $sent;
}
}
-?>
+
diff --git a/core/event.class.php b/core/event.class.php
index 7e069e2d..2b824e5b 100644
--- a/core/event.class.php
+++ b/core/event.class.php
@@ -26,10 +26,13 @@ class InitExtEvent extends Event {}
* $event->get_arg(0) = "42"
*/
class PageRequestEvent extends Event {
- var $args;
- var $arg_count;
- var $part_count;
+ public $args;
+ public $arg_count;
+ public $part_count;
+ /**
+ * @param string $path
+ */
public function __construct($path) {
global $config;
@@ -63,7 +66,8 @@ class PageRequestEvent extends Event {
*
* If it matches, store the remaining path elements in $args
*
- * @retval bool
+ * @param string $name
+ * @return bool
*/
public function page_matches(/*string*/ $name) {
$parts = explode("/", $name);
@@ -84,8 +88,9 @@ class PageRequestEvent extends Event {
/**
* Get the n th argument of the page request (if it exists.)
- * @param $n integer
- * @retval The argmuent (string) or NULL
+ *
+ * @param int $n
+ * @return string|null The argmuent (string) or NULL
*/
public function get_arg(/*int*/ $n) {
$offset = $this->part_count + $n;
@@ -99,7 +104,7 @@ class PageRequestEvent extends Event {
/**
* Returns the number of arguments the page request has.
- * @retval int
+ * @return int
*/
public function count_args() {
return (int)($this->arg_count - $this->part_count);
@@ -108,6 +113,10 @@ class PageRequestEvent extends Event {
/*
* Many things use these functions
*/
+
+ /**
+ * @return array
+ */
public function get_search_terms() {
$search_terms = array();
if($this->count_args() === 2) {
@@ -115,6 +124,10 @@ class PageRequestEvent extends Event {
}
return $search_terms;
}
+
+ /**
+ * @return int
+ */
public function get_page_number() {
$page_number = 1;
if($this->count_args() === 1) {
@@ -126,6 +139,10 @@ class PageRequestEvent extends Event {
if($page_number === 0) $page_number = 1; // invalid -> 0
return $page_number;
}
+
+ /**
+ * @return int
+ */
public function get_page_size() {
global $config;
return $config->get_int('index_images');
@@ -227,28 +244,28 @@ class LogEvent extends Event {
/**
* a category, normally the extension name
*
- * @retval string
+ * @return string
*/
var $section;
/**
* See python...
*
- * @retval int
+ * @return int
*/
var $priority = 0;
/**
* Free text to be logged
*
- * @retval text
+ * @return text
*/
var $message;
/**
* The time that the event was created
*
- * @retval int
+ * @return int
*/
var $time;
@@ -265,4 +282,4 @@ class LogEvent extends Event {
$this->time = time();
}
}
-?>
+
diff --git a/core/exceptions.class.php b/core/exceptions.class.php
index f9648bf8..d627dc3c 100644
--- a/core/exceptions.class.php
+++ b/core/exceptions.class.php
@@ -8,4 +8,12 @@ class SCoreException extends Exception {}
* A fairly common, generic exception
*/
class PermissionDeniedException extends SCoreException {}
-?>
+
+/**
+ * Class ImageDoesNotExist
+ *
+ * This exception is used when an Image cannot be found by ID.
+ *
+ * Example: Image::by_id(-1) returns null
+ */
+class ImageDoesNotExist extends SCoreException {}
diff --git a/core/extension.class.php b/core/extension.class.php
index 9d881c80..1a0d50c5 100644
--- a/core/extension.class.php
+++ b/core/extension.class.php
@@ -81,7 +81,7 @@
*/
abstract class Extension {
/** this theme's Themelet object */
- var $theme;
+ public $theme;
/** @private */
var $_child;
@@ -220,15 +220,18 @@ abstract class DataHandlerExtension extends Extension {
}
}
+ /*
public function onSetupBuilding(SetupBuildingEvent $event) {
$sb = $this->setup();
if($sb) $event->panel->add_block($sb);
}
protected function setup() {}
+ */
+
abstract protected function supported_ext($ext);
abstract protected function check_contents($tmpname);
abstract protected function create_image_from_data($filename, $metadata);
abstract protected function create_thumb($hash);
}
-?>
+
diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php
index 8e21de8b..8c8e27b0 100644
--- a/core/imageboard.pack.php
+++ b/core/imageboard.pack.php
@@ -36,14 +36,14 @@ require_once "lib/flexihash.php";
* sound file, or any other supported upload type.
*/
class Image {
- var $id = null;
- var $height, $width;
- var $hash, $filesize;
- var $filename, $ext;
- var $owner_ip;
- var $posted;
- var $source;
- var $locked;
+ public $id = null;
+ public $height, $width;
+ public $hash, $filesize;
+ public $filename, $ext;
+ public $owner_id, $owner_ip;
+ public $posted, $posted_timestamp;
+ public $source;
+ public $locked;
/**
* One will very rarely construct an image directly, more common
@@ -54,7 +54,7 @@ class Image {
foreach($row as $name => $value) {
// some databases use table.name rather than name
$name = str_replace("images.", "", $name);
- $this->$name = $value; // hax
+ $this->$name = $value; // hax, this is likely the cause of much scrutinizer-ci complaints.
}
$this->posted_timestamp = strtotime($this->posted); // pray
$this->locked = bool_escape($this->locked);
@@ -68,7 +68,8 @@ class Image {
/**
* Find an image by ID
*
- * @retval Image
+ * @param int $id
+ * @return Image
*/
public static function by_id(/*int*/ $id) {
assert(is_numeric($id));
@@ -80,7 +81,8 @@ class Image {
/**
* Find an image by hash
*
- * @retval Image
+ * @param string $hash
+ * @return Image
*/
public static function by_hash(/*string*/ $hash) {
assert(is_string($hash));
@@ -92,7 +94,8 @@ class Image {
/**
* Pick a random image out of a set
*
- * @retval Image
+ * @param array $tags
+ * @return Image
*/
public static function by_random($tags=array()) {
assert(is_array($tags));
@@ -107,7 +110,11 @@ class Image {
/**
* Search for an array of images
*
- * @retval Array
+ * @param int $start
+ * @param int $limit
+ * @param array $tags
+ * @throws SCoreException
+ * @return Array
*/
public static function find_images(/*int*/ $start, /*int*/ $limit, $tags=array()) {
assert(is_numeric($start));
@@ -145,6 +152,9 @@ class Image {
/**
* Count the number of image results for a given search
+ *
+ * @param array $tags
+ * @return mixed
*/
public static function count_images($tags=array()) {
assert(is_array($tags));
@@ -174,6 +184,9 @@ class Image {
/**
* Count the number of pages for a given search
+ *
+ * @param array $tags
+ * @return float
*/
public static function count_pages($tags=array()) {
assert(is_array($tags));
@@ -192,7 +205,9 @@ class Image {
* Rather than simply $this_id + 1, one must take into account
* deleted images and search queries
*
- * @retval Image
+ * @param array $tags
+ * @param bool $next
+ * @return Image
*/
public function get_next($tags=array(), $next=true) {
assert(is_array($tags));
@@ -224,7 +239,8 @@ class Image {
/**
* The reverse of get_next
*
- * @retval Image
+ * @param array $tags
+ * @return Image
*/
public function get_prev($tags=array()) {
return $this->get_next($tags, false);
@@ -233,14 +249,16 @@ class Image {
/**
* Find the User who owns this Image
*
- * @retval User
+ * @return User
*/
public function get_owner() {
return User::by_id($this->owner_id);
}
/**
- * Set the image's owner
+ * Set the image's owner.
+ *
+ * @param User $owner
*/
public function set_owner(User $owner) {
global $database;
@@ -262,7 +280,9 @@ class Image {
}
/**
- * Get this image's tags as a string
+ * Get this image's tags as a string.
+ *
+ * @return string
*/
public function get_tag_list() {
return Tag::implode($this->get_tag_array());
@@ -271,7 +291,7 @@ class Image {
/**
* Get the URL for the full size image
*
- * @retval string
+ * @return string
*/
public function get_image_link() {
global $config;
@@ -296,7 +316,7 @@ class Image {
* Get a short link to the full size image
*
* @deprecated
- * @retval string
+ * @return string
*/
public function get_short_link() {
global $config;
@@ -306,7 +326,7 @@ class Image {
/**
* Get the URL for the thumbnail
*
- * @retval string
+ * @return string
*/
public function get_thumb_link() {
global $config;
@@ -331,7 +351,7 @@ class Image {
* Get the tooltip for this image, formatted according to the
* configured template
*
- * @retval string
+ * @return string
*/
public function get_tooltip() {
global $config;
@@ -360,7 +380,7 @@ class Image {
/**
* Figure out where the full size image is on disk
*
- * @retval string
+ * @return string
*/
public function get_image_filename() {
return warehouse_path("images", $this->hash);
@@ -369,7 +389,7 @@ class Image {
/**
* Figure out where the thumbnail is on disk
*
- * @retval string
+ * @return string
*/
public function get_thumb_filename() {
return warehouse_path("thumbs", $this->hash);
@@ -378,7 +398,7 @@ class Image {
/**
* Get the original filename
*
- * @retval string
+ * @return string
*/
public function get_filename() {
return $this->filename;
@@ -387,7 +407,7 @@ class Image {
/**
* Get the image's mime type
*
- * @retval string
+ * @return string
*/
public function get_mime_type() {
return getMimeType($this->get_image_filename(), $this->get_ext());
@@ -396,7 +416,7 @@ class Image {
/**
* Get the image's filename extension
*
- * @retval string
+ * @return string
*/
public function get_ext() {
return $this->ext;
@@ -405,7 +425,7 @@ class Image {
/**
* Get the image's source URL
*
- * @retval string
+ * @return string
*/
public function get_source() {
return $this->source;
@@ -413,6 +433,8 @@ class Image {
/**
* Set the image's source URL
+ *
+ * @param string $new_source
*/
public function set_source(/*string*/ $new_source) {
global $database;
@@ -426,7 +448,7 @@ class Image {
/**
* Check if the image is locked.
- * @retval bool
+ * @return bool
*/
public function is_locked() {
return $this->locked;
@@ -542,7 +564,9 @@ class Image {
/**
* Someone please explain this
*
- * @retval string
+ * @param $tmpl
+ * @param string $_escape
+ * @return string
*/
public function parse_link_template($tmpl, $_escape="url_escape") {
global $config;
@@ -682,8 +706,8 @@ class Image {
else {
$expansions = Tag::resolve_wildcard($term);
if($expansions && $positive) $positive_tag_count++;
- foreach($expansions as $term) {
- $tag_querylets[] = new TagQuerylet($term, $positive);
+ foreach($expansions as $expanded_term) {
+ $tag_querylets[] = new TagQuerylet($expanded_term, $positive);
}
}
}
@@ -966,6 +990,9 @@ class Image {
class Tag {
/**
* Remove any excess fluff from a user-input tag
+ *
+ * @param string $tag
+ * @return mixed
*/
public static function sanitise($tag) {
assert(is_string($tag));
@@ -1005,6 +1032,10 @@ class Tag {
return $tag_array;
}
+ /**
+ * @param $tags
+ * @return string
+ */
public static function implode($tags) {
assert(is_string($tags) || is_array($tags));
@@ -1019,6 +1050,10 @@ class Tag {
return $tags;
}
+ /**
+ * @param string $tag
+ * @return string
+ */
public static function resolve_alias($tag) {
assert(is_string($tag));
@@ -1067,8 +1102,8 @@ class Tag {
/**
* This function takes a list (array) of tags and changes any tags that have aliases
*
- * @param $tags Array of tags
- * @return Array of tags
+ * @param array $tags Array of tags
+ * @return array of tags
*/
public static function resolve_aliases($tags) {
assert(is_array($tags));
@@ -1104,7 +1139,7 @@ class Tag {
/**
* Move a file from PHP's temporary area into shimmie's image storage
- * heirachy, or throw an exception trying
+ * hierarchy, or throw an exception trying
*/
function move_upload_to_archive(DataUploadEvent $event) {
$target = warehouse_path("images", $event->hash);
@@ -1116,8 +1151,12 @@ function move_upload_to_archive(DataUploadEvent $event) {
}
/**
- * Given a full size pair of dimentions, return a pair scaled down to fit
+ * Given a full size pair of dimensions, return a pair scaled down to fit
* into the configured thumbnail square, with ratio intact
+ *
+ * @param int $orig_width
+ * @param int $orig_height
+ * @return array
*/
function get_thumbnail_size(/*int*/ $orig_width, /*int*/ $orig_height) {
global $config;
@@ -1143,4 +1182,4 @@ function get_thumbnail_size(/*int*/ $orig_width, /*int*/ $orig_height) {
}
}
-?>
+
diff --git a/core/page.class.php b/core/page.class.php
index f56a4d46..db588e94 100644
--- a/core/page.class.php
+++ b/core/page.class.php
@@ -251,11 +251,11 @@ class Page {
$data_href = get_base_href();
$theme_name = $config->get_string('theme', 'default');
- $this->add_html_header("");
+ $this->add_html_header("", 40);
# 404/static handler will map these to themes/foo/bar.ico or lib/static/bar.ico
- $this->add_html_header("");
- $this->add_html_header("");
+ $this->add_html_header("", 41);
+ $this->add_html_header("", 42);
$css_files = array();
$css_latest = 0;
@@ -275,7 +275,7 @@ class Page {
}
file_put_contents($css_cache_file, $css_data);
}
- $this->add_html_header("");
+ $this->add_html_header("", 43);
$js_files = array();
$js_latest = 0;
@@ -291,10 +291,10 @@ class Page {
}
file_put_contents($js_cache_file, $js_data);
}
- $this->add_html_header("");
+ $this->add_html_header("", 44);
}
}
class MockPage extends Page {
}
-?>
+
diff --git a/core/sys_config.inc.php b/core/sys_config.inc.php
index c70acb93..bd9f0616 100644
--- a/core/sys_config.inc.php
+++ b/core/sys_config.inc.php
@@ -46,4 +46,5 @@ _d("EXTRA_EXTS", ""); // optional extra extensions
*/
_d("SCORE_VERSION", 's2hack/'.VERSION); // string SCore version
_d("ENABLED_EXTS", CORE_EXTS.",".EXTRA_EXTS);
-?>
+
+
diff --git a/core/user.class.php b/core/user.class.php
index 3adceadc..94e22c63 100644
--- a/core/user.class.php
+++ b/core/user.class.php
@@ -8,16 +8,23 @@ function _new_user($row) {
/**
* An object representing a row in the "users" table.
*
- * The currently logged in user will always be accessable via the global variable $user
+ * The currently logged in user will always be accessible via the global variable $user
*/
class User {
- var $id;
- var $name;
- var $email;
- var $join_date;
- var $passhash;
+ /** @var int */
+ public $id;
- /* @var UserClass */
+ /** @var string */
+ public $name;
+
+ /** @var string */
+ public $email;
+
+ public $join_date;
+
+ public $passhash;
+
+ /** @var UserClass */
var $class;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -44,6 +51,13 @@ class User {
$this->class = $_user_classes[$row["class"]];
}
+ /**
+ * Construct a User by session.
+ *
+ * @param string $name
+ * @param string $session
+ * @return null|User
+ */
public static function by_session(/*string*/ $name, /*string*/ $session) {
global $config, $database;
$row = $database->cache->get("user-session-$name-$session");
@@ -60,6 +74,11 @@ class User {
return is_null($row) ? null : new User($row);
}
+ /**
+ * Construct a User by session.
+ * @param int $id
+ * @return null|User
+ */
public static function by_id(/*int*/ $id) {
assert(is_numeric($id));
global $database;
@@ -72,6 +91,11 @@ class User {
return is_null($row) ? null : new User($row);
}
+ /**
+ * Construct a User by name.
+ * @param string $name
+ * @return null|User
+ */
public static function by_name(/*string*/ $name) {
assert(is_string($name));
global $database;
@@ -79,6 +103,12 @@ class User {
return is_null($row) ? null : new User($row);
}
+ /**
+ * Construct a User by name and hash.
+ * @param string $name
+ * @param string $hash
+ * @return null|User
+ */
public static function by_name_and_hash(/*string*/ $name, /*string*/ $hash) {
assert(is_string($name));
assert(is_string($hash));
@@ -88,6 +118,11 @@ class User {
return is_null($row) ? null : new User($row);
}
+ /**
+ * @param int $offset
+ * @param int $limit
+ * @return array
+ */
public static function by_list(/*int*/ $offset, /*int*/ $limit=50) {
assert(is_numeric($offset));
assert(is_numeric($limit));
@@ -97,8 +132,12 @@ class User {
}
- /*
- * useful user object functions start here
+ /* useful user object functions start here */
+
+
+ /**
+ * @param string $ability
+ * @return bool
*/
public function can($ability) {
return $this->class->can($ability);
@@ -108,7 +147,7 @@ class User {
/**
* Test if this user is anonymous (not logged in)
*
- * @retval bool
+ * @return bool
*/
public function is_anonymous() {
global $config;
@@ -118,7 +157,7 @@ class User {
/**
* Test if this user is logged in
*
- * @retval bool
+ * @return bool
*/
public function is_logged_in() {
global $config;
@@ -128,12 +167,15 @@ class User {
/**
* Test if this user is an administrator
*
- * @retval bool
+ * @return bool
*/
public function is_admin() {
return ($this->class->name === "admin");
}
+ /**
+ * @param string $class
+ */
public function set_class(/*string*/ $class) {
assert(is_string($class));
global $database;
@@ -141,6 +183,9 @@ class User {
log_info("core-user", 'Set class for '.$this->name.' to '.$class);
}
+ /**
+ * @param string $password
+ */
public function set_password(/*string*/ $password) {
global $database;
$hash = md5(strtolower($this->name) . $password);
@@ -157,7 +202,7 @@ class User {
/**
* Get a snippet of HTML which will render the user's avatar, be that
* a local file, a remote file, a gravatar, a something else, etc
- * @retval String of HTML
+ * @return String of HTML
*/
public function get_avatar_html() {
// FIXME: configurable
@@ -186,7 +231,7 @@ class User {
* the form was generated within the session. Salted and re-hashed so that
* reading a web page from the user's cache doesn't give access to the session key
*
- * @retval String containing auth token (MD5sum)
+ * @return String containing auth token (MD5sum)
*/
public function get_auth_token() {
global $config;
@@ -218,4 +263,4 @@ class MockUser extends User {
parent::__construct($row);
}
}
-?>
+
diff --git a/core/userclass.class.php b/core/userclass.class.php
index a8bec4e5..ee6871ea 100644
--- a/core/userclass.class.php
+++ b/core/userclass.class.php
@@ -2,9 +2,9 @@
$_user_classes = array();
class UserClass {
- var $name = null;
- var $parent = null;
- var $abilities = array();
+ public $name = null;
+ public $parent = null;
+ public $abilities = array();
public function __construct($name, $parent=null, $abilities=array()) {
global $_user_classes;
@@ -19,6 +19,13 @@ class UserClass {
$_user_classes[$name] = $this;
}
+ /**
+ * Determine if this class of user can perform an action or has ability.
+ *
+ * @param string $ability
+ * @return bool
+ * @throws SCoreException
+ */
public function can(/*string*/ $ability) {
global $config;
@@ -164,4 +171,4 @@ new UserClass("hellbanned", "user", array(
));
@include_once "data/config/user-classes.conf.php";
-?>
+
diff --git a/core/util.inc.php b/core/util.inc.php
index b2dfa436..60a95b6f 100644
--- a/core/util.inc.php
+++ b/core/util.inc.php
@@ -10,6 +10,7 @@ require_once "lib/context.php";
/**
* Make some data safe for printing into HTML
*
+ * @param $input
* @return string
*/
function html_escape($input) {
@@ -19,6 +20,7 @@ function html_escape($input) {
/**
* Make sure some data is safe to be used in integer context
*
+ * @param $input
* @return int
*/
function int_escape($input) {
@@ -32,6 +34,7 @@ function int_escape($input) {
/**
* Make sure some data is safe to be used in URL context
*
+ * @param $input
* @return string
*/
function url_escape($input) {
@@ -66,6 +69,7 @@ function url_escape($input) {
/**
* Make sure some data is safe to be used in SQL context
*
+ * @param $input
* @return string
*/
function sql_escape($input) {
@@ -77,6 +81,7 @@ function sql_escape($input) {
/**
* Turn all manner of HTML / INI / JS / DB booleans into a PHP one
*
+ * @param $input
* @return boolean
*/
function bool_escape($input) {
@@ -112,6 +117,7 @@ function bool_escape($input) {
* Some functions require a callback function for escaping,
* but we might not want to alter the data
*
+ * @param $input
* @return string
*/
function no_escape($input) {
@@ -156,6 +162,7 @@ function truncate($string, $limit, $break=" ", $pad="...") {
/**
* Turn a human readable filesize into an integer, eg 1KB -> 1024
*
+ * @param $limit
* @return int
*/
function parse_shorthand_int($limit) {
@@ -167,8 +174,11 @@ function parse_shorthand_int($limit) {
$value = $m[1];
if (isset($m[2])) {
switch(strtolower($m[2])) {
+ /** @noinspection PhpMissingBreakStatementInspection */
case 'g': $value *= 1024; // fall through
+ /** @noinspection PhpMissingBreakStatementInspection */
case 'm': $value *= 1024; // fall through
+ /** @noinspection PhpMissingBreakStatementInspection */
case 'k': $value *= 1024; break;
default: $value = -1;
}
@@ -182,6 +192,7 @@ function parse_shorthand_int($limit) {
/**
* Turn an integer into a human readable filesize, eg 1024 -> 1KB
*
+ * @param $int
* @return string
*/
function to_shorthand_int($int) {
@@ -203,6 +214,8 @@ function to_shorthand_int($int) {
/**
* Turn a date into a time, a date, an "X minutes ago...", etc
*
+ * @param $date
+ * @param bool $html
* @return string
*/
function autodate($date, $html=true) {
@@ -214,6 +227,7 @@ function autodate($date, $html=true) {
/**
* Check if a given string is a valid date-time. ( Format: yyyy-mm-dd hh:mm:ss )
*
+ * @param $dateTime
* @return boolean
*/
function isValidDateTime($dateTime) {
@@ -229,6 +243,7 @@ function isValidDateTime($dateTime) {
/**
* Check if a given string is a valid date. ( Format: yyyy-mm-dd )
*
+ * @param $date
* @return boolean
*/
function isValidDate($date) {
@@ -248,6 +263,8 @@ function isValidDate($date) {
*
* FIXME: also check that IP ban ext is installed
*
+ * @param $ip
+ * @param $ban_reason
* @return string
*/
function show_ip($ip, $ban_reason) {
@@ -295,6 +312,8 @@ function endsWith(/*string*/ $haystack, /*string*/ $needle) {
*
* eg make_link("post/list") becomes "/v2/index.php?q=post/list"
*
+ * @param null|string $page
+ * @param null|string $query
* @return string
*/
function make_link($page=null, $query=null) {
@@ -329,8 +348,9 @@ function make_link($page=null, $query=null) {
/**
- * Take the current URL and modify some paramaters
+ * Take the current URL and modify some parameters
*
+ * @param $changes
* @return string
*/
function modify_current_url($changes) {
@@ -372,6 +392,7 @@ function modify_url($url, $changes) {
/**
* Turn a relative link into an absolute one, including hostname
*
+ * @param string $link
* @return string
*/
function make_http(/*string*/ $link) {
@@ -385,11 +406,11 @@ function make_http(/*string*/ $link) {
/**
* Make a form tag with relevant auth token and stuff
*
- * @param target string
- * @param method string
- * @param multipart boolean
- * @param form_id string
- * @param onsubmit string
+ * @param string $target
+ * @param string $method
+ * @param bool $multipart
+ * @param string $form_id
+ * @param string $onsubmit
*
* @return string
*/
@@ -412,6 +433,11 @@ function mtimefile($file) {
return "$data_href/$file?$mtime";
}
+/**
+ * Return the current theme as a string
+ *
+ * @return string
+ */
function get_theme() {
global $config;
$theme = $config->get_string("theme", "default");
@@ -505,16 +531,18 @@ function captcha_check() {
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
-* Get MIME type for file
-*
-* The contents of this function are taken from the __getMimeType() function
-* from the "Amazon S3 PHP class" which is Copyright (c) 2008, Donovan Schönknecht
-* and released under the 'Simplified BSD License'.
-*
-* @internal Used to get mime types
-* @param string &$file File path
-* @return string
-*/
+ * Get MIME type for file
+ *
+ * The contents of this function are taken from the __getMimeType() function
+ * from the "Amazon S3 PHP class" which is Copyright (c) 2008, Donovan Schönknecht
+ * and released under the 'Simplified BSD License'.
+ *
+ * @internal Used to get mime types
+ * @param string &$file File path
+ * @param string $ext
+ * @param bool $list
+ * @return string
+ */
function getMimeType($file, $ext="", $list=false) {
// Static extension lookup
@@ -639,6 +667,8 @@ function _count_execs($db, $sql, $inputarray) {
/**
* Compare two Block objects, used to sort them before being displayed
*
+ * @param Block $a
+ * @param Block $b
* @return int
*/
function blockcmp(Block $a, Block $b) {
@@ -702,6 +732,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
*
+ * @param Config $config
* @return string
*/
function get_session_ip(Config $config) {
@@ -788,6 +819,7 @@ function get_base_href() {
* A shorthand way to send a TextFormattingEvent and get the
* results
*
+ * @param $string
* @return string
*/
function format_text(/*string*/ $string) {
@@ -867,9 +899,11 @@ 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
+ //
+ // Scrutinizer-ci complains that $http_response_header does not exist,
+ // however, $http_response_header is actually a super-global.
+ // I have filed a bug with PHP-Analyzer here: https://github.com/scrutinizer-ci/php-analyzer/issues/212
+ //
$headers = http_parse_headers(implode("\n", $http_response_header));
return $headers;
@@ -1004,6 +1038,8 @@ function get_request_id() {
/**
* Remove an item from an array
*
+ * @param $array
+ * @param $to_remove
* @return array
*/
function array_remove($array, $to_remove) {
@@ -1022,6 +1058,8 @@ function array_remove($array, $to_remove) {
*
* Also removes duplicate values from the array.
*
+ * @param $array
+ * @param $element
* @return array
*/
function array_add($array, $element) {
@@ -1035,6 +1073,7 @@ function array_add($array, $element) {
/**
* Return the unique elements of an array, case insensitively
*
+ * @param $array
* @return array
*/
function array_iunique($array) {
@@ -1058,6 +1097,8 @@ function array_iunique($array) {
*
* from http://uk.php.net/network
*
+ * @param $IP
+ * @param $CIDR
* @return bool
*/
function ip_in_range($IP, $CIDR) {
@@ -1118,7 +1159,7 @@ function deltree($f) {
}
/**
- * Copy an entire file heirachy
+ * Copy an entire file hierarchy
*
* from a comment on http://uk.php.net/copy
*/
@@ -1456,4 +1497,4 @@ function _end_coverage() {
file_put_contents("$absolute_path/$t.$n.log", gzdeflate(serialize(xdebug_get_code_coverage())));
}
}
-?>
+
diff --git a/ext/admin/main.php b/ext/admin/main.php
index 68273195..dc8be5f0 100644
--- a/ext/admin/main.php
+++ b/ext/admin/main.php
@@ -257,4 +257,4 @@ class AdminPage extends Extension {
return true;
}
}
-?>
+
diff --git a/ext/admin/test.php b/ext/admin/test.php
index 73bc7629..3aad3d93 100644
--- a/ext/admin/test.php
+++ b/ext/admin/test.php
@@ -80,4 +80,4 @@ class AdminPageTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/admin/theme.php b/ext/admin/theme.php
index 3eefdb11..d1f8c71b 100644
--- a/ext/admin/theme.php
+++ b/ext/admin/theme.php
@@ -68,4 +68,4 @@ class AdminPageTheme extends Themelet {
return $html;
}
}
-?>
+
diff --git a/ext/alias_editor/main.php b/ext/alias_editor/main.php
index 54015ab9..883292d9 100644
--- a/ext/alias_editor/main.php
+++ b/ext/alias_editor/main.php
@@ -153,4 +153,4 @@ class AliasEditor extends Extension {
// missing out the images tagged with the oldtag
public function get_priority() {return 60;}
}
-?>
+
diff --git a/ext/alias_editor/test.php b/ext/alias_editor/test.php
index f1f9c6a1..2aa3ab78 100644
--- a/ext/alias_editor/test.php
+++ b/ext/alias_editor/test.php
@@ -97,4 +97,4 @@ class AliasEditorTest extends ShimmieWebTestCase {
*/
}
}
-?>
+
diff --git a/ext/alias_editor/theme.php b/ext/alias_editor/theme.php
index 173f7bd2..21a984b8 100644
--- a/ext/alias_editor/theme.php
+++ b/ext/alias_editor/theme.php
@@ -73,4 +73,4 @@ class AliasEditorTheme extends Themelet {
$this->display_paginator($page, "alias/list", null, $pageNumber, $totalPages);
}
}
-?>
+
diff --git a/ext/amazon_s3/main.php b/ext/amazon_s3/main.php
index b4191a69..7b39e5a2 100644
--- a/ext/amazon_s3/main.php
+++ b/ext/amazon_s3/main.php
@@ -72,4 +72,4 @@ class UploadS3 extends Extension {
}
}
}
-?>
+
diff --git a/ext/arrowkey_navigation/main.php b/ext/arrowkey_navigation/main.php
index b1c1b972..4d248f32 100644
--- a/ext/arrowkey_navigation/main.php
+++ b/ext/arrowkey_navigation/main.php
@@ -79,4 +79,4 @@ class ArrowkeyNavigation extends Extension {
return $pageinfo;
}
}
-?>
+
diff --git a/ext/artists/main.php b/ext/artists/main.php
index f74022d5..43edec08 100644
--- a/ext/artists/main.php
+++ b/ext/artists/main.php
@@ -1221,4 +1221,4 @@ class Artists extends Extension {
return $result;
}
}
-?>
+
diff --git a/ext/artists/test.php b/ext/artists/test.php
index 7f794343..767d764b 100644
--- a/ext/artists/test.php
+++ b/ext/artists/test.php
@@ -5,4 +5,4 @@ class ArtistTest extends ShimmieWebTestCase {
$this->get_page("post/list/author=bob/1");
}
}
-?>
+
diff --git a/ext/artists/theme.php b/ext/artists/theme.php
index c6d957a3..3cecede4 100644
--- a/ext/artists/theme.php
+++ b/ext/artists/theme.php
@@ -514,4 +514,4 @@ class ArtistsTheme extends Themelet {
}
}
-?>
+
diff --git a/ext/ban_words/main.php b/ext/ban_words/main.php
index 88fe247a..027f8d8f 100644
--- a/ext/ban_words/main.php
+++ b/ext/ban_words/main.php
@@ -101,4 +101,4 @@ xanax
public function get_priority() {return 30;}
}
-?>
+
diff --git a/ext/ban_words/test.php b/ext/ban_words/test.php
index e9f9cee8..37c0cfda 100644
--- a/ext/ban_words/test.php
+++ b/ext/ban_words/test.php
@@ -42,4 +42,4 @@ class BanWordsTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/bbcode/main.php b/ext/bbcode/main.php
index 4b10a5c7..9812d0ca 100644
--- a/ext/bbcode/main.php
+++ b/ext/bbcode/main.php
@@ -156,4 +156,4 @@ class BBCode extends FormatterExtension {
return $text;
}
}
-?>
+
diff --git a/ext/bbcode/test.php b/ext/bbcode/test.php
index a24c548f..14aac004 100644
--- a/ext/bbcode/test.php
+++ b/ext/bbcode/test.php
@@ -81,4 +81,4 @@ class BBCodeUnitTest extends UnitTestCase {
return $bb->strip($in);
}
}
-?>
+
diff --git a/ext/blocks/main.php b/ext/blocks/main.php
index c80ce1af..9cd8f253 100644
--- a/ext/blocks/main.php
+++ b/ext/blocks/main.php
@@ -85,4 +85,4 @@ class Blocks extends Extension {
}
}
}
-?>
+
diff --git a/ext/blocks/test.php b/ext/blocks/test.php
index a68442b3..d6f91a38 100644
--- a/ext/blocks/test.php
+++ b/ext/blocks/test.php
@@ -8,4 +8,4 @@ class BlocksTest extends SCoreWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/blocks/theme.php b/ext/blocks/theme.php
index 08f2eb1f..00cfd170 100644
--- a/ext/blocks/theme.php
+++ b/ext/blocks/theme.php
@@ -43,4 +43,4 @@ class BlocksTheme extends Themelet {
$page->add_block(new Block("Block Editor", $html));
}
}
-?>
+
diff --git a/ext/blotter/main.php b/ext/blotter/main.php
index f02e1461..191d20ff 100644
--- a/ext/blotter/main.php
+++ b/ext/blotter/main.php
@@ -131,4 +131,4 @@ class Blotter extends Extension {
$this->theme->display_blotter($entries);
}
}
-?>
+
diff --git a/ext/blotter/script.js b/ext/blotter/script.js
index e2f4f892..25e3188c 100644
--- a/ext/blotter/script.js
+++ b/ext/blotter/script.js
@@ -1,3 +1,5 @@
+/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
+
$(document).ready(function() {
$(".shm-blotter2-toggle").click(function() {
$(".shm-blotter2").slideToggle("slow", function() {
@@ -9,7 +11,7 @@ $(document).ready(function() {
}
});
});
- if($.cookie("ui-blotter2-hidden") == 'true') {
+ if($.cookie("ui-blotter2-hidden") === 'true') {
$(".shm-blotter2").hide();
}
});
diff --git a/ext/blotter/test.php b/ext/blotter/test.php
index 1e532906..20c321b0 100644
--- a/ext/blotter/test.php
+++ b/ext/blotter/test.php
@@ -34,4 +34,4 @@ class BlotterTest extends SCoreWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/blotter/theme.php b/ext/blotter/theme.php
index 23395bc5..27987687 100644
--- a/ext/blotter/theme.php
+++ b/ext/blotter/theme.php
@@ -176,4 +176,4 @@ class BlotterTheme extends Themelet {
return $html;
}
}
-?>
+
diff --git a/ext/bookmarks/main.php b/ext/bookmarks/main.php
index 93661086..d864d92a 100644
--- a/ext/bookmarks/main.php
+++ b/ext/bookmarks/main.php
@@ -32,8 +32,7 @@ class Bookmarks extends Extension {
}
protected function install() {
- global $database;
- global $config;
+ global $database, $config;
// shortcut to latest
if($config->get_int("ext_bookmarks_version") < 1) {
@@ -61,9 +60,9 @@ class Bookmarks extends Extension {
}
private function add_bookmark(/*string*/ $url, /*string*/ $title) {
- global $database;
+ global $database, $user;
$sql = "INSERT INTO bookmark(owner_id, url, title) VALUES (?, ?, ?)";
$database->Execute($sql, array($user->id, $url, $title));
}
}
-?>
+
diff --git a/ext/bookmarks/test.php b/ext/bookmarks/test.php
index 9bd0692a..66d41a96 100644
--- a/ext/bookmarks/test.php
+++ b/ext/bookmarks/test.php
@@ -1,4 +1,3 @@
-
get_page("bookmark/remove");
}
}
-?>
+
diff --git a/ext/bookmarks/theme.php b/ext/bookmarks/theme.php
index 83c43b42..a1cb7b42 100644
--- a/ext/bookmarks/theme.php
+++ b/ext/bookmarks/theme.php
@@ -2,4 +2,4 @@
class BookmarksTheme extends Themelet {
}
-?>
+
diff --git a/ext/browser_search/main.php b/ext/browser_search/main.php
index 266c7cd1..719dddfc 100644
--- a/ext/browser_search/main.php
+++ b/ext/browser_search/main.php
@@ -101,4 +101,4 @@ class BrowserSearch extends Extension {
$event->panel->add_block($sb);
}
}
-?>
+
diff --git a/ext/browser_search/test.php b/ext/browser_search/test.php
index 0f7ce77f..e0df2f92 100644
--- a/ext/browser_search/test.php
+++ b/ext/browser_search/test.php
@@ -5,4 +5,4 @@ class BrowserSearchTest extends SCoreWebTestCase {
$this->get_page("browser_search/test");
}
}
-?>
+
diff --git a/ext/bulk_add/main.php b/ext/bulk_add/main.php
index cf58e4a3..ea590a3f 100644
--- a/ext/bulk_add/main.php
+++ b/ext/bulk_add/main.php
@@ -111,4 +111,4 @@ class BulkAdd extends Extension {
}
}
}
-?>
+
diff --git a/ext/bulk_add/test.php b/ext/bulk_add/test.php
index 40b4d4e5..3f57fe99 100644
--- a/ext/bulk_add/test.php
+++ b/ext/bulk_add/test.php
@@ -31,4 +31,4 @@ class BulkAddTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/bulk_add/theme.php b/ext/bulk_add/theme.php
index 3df8a40b..787a4532 100644
--- a/ext/bulk_add/theme.php
+++ b/ext/bulk_add/theme.php
@@ -42,4 +42,4 @@ class BulkAddTheme extends Themelet {
$this->messages[] = new Block($title, $body);
}
}
-?>
+
diff --git a/ext/bulk_add_csv/main.php b/ext/bulk_add_csv/main.php
index 4ff15773..7fd6d2a7 100644
--- a/ext/bulk_add_csv/main.php
+++ b/ext/bulk_add_csv/main.php
@@ -136,4 +136,4 @@ class BulkAddCSV extends Extension {
fclose($csvhandle);
}
}
-?>
+
diff --git a/ext/bulk_add_csv/theme.php b/ext/bulk_add_csv/theme.php
index dfff459b..01c2e21f 100644
--- a/ext/bulk_add_csv/theme.php
+++ b/ext/bulk_add_csv/theme.php
@@ -41,4 +41,4 @@ class BulkAddCSVTheme extends Themelet {
$this->messages[] = new Block($title, $body);
}
}
-?>
+
diff --git a/ext/bulk_remove/main.php b/ext/bulk_remove/main.php
index 2e609386..592d85f6 100644
--- a/ext/bulk_remove/main.php
+++ b/ext/bulk_remove/main.php
@@ -130,4 +130,4 @@ class BulkRemove extends Extension {
$image_arr = $_POST["bulk_remove_images"];
}
}
-?>
+
diff --git a/ext/chatbox/cp/js/admincp.js b/ext/chatbox/cp/js/admincp.js
index ba4ca788..3fe93b27 100644
--- a/ext/chatbox/cp/js/admincp.js
+++ b/ext/chatbox/cp/js/admincp.js
@@ -1,7 +1,11 @@
+/*jshint bitwise:true, curly:true, devel:true, eqeqeq:true, evil:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
+
Array.prototype.inArray = function (value) {
- for (var i = 0; i < this.length; i++)
- if (this[i] === value)
+ for (var i = 0; i < this.length; i++) {
+ if (this[i] === value) {
return true;
+ }
+ }
return false;
};
@@ -25,8 +29,9 @@ AdminCP.prototype = {
this.initializing = true;
this.loginForm();
this.initEvents();
- if (this.loaded()) this.afterLogin();
- else {
+ if (this.loaded()) {
+ this.afterLogin();
+ } else {
$('#login-password')[0].focus();
}
@@ -54,10 +59,11 @@ AdminCP.prototype = {
$('.logout').click(function() { self.logout(); return false; });
// Show the nav
- if (this.initializing)
+ if (this.initializing) {
$('#nav ul').css('display', 'block');
- else
+ } else {
$('#nav ul').slideDown();
+ }
// Some css for betterlookingness
$('#preferences-form fieldset:odd').addClass('odd');
@@ -75,10 +81,11 @@ AdminCP.prototype = {
// If they want to go directly to a section
var anchor = this.getAnchor();
- if (anchor.length > 0 && ['preferences', 'bans', 'about'].inArray(anchor))
+ if (anchor.length > 0 && ['preferences', 'bans', 'about'].inArray(anchor)) {
self.show(anchor);
- else
+ } else {
self.show('preferences');
+ }
},
initEventsAfter: function() {
@@ -101,15 +108,16 @@ AdminCP.prototype = {
// Preferences
$('#preferences-form input').keypress(function(e) {
var key = window.event ? e.keyCode : e.which;
- if (key == 13 || key == 3) {
+ if (key === 13 || key === 3) {
self.changePref.apply(self, [$(this).attr('rel'), this.value]);
return false;
}
}).focus(function() {
this.name = this.value;
}).blur(function() {
- if (this.name != this.value)
+ if (this.name !== this.value) {
self.changePref.apply(self, [$(this).attr('rel'), this.value]);
+ }
});
$('#preferences-form select').change(function() {
@@ -125,10 +133,11 @@ AdminCP.prototype = {
'value': value
};
this.ajax(function(json) {
- if (!json.error)
+ if (!json.error) {
this.done();
- else
+ } else {
alert(json.error);
+ }
}, pars);
},
@@ -137,20 +146,20 @@ AdminCP.prototype = {
var pars = {
mode: 'resetpreferences'
- }
+ };
this.ajax(function(json) {
this.done();
- if (json.prefs)
- for(pref in json.prefs) {
+ if (json.prefs) {
+ for (pref in json.prefs) {
var value = json.prefs[pref];
var el = $('#preferences-form input[@rel=' + pref + '], select[@rel=' + pref + ']')[0];
- if (el.type == 'text')
+ if (el.type === 'text') {
el.value = value;
- else {
- if (value == true) value = 'true';
- if (value == false) value = 'false';
+ } else {
+ if (value === true) { value = 'true'; }
+ if (value === false) { value = 'false'; }
$('#preferences-form select[@rel=' + pref + ']')
.find('option')
@@ -158,11 +167,10 @@ AdminCP.prototype = {
.end()
.find('option[@rel=' + value + ']')
.attr('selected', 'yeah');
-
}
}
- }, pars);
-
+ }
+ }, pars);
},
invalidPassword: function() {
@@ -230,49 +238,53 @@ AdminCP.prototype = {
// if (!sections.inArray(section)) section = 'preferences';
if ($.browser.msie) {
- if (section == 'preferences')
+ if (section === 'preferences') {
$('#preferences select').css('display', 'block');
- else
+ } else {
$('#preferences select').css('display', 'none');
+ }
}
- if (section == this.curSection) return;
+ if (section === this.curSection) { return; }
+
this.curSection = section;
$('#' + section)[0].style.zIndex = ++this.z;
- if (this.initializing)
+
+ if (this.initializing) {
$('#' + section).css('display', 'block');
- else
+ } else {
$('#' + section).fadeIn(this.animSpeed, callback);
+ }
},
showPrefPane: function(pane) {
var self = this;
- if (pane == this.curPrefPane) return;
+ if (pane === this.curPrefPane) { return; }
this.curPrefPane = pane;
$('#preferences .cp-pane').css('display', 'none');
$('#cp-pane-' + pane).css('display', 'block').fadeIn(this.animSpeed, function() {
- if (self.curPrefPane == pane)
+ if (self.curPrefPane === pane) {
$('#preferences .cp-pane').not('#cp-pane-' + pane).css('display', 'none');
- else
+ } else {
$('#cp-pane-' + pane).css('display', 'none');
-
+ }
});
},
showAboutPane: function(pane) {
var self = this;
- if (pane == this.curAboutPane) return;
+ if (pane === this.curAboutPane) { return; }
this.curAboutPane = pane;
$('#about .cp-pane').css('display', 'none');
$('#cp-pane-' + pane).css('display', 'block').fadeIn(this.animSpeed, function() {
- if (self.curAboutPane == pane)
+ if (self.curAboutPane === pane) {
$('#about .cp-pane').not('#cp-pane-' + pane).css('display', 'none');
- else
+ } else {
$('#cp-pane-' + pane).css('display', 'none');
-
+ }
});
},
@@ -281,13 +293,15 @@ AdminCP.prototype = {
$.post('ajax.php', pars, function(parse) {
// alert(parse);
- if (parse)
- if (html)
+ if (parse) {
+ if (html) {
callback.apply(self, [parse]);
- else
+ } else {
callback.apply(self, [self.json(parse)]);
- else
+ }
+ } else {
callback.apply(self);
+ }
});
},
@@ -297,7 +311,7 @@ AdminCP.prototype = {
},
loaded: function() {
- return ($('#cp-loaded').length == 1);
+ return ($('#cp-loaded').length === 1);
},
loading: function() {
@@ -325,10 +339,11 @@ AdminCP.prototype = {
},
getAnchor: function() {
- var href = window.location.href;
- if (href.indexOf('#') > -1 )
- return href.substr(href.indexOf('#') + 1).toLowerCase();
- return '';
+ var href = window.location.href;
+ if (href.indexOf('#') > -1 ) {
+ return href.substr(href.indexOf('#') + 1).toLowerCase();
+ }
+ return '';
},
unban: function(ip, el) {
@@ -357,7 +372,7 @@ AdminCP.prototype = {
var pars = {
mode: 'unbanall'
- }
+ };
this.ajax(function(json) {
this.done();
diff --git a/ext/chatbox/history/index.php b/ext/chatbox/history/index.php
index fd3d8e02..aadd2853 100644
--- a/ext/chatbox/history/index.php
+++ b/ext/chatbox/history/index.php
@@ -83,7 +83,6 @@ if (isset($_POST['p'])) {
}
?>
-
@@ -109,13 +108,13 @@ if (isset($_POST['p'])) {
YShout.History
- if($admin) : ?>
+
Clear this log, or
Clear all logs.
- endif; ?>
+
';
- if (this.prefs.inverse) $('#ys-posts').prepend(html);
- else $('#ys-posts').append(html);
+ if (this.prefs.inverse) { $('#ys-posts').prepend(html); }
+ else { $('#ys-posts').append(html); }
this.p.push(post);
$('#' + id)
.find('.ys-post-nickname').click(function() {
- if (post.adminInfo)
+ if (post.adminInfo) {
self.findBySame(post.adminInfo.ip);
+ }
}).end()
.find('.ys-info-link').toggle(
function() { self.showInfo.apply(self, [id, this]); return false; },
@@ -514,22 +522,24 @@ YShout.prototype = {
showInfo: function(id, el) {
var jEl = $('#' + id + ' .ys-post-info');
- if (this.prefs.info == 'overlay')
+ if (this.prefs.info === 'overlay') {
jEl.css('display', 'block').fadeIn(this.animSpeed);
- else
+ } else {
jEl.slideDown(this.animSpeed);
+ }
- el.innerHTML ='Close Info'
+ el.innerHTML = 'Close Info';
return false;
},
hideInfo: function(id, el) {
var jEl = $('#' + id + ' .ys-post-info');
- if (this.prefs.info == 'overlay')
+ if (this.prefs.info === 'overlay') {
jEl.fadeOut(this.animSpeed);
- else
+ } else {
jEl.slideUp(this.animSpeed);
-
+ }
+
el.innerHTML = 'Info';
return false;
},
@@ -557,26 +567,24 @@ YShout.prototype = {
return;
}
//alert('p: ' + this.p + ' / ' + this.p.length);
- if (json.bannedSelf)
+ if (json.bannedSelf) {
self.banned(); // ?
-
- else
+ } else {
$.each(self.p, function(i) {
- if (this.adminInfo && this.adminInfo.ip == post.adminInfo.ip)
+ if (this.adminInfo && this.adminInfo.ip === post.adminInfo.ip) {
$('#' + this.id)
.addClass('ys-banned-post')
.find('.ys-ban-link').html('Unban');
+ }
});
-
+ }
}, pars);
link.innerHTML = 'Banning...';
return false;
- break;
case 'Banning...':
return false;
- break;
case 'Unban':
var pars = {
@@ -590,26 +598,24 @@ YShout.prototype = {
case 'admin':
self.error('You\'re not an admin. Log in through the Admin CP to unban people.');
return;
- break;
}
}
$.each(self.p, function(i) {
- if (this.adminInfo && this.adminInfo.ip == post.adminInfo.ip)
+ if (this.adminInfo && this.adminInfo.ip === post.adminInfo.ip) {
$('#' + this.id)
.removeClass('ys-banned-post')
.find('.ys-ban-link').html('Ban');
+ }
});
}, pars);
link.innerHTML = 'Unbanning...';
return false;
- break;
case 'Unbanning...':
return false;
- break;
}
},
@@ -617,7 +623,7 @@ YShout.prototype = {
var self = this;
var link = $('#' + id).find('.ys-delete-link')[0];
- if (link.innerHTML == 'Deleting...') return;
+ if (link.innerHTML === 'Deleting...') { return; }
var pars = {
reqType: 'delete',
@@ -630,7 +636,6 @@ YShout.prototype = {
case 'admin':
self.error('You\'re not an admin. Log in through the Admin CP to ban people.');
return;
- break;
}
}
self.reload();
@@ -638,15 +643,15 @@ YShout.prototype = {
link.innerHTML = 'Deleting...';
return false;
-
},
banSelf: function(reason) {
var self = this;
this.ajax(function(json) {
- if (json.error == false)
+ if (json.error === false) {
self.banned();
+ }
}, {
reqType: 'banself',
nickname: $('#ys-input-nickname').val()
@@ -710,22 +715,24 @@ YShout.prototype = {
truncate: function(clearAll) {
var truncateTo = clearAll ? 0 : this.prefs.truncate;
var posts = $('#ys-posts .ys-post').length;
- if (posts <= truncateTo) return;
+ if (posts <= truncateTo) { return; }
//alert(this.initializing);
if (this.prefs.doTruncate || this.initializing) {
var diff = posts - truncateTo;
- for (var i = 0; i < diff; i++)
+ for (var i = 0; i < diff; i++) {
this.p.shift();
+ }
// $('#ys-posts .ys-post:gt(' + truncateTo + ')').remove();
- if (this.prefs.inverse)
+ if (this.prefs.inverse) {
$('#ys-posts .ys-post:gt(' + (truncateTo - 1) + ')').remove();
- else
+ } else {
$('#ys-posts .ys-post:lt(' + (posts - truncateTo) + ')').remove();
+ }
}
- this.markEnds();
+ this.markEnds();
},
markEnds: function() {
@@ -766,11 +773,11 @@ YShout.prototype = {
json: function(parse) {
this.d('In json: ' + parse);
var json = eval('(' + parse + ')');
- if (!this.checkError(json)) return json;
+ if (!this.checkError(json)) { return json; }
},
checkError: function(json) {
- if (!json.yError) return false;
+ if (!json.yError) { return false; }
this.d('Error: ' + json.yError);
return true;
@@ -789,10 +796,8 @@ YShout.prototype = {
dataType: html ? 'text' : 'json',
data: pars,
success: function(parse) {
-var arr = [parse];
-
+ var arr = [parse];
callback.apply(self, arr);
-
}
});
},
diff --git a/ext/chatbox/main.php b/ext/chatbox/main.php
index 8d52bd6a..0f65d31b 100644
--- a/ext/chatbox/main.php
+++ b/ext/chatbox/main.php
@@ -33,4 +33,4 @@ class Chatbox extends Extension {
$page->add_block($chatblock);
}
}
-?>
+
diff --git a/ext/chatbox/php/ajaxcall.class.php b/ext/chatbox/php/ajaxcall.class.php
index 7d175b25..149a2ecc 100644
--- a/ext/chatbox/php/ajaxcall.class.php
+++ b/ext/chatbox/php/ajaxcall.class.php
@@ -1,5 +1,9 @@
banned(ip())) { $this->sendBanned(); break; }
- if ($post = $ys->post($nickname, $message)) // To use $post somewheres later
- $this->sendUpdates();
+ if ($post = $ys->post($nickname, $message)) {
+ // To use $post somewheres later
+ $this->sendUpdates();
+ }
break;
case 'refresh':
@@ -138,7 +144,6 @@
$send['error'] = false;
echo jsonEncode($send);
-
}
function unbanSelf() {
@@ -235,7 +240,7 @@
}
function clearLog() {
- $log = $_POST['log'];
+ //$log = $_POST['log'];
$send = array();
$ys = ys($_SESSION['yLog']);
@@ -254,10 +259,10 @@
function clearLogs() {
global $prefs;
- $log = $_POST['log'];
+ //$log = $_POST['log'];
$send = array();
- $ys = ys($_SESSION['yLog']);
+ //$ys = ys($_SESSION['yLog']);
switch(true) {
case !loggedIn():
@@ -272,8 +277,8 @@
$send['error'] = false;
}
- echo jsonEncode($send);
+ echo jsonEncode($send);
}
}
-?>
\ No newline at end of file
+
diff --git a/ext/chatbox/php/filestorage.class.php b/ext/chatbox/php/filestorage.class.php
index 35b8ede1..a7ab5ba4 100644
--- a/ext/chatbox/php/filestorage.class.php
+++ b/ext/chatbox/php/filestorage.class.php
@@ -2,6 +2,8 @@
class FileStorage {
+ public $shoutLog, $path, $handle;
+
function FileStorage($path, $shoutLog = false) {
$this->shoutLog = $shoutLog;
$folder = 'logs';
@@ -56,7 +58,6 @@ class FileStorage {
fseek($this->handle, 0);
//return stream_get_contents($this->handle);
return file_get_contents($this->path);
-
}
function write($contents) {
@@ -79,7 +80,5 @@ class FileStorage {
$this->save($default, false);
return $default;
}
-
}
-?>
\ No newline at end of file
diff --git a/ext/chatbox/php/functions.php b/ext/chatbox/php/functions.php
index 07078599..c61a65e3 100644
--- a/ext/chatbox/php/functions.php
+++ b/ext/chatbox/php/functions.php
@@ -16,8 +16,8 @@
}
function getVar($name) {
- if (isset($_POST[$name])) return $_POST[$name];
- if (isset($_GET[$name])) return $_GET[$name];
+ if (isset($_POST[$name])) { return $_POST[$name]; }
+ if (isset($_GET[$name])) { return $_GET[$name]; }
return null;
}
@@ -28,7 +28,7 @@
}
function magic($s) {
- if (get_magic_quotes_gpc()) $s = stripslashes($s);
+ if (get_magic_quotes_gpc()) { $s = stripslashes($s); }
return $s;
}
@@ -147,6 +147,5 @@
return $_SESSION['yLoginHash'] == md5($prefs['password']);
return false;
-
}
-?>
\ No newline at end of file
+
diff --git a/ext/chatbox/php/yshout.class.php b/ext/chatbox/php/yshout.class.php
index b5b83e0b..e0074cba 100644
--- a/ext/chatbox/php/yshout.class.php
+++ b/ext/chatbox/php/yshout.class.php
@@ -250,4 +250,3 @@ class YShout {
}
-?>
\ No newline at end of file
diff --git a/ext/chatbox/preferences.php b/ext/chatbox/preferences.php
index ef79bbf1..cc72b33b 100644
--- a/ext/chatbox/preferences.php
+++ b/ext/chatbox/preferences.php
@@ -71,4 +71,4 @@
resetPrefs();
//loadPrefs();
-?>
+
diff --git a/ext/comment/main.php b/ext/comment/main.php
index e6132807..f64247e2 100644
--- a/ext/comment/main.php
+++ b/ext/comment/main.php
@@ -332,7 +332,7 @@ class CommentList extends Extension {
$image = null; // this is "clever", I may live to regret it
}
}
- if(!is_null($image)) $images[] = array($image, $comments);
+ if(!is_null($image)) $images[] = array($image, $comments);
}
}
@@ -558,4 +558,4 @@ class CommentList extends Extension {
}
// }}}
}
-?>
+
diff --git a/ext/comment/test.php b/ext/comment/test.php
index 600b2edc..1cae2054 100644
--- a/ext/comment/test.php
+++ b/ext/comment/test.php
@@ -101,4 +101,4 @@ class CommentListTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/comment/theme.php b/ext/comment/theme.php
index 7821b68c..3a08c695 100644
--- a/ext/comment/theme.php
+++ b/ext/comment/theme.php
@@ -296,4 +296,4 @@ class CommentListTheme extends Themelet {
';
}
}
-?>
+
diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php
index 24c62c55..97f4062c 100644
--- a/ext/cron_uploader/main.php
+++ b/ext/cron_uploader/main.php
@@ -415,4 +415,4 @@ class CronUploader extends Extension {
file_put_contents ($log_path, $content);
}
}
-?>
+
diff --git a/ext/custom_html_headers/main.php b/ext/custom_html_headers/main.php
index 4bb00058..d8dc8b57 100644
--- a/ext/custom_html_headers/main.php
+++ b/ext/custom_html_headers/main.php
@@ -71,4 +71,4 @@ class custom_html_headers extends Extension {
}
}
}
-?>
+
diff --git a/ext/danbooru_api/main.php b/ext/danbooru_api/main.php
index 2b475a9e..af254ec7 100644
--- a/ext/danbooru_api/main.php
+++ b/ext/danbooru_api/main.php
@@ -261,6 +261,8 @@ class DanbooruApi extends Extension {
if(($event->get_arg(1) == 'find_posts') || (($event->get_arg(1) == 'post') && ($event->get_arg(2) == 'index.xml')))
{
$this->authenticate_user();
+ $start = 0;
+
if(isset($_GET['md5']))
{
$md5list = explode(",",$_GET['md5']);
@@ -268,6 +270,7 @@ class DanbooruApi extends Extension {
{
$results[] = Image::by_hash($md5);
}
+ $count = count($results);
} elseif(isset($_GET['id']))
{
$idlist = explode(",",$_GET['id']);
@@ -275,6 +278,7 @@ class DanbooruApi extends Extension {
{
$results[] = Image::by_id($id);
}
+ $count = count($results);
} else
{
$limit = isset($_GET['limit']) ? int_escape($_GET['limit']) : 100;
@@ -294,7 +298,7 @@ class DanbooruApi extends Extension {
// Now we have the array $results filled with Image objects
// Let's display them
- $xml = "
\n";
+ $xml = "\n";
foreach($results as $img)
{
// Sanity check to see if $img is really an image object
@@ -435,4 +439,4 @@ class DanbooruApi extends Extension {
}
}
-?>
+
diff --git a/ext/danbooru_api/test.php b/ext/danbooru_api/test.php
index a5218626..3717ed80 100644
--- a/ext/danbooru_api/test.php
+++ b/ext/danbooru_api/test.php
@@ -23,4 +23,4 @@ class DanbooruApiTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/downtime/main.php b/ext/downtime/main.php
index 63421db8..2c857fba 100644
--- a/ext/downtime/main.php
+++ b/ext/downtime/main.php
@@ -40,4 +40,4 @@ class Downtime extends Extension {
else return false;
}
}
-?>
+
diff --git a/ext/downtime/test.php b/ext/downtime/test.php
index 868eeef6..77657dff 100644
--- a/ext/downtime/test.php
+++ b/ext/downtime/test.php
@@ -20,4 +20,4 @@ class DowntimeTest extends SCoreWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/downtime/theme.php b/ext/downtime/theme.php
index cec59c7b..aae0cca5 100644
--- a/ext/downtime/theme.php
+++ b/ext/downtime/theme.php
@@ -59,4 +59,4 @@ class DowntimeTheme extends Themelet {
EOD;
}
}
-?>
+
diff --git a/ext/emoticons/main.php b/ext/emoticons/main.php
index ec7a071d..a33b06c7 100644
--- a/ext/emoticons/main.php
+++ b/ext/emoticons/main.php
@@ -32,4 +32,4 @@ class EmoticonList extends Extension {
}
}
}
-?>
+
diff --git a/ext/emoticons/test.php b/ext/emoticons/test.php
index 3758ce3b..7f9237c7 100644
--- a/ext/emoticons/test.php
+++ b/ext/emoticons/test.php
@@ -19,4 +19,4 @@ class EmoticonTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/emoticons/theme.php b/ext/emoticons/theme.php
index 22eaa350..dff9f98a 100644
--- a/ext/emoticons/theme.php
+++ b/ext/emoticons/theme.php
@@ -18,4 +18,4 @@ class EmoticonListTheme extends Themelet {
$page->set_data($html);
}
}
-?>
+
diff --git a/ext/et/main.php b/ext/et/main.php
index 570eb3da..d08fd552 100644
--- a/ext/et/main.php
+++ b/ext/et/main.php
@@ -83,4 +83,4 @@ class ET extends Extension {
return $info;
}
}
-?>
+
diff --git a/ext/et/test.php b/ext/et/test.php
index 6d4fcae8..d6df53b9 100644
--- a/ext/et/test.php
+++ b/ext/et/test.php
@@ -7,4 +7,4 @@ class ETTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/et/theme.php b/ext/et/theme.php
index 265b019a..2239807b 100644
--- a/ext/et/theme.php
+++ b/ext/et/theme.php
@@ -59,4 +59,4 @@ EOD;
return $html;
}
}
-?>
+
diff --git a/ext/ext_manager/main.php b/ext/ext_manager/main.php
index fdd59c4e..1dc41624 100644
--- a/ext/ext_manager/main.php
+++ b/ext/ext_manager/main.php
@@ -199,4 +199,4 @@ class ExtManager extends Extension {
}
}
}
-?>
+
diff --git a/ext/ext_manager/test.php b/ext/ext_manager/test.php
index 1ef29a37..4a4b0601 100644
--- a/ext/ext_manager/test.php
+++ b/ext/ext_manager/test.php
@@ -23,4 +23,4 @@ class ExtManagerTest extends SCoreWebTestCase {
# FIXME: test that some extensions can be added and removed? :S
}
}
-?>
+
diff --git a/ext/ext_manager/theme.php b/ext/ext_manager/theme.php
index 0b9cb270..fa340d41 100644
--- a/ext/ext_manager/theme.php
+++ b/ext/ext_manager/theme.php
@@ -136,4 +136,4 @@ class ExtManagerTheme extends Themelet {
$page->add_block(new Block("Documentation", $html));
}
}
-?>
+
diff --git a/ext/favorites/main.php b/ext/favorites/main.php
index 10242e53..e90aa009 100644
--- a/ext/favorites/main.php
+++ b/ext/favorites/main.php
@@ -196,4 +196,4 @@ class Favorites extends Extension {
array("image_id"=>$image->id));
}
}
-?>
+
diff --git a/ext/favorites/test.php b/ext/favorites/test.php
index 34dc91eb..c3c4b8d1 100644
--- a/ext/favorites/test.php
+++ b/ext/favorites/test.php
@@ -30,4 +30,4 @@ class FavoritesTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/favorites/theme.php b/ext/favorites/theme.php
index 14a4fd39..d530e497 100644
--- a/ext/favorites/theme.php
+++ b/ext/favorites/theme.php
@@ -35,4 +35,4 @@ class FavoritesTheme extends Themelet {
}
}
-?>
+
diff --git a/ext/featured/main.php b/ext/featured/main.php
index 01bf6475..e0a23676 100644
--- a/ext/featured/main.php
+++ b/ext/featured/main.php
@@ -86,4 +86,4 @@ class Featured extends Extension {
}
}
}
-?>
+
diff --git a/ext/featured/test.php b/ext/featured/test.php
index 293efe69..2308238e 100644
--- a/ext/featured/test.php
+++ b/ext/featured/test.php
@@ -30,4 +30,4 @@ class FeaturedTest extends ShimmieWebTestCase {
$this->assert_no_text("Featured Image");
}
}
-?>
+
diff --git a/ext/featured/theme.php b/ext/featured/theme.php
index 77afe5ff..35a64a36 100644
--- a/ext/featured/theme.php
+++ b/ext/featured/theme.php
@@ -34,4 +34,4 @@ class FeaturedTheme extends Themelet {
";
}
}
-?>
+
diff --git a/ext/forum/main.php b/ext/forum/main.php
index 62951e4f..1fea2064 100644
--- a/ext/forum/main.php
+++ b/ext/forum/main.php
@@ -412,4 +412,4 @@ class Forum extends Extension {
}
}
}
-?>
+
diff --git a/ext/forum/theme.php b/ext/forum/theme.php
index 78c06261..74d7c5df 100644
--- a/ext/forum/theme.php
+++ b/ext/forum/theme.php
@@ -229,4 +229,4 @@ class ForumTheme extends Themelet {
return $html;
}
}
-?>
+
diff --git a/ext/google_analytics/main.php b/ext/google_analytics/main.php
index f1ef0b08..3f0f8608 100644
--- a/ext/google_analytics/main.php
+++ b/ext/google_analytics/main.php
@@ -35,4 +35,4 @@ class google_analytics extends Extension {
}
}
}
-?>
+
diff --git a/ext/handle_404/main.php b/ext/handle_404/main.php
index cc41b03d..fd00790c 100644
--- a/ext/handle_404/main.php
+++ b/ext/handle_404/main.php
@@ -50,4 +50,4 @@ class Handle404 extends Extension {
public function get_priority() {return 99;}
}
-?>
+
diff --git a/ext/handle_404/test.php b/ext/handle_404/test.php
index 452af8da..ad6d3943 100644
--- a/ext/handle_404/test.php
+++ b/ext/handle_404/test.php
@@ -10,4 +10,4 @@ class Handle404Test extends SCoreWebTestCase {
$this->assert_response(200);
}
}
-?>
+
diff --git a/ext/handle_archive/main.php b/ext/handle_archive/main.php
index f4dfe3dc..3f61ad60 100644
--- a/ext/handle_archive/main.php
+++ b/ext/handle_archive/main.php
@@ -110,4 +110,4 @@ class ArchiveFileHandler extends Extension {
// $this->theme->add_status("Adding $subdir", $list);
}
}
-?>
+
diff --git a/ext/handle_flash/main.php b/ext/handle_flash/main.php
index 88becce7..f84153ad 100644
--- a/ext/handle_flash/main.php
+++ b/ext/handle_flash/main.php
@@ -46,4 +46,4 @@ class FlashFileHandler extends DataHandlerExtension {
return true;
}
}
-?>
+
diff --git a/ext/handle_flash/theme.php b/ext/handle_flash/theme.php
index 6b956a75..e4557088 100644
--- a/ext/handle_flash/theme.php
+++ b/ext/handle_flash/theme.php
@@ -23,4 +23,4 @@ class FlashFileHandlerTheme extends Themelet {
$page->add_block(new Block("Flash Animation", $html, "main", 10));
}
}
-?>
+
diff --git a/ext/handle_ico/main.php b/ext/handle_ico/main.php
index 07fa97ec..dae069c8 100644
--- a/ext/handle_ico/main.php
+++ b/ext/handle_ico/main.php
@@ -107,4 +107,4 @@ class IcoFileHandler extends Extension {
return true;
}
}
-?>
+
diff --git a/ext/handle_ico/test.php b/ext/handle_ico/test.php
index dd362055..9292a4a5 100644
--- a/ext/handle_ico/test.php
+++ b/ext/handle_ico/test.php
@@ -17,4 +17,4 @@ class IcoHandlerTest extends ShimmieWebTestCase {
# FIXME: test that it gets displayed properly
}
}
-?>
+
diff --git a/ext/handle_ico/theme.php b/ext/handle_ico/theme.php
index 27b1ae74..aa092709 100644
--- a/ext/handle_ico/theme.php
+++ b/ext/handle_ico/theme.php
@@ -9,4 +9,4 @@ class IcoFileHandlerTheme extends Themelet {
$page->add_block(new Block("Image", $html, "main", 10));
}
}
-?>
+
diff --git a/ext/handle_mp3/main.php b/ext/handle_mp3/main.php
index 2a81fcbb..be807472 100644
--- a/ext/handle_mp3/main.php
+++ b/ext/handle_mp3/main.php
@@ -59,4 +59,4 @@ class MP3FileHandler extends DataHandlerExtension {
return FALSE;
}
}
-?>
+
diff --git a/ext/handle_mp3/theme.php b/ext/handle_mp3/theme.php
index 59ecefac..d6beb126 100644
--- a/ext/handle_mp3/theme.php
+++ b/ext/handle_mp3/theme.php
@@ -20,4 +20,4 @@ class MP3FileHandlerTheme extends Themelet {
$page->add_block(new Block("Music", $html, "main", 10));
}
}
-?>
+
diff --git a/ext/handle_pixel/main.php b/ext/handle_pixel/main.php
index 0ee4ca69..bf345352 100644
--- a/ext/handle_pixel/main.php
+++ b/ext/handle_pixel/main.php
@@ -177,4 +177,4 @@ class PixelFileHandler extends DataHandlerExtension {
}
// }}}
}
-?>
+
diff --git a/ext/handle_pixel/test.php b/ext/handle_pixel/test.php
index ac8411c8..c8096114 100644
--- a/ext/handle_pixel/test.php
+++ b/ext/handle_pixel/test.php
@@ -14,4 +14,4 @@ class PixelHandlerTest extends ShimmieWebTestCase {
# FIXME: test that it gets displayed properly
}
}
-?>
+
diff --git a/ext/handle_pixel/theme.php b/ext/handle_pixel/theme.php
index 74f9af4c..de8c0c60 100644
--- a/ext/handle_pixel/theme.php
+++ b/ext/handle_pixel/theme.php
@@ -31,4 +31,4 @@ class PixelFileHandlerTheme extends Themelet {
$page->add_block(new Block("Image", $html, "main", 10));
}
}
-?>
+
diff --git a/ext/handle_svg/main.php b/ext/handle_svg/main.php
index 76b9a18d..d27bb6f0 100644
--- a/ext/handle_svg/main.php
+++ b/ext/handle_svg/main.php
@@ -103,4 +103,4 @@ class MiniSVGParser {
function endElement($parser, $name) {
}
}
-?>
+
diff --git a/ext/handle_svg/test.php b/ext/handle_svg/test.php
index 934d6ef6..f6420684 100644
--- a/ext/handle_svg/test.php
+++ b/ext/handle_svg/test.php
@@ -34,4 +34,4 @@ class SVGHandlerTest extends ShimmieWebTestCase {
# FIXME: test that it gets displayed properly
}
}
-?>
+
diff --git a/ext/handle_svg/theme.php b/ext/handle_svg/theme.php
index 304baf79..76d76aa3 100644
--- a/ext/handle_svg/theme.php
+++ b/ext/handle_svg/theme.php
@@ -12,4 +12,4 @@ class SVGFileHandlerTheme extends Themelet {
$page->add_block(new Block("Image", $html, "main", 10));
}
}
-?>
+
diff --git a/ext/handle_video/main.php b/ext/handle_video/main.php
index 9d34d436..e08c005a 100644
--- a/ext/handle_video/main.php
+++ b/ext/handle_video/main.php
@@ -79,4 +79,4 @@ class VideoFileHandler extends DataHandlerExtension {
return FALSE;
}
}
-?>
+
diff --git a/ext/handle_video/theme.php b/ext/handle_video/theme.php
index 3e584ce3..d6d7f723 100644
--- a/ext/handle_video/theme.php
+++ b/ext/handle_video/theme.php
@@ -37,4 +37,4 @@ else {
$page->add_block(new Block("Video", $html, "main", 10));
}
}
-?>
+
diff --git a/ext/hellban/main.php b/ext/hellban/main.php
index ae6e2be6..cac33ee9 100644
--- a/ext/hellban/main.php
+++ b/ext/hellban/main.php
@@ -22,4 +22,4 @@ class HellBan extends Extension {
}
}
}
-?>
+
diff --git a/ext/holiday/main.php b/ext/holiday/main.php
index f435099a..be23350c 100644
--- a/ext/holiday/main.php
+++ b/ext/holiday/main.php
@@ -29,4 +29,4 @@ class Holiday extends Extension {
}
}
}
-?>
+
diff --git a/ext/holiday/theme.php b/ext/holiday/theme.php
index 2012f3ee..fa32d350 100644
--- a/ext/holiday/theme.php
+++ b/ext/holiday/theme.php
@@ -17,4 +17,4 @@ class HolidayTheme extends Themelet {
}
}
}
-?>
+
diff --git a/ext/home/main.php b/ext/home/main.php
index 2c585a1a..d170b135 100644
--- a/ext/home/main.php
+++ b/ext/home/main.php
@@ -80,4 +80,4 @@ class Home extends Extension {
return $this->theme->build_body($sitename, $main_links, $main_text, $contact_link, $num_comma, $counter_text);
}
}
-?>
+
diff --git a/ext/home/test.php b/ext/home/test.php
index ada45afe..3a142074 100644
--- a/ext/home/test.php
+++ b/ext/home/test.php
@@ -8,4 +8,4 @@ class HomeTest extends ShimmieWebTestCase {
# FIXME: test search box
}
}
-?>
+
diff --git a/ext/home/theme.php b/ext/home/theme.php
index c93cdf13..2d4fa889 100644
--- a/ext/home/theme.php
+++ b/ext/home/theme.php
@@ -55,4 +55,4 @@ EOD
";
}
}
-?>
+
diff --git a/ext/image/main.php b/ext/image/main.php
index 32d1bf97..d9a2edbb 100644
--- a/ext/image/main.php
+++ b/ext/image/main.php
@@ -418,7 +418,7 @@ class ImageIO extends Extension {
inspected later by an admin?
*/
log_debug("image", "Removing image with hash ".$existing->hash);
- $existing->remove_image_only(); // Actually delete the old image file from disk
+ $existing->remove_image_only(); // Actually delete the old image file from disk
// Update the data in the database.
$database->Execute(
@@ -441,4 +441,4 @@ class ImageIO extends Extension {
} // end of class ImageIO
-?>
+
diff --git a/ext/image/test.php b/ext/image/test.php
index 0bb36eef..3e5a94b3 100644
--- a/ext/image/test.php
+++ b/ext/image/test.php
@@ -23,4 +23,4 @@ class ImageTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/image/theme.php b/ext/image/theme.php
index 9a07b7fe..072888bf 100644
--- a/ext/image/theme.php
+++ b/ext/image/theme.php
@@ -4,7 +4,8 @@ class ImageIOTheme extends Themelet {
* Display a link to delete an image
* (Added inline Javascript to confirm the deletion)
*
- * @param $image_id The image to delete
+ * @param $image_id integer The image to delete
+ * @return string
*/
public function get_deleter_html(/*int*/ $image_id) {
global $config;
@@ -18,11 +19,12 @@ class ImageIOTheme extends Themelet {
return $html;
}
-
+
/**
* Display link to replace the image
*
- * @param $image_id The image to replace
+ * @param $image_id integer The image to replace
+ * @return string
*/
public function get_replace_html(/*int*/ $image_id) {
$html = make_form(make_link("image/replace"))."
@@ -32,4 +34,4 @@ class ImageIOTheme extends Themelet {
return $html;
}
}
-?>
+
diff --git a/ext/image_hash_ban/main.php b/ext/image_hash_ban/main.php
index 410f0b41..5037c844 100644
--- a/ext/image_hash_ban/main.php
+++ b/ext/image_hash_ban/main.php
@@ -158,4 +158,4 @@ class ImageBan extends Extension {
// in before resolution limit plugin
public function get_priority() {return 30;}
}
-?>
+
diff --git a/ext/image_hash_ban/test.php b/ext/image_hash_ban/test.php
index 9af952e8..d84889fd 100644
--- a/ext/image_hash_ban/test.php
+++ b/ext/image_hash_ban/test.php
@@ -34,4 +34,4 @@ class HashBanTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/image_hash_ban/theme.php b/ext/image_hash_ban/theme.php
index 87c70cb1..0c759a4a 100644
--- a/ext/image_hash_ban/theme.php
+++ b/ext/image_hash_ban/theme.php
@@ -92,4 +92,4 @@ class ImageBanTheme extends Themelet {
return $html;
}
}
-?>
+
diff --git a/ext/image_view_counter/main.php b/ext/image_view_counter/main.php
index a5da3593..4d8fa1cf 100644
--- a/ext/image_view_counter/main.php
+++ b/ext/image_view_counter/main.php
@@ -105,4 +105,4 @@ class image_view_counter extends Extension {
return $view_count;
}
}
-?>
+
diff --git a/ext/index/main.php b/ext/index/main.php
index e2664883..1c00bdad 100644
--- a/ext/index/main.php
+++ b/ext/index/main.php
@@ -381,4 +381,4 @@ class Index extends Extension {
$this->stpen++;
}
}
-?>
+
diff --git a/ext/index/script.js b/ext/index/script.js
index 6842ef34..7fd63d6a 100644
--- a/ext/index/script.js
+++ b/ext/index/script.js
@@ -1,3 +1,5 @@
+/*jshint bitwise:false, curly:true, eqeqeq:true, evil:true, forin:false, noarg:true, noempty:true, nonew:true, undef:false, strict:false, browser:true, jquery:true */
+
$(function() {
var blocked_tags = ($.cookie("ui-blocked-tags") || "").split(" ");
var needs_refresh = false;
diff --git a/ext/index/test.php b/ext/index/test.php
index 509ab7ff..6496882b 100644
--- a/ext/index/test.php
+++ b/ext/index/test.php
@@ -112,4 +112,4 @@ class IndexTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/index/theme.php b/ext/index/theme.php
index 7c04910b..81fb318f 100644
--- a/ext/index/theme.php
+++ b/ext/index/theme.php
@@ -106,4 +106,4 @@ and of course start organising your images :-)
return $table;
}
}
-?>
+
diff --git a/ext/ipban/main.php b/ext/ipban/main.php
index c566f47a..67e363fa 100644
--- a/ext/ipban/main.php
+++ b/ext/ipban/main.php
@@ -284,4 +284,4 @@ class IPBan extends Extension {
}
// }}}
}
-?>
+
diff --git a/ext/ipban/test.php b/ext/ipban/test.php
index 9fd636d4..4e4226b6 100644
--- a/ext/ipban/test.php
+++ b/ext/ipban/test.php
@@ -25,5 +25,5 @@ class IPBanTest extends SCoreWebTestCase {
# FIXME: test that the IP is actually banned
}
}
-?>
+
diff --git a/ext/ipban/theme.php b/ext/ipban/theme.php
index e9e927b6..9b9996e6 100644
--- a/ext/ipban/theme.php
+++ b/ext/ipban/theme.php
@@ -57,4 +57,4 @@ class IPBanTheme extends Themelet {
$page->add_block(new Block("Edit IP Bans", $html));
}
}
-?>
+
diff --git a/ext/link_image/main.php b/ext/link_image/main.php
index 3183a41d..75f97221 100644
--- a/ext/link_image/main.php
+++ b/ext/link_image/main.php
@@ -34,4 +34,4 @@ class LinkImage extends Extension {
'text_link' => $text_link);
}
}
-?>
+
diff --git a/ext/link_image/test.php b/ext/link_image/test.php
index 83f641f7..1e70a4d2 100644
--- a/ext/link_image/test.php
+++ b/ext/link_image/test.php
@@ -22,4 +22,4 @@ class LinkImageTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/link_image/theme.php b/ext/link_image/theme.php
index 24de94dc..f92891c6 100644
--- a/ext/link_image/theme.php
+++ b/ext/link_image/theme.php
@@ -91,4 +91,4 @@ class LinkImageTheme extends Themelet {
";
}
}
-?>
+
diff --git a/ext/log_db/main.php b/ext/log_db/main.php
index 126a6f66..c72c51cd 100644
--- a/ext/log_db/main.php
+++ b/ext/log_db/main.php
@@ -135,4 +135,4 @@ class LogDatabase extends Extension {
}
}
}
-?>
+
diff --git a/ext/log_db/test.php b/ext/log_db/test.php
index f2e9b8dd..2314d41f 100644
--- a/ext/log_db/test.php
+++ b/ext/log_db/test.php
@@ -10,4 +10,4 @@ class LogDatabaseTest extends SCoreWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/log_db/theme.php b/ext/log_db/theme.php
index 77705826..1b0ba8b0 100644
--- a/ext/log_db/theme.php
+++ b/ext/log_db/theme.php
@@ -103,4 +103,4 @@ class LogDatabaseTheme extends Themelet {
return "Image #$iid";
}
}
-?>
+
diff --git a/ext/log_net/main.php b/ext/log_net/main.php
index f82d01d3..8a0fdd8a 100644
--- a/ext/log_net/main.php
+++ b/ext/log_net/main.php
@@ -46,4 +46,4 @@ class LogNet extends Extension {
}
}
}
-?>
+
diff --git a/ext/mail/main.php b/ext/mail/main.php
index 7d0ac454..d4b8007f 100644
--- a/ext/mail/main.php
+++ b/ext/mail/main.php
@@ -42,4 +42,4 @@ class MailTest extends Extension {
}
}
}
-?>
+
diff --git a/ext/mass_tagger/main.php b/ext/mass_tagger/main.php
index 2216699b..aa9e650e 100644
--- a/ext/mass_tagger/main.php
+++ b/ext/mass_tagger/main.php
@@ -57,4 +57,4 @@ class MassTagger extends Extension {
$page->set_redirect($_SERVER['HTTP_REFERER']);
}
}
-?>
+
diff --git a/ext/mass_tagger/script.js b/ext/mass_tagger/script.js
index 1cc4077c..966e8ac2 100644
--- a/ext/mass_tagger/script.js
+++ b/ext/mass_tagger/script.js
@@ -1,3 +1,5 @@
+/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
+
function activate_mass_tagger ( image_link ) {
$(".shm-thumb").each(
function ( index, block ) {
diff --git a/ext/mass_tagger/theme.php b/ext/mass_tagger/theme.php
index 5a844bac..56a2273a 100644
--- a/ext/mass_tagger/theme.php
+++ b/ext/mass_tagger/theme.php
@@ -24,4 +24,4 @@ class MassTaggerTheme extends Themelet {
$page->add_block( $block );
}
}
-?>
+
diff --git a/ext/not_a_tag/main.php b/ext/not_a_tag/main.php
index 5dcb41fc..777d6dbe 100644
--- a/ext/not_a_tag/main.php
+++ b/ext/not_a_tag/main.php
@@ -119,4 +119,4 @@ class NotATag extends Extension {
else {return array();}
}
}
-?>
+
diff --git a/ext/not_a_tag/theme.php b/ext/not_a_tag/theme.php
index 543af6f5..d5b39cf0 100644
--- a/ext/not_a_tag/theme.php
+++ b/ext/not_a_tag/theme.php
@@ -55,4 +55,4 @@ class NotATagTheme extends Themelet {
$this->display_paginator($page, "untag/list", null, $page_number, $page_count);
}
}
-?>
+
diff --git a/ext/notes/main.php b/ext/notes/main.php
index cfbb6259..3a259c1c 100644
--- a/ext/notes/main.php
+++ b/ext/notes/main.php
@@ -323,26 +323,16 @@ class Notes extends Extension {
$noteText = mysql_real_escape_string(html_escape($_POST["note_text"]));
// validate parameters
- if(is_null($imageID) || !is_numeric($imageID))
- return;
-
- if(is_null($noteID) || !is_numeric($noteID))
- return;
-
- if(is_null($noteX1) || !is_numeric($noteX1))
- return;
-
- if(is_null($noteY1) || !is_numeric($noteY1))
- return;
-
- if(is_null($noteHeight) || !is_numeric($noteHeight))
- return;
-
- if(is_null($noteWidth) || !is_numeric($noteWidth))
- return;
-
- if(is_null($noteText) || strlen($noteText) == 0)
+ if (is_null($imageID) || !is_numeric($imageID) ||
+ is_null($noteID) || !is_numeric($noteID) ||
+ is_null($noteX1) || !is_numeric($noteX1) ||
+ is_null($noteY1) || !is_numeric($noteY1) ||
+ is_null($noteHeight) || !is_numeric($noteHeight) ||
+ is_null($noteWidth) || !is_numeric($noteWidth) ||
+ is_null($noteText) || strlen($noteText) == 0)
+ {
return;
+ }
global $database;
$database->execute("UPDATE notes ".
@@ -369,11 +359,11 @@ class Notes extends Extension {
$noteID = int_escape($_POST["note_id"]);
// validate parameters
- if(is_null($imageID) || !is_numeric($imageID))
- return;
-
- if(is_null($noteID) || !is_numeric($noteID))
+ if( is_null($imageID) || !is_numeric($imageID) ||
+ is_null($noteID) || !is_numeric($noteID))
+ {
return;
+ }
global $database;
@@ -609,4 +599,4 @@ class Notes extends Extension {
}
}
-?>
+
diff --git a/ext/notes/script.js b/ext/notes/script.js
index c8bafab7..43f492b2 100644
--- a/ext/notes/script.js
+++ b/ext/notes/script.js
@@ -1,3 +1,5 @@
+/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
+
$(function() {
if(window.notes) {
$('#main_image').imgNotes({notes: window.notes});
@@ -36,9 +38,9 @@ $(function() {
});
function showaddnote (img, area) {
- imgOffset = $(img).offset();
- form_left = parseInt(imgOffset.left) + parseInt(area.x1);
- form_top = parseInt(imgOffset.top) + parseInt(area.y1) + parseInt(area.height)+5;
+ var imgOffset = $(img).offset();
+ var form_left = parseInt(imgOffset.left) + parseInt(area.x1);
+ var form_top = parseInt(imgOffset.top) + parseInt(area.y1) + parseInt(area.height)+5;
$('#noteform').css({ left: form_left + 'px', top: form_top + 'px'});
$('#noteform').show();
@@ -50,9 +52,9 @@ function showaddnote (img, area) {
}
function showeditnote (img, area) {
- imgOffset = $(img).offset();
- form_left = parseInt(imgOffset.left) + area.x1;
- form_top = parseInt(imgOffset.top) + area.y2;
+ var imgOffset = $(img).offset();
+ var form_left = parseInt(imgOffset.left) + area.x1;
+ var form_top = parseInt(imgOffset.top) + area.y2;
$('#noteEditForm').css({ left: form_left + 'px', top: form_top + 'px'});
$('#noteEditForm').show();
diff --git a/ext/notes/theme.php b/ext/notes/theme.php
index 99359b92..38e7a968 100644
--- a/ext/notes/theme.php
+++ b/ext/notes/theme.php
@@ -235,5 +235,5 @@ class NotesTheme extends Themelet {
$this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages);
}
-}
-?>
+}
+
diff --git a/ext/numeric_score/main.php b/ext/numeric_score/main.php
index e9a471f5..e2754f5a 100644
--- a/ext/numeric_score/main.php
+++ b/ext/numeric_score/main.php
@@ -137,6 +137,10 @@ class NumericScore extends Extension {
else if($event->page_matches("popular_by_year")){
$dte = array($totaldate, $year, "\\y\\e\\a\\r\=Y", "year");
}
+ else {
+ // this should never happen due to the fact that the page event is already matched against earlier.
+ throw new UnexpectedValueException("Error: Invalid page event.");
+ }
$sql .= " AND NOT numeric_score=0 ORDER BY numeric_score DESC LIMIT :limit OFFSET 0";
//filter images by score != 0 + date > limit to max images on one page > order from highest to lowest score
@@ -300,4 +304,4 @@ class NumericScore extends Extension {
array("imageid" => $image_id, "id" => $image_id));
}
}
-?>
+
diff --git a/ext/numeric_score/test.php b/ext/numeric_score/test.php
index 69f1d64f..ed230272 100644
--- a/ext/numeric_score/test.php
+++ b/ext/numeric_score/test.php
@@ -54,4 +54,4 @@ class NumericScoreTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/numeric_score/theme.php b/ext/numeric_score/theme.php
index e805c929..e089bc74 100644
--- a/ext/numeric_score/theme.php
+++ b/ext/numeric_score/theme.php
@@ -89,4 +89,4 @@ class NumericScoreTheme extends Themelet {
}
}
-?>
+
diff --git a/ext/oekaki/main.php b/ext/oekaki/main.php
index 6c114537..b9081fe1 100644
--- a/ext/oekaki/main.php
+++ b/ext/oekaki/main.php
@@ -87,4 +87,4 @@ class Oekaki extends Extension {
}
}
}
-?>
+
diff --git a/ext/oekaki/test.php b/ext/oekaki/test.php
index f4257590..07ca4ec3 100644
--- a/ext/oekaki/test.php
+++ b/ext/oekaki/test.php
@@ -6,4 +6,4 @@ class OekakiTest extends SCoreWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/oekaki/theme.php b/ext/oekaki/theme.php
index 468c0bdb..8a0ee9b9 100644
--- a/ext/oekaki/theme.php
+++ b/ext/oekaki/theme.php
@@ -61,4 +61,4 @@ class OekakiTheme extends Themelet {
, "left", 21)); // upload is 20
}
}
-?>
+
diff --git a/ext/ouroboros_api/main.php b/ext/ouroboros_api/main.php
index fa9ef5da..c223690c 100644
--- a/ext/ouroboros_api/main.php
+++ b/ext/ouroboros_api/main.php
@@ -573,12 +573,17 @@ class OuroborosAPI extends Extension
protected function postShow($id = null)
{
if (!is_null($id)) {
- $post = new _SafeOuroborosImage(Image::by_id($id));
- $this->sendData('post', $post);
- } else {
- $this->sendResponse(424, 'ID is mandatory');
- }
- }
+ $image = Image::by_id($id);
+ if ( ! $image instanceof Image) {
+ $this->sendResponse(404, 'ID not found');
+ } else {
+ $post = new _SafeOuroborosImage($image);
+ $this->sendData('post', $post);
+ }
+ } else {
+ $this->sendResponse(424, 'ID is mandatory');
+ }
+ }
/**
* Wrapper for getting a list of posts
diff --git a/ext/pm/main.php b/ext/pm/main.php
index 9cd781e7..2deaf4e4 100644
--- a/ext/pm/main.php
+++ b/ext/pm/main.php
@@ -210,4 +210,4 @@ class PrivMsg extends Extension {
return $count;
}
}
-?>
+
diff --git a/ext/pm/test.php b/ext/pm/test.php
index 0717433a..f08a0274 100644
--- a/ext/pm/test.php
+++ b/ext/pm/test.php
@@ -50,4 +50,4 @@ class PrivMsgTest extends SCoreWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/pm/theme.php b/ext/pm/theme.php
index 7b0f5be1..79001617 100644
--- a/ext/pm/theme.php
+++ b/ext/pm/theme.php
@@ -70,4 +70,4 @@ EOD;
$page->add_block(new Block("Message from {$from->name}", format_text($pm->message), "main", 10));
}
}
-?>
+
diff --git a/ext/pm_triggers/main.php b/ext/pm_triggers/main.php
index a09454a1..7cb80013 100644
--- a/ext/pm_triggers/main.php
+++ b/ext/pm_triggers/main.php
@@ -26,4 +26,4 @@ class PMTrigger extends Extension {
)));
}
}
-?>
+
diff --git a/ext/pools/main.php b/ext/pools/main.php
index 965fb98e..40270a0b 100644
--- a/ext/pools/main.php
+++ b/ext/pools/main.php
@@ -881,4 +881,4 @@ class Pools extends Extension {
}
}
-?>
+
diff --git a/ext/pools/script.js b/ext/pools/script.js
index 505718a9..c5e91d4e 100644
--- a/ext/pools/script.js
+++ b/ext/pools/script.js
@@ -1,3 +1,5 @@
+/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
+
$(function() {
var order_pool = $.cookie("shm_ui-order-pool") || "created";
$("#order_pool option[value="+order_pool+"]").attr("selected", true);
diff --git a/ext/pools/test.php b/ext/pools/test.php
index ea8015c3..8a59dce9 100644
--- a/ext/pools/test.php
+++ b/ext/pools/test.php
@@ -38,4 +38,4 @@ class PoolsTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/pools/theme.php b/ext/pools/theme.php
index fd25d431..c8cc4e02 100644
--- a/ext/pools/theme.php
+++ b/ext/pools/theme.php
@@ -423,4 +423,4 @@ class PoolsTheme extends Themelet {
$this->display_paginator($page, "pool/updated", null, $pageNumber, $totalPages);
}
}
-?>
+
diff --git a/ext/qr_code/main.php b/ext/qr_code/main.php
index ed671fd3..4fe864d8 100644
--- a/ext/qr_code/main.php
+++ b/ext/qr_code/main.php
@@ -12,4 +12,4 @@ class QRImage extends Extension {
$this->theme->links_block(make_http(make_link('image/'.$event->image->id.'.jpg')));
}
}
-?>
+
diff --git a/ext/qr_code/theme.php b/ext/qr_code/theme.php
index 8f6103de..3e82351d 100644
--- a/ext/qr_code/theme.php
+++ b/ext/qr_code/theme.php
@@ -6,4 +6,4 @@ class QRImageTheme extends Themelet {
"QR Code","
","left",50));
}
}
-?>
+
diff --git a/ext/random_image/main.php b/ext/random_image/main.php
index 0d799855..1d2d194a 100644
--- a/ext/random_image/main.php
+++ b/ext/random_image/main.php
@@ -76,4 +76,4 @@ class RandomImage extends Extension {
}
}
}
-?>
+
diff --git a/ext/random_image/test.php b/ext/random_image/test.php
index 4d30c0e1..f11c83ef 100644
--- a/ext/random_image/test.php
+++ b/ext/random_image/test.php
@@ -55,4 +55,4 @@ class RandomTest extends ShimmieWebTestCase {
$this->assert_no_text("Random Image");
}
}
-?>
+
diff --git a/ext/random_image/theme.php b/ext/random_image/theme.php
index 87806bec..1210959e 100644
--- a/ext/random_image/theme.php
+++ b/ext/random_image/theme.php
@@ -24,4 +24,4 @@ class RandomImageTheme extends Themelet {
";
}
}
-?>
+
diff --git a/ext/random_list/main.php b/ext/random_list/main.php
index c9671309..609766fb 100644
--- a/ext/random_list/main.php
+++ b/ext/random_list/main.php
@@ -51,4 +51,4 @@ class RandomList extends Extension {
$event->panel->add_block($sb);
}
}
-?>
+
diff --git a/ext/rating/main.php b/ext/rating/main.php
index eda01145..c9f3c8aa 100644
--- a/ext/rating/main.php
+++ b/ext/rating/main.php
@@ -235,4 +235,4 @@ class Ratings extends Extension {
}
}
}
-?>
+
diff --git a/ext/rating/test.php b/ext/rating/test.php
index ac092c2f..81d02dfc 100644
--- a/ext/rating/test.php
+++ b/ext/rating/test.php
@@ -52,4 +52,4 @@ class RatingTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/rating/theme.php b/ext/rating/theme.php
index 3e9437a6..4fde8274 100644
--- a/ext/rating/theme.php
+++ b/ext/rating/theme.php
@@ -45,4 +45,4 @@ class RatingsTheme extends Themelet {
}
}
-?>
+
diff --git a/ext/regen_thumb/main.php b/ext/regen_thumb/main.php
index b417e539..4c12f0c4 100644
--- a/ext/regen_thumb/main.php
+++ b/ext/regen_thumb/main.php
@@ -31,4 +31,4 @@ class RegenThumb extends Extension {
}
}
}
-?>
+
diff --git a/ext/regen_thumb/test.php b/ext/regen_thumb/test.php
index cb2139f6..e2b5dc63 100644
--- a/ext/regen_thumb/test.php
+++ b/ext/regen_thumb/test.php
@@ -12,4 +12,4 @@ class RegenThumbTest extends ShimmieWebTestCase {
# FIXME: test that the thumb's modified time has been updated
}
}
-?>
+
diff --git a/ext/regen_thumb/theme.php b/ext/regen_thumb/theme.php
index 6f5720a7..68d7904c 100644
--- a/ext/regen_thumb/theme.php
+++ b/ext/regen_thumb/theme.php
@@ -24,4 +24,4 @@ class RegenThumbTheme extends Themelet {
$page->add_block(new Block("Thumbnail", $this->build_thumb_html($image)));
}
}
-?>
+
diff --git a/ext/relatationships/main.php b/ext/relatationships/main.php
index b1be3c36..846687a1 100644
--- a/ext/relatationships/main.php
+++ b/ext/relatationships/main.php
@@ -120,4 +120,4 @@ class Relationships extends Extension {
}
}
}
-?>
+
diff --git a/ext/relatationships/theme.php b/ext/relatationships/theme.php
index b40c6289..a73e2293 100644
--- a/ext/relatationships/theme.php
+++ b/ext/relatationships/theme.php
@@ -42,4 +42,4 @@ class RelationshipsTheme extends Themelet {
return $html;
}
}
-?>
+
diff --git a/ext/report_image/main.php b/ext/report_image/main.php
index a21a0581..b99f7030 100644
--- a/ext/report_image/main.php
+++ b/ext/report_image/main.php
@@ -181,4 +181,4 @@ class ReportImage extends Extension {
// * Version 0.2b - 10/27/07 - Now supports Shimmie2 RC2!
// * Version 0.2a - 10/24/07 - Fixed some SQL issues. I will make sure to test before commiting :)
// * Version 0.2 - 10/24/07 - First public release.
-?>
+
diff --git a/ext/report_image/test.php b/ext/report_image/test.php
index cb1339db..65b89aef 100644
--- a/ext/report_image/test.php
+++ b/ext/report_image/test.php
@@ -37,4 +37,4 @@ class ReportImageTest extends ShimmieWebTestCase {
# FIXME: test that >>123 works
}
}
-?>
+
diff --git a/ext/report_image/theme.php b/ext/report_image/theme.php
index b62fd02a..35aca30f 100644
--- a/ext/report_image/theme.php
+++ b/ext/report_image/theme.php
@@ -78,4 +78,4 @@ class ReportImageTheme extends Themelet {
$page->add_block(new Block("Report Image", $html, "left"));
}
}
-?>
+
diff --git a/ext/res_limit/main.php b/ext/res_limit/main.php
index c17ad203..34b0f90d 100644
--- a/ext/res_limit/main.php
+++ b/ext/res_limit/main.php
@@ -70,4 +70,4 @@ class ResolutionLimit extends Extension {
$event->panel->add_block($sb);
}
}
-?>
+
diff --git a/ext/res_limit/test.php b/ext/res_limit/test.php
index 2707923a..9d66d3ce 100644
--- a/ext/res_limit/test.php
+++ b/ext/res_limit/test.php
@@ -110,4 +110,4 @@ class ResLimitTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/resize/main.php b/ext/resize/main.php
index 705980eb..72b29231 100644
--- a/ext/resize/main.php
+++ b/ext/resize/main.php
@@ -59,7 +59,8 @@ class ResizeImage extends Extension {
}
public function onDataUpload(DataUploadEvent $event) {
- global $config;
+ global $config, $page;
+
$image_obj = Image::by_id($event->image_id);
if($config->get_bool("resize_upload") == true && ($image_obj->ext == "jpg" || $image_obj->ext == "png" || $image_obj->ext == "gif")){
@@ -312,4 +313,4 @@ class ResizeImage extends Extension {
log_info("resize", "Resized Image #{$image_obj->id} - New hash: {$new_hash}");
}
}
-?>
+
diff --git a/ext/resize/theme.php b/ext/resize/theme.php
index e19a8e32..3d09e1f0 100644
--- a/ext/resize/theme.php
+++ b/ext/resize/theme.php
@@ -35,4 +35,4 @@ class ResizeImageTheme extends Themelet {
$page->add_block(new Block($title, $message));
}
}
-?>
+
diff --git a/ext/rotate/main.php b/ext/rotate/main.php
index cde59505..5e1c8af8 100644
--- a/ext/rotate/main.php
+++ b/ext/rotate/main.php
@@ -231,4 +231,4 @@ class RotateImage extends Extension {
log_info("rotate", "Rotated Image #{$image_id} - New hash: {$new_hash}");
}
}
-?>
+
diff --git a/ext/rotate/theme.php b/ext/rotate/theme.php
index ddef58c7..c6481469 100644
--- a/ext/rotate/theme.php
+++ b/ext/rotate/theme.php
@@ -25,4 +25,4 @@ class RotateImageTheme extends Themelet {
$page->add_block(new Block($title, $message));
}
}
-?>
+
diff --git a/ext/rss_comments/main.php b/ext/rss_comments/main.php
index a141cc39..7ae90be5 100644
--- a/ext/rss_comments/main.php
+++ b/ext/rss_comments/main.php
@@ -75,4 +75,4 @@ EOD;
}
}
}
-?>
+
diff --git a/ext/rss_comments/test.php b/ext/rss_comments/test.php
index e6062c29..1036c177 100644
--- a/ext/rss_comments/test.php
+++ b/ext/rss_comments/test.php
@@ -19,4 +19,4 @@ class RSSCommentsTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/rss_images/main.php b/ext/rss_images/main.php
index f9d4b330..cef02075 100644
--- a/ext/rss_images/main.php
+++ b/ext/rss_images/main.php
@@ -112,4 +112,4 @@ class RSS_Images extends Extension {
return $data;
}
}
-?>
+
diff --git a/ext/rss_images/test.php b/ext/rss_images/test.php
index 9447ecc6..4322b308 100644
--- a/ext/rss_images/test.php
+++ b/ext/rss_images/test.php
@@ -33,4 +33,4 @@ class RSSImagesTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/rss_images/theme.php b/ext/rss_images/theme.php
index d1f2734f..ef4ac101 100644
--- a/ext/rss_images/theme.php
+++ b/ext/rss_images/theme.php
@@ -1,4 +1,4 @@
+
diff --git a/ext/setup/main.php b/ext/setup/main.php
index d6c0cd45..f34e0d4d 100644
--- a/ext/setup/main.php
+++ b/ext/setup/main.php
@@ -306,4 +306,4 @@ class Setup extends Extension {
}
}
}
-?>
+
diff --git a/ext/setup/test.php b/ext/setup/test.php
index c990f2ee..6114b030 100644
--- a/ext/setup/test.php
+++ b/ext/setup/test.php
@@ -28,4 +28,4 @@ class SetupTest extends SCoreWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/setup/theme.php b/ext/setup/theme.php
index 3bad7007..99fa314a 100644
--- a/ext/setup/theme.php
+++ b/ext/setup/theme.php
@@ -96,4 +96,4 @@ class SetupTheme extends Themelet {
return $html;
}
}
-?>
+
diff --git a/ext/shimmie_api/main.php b/ext/shimmie_api/main.php
index da65a2d6..0ea29ead 100644
--- a/ext/shimmie_api/main.php
+++ b/ext/shimmie_api/main.php
@@ -21,6 +21,17 @@
class _SafeImage {
#{"id":"2","height":"768","width":"1024","hash":"71cdfaabbcdad3f777e0b60418532e94","filesize":"439561","filename":"HeilAmu.png","ext":"png","owner_ip":"0.0.0.0","posted":"0000-00-00 00:00:00","source":null,"locked":"N","owner_id":"0","rating":"u","numeric_score":"0","text_score":"0","notes":"0","favorites":"0","posted_timestamp":-62169955200,"tag_array":["cat","kunimitsu"]}
+ public $id;
+ public $height;
+ public $width;
+ public $hash;
+ public $filesize;
+ public $ext;
+ public $posted;
+ public $source;
+ public $owner_id;
+ public $tags;
+
function __construct(Image $img) {
$this->id = $img->id;
$this->height = $img->height;
@@ -146,4 +157,4 @@ class ShimmieApi extends Extension {
}
}
}
-?>
+
diff --git a/ext/shimmie_api/test.php b/ext/shimmie_api/test.php
index 961afa0a..c8dfa91c 100644
--- a/ext/shimmie_api/test.php
+++ b/ext/shimmie_api/test.php
@@ -26,4 +26,4 @@ class ShimmieApiTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/simpletest/main.php b/ext/simpletest/main.php
index 523204cb..2ff0abf0 100644
--- a/ext/simpletest/main.php
+++ b/ext/simpletest/main.php
@@ -91,6 +91,7 @@ define('ADMIN_PASS', "demo");
* A set of common SCore activities to test
*/
class SCoreWebTestCase extends WebTestCase {
+
/**
* Click on a link or a button
*/
@@ -257,4 +258,4 @@ class SimpleSCoreTest extends Extension {
}
}
}
-?>
+
diff --git a/ext/simpletest/theme.php b/ext/simpletest/theme.php
index 4ed982d9..44d22a8c 100644
--- a/ext/simpletest/theme.php
+++ b/ext/simpletest/theme.php
@@ -84,4 +84,4 @@ class SCoreWebReporter extends HtmlReporter {
/** @private */
class SCoreCLIReporter extends TextReporter {
}
-?>
+
diff --git a/ext/site_description/main.php b/ext/site_description/main.php
index 9adaa5d3..80563617 100644
--- a/ext/site_description/main.php
+++ b/ext/site_description/main.php
@@ -30,4 +30,4 @@ class SiteDescription extends Extension {
$event->panel->add_block($sb);
}
}
-?>
+
diff --git a/ext/site_description/test.php b/ext/site_description/test.php
index ee27e2fc..293c6a1a 100644
--- a/ext/site_description/test.php
+++ b/ext/site_description/test.php
@@ -15,4 +15,4 @@ class SiteDescriptionTest extends SCoreWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/sitemap/main.php b/ext/sitemap/main.php
index 056d07fe..7172dc21 100644
--- a/ext/sitemap/main.php
+++ b/ext/sitemap/main.php
@@ -164,4 +164,4 @@ class XMLSitemap extends Extension {
$page->set_data($xml);
}
}
-?>
+
diff --git a/ext/sitemap/test.php b/ext/sitemap/test.php
index 0d420888..fa459d9b 100644
--- a/ext/sitemap/test.php
+++ b/ext/sitemap/test.php
@@ -6,4 +6,4 @@ class XMLSitemapTest extends ShimmieWebTestCase {
$this->get_page('sitemap.xml');
}
}
-?>
+
diff --git a/ext/source_history/main.php b/ext/source_history/main.php
index 366ea7cf..a9eab563 100644
--- a/ext/source_history/main.php
+++ b/ext/source_history/main.php
@@ -140,13 +140,20 @@ class Source_History extends Extension {
}
// lets get the values out of the result
- $stored_result_id = $result['id'];
+ //$stored_result_id = $result['id'];
$stored_image_id = $result['image_id'];
$stored_source = $result['source'];
log_debug("source_history", 'Reverting source of Image #'.$stored_image_id.' to ['.$stored_source.']');
+
+ $image = Image::by_id($stored_image_id);
+
+ if (is_null($image)) {
+ die('Error: No image with the id ('.$stored_image_id.') was found. Perhaps the image was deleted while processing this request.');
+ }
+
// all should be ok so we can revert by firing the SetUserSources event.
- send_event(new SourceSetEvent(Image::by_id($stored_image_id), $stored_source));
+ send_event(new SourceSetEvent($image, $stored_source));
// all should be done now so redirect the user back to the image
$page->set_mode("redirect");
@@ -309,8 +316,15 @@ class Source_History extends Extension {
$stored_source = $result['source'];
log_debug("source_history", 'Reverting source of Image #'.$stored_image_id.' to ['.$stored_source.']');
+
+ $image = Image::by_id($stored_image_id);
+
+ if (is_null($image)) {
+ die('Error: No image with the id ('.$stored_image_id.') was found. Perhaps the image was deleted while processing this request.');
+ }
+
// all should be ok so we can revert by firing the SetSources event.
- send_event(new SourceSetEvent(Image::by_id($stored_image_id), $stored_source));
+ send_event(new SourceSetEvent($image, $stored_source));
$this->theme->add_status('Reverted Change','Reverted Image #'.$image_id.' to Source History #'.$stored_result_id.' ('.$row['source'].')');
}
}
@@ -373,4 +387,4 @@ class Source_History extends Extension {
}
}
}
-?>
+
diff --git a/ext/source_history/theme.php b/ext/source_history/theme.php
index 29bcc019..4399c300 100644
--- a/ext/source_history/theme.php
+++ b/ext/source_history/theme.php
@@ -134,4 +134,4 @@ class Source_HistoryTheme extends Themelet {
$this->messages[] = ''. $title .'
'. $body .'
';
}
}
-?>
+
diff --git a/ext/tag_categories/main.php b/ext/tag_categories/main.php
index 80f62e88..4e0fbdda 100644
--- a/ext/tag_categories/main.php
+++ b/ext/tag_categories/main.php
@@ -146,4 +146,4 @@ class TagCategories extends Extension {
}
}
-?>
+
diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php
index eb58efe3..8161af83 100644
--- a/ext/tag_edit/main.php
+++ b/ext/tag_edit/main.php
@@ -320,4 +320,4 @@ class TagEdit extends Extension {
}
}
}
-?>
+
diff --git a/ext/tag_edit/test.php b/ext/tag_edit/test.php
index a88bfc37..89541830 100644
--- a/ext/tag_edit/test.php
+++ b/ext/tag_edit/test.php
@@ -68,4 +68,4 @@ class TagEditTest extends ShimmieWebTestCase {
}
*/
}
-?>
+
diff --git a/ext/tag_edit/theme.php b/ext/tag_edit/theme.php
index 4cd67bae..4e1650cc 100644
--- a/ext/tag_edit/theme.php
+++ b/ext/tag_edit/theme.php
@@ -134,4 +134,4 @@ class TagEditTheme extends Themelet {
";
}
}
-?>
+
diff --git a/ext/tag_editcloud/main.php b/ext/tag_editcloud/main.php
index d74e061e..d1cd2bd2 100644
--- a/ext/tag_editcloud/main.php
+++ b/ext/tag_editcloud/main.php
@@ -156,4 +156,4 @@ class TagEditCloud extends Extension {
return ($user->can("edit_image_tag") && (!$image->is_locked() || $user->can("edit_image_lock")));
}
}
-?>
+
diff --git a/ext/tag_editcloud/script.js b/ext/tag_editcloud/script.js
index b71818c4..71a9c287 100644
--- a/ext/tag_editcloud/script.js
+++ b/ext/tag_editcloud/script.js
@@ -1,3 +1,5 @@
+/*jshint bitwise:true, curly:true, eqeqeq: false, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
+
Array.prototype.editcloud_contains = function (ele) {
for (var i = 0; i < this.length; i++) {
if (this[i] == ele) {
@@ -7,7 +9,7 @@ Array.prototype.editcloud_contains = function (ele) {
return false;
};
Array.prototype.editcloud_remove = function (ele) {
- var arr = new Array();
+ var arr = [];
var count = 0;
for (var i = 0; i < this.length; i++) {
if (this[i] != ele) {
@@ -25,8 +27,8 @@ function tageditcloud_toggle_extra(hide) {
}
var el = document.getElementById('tagcloud_extra');
- el.style.display = (el.style.display != 'none' ? 'none' : '' );
- hide.innerHTML = (el.style.display != 'none' ? 'show fewer tags' : hide_text );
+ el.style.display = (el.style.display !== 'none' ? 'none' : '' );
+ hide.innerHTML = (el.style.display !== 'none' ? 'show fewer tags' : hide_text );
}
function tageditcloud_toggle_tag(ele,fullTag) {
@@ -42,5 +44,5 @@ function tageditcloud_toggle_tag(ele,fullTag) {
}
taglist.value = tags.join(' ');
- document.getElementById('tags').focus();
+ document.getElementById('tag_editor').focus();
}
diff --git a/ext/tag_history/main.php b/ext/tag_history/main.php
index b6e6605c..e3c60131 100644
--- a/ext/tag_history/main.php
+++ b/ext/tag_history/main.php
@@ -143,10 +143,15 @@ class Tag_History extends Extension {
$stored_result_id = $result['id'];
$stored_image_id = int_escape($result['image_id']);
$stored_tags = $result['tags'];
-
+
+ $image = Image::by_id($stored_image_id);
+ if ( ! $image instanceof Image) {
+ throw new ImageDoesNotExist("Error: cannot find any image with the ID = ". $stored_image_id);
+ }
+
log_debug("tag_history", 'Reverting tags of Image #'.$stored_image_id.' to ['.$stored_tags.']');
// all should be ok so we can revert by firing the SetUserTags event.
- send_event(new TagSetEvent(Image::by_id($stored_image_id), $stored_tags));
+ send_event(new TagSetEvent($image, $stored_tags));
// all should be done now so redirect the user back to the image
$page->set_mode("redirect");
@@ -307,10 +312,15 @@ class Tag_History extends Extension {
$stored_result_id = int_escape($result['id']);
$stored_image_id = int_escape($result['image_id']);
$stored_tags = $result['tags'];
-
+
+ $image = Image::by_id($stored_image_id);
+ if ( ! $image instanceof Image) {
+ throw new ImageDoesNotExist("Error: cannot find any image with the ID = ". $stored_image_id);
+ }
+
log_debug("tag_history", 'Reverting tags of Image #'.$stored_image_id.' to ['.$stored_tags.']');
// all should be ok so we can revert by firing the SetTags event.
- send_event(new TagSetEvent(Image::by_id($stored_image_id), $stored_tags));
+ send_event(new TagSetEvent($image, $stored_tags));
$this->theme->add_status('Reverted Change','Reverted Image #'.$image_id.' to Tag History #'.$stored_result_id.' ('.$row['tags'].')');
}
}
@@ -373,4 +383,4 @@ class Tag_History extends Extension {
}
}
}
-?>
+
diff --git a/ext/tag_history/test.php b/ext/tag_history/test.php
index 5ca06e44..ae8f2bdf 100644
--- a/ext/tag_history/test.php
+++ b/ext/tag_history/test.php
@@ -20,4 +20,4 @@ class TagHistoryTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/tag_history/theme.php b/ext/tag_history/theme.php
index 62efac5a..1f516d64 100644
--- a/ext/tag_history/theme.php
+++ b/ext/tag_history/theme.php
@@ -146,4 +146,4 @@ class Tag_HistoryTheme extends Themelet {
$this->messages[] = ''. $title .'
'. $body .'
';
}
}
-?>
+
diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php
index 3677c98a..53f748ea 100644
--- a/ext/tag_list/main.php
+++ b/ext/tag_list/main.php
@@ -492,4 +492,4 @@ class TagList extends Extension {
}
// }}}
}
-?>
+
diff --git a/ext/tag_list/test.php b/ext/tag_list/test.php
index fc574eab..6b50fc87 100644
--- a/ext/tag_list/test.php
+++ b/ext/tag_list/test.php
@@ -34,4 +34,4 @@ class TagListTest extends ShimmieWebTestCase {
}
}
}
-?>
+
diff --git a/ext/tag_list/theme.php b/ext/tag_list/theme.php
index 87866476..525330e2 100644
--- a/ext/tag_list/theme.php
+++ b/ext/tag_list/theme.php
@@ -272,4 +272,4 @@ class TagListTheme extends Themelet {
return make_link("post/list/$u_tag/1");
}
}
-?>
+
diff --git a/ext/tagger/main.php b/ext/tagger/main.php
index 4df81ee8..553a8fc6 100644
--- a/ext/tagger/main.php
+++ b/ext/tagger/main.php
@@ -139,4 +139,4 @@ class TaggerXML extends Extension {
"SELECT COUNT(*) FROM `tags` $query",$values)->fields['COUNT(*)'];
}
}
-?>
+
diff --git a/ext/tagger/script.js b/ext/tagger/script.js
index e01c8168..511a2684 100644
--- a/ext/tagger/script.js
+++ b/ext/tagger/script.js
@@ -1,9 +1,11 @@
+/*jshint forin:false, nonew:true, undef:true, strict:false, browser:true, jquery:true */
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* Tagger - Advanced Tagging v2 *
* Author: Artanis (Erik Youngren ) *
* Do not remove this notice. *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
+
var Tagger = {
initialize : function (image_id) {
// object navigation
@@ -25,7 +27,7 @@ var Tagger = {
this.tag.suggest = null;
this.tag.image_tags();
- // reveal
+ // reveal
this.editor.container.style.display = "";
// dragging
@@ -39,10 +41,10 @@ var Tagger = {
},
alert : function (type,text,timeout) {
- var id = "tagger_alert-"+type
+ var id = "tagger_alert-"+type;
var t_alert = byId(id);
if (t_alert) {
- if(text == false) {
+ if(text === false) {
// remove
t_alert.parentNode.removeChild(t_alert);
} else {
@@ -150,10 +152,10 @@ var Tagger = {
},
ajax : function (url, callback) {
- var http = (new XMLHttpRequest || new ActiveXObject("Microsoft.XMLHTTP"));
+ var http = (new XMLHttpRequest() || new ActiveXObject("Microsoft.XMLHTTP"));
http.open("GET",url,true);
http.onreadystatechange = function () {
- if(http.readyState == 4) callback(http);
+ if(http.readyState == 4) { callback(http); }
};
http.send(null);
}
@@ -162,22 +164,19 @@ var Tagger = {
position : {
set : function (x,y) {
if (!x || !y) {
- with(this.parent.editor.container.style) {
- top = "25px";
- left = "";
- right = "25px";
- bottom = "";
- }
+ this.parent.editor.container.style.top = "25px";
+ this.parent.editor.container.style.left = "";
+ this.parent.editor.container.style.right = "25px";
+ this.parent.editor.container.style.bottom = "";
+
var xy = this.get();
x = xy[0];
y = xy[1];
}
- with(this.parent.editor.container.style) {
- top = y+"px";
- left = x+"px";
- right = "";
- bottom = "";
- }
+ this.parent.editor.container.style.top = y+"px";
+ this.parent.editor.container.style.left = x+"px";
+ this.parent.editor.container.style.right = "";
+ this.parent.editor.container.style.bottom = "";
},
get : function () {
diff --git a/ext/tagger/theme.php b/ext/tagger/theme.php
index 733db116..27ac184a 100644
--- a/ext/tagger/theme.php
+++ b/ext/tagger/theme.php
@@ -11,10 +11,14 @@ class taggerTheme extends Themelet {
// Initialization code
$base_href = get_base_href();
// TODO: AJAX test and fallback.
+
$page->add_html_header("");
$page->add_block(new Block(null,
- "","main",1000));
+ "","main",1000));
// Tagger block
$page->add_block( new Block(
@@ -62,4 +66,4 @@ EOD;
return $html;
}
}
-?>
+
diff --git a/ext/tagger/webtoolkit.drag.js b/ext/tagger/webtoolkit.drag.js
index 3ba87507..68d48f4a 100644
--- a/ext/tagger/webtoolkit.drag.js
+++ b/ext/tagger/webtoolkit.drag.js
@@ -1,3 +1,5 @@
+/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
+
/**
*
* Crossbrowser Drag Handler
@@ -18,9 +20,9 @@ var DragHandler = {
oElem.onmousedown = DragHandler._dragBegin;
// callbacks
- oElem.dragBegin = new Function();
- oElem.drag = new Function();
- oElem.dragEnd = new Function();
+ oElem.dragBegin = function () {};
+ oElem.drag = function () {};
+ oElem.dragEnd = function () {};
return oElem;
},
@@ -82,4 +84,4 @@ var DragHandler = {
DragHandler._oElem = null;
}
-}
+};
diff --git a/ext/tips/main.php b/ext/tips/main.php
index d1c08929..94f8bf2f 100644
--- a/ext/tips/main.php
+++ b/ext/tips/main.php
@@ -137,9 +137,9 @@ class Tips extends Extension {
$tip = $database->get_row("SELECT * FROM tips WHERE id = ? ", array($tipID));
- if($tip['enable'] == "Y") {
+ if (bool_escape($tip['enable'])) {
$enable = "N";
- } elseif($tip['enable'] == "N") {
+ } else {
$enable = "Y";
}
@@ -151,4 +151,4 @@ class Tips extends Extension {
$database->execute("DELETE FROM tips WHERE id = ?", array($tipID));
}
}
-?>
+
diff --git a/ext/tips/test.php b/ext/tips/test.php
index 7e3998a6..6b5e6c1a 100644
--- a/ext/tips/test.php
+++ b/ext/tips/test.php
@@ -68,4 +68,4 @@ class TipsTest extends SCoreWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/tips/theme.php b/ext/tips/theme.php
index 2f4b84ba..2aa3ef51 100644
--- a/ext/tips/theme.php
+++ b/ext/tips/theme.php
@@ -92,4 +92,4 @@ class TipsTheme extends Themelet {
$page->add_block(new Block("All Tips", $html, "main", 20));
}
}
-?>
+
diff --git a/ext/twitter_soc/main.php b/ext/twitter_soc/main.php
index c81a2d6a..0242c7d4 100644
--- a/ext/twitter_soc/main.php
+++ b/ext/twitter_soc/main.php
@@ -21,4 +21,4 @@ class TwitterSoc extends Extension {
$event->panel->add_block($sb);
}
}
-?>
+
diff --git a/ext/twitter_soc/script.js b/ext/twitter_soc/script.js
index 06457f3a..62e316d0 100644
--- a/ext/twitter_soc/script.js
+++ b/ext/twitter_soc/script.js
@@ -1,3 +1,5 @@
+/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
+
// jquery.tweet.js - See http://tweet.seaofclouds.com/ or https://github.com/seaofclouds/tweet for more info
// Copyright (c) 2008-2011 Todd Matthews & Steve Purcell
(function($) {
@@ -27,7 +29,7 @@
twitter_search_url: "search.twitter.com", // [string] custom twitter search url, if any (apigee, etc.)
template: "{avatar}{time}{join}{text}", // [string or function] template used to construct each tweet - see code for available vars
comparator: function(tweet1, tweet2) { // [function] comparator used to sort tweets (see Array.sort)
- return tweet2["tweet_time"] - tweet1["tweet_time"];
+ return tweet2.tweet_time - tweet1.tweet_time;
},
filter: function(tweet) { // [function] whether or not to include a particular tweet (be sure to also set 'fetch')
return true;
@@ -46,7 +48,7 @@
result = result.replace(new RegExp('{'+key+'}','g'), val === null ? '' : val);
}
return result;
- } else return template(info);
+ } else { return template(info); }
}
// Export the t function for use when passing a function as the 'template' option
$.extend({tweet: {t: t}});
@@ -69,7 +71,7 @@
linkUser: replacer(/(^|[\W])@(\w+)/gi, "$1@$2"),
// Support various latin1 (\u00**) and arabic (\u06**) alphanumeric chars
linkHash: replacer(/(?:^| )[\#]+([\w\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0600-\u06ff]+)/gi,
- ' #$1'),
+ ' #$1'),
capAwesome: replacer(/\b(awesome)\b/gi, '$1'),
capEpic: replacer(/\b(epic)\b/gi, '$1'),
makeHeart: replacer(/(<)+[3]/gi, "♥")
@@ -81,7 +83,7 @@
var text = match;
for(var i = 0; i < entities.length; ++i) {
var entity = entities[i];
- if (entity.url == url && entity.expanded_url) {
+ if (entity.url === url && entity.expanded_url) {
url = entity.expanded_url;
text = entity.display_url;
break;
@@ -137,14 +139,14 @@
}
function build_api_url() {
- var proto = ('https:' == document.location.protocol ? 'https:' : 'http:');
+ var proto = ('https:' === document.location.protocol ? 'https:' : 'http:');
var count = (s.fetch === null) ? s.count : s.fetch;
var common_params = '&include_entities=1&callback=?';
if (s.list) {
return proto+"//"+s.twitter_api_url+"/1/"+s.username[0]+"/lists/"+s.list+"/statuses.json?page="+s.page+"&per_page="+count+common_params;
} else if (s.favorites) {
return proto+"//"+s.twitter_api_url+"/favorites/"+s.username[0]+".json?page="+s.page+"&count="+count+common_params;
- } else if (s.query === null && s.username.length == 1) {
+ } else if (s.query === null && s.username.length === 1) {
return proto+'//'+s.twitter_api_url+'/1/statuses/user_timeline.json?screen_name='+s.username[0]+'&count='+count+(s.retweets ? '&include_rts=1' : '')+'&page='+s.page+common_params;
} else {
var query = (s.query || 'from:'+s.username.join(' OR from:'));
@@ -172,9 +174,9 @@
o.screen_name = item.from_user || item.user.screen_name;
o.avatar_size = s.avatar_size;
o.avatar_url = extract_avatar_url(item, (document.location.protocol === 'https:'));
- o.retweet = typeof(item.retweeted_status) != 'undefined';
+ o.retweet = typeof(item.retweeted_status) !== 'undefined';
o.tweet_time = parse_date(item.created_at);
- o.join_text = s.join_text == "auto" ? build_auto_join_text(item.text) : s.join_text;
+ o.join_text = s.join_text === "auto" ? build_auto_join_text(item.text) : s.join_text;
o.tweet_id = item.id_str;
o.twitter_base = "http://"+s.twitter_url+"/";
o.user_url = o.twitter_base+o.screen_name;
@@ -213,10 +215,10 @@
}
$(widget).bind("tweet:load", function(){
- if (s.loading_text) $(widget).empty().append(loading);
+ if (s.loading_text) { $(widget).empty().append(loading); }
$.getJSON(build_api_url(), function(data){
$(widget).empty().append(list);
- if (s.intro_text) list.before(intro);
+ if (s.intro_text) { list.before(intro); }
list.empty();
var tweets = $.map(data.results || data, extract_template_data);
@@ -226,7 +228,7 @@
children('li:odd').addClass('tweet_even').end().
children('li:even').addClass('tweet_odd');
- if (s.outro_text) list.after(outro);
+ if (s.outro_text) { list.after(outro); }
$(widget).trigger("loaded").trigger((tweets.length === 0 ? "empty" : "full"));
if (s.refresh_interval) {
window.setTimeout(function() { $(widget).trigger("tweet:load"); }, 1000 * s.refresh_interval);
diff --git a/ext/twitter_soc/test.php b/ext/twitter_soc/test.php
index 438e530b..cbc700de 100644
--- a/ext/twitter_soc/test.php
+++ b/ext/twitter_soc/test.php
@@ -26,4 +26,4 @@ class TwitterSocTest extends SCoreWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/twitter_soc/theme.php b/ext/twitter_soc/theme.php
index efbf7959..c8685f4b 100644
--- a/ext/twitter_soc/theme.php
+++ b/ext/twitter_soc/theme.php
@@ -22,4 +22,4 @@ $(function() {
', "left", 25));
}
}
-?>
+
diff --git a/ext/update/main.php b/ext/update/main.php
index 6cd29b26..8804e787 100644
--- a/ext/update/main.php
+++ b/ext/update/main.php
@@ -109,4 +109,4 @@ class Update extends Extension {
}
}
-?>
+
diff --git a/ext/update/script.js b/ext/update/script.js
index dea04c24..c2719786 100644
--- a/ext/update/script.js
+++ b/ext/update/script.js
@@ -1,3 +1,5 @@
+/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
+
$(function() {
if($('#updatecheck').length !== 0){
$.getJSON('https://api.github.com/repos/shish/shimmie2/commits', function(data){
diff --git a/ext/update/theme.php b/ext/update/theme.php
index 4823e0c6..e3dffb6a 100644
--- a/ext/update/theme.php
+++ b/ext/update/theme.php
@@ -11,4 +11,4 @@ class UpdateTheme extends Themelet {
$page->add_block(new Block("Software Update", $html, "main", 75));
}
}
-?>
+
diff --git a/ext/upgrade/main.php b/ext/upgrade/main.php
index d7967754..477452cb 100644
--- a/ext/upgrade/main.php
+++ b/ext/upgrade/main.php
@@ -95,4 +95,4 @@ class Upgrade extends Extension {
public function get_priority() {return 5;}
}
-?>
+
diff --git a/ext/upload/bookmarklet.js b/ext/upload/bookmarklet.js
index 0c4dda31..26b4766c 100644
--- a/ext/upload/bookmarklet.js
+++ b/ext/upload/bookmarklet.js
@@ -1,3 +1,5 @@
+/*jshint bitwise:true, curly:true, devel:true, forin:false, noarg:true, undef:true, strict:false, browser:true, jquery:true */
+
/* Imageboard to Shimmie */
// This should work with "most" sites running Danbooru/Gelbooru/Shimmie
// maxsize, supext, CA are set inside the bookmarklet (see theme.php)
@@ -7,10 +9,7 @@ var toobig = "The file you are trying to upload is too big to upload!";
var notsup = "The file you are trying to upload is not supported!";
if(CA === 0 || CA > 2) { // Default
- if(confirm("Keep existing tags?\n(Cancel will prompt for new tags)")) {
- // Do nothing
- }
- else {
+ if (confirm("Keep existing tags?\n(Cancel will prompt for new tags)") === false) {
var tag = prompt("Enter Tags", "");
var chk = 1; // This makes sure it doesn't use current tags.
}
@@ -39,14 +38,14 @@ if(document.getElementById("post_tag_string") !== null) {
var source = "http://" + document.location.hostname + document.location.href.match("\/posts\/[0-9]+");
var rlist = $('[name="post[rating]"]');
- for(x=0;x<3;x++){
- var rating = (rlist[x].checked == true ? rlist[x].value : rating);
+ for( var x=0; x < 3; x++){
+ var rating = (rlist[x].checked === true ? rlist[x].value : rating);
}
var fileinfo = $('#sidebar > section:eq(3) > ul > :contains("Size") > a');
var furl = "http://" + document.location.hostname + fileinfo.attr('href');
var fs = fileinfo.text().split(" ");
- var filesize = (fs[1] == "MB" ? fs[0] * 1024 : fs[0]);
+ var filesize = (fs[1] === "MB" ? fs[0] * 1024 : fs[0]);
if(supext.search(furl.match("[a-zA-Z0-9]+$")[0]) !== -1){
if(filesize <= maxsize){
@@ -84,12 +83,12 @@ else if(document.getElementById('tag-sidebar') !== null) {
}else if(source.search("gelbooru\\.com") >= 0){
var fileinfo = document.getElementById('pfd').parentNode.parentNode.getElementsByTagName('a')[0];
//gelbooru has no easy way to select the original image link, so we need to double check it is the correct link.
- fileinfo = (fileinfo.getAttribute('href') == "#" ? document.getElementById('pfd').parentNode.parentNode.getElementsByTagName('a')[1] : fileinfo);
+ fileinfo = (fileinfo.getAttribute('href') === "#" ? document.getElementById('pfd').parentNode.parentNode.getElementsByTagName('a')[1] : fileinfo);
}
fileinfo = fileinfo || document.getElementsByTagName('embed')[0]; //If fileinfo is null then image is most likely flash.
var furl = fileinfo.href || fileinfo.src;
var fs = (fileinfo.innerText.match(/[0-9]+ (KB|MB)/) || ["0 KB"])[0].split(" ");
- var filesize = (fs[1] == "MB" ? fs[0] * 1024 : fs[0]);
+ var filesize = (fs[1] === "MB" ? fs[0] * 1024 : fs[0]);
if(supext.search(furl.match("[a-zA-Z0-9]+$")[0]) !== -1){
if(filesize <= maxsize){
@@ -116,8 +115,8 @@ else if(document.getElementById('tag-sidebar') !== null) {
* This crazy way of checking "should" work with older releases though
* (Seems to work with 2009~ ver)
*/
-else if(document.getElementsByTagName("title")[0].innerHTML.search("Image [0-9.-]+\: ") == 0) {
- if(typeof tag !=="ftp://ftp." && chk !==1) {
+else if(document.getElementsByTagName("title")[0].innerHTML.search("Image [0-9.-]+\: ") === 0) {
+ if(typeof tag !== "ftp://ftp." && chk !==1) {
var tag = document.getElementsByTagName("title")[0].innerHTML.match("Image [0-9.-]+\: (.*)")[1];
}
@@ -126,7 +125,7 @@ else if(document.getElementsByTagName("title")[0].innerHTML.search("Image [0-9.-
// TODO: Make file size show on all themes
// (Only seems to show in lite/Danbooru themes.)
- if(tag.search(/\bflash\b/) == -1) {
+ if(tag.search(/\bflash\b/) === -1) {
var img = document.getElementById("main_image").src;
if(supext.search(img.match(".*\\.([a-z0-9]+)")[1]) !== -1) {
location.href = ste+img+"&tags="+tag+"&source="+source;
diff --git a/ext/upload/main.php b/ext/upload/main.php
index e0a2c9b8..028c2857 100644
--- a/ext/upload/main.php
+++ b/ext/upload/main.php
@@ -15,9 +15,9 @@ class DataUploadEvent extends Event {
/**
* Some data is being uploaded.
* This should be caught by a file handler.
- * @param $user The user uploading the data.
- * @param $tmpname The temporary file used for upload.
- * @param $metadata Info about the file, should contain at least "filename", "extension", "tags" and "source".
+ * -- Removed: param $user The user uploading the data.
+ * @param $tmpname string The temporary file used for upload.
+ * @param $metadata array Info about the file, should contain at least "filename", "extension", "tags" and "source".
*/
public function __construct(/*string*/ $tmpname, /*array*/ $metadata) {
assert(file_exists($tmpname));
@@ -42,6 +42,9 @@ class UploadException extends SCoreException {}
* This also includes transloaded files as well.
*/
class Upload extends Extension {
+
+ public $is_full;
+
// early, so it can stop the DataUploadEvent before any data handlers see it
public function get_priority() {return 40;}
@@ -59,7 +62,6 @@ class Upload extends Extension {
else {
$this->is_full = $free_num < MIN_FREE_SPACE;
}
-
}
public function onPostListBuilding(PostListBuildingEvent $event) {
@@ -235,8 +237,8 @@ class Upload extends Extension {
*
* TODO: Make these messages user/admin editable
*
- * @param $error_code PHP error code (int)
- * @retval String
+ * @param $error_code integer PHP error code
+ * @return String
*/
private function upload_error_message($error_code) {
switch ($error_code) {
@@ -258,10 +260,14 @@ class Upload extends Extension {
return 'Unknown upload error';
}
}
-
+
/**
* Handle an upload.
- * @retval bool TRUE on upload successful.
+ * @param $file
+ * @param $tags
+ * @param $source
+ * @param string $replace
+ * @return bool TRUE on upload successful.
*/
private function try_upload($file, $tags, $source, $replace='') {
global $page, $config, $user;
@@ -310,7 +316,11 @@ class Upload extends Extension {
/**
* Handle an transload.
- * @retval bool TRUE on transload successful.
+ * @param $url
+ * @param $tags
+ * @param $source
+ * @param string $replace
+ * @return bool TRUE on transload successful.
*/
private function try_transload($url, $tags, $source, $replace='') {
global $page, $config, $user;
@@ -388,4 +398,4 @@ class Upload extends Extension {
}
// }}}
}
-?>
+
diff --git a/ext/upload/test.php b/ext/upload/test.php
index 7a9c1281..7eb0b08d 100644
--- a/ext/upload/test.php
+++ b/ext/upload/test.php
@@ -39,4 +39,4 @@ class UploadTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/upload/theme.php b/ext/upload/theme.php
index 464d8ee9..e1c9692d 100644
--- a/ext/upload/theme.php
+++ b/ext/upload/theme.php
@@ -319,4 +319,4 @@ class UploadTheme extends Themelet {
";
}
}
-?>
+
diff --git a/ext/user/main.php b/ext/user/main.php
index 67755004..130930dd 100644
--- a/ext/user/main.php
+++ b/ext/user/main.php
@@ -50,6 +50,8 @@ class UserDeletionEvent extends Event {
class UserCreationException extends SCoreException {}
+class NullUserException extends SCoreException {}
+
class UserPage extends Extension {
public function onInitExt(InitExtEvent $event) {
global $config;
@@ -147,11 +149,13 @@ class UserPage extends Extension {
// Try forwarding to same page on logout unless user comes from registration page
if ($config->get_int("user_loginshowprofile",0) == 0 &&
- isset($_SERVER['HTTP_REFERER']) &&
- strstr($_SERVER['HTTP_REFERER'], "post/"))
- $page->set_redirect ($_SERVER['HTTP_REFERER']);
- else
- $page->set_redirect(make_link());
+ isset($_SERVER['HTTP_REFERER']) &&
+ strstr($_SERVER['HTTP_REFERER'], "post/"))
+ {
+ $page->set_redirect ($_SERVER['HTTP_REFERER']);
+ } else {
+ $page->set_redirect(make_link());
+ }
}
if(!$user->check_auth_token()) {
@@ -161,6 +165,9 @@ class UserPage extends Extension {
else if($event->get_arg(0) == "change_pass") {
if(isset($_POST['id']) && isset($_POST['pass1']) && isset($_POST['pass2'])) {
$duser = User::by_id($_POST['id']);
+ if ( ! $duser instanceof User) {
+ throw new NullUserException("Error: the user id does not exist!");
+ }
$pass1 = $_POST['pass1'];
$pass2 = $_POST['pass2'];
$this->change_password_wrapper($duser, $pass1, $pass2);
@@ -169,6 +176,9 @@ class UserPage extends Extension {
else if($event->get_arg(0) == "change_email") {
if(isset($_POST['id']) && isset($_POST['address'])) {
$duser = User::by_id($_POST['id']);
+ if ( ! $duser instanceof User) {
+ throw new NullUserException("Error: the user id does not exist!");
+ }
$address = $_POST['address'];
$this->change_email_wrapper($duser, $address);
}
@@ -177,6 +187,9 @@ class UserPage extends Extension {
global $_user_classes;
if(isset($_POST['id']) && isset($_POST['class'])) {
$duser = User::by_id($_POST['id']);
+ if ( ! $duser instanceof User) {
+ throw new NullUserException("Error: the user id does not exist!");
+ }
$class = $_POST['class'];
if(!array_key_exists($class, $_user_classes)) {
throw Exception("Invalid user class: ".html_escape($class));
@@ -349,13 +362,16 @@ class UserPage extends Extension {
$this->set_login_cookie($duser->name, $pass);
log_info("user", "{$user->class->name} logged in");
$page->set_mode("redirect");
-
- // Try returning to previous page
- if ($config->get_int("user_loginshowprofile",0) == 0 &&
- isset($_SERVER['HTTP_REFERER']) &&
- strstr($_SERVER['HTTP_REFERER'], "post/"))
- $page->set_redirect($_SERVER['HTTP_REFERER']);
- else $page->set_redirect(make_link("user"));
+
+ // Try returning to previous page
+ if ($config->get_int("user_loginshowprofile",0) == 0 &&
+ isset($_SERVER['HTTP_REFERER']) &&
+ strstr($_SERVER['HTTP_REFERER'], "post/"))
+ {
+ $page->set_redirect($_SERVER['HTTP_REFERER']);
+ } else {
+ $page->set_redirect(make_link("user"));
+ }
}
else {
log_warning("user", "Failed to log in as ".html_escape($name)." [$hash]");
@@ -490,6 +506,9 @@ class UserPage extends Extension {
if($user->class->name == "admin") {
$duser = User::by_id($_POST['id']);
+ if ( ! $duser instanceof User) {
+ throw new NullUserException("Error: the user id does not exist!");
+ }
$duser->set_class($class);
flash_message("Class changed");
@@ -585,4 +604,4 @@ class UserPage extends Extension {
}
// }}}
}
-?>
+
diff --git a/ext/user/test.php b/ext/user/test.php
index 8655cd5e..cd55086b 100644
--- a/ext/user/test.php
+++ b/ext/user/test.php
@@ -37,4 +37,4 @@ class UserPageTest extends SCoreWebTestCase {
$this->assert_text("demo");
}
}
-?>
+
diff --git a/ext/user/theme.php b/ext/user/theme.php
index 2f0c0363..7d749de8 100644
--- a/ext/user/theme.php
+++ b/ext/user/theme.php
@@ -235,4 +235,4 @@ class UserPageTheme extends Themelet {
}
// }}}
}
-?>
+
diff --git a/ext/view/main.php b/ext/view/main.php
index c97e0592..35bb8081 100644
--- a/ext/view/main.php
+++ b/ext/view/main.php
@@ -139,4 +139,4 @@ class ViewImage extends Extension {
$this->theme->display_page($event->get_image(), $iibbe->parts);
}
}
-?>
+
diff --git a/ext/view/test.php b/ext/view/test.php
index 9338f841..2398e356 100644
--- a/ext/view/test.php
+++ b/ext/view/test.php
@@ -42,4 +42,4 @@ class ViewTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/view/theme.php b/ext/view/theme.php
index c043ff83..a2775c8b 100644
--- a/ext/view/theme.php
+++ b/ext/view/theme.php
@@ -90,4 +90,4 @@ class ViewImageTheme extends Themelet {
return $html;
}
}
-?>
+
diff --git a/ext/wiki/main.php b/ext/wiki/main.php
index 94f9fb0f..d1457584 100644
--- a/ext/wiki/main.php
+++ b/ext/wiki/main.php
@@ -483,4 +483,4 @@ class Wiki extends Extension {
}
// }}}
}
-?>
+
diff --git a/ext/wiki/test.php b/ext/wiki/test.php
index 7694a496..3cbbd44c 100644
--- a/ext/wiki/test.php
+++ b/ext/wiki/test.php
@@ -111,4 +111,4 @@ class WikiTest extends SCoreWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/ext/wiki/theme.php b/ext/wiki/theme.php
index 54e7338d..99b94a41 100644
--- a/ext/wiki/theme.php
+++ b/ext/wiki/theme.php
@@ -106,4 +106,4 @@ class WikiTheme extends Themelet {
";
}
}
-?>
+
diff --git a/ext/word_filter/main.php b/ext/word_filter/main.php
index f85cc3de..0ce8d5ea 100644
--- a/ext/word_filter/main.php
+++ b/ext/word_filter/main.php
@@ -48,4 +48,4 @@ class WordFilter extends Extension {
return $map;
}
}
-?>
+
diff --git a/ext/word_filter/test.php b/ext/word_filter/test.php
index 5fbe0f19..6b3df0b2 100644
--- a/ext/word_filter/test.php
+++ b/ext/word_filter/test.php
@@ -53,4 +53,4 @@ class WordFilterTest extends ShimmieWebTestCase {
$this->log_out();
}
}
-?>
+
diff --git a/index.php b/index.php
index 28d6811a..1599e2c4 100644
--- a/index.php
+++ b/index.php
@@ -100,4 +100,4 @@ catch(Exception $e) {
_fatal_error($e);
ctx_log_ender();
}
-?>
+
diff --git a/lib/shimmie.js b/lib/shimmie.js
index 2a1f09ed..79419237 100644
--- a/lib/shimmie.js
+++ b/lib/shimmie.js
@@ -1,3 +1,4 @@
+/*jshint bitwise:false, curly:true, eqeqeq:true, evil:true, forin:false, noarg:true, noempty:true, nonew:true, undef:false, strict:false, browser:true */
// Adding jQuery ui stuff
$(document).ready(function() {
@@ -49,7 +50,7 @@ $(document).ready(function() {
if(sidebar_hidden.hasOwnProperty(i) && sidebar_hidden[i].length > 0) {
$(sidebar_hidden[i]+" .blockbody").hide();
}
- };
+ }
}
catch(err) {
var sidebar_hidden = [];
@@ -59,7 +60,7 @@ $(document).ready(function() {
var tob = $(tid+" .blockbody");
$(elm).click(function(e) {
tob.slideToggle("slow");
- if(sidebar_hidden.indexOf(tid) == -1) {
+ if(sidebar_hidden.indexOf(tid) === -1) {
sidebar_hidden.push(tid);
}
else {
@@ -70,7 +71,7 @@ $(document).ready(function() {
}
}
$.cookie("ui-sidebar-hidden", sidebar_hidden.join("|"), {path: '/', expires: 365});
- })
+ });
});
$(".shm-unlocker").each(function(idx, elm) {
@@ -140,12 +141,12 @@ function getHTTPObject() {
function getCookie( name ) {
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
- if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
+ if ( ( !start ) && ( name !== document.cookie.substring( 0, name.length ) ) ) {
return null;
}
- if ( start == -1 ) return null;
+ if ( start === -1 ) { return null; }
var end = document.cookie.indexOf( ";", len );
- if ( end == -1 ) end = document.cookie.length;
+ if ( end === -1 ) { end = document.cookie.length; }
return unescape( document.cookie.substring( len, end ) );
}
@@ -164,10 +165,11 @@ function setCookie( name, value, expires, path, domain, secure ) {
}
function deleteCookie( name, path, domain ) {
- if ( getCookie( name ) ) document.cookie = name + "=" +
+ if ( getCookie( name ) ) { document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
+ }
}
function replyTo(imageId, commentId, userId) {
diff --git a/tests/test_install.php b/tests/test_install.php
index 80a4d20d..2c2cbace 100644
--- a/tests/test_install.php
+++ b/tests/test_install.php
@@ -21,7 +21,7 @@ $db = $options["d"];
$host = rtrim(trim(trim($options["h"], '"')), "/");
// Check if they are empty.
-if (empty($db)){ die("Error: need to specifiy a database for the test environment."); }
+if (empty($db)){ die("Error: need to specify a database for the test environment."); }
if (empty($host)){ $host = "http://127.0.0.1"; }
define("_TRAVIS_DATABASE", $db);
diff --git a/themes/danbooru/comment.theme.php b/themes/danbooru/comment.theme.php
index f9fcdfca..826c87d4 100644
--- a/themes/danbooru/comment.theme.php
+++ b/themes/danbooru/comment.theme.php
@@ -49,7 +49,7 @@ class CustomCommentListTheme extends CommentListTheme {
$comment_count = count($comments);
if($comment_limit > 0 && $comment_count > $comment_limit) {
- $hidden = $comment_count - $comment_limit;
+ //$hidden = $comment_count - $comment_limit;
$comment_html .= "showing $comment_limit of $comment_count comments
";
$comments = array_slice($comments, -$comment_limit);
}
@@ -93,9 +93,9 @@ class CustomCommentListTheme extends CommentListTheme {
$tfe = new TextFormattingEvent($comment->comment);
send_event($tfe);
- $i_uid = int_escape($comment->owner_id);
+ //$i_uid = int_escape($comment->owner_id);
$h_name = html_escape($comment->owner_name);
- $h_poster_ip = html_escape($comment->poster_ip);
+ //$h_poster_ip = html_escape($comment->poster_ip);
$h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted);
$i_comment_id = int_escape($comment->comment_id);
$i_image_id = int_escape($comment->image_id);
@@ -107,7 +107,7 @@ class CustomCommentListTheme extends CommentListTheme {
$h_del = $user->can("delete_comment") ?
' - Del' : '';
- $h_imagelink = $trim ? ">>>\n" : "";
+ //$h_imagelink = $trim ? ">>>\n" : "";
if($trim) {
return "";
}
@@ -121,4 +121,4 @@ class CustomCommentListTheme extends CommentListTheme {
}
}
}
-?>
+
diff --git a/themes/danbooru/custompage.class.php b/themes/danbooru/custompage.class.php
index 1e71720b..16d676cf 100644
--- a/themes/danbooru/custompage.class.php
+++ b/themes/danbooru/custompage.class.php
@@ -6,4 +6,4 @@ class CustomPage extends Page {
$this->left_enabled = false;
}
}
-?>
+
diff --git a/themes/danbooru/index.theme.php b/themes/danbooru/index.theme.php
index b27aa028..47bd2d9a 100644
--- a/themes/danbooru/index.theme.php
+++ b/themes/danbooru/index.theme.php
@@ -58,4 +58,4 @@ class CustomIndexTheme extends IndexTheme {
return $table;
}
}
-?>
+
diff --git a/themes/danbooru/layout.class.php b/themes/danbooru/layout.class.php
index 27af8810..ca0f3fe0 100644
--- a/themes/danbooru/layout.class.php
+++ b/themes/danbooru/layout.class.php
@@ -265,4 +265,4 @@ EOD;
return $html;
}
}
-?>
+
diff --git a/themes/danbooru/tag_list.theme.php b/themes/danbooru/tag_list.theme.php
index 3c168380..6628ca29 100644
--- a/themes/danbooru/tag_list.theme.php
+++ b/themes/danbooru/tag_list.theme.php
@@ -6,4 +6,4 @@ class CustomTagListTheme extends TagListTheme {
parent::display_page($page);
}
}
-?>
+
diff --git a/themes/danbooru/themelet.class.php b/themes/danbooru/themelet.class.php
index b69c5288..9eb986c7 100644
--- a/themes/danbooru/themelet.class.php
+++ b/themes/danbooru/themelet.class.php
@@ -48,4 +48,4 @@ class Themelet extends BaseThemelet {
return "$prev_html $first_html $pdots $pages_html $ndots $last_html $next_html
";
}
}
-?>
+
diff --git a/themes/danbooru/upload.theme.php b/themes/danbooru/upload.theme.php
index 7e5f75bf..a7047cf3 100644
--- a/themes/danbooru/upload.theme.php
+++ b/themes/danbooru/upload.theme.php
@@ -11,4 +11,4 @@ class CustomUploadTheme extends UploadTheme {
parent::display_page($page);
}
}
-?>
+
diff --git a/themes/danbooru/user.theme.php b/themes/danbooru/user.theme.php
index fba58e8d..9990879e 100644
--- a/themes/danbooru/user.theme.php
+++ b/themes/danbooru/user.theme.php
@@ -98,4 +98,4 @@ class CustomUserPageTheme extends UserPageTheme {
parent::display_user_page($duser, $stats);
}
}
-?>
+
diff --git a/themes/danbooru/view.theme.php b/themes/danbooru/view.theme.php
index 19aa4fcf..427d4f48 100644
--- a/themes/danbooru/view.theme.php
+++ b/themes/danbooru/view.theme.php
@@ -51,4 +51,4 @@ class CustomViewImageTheme extends ViewImageTheme {
return $html;
}
}
-?>
+
diff --git a/themes/danbooru2/admin.theme.php b/themes/danbooru2/admin.theme.php
index b08d12c3..2007705d 100644
--- a/themes/danbooru2/admin.theme.php
+++ b/themes/danbooru2/admin.theme.php
@@ -8,4 +8,4 @@ class CustomAdminPageTheme extends AdminPageTheme {
}
}
-?>
+
diff --git a/themes/danbooru2/comment.theme.php b/themes/danbooru2/comment.theme.php
index f9fcdfca..826c87d4 100644
--- a/themes/danbooru2/comment.theme.php
+++ b/themes/danbooru2/comment.theme.php
@@ -49,7 +49,7 @@ class CustomCommentListTheme extends CommentListTheme {
$comment_count = count($comments);
if($comment_limit > 0 && $comment_count > $comment_limit) {
- $hidden = $comment_count - $comment_limit;
+ //$hidden = $comment_count - $comment_limit;
$comment_html .= "showing $comment_limit of $comment_count comments
";
$comments = array_slice($comments, -$comment_limit);
}
@@ -93,9 +93,9 @@ class CustomCommentListTheme extends CommentListTheme {
$tfe = new TextFormattingEvent($comment->comment);
send_event($tfe);
- $i_uid = int_escape($comment->owner_id);
+ //$i_uid = int_escape($comment->owner_id);
$h_name = html_escape($comment->owner_name);
- $h_poster_ip = html_escape($comment->poster_ip);
+ //$h_poster_ip = html_escape($comment->poster_ip);
$h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted);
$i_comment_id = int_escape($comment->comment_id);
$i_image_id = int_escape($comment->image_id);
@@ -107,7 +107,7 @@ class CustomCommentListTheme extends CommentListTheme {
$h_del = $user->can("delete_comment") ?
' - Del' : '';
- $h_imagelink = $trim ? ">>>\n" : "";
+ //$h_imagelink = $trim ? ">>>\n" : "";
if($trim) {
return "";
}
@@ -121,4 +121,4 @@ class CustomCommentListTheme extends CommentListTheme {
}
}
}
-?>
+
diff --git a/themes/danbooru2/custompage.class.php b/themes/danbooru2/custompage.class.php
index 1e71720b..16d676cf 100644
--- a/themes/danbooru2/custompage.class.php
+++ b/themes/danbooru2/custompage.class.php
@@ -6,4 +6,4 @@ class CustomPage extends Page {
$this->left_enabled = false;
}
}
-?>
+
diff --git a/themes/danbooru2/ext_manager.theme.php b/themes/danbooru2/ext_manager.theme.php
index 67449dcf..1c42e2e8 100644
--- a/themes/danbooru2/ext_manager.theme.php
+++ b/themes/danbooru2/ext_manager.theme.php
@@ -11,4 +11,4 @@ class CustomExtManagerTheme extends ExtManagerTheme {
}
}
-?>
+
diff --git a/themes/danbooru2/index.theme.php b/themes/danbooru2/index.theme.php
index 4d0ca68f..090cd248 100644
--- a/themes/danbooru2/index.theme.php
+++ b/themes/danbooru2/index.theme.php
@@ -58,4 +58,4 @@ class CustomIndexTheme extends IndexTheme {
return $table;
}
}
-?>
+
diff --git a/themes/danbooru2/layout.class.php b/themes/danbooru2/layout.class.php
index d7e108b2..e937ed8b 100644
--- a/themes/danbooru2/layout.class.php
+++ b/themes/danbooru2/layout.class.php
@@ -291,4 +291,4 @@ EOD;
return $html;
}
}
-?>
+
diff --git a/themes/danbooru2/tag_list.theme.php b/themes/danbooru2/tag_list.theme.php
index 3c168380..6628ca29 100644
--- a/themes/danbooru2/tag_list.theme.php
+++ b/themes/danbooru2/tag_list.theme.php
@@ -6,4 +6,4 @@ class CustomTagListTheme extends TagListTheme {
parent::display_page($page);
}
}
-?>
+
diff --git a/themes/danbooru2/themelet.class.php b/themes/danbooru2/themelet.class.php
index b69c5288..9eb986c7 100644
--- a/themes/danbooru2/themelet.class.php
+++ b/themes/danbooru2/themelet.class.php
@@ -48,4 +48,4 @@ class Themelet extends BaseThemelet {
return "$prev_html $first_html $pdots $pages_html $ndots $last_html $next_html
";
}
}
-?>
+
diff --git a/themes/danbooru2/upload.theme.php b/themes/danbooru2/upload.theme.php
index 7e5f75bf..a7047cf3 100644
--- a/themes/danbooru2/upload.theme.php
+++ b/themes/danbooru2/upload.theme.php
@@ -11,4 +11,4 @@ class CustomUploadTheme extends UploadTheme {
parent::display_page($page);
}
}
-?>
+
diff --git a/themes/danbooru2/user.theme.php b/themes/danbooru2/user.theme.php
index fba58e8d..9990879e 100644
--- a/themes/danbooru2/user.theme.php
+++ b/themes/danbooru2/user.theme.php
@@ -98,4 +98,4 @@ class CustomUserPageTheme extends UserPageTheme {
parent::display_user_page($duser, $stats);
}
}
-?>
+
diff --git a/themes/danbooru2/view.theme.php b/themes/danbooru2/view.theme.php
index 11956fc9..bd6e5f45 100644
--- a/themes/danbooru2/view.theme.php
+++ b/themes/danbooru2/view.theme.php
@@ -64,4 +64,4 @@ class CustomViewImageTheme extends ViewImageTheme {
return "$h_search";
}
}
-?>
+
diff --git a/themes/default/layout.class.php b/themes/default/layout.class.php
index 078e143f..87b86d31 100644
--- a/themes/default/layout.class.php
+++ b/themes/default/layout.class.php
@@ -94,4 +94,4 @@ $header_html
EOD;
}
}
-?>
+
diff --git a/themes/default/themelet.class.php b/themes/default/themelet.class.php
index d13596ce..77c927c3 100644
--- a/themes/default/themelet.class.php
+++ b/themes/default/themelet.class.php
@@ -1,3 +1,3 @@
+
diff --git a/themes/futaba/comment.theme.php b/themes/futaba/comment.theme.php
index f65b0b14..2b4c3518 100644
--- a/themes/futaba/comment.theme.php
+++ b/themes/futaba/comment.theme.php
@@ -1,13 +1,13 @@
get_string('title');
$page->set_title($page_title);
@@ -51,7 +51,7 @@ class CustomCommentListTheme extends CommentListTheme {
// sidebar fails in this theme
}
- private function build_upload_box() {
+ public function build_upload_box() {
return "[[ insert upload-and-comment extension here ]]";
}
@@ -63,9 +63,9 @@ class CustomCommentListTheme extends CommentListTheme {
$tfe = new TextFormattingEvent($comment->comment);
send_event($tfe);
- $i_uid = int_escape($comment->owner_id);
+ //$i_uid = int_escape($comment->owner_id);
$h_name = html_escape($comment->owner_name);
- $h_poster_ip = html_escape($comment->poster_ip);
+ //$h_poster_ip = html_escape($comment->poster_ip);
$h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted);
$i_comment_id = int_escape($comment->comment_id);
$i_image_id = int_escape($comment->image_id);
@@ -89,4 +89,4 @@ class CustomCommentListTheme extends CommentListTheme {
}
}
}
-?>
+
diff --git a/themes/futaba/custompage.class.php b/themes/futaba/custompage.class.php
index 1e71720b..16d676cf 100644
--- a/themes/futaba/custompage.class.php
+++ b/themes/futaba/custompage.class.php
@@ -6,4 +6,4 @@ class CustomPage extends Page {
$this->left_enabled = false;
}
}
-?>
+
diff --git a/themes/futaba/layout.class.php b/themes/futaba/layout.class.php
index b42c9ad2..a2f1c370 100644
--- a/themes/futaba/layout.class.php
+++ b/themes/futaba/layout.class.php
@@ -102,4 +102,4 @@ $header_html
EOD;
}
}
-?>
+
diff --git a/themes/futaba/themelet.class.php b/themes/futaba/themelet.class.php
index 5770b05b..3f38fdfc 100644
--- a/themes/futaba/themelet.class.php
+++ b/themes/futaba/themelet.class.php
@@ -1,53 +1,87 @@
build_paginator($page_number, $total_pages, $base, $query);
+ $body = $this->futaba_build_paginator($page_number, $total_pages, $base, $query);
$page->add_block(new Block(null, $body, "main", $position));
}
- private function gen_page_link($base_url, $query, $page, $name) {
+ /**
+ * Generate a single HTML link.
+ *
+ * @param string $base_url
+ * @param string $query
+ * @param int|string $page
+ * @param string $name
+ * @return string
+ */
+ public function futaba_gen_page_link($base_url, $query, $page, $name) {
$link = make_link("$base_url/$page", $query);
- return "[$name]";
+ return "[{$name}]";
}
-
- private function gen_page_link_block($base_url, $query, $page, $current_page, $name) {
+
+ /**
+ * @param string $base_url
+ * @param string $query
+ * @param int|string $page
+ * @param int|string $current_page
+ * @param string $name
+ * @return string
+ */
+ public function futaba_gen_page_link_block($base_url, $query, $page, $current_page, $name) {
$paginator = "";
if($page == $current_page) $paginator .= "";
- $paginator .= $this->gen_page_link($base_url, $query, $page, $name);
+ $paginator .= $this->futaba_gen_page_link($base_url, $query, $page, $name);
if($page == $current_page) $paginator .= "";
return $paginator;
}
-
- private function build_paginator($current_page, $total_pages, $base_url, $query) {
+
+ /**
+ * Build the paginator.
+ *
+ * @param int $current_page
+ * @param int $total_pages
+ * @param string $base_url
+ * @param string $query
+ * @return string
+ */
+ public function futaba_build_paginator($current_page, $total_pages, $base_url, $query) {
$next = $current_page + 1;
$prev = $current_page - 1;
- $rand = mt_rand(1, $total_pages);
+ //$rand = mt_rand(1, $total_pages);
$at_start = ($current_page <= 1 || $total_pages <= 1);
$at_end = ($current_page >= $total_pages);
- $first_html = $at_start ? "First" : $this->gen_page_link($base_url, $query, 1, "First");
- $prev_html = $at_start ? "Prev" : $this->gen_page_link($base_url, $query, $prev, "Prev");
- $random_html = $this->gen_page_link($base_url, $query, $rand, "Random");
- $next_html = $at_end ? "Next" : $this->gen_page_link($base_url, $query, $next, "Next");
- $last_html = $at_end ? "Last" : $this->gen_page_link($base_url, $query, $total_pages, "Last");
+ //$first_html = $at_start ? "First" : $this->futaba_gen_page_link($base_url, $query, 1, "First");
+ $prev_html = $at_start ? "Prev" : $this->futaba_gen_page_link($base_url, $query, $prev, "Prev");
+ //$random_html = $this->futaba_gen_page_link($base_url, $query, $rand, "Random");
+ $next_html = $at_end ? "Next" : $this->futaba_gen_page_link($base_url, $query, $next, "Next");
+ //$last_html = $at_end ? "Last" : $this->futaba_gen_page_link($base_url, $query, $total_pages, "Last");
$start = $current_page-5 > 1 ? $current_page-5 : 1;
$end = $start+10 < $total_pages ? $start+10 : $total_pages;
$pages = array();
foreach(range($start, $end) as $i) {
- $pages[] = $this->gen_page_link_block($base_url, $query, $i, $current_page, $i);
+ $pages[] = $this->futaba_gen_page_link_block($base_url, $query, $i, $current_page, $i);
}
$pages_html = implode(" ", $pages);
//return "$first_html | $prev_html | $random_html | $next_html | $last_html".
// "
<< $pages_html >>
";
- return "$prev_html $pages_html $next_html
";
+ return "{$prev_html} {$pages_html} {$next_html}
";
}
}
-?>
+
diff --git a/themes/futaba/view.theme.php b/themes/futaba/view.theme.php
index c8c3519b..54b66e88 100644
--- a/themes/futaba/view.theme.php
+++ b/themes/futaba/view.theme.php
@@ -8,4 +8,4 @@ class CustomViewImageTheme extends ViewImageTheme {
$page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 10));
}
}
-?>
+
diff --git a/themes/lite/comment.theme.php b/themes/lite/comment.theme.php
index 97676e24..9c4638ea 100644
--- a/themes/lite/comment.theme.php
+++ b/themes/lite/comment.theme.php
@@ -9,4 +9,3 @@ class CustomCommentListTheme extends CommentListTheme {
return $this->rr(parent::build_postbox($image_id));
}
}
-?>
diff --git a/themes/lite/custompage.class.php b/themes/lite/custompage.class.php
index 1e71720b..16d676cf 100644
--- a/themes/lite/custompage.class.php
+++ b/themes/lite/custompage.class.php
@@ -6,4 +6,4 @@ class CustomPage extends Page {
$this->left_enabled = false;
}
}
-?>
+
diff --git a/themes/lite/layout.class.php b/themes/lite/layout.class.php
index 3cf8e9d9..29c0bb3d 100644
--- a/themes/lite/layout.class.php
+++ b/themes/lite/layout.class.php
@@ -8,6 +8,7 @@
* some other sites, packaged in a light blue color.
*/
class Layout {
+
/**
* turns the Page into HTML
*/
@@ -20,13 +21,14 @@ class Layout {
$contact_link = $config->get_string('contact_link');
$header_html = "";
+ ksort($page->html_headers);
foreach($page->html_headers as $line) {
- $header_html .= "\t\t$line\n";
+ $header_html .= "\t\t{$line}\n";
}
$menu = "";
+ $menu .= "{$custom_links}";
$left_block_html = "";
$main_block_html = "";
@@ -76,11 +78,11 @@ class Layout {
$custom_sublinks = "";
// hack
- global $user;
$username = url_escape($user->name);
// hack
$qp = explode("/", ltrim(@$_GET["q"], "/"));
- $hw = class_exists("Wiki");
+ $cs = "";
+
// php sucks
switch($qp[0]) {
default:
@@ -93,12 +95,14 @@ class Layout {
# the subnav links aren't shown, but it would
# be nice to be correct
case "post":
- if(class_exists("NumericScore")){ $cs .= "
Popular by Day/Month/Year ";}
+ if(class_exists("NumericScore")){
+ $cs .= "
Popular by Day/Month/Year ";
+ }
$cs .= "
All";
- if(class_exists("Favorites")){ $cs .= "
My Favorites";}
+ if(class_exists("Favorites")){ $cs .= "
My Favorites";}
if(class_exists("RSS_Images")){ $cs .= "
Feed";}
if(class_exists("Random_Image")){ $cs .= "
Random Image";}
- if($hw){ $cs .= "
Help";
+ if(class_exists("Wiki")){ $cs .= "
Help";
}else{ $cs .= "
Help";}
break;
case "comment":
@@ -127,7 +131,7 @@ class Layout {
$cs .= "
Help";
break;
case "upload":
- if($hw) $cs .= "
Guidelines";
+ if(class_exists("Wiki")) { $cs .= "
Guidelines"; }
break;
case "random":
$cs .= "
Shuffle";
@@ -137,25 +141,28 @@ class Layout {
$cs .= "
Download";
break;
}
- if($cs == "") {$custom_sublinks = "";} else {
- $custom_sublinks .= "$cs
";}
+ if($cs == "") {
+ $custom_sublinks = "";
+ } else {
+ $custom_sublinks .= "$cs";
+ }
$debug = get_debug_info();
- $contact = empty($contact_link) ? "" : "
Contact";
- $subheading = empty($page->subheading) ? "" : "{$page->subheading}
";
+ $contact = empty($contact_link) ? "" : "
Contact";
+ //$subheading = empty($page->subheading) ? "" : "{$page->subheading}
";
- $wrapper = "";
+ /*$wrapper = "";
if(strlen($page->heading) > 100) {
$wrapper = ' style="height: 3em; overflow: auto;"';
- }
- if($page->left_enabled==false) {
+ }*/
+ if($page->left_enabled == false) {
$left_block_html = "";
- $main_block_html = "$main_block_html";
+ $main_block_html = "{$main_block_html}";
} else {
- $left_block_html = "";
- $main_block_html = "$main_block_html";
+ $left_block_html = "";
+ $main_block_html = "{$main_block_html}";
}
$flash = get_prefixed_cookie("flash_message");
@@ -199,62 +206,63 @@ class Layout {