@@ -5,7 +5,7 @@ |
||
| 5 | 5 | use Core\Controller; |
| 6 | 6 | |
| 7 | 7 | class Debug extends Controller { |
| 8 | - public function index(){ |
|
| 8 | + public function index() { |
|
| 9 | 9 | |
| 10 | 10 | } |
| 11 | 11 | } |
| 12 | 12 | \ No newline at end of file |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | $twigOptions = []; |
| 48 | 48 | if (!Config::DEV_ENVIRONMENT) { |
| 49 | 49 | $twigOptions = [ |
| 50 | - 'cache' => dirname(__DIR__) . '/Cache' |
|
| 50 | + 'cache' => dirname(__DIR__).'/Cache' |
|
| 51 | 51 | ]; |
| 52 | 52 | } |
| 53 | - $loader = new \Twig_Loader_Filesystem(dirname(__DIR__) . '/App/Views'); |
|
| 53 | + $loader = new \Twig_Loader_Filesystem(dirname(__DIR__).'/App/Views'); |
|
| 54 | 54 | $twig = new \Twig_Environment($loader, $twigOptions); |
| 55 | 55 | |
| 56 | 56 | return $twig; |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | if ($this->dbh) { |
| 66 | 66 | return $this->dbh; |
| 67 | 67 | } |
| 68 | - $dsn = "mysql:host=" . Config::DB_HOST . ";dbname=" . Config::DB_NAME . ";charset=utf8"; //Creating the Data Source name |
|
| 68 | + $dsn = "mysql:host=".Config::DB_HOST.";dbname=".Config::DB_NAME.";charset=utf8"; //Creating the Data Source name |
|
| 69 | 69 | $opt = [ |
| 70 | 70 | PDO::ATTR_PERSISTENT => true, |
| 71 | 71 | PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, |
| 72 | 72 | PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ |
| 73 | 73 | ]; |
| 74 | - $this->dbh = new PDO($dsn, Config::DB_USER, Config::DB_PASSWORD, $opt);; |
|
| 74 | + $this->dbh = new PDO($dsn, Config::DB_USER, Config::DB_PASSWORD, $opt); ; |
|
| 75 | 75 | return $this->dbh; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | $loadModuleObj = $this->getModuleNamespace($loadModule); |
| 85 | 85 | //Modules must be children of the Module template |
| 86 | 86 | if (!is_subclass_of($loadModuleObj, 'Core\Modules\Module')) { |
| 87 | - throw new \ErrorException('Module ' . $loadModuleName . ' must be a sub class of module'); |
|
| 87 | + throw new \ErrorException('Module '.$loadModuleName.' must be a sub class of module'); |
|
| 88 | 88 | } |
| 89 | 89 | $loadedModule = new $loadModuleObj($this->container); |
| 90 | 90 | //we are not allowed to create public modules, they must be a placeholder ready |
| 91 | 91 | if (!property_exists($this, $loadModuleName)) { |
| 92 | - throw new \ErrorException('the protected or private variable of ' . $loadModuleName . ' is not present'); |
|
| 92 | + throw new \ErrorException('the protected or private variable of '.$loadModuleName.' is not present'); |
|
| 93 | 93 | } |
| 94 | 94 | $this->$loadModuleName = $loadedModule; |
| 95 | 95 | } |
@@ -106,23 +106,23 @@ discard block |
||
| 106 | 106 | $childClass = new \ReflectionClass(get_class($this)); |
| 107 | 107 | $childClassNamespace = $childClass->getNamespaceName(); |
| 108 | 108 | //check in classNameSpace |
| 109 | - if (class_exists($childClassNamespace . '\\Modules\\' . $loadModule)) { |
|
| 110 | - $this->addToDevHelper('module ' . $loadModule . ' loaded', $childClassNamespace . '\\' . $loadModule); |
|
| 111 | - return $childClassNamespace . '\\' . $loadModule; |
|
| 109 | + if (class_exists($childClassNamespace.'\\Modules\\'.$loadModule)) { |
|
| 110 | + $this->addToDevHelper('module '.$loadModule.' loaded', $childClassNamespace.'\\'.$loadModule); |
|
| 111 | + return $childClassNamespace.'\\'.$loadModule; |
|
| 112 | 112 | } |
| 113 | 113 | //check in app |
| 114 | - if (class_exists('App\\Modules\\' . $loadModule)) { |
|
| 115 | - $this->addToDevHelper('module ' . $loadModule . ' loaded', 'App\\Modules\\' . $loadModule); |
|
| 116 | - return 'App\\Modules\\' . $loadModule; |
|
| 114 | + if (class_exists('App\\Modules\\'.$loadModule)) { |
|
| 115 | + $this->addToDevHelper('module '.$loadModule.' loaded', 'App\\Modules\\'.$loadModule); |
|
| 116 | + return 'App\\Modules\\'.$loadModule; |
|
| 117 | 117 | } |
| 118 | 118 | //check in core, send error popup if overcharged |
| 119 | - if (class_exists('Core\\Modules\\' . $loadModule)) { |
|
| 120 | - $this->addToDevHelper('module ' . $loadModule . ' loaded', 'Core\\Modules\\' . $loadModule); |
|
| 121 | - return 'Core\\Modules\\' . $loadModule; |
|
| 119 | + if (class_exists('Core\\Modules\\'.$loadModule)) { |
|
| 120 | + $this->addToDevHelper('module '.$loadModule.' loaded', 'Core\\Modules\\'.$loadModule); |
|
| 121 | + return 'Core\\Modules\\'.$loadModule; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | //if we are here then no module found |
| 125 | - throw new \ErrorException('module ' . $loadModule . ' does not exist or not loaded'); |
|
| 125 | + throw new \ErrorException('module '.$loadModule.' does not exist or not loaded'); |
|
| 126 | 126 | |
| 127 | 127 | } |
| 128 | 128 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | public function getView($template) |
| 148 | 148 | { |
| 149 | 149 | $twig = $this->container->getTemplate(); |
| 150 | - return $twig->render($template . '.twig', $this->data); |
|
| 150 | + return $twig->render($template.'.twig', $this->data); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $this->devHelper(); |
| 170 | 170 | } |
| 171 | 171 | $twig = $this->container->getTemplate(); |
| 172 | - $twig->display($template . '.twig', $this->data); |
|
| 172 | + $twig->display($template.'.twig', $this->data); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | protected function addToDevHelper($name, $var) |
| 202 | 202 | { |
| 203 | 203 | //only populate if in dev environment |
| 204 | - if (Config::DEV_ENVIRONMENT){ |
|
| 204 | + if (Config::DEV_ENVIRONMENT) { |
|
| 205 | 205 | $classMethods = []; |
| 206 | 206 | $classMethods[$name] = $var; |
| 207 | 207 | if (!isset($this->data['dev_info'])) { |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | * return the entire session superglobal. mainly for debugging purposes |
| 92 | 92 | * @return mixed |
| 93 | 93 | */ |
| 94 | - public function getAllSessionVars(){ |
|
| 94 | + public function getAllSessionVars() { |
|
| 95 | 95 | return $_SESSION; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | } |
| 37 | 37 | if ($success) { |
| 38 | 38 | $this->alertBox->setAlert('Configuration updates successfully'); |
| 39 | - } else { |
|
| 39 | + }else { |
|
| 40 | 40 | $this->alertBox->setAlert('error in configuration update', 'error'); |
| 41 | 41 | } |
| 42 | 42 | $this->container->getResponse()->redirect('admin/config'); |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | if (!$configModel->updateConfig($update->name, $update->value)) { |
| 39 | 39 | $result['success'] = false; |
| 40 | 40 | $result['errorId'][] = $update->name; |
| 41 | - } else { |
|
| 41 | + }else { |
|
| 42 | 42 | $result['successId'][] = $update->name; |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | { |
| 25 | 25 | $this->session->set('user_role_name', 'Admin'); |
| 26 | 26 | $this->session->set('user_role_level', 2); |
| 27 | - $this->session->set('user_id',1); |
|
| 27 | + $this->session->set('user_id', 1); |
|
| 28 | 28 | $this->alertBox->setAlert('Connected as admin'); |
| 29 | 29 | $this->container->getResponse()->redirect('/admin/'); |
| 30 | 30 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $this->query($sql); |
| 88 | 88 | if ($select != null) { |
| 89 | 89 | foreach ($select as $col => $val) { |
| 90 | - $this->bind(":" . $col, $val); |
|
| 90 | + $this->bind(":".$col, $val); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | $this->bind(":limit", $limit); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $this->query($sql); |
| 122 | 122 | if ($select != null) { |
| 123 | 123 | foreach ($select as $col => $val) { |
| 124 | - $this->bind(":" . $col, $val); |
|
| 124 | + $this->bind(":".$col, $val); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | $this->execute(); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | $this->execute(); |
| 293 | 293 | |
| 294 | - return (int)$this->dbh->lastInsertId(); |
|
| 294 | + return (int) $this->dbh->lastInsertId(); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | $this->query($sql); |
| 68 | 68 | $this->bind(":tag", $tag); |
| 69 | 69 | $this->execute(); |
| 70 | - return (int)$this->dbh->lastInsertId(); |
|
| 70 | + return (int) $this->dbh->lastInsertId(); |
|
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | |