From 298344048cfe852640ac67f266770126511ef5b4 Mon Sep 17 00:00:00 2001 From: jgen Date: Sat, 26 Apr 2014 00:27:16 -0400 Subject: [PATCH] Make these functions public to prevent scrutinizer from complaining. --- ext/comment/main.php | 2 +- ext/ouroboros_api/main.php | 17 +++++++++++------ themes/futaba/comment.theme.php | 4 ++-- themes/futaba/themelet.class.php | 16 ++++++++-------- themes/lite/themelet.class.php | 6 +++--- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/ext/comment/main.php b/ext/comment/main.php index 5e3c870d..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); } } 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/themes/futaba/comment.theme.php b/themes/futaba/comment.theme.php index 35e74d7d..2b4c3518 100644 --- a/themes/futaba/comment.theme.php +++ b/themes/futaba/comment.theme.php @@ -1,7 +1,7 @@ add_block(new Block(null, $body, "main", $position)); } - private function futaba_gen_page_link($base_url, $query, $page, $name) { + public function futaba_gen_page_link($base_url, $query, $page, $name) { $link = make_link("$base_url/$page", $query); return "[{$name}]"; } - private function futaba_gen_page_link_block($base_url, $query, $page, $current_page, $name) { + public function futaba_gen_page_link_block($base_url, $query, $page, $current_page, $name) { $paginator = ""; if($page == $current_page) $paginator .= ""; $paginator .= $this->futaba_gen_page_link($base_url, $query, $page, $name); @@ -22,7 +22,7 @@ class Themelet extends BaseThemelet { return $paginator; } - private function futaba_build_paginator($current_page, $total_pages, $base_url, $query) { + 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); @@ -30,11 +30,11 @@ class Themelet extends BaseThemelet { $at_start = ($current_page <= 1 || $total_pages <= 1); $at_end = ($current_page >= $total_pages); - //$first_html = $at_start ? "First" : $this->litetheme_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->litetheme_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->litetheme_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; diff --git a/themes/lite/themelet.class.php b/themes/lite/themelet.class.php index 631ef171..2c10869f 100644 --- a/themes/lite/themelet.class.php +++ b/themes/lite/themelet.class.php @@ -20,12 +20,12 @@ class Themelet extends BaseThemelet { $page->add_block(new Block(null, $body, "main", 90)); } - private function litetheme_gen_page_link($base_url, $query, $page, $name, $link_class=null) { + public function litetheme_gen_page_link($base_url, $query, $page, $name, $link_class=null) { $link = make_link("$base_url/$page", $query); return "$name"; } - private function litetheme_gen_page_link_block($base_url, $query, $page, $current_page, $name) { + public function litetheme_gen_page_link_block($base_url, $query, $page, $current_page, $name) { $paginator = ""; if($page == $current_page) {$link_class = "tab-selected";} else {$link_class = "";} @@ -34,7 +34,7 @@ class Themelet extends BaseThemelet { return $paginator; } - private function litetheme_build_paginator($current_page, $total_pages, $base_url, $query) { + public function litetheme_build_paginator($current_page, $total_pages, $base_url, $query) { $next = $current_page + 1; $prev = $current_page - 1; $rand = mt_rand(1, $total_pages);