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 $query
* @param int|string $page
* @param string $page
* @param string $name
* @return string
*/
@ -108,8 +108,8 @@ class BaseThemelet {
/**
* @param string $base_url
* @param string $query
* @param int|string $page
* @param int|string $current_page
* @param string $page
* @param int $current_page
* @param string $name
* @return string
*/

View file

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

View file

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

View file

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

View file

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

View file

@ -54,6 +54,14 @@ class BulkAddCSV extends Extension {
/**
* 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) {
assert(file_exists($tmpname));

View file

@ -71,7 +71,7 @@ class Comment {
}
/**
* @param \User $user
* @param User $user
* @return mixed
*/
public static function count_comments_by_user($user) {
@ -393,7 +393,7 @@ class CommentList extends Extension {
/**
* @param string $query
* @param array $args
* @return array
* @return Comment[]
*/
private function get_generic_comments($query, $args) {
global $database;
@ -407,7 +407,7 @@ class CommentList extends Extension {
/**
* @param int $count
* @return array
* @return Comment[]
*/
private function get_recent_comments($count) {
return $this->get_generic_comments("
@ -427,7 +427,7 @@ class CommentList extends Extension {
* @param int $user_id
* @param int $count
* @param int $offset
* @return array
* @return Comment[]
*/
private function get_user_comments(/*int*/ $user_id, /*int*/ $count, /*int*/ $offset=0) {
return $this->get_generic_comments("
@ -446,7 +446,7 @@ class CommentList extends Extension {
/**
* @param int $image_id
* @return array
* @return Comment[]
*/
private function get_comments(/*int*/ $image_id) {
return $this->get_generic_comments("
@ -464,6 +464,9 @@ class CommentList extends Extension {
// }}}
// add / remove / edit comments {{{
/**
* @return bool
*/
private function is_comment_limit_hit() {
global $config, $database;
@ -499,6 +502,8 @@ class CommentList extends Extension {
* many times.
*
* FIXME: assumes comments are posted via HTTP...
*
* @return string
*/
public static function get_hash() {
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));
}
/**
* @param int $image_id
* @param User $user
* @param string $comment
* @throws CommentPostingException
*/
private function comment_checks(/*int*/ $image_id, User $user, /*string*/ $comment) {
global $config, $page;