@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | static public function singleton() { |
| 13 | - if (Registry::exists('APP')) |
|
| 14 | - $app = Registry::get('APP'); |
|
| 15 | - else { |
|
| 13 | + if (Registry::exists('APP')) { |
|
| 14 | + $app = Registry::get('APP'); |
|
| 15 | + } else { |
|
| 16 | 16 | $app = new self; |
| 17 | 17 | Registry::set('APP',$app); |
| 18 | 18 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function loadRoutes($file = null){ |
| 60 | 60 | if($file) { |
| 61 | 61 | $this->app->config(base_path('routes/'.$file)); |
| 62 | - }else{ |
|
| 62 | + } else{ |
|
| 63 | 63 | foreach(glob(base_path('routes/*.ini')) as $file) { |
| 64 | 64 | $this->app->config($file); |
| 65 | 65 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | public function loadConfig($file = null){ |
| 70 | 70 | if($file) { |
| 71 | 71 | $this->app->config(base_path('config/'.$file)); |
| 72 | - }else{ |
|
| 72 | + } else{ |
|
| 73 | 73 | foreach(glob(base_path('config/*.ini')) as $file) { |
| 74 | 74 | $this->app->config($file); |
| 75 | 75 | } |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | if($type == 'jig'){ |
| 96 | 96 | $this->db = new DB\Jig($this->app->DB_PATH, DB\Jig::FORMAT_JSON); |
| 97 | - }else if($type == 'sql'){ |
|
| 97 | + } else if($type == 'sql'){ |
|
| 98 | 98 | $this->db = new DB\SQL($this->app->DB, $this->app->DB_USER, $this->app->DB_PSWD); |
| 99 | - }else if($type == 'mongo'){ |
|
| 99 | + } else if($type == 'mongo'){ |
|
| 100 | 100 | $this->db = new DB\Mongo($this->app->DB, $this->app->DB_USER); |
| 101 | 101 | } |
| 102 | 102 | $this->app->set('DB', $this->db); |
@@ -108,18 +108,18 @@ discard block |
||
| 108 | 108 | if($type) { |
| 109 | 109 | if($this->app->CSRF && ('jig' == $type || 'sql' == $type || 'mongo' == $type)) { |
| 110 | 110 | $this->configureCSRF($type); |
| 111 | - }else if($this->app->CSRF){ |
|
| 111 | + } else if($this->app->CSRF){ |
|
| 112 | 112 | $this->session = new Session(null, 'CSRF'); |
| 113 | - }else{ |
|
| 113 | + } else{ |
|
| 114 | 114 | if($type == 'jig' || $type == 'mongo' || $type == 'sql'){ |
| 115 | 115 | if($type == 'jig' || $type == 'mongo'){ |
| 116 | 116 | $type = ucfirst($type); |
| 117 | - }else if($type == 'sql') { |
|
| 117 | + } else if($type == 'sql') { |
|
| 118 | 118 | $type = strtoupper($type); |
| 119 | 119 | } |
| 120 | 120 | $session = str_ireplace('/', '', 'DB\/'.$type.'\Session'); |
| 121 | 121 | $this->session = new $session($this->app->DB); |
| 122 | - }else{ |
|
| 122 | + } else{ |
|
| 123 | 123 | $this->session = new Session(); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | public function configureCSRF($type) { |
| 131 | 131 | if($type == 'jig' || $type == 'mongo'){ |
| 132 | 132 | $type = ucfirst($type); |
| 133 | - }else if($type == 'sql') { |
|
| 133 | + } else if($type == 'sql') { |
|
| 134 | 134 | $type = strtoupper($type); |
| 135 | 135 | } |
| 136 | 136 | $session = str_ireplace('/', '', 'DB\/'.$type.'\Session'); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | public function registerErrorHandler() { |
| 148 | 148 | if($this->app->DEV) { |
| 149 | 149 | Falsum\Run::handler($this->app->DEBUG != 3); |
| 150 | - }else{ |
|
| 150 | + } else{ |
|
| 151 | 151 | $this->app->set('ONERROR', 'App\Core\Controllers\ErrorController->init'); |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -44,21 +44,21 @@ |
||
| 44 | 44 | if('class' == $key && is_array($key)) { |
| 45 | 45 | if(array_key_exists('img', $key)){ |
| 46 | 46 | $imgClass = $key['img']; |
| 47 | - }else if(array_key_exists('input', $key)){ |
|
| 47 | + } else if(array_key_exists('input', $key)){ |
|
| 48 | 48 | $inputClass = $key['input']; |
| 49 | 49 | } |
| 50 | - }else{ |
|
| 50 | + } else{ |
|
| 51 | 51 | $imgClass = $inputClass = $key; |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | if(method_exists($this, $func)) { |
| 55 | 55 | $response = $this->$key($length, $imgClass).$this->input($inputClass); |
| 56 | - }else{ |
|
| 56 | + } else{ |
|
| 57 | 57 | throw new Exception("Error Processing Captcha Method", 1); |
| 58 | 58 | } |
| 59 | - }else if(is_numeric($param)){ |
|
| 59 | + } else if(is_numeric($param)){ |
|
| 60 | 60 | $response = $this->img($param).$this->input(); |
| 61 | - }else{ |
|
| 61 | + } else{ |
|
| 62 | 62 | throw new Exception("Error Processing Captcha Parameters", 1); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -35,13 +35,16 @@ |
||
| 35 | 35 | $val = $this->get($field); |
| 36 | 36 | $model = strtolower(str_replace('\\','.',$class)); |
| 37 | 37 | // check required fields |
| 38 | - if ($valid && isset($conf['required'])) |
|
| 39 | - $valid = \Validation::instance()->required($val,$field,'error.'.$model.'.'.$field); |
|
| 38 | + if ($valid && isset($conf['required'])) { |
|
| 39 | + $valid = \Validation::instance()->required($val,$field,'error.'.$model.'.'.$field); |
|
| 40 | + } |
|
| 40 | 41 | // check unique |
| 41 | - if ($valid && isset($conf['unique'])) |
|
| 42 | - $valid = \Validation::instance()->unique($self,$val,$field,'error.'.$model.'.'.$field); |
|
| 43 | - if (!$valid) |
|
| 44 | - break; |
|
| 42 | + if ($valid && isset($conf['unique'])) { |
|
| 43 | + $valid = \Validation::instance()->unique($self,$val,$field,'error.'.$model.'.'.$field); |
|
| 44 | + } |
|
| 45 | + if (!$valid) { |
|
| 46 | + break; |
|
| 47 | + } |
|
| 45 | 48 | } |
| 46 | 49 | } |
| 47 | 50 | return $valid; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | if(is_array($template)){ |
| 22 | 22 | $layout = $template[0]; |
| 23 | 23 | $view = $template[1]; |
| 24 | - }else{ |
|
| 24 | + } else{ |
|
| 25 | 25 | $layout = 'layouts/app.htm'; |
| 26 | 26 | $view = $template; |
| 27 | 27 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | if(is_array($template)){ |
| 38 | 38 | $layout = $template[0]; |
| 39 | 39 | $view = $template[1]; |
| 40 | - }else{ |
|
| 40 | + } else{ |
|
| 41 | 41 | $layout = 'layouts/app.htm'; |
| 42 | 42 | $view = $template; |
| 43 | 43 | } |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | foreach($err as $e) { |
| 59 | 59 | flash($e, 'danger'); |
| 60 | 60 | } |
| 61 | - }else{ |
|
| 61 | + } else{ |
|
| 62 | 62 | flash($err, 'danger'); |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | - }else{ |
|
| 65 | + } else{ |
|
| 66 | 66 | flash($error, 'danger'); |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | \ No newline at end of file |