@@ -131,6 +131,9 @@ |
||
| 131 | 131 | self::send($array); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | + /** |
|
| 135 | + * @param string[] $array |
|
| 136 | + */ |
|
| 134 | 137 | private static function send($array, $gzip = true) |
| 135 | 138 | { |
| 136 | 139 | if($gzip) |
@@ -3,86 +3,86 @@ |
||
| 3 | 3 | final class Header |
| 4 | 4 | { |
| 5 | 5 | |
| 6 | - public static function sendJSON() |
|
| 7 | - { |
|
| 8 | - $array = array( |
|
| 9 | - 'HTTP/1.1 200 OK', |
|
| 10 | - 'Cache-Control: no-cache', |
|
| 11 | - 'Content-Language: en', |
|
| 12 | - 'Content-Type: application/json', |
|
| 13 | - 'Expires: ' . self::get_date(time() - 1), |
|
| 14 | - 'Last-Modified: ' . self::get_date(), |
|
| 15 | - 'X-Powered-By: jacobemerick.com'); |
|
| 16 | - self::send($array); |
|
| 17 | - } |
|
| 6 | + public static function sendJSON() |
|
| 7 | + { |
|
| 8 | + $array = array( |
|
| 9 | + 'HTTP/1.1 200 OK', |
|
| 10 | + 'Cache-Control: no-cache', |
|
| 11 | + 'Content-Language: en', |
|
| 12 | + 'Content-Type: application/json', |
|
| 13 | + 'Expires: ' . self::get_date(time() - 1), |
|
| 14 | + 'Last-Modified: ' . self::get_date(), |
|
| 15 | + 'X-Powered-By: jacobemerick.com'); |
|
| 16 | + self::send($array); |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - public static function sendHTML() |
|
| 20 | - { |
|
| 21 | - $array = array( |
|
| 22 | - 'HTTP/1.1 200 OK', |
|
| 23 | - 'Cache-Control: no-cache', |
|
| 24 | - 'Content-Language: en', |
|
| 25 | - 'Content-Type: text/html', |
|
| 26 | - 'Expires: ' . self::get_date(time() - 1), |
|
| 27 | - 'Last-Modified: ' . self::get_date(), |
|
| 28 | - 'X-Powered-By: jacobemerick.com'); |
|
| 29 | - self::send($array); |
|
| 30 | - } |
|
| 19 | + public static function sendHTML() |
|
| 20 | + { |
|
| 21 | + $array = array( |
|
| 22 | + 'HTTP/1.1 200 OK', |
|
| 23 | + 'Cache-Control: no-cache', |
|
| 24 | + 'Content-Language: en', |
|
| 25 | + 'Content-Type: text/html', |
|
| 26 | + 'Expires: ' . self::get_date(time() - 1), |
|
| 27 | + 'Last-Modified: ' . self::get_date(), |
|
| 28 | + 'X-Powered-By: jacobemerick.com'); |
|
| 29 | + self::send($array); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - public static function redirect($location, $method = 301) |
|
| 33 | - { |
|
| 34 | - header("Location: {$location}", TRUE, $method); |
|
| 35 | - exit(); |
|
| 36 | - } |
|
| 32 | + public static function redirect($location, $method = 301) |
|
| 33 | + { |
|
| 34 | + header("Location: {$location}", TRUE, $method); |
|
| 35 | + exit(); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public static function send404() |
|
| 39 | - { |
|
| 40 | - $array = array( |
|
| 41 | - 'HTTP/1.1 404 Not Found', |
|
| 42 | - 'Cache-Control: no-cache', |
|
| 43 | - 'Content-Language: en', |
|
| 44 | - 'Content-Type: text/html', |
|
| 45 | - 'Expires: ' . self::get_date(time() - 1), |
|
| 46 | - 'Last-Modified: ' . self::get_date(), |
|
| 47 | - 'X-Powered-By: jacobemerick.com'); |
|
| 48 | - self::send($array); |
|
| 49 | - } |
|
| 38 | + public static function send404() |
|
| 39 | + { |
|
| 40 | + $array = array( |
|
| 41 | + 'HTTP/1.1 404 Not Found', |
|
| 42 | + 'Cache-Control: no-cache', |
|
| 43 | + 'Content-Language: en', |
|
| 44 | + 'Content-Type: text/html', |
|
| 45 | + 'Expires: ' . self::get_date(time() - 1), |
|
| 46 | + 'Last-Modified: ' . self::get_date(), |
|
| 47 | + 'X-Powered-By: jacobemerick.com'); |
|
| 48 | + self::send($array); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - public static function send503() |
|
| 52 | - { |
|
| 53 | - $array = array( |
|
| 54 | - 'HTTP/1.1 503 Service Unavailable', |
|
| 55 | - 'Cache-Control: no-cache', |
|
| 56 | - 'Content-Language: en', |
|
| 57 | - 'Content-Type: text/html', |
|
| 58 | - 'Expires: ' . self::get_date(time() - 1), |
|
| 59 | - 'Last-Modified: ' . self::get_date(), |
|
| 60 | - 'X-Powered-By: jacobemerick.com'); |
|
| 61 | - self::send($array); |
|
| 62 | - } |
|
| 51 | + public static function send503() |
|
| 52 | + { |
|
| 53 | + $array = array( |
|
| 54 | + 'HTTP/1.1 503 Service Unavailable', |
|
| 55 | + 'Cache-Control: no-cache', |
|
| 56 | + 'Content-Language: en', |
|
| 57 | + 'Content-Type: text/html', |
|
| 58 | + 'Expires: ' . self::get_date(time() - 1), |
|
| 59 | + 'Last-Modified: ' . self::get_date(), |
|
| 60 | + 'X-Powered-By: jacobemerick.com'); |
|
| 61 | + self::send($array); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - private static function send($array, $gzip = true) |
|
| 65 | - { |
|
| 66 | - if($gzip) |
|
| 67 | - self::start_gzipping(); |
|
| 64 | + private static function send($array, $gzip = true) |
|
| 65 | + { |
|
| 66 | + if($gzip) |
|
| 67 | + self::start_gzipping(); |
|
| 68 | 68 | |
| 69 | - foreach($array as $row) |
|
| 70 | - { |
|
| 71 | - header($row, TRUE); |
|
| 72 | - } |
|
| 73 | - } |
|
| 69 | + foreach($array as $row) |
|
| 70 | + { |
|
| 71 | + header($row, TRUE); |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - private static function get_date($timestamp = false) |
|
| 76 | - { |
|
| 77 | - if($timestamp == 0) |
|
| 78 | - $timestamp = time(); |
|
| 79 | - return gmdate('D, d M Y H:i:s \G\M\T', $timestamp); |
|
| 80 | - } |
|
| 75 | + private static function get_date($timestamp = false) |
|
| 76 | + { |
|
| 77 | + if($timestamp == 0) |
|
| 78 | + $timestamp = time(); |
|
| 79 | + return gmdate('D, d M Y H:i:s \G\M\T', $timestamp); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - private static function start_gzipping() |
|
| 83 | - { |
|
| 84 | - if(!ob_start('ob_gzhandler')) |
|
| 82 | + private static function start_gzipping() |
|
| 83 | + { |
|
| 84 | + if(!ob_start('ob_gzhandler')) |
|
| 85 | 85 | ob_start(); |
| 86 | - } |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | 88 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | protected $connections; |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * @param Aura\Sql\ConnectionLocator $connections |
|
| 14 | + * @param ConnectionLocator $connections |
|
| 15 | 15 | */ |
| 16 | 16 | public function __construct(ConnectionLocator $connections) |
| 17 | 17 | { |
@@ -41,6 +41,9 @@ discard block |
||
| 41 | 41 | ->fetchOne($query, $bindings); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | + /** |
|
| 45 | + * @param integer $limit |
|
| 46 | + */ |
|
| 44 | 47 | public function getActivePosts($limit = null, $offset = 0) |
| 45 | 48 | { |
| 46 | 49 | $query = " |
@@ -79,6 +82,9 @@ discard block |
||
| 79 | 82 | ->fetchValue($query, $bindings); |
| 80 | 83 | } |
| 81 | 84 | |
| 85 | + /** |
|
| 86 | + * @param integer $limit |
|
| 87 | + */ |
|
| 82 | 88 | public function getActivePostsByTag($tag, $limit = null, $offset = 0) |
| 83 | 89 | { |
| 84 | 90 | $query = " |
@@ -122,6 +128,9 @@ discard block |
||
| 122 | 128 | ->fetchValue($query, $bindings); |
| 123 | 129 | } |
| 124 | 130 | |
| 131 | + /** |
|
| 132 | + * @param integer $limit |
|
| 133 | + */ |
|
| 125 | 134 | public function getActivePostsByCategory($category, $limit = null, $offset = 0) |
| 126 | 135 | { |
| 127 | 136 | $query = " |
@@ -5,9 +5,9 @@ discard block |
||
| 5 | 5 | final class PhotoCollector extends Collector |
| 6 | 6 | { |
| 7 | 7 | |
| 8 | - public static function fetchRow($category, $photo) |
|
| 9 | - { |
|
| 10 | - $query = " |
|
| 8 | + public static function fetchRow($category, $photo) |
|
| 9 | + { |
|
| 10 | + $query = " |
|
| 11 | 11 | SELECT |
| 12 | 12 | `photo`.`name`, |
| 13 | 13 | `photo_category`.`name` AS `category`, |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | `photo`.`name` = '{$photo}' && |
| 25 | 25 | `photo_category`.`name` = '{$category}' |
| 26 | 26 | LIMIT 1"; |
| 27 | - return self::run_row_query($query); |
|
| 28 | - } |
|
| 27 | + return self::run_row_query($query); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public static function getRow($id) |
|
| 31 | - { |
|
| 32 | - $query = " |
|
| 30 | + public static function getRow($id) |
|
| 31 | + { |
|
| 32 | + $query = " |
|
| 33 | 33 | SELECT |
| 34 | 34 | `photo`.`name`, |
| 35 | 35 | `photo_category`.`name` AS `category`, |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | `photo`.`photographer` = `photographer`.`id` && |
| 46 | 46 | `photo`.`id` = '{$id}' |
| 47 | 47 | LIMIT 1"; |
| 48 | - return self::run_row_query($query); |
|
| 49 | - } |
|
| 48 | + return self::run_row_query($query); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | } |
@@ -5,9 +5,9 @@ discard block |
||
| 5 | 5 | final class AlbumCollector extends Collector |
| 6 | 6 | { |
| 7 | 7 | |
| 8 | - public static function getPhotoListForAlbum($album) |
|
| 9 | - { |
|
| 10 | - $query = " |
|
| 8 | + public static function getPhotoListForAlbum($album) |
|
| 9 | + { |
|
| 10 | + $query = " |
|
| 11 | 11 | SELECT |
| 12 | 12 | `photo`.`name`, |
| 13 | 13 | `photo_category`.`name` AS `category`, |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | ORDER BY |
| 39 | 39 | `photo`.`date_taken`"; |
| 40 | 40 | |
| 41 | - return self::run_query($query); |
|
| 42 | - } |
|
| 41 | + return self::run_query($query); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | } |
| 45 | 45 | \ No newline at end of file |
@@ -5,9 +5,9 @@ discard block |
||
| 5 | 5 | final class WatercourseCollector extends Collector |
| 6 | 6 | { |
| 7 | 7 | |
| 8 | - public static function getById($id) |
|
| 9 | - { |
|
| 10 | - $query = " |
|
| 8 | + public static function getById($id) |
|
| 9 | + { |
|
| 10 | + $query = " |
|
| 11 | 11 | SELECT |
| 12 | 12 | `watercourse`.`name`, |
| 13 | 13 | `watercourse`.`alias` |
@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | `watercourse`.`id` = '{$id}' |
| 18 | 18 | LIMIT 1"; |
| 19 | 19 | |
| 20 | - return self::run_row_query($query); |
|
| 21 | - } |
|
| 20 | + return self::run_row_query($query); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public static function getByAlias($alias) |
|
| 24 | - { |
|
| 25 | - $alias = self::escape($alias); |
|
| 23 | + public static function getByAlias($alias) |
|
| 24 | + { |
|
| 25 | + $alias = self::escape($alias); |
|
| 26 | 26 | |
| 27 | - $query = " |
|
| 27 | + $query = " |
|
| 28 | 28 | SELECT |
| 29 | 29 | `watercourse`.`id`, |
| 30 | 30 | `watercourse`.`name`, |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | `watercourse`.`alias` = '{$alias}' |
| 49 | 49 | LIMIT 1"; |
| 50 | 50 | |
| 51 | - return self::run_row_query($query); |
|
| 52 | - } |
|
| 51 | + return self::run_row_query($query); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - public static function getWatercourseList() |
|
| 55 | - { |
|
| 56 | - $query = " |
|
| 54 | + public static function getWatercourseList() |
|
| 55 | + { |
|
| 56 | + $query = " |
|
| 57 | 57 | SELECT |
| 58 | 58 | `sum_table`.`name`, |
| 59 | 59 | `sum_table`.`alias`, |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | ORDER BY |
| 112 | 112 | `sum_table`.`name`"; |
| 113 | 113 | |
| 114 | - return self::run_query($query); |
|
| 115 | - } |
|
| 114 | + return self::run_query($query); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - public static function getLogListForWatercourse($watercourse, $total, $offset = 0) |
|
| 118 | - { |
|
| 119 | - $query = " |
|
| 117 | + public static function getLogListForWatercourse($watercourse, $total, $offset = 0) |
|
| 118 | + { |
|
| 119 | + $query = " |
|
| 120 | 120 | SELECT |
| 121 | 121 | `waterfall`.`id`, |
| 122 | 122 | `waterfall`.`name`, |
@@ -150,16 +150,16 @@ discard block |
||
| 150 | 150 | `watercourse` |
| 151 | 151 | LIMIT |
| 152 | 152 | {$offset}, {$total}"; |
| 153 | - return self::run_query($query); |
|
| 154 | - } |
|
| 153 | + return self::run_query($query); |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | 156 | public static function getParentWatercourse($watercourse) |
| 157 | 157 | { |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - public static function getLogCountForWatercourse($watercourse) |
|
| 161 | - { |
|
| 162 | - $query = " |
|
| 160 | + public static function getLogCountForWatercourse($watercourse) |
|
| 161 | + { |
|
| 162 | + $query = " |
|
| 163 | 163 | SELECT |
| 164 | 164 | SUM(`count`) AS `count` |
| 165 | 165 | FROM |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | ) |
| 207 | 207 | ) AS `sum_table`"; |
| 208 | 208 | |
| 209 | - return self::get_count($query); |
|
| 210 | - } |
|
| 209 | + return self::get_count($query); |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | 212 | } |
| 213 | 213 | \ No newline at end of file |
@@ -5,11 +5,11 @@ discard block |
||
| 5 | 5 | final class CompanionCollector extends Collector |
| 6 | 6 | { |
| 7 | 7 | |
| 8 | - public static function getByAlias($alias) |
|
| 9 | - { |
|
| 10 | - $alias = self::escape($alias); |
|
| 8 | + public static function getByAlias($alias) |
|
| 9 | + { |
|
| 10 | + $alias = self::escape($alias); |
|
| 11 | 11 | |
| 12 | - $query = " |
|
| 12 | + $query = " |
|
| 13 | 13 | SELECT |
| 14 | 14 | `companion`.`id`, |
| 15 | 15 | `companion`.`name`, |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | `companion`.`alias` = '{$alias}' |
| 33 | 33 | LIMIT 1"; |
| 34 | 34 | |
| 35 | - return self::run_row_query($query); |
|
| 36 | - } |
|
| 35 | + return self::run_row_query($query); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public static function getCompanionList() |
|
| 39 | - { |
|
| 40 | - $query = " |
|
| 38 | + public static function getCompanionList() |
|
| 39 | + { |
|
| 40 | + $query = " |
|
| 41 | 41 | SELECT |
| 42 | 42 | `companion`.`name`, |
| 43 | 43 | `companion`.`alias`, |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | ORDER BY |
| 58 | 58 | `companion`.`name`"; |
| 59 | 59 | |
| 60 | - return self::run_query($query); |
|
| 61 | - } |
|
| 60 | + return self::run_query($query); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - public static function getLogListForCompanion($companion, $total, $offset = 0) |
|
| 64 | - { |
|
| 65 | - $query = " |
|
| 63 | + public static function getLogListForCompanion($companion, $total, $offset = 0) |
|
| 64 | + { |
|
| 65 | + $query = " |
|
| 66 | 66 | SELECT |
| 67 | 67 | `log`.`id`, |
| 68 | 68 | `log`.`title`, |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | `log`.`date` DESC |
| 91 | 91 | LIMIT |
| 92 | 92 | {$offset}, {$total}"; |
| 93 | - return self::run_query($query); |
|
| 94 | - } |
|
| 93 | + return self::run_query($query); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - public static function getLogCountForCompanion($companion) |
|
| 97 | - { |
|
| 98 | - $query = " |
|
| 96 | + public static function getLogCountForCompanion($companion) |
|
| 97 | + { |
|
| 98 | + $query = " |
|
| 99 | 99 | SELECT |
| 100 | 100 | COUNT(1) AS `count` |
| 101 | 101 | FROM |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | WHERE |
| 107 | 107 | `log_companion_map`.`companion` = '{$companion}' && |
| 108 | 108 | `log`.`is_public` = '1'"; |
| 109 | - return self::get_count($query); |
|
| 110 | - } |
|
| 109 | + return self::get_count($query); |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | 112 | } |
| 113 | 113 | \ No newline at end of file |
@@ -5,11 +5,11 @@ discard block |
||
| 5 | 5 | final class PeriodCollector extends Collector |
| 6 | 6 | { |
| 7 | 7 | |
| 8 | - public static function getByAlias($alias) |
|
| 9 | - { |
|
| 10 | - $alias = self::escape($alias); |
|
| 8 | + public static function getByAlias($alias) |
|
| 9 | + { |
|
| 10 | + $alias = self::escape($alias); |
|
| 11 | 11 | |
| 12 | - $query = " |
|
| 12 | + $query = " |
|
| 13 | 13 | SELECT |
| 14 | 14 | `period`.`id`, |
| 15 | 15 | `period`.`name`, |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | WHERE |
| 32 | 32 | `period`.`alias` = '{$alias}' |
| 33 | 33 | LIMIT 1"; |
| 34 | - return self::run_row_query($query); |
|
| 35 | - } |
|
| 34 | + return self::run_row_query($query); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - public static function getPeriodList() |
|
| 38 | - { |
|
| 39 | - $query = " |
|
| 37 | + public static function getPeriodList() |
|
| 38 | + { |
|
| 39 | + $query = " |
|
| 40 | 40 | SELECT |
| 41 | 41 | `period`.`name`, |
| 42 | 42 | `period`.`alias`, |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | `period`.`alias` |
| 53 | 53 | ORDER BY |
| 54 | 54 | `period`.`id`"; |
| 55 | - return self::run_query($query); |
|
| 56 | - } |
|
| 55 | + return self::run_query($query); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - public static function getLogListForPeriod($period, $total, $offset = 0) |
|
| 59 | - { |
|
| 60 | - $query = " |
|
| 58 | + public static function getLogListForPeriod($period, $total, $offset = 0) |
|
| 59 | + { |
|
| 60 | + $query = " |
|
| 61 | 61 | SELECT |
| 62 | 62 | `log`.`id`, |
| 63 | 63 | `log`.`title`, |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | LIMIT |
| 84 | 84 | {$offset}, {$total}"; |
| 85 | 85 | |
| 86 | - return self::run_query($query); |
|
| 87 | - } |
|
| 86 | + return self::run_query($query); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - public static function getLogCountForPeriod($period) |
|
| 90 | - { |
|
| 91 | - $query = " |
|
| 89 | + public static function getLogCountForPeriod($period) |
|
| 90 | + { |
|
| 91 | + $query = " |
|
| 92 | 92 | SELECT |
| 93 | 93 | COUNT(1) AS `count` |
| 94 | 94 | FROM |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | WHERE |
| 97 | 97 | `period` = '{$period}' && |
| 98 | 98 | `is_public` = '1'"; |
| 99 | - return self::get_count($query); |
|
| 100 | - } |
|
| 99 | + return self::get_count($query); |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | 102 | } |
| 103 | 103 | \ No newline at end of file |
@@ -5,11 +5,11 @@ discard block |
||
| 5 | 5 | final class CountyCollector extends Collector |
| 6 | 6 | { |
| 7 | 7 | |
| 8 | - public static function getByAlias($alias) |
|
| 9 | - { |
|
| 10 | - $alias = self::escape($alias); |
|
| 8 | + public static function getByAlias($alias) |
|
| 9 | + { |
|
| 10 | + $alias = self::escape($alias); |
|
| 11 | 11 | |
| 12 | - $query = " |
|
| 12 | + $query = " |
|
| 13 | 13 | SELECT |
| 14 | 14 | `county`.`id`, |
| 15 | 15 | `county`.`name`, |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | `county`.`alias` = '{$alias}' |
| 33 | 33 | LIMIT 1"; |
| 34 | 34 | |
| 35 | - return self::run_row_query($query); |
|
| 36 | - } |
|
| 35 | + return self::run_row_query($query); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public static function getCountyList() |
|
| 39 | - { |
|
| 40 | - $query = " |
|
| 38 | + public static function getCountyList() |
|
| 39 | + { |
|
| 40 | + $query = " |
|
| 41 | 41 | SELECT |
| 42 | 42 | `county`.`name`, |
| 43 | 43 | `county`.`alias`, |
@@ -54,12 +54,12 @@ discard block |
||
| 54 | 54 | ORDER BY |
| 55 | 55 | `county`.`name`"; |
| 56 | 56 | |
| 57 | - return self::run_query($query); |
|
| 58 | - } |
|
| 57 | + return self::run_query($query); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - public static function getLogListForCounty($county, $total, $offset = 0) |
|
| 61 | - { |
|
| 62 | - $query = " |
|
| 60 | + public static function getLogListForCounty($county, $total, $offset = 0) |
|
| 61 | + { |
|
| 62 | + $query = " |
|
| 63 | 63 | SELECT |
| 64 | 64 | `waterfall`.`id`, |
| 65 | 65 | `waterfall`.`name`, |
@@ -93,12 +93,12 @@ discard block |
||
| 93 | 93 | `watercourse`.`name` |
| 94 | 94 | LIMIT |
| 95 | 95 | {$offset}, {$total}"; |
| 96 | - return self::run_query($query); |
|
| 97 | - } |
|
| 96 | + return self::run_query($query); |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - public static function getLogCountForCounty($county) |
|
| 100 | - { |
|
| 101 | - $query = " |
|
| 99 | + public static function getLogCountForCounty($county) |
|
| 100 | + { |
|
| 101 | + $query = " |
|
| 102 | 102 | SELECT |
| 103 | 103 | COUNT(1) AS `count` |
| 104 | 104 | FROM |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | WHERE |
| 110 | 110 | `waterfall`.`county` = '{$county}' && |
| 111 | 111 | `waterfall`.`is_public` = '1'"; |
| 112 | - return self::get_count($query); |
|
| 113 | - } |
|
| 112 | + return self::get_count($query); |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | \ No newline at end of file |
@@ -5,9 +5,9 @@ discard block |
||
| 5 | 5 | final class LogCollector extends Collector |
| 6 | 6 | { |
| 7 | 7 | |
| 8 | - public static function getList($total, $offset = 0) |
|
| 9 | - { |
|
| 10 | - $query = " |
|
| 8 | + public static function getList($total, $offset = 0) |
|
| 9 | + { |
|
| 10 | + $query = " |
|
| 11 | 11 | SELECT |
| 12 | 12 | `log`.`id`, |
| 13 | 13 | `log`.`title`, |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | `log`.`date` DESC |
| 32 | 32 | LIMIT |
| 33 | 33 | {$offset}, {$total}"; |
| 34 | - return self::run_query($query); |
|
| 35 | - } |
|
| 34 | + return self::run_query($query); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | public static function getRecentList($total) |
| 38 | 38 | { |
@@ -62,21 +62,21 @@ discard block |
||
| 62 | 62 | return self::run_query($query); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public static function getListCount() |
|
| 66 | - { |
|
| 67 | - $query = " |
|
| 65 | + public static function getListCount() |
|
| 66 | + { |
|
| 67 | + $query = " |
|
| 68 | 68 | SELECT |
| 69 | 69 | COUNT(1) AS `count` |
| 70 | 70 | FROM |
| 71 | 71 | `jpemeric_waterfall`.`log` |
| 72 | 72 | WHERE |
| 73 | 73 | `is_public` = '1'"; |
| 74 | - return self::get_count($query); |
|
| 75 | - } |
|
| 74 | + return self::get_count($query); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - public static function getCompanionListForLog($log) |
|
| 78 | - { |
|
| 79 | - $query = " |
|
| 77 | + public static function getCompanionListForLog($log) |
|
| 78 | + { |
|
| 79 | + $query = " |
|
| 80 | 80 | SELECT |
| 81 | 81 | `companion`.`name`, |
| 82 | 82 | `companion`.`alias` |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | ON `log_companion_map`.`companion` = `companion`.`id` |
| 88 | 88 | WHERE |
| 89 | 89 | `log_companion_map`.`log` = '{$log}'"; |
| 90 | - return self::run_query($query); |
|
| 91 | - } |
|
| 90 | + return self::run_query($query); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - public static function getWaterfallListForLog($log) |
|
| 94 | - { |
|
| 95 | - $query = " |
|
| 93 | + public static function getWaterfallListForLog($log) |
|
| 94 | + { |
|
| 95 | + $query = " |
|
| 96 | 96 | SELECT |
| 97 | 97 | `waterfall`.`name`, |
| 98 | 98 | `waterfall`.`alias`, |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | `waterfall`.`is_public` = '1' |
| 111 | 111 | ORDER BY |
| 112 | 112 | `log_waterfall_map`.`order`"; |
| 113 | - return self::run_query($query); |
|
| 114 | - } |
|
| 113 | + return self::run_query($query); |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - public static function getLogListForWaterfall($waterfall) |
|
| 117 | - { |
|
| 118 | - $query = " |
|
| 116 | + public static function getLogListForWaterfall($waterfall) |
|
| 117 | + { |
|
| 118 | + $query = " |
|
| 119 | 119 | SELECT |
| 120 | 120 | `log`.`title`, |
| 121 | 121 | `log`.`alias`, |
@@ -130,12 +130,12 @@ discard block |
||
| 130 | 130 | `log`.`is_public` = '1' |
| 131 | 131 | ORDER BY |
| 132 | 132 | `log`.`date`"; |
| 133 | - return self::run_query($query); |
|
| 134 | - } |
|
| 133 | + return self::run_query($query); |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - public static function getTagListForLog($log) |
|
| 137 | - { |
|
| 138 | - $query = " |
|
| 136 | + public static function getTagListForLog($log) |
|
| 137 | + { |
|
| 138 | + $query = " |
|
| 139 | 139 | SELECT |
| 140 | 140 | `tag`.`name`, |
| 141 | 141 | `tag`.`alias` |
@@ -144,14 +144,14 @@ discard block |
||
| 144 | 144 | INNER JOIN |
| 145 | 145 | `jpemeric_waterfall`.`log_tag_map` |
| 146 | 146 | ON `log_tag_map`.`tag` = `tag`.`id` && `log_tag_map`.`log` = '{$log}'"; |
| 147 | - return self::run_query($query); |
|
| 148 | - } |
|
| 147 | + return self::run_query($query); |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - public static function getByAlias($alias) |
|
| 151 | - { |
|
| 152 | - $alias = self::escape($alias); |
|
| 150 | + public static function getByAlias($alias) |
|
| 151 | + { |
|
| 152 | + $alias = self::escape($alias); |
|
| 153 | 153 | |
| 154 | - $query = " |
|
| 154 | + $query = " |
|
| 155 | 155 | SELECT |
| 156 | 156 | `log`.`id`, |
| 157 | 157 | `log`.`title`, |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | `log`.`is_public` = '1' |
| 176 | 176 | LIMIT 1"; |
| 177 | 177 | |
| 178 | - return self::run_row_query($query); |
|
| 179 | - } |
|
| 178 | + return self::run_row_query($query); |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | 181 | public static function getByDate($date) |
| 182 | 182 | { |
@@ -195,9 +195,9 @@ discard block |
||
| 195 | 195 | return self::run_row_query($query); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - public static function getById($log) |
|
| 199 | - { |
|
| 200 | - $query = " |
|
| 198 | + public static function getById($log) |
|
| 199 | + { |
|
| 200 | + $query = " |
|
| 201 | 201 | SELECT |
| 202 | 202 | `title`, |
| 203 | 203 | `date`, |
@@ -208,12 +208,12 @@ discard block |
||
| 208 | 208 | `id` = '{$log}' AND |
| 209 | 209 | `is_public` = '1' |
| 210 | 210 | LIMIT 1"; |
| 211 | - return self::run_row_query($query); |
|
| 212 | - } |
|
| 211 | + return self::run_row_query($query); |
|
| 212 | + } |
|
| 213 | 213 | |
| 214 | - public static function getPreviousLog($log) |
|
| 215 | - { |
|
| 216 | - $query = " |
|
| 214 | + public static function getPreviousLog($log) |
|
| 215 | + { |
|
| 216 | + $query = " |
|
| 217 | 217 | SELECT |
| 218 | 218 | `title`, |
| 219 | 219 | `date`, |
@@ -233,12 +233,12 @@ discard block |
||
| 233 | 233 | `date` DESC |
| 234 | 234 | LIMIT 1"; |
| 235 | 235 | |
| 236 | - return self::run_row_query($query); |
|
| 237 | - } |
|
| 236 | + return self::run_row_query($query); |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | - public static function getNextLog($log) |
|
| 240 | - { |
|
| 241 | - $query = " |
|
| 239 | + public static function getNextLog($log) |
|
| 240 | + { |
|
| 241 | + $query = " |
|
| 242 | 242 | SELECT |
| 243 | 243 | `title`, |
| 244 | 244 | `date`, |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | `date` ASC |
| 259 | 259 | LIMIT 1"; |
| 260 | 260 | |
| 261 | - return self::run_row_query($query); |
|
| 262 | - } |
|
| 261 | + return self::run_row_query($query); |
|
| 262 | + } |
|
| 263 | 263 | |
| 264 | 264 | } |
@@ -34,6 +34,9 @@ discard block |
||
| 34 | 34 | return self::run_query($query); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | + /** |
|
| 38 | + * @param integer $total |
|
| 39 | + */ |
|
| 37 | 40 | public static function getRecentList($total) |
| 38 | 41 | { |
| 39 | 42 | $query = " |
@@ -178,6 +181,9 @@ discard block |
||
| 178 | 181 | return self::run_row_query($query); |
| 179 | 182 | } |
| 180 | 183 | |
| 184 | + /** |
|
| 185 | + * @param string $date |
|
| 186 | + */ |
|
| 181 | 187 | public static function getByDate($date) |
| 182 | 188 | { |
| 183 | 189 | $date = self::escape($date); |