@@ -24,8 +24,9 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public static function instance() |
| 26 | 26 | { |
| 27 | - if(!isset(self::$instance)) |
|
| 28 | - self::$instance = new Debugger(); |
|
| 27 | + if(!isset(self::$instance)) {
|
|
| 28 | + self::$instance = new Debugger(); |
|
| 29 | + } |
|
| 29 | 30 | return self::$instance; |
| 30 | 31 | } |
| 31 | 32 | |
@@ -52,12 +53,15 @@ discard block |
||
| 52 | 53 | |
| 53 | 54 | public static function internal_error($code, $string, $file = null, $line = null, $context = null) |
| 54 | 55 | { |
| 55 | - if($file == null) |
|
| 56 | - $file = self::$UNKNOWN_ERROR_FILE; |
|
| 57 | - if($line == null) |
|
| 58 | - $line = self::$UNKNOWN_ERROR_LINE; |
|
| 59 | - if($context == null) |
|
| 60 | - $context = self::$UNKNOWN_ERROR_CONTEXT; |
|
| 56 | + if($file == null) {
|
|
| 57 | + $file = self::$UNKNOWN_ERROR_FILE; |
|
| 58 | + } |
|
| 59 | + if($line == null) {
|
|
| 60 | + $line = self::$UNKNOWN_ERROR_LINE; |
|
| 61 | + } |
|
| 62 | + if($context == null) {
|
|
| 63 | + $context = self::$UNKNOWN_ERROR_CONTEXT; |
|
| 64 | + } |
|
| 61 | 65 | |
| 62 | 66 | self::instance()->console->logError(new Exception($string), "{$string}... TYPE: {$code}"); |
| 63 | 67 | |
@@ -68,8 +72,9 @@ discard block |
||
| 68 | 72 | { |
| 69 | 73 | $error = error_get_last(); |
| 70 | 74 | |
| 71 | - if(isset($error)) |
|
| 72 | - self::internal_error($error['type'], $error['message'], $error['file'], $error['line']); |
|
| 75 | + if(isset($error)) {
|
|
| 76 | + self::internal_error($error['type'], $error['message'], $error['file'], $error['line']); |
|
| 77 | + } |
|
| 73 | 78 | |
| 74 | 79 | self::display(); |
| 75 | 80 | return true; |
@@ -57,8 +57,7 @@ |
||
| 57 | 57 | |
| 58 | 58 | Loader::load('utility', 'Content'); |
| 59 | 59 | $uri = Content::instance('URLSafe', "/{$post->category}/{$post->title_url}/")->activate(); |
| 60 | - } |
|
| 61 | - else |
|
| 60 | + } else |
|
| 62 | 61 | { |
| 63 | 62 | $post_uri = URLDecode::getPiece(1); |
| 64 | 63 | if($post_uri !== null) |
@@ -163,10 +163,11 @@ |
||
| 163 | 163 | { |
| 164 | 164 | $path = self::escape($path); |
| 165 | 165 | |
| 166 | - if($commenter != 0) |
|
| 167 | - $trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')"; |
|
| 168 | - else |
|
| 169 | - $trusted_commenter_clause = "`commenter`.`trusted` = '1'"; |
|
| 166 | + if($commenter != 0) {
|
|
| 167 | + $trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')";
|
|
| 168 | + } else {
|
|
| 169 | + $trusted_commenter_clause = "`commenter`.`trusted` = '1'"; |
|
| 170 | + } |
|
| 170 | 171 | |
| 171 | 172 | $query = " |
| 172 | 173 | SELECT |
@@ -18,10 +18,11 @@ |
||
| 18 | 18 | |
| 19 | 19 | foreach($pieces as $piece) |
| 20 | 20 | { |
| 21 | - if($piece->category == 1) |
|
| 22 | - $this->addURL("web/{$piece->title_url}/", date('Y-01-01'), 'yearly', .7); |
|
| 23 | - else |
|
| 24 | - $this->addURL("print/{$piece->title_url}/", date('Y-01-01'), 'yearly', .7); |
|
| 21 | + if($piece->category == 1) {
|
|
| 22 | + $this->addURL("web/{$piece->title_url}/", date('Y-01-01'), 'yearly', .7);
|
|
| 23 | + } else {
|
|
| 24 | + $this->addURL("print/{$piece->title_url}/", date('Y-01-01'), 'yearly', .7);
|
|
| 25 | + } |
|
| 25 | 26 | } |
| 26 | 27 | } |
| 27 | 28 | |
@@ -22,8 +22,9 @@ |
||
| 22 | 22 | |
| 23 | 23 | protected function addURL($loc, $lastmod = false, $changefreq = 'monthly', $priority = .5) |
| 24 | 24 | { |
| 25 | - if(!$lastmod) |
|
| 26 | - $lastmod = $this->default_lastmod; |
|
| 25 | + if(!$lastmod) {
|
|
| 26 | + $lastmod = $this->default_lastmod; |
|
| 27 | + } |
|
| 27 | 28 | |
| 28 | 29 | $url = $this->xml->addChild('url'); |
| 29 | 30 | |
@@ -14,20 +14,27 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | protected function set_data() |
| 16 | 16 | { |
| 17 | - if(!Validate::checkRequest('post', 'name', 'name')) |
|
| 18 | - return $this->fail_response('You must include a valid name.'); |
|
| 19 | - if(!Validate::checkRequest('post', 'email', 'email')) |
|
| 20 | - return $this->fail_response('You must include a valid email.'); |
|
| 21 | - if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url')) |
|
| 22 | - return $this->fail_response('Please include a valid website.'); |
|
| 23 | - if(!Validate::checkRequest('post', 'comment', 'string')) |
|
| 24 | - return $this->fail_response('You must enter a comment.'); |
|
| 25 | - if(!Validate::checkRequest('post', 'save', 'boolean')) |
|
| 26 | - return $this->fail_response('You entered an invalid save request.'); |
|
| 27 | - if(!Validate::checkRequest('post', 'notify', 'boolean')) |
|
| 28 | - return $this->fail_response('You entered an invalid notify request.'); |
|
| 29 | - if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer')) |
|
| 30 | - return $this->fail_response('You entered an invalid reply value.'); |
|
| 17 | + if(!Validate::checkRequest('post', 'name', 'name')) {
|
|
| 18 | + return $this->fail_response('You must include a valid name.');
|
|
| 19 | + } |
|
| 20 | + if(!Validate::checkRequest('post', 'email', 'email')) {
|
|
| 21 | + return $this->fail_response('You must include a valid email.');
|
|
| 22 | + } |
|
| 23 | + if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url')) {
|
|
| 24 | + return $this->fail_response('Please include a valid website.');
|
|
| 25 | + } |
|
| 26 | + if(!Validate::checkRequest('post', 'comment', 'string')) {
|
|
| 27 | + return $this->fail_response('You must enter a comment.');
|
|
| 28 | + } |
|
| 29 | + if(!Validate::checkRequest('post', 'save', 'boolean')) {
|
|
| 30 | + return $this->fail_response('You entered an invalid save request.');
|
|
| 31 | + } |
|
| 32 | + if(!Validate::checkRequest('post', 'notify', 'boolean')) {
|
|
| 33 | + return $this->fail_response('You entered an invalid notify request.');
|
|
| 34 | + } |
|
| 35 | + if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer')) {
|
|
| 36 | + return $this->fail_response('You entered an invalid reply value.');
|
|
| 37 | + } |
|
| 31 | 38 | |
| 32 | 39 | $referer_url = Request::getServer('HTTP_REFERER'); |
| 33 | 40 | $url = explode('/', $referer_url); |
@@ -35,8 +42,9 @@ discard block |
||
| 35 | 42 | $url = array_pop($url); |
| 36 | 43 | $post = PostCollector::getPostByURI($url); |
| 37 | 44 | |
| 38 | - if($post === null) |
|
| 39 | - return $this->fail_response('There seems to be a problem with this page.', 'error'); |
|
| 45 | + if($post === null) {
|
|
| 46 | + return $this->fail_response('There seems to be a problem with this page.', 'error');
|
|
| 47 | + } |
|
| 40 | 48 | |
| 41 | 49 | $commentpage_result = CommentCollector::getCommentPageByURL($post->path, 2); |
| 42 | 50 | if($commentpage_result === null) |
@@ -49,9 +57,9 @@ discard block |
||
| 49 | 57 | $query = sprintf($query, $site_id, $url); |
| 50 | 58 | Database::execute($query); |
| 51 | 59 | $commentpage_id = Database::lastInsertID(); |
| 52 | - } |
|
| 53 | - else |
|
| 54 | - $commentpage_id = $commentpage_result->id; |
|
| 60 | + } else {
|
|
| 61 | + $commentpage_id = $commentpage_result->id; |
|
| 62 | + } |
|
| 55 | 63 | |
| 56 | 64 | $save = (Request::getPost('save') == 'true') ? 1 : 0; |
| 57 | 65 | |
@@ -67,8 +75,7 @@ discard block |
||
| 67 | 75 | $query = sprintf($query, $name, $email, $website, $save); |
| 68 | 76 | Database::execute($query); |
| 69 | 77 | $commenter_id = Database::lastInsertID(); |
| 70 | - } |
|
| 71 | - else |
|
| 78 | + } else |
|
| 72 | 79 | { |
| 73 | 80 | if($commenter_result->save !== $save) |
| 74 | 81 | { |
@@ -90,9 +97,9 @@ discard block |
||
| 90 | 97 | $query = sprintf($query, $body); |
| 91 | 98 | Database::execute($query); |
| 92 | 99 | $comment_id = Database::lastInsertID(); |
| 93 | - } |
|
| 94 | - else |
|
| 95 | - $comment_id = $comment_result->id; |
|
| 100 | + } else {
|
|
| 101 | + $comment_id = $comment_result->id; |
|
| 102 | + } |
|
| 96 | 103 | |
| 97 | 104 | $query = "INSERT INTO `jpemeric_comment`.`comment_meta` (`commenter_id`,`comment_id`,`reply`,`notify`,`commentpage_id`,`date`,`display`) VALUES ('%d','%d','%d','%d','%d','%s','%d')"; |
| 98 | 105 | |
@@ -114,8 +121,9 @@ discard block |
||
| 114 | 121 | |
| 115 | 122 | foreach($notification_result as $notification_row) |
| 116 | 123 | { |
| 117 | - if($notification_row->email == $email) |
|
| 118 | - continue; |
|
| 124 | + if($notification_row->email == $email) {
|
|
| 125 | + continue; |
|
| 126 | + } |
|
| 119 | 127 | |
| 120 | 128 | $email_recipient_array[$notification_row->email] = array( |
| 121 | 129 | 'email' => $notification_row->email, |
@@ -112,8 +112,9 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $album = array(); |
| 114 | 114 | |
| 115 | - if($this->waterfall->album == 0) |
|
| 116 | - return $album; |
|
| 115 | + if($this->waterfall->album == 0) {
|
|
| 116 | + return $album; |
|
| 117 | + } |
|
| 117 | 118 | |
| 118 | 119 | $photo_list = AlbumCollector::getPhotoListForAlbum($this->waterfall->album); |
| 119 | 120 | foreach($photo_list as $photo) |
@@ -122,10 +123,11 @@ discard block |
||
| 122 | 123 | $photo_array['full_link'] = sprintf(self::$FULL_IMAGE_LINK, $photo->category, $photo->name); |
| 123 | 124 | $photo_array['description'] = $photo->description; |
| 124 | 125 | |
| 125 | - if($photo->height < $photo->width) |
|
| 126 | - list($height, $width) = array(75, 100); |
|
| 127 | - else |
|
| 128 | - list($height, $width) = array(100, 75); |
|
| 126 | + if($photo->height < $photo->width) {
|
|
| 127 | + list($height, $width) = array(75, 100); |
|
| 128 | + } else {
|
|
| 129 | + list($height, $width) = array(100, 75); |
|
| 130 | + } |
|
| 129 | 131 | |
| 130 | 132 | $photo_array['image_node'] = sprintf( |
| 131 | 133 | self::$THUMB_IMAGE_NODE, |
@@ -28,8 +28,9 @@ |
||
| 28 | 28 | $path = URLDecode::getPiece(1); |
| 29 | 29 | $this->county = CountyCollector::getByAlias($path); |
| 30 | 30 | |
| 31 | - if(!$this->county) |
|
| 32 | - $this->eject(); |
|
| 31 | + if(!$this->county) {
|
|
| 32 | + $this->eject(); |
|
| 33 | + } |
|
| 33 | 34 | |
| 34 | 35 | parent::__construct(); |
| 35 | 36 | } |
@@ -25,8 +25,9 @@ discard block |
||
| 25 | 25 | $log_path = URLDecode::getPiece(2); |
| 26 | 26 | |
| 27 | 27 | $this->log = LogCollector::getByAlias($log_path); |
| 28 | - if(!$this->log) |
|
| 29 | - $this->eject(); |
|
| 28 | + if(!$this->log) {
|
|
| 29 | + $this->eject(); |
|
| 30 | + } |
|
| 30 | 31 | |
| 31 | 32 | $this->parent_navigation_item = 'journal'; |
| 32 | 33 | |
@@ -182,8 +183,9 @@ discard block |
||
| 182 | 183 | { |
| 183 | 184 | $album = array(); |
| 184 | 185 | |
| 185 | - if($this->log->album == 0) |
|
| 186 | - return $album; |
|
| 186 | + if($this->log->album == 0) {
|
|
| 187 | + return $album; |
|
| 188 | + } |
|
| 187 | 189 | |
| 188 | 190 | $photo_list = AlbumCollector::getPhotoListForAlbum($this->log->album); |
| 189 | 191 | foreach($photo_list as $photo) |
@@ -192,10 +194,11 @@ discard block |
||
| 192 | 194 | $photo_array['full_link'] = sprintf(self::$FULL_IMAGE_LINK, $photo->category, $photo->name); |
| 193 | 195 | $photo_array['description'] = $photo->description; |
| 194 | 196 | |
| 195 | - if($photo->height < $photo->width) |
|
| 196 | - list($height, $width) = array(75, 100); |
|
| 197 | - else |
|
| 198 | - list($height, $width) = array(100, 75); |
|
| 197 | + if($photo->height < $photo->width) {
|
|
| 198 | + list($height, $width) = array(75, 100); |
|
| 199 | + } else {
|
|
| 200 | + list($height, $width) = array(100, 75); |
|
| 201 | + } |
|
| 199 | 202 | |
| 200 | 203 | if ($photo->description == '') { |
| 201 | 204 | Debugger::logMessage("No description for {$photo->category}/{$photo->name}"); |