diff --git a/core/block.class.php b/core/block.class.php index aa2b3465..0beab722 100644 --- a/core/block.class.php +++ b/core/block.class.php @@ -31,7 +31,7 @@ class Block { */ var $position; - public function __construct($header, $body, $section="main", $position=50) { + public function __construct($header, $body, /*string*/ $section="main", /*int*/ $position=50) { $this->header = $header; $this->body = $body; $this->section = $section; diff --git a/core/event.class.php b/core/event.class.php index 14043de4..a158cb9d 100644 --- a/core/event.class.php +++ b/core/event.class.php @@ -40,7 +40,7 @@ class PageRequestEvent extends Event { * * If it matches, store the remaining path elements in $args */ - public function page_matches($name) { + public function page_matches(/*string*/ $name) { $parts = explode("/", $name); $this->part_count = count($parts); @@ -57,7 +57,7 @@ class PageRequestEvent extends Event { return true; } - public function get_arg($n) { + public function get_arg(/*int*/ $n) { $offset = $this->part_count + $n; if($offset >= 0 && $offset < $this->arg_count) { return $this->args[$offset]; @@ -120,7 +120,7 @@ class TextFormattingEvent extends Event { */ var $stripped; - public function __construct($text) { + public function __construct(/*string*/ $text) { $h_text = html_escape(trim($text)); $this->original = $h_text; $this->formatted = $h_text; diff --git a/core/extension.class.php b/core/extension.class.php index e02df376..5d61b347 100644 --- a/core/extension.class.php +++ b/core/extension.class.php @@ -92,7 +92,7 @@ abstract class SimpleExtension implements Extension { var $theme; var $_child; - public function i_am($child) { + public function i_am(Extension $child) { $this->_child = $child; if(is_null($this->theme)) $this->theme = get_theme_object($child, false); } @@ -115,13 +115,13 @@ abstract class SimpleExtension implements Extension { * Several extensions have this in common, make a common API */ abstract class FormatterExtension extends SimpleExtension { - public function onTextFormatting($event) { + public function onTextFormatting(TextFormatting $event) { $event->formatted = $this->format($event->formatted); $event->stripped = $this->strip($event->stripped); } - abstract public function format($text); - abstract public function strip($text); + abstract public function format(/*string*/ $text); + abstract public function strip(/*string*/ $text); } /** @@ -129,7 +129,7 @@ abstract class FormatterExtension extends SimpleExtension { * so we have a base class to extend from */ abstract class DataHandlerExtension extends SimpleExtension { - public function onDataUpload($event) { + public function onDataUpload(DataUploadEvent $event) { if($this->supported_ext($event->type) && $this->check_contents($event->tmpname)) { if(!move_upload_to_archive($event)) return; send_event(new ThumbnailGenerationEvent($event->hash, $event->type)); @@ -188,7 +188,7 @@ abstract class DataHandlerExtension extends SimpleExtension { } } - public function onThumnbnailGeneration($event) { + public function onThumnbnailGeneration(ThumbnailGenerationEvent $event) { if($this->supported_ext($event->type)) { if (method_exists($this, 'create_thumb_force') && $event->force == true) { $this->create_thumb_force($event->hash); @@ -199,14 +199,14 @@ abstract class DataHandlerExtension extends SimpleExtension { } } - public function onDisplayingImage($event) { + public function onDisplayingImage(DisplayingImageEvent $event) { global $page; if($this->supported_ext($event->image->ext)) { $this->theme->display_image($page, $event->image); } } - public function onSetupBuilding($event) { + public function onSetupBuilding(SetupBuildingEvent $event) { $sb = $this->setup(); if($sb) $event->panel->add_block($sb); } diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 42e28637..14f2037e 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -66,7 +66,7 @@ class Image { * * @retval Image */ - public static function by_id($id) { + public static function by_id(/*int*/ $id) { assert(is_numeric($id)); global $database; $image = null; @@ -79,7 +79,7 @@ class Image { * * @retval Image */ - public static function by_hash($hash) { + public static function by_hash(/*string*/ $hash) { assert(is_string($hash)); global $database; $image = null; @@ -1011,7 +1011,7 @@ class Tag { * Move a file from PHP's temporary area into shimmie's image storage * heirachy, or throw an exception trying */ -function move_upload_to_archive($event) { +function move_upload_to_archive(DataUploadEvent $event) { $target = warehouse_path("images", $event->hash); if(!file_exists(dirname($target))) mkdir(dirname($target), 0755, true); if(!@copy($event->tmpname, $target)) { @@ -1026,7 +1026,7 @@ function move_upload_to_archive($event) { * Given a full size pair of dimentions, return a pair scaled down to fit * into the configured thumbnail square, with ratio intact */ -function get_thumbnail_size($orig_width, $orig_height) { +function get_thumbnail_size(/*int*/ $orig_width, /*int*/ $orig_height) { global $config; if($orig_width == 0) $orig_width = 192; diff --git a/core/user.class.php b/core/user.class.php index 9ab57a57..04ae7c7a 100644 --- a/core/user.class.php +++ b/core/user.class.php @@ -38,7 +38,7 @@ class User { $this->passhash = $row['pass']; } - public static function by_session($name, $session) { + public static function by_session(/*string*/ $name, /*string*/ $session) { global $config, $database; if($database->engine->name == "mysql") { $query = "SELECT * FROM users WHERE name = :name AND md5(concat(pass, :ip)) = :sess"; @@ -50,7 +50,7 @@ class User { return is_null($row) ? null : new User($row); } - public static function by_id($id) { + public static function by_id(/*int*/ $id) { assert(is_numeric($id)); global $database; if($id == 1) { @@ -62,14 +62,14 @@ class User { return is_null($row) ? null : new User($row); } - public static function by_name($name) { + public static function by_name(/*string*/ $name) { assert(is_string($name)); global $database; $row = $database->get_row("SELECT * FROM users WHERE name = :name", array("name"=>$name)); return is_null($row) ? null : new User($row); } - public static function by_name_and_hash($name, $hash) { + public static function by_name_and_hash(/*string*/ $name, /*string*/ $hash) { assert(is_string($name)); assert(is_string($hash)); assert(strlen($hash) == 32); @@ -78,7 +78,7 @@ class User { return is_null($row) ? null : new User($row); } - public static function by_list($offset, $limit=50) { + public static function by_list(/*int*/ $offset, /*int*/ $limit=50) { assert(is_numeric($offset)); assert(is_numeric($limit)); global $database; @@ -120,7 +120,7 @@ class User { return $this->admin; } - public function set_admin($admin) { + public function set_admin(/*bool*/ $admin) { assert(is_bool($admin)); global $database; $yn = $admin ? 'Y' : 'N'; @@ -128,14 +128,14 @@ class User { log_info("core-user", "Made {$this->name} admin=$yn"); } - public function set_password($password) { + public function set_password(/*string*/ $password) { global $database; $hash = md5(strtolower($this->name) . $password); $database->Execute("UPDATE users SET pass=:hash WHERE id=:id", array("hash"=>$hash, "id"=>$this->id)); log_info("core-user", "Set password for {$this->name}"); } - public function set_email($address) { + public function set_email(/*string*/ $address) { global $database; $database->Execute("UPDATE users SET email=:email WHERE id=:id", array("email"=>$address, "id"=>$this->id)); log_info("core-user", "Set email for {$this->name}"); diff --git a/core/util.inc.php b/core/util.inc.php index 7005d840..731a5d9d 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -276,7 +276,7 @@ function modify_url($url, $changes) { * * @retval string */ -function make_http($link) { +function make_http(/*string*/ $link) { if(strpos($link, "ttp://") > 0) return $link; if(strlen($link) > 0 && $link[0] != '/') $link = get_base_href().'/'.$link; $link = "http://".$_SERVER["HTTP_HOST"].$link; @@ -504,7 +504,7 @@ function get_memory_limit() { * * @retval string */ -function get_session_ip($config) { +function get_session_ip(Config $config) { $mask = $config->get_string("session_hash_mask", "255.255.0.0"); $addr = $_SERVER['REMOTE_ADDR']; $addr = inet_ntop(inet_pton($addr) & inet_pton($mask)); @@ -516,7 +516,7 @@ function get_session_ip($config) { * prefix prepended to it, eg username -> shm_username, to prevent * conflicts from multiple installs within one domain. */ -function get_prefixed_cookie($name) { +function get_prefixed_cookie(/*string*/ $name) { global $config; $full_name = COOKIE_PREFIX."_".$name; if(isset($_COOKIE[$full_name])) { @@ -569,13 +569,13 @@ function get_base_href() { * * @retval string */ -function format_text($string) { +function format_text(/*string*/ $string) { $tfe = new TextFormattingEvent($string); send_event($tfe); return $tfe->formatted; } -function warehouse_path($base, $hash, $create=true) { +function warehouse_path(/*string*/ $base, /*string*/ $hash, /*bool*/ $create=true) { $ab = substr($hash, 0, 2); $cd = substr($hash, 2, 2); if(WH_SPLITS == 2) {