more comments

This commit is contained in:
Shish 2015-09-27 02:17:44 +01:00
parent 78c44c7067
commit cdcd762a52
7 changed files with 54 additions and 20 deletions

View file

@ -96,7 +96,7 @@ class BaseThemelet {
* *
* @param string $base_url * @param string $base_url
* @param string $query * @param string $query
* @param int|string $page * @param string $page
* @param string $name * @param string $name
* @return string * @return string
*/ */
@ -108,8 +108,8 @@ class BaseThemelet {
/** /**
* @param string $base_url * @param string $base_url
* @param string $query * @param string $query
* @param int|string $page * @param string $page
* @param int|string $current_page * @param int $current_page
* @param string $name * @param string $name
* @return string * @return string
*/ */

View file

@ -282,7 +282,7 @@ abstract class DataHandlerExtension extends Extension {
abstract protected function supported_ext($ext); abstract protected function supported_ext($ext);
/** /**
* @param $tmpname * @param string $tmpname
* @return bool * @return bool
*/ */
abstract protected function check_contents($tmpname); abstract protected function check_contents($tmpname);

View file

@ -192,6 +192,13 @@ class Image {
return ($yays > 1 || $nays > 0); return ($yays > 1 || $nays > 0);
} }
/**
* @param string[] $tags
* @param int $offset
* @param int $limit
* @return null|PDOStatement
* @throws SCoreException
*/
public function get_accelerated_result($tags, $offset, $limit) { public function get_accelerated_result($tags, $offset, $limit) {
global $database; global $database;
@ -244,7 +251,7 @@ class Image {
* Count the number of image results for a given search * Count the number of image results for a given search
* *
* @param string[] $tags * @param string[] $tags
* @return mixed * @return int
*/ */
public static function count_images($tags=array()) { public static function count_images($tags=array()) {
assert('is_array($tags)'); assert('is_array($tags)');
@ -401,9 +408,9 @@ class Image {
/** /**
* Check configured template for a link, then try nice URL, then plain URL * Check configured template for a link, then try nice URL, then plain URL
* *
* @param $template * @param string $template
* @param $nice * @param string $nice
* @param $plain * @param string $plain
* @return string * @return string
*/ */
private function get_link($template, $nice, $plain) { private function get_link($template, $nice, $plain) {
@ -532,6 +539,10 @@ class Image {
return $this->locked; return $this->locked;
} }
/**
* @param bool $tf
* @throws SCoreException
*/
public function set_locked($tf) { public function set_locked($tf) {
global $database; global $database;
$ln = $tf ? "Y" : "N"; $ln = $tf ? "Y" : "N";
@ -1102,7 +1113,7 @@ class Tag {
* Remove any excess fluff from a user-input tag * Remove any excess fluff from a user-input tag
* *
* @param string $tag * @param string $tag
* @return mixed * @return string
*/ */
public static function sanitise($tag) { public static function sanitise($tag) {
assert('is_string($tag)'); assert('is_string($tag)');
@ -1118,7 +1129,7 @@ class Tag {
* *
* @param string|string[] $tags * @param string|string[] $tags
* @param bool $tagme * @param bool $tagme
* @return array * @return string[]
*/ */
public static function explode($tags, $tagme=true) { public static function explode($tags, $tagme=true) {
assert('is_string($tags) || is_array($tags)'); assert('is_string($tags) || is_array($tags)');
@ -1307,9 +1318,9 @@ function add_dir(/*string*/ $base) {
} }
/** /**
* @param $tmpname * @param string $tmpname
* @param $filename * @param string $filename
* @param $tags * @param string $tags
* @throws UploadException * @throws UploadException
*/ */
function add_image(/*string*/ $tmpname, /*string*/ $filename, /*string*/ $tags) { function add_image(/*string*/ $tmpname, /*string*/ $filename, /*string*/ $tags) {
@ -1337,7 +1348,7 @@ function add_image(/*string*/ $tmpname, /*string*/ $filename, /*string*/ $tags)
* *
* @param int $orig_width * @param int $orig_width
* @param int $orig_height * @param int $orig_height
* @return array * @return int[]
*/ */
function get_thumbnail_size(/*int*/ $orig_width, /*int*/ $orig_height) { function get_thumbnail_size(/*int*/ $orig_width, /*int*/ $orig_height) {
global $config; global $config;

View file

@ -205,6 +205,10 @@ class Page {
$this->cookies[] = array($full_name, $value, $time, $path); $this->cookies[] = array($full_name, $value, $time, $path);
} }
/**
* @param string $name
* @return string|null
*/
public function get_cookie(/*string*/ $name) { public function get_cookie(/*string*/ $name) {
$full_name = COOKIE_PREFIX."_".$name; $full_name = COOKIE_PREFIX."_".$name;
if(isset($_COOKIE[$full_name])) { if(isset($_COOKIE[$full_name])) {

View file

@ -93,7 +93,7 @@ class BBCode extends FormatterExtension {
/** /**
* @param string $text * @param string $text
* @return mixed * @return string
*/ */
private function filter_spoiler(/*string*/ $text) { private function filter_spoiler(/*string*/ $text) {
return str_replace( return str_replace(

View file

@ -54,6 +54,14 @@ class BulkAddCSV extends Extension {
/** /**
* Generate the necessary DataUploadEvent for a given image and tags. * Generate the necessary DataUploadEvent for a given image and tags.
*
* @param string $tmpname
* @param string $filename
* @param string $tags
* @param string $source
* @param string $rating
* @param string $thumbfile
* @throws UploadException
*/ */
private function add_image($tmpname, $filename, $tags, $source, $rating, $thumbfile) { private function add_image($tmpname, $filename, $tags, $source, $rating, $thumbfile) {
assert(file_exists($tmpname)); assert(file_exists($tmpname));

View file

@ -71,7 +71,7 @@ class Comment {
} }
/** /**
* @param \User $user * @param User $user
* @return mixed * @return mixed
*/ */
public static function count_comments_by_user($user) { public static function count_comments_by_user($user) {
@ -393,7 +393,7 @@ class CommentList extends Extension {
/** /**
* @param string $query * @param string $query
* @param array $args * @param array $args
* @return array * @return Comment[]
*/ */
private function get_generic_comments($query, $args) { private function get_generic_comments($query, $args) {
global $database; global $database;
@ -407,7 +407,7 @@ class CommentList extends Extension {
/** /**
* @param int $count * @param int $count
* @return array * @return Comment[]
*/ */
private function get_recent_comments($count) { private function get_recent_comments($count) {
return $this->get_generic_comments(" return $this->get_generic_comments("
@ -427,7 +427,7 @@ class CommentList extends Extension {
* @param int $user_id * @param int $user_id
* @param int $count * @param int $count
* @param int $offset * @param int $offset
* @return array * @return Comment[]
*/ */
private function get_user_comments(/*int*/ $user_id, /*int*/ $count, /*int*/ $offset=0) { private function get_user_comments(/*int*/ $user_id, /*int*/ $count, /*int*/ $offset=0) {
return $this->get_generic_comments(" return $this->get_generic_comments("
@ -446,7 +446,7 @@ class CommentList extends Extension {
/** /**
* @param int $image_id * @param int $image_id
* @return array * @return Comment[]
*/ */
private function get_comments(/*int*/ $image_id) { private function get_comments(/*int*/ $image_id) {
return $this->get_generic_comments(" return $this->get_generic_comments("
@ -464,6 +464,9 @@ class CommentList extends Extension {
// }}} // }}}
// add / remove / edit comments {{{ // add / remove / edit comments {{{
/**
* @return bool
*/
private function is_comment_limit_hit() { private function is_comment_limit_hit() {
global $config, $database; global $config, $database;
@ -499,6 +502,8 @@ class CommentList extends Extension {
* many times. * many times.
* *
* FIXME: assumes comments are posted via HTTP... * FIXME: assumes comments are posted via HTTP...
*
* @return string
*/ */
public static function get_hash() { public static function get_hash() {
return md5($_SERVER['REMOTE_ADDR'] . date("%Y%m%d")); return md5($_SERVER['REMOTE_ADDR'] . date("%Y%m%d"));
@ -590,6 +595,12 @@ class CommentList extends Extension {
log_info("comment", "Comment #$cid added to Image #$image_id: $snippet", false, array("image_id"=>$image_id, "comment_id"=>$cid)); log_info("comment", "Comment #$cid added to Image #$image_id: $snippet", false, array("image_id"=>$image_id, "comment_id"=>$cid));
} }
/**
* @param int $image_id
* @param User $user
* @param string $comment
* @throws CommentPostingException
*/
private function comment_checks(/*int*/ $image_id, User $user, /*string*/ $comment) { private function comment_checks(/*int*/ $image_id, User $user, /*string*/ $comment) {
global $config, $page; global $config, $page;