@@ -13,10 +13,11 @@ discard block |
||
13 | 13 | |
14 | 14 | function __construct() |
15 | 15 | { |
16 | - if(Loader::isLive()) |
|
17 | - $handle[] = self::$live_root; |
|
18 | - else |
|
19 | - $handle[] = self::$test_root; |
|
16 | + if(Loader::isLive()) { |
|
17 | + $handle[] = self::$live_root; |
|
18 | + } else { |
|
19 | + $handle[] = self::$test_root; |
|
20 | + } |
|
20 | 21 | |
21 | 22 | $i = 0; |
22 | 23 | while(isset($handle[$i])) |
@@ -27,10 +28,12 @@ discard block |
||
27 | 28 | { |
28 | 29 | if($file != '.' && $file != '..') |
29 | 30 | { |
30 | - if(is_dir("{$path}/{$file}")) |
|
31 | - $handle[] = "{$path}/{$file}"; |
|
32 | - if($file == 'error.log') |
|
33 | - $this->error_files[] = "{$path}/{$file}"; |
|
31 | + if(is_dir("{$path}/{$file}")) { |
|
32 | + $handle[] = "{$path}/{$file}"; |
|
33 | + } |
|
34 | + if($file == 'error.log') { |
|
35 | + $this->error_files[] = "{$path}/{$file}"; |
|
36 | + } |
|
34 | 37 | } |
35 | 38 | } |
36 | 39 | closedir($fh); |
@@ -50,9 +53,9 @@ discard block |
||
50 | 53 | $contents = file_get_contents($error_file); |
51 | 54 | $message .= "{$error_file}\n{$contents}\n\n"; |
52 | 55 | } |
53 | - } |
|
54 | - else |
|
55 | - $message = 'No errors found in the flat-files!'; |
|
56 | + } else { |
|
57 | + $message = 'No errors found in the flat-files!'; |
|
58 | + } |
|
56 | 59 | |
57 | 60 | $mail = new Mail(); |
58 | 61 | $mail->setToAddress('EMAIL', 'Jacob Emerick'); |
@@ -19,13 +19,15 @@ discard block |
||
19 | 19 | |
20 | 20 | public function activate() |
21 | 21 | { |
22 | - if(!$this->xml) |
|
23 | - return $this->error('Could not connect to feed.'); |
|
22 | + if(!$this->xml) { |
|
23 | + return $this->error('Could not connect to feed.'); |
|
24 | + } |
|
24 | 25 | |
25 | 26 | foreach($this->xml->channel->item as $item) |
26 | 27 | { |
27 | - if(strtotime($item->user_read_at) <= 0) |
|
28 | - continue; |
|
28 | + if(strtotime($item->user_read_at) <= 0) { |
|
29 | + continue; |
|
30 | + } |
|
29 | 31 | |
30 | 32 | $title = $item->title; |
31 | 33 | $title = trim($title); |
@@ -42,8 +44,9 @@ discard block |
||
42 | 44 | $date_added = date('Y-m-d H:i:s', strtotime($item->user_date_created)); |
43 | 45 | |
44 | 46 | $book_result = BookCollector::getBookByFields($title, $author); |
45 | - if($book_result !== null) |
|
46 | - continue; |
|
47 | + if($book_result !== null) { |
|
48 | + continue; |
|
49 | + } |
|
47 | 50 | |
48 | 51 | $query = sprintf(self::$QUERY, $title, $author, $link, $description, $image, $date_read, $date_added); |
49 | 52 | Database::execute($query); |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | |
21 | 21 | public function activate() |
22 | 22 | { |
23 | - if(!$this->json) |
|
24 | - return $this->error('Could not connect to feed.'); |
|
23 | + if(!$this->json) { |
|
24 | + return $this->error('Could not connect to feed.'); |
|
25 | + } |
|
25 | 26 | |
26 | 27 | $count = 0; |
27 | 28 | foreach($this->json->entries as $entry) |
@@ -41,8 +42,9 @@ discard block |
||
41 | 42 | $date = date('Y-m-d H:i:s', strtotime($entry->at)); |
42 | 43 | |
43 | 44 | $distance_result = DistanceCollector::getDistanceByFields($date, $type, $distance); |
44 | - if($distance_result !== null) |
|
45 | - continue; |
|
45 | + if($distance_result !== null) { |
|
46 | + continue; |
|
47 | + } |
|
46 | 48 | |
47 | 49 | $query = sprintf(self::$QUERY, $type, $distance, $url, $felt, $title, $message, $date); |
48 | 50 | Database::execute($query); |
@@ -11,40 +11,47 @@ discard block |
||
11 | 11 | |
12 | 12 | public static function isBoolean($value, $strict = false) |
13 | 13 | { |
14 | - if($strict && ($value === true || $value === false)) |
|
15 | - return true; |
|
16 | - if(!$strict && ((bool) $value === true || (bool) $value === false)) |
|
17 | - return true; |
|
14 | + if($strict && ($value === true || $value === false)) { |
|
15 | + return true; |
|
16 | + } |
|
17 | + if(!$strict && ((bool) $value === true || (bool) $value === false)) { |
|
18 | + return true; |
|
19 | + } |
|
18 | 20 | return false; |
19 | 21 | } |
20 | 22 | |
21 | 23 | public static function isDate($value) |
22 | 24 | { |
23 | - if(strtotime($value) !== -1) |
|
24 | - return true; |
|
25 | - if(date('y', $value) !== false) |
|
26 | - return true; |
|
25 | + if(strtotime($value) !== -1) { |
|
26 | + return true; |
|
27 | + } |
|
28 | + if(date('y', $value) !== false) { |
|
29 | + return true; |
|
30 | + } |
|
27 | 31 | return false; |
28 | 32 | } |
29 | 33 | |
30 | 34 | public static function isInteger($value, $strict = false) |
31 | 35 | { |
32 | - if($strict) |
|
33 | - return is_int($value); |
|
36 | + if($strict) { |
|
37 | + return is_int($value); |
|
38 | + } |
|
34 | 39 | return (int) $value == $value; |
35 | 40 | } |
36 | 41 | |
37 | 42 | public static function isIP($value) |
38 | 43 | { |
39 | - if(self::isInteger(ip2long($value))) |
|
40 | - return true; |
|
44 | + if(self::isInteger(ip2long($value))) { |
|
45 | + return true; |
|
46 | + } |
|
41 | 47 | return false; |
42 | 48 | } |
43 | 49 | |
44 | 50 | public static function isString($value, $strict = false) |
45 | 51 | { |
46 | - if($strict) |
|
47 | - return is_string($value); |
|
52 | + if($strict) { |
|
53 | + return is_string($value); |
|
54 | + } |
|
48 | 55 | return (string) $value == $value; |
49 | 56 | } |
50 | 57 | |
@@ -67,8 +74,9 @@ discard block |
||
67 | 74 | private static function check_value($pattern, $string) |
68 | 75 | { |
69 | 76 | preg_match($pattern, $string, $matches); |
70 | - if(empty($matches)) |
|
71 | - return false; |
|
77 | + if(empty($matches)) { |
|
78 | + return false; |
|
79 | + } |
|
72 | 80 | return $matches[0] == $string; |
73 | 81 | } |
74 | 82 | |
@@ -84,8 +92,9 @@ discard block |
||
84 | 92 | break; |
85 | 93 | } |
86 | 94 | |
87 | - if($value == false) |
|
88 | - return false; |
|
95 | + if($value == false) { |
|
96 | + return false; |
|
97 | + } |
|
89 | 98 | |
90 | 99 | switch($validation) |
91 | 100 | { |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | { |
21 | 21 | if($key) |
22 | 22 | { |
23 | - if(isset(self::$server[$key])) |
|
24 | - return self::$server[$key]; |
|
23 | + if(isset(self::$server[$key])) { |
|
24 | + return self::$server[$key]; |
|
25 | + } |
|
25 | 26 | return false; |
26 | 27 | } |
27 | 28 | return self::$server; |
@@ -29,8 +30,9 @@ discard block |
||
29 | 30 | |
30 | 31 | static function isAjax() |
31 | 32 | { |
32 | - if(self::getServer(self::$AJAX_REQUEST)) |
|
33 | - return true; |
|
33 | + if(self::getServer(self::$AJAX_REQUEST)) { |
|
34 | + return true; |
|
35 | + } |
|
34 | 36 | return false; |
35 | 37 | } |
36 | 38 | |
@@ -38,8 +40,9 @@ discard block |
||
38 | 40 | { |
39 | 41 | if($key) |
40 | 42 | { |
41 | - if(isset(self::$get[$key])) |
|
42 | - return self::$get[$key]; |
|
43 | + if(isset(self::$get[$key])) { |
|
44 | + return self::$get[$key]; |
|
45 | + } |
|
43 | 46 | return false; |
44 | 47 | } |
45 | 48 | return self::$get; |
@@ -49,8 +52,9 @@ discard block |
||
49 | 52 | { |
50 | 53 | if($key) |
51 | 54 | { |
52 | - if(isset(self::$post[$key])) |
|
53 | - return self::$post[$key]; |
|
55 | + if(isset(self::$post[$key])) { |
|
56 | + return self::$post[$key]; |
|
57 | + } |
|
54 | 58 | return false; |
55 | 59 | } |
56 | 60 | return self::$post; |
@@ -42,8 +42,9 @@ discard block |
||
42 | 42 | foreach($this->result as $row) |
43 | 43 | { |
44 | 44 | $weight = $this->get_search_weight($row); |
45 | - if($weight > 0) |
|
46 | - $weighted_array[$row->id] = $weight; |
|
45 | + if($weight > 0) { |
|
46 | + $weighted_array[$row->id] = $weight; |
|
47 | + } |
|
47 | 48 | } |
48 | 49 | arsort($weighted_array); |
49 | 50 | |
@@ -52,8 +53,9 @@ discard block |
||
52 | 53 | { |
53 | 54 | foreach($this->result as $row) |
54 | 55 | { |
55 | - if($row->id == $id) |
|
56 | - $final_array[] = $row; |
|
56 | + if($row->id == $id) { |
|
57 | + $final_array[] = $row; |
|
58 | + } |
|
57 | 59 | } |
58 | 60 | } |
59 | 61 | return $final_array; |
@@ -20,10 +20,11 @@ |
||
20 | 20 | |
21 | 21 | public function setToAddress($email, $person = null) |
22 | 22 | { |
23 | - if($person) |
|
24 | - $this->to[] = "{$person} <{$email}>"; |
|
25 | - else |
|
26 | - $this->to[] = "{$email}"; |
|
23 | + if($person) { |
|
24 | + $this->to[] = "{$person} <{$email}>"; |
|
25 | + } else { |
|
26 | + $this->to[] = "{$email}"; |
|
27 | + } |
|
27 | 28 | return $this; |
28 | 29 | } |
29 | 30 |
@@ -60,8 +60,9 @@ |
||
60 | 60 | { |
61 | 61 | $post_array[] = $this->format_post($post, true); |
62 | 62 | } |
63 | - if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') |
|
64 | - $this->eject(); |
|
63 | + if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') { |
|
64 | + $this->eject(); |
|
65 | + } |
|
65 | 66 | return $post_array; |
66 | 67 | } |
67 | 68 |
@@ -33,17 +33,21 @@ |
||
33 | 33 | |
34 | 34 | private function process_form() |
35 | 35 | { |
36 | - if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
37 | - return (object) array('display' => 'normal'); |
|
36 | + if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') { |
|
37 | + return (object) array('display' => 'normal'); |
|
38 | + } |
|
38 | 39 | |
39 | 40 | Loader::load('utility', 'Validate'); |
40 | 41 | $error_result = array(); |
41 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
42 | - $error_result['name'] = 'please enter your name'; |
|
43 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
44 | - $error_result['email'] = 'please enter a valid email'; |
|
45 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
46 | - $error_result['message'] = 'please write a message'; |
|
42 | + if(!Validate::checkRequest('post', 'name', 'string')) { |
|
43 | + $error_result['name'] = 'please enter your name'; |
|
44 | + } |
|
45 | + if(!Validate::checkRequest('post', 'email', 'string')) { |
|
46 | + $error_result['email'] = 'please enter a valid email'; |
|
47 | + } |
|
48 | + if(!Validate::checkRequest('post', 'message', 'string')) { |
|
49 | + $error_result['message'] = 'please write a message'; |
|
50 | + } |
|
47 | 51 | |
48 | 52 | $values = (object) array( |
49 | 53 | 'name' => Request::getPost('name'), |