@@ -72,7 +72,7 @@ |
||
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @param string $verificationCode |
75 | - * @return mixed |
|
75 | + * @return string |
|
76 | 76 | */ |
77 | 77 | public function verification_check(string $verificationCode) { |
78 | 78 | //user is trying to validate their email for signup, check if verification code is still valid/exists |
@@ -77,9 +77,9 @@ |
||
77 | 77 | public function verification_check(string $verificationCode) { |
78 | 78 | //user is trying to validate their email for signup, check if verification code is still valid/exists |
79 | 79 | $query = $this->db->select('email, verification_code_time') |
80 | - ->from('auth_signup_verification') |
|
81 | - ->where(array('verification_code' => $verificationCode)) |
|
82 | - ->get(); |
|
80 | + ->from('auth_signup_verification') |
|
81 | + ->where(array('verification_code' => $verificationCode)) |
|
82 | + ->get(); |
|
83 | 83 | |
84 | 84 | $return = FALSE; |
85 | 85 | if($query->num_rows() > 0) { |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed'); |
|
1 | +<?php declare(strict_types = 1); defined('BASEPATH') or exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | class Auth_Model extends CI_Model { |
4 | 4 | public function __construct() { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | $success = TRUE; |
63 | - } catch (Exception $e) { |
|
63 | + } catch(Exception $e) { |
|
64 | 64 | //echo 'Caught exception: ', $e->getMessage(), "\n"; |
65 | 65 | |
66 | 66 | //revert verification |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | //TODO: Remove from DB, send user error that verification expired. |
92 | 92 | } else { |
93 | 93 | //not expired, verification is valid, return email |
94 | - $return = $result->email; |
|
94 | + $return = $result->email; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | return $return; |
@@ -88,6 +88,9 @@ |
||
88 | 88 | return $arr; |
89 | 89 | } |
90 | 90 | |
91 | + /** |
|
92 | + * @return string |
|
93 | + */ |
|
91 | 94 | public function getSiteDataFromURL(string $site_url) { |
92 | 95 | $query = $this->db->select('id, site_class') |
93 | 96 | ->from('tracker_sites') |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
1 | +<?php declare(strict_types = 1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | class Tracker_Model extends CI_Model { |
4 | 4 | public $sites; |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | ]; |
50 | 50 | } |
51 | 51 | if($query->num_rows() > 0) { |
52 | - foreach ($query->result() as $row) { |
|
53 | - $is_unread = intval($row->latest_chapter == $row->current_chapter ? '1' : '0'); |
|
52 | + foreach($query->result() as $row) { |
|
53 | + $is_unread = intval($row->latest_chapter == $row->current_chapter ? '1' : '0'); |
|
54 | 54 | $arr[$row->category]['unread_count'] = (($arr[$row->category]['unread_count'] ?? 0) + !$is_unread); |
55 | 55 | $arr[$row->category]['manga'][] = [ |
56 | 56 | 'id' => $row->id, |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | //NOTE: This does not sort in the same way as tablesorter, but it works better. |
82 | - foreach (array_keys($arr) as $category) { |
|
83 | - usort($arr[$category]['manga'], function ($a, $b) { |
|
82 | + foreach(array_keys($arr) as $category) { |
|
83 | + usort($arr[$category]['manga'], function($a, $b) { |
|
84 | 84 | return strtolower("{$a['new_chapter_exists']} - {$a['title_data']['title']}") <=> strtolower("{$b['new_chapter_exists']} - {$b['title_data']['title']}"); |
85 | 85 | }); |
86 | 86 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | ->get(); |
227 | 227 | |
228 | 228 | if($query->num_rows() > 0) { |
229 | - foreach ($query->result() as $row) { |
|
229 | + foreach($query->result() as $row) { |
|
230 | 230 | print "> {$row->title} <{$row->site_class}>"; //Print this prior to doing anything so we can more easily find out if something went wrong |
231 | 231 | $titleData = $this->sites->{$row->site_class}->getTitleData($row->title_url); |
232 | 232 | if(!is_null($titleData['latest_chapter'])) { |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | $arr = []; |
263 | 263 | if($query->num_rows() > 0) { |
264 | - foreach ($query->result() as $row) { |
|
264 | + foreach($query->result() as $row) { |
|
265 | 265 | $arr[$row->category][] = [ |
266 | 266 | 'site' => $row->site, |
267 | 267 | 'title_url' => $row->title_url, |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
1 | +<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | class User_Model extends CI_Model { |
4 | 4 | public $id; |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | |
92 | 92 | public function getSiteDataFromURL(string $site_url) { |
93 | 93 | $query = $this->db->select('id, site_class') |
94 | - ->from('tracker_sites') |
|
95 | - ->where('site', $site_url) |
|
96 | - ->get(); |
|
94 | + ->from('tracker_sites') |
|
95 | + ->where('site', $site_url) |
|
96 | + ->get(); |
|
97 | 97 | |
98 | 98 | if($query->num_rows() > 0) { |
99 | 99 | $siteData = $query->row(); |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | |
105 | 105 | public function getTitleID(string $titleURL, int $siteID) { |
106 | 106 | $query = $this->db->select('id') |
107 | - ->from('tracker_titles') |
|
108 | - ->where('title_url', $titleURL) |
|
109 | - ->where('site_id', $siteID) |
|
110 | - ->get(); |
|
107 | + ->from('tracker_titles') |
|
108 | + ->where('title_url', $titleURL) |
|
109 | + ->where('site_id', $siteID) |
|
110 | + ->get(); |
|
111 | 111 | |
112 | 112 | if($query->num_rows() > 0) { |
113 | 113 | $titleID = $query->row('id'); |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | $idQuery = $this->db->select('id') |
144 | - ->where('user_id', $userID) |
|
145 | - ->where('title_id', $titleID) |
|
146 | - ->get('tracker_chapters'); |
|
144 | + ->where('user_id', $userID) |
|
145 | + ->where('title_id', $titleID) |
|
146 | + ->get('tracker_chapters'); |
|
147 | 147 | if($idQuery->num_rows() > 0) { |
148 | 148 | $success = (bool) $this->db->set(['current_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL]) |
149 | - ->where('user_id', $userID) |
|
150 | - ->where('title_id', $titleID) |
|
151 | - ->update('tracker_chapters'); |
|
149 | + ->where('user_id', $userID) |
|
150 | + ->where('title_id', $titleID) |
|
151 | + ->update('tracker_chapters'); |
|
152 | 152 | |
153 | 153 | if($success) { |
154 | 154 | $idQueryRow = $idQuery->row(); |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | |
174 | 174 | public function updateTrackerByID(int $userID, int $chapterID, string $chapter) : bool { |
175 | 175 | $success = (bool) $this->db->set(['current_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL]) |
176 | - ->where('user_id', $userID) |
|
177 | - ->where('id', $chapterID) |
|
178 | - ->update('tracker_chapters'); |
|
176 | + ->where('user_id', $userID) |
|
177 | + ->where('id', $chapterID) |
|
178 | + ->update('tracker_chapters'); |
|
179 | 179 | |
180 | 180 | if($success) { |
181 | 181 | $this->History->userUpdateTitle($chapterID, $chapter); |
@@ -188,23 +188,23 @@ discard block |
||
188 | 188 | //This is to allow user history to function properly. |
189 | 189 | |
190 | 190 | $success = $this->db->set(['active' => 'N', 'last_updated' => NULL]) |
191 | - ->where('user_id', $userID) |
|
192 | - ->where('id', $chapterID) |
|
193 | - ->update('tracker_chapters'); |
|
191 | + ->where('user_id', $userID) |
|
192 | + ->where('id', $chapterID) |
|
193 | + ->update('tracker_chapters'); |
|
194 | 194 | |
195 | 195 | return (bool) $success; |
196 | 196 | } |
197 | 197 | private function updateTitleById(int $id, string $latestChapter) { |
198 | 198 | //FIXME: Really not too happy with how we're doing history stuff here, it just feels messy. |
199 | 199 | $query = $this->db->select('latest_chapter AS current_chapter') |
200 | - ->from('tracker_titles') |
|
201 | - ->where('id', $id) |
|
202 | - ->get(); |
|
200 | + ->from('tracker_titles') |
|
201 | + ->where('id', $id) |
|
202 | + ->get(); |
|
203 | 203 | $row = $query->row(); |
204 | 204 | |
205 | 205 | $success = $this->db->set(['latest_chapter' => $latestChapter]) //last_updated gets updated via a trigger if something changes |
206 | - ->where('id', $id) |
|
207 | - ->update('tracker_titles'); |
|
206 | + ->where('id', $id) |
|
207 | + ->update('tracker_titles'); |
|
208 | 208 | |
209 | 209 | //Update History |
210 | 210 | //NOTE: To avoid doing another query to grab the last_updated time, we just use time() which <should> get the same thing. |
@@ -215,16 +215,16 @@ discard block |
||
215 | 215 | } |
216 | 216 | private function updateTitleDataById(int $id, array $titleData) { |
217 | 217 | $success = $this->db->set($titleData) |
218 | - ->where('id', $id) |
|
219 | - ->update('tracker_titles'); |
|
218 | + ->where('id', $id) |
|
219 | + ->update('tracker_titles'); |
|
220 | 220 | |
221 | 221 | return (bool) $success; |
222 | 222 | } |
223 | 223 | private function addTitle(string $titleURL, int $siteID) { |
224 | 224 | $query = $this->db->select('site, site_class') |
225 | - ->from('tracker_sites') |
|
226 | - ->where('id', $siteID) |
|
227 | - ->get(); |
|
225 | + ->from('tracker_sites') |
|
226 | + ->where('id', $siteID) |
|
227 | + ->get(); |
|
228 | 228 | |
229 | 229 | $titleData = $this->sites->{$query->row()->site_class}->getTitleData($titleURL); |
230 | 230 | $this->db->insert('tracker_titles', array_merge($titleData, ['title_url' => $titleURL, 'site_id' => $siteID])); |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | //Make sure last_checked is always updated on successful run. |
276 | 276 | //CHECK: Is there a reason we aren't just doing this in updateTitleById? |
277 | 277 | $this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
278 | - ->where('id', $row->id) |
|
279 | - ->update('tracker_titles'); |
|
278 | + ->where('id', $row->id) |
|
279 | + ->update('tracker_titles'); |
|
280 | 280 | |
281 | 281 | print " - ({$titleData['latest_chapter']})\n"; |
282 | 282 | } |
@@ -393,9 +393,9 @@ discard block |
||
393 | 393 | } |
394 | 394 | public function setCategoryTrackerByID(int $userID, int $chapterID, string $category) : bool { |
395 | 395 | $success = $this->db->set(['category' => $category, 'active' => 'Y', 'last_updated' => NULL]) |
396 | - ->where('user_id', $userID) |
|
397 | - ->where('id', $chapterID) |
|
398 | - ->update('tracker_chapters'); |
|
396 | + ->where('user_id', $userID) |
|
397 | + ->where('id', $chapterID) |
|
398 | + ->update('tracker_chapters'); |
|
399 | 399 | |
400 | 400 | return (bool) $success; |
401 | 401 | } |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | $success = FALSE; |
406 | 406 | if(preg_match("/^[a-z0-9-_,]{0,255}$/", $tag_string)) { |
407 | 407 | $success = (bool) $this->db->set(['tags' => $tag_string, 'active' => 'Y', 'last_updated' => NULL]) |
408 | - ->where('user_id', $userID) |
|
409 | - ->where('id', $chapterID) |
|
410 | - ->update('tracker_chapters'); |
|
408 | + ->where('user_id', $userID) |
|
409 | + ->where('id', $chapterID) |
|
410 | + ->update('tracker_chapters'); |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | if($success) { |
@@ -421,10 +421,10 @@ discard block |
||
421 | 421 | $usedCategories = []; |
422 | 422 | |
423 | 423 | $query = $this->db->distinct() |
424 | - ->select('category') |
|
425 | - ->from('tracker_chapters') |
|
426 | - ->where('tracker_chapters.active', 'Y') |
|
427 | - ->get(); |
|
424 | + ->select('category') |
|
425 | + ->from('tracker_chapters') |
|
426 | + ->where('tracker_chapters.active', 'Y') |
|
427 | + ->get(); |
|
428 | 428 | |
429 | 429 | return array_column($query->result_array(), 'category'); |
430 | 430 | } |
@@ -144,6 +144,10 @@ |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | //utility functions |
147 | + |
|
148 | + /** |
|
149 | + * @param string $field |
|
150 | + */ |
|
147 | 151 | function get_error_message(/*str*/$field, /*obj*/ $customObj = FALSE) { |
148 | 152 | $obj = $customObj ?: $this->form_validation; |
149 | 153 | $error_messages = ReflectionHelper::getPrivateProperty( |
@@ -210,10 +210,10 @@ |
||
210 | 210 | { |
211 | 211 | // Ensure there's a trailing slash |
212 | 212 | $system_path = strtr( |
213 | - rtrim($system_path, '/\\'), |
|
214 | - '/\\', |
|
215 | - DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
|
216 | - ).DIRECTORY_SEPARATOR; |
|
213 | + rtrim($system_path, '/\\'), |
|
214 | + '/\\', |
|
215 | + DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
|
216 | + ).DIRECTORY_SEPARATOR; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | // Is the system path correct? |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * Different environments will require different levels of error reporting. |
64 | 64 | * By default development will show errors but testing and live will hide them. |
65 | 65 | */ |
66 | -switch (ENVIRONMENT) |
|
66 | +switch(ENVIRONMENT) |
|
67 | 67 | { |
68 | 68 | case 'development': |
69 | 69 | error_reporting(-1); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | case 'testing': |
80 | 80 | case 'production': |
81 | 81 | ini_set('display_errors', 0); |
82 | - if (version_compare(PHP_VERSION, '5.3', '>=')) |
|
82 | + if(version_compare(PHP_VERSION, '5.3', '>=')) |
|
83 | 83 | { |
84 | 84 | error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); |
85 | 85 | } |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | */ |
198 | 198 | |
199 | 199 | // Set the current directory correctly for CLI requests |
200 | -if (defined('STDIN')) |
|
200 | +if(defined('STDIN')) |
|
201 | 201 | { |
202 | 202 | chdir(dirname(__FILE__)); |
203 | 203 | } |
204 | 204 | |
205 | -if (($_temp = realpath($system_path)) !== FALSE) |
|
205 | +if(($_temp = realpath($system_path)) !== FALSE) |
|
206 | 206 | { |
207 | 207 | $system_path = $_temp.DIRECTORY_SEPARATOR; |
208 | 208 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | |
219 | 219 | // Is the system path correct? |
220 | -if ( ! is_dir($system_path)) |
|
220 | +if(!is_dir($system_path)) |
|
221 | 221 | { |
222 | 222 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
223 | 223 | echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME); |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | define('SYSDIR', basename(BASEPATH)); |
243 | 243 | |
244 | 244 | // The path to the "application" directory |
245 | -if (is_dir($application_folder)) |
|
245 | +if(is_dir($application_folder)) |
|
246 | 246 | { |
247 | - if (($_temp = realpath($application_folder)) !== FALSE) |
|
247 | + if(($_temp = realpath($application_folder)) !== FALSE) |
|
248 | 248 | { |
249 | 249 | $application_folder = $_temp; |
250 | 250 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | ); |
258 | 258 | } |
259 | 259 | } |
260 | -elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
|
260 | +elseif(is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
|
261 | 261 | { |
262 | 262 | $application_folder = BASEPATH.strtr( |
263 | 263 | trim($application_folder, '/\\'), |
@@ -275,13 +275,13 @@ discard block |
||
275 | 275 | define('APPPATH', $application_folder.DIRECTORY_SEPARATOR); |
276 | 276 | |
277 | 277 | // The path to the "views" directory |
278 | -if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
|
278 | +if(!isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
|
279 | 279 | { |
280 | 280 | $view_folder = APPPATH.'views'; |
281 | 281 | } |
282 | -elseif (is_dir($view_folder)) |
|
282 | +elseif(is_dir($view_folder)) |
|
283 | 283 | { |
284 | - if (($_temp = realpath($view_folder)) !== FALSE) |
|
284 | + if(($_temp = realpath($view_folder)) !== FALSE) |
|
285 | 285 | { |
286 | 286 | $view_folder = $_temp; |
287 | 287 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | ); |
295 | 295 | } |
296 | 296 | } |
297 | -elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
|
297 | +elseif(is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
|
298 | 298 | { |
299 | 299 | $view_folder = APPPATH.strtr( |
300 | 300 | trim($view_folder, '/\\'), |
@@ -63,8 +63,7 @@ discard block |
||
63 | 63 | * Different environments will require different levels of error reporting. |
64 | 64 | * By default development will show errors but testing and live will hide them. |
65 | 65 | */ |
66 | -switch (ENVIRONMENT) |
|
67 | -{ |
|
66 | +switch (ENVIRONMENT) { |
|
68 | 67 | case 'development': |
69 | 68 | error_reporting(-1); |
70 | 69 | ini_set('display_errors', 1); |
@@ -79,12 +78,9 @@ discard block |
||
79 | 78 | case 'testing': |
80 | 79 | case 'production': |
81 | 80 | ini_set('display_errors', 0); |
82 | - if (version_compare(PHP_VERSION, '5.3', '>=')) |
|
83 | - { |
|
81 | + if (version_compare(PHP_VERSION, '5.3', '>=')) { |
|
84 | 82 | error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); |
85 | - } |
|
86 | - else |
|
87 | - { |
|
83 | + } else { |
|
88 | 84 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); |
89 | 85 | } |
90 | 86 | break; |
@@ -197,17 +193,13 @@ discard block |
||
197 | 193 | */ |
198 | 194 | |
199 | 195 | // Set the current directory correctly for CLI requests |
200 | -if (defined('STDIN')) |
|
201 | -{ |
|
196 | +if (defined('STDIN')) { |
|
202 | 197 | chdir(dirname(__FILE__)); |
203 | 198 | } |
204 | 199 | |
205 | -if (($_temp = realpath($system_path)) !== FALSE) |
|
206 | -{ |
|
200 | +if (($_temp = realpath($system_path)) !== FALSE) { |
|
207 | 201 | $system_path = $_temp.DIRECTORY_SEPARATOR; |
208 | -} |
|
209 | -else |
|
210 | -{ |
|
202 | +} else { |
|
211 | 203 | // Ensure there's a trailing slash |
212 | 204 | $system_path = strtr( |
213 | 205 | rtrim($system_path, '/\\'), |
@@ -217,8 +209,7 @@ discard block |
||
217 | 209 | } |
218 | 210 | |
219 | 211 | // Is the system path correct? |
220 | -if ( ! is_dir($system_path)) |
|
221 | -{ |
|
212 | +if ( ! is_dir($system_path)) { |
|
222 | 213 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
223 | 214 | echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME); |
224 | 215 | exit(3); // EXIT_CONFIG |
@@ -242,31 +233,23 @@ discard block |
||
242 | 233 | define('SYSDIR', basename(BASEPATH)); |
243 | 234 | |
244 | 235 | // The path to the "application" directory |
245 | -if (is_dir($application_folder)) |
|
246 | -{ |
|
247 | - if (($_temp = realpath($application_folder)) !== FALSE) |
|
248 | - { |
|
236 | +if (is_dir($application_folder)) { |
|
237 | + if (($_temp = realpath($application_folder)) !== FALSE) { |
|
249 | 238 | $application_folder = $_temp; |
250 | - } |
|
251 | - else |
|
252 | - { |
|
239 | + } else { |
|
253 | 240 | $application_folder = strtr( |
254 | 241 | rtrim($application_folder, '/\\'), |
255 | 242 | '/\\', |
256 | 243 | DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
257 | 244 | ); |
258 | 245 | } |
259 | -} |
|
260 | -elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
|
261 | -{ |
|
246 | +} elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) { |
|
262 | 247 | $application_folder = BASEPATH.strtr( |
263 | 248 | trim($application_folder, '/\\'), |
264 | 249 | '/\\', |
265 | 250 | DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
266 | 251 | ); |
267 | -} |
|
268 | -else |
|
269 | -{ |
|
252 | +} else { |
|
270 | 253 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
271 | 254 | echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
272 | 255 | exit(3); // EXIT_CONFIG |
@@ -275,35 +258,25 @@ discard block |
||
275 | 258 | define('APPPATH', $application_folder.DIRECTORY_SEPARATOR); |
276 | 259 | |
277 | 260 | // The path to the "views" directory |
278 | -if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
|
279 | -{ |
|
261 | +if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) { |
|
280 | 262 | $view_folder = APPPATH.'views'; |
281 | -} |
|
282 | -elseif (is_dir($view_folder)) |
|
283 | -{ |
|
284 | - if (($_temp = realpath($view_folder)) !== FALSE) |
|
285 | - { |
|
263 | +} elseif (is_dir($view_folder)) { |
|
264 | + if (($_temp = realpath($view_folder)) !== FALSE) { |
|
286 | 265 | $view_folder = $_temp; |
287 | - } |
|
288 | - else |
|
289 | - { |
|
266 | + } else { |
|
290 | 267 | $view_folder = strtr( |
291 | 268 | rtrim($view_folder, '/\\'), |
292 | 269 | '/\\', |
293 | 270 | DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
294 | 271 | ); |
295 | 272 | } |
296 | -} |
|
297 | -elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
|
298 | -{ |
|
273 | +} elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) { |
|
299 | 274 | $view_folder = APPPATH.strtr( |
300 | 275 | trim($view_folder, '/\\'), |
301 | 276 | '/\\', |
302 | 277 | DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
303 | 278 | ); |
304 | -} |
|
305 | -else |
|
306 | -{ |
|
279 | +} else { |
|
307 | 280 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
308 | 281 | echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
309 | 282 | exit(3); // EXIT_CONFIG |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | public function test_index_logged_in() { |
10 | 10 | //user is already logged in, redirect to dashboard |
11 | 11 | $this->request->setCallablePreConstructor( |
12 | - function () { |
|
12 | + function() { |
|
13 | 13 | $ion_auth = $this->getMock_ion_auth_logged_in(); |
14 | 14 | load_class_instance('ion_auth', $ion_auth); |
15 | 15 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->markTestIncomplete('This test is broken for now.'); |
31 | 31 | |
32 | 32 | $this->request->setCallable( |
33 | - function ($CI) { |
|
33 | + function($CI) { |
|
34 | 34 | $validation = $this->getDouble( |
35 | 35 | 'CI_Form_validation', |
36 | 36 | ['set_rules' => NULL, 'run' => TRUE] |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | ); |
46 | 46 | $this->request->addCallable( |
47 | - function ($CI) { |
|
47 | + function($CI) { |
|
48 | 48 | $user = $this->getDouble( |
49 | 49 | 'User_Model', |
50 | 50 | ['find_email_from_identity' => 'foobar'] |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | ); |
58 | 58 | $this->request->addCallable( |
59 | - function ($CI) { |
|
59 | + function($CI) { |
|
60 | 60 | $auth = $this->getDouble( |
61 | 61 | 'Ion_auth_model', |
62 | 62 | ['login' => TRUE] |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $this->markTestIncomplete('This test is broken for now.'); |
78 | 78 | |
79 | 79 | $this->request->setCallable( |
80 | - function ($CI) { |
|
80 | + function($CI) { |
|
81 | 81 | $validation = $this->getDouble( |
82 | 82 | 'CI_Form_validation', |
83 | 83 | ['set_rules' => NULL, 'run' => TRUE] |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | ); |
93 | 93 | $this->request->addCallable( |
94 | - function ($CI) { |
|
94 | + function($CI) { |
|
95 | 95 | $user = $this->getDouble( |
96 | 96 | 'User_Model', |
97 | 97 | ['find_email_from_identity' => 'foobar'] |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | } |
104 | 104 | ); |
105 | 105 | $this->request->addCallable( |
106 | - function ($CI) { |
|
106 | + function($CI) { |
|
107 | 107 | $auth = $this->getDouble( |
108 | 108 | 'Ion_auth_model', |
109 | 109 | ['login' => TRUE] |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | ); |
117 | 117 | $this->request->addCallable( |
118 | - function ($CI) { |
|
118 | + function($CI) { |
|
119 | 119 | // Get mock object |
120 | 120 | $session = $this->getDouble( |
121 | 121 | 'CI_Session', |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | public function test_login_validation_fail() { |
135 | 135 | //user isn't logged in, validation failed, this is happens on the first time loading the page |
136 | 136 | $this->request->setCallable( |
137 | - function ($CI) { |
|
137 | + function($CI) { |
|
138 | 138 | // Get mock object |
139 | 139 | $validation = $this->getDouble( |
140 | 140 | 'CI_Form_validation', |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | public function test_login_validation_pass_but_login_fail() { |
157 | 157 | //user isn't logged in, tried to login, validation succeeded but login failed |
158 | 158 | $this->request->setCallable( |
159 | - function ($CI) { |
|
159 | + function($CI) { |
|
160 | 160 | // Get mock object |
161 | 161 | $validation = $this->getDouble( |
162 | 162 | 'CI_Form_validation', |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | $this->assertResponseCode(200); |
7 | 7 | |
8 | 8 | $this->request->setCallable( |
9 | - function ($CI) { |
|
9 | + function($CI) { |
|
10 | 10 | $auth = $this->getDouble('Auth_Model', ['verification_check' => 'foobar']); |
11 | 11 | $this->verifyInvokedOnce($auth, 'verification_check'); |
12 | 12 | $CI->Auth = $auth; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function test_index_logged_in() { |
20 | 20 | //user is already logged in, redirect to dashboard |
21 | 21 | $this->request->setCallablePreConstructor( |
22 | - function () { |
|
22 | + function() { |
|
23 | 23 | $ion_auth = $this->getMock_ion_auth_logged_in(); |
24 | 24 | load_class_instance('ion_auth', $ion_auth); |
25 | 25 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function test_signup_p1_validation_pass_verification_pass() { |
39 | 39 | $this->request->setCallable( |
40 | - function ($CI) { |
|
40 | + function($CI) { |
|
41 | 41 | $validation = $this->getDouble( |
42 | 42 | 'CI_Form_validation', |
43 | 43 | ['set_rules' => NULL, 'run' => TRUE] |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | ); |
53 | 53 | $this->request->addCallable( |
54 | - function ($CI) { |
|
54 | + function($CI) { |
|
55 | 55 | $auth = $this->getDouble('Auth_Model', ['verification_start' => TRUE]); |
56 | 56 | $this->verifyInvokedOnce($auth, 'verification_start'); |
57 | 57 | $CI->Auth = $auth; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | public function test_signup_p1_validation_pass_verification_fail() { |
67 | 67 | $this->request->setCallable( |
68 | - function ($CI) { |
|
68 | + function($CI) { |
|
69 | 69 | $validation = $this->getDouble( |
70 | 70 | 'CI_Form_validation', |
71 | 71 | ['set_rules' => NULL, 'run' => TRUE] |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | ); |
81 | 81 | $this->request->addCallable( |
82 | - function ($CI) { |
|
82 | + function($CI) { |
|
83 | 83 | $auth = $this->getDouble('Auth_Model', ['verification_start' => FALSE]); |
84 | 84 | $this->verifyInvokedOnce($auth, 'verification_start'); |
85 | 85 | $CI->Auth = $auth; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | public function test_signup_p1_validation_fail() { |
95 | 95 | $this->request->setCallable( |
96 | - function ($CI) { |
|
96 | + function($CI) { |
|
97 | 97 | $validation = $this->getDouble( |
98 | 98 | 'CI_Form_validation', |
99 | 99 | ['set_rules' => NULL, 'run' => FALSE, 'set_value' => ''] |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | //form was valid, and register was successful, user is redirected to dashboard |
116 | 116 | |
117 | 117 | $this->request->setCallable( |
118 | - function ($CI) { |
|
118 | + function($CI) { |
|
119 | 119 | $auth = $this->getDouble('Auth_Model', ['verification_check' => '[email protected]']); |
120 | 120 | $this->verifyInvokedOnce($auth, 'verification_check'); |
121 | 121 | $CI->Auth = $auth; |
122 | 122 | } |
123 | 123 | ); |
124 | 124 | $this->request->addCallable( |
125 | - function ($CI) { |
|
125 | + function($CI) { |
|
126 | 126 | $validation = $this->getDouble( |
127 | 127 | 'CI_Form_validation', |
128 | 128 | ['set_rules' => NULL, 'run' => TRUE] |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | ); |
138 | 138 | $this->request->addCallable( |
139 | - function ($CI) { |
|
139 | + function($CI) { |
|
140 | 140 | $auth = $this->getDouble( |
141 | 141 | 'Ion_auth_model', |
142 | 142 | ['register' => TRUE] |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | public function test_signup_p2_verification_pass_validation_pass_register_fail() { |
155 | 155 | //form was valid, and register was unsuccessful, reshow form |
156 | 156 | $this->request->setCallable( |
157 | - function ($CI) { |
|
157 | + function($CI) { |
|
158 | 158 | $auth = $this->getDouble('Auth_Model', ['verification_check' => '[email protected]']); |
159 | 159 | $this->verifyInvokedOnce($auth, 'verification_check'); |
160 | 160 | $CI->Auth = $auth; |
161 | 161 | } |
162 | 162 | ); |
163 | 163 | $this->request->addCallable( |
164 | - function ($CI) { |
|
164 | + function($CI) { |
|
165 | 165 | $validation = $this->getDouble( |
166 | 166 | 'CI_Form_validation', |
167 | 167 | ['set_rules' => NULL, 'run' => TRUE, 'set_value' => 'foobar'] |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | ); |
178 | 178 | $this->request->addCallable( |
179 | - function ($CI) { |
|
179 | + function($CI) { |
|
180 | 180 | $auth = $this->getDouble( |
181 | 181 | 'Ion_auth_model', |
182 | 182 | ['register' => FALSE, 'errors' => FALSE, 'logged_in' => FALSE] |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | public function test_signup_p2_verification_pass_validation_fail() { |
195 | 195 | //validation failed, this is probably the first time the user visits the page, show form |
196 | 196 | $this->request->setCallable( |
197 | - function ($CI) { |
|
197 | + function($CI) { |
|
198 | 198 | $auth = $this->getDouble('Auth_Model', ['verification_check' => '[email protected]']); |
199 | 199 | $this->verifyInvokedOnce($auth, 'verification_check'); |
200 | 200 | $CI->Auth = $auth; |
201 | 201 | } |
202 | 202 | ); |
203 | 203 | $this->request->addCallable( |
204 | - function ($CI) { |
|
204 | + function($CI) { |
|
205 | 205 | $validation = $this->getDouble( |
206 | 206 | 'CI_Form_validation', |
207 | 207 | ['set_rules' => NULL, 'run' => FALSE, 'set_value' => ''] |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | public function test_signup_p2_verification_fail() { |
223 | 223 | //validation failed, this is probably the first time the user visits the page, show form |
224 | 224 | $this->request->setCallable( |
225 | - function ($CI) { |
|
225 | + function($CI) { |
|
226 | 226 | $auth = $this->getDouble('Auth_Model', ['verification_check' => FALSE]); |
227 | 227 | $this->verifyInvokedOnce($auth, 'verification_check'); |
228 | 228 | $CI->Auth = $auth; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | |
21 | 21 | $this->request->setCallablePreConstructor( |
22 | - function () { |
|
22 | + function() { |
|
23 | 23 | $ion_auth = $this->getMock_ion_auth_logged_in(); |
24 | 24 | load_class_instance('ion_auth', $ion_auth); |
25 | 25 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function test_forgot_password_validation_pass() { |
39 | 39 | //user isn't logged in, form is valid, user is shown success page regardless of if email is used |
40 | 40 | $this->request->setCallable( |
41 | - function ($CI) { |
|
41 | + function($CI) { |
|
42 | 42 | $validation = $this->getDouble( |
43 | 43 | 'CI_Form_validation', |
44 | 44 | ['set_rules' => NULL, 'run' => TRUE] |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } |
53 | 53 | ); |
54 | 54 | $this->request->addCallable( |
55 | - function ($CI) { |
|
55 | + function($CI) { |
|
56 | 56 | $auth = $this->getDouble( |
57 | 57 | 'Ion_auth_model', |
58 | 58 | ['forgotten_password' => TRUE, 'row' => (object) ['email' => '[email protected]'], 'logged_in' => FALSE] |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function test_forgot_password_validation_fail() { |
73 | 73 | //user isn't logged in, form is invalid, this is usually the case when first viewing the page |
74 | 74 | $this->request->setCallable( |
75 | - function ($CI) { |
|
75 | + function($CI) { |
|
76 | 76 | $validation = $this->getDouble( |
77 | 77 | 'CI_Form_validation', |
78 | 78 | ['set_rules' => NULL, 'run' => FALSE] |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | public function test_reset_password_user_pass_validation_pass_change_fail() { |
94 | 94 | //reset code is valid, form is invalid (or new) |
95 | 95 | $this->request->addCallable( |
96 | - function ($CI) { |
|
96 | + function($CI) { |
|
97 | 97 | $auth = $this->getDouble( |
98 | 98 | 'Ion_auth_model', |
99 | 99 | ['forgotten_password_check' => TRUE, 'reset_password' => FALSE] |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | ); |
107 | 107 | $this->request->addCallable( |
108 | - function ($CI) { |
|
108 | + function($CI) { |
|
109 | 109 | $validation = $this->getDouble( |
110 | 110 | 'CI_Form_validation', |
111 | 111 | ['set_rules' => NULL, 'run' => TRUE] |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | public function test_reset_password_user_pass_validation_pass_change_pass() { |
127 | 127 | //reset code is valid, form is valid, password change was successful, redirect to login |
128 | 128 | $this->request->addCallable( |
129 | - function ($CI) { |
|
129 | + function($CI) { |
|
130 | 130 | $auth = $this->getDouble( |
131 | 131 | 'Ion_auth_model', |
132 | 132 | ['forgotten_password_check' => TRUE, 'reset_password' => TRUE] |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | ); |
140 | 140 | $this->request->addCallable( |
141 | - function ($CI) { |
|
141 | + function($CI) { |
|
142 | 142 | $validation = $this->getDouble( |
143 | 143 | 'CI_Form_validation', |
144 | 144 | ['set_rules' => NULL, 'run' => TRUE] |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | public function test_reset_password_user_pass_validation_fail() { |
160 | 160 | //reset code is valid, form is valid, password change was unsuccessful, send back to reset_password page |
161 | 161 | $this->request->setCallable( |
162 | - function ($CI) { |
|
162 | + function($CI) { |
|
163 | 163 | $auth = $this->getDouble( |
164 | 164 | 'Ion_auth_model', |
165 | 165 | ['forgotten_password_check' => TRUE, 'logged_in' => FALSE] |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | public function test_APPPATH() { |
15 | 15 | $actual = realpath(APPPATH); |
16 | - $expected = realpath(__DIR__ . '/../..'); |
|
16 | + $expected = realpath(__DIR__.'/../..'); |
|
17 | 17 | $this->assertEquals( |
18 | 18 | $expected, |
19 | 19 | $actual, |
@@ -29,27 +29,27 @@ discard block |
||
29 | 29 | |
30 | 30 | public function getMock_ion_auth_logged_in() { |
31 | 31 | $ion_auth = $this->getMockBuilder('Ion_auth') |
32 | - ->disableOriginalConstructor() |
|
33 | - ->getMock(); |
|
32 | + ->disableOriginalConstructor() |
|
33 | + ->getMock(); |
|
34 | 34 | |
35 | 35 | $ion_auth->expects($this->at(0)) |
36 | - ->method('logged_in') |
|
37 | - ->willReturn(TRUE); |
|
36 | + ->method('logged_in') |
|
37 | + ->willReturn(TRUE); |
|
38 | 38 | $ion_auth->expects($this->at(1)) |
39 | - ->method('logged_in') |
|
40 | - ->willReturn(TRUE); |
|
39 | + ->method('logged_in') |
|
40 | + ->willReturn(TRUE); |
|
41 | 41 | |
42 | 42 | $ion_auth->expects($this->any()) |
43 | - ->method($this->anything()) |
|
44 | - ->will($this->returnSelf()); |
|
43 | + ->method($this->anything()) |
|
44 | + ->will($this->returnSelf()); |
|
45 | 45 | |
46 | 46 | return $ion_auth; |
47 | 47 | } |
48 | 48 | |
49 | 49 | public function getMock_CI_DB_result(array $methods) { |
50 | 50 | $db_result = $this->getMockBuilder('CI_DB_result') |
51 | - ->disableOriginalConstructor() |
|
52 | - ->getMock(); |
|
51 | + ->disableOriginalConstructor() |
|
52 | + ->getMock(); |
|
53 | 53 | |
54 | 54 | foreach ($methods as $method => $return) { |
55 | 55 | $db_result->method($method)->willReturn($return); |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | |
60 | 60 | public function getMock_CI_DB($return) { |
61 | 61 | $db = $this->getMockBuilder('CI_DB') |
62 | - ->disableOriginalConstructor() |
|
63 | - ->setMethods(array('select', 'from', 'where', 'get')) |
|
64 | - ->getMock(); |
|
62 | + ->disableOriginalConstructor() |
|
63 | + ->setMethods(array('select', 'from', 'where', 'get')) |
|
64 | + ->getMock(); |
|
65 | 65 | |
66 | 66 | $db->expects($this->at(3)) |
67 | 67 | ->method('get') |
@@ -51,7 +51,7 @@ |
||
51 | 51 | ->disableOriginalConstructor() |
52 | 52 | ->getMock(); |
53 | 53 | |
54 | - foreach ($methods as $method => $return) { |
|
54 | + foreach($methods as $method => $return) { |
|
55 | 55 | $db_result->method($method)->willReturn($return); |
56 | 56 | } |
57 | 57 | return $db_result; |