@@ -2,43 +2,43 @@ |
||
2 | 2 | |
3 | 3 | if (!function_exists('ifdef')) |
4 | 4 | { |
5 | - function ifdef($value, Array $array) |
|
6 | - { |
|
7 | - $global = __DIR__ . '/../../../config/global.config.php'; |
|
5 | + function ifdef($value, Array $array) |
|
6 | + { |
|
7 | + $global = __DIR__ . '/../../../config/global.config.php'; |
|
8 | 8 | |
9 | - if (file_exists($global)) |
|
10 | - { |
|
11 | - $key = array_shift($array); |
|
12 | - $in = include $global; |
|
9 | + if (file_exists($global)) |
|
10 | + { |
|
11 | + $key = array_shift($array); |
|
12 | + $in = include $global; |
|
13 | 13 | |
14 | - do |
|
15 | - { |
|
16 | - if (is_array($in)) |
|
17 | - { |
|
18 | - if (array_key_exists($key, $in)) |
|
19 | - $in = $in[$key]; |
|
20 | - else |
|
21 | - return $value; |
|
22 | - } |
|
23 | - else |
|
24 | - return $value; |
|
14 | + do |
|
15 | + { |
|
16 | + if (is_array($in)) |
|
17 | + { |
|
18 | + if (array_key_exists($key, $in)) |
|
19 | + $in = $in[$key]; |
|
20 | + else |
|
21 | + return $value; |
|
22 | + } |
|
23 | + else |
|
24 | + return $value; |
|
25 | 25 | |
26 | - $key = ($array) ? array_shift($array) : NULL; |
|
26 | + $key = ($array) ? array_shift($array) : NULL; |
|
27 | 27 | |
28 | - if (!$key) |
|
29 | - return $in; |
|
28 | + if (!$key) |
|
29 | + return $in; |
|
30 | 30 | |
31 | - } while($key); |
|
32 | - } |
|
33 | - else |
|
34 | - return $value; |
|
35 | - } |
|
31 | + } while($key); |
|
32 | + } |
|
33 | + else |
|
34 | + return $value; |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | return [ |
39 | - 'project' => [ |
|
40 | - 'name' => ifdef('PROJECT NAME', ["project", "name"]), # The name of your project |
|
41 | - ], |
|
39 | + 'project' => [ |
|
40 | + 'name' => ifdef('PROJECT NAME', ["project", "name"]), # The name of your project |
|
41 | + ], |
|
42 | 42 | 'output' => [ |
43 | 43 | 'cache' |
44 | 44 | ] |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | { |
5 | 5 | function ifdef($value, Array $array) |
6 | 6 | { |
7 | - $global = __DIR__ . '/../../../config/global.config.php'; |
|
7 | + $global = __DIR__ . '/../../../config/global.config.php'; |
|
8 | 8 | |
9 | 9 | if (file_exists($global)) |
10 | 10 | { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | if (!$key) |
29 | 29 | return $in; |
30 | 30 | |
31 | - } while($key); |
|
31 | + } while ($key); |
|
32 | 32 | } |
33 | 33 | else |
34 | 34 | return $value; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | return [ |
39 | 39 | 'project' => [ |
40 | - 'name' => ifdef('PROJECT NAME', ["project", "name"]), # The name of your project |
|
40 | + 'name' => ifdef('PROJECT NAME', ["project", "name"]), # The name of your project |
|
41 | 41 | ], |
42 | 42 | 'output' => [ |
43 | 43 | 'cache' |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | |
12 | 12 | class Module extends AbstractionModule |
13 | 13 | { |
14 | - public function init(AbstractionController $c) |
|
15 | - { |
|
14 | + public function init(AbstractionController $c) |
|
15 | + { |
|
16 | 16 | $config = $this->getUserConfig(); |
17 | 17 | |
18 | 18 | $_config = ArrayDimension::toUnidimensional($config, "_"); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | else |
91 | 91 | $layoutManager->fromTemplate($this, 'blank'); |
92 | 92 | } |
93 | - } |
|
93 | + } |
|
94 | 94 | |
95 | 95 | private function setTranslator(AbstractionController $c) |
96 | 96 | { |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | $c->translator = new \Zend\Mvc\I18n\Translator($i18nTranslator); |
113 | 113 | } |
114 | 114 | |
115 | - public function getUserConfig() |
|
116 | - { |
|
117 | - return include __DIR__ . "/config/user.config.php"; |
|
118 | - } |
|
115 | + public function getUserConfig() |
|
116 | + { |
|
117 | + return include __DIR__ . "/config/user.config.php"; |
|
118 | + } |
|
119 | 119 | } |
120 | 120 | \ No newline at end of file |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | $data["messages"] = $validator->getMessages(); |
54 | 54 | throw new \Exception("Module config errros in user.config!", 300); |
55 | 55 | } |
56 | - } |
|
57 | - catch (\Exception $e) |
|
56 | + } catch (\Exception $e) |
|
58 | 57 | { |
59 | 58 | $file = str_replace('\\', '', __CLASS__); |
60 | 59 | $storage = new \Drone\Exception\Storage("cache/$file.json"); |
@@ -85,10 +84,11 @@ discard block |
||
85 | 84 | $layoutManager->setParams($data); |
86 | 85 | |
87 | 86 | # for AJAX requests! |
88 | - if ($c->isXmlHttpRequest()) |
|
89 | - $layoutManager->content(); |
|
90 | - else |
|
91 | - $layoutManager->fromTemplate($this, 'blank'); |
|
87 | + if ($c->isXmlHttpRequest()) { |
|
88 | + $layoutManager->content(); |
|
89 | + } else { |
|
90 | + $layoutManager->fromTemplate($this, 'blank'); |
|
91 | + } |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 |
@@ -7,24 +7,24 @@ |
||
7 | 7 | |
8 | 8 | class Error extends AbstractionController |
9 | 9 | { |
10 | - public function notFound() |
|
11 | - { |
|
12 | - $this->setShowView(false); |
|
13 | - $this->setLayout('HTTP404'); |
|
10 | + public function notFound() |
|
11 | + { |
|
12 | + $this->setShowView(false); |
|
13 | + $this->setLayout('HTTP404'); |
|
14 | 14 | |
15 | 15 | $http = new Http(); |
16 | 16 | $http->writeStatus($http::HTTP_NOT_FOUND); |
17 | 17 | |
18 | - return []; |
|
19 | - } |
|
18 | + return []; |
|
19 | + } |
|
20 | 20 | |
21 | - public function notFoundView() |
|
22 | - { |
|
23 | - $this->setLayout('blank'); |
|
21 | + public function notFoundView() |
|
22 | + { |
|
23 | + $this->setLayout('blank'); |
|
24 | 24 | |
25 | 25 | $http = new Http(); |
26 | 26 | $http->writeStatus($http::HTTP_NOT_FOUND); |
27 | 27 | |
28 | - return []; |
|
29 | - } |
|
28 | + return []; |
|
29 | + } |
|
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -3,11 +3,11 @@ |
||
3 | 3 | return [ |
4 | 4 | 'router' => [ |
5 | 5 | 'routes' => [ |
6 | - 'NotFound' => [ |
|
7 | - 'module' => 'NotFound', |
|
8 | - 'controller' => '', |
|
9 | - 'view' => '' |
|
10 | - ] |
|
6 | + 'NotFound' => [ |
|
7 | + 'module' => 'NotFound', |
|
8 | + 'controller' => '', |
|
9 | + 'view' => '' |
|
10 | + ] |
|
11 | 11 | ], |
12 | 12 | ], |
13 | 13 | 'view_manager' => [ |
@@ -2,100 +2,100 @@ discard block |
||
2 | 2 | |
3 | 3 | if (!function_exists('ifdef')) |
4 | 4 | { |
5 | - function ifdef($value, Array $array) |
|
6 | - { |
|
7 | - $global = __DIR__ . '/../../../config/global.config.php'; |
|
5 | + function ifdef($value, Array $array) |
|
6 | + { |
|
7 | + $global = __DIR__ . '/../../../config/global.config.php'; |
|
8 | 8 | |
9 | - if (file_exists($global)) |
|
10 | - { |
|
11 | - $key = array_shift($array); |
|
12 | - $in = include $global; |
|
9 | + if (file_exists($global)) |
|
10 | + { |
|
11 | + $key = array_shift($array); |
|
12 | + $in = include $global; |
|
13 | 13 | |
14 | - do |
|
15 | - { |
|
16 | - if (is_array($in)) |
|
17 | - { |
|
18 | - if (array_key_exists($key, $in)) |
|
19 | - $in = $in[$key]; |
|
20 | - else |
|
21 | - return $value; |
|
22 | - } |
|
23 | - else |
|
24 | - return $value; |
|
14 | + do |
|
15 | + { |
|
16 | + if (is_array($in)) |
|
17 | + { |
|
18 | + if (array_key_exists($key, $in)) |
|
19 | + $in = $in[$key]; |
|
20 | + else |
|
21 | + return $value; |
|
22 | + } |
|
23 | + else |
|
24 | + return $value; |
|
25 | 25 | |
26 | - $key = ($array) ? array_shift($array) : NULL; |
|
26 | + $key = ($array) ? array_shift($array) : NULL; |
|
27 | 27 | |
28 | - if (!$key) |
|
29 | - return $in; |
|
28 | + if (!$key) |
|
29 | + return $in; |
|
30 | 30 | |
31 | - } while($key); |
|
32 | - } |
|
33 | - else |
|
34 | - return $value; |
|
35 | - } |
|
31 | + } while($key); |
|
32 | + } |
|
33 | + else |
|
34 | + return $value; |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | return [ |
39 | - 'project' => [ |
|
40 | - 'name' => ifdef('PROJECT NAME', ["project", "name"]), # The name of your project |
|
41 | - ], |
|
42 | - 'mail' => [ |
|
39 | + 'project' => [ |
|
40 | + 'name' => ifdef('PROJECT NAME', ["project", "name"]), # The name of your project |
|
41 | + ], |
|
42 | + 'mail' => [ |
|
43 | 43 | /** CHECKING: |
44 | 44 | * If checking is enabled, the registering process will require e-mail verification. |
45 | 45 | * If checking is enabled, the user will log in after registering. |
46 | 46 | */ |
47 | - 'checking' => [ |
|
48 | - 'enabled' => "N", |
|
49 | - 'from' => ifdef('[email protected]', ["mail", "noreply"]) |
|
50 | - ], |
|
51 | - "host" => ifdef('localhost', ["mail", "host"]) |
|
52 | - ], |
|
53 | - "authentication" => [ |
|
54 | - "method" => ifdef('_COOKIE', ["authentication", "method"]), # the method to store credentials (_COOKIE, _SESSION) |
|
55 | - "key" => ifdef('session_id', ["authentication", "key"]), # the key in the array to store credentials |
|
47 | + 'checking' => [ |
|
48 | + 'enabled' => "N", |
|
49 | + 'from' => ifdef('[email protected]', ["mail", "noreply"]) |
|
50 | + ], |
|
51 | + "host" => ifdef('localhost', ["mail", "host"]) |
|
52 | + ], |
|
53 | + "authentication" => [ |
|
54 | + "method" => ifdef('_COOKIE', ["authentication", "method"]), # the method to store credentials (_COOKIE, _SESSION) |
|
55 | + "key" => ifdef('session_id', ["authentication", "key"]), # the key in the array to store credentials |
|
56 | 56 | /** AUTH TYPE: |
57 | 57 | * db_table: get credentials from a table in a database |
58 | 58 | * db_user: get credentials from database users (database authentication) |
59 | 59 | */ |
60 | - "type" => "db_table", |
|
60 | + "type" => "db_table", |
|
61 | 61 | /** DB GATEWAY: |
62 | 62 | * Gateway is used to connect to database. It consists in an entity that connects to |
63 | 63 | * a database and checks the specified credentials. Theses will checked only if the AUTH TYPE is db_table. |
64 | 64 | */ |
65 | - "gateway" => [ |
|
66 | - "entity" => "USER", # Table name (without prefix if exists) |
|
67 | - /** CREDENTIALS: |
|
68 | - * The field names of credentials in the table. |
|
69 | - */ |
|
70 | - "credentials" => [ |
|
71 | - "username" => "USERNAME", |
|
72 | - "password" => "USER_PASSWORD" |
|
73 | - ], |
|
65 | + "gateway" => [ |
|
66 | + "entity" => "USER", # Table name (without prefix if exists) |
|
67 | + /** CREDENTIALS: |
|
68 | + * The field names of credentials in the table. |
|
69 | + */ |
|
70 | + "credentials" => [ |
|
71 | + "username" => "USERNAME", |
|
72 | + "password" => "USER_PASSWORD" |
|
73 | + ], |
|
74 | 74 | |
75 | - // [TO DO] - Add validations for the following ... |
|
75 | + // [TO DO] - Add validations for the following ... |
|
76 | 76 | |
77 | 77 | |
78 | - /** TABLE INFO: |
|
79 | - * Other information may be required for abstraction. If mail_checking is not enabled, your must define |
|
80 | - * at least the id_field for the table. |
|
81 | - */ |
|
82 | - "table_info" => [ |
|
83 | - "columns" => [ |
|
84 | - "id_field" => "USER_ID", # often the primary key |
|
85 | - "state_field" => "USER_STATE_ID", # required if mail_checking is enabled |
|
86 | - "email_field" => "EMAIL" # required registration process |
|
87 | - ], |
|
88 | - "column_values" => [ |
|
89 | - "state_field" => [ |
|
90 | - "pending_email" => 1, # required if mail_checking is enabled |
|
91 | - "user_active" => 2, # required if mail_checking is enabled |
|
92 | - ] |
|
93 | - ] |
|
94 | - ] |
|
78 | + /** TABLE INFO: |
|
79 | + * Other information may be required for abstraction. If mail_checking is not enabled, your must define |
|
80 | + * at least the id_field for the table. |
|
81 | + */ |
|
82 | + "table_info" => [ |
|
83 | + "columns" => [ |
|
84 | + "id_field" => "USER_ID", # often the primary key |
|
85 | + "state_field" => "USER_STATE_ID", # required if mail_checking is enabled |
|
86 | + "email_field" => "EMAIL" # required registration process |
|
87 | + ], |
|
88 | + "column_values" => [ |
|
89 | + "state_field" => [ |
|
90 | + "pending_email" => 1, # required if mail_checking is enabled |
|
91 | + "user_active" => 2, # required if mail_checking is enabled |
|
92 | + ] |
|
93 | + ] |
|
94 | + ] |
|
95 | 95 | |
96 | 96 | |
97 | - ], |
|
98 | - ], |
|
97 | + ], |
|
98 | + ], |
|
99 | 99 | /** AUTHORIZATION: |
100 | 100 | * |
101 | 101 | * If authorization is enabled, after user registering someone must authorize the first login of a user. |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | * |
105 | 105 | * If authorization is not enabled, users will log in after registration process without a previous authorization. |
106 | 106 | */ |
107 | - "authorization" => [ |
|
108 | - "enabled" => "N" |
|
109 | - ], |
|
110 | - "database" => [ |
|
111 | - /** TABLE PREFIX: |
|
112 | - * Database prefix of tables, specifically here, the prefix of entity gateway above. |
|
113 | - */ |
|
114 | - "prefix" => ifdef('APP', ["database", "prefix"]) |
|
115 | - ], |
|
116 | - "redirect" => "App" # the module that will be redirect to, after authentication |
|
107 | + "authorization" => [ |
|
108 | + "enabled" => "N" |
|
109 | + ], |
|
110 | + "database" => [ |
|
111 | + /** TABLE PREFIX: |
|
112 | + * Database prefix of tables, specifically here, the prefix of entity gateway above. |
|
113 | + */ |
|
114 | + "prefix" => ifdef('APP', ["database", "prefix"]) |
|
115 | + ], |
|
116 | + "redirect" => "App" # the module that will be redirect to, after authentication |
|
117 | 117 | ]; |
118 | 118 | \ No newline at end of file |
@@ -2,21 +2,21 @@ |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | 'project' => [ |
5 | - 'id' => 'id8931896', # Unique ID for the project |
|
6 | - 'name' => 'PHPStudio' # The name of your project |
|
5 | + 'id' => 'id8931896', # Unique ID for the project |
|
6 | + 'name' => 'PHPStudio' # The name of your project |
|
7 | 7 | ], |
8 | - 'mail' => [ |
|
9 | - "noreply" => "", |
|
10 | - "host" => "" |
|
11 | - ], |
|
12 | - "authentication" => [ |
|
13 | - "method" => "_COOKIE", # the method to store credentials (_COOKIE, _SESSION) |
|
14 | - "key" => "session_id6899112", # the key in the array to store credentials |
|
15 | - ], |
|
16 | - "database" => [ |
|
17 | - /** TABLE PREFIX: |
|
18 | - * Database prefix of tables, specifically here, the prefix of entity gateway above. |
|
19 | - */ |
|
20 | - "prefix" => "PHS" |
|
21 | - ] |
|
8 | + 'mail' => [ |
|
9 | + "noreply" => "", |
|
10 | + "host" => "" |
|
11 | + ], |
|
12 | + "authentication" => [ |
|
13 | + "method" => "_COOKIE", # the method to store credentials (_COOKIE, _SESSION) |
|
14 | + "key" => "session_id6899112", # the key in the array to store credentials |
|
15 | + ], |
|
16 | + "database" => [ |
|
17 | + /** TABLE PREFIX: |
|
18 | + * Database prefix of tables, specifically here, the prefix of entity gateway above. |
|
19 | + */ |
|
20 | + "prefix" => "PHS" |
|
21 | + ] |
|
22 | 22 | ]; |
23 | 23 | \ No newline at end of file |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | 'project' => [ |
5 | - 'id' => 'id8931896', # Unique ID for the project |
|
5 | + 'id' => 'id8931896', # Unique ID for the project |
|
6 | 6 | 'name' => 'PHPStudio' # The name of your project |
7 | 7 | ], |
8 | 8 | 'mail' => [ |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | "host" => "" |
11 | 11 | ], |
12 | 12 | "authentication" => [ |
13 | - "method" => "_COOKIE", # the method to store credentials (_COOKIE, _SESSION) |
|
14 | - "key" => "session_id6899112", # the key in the array to store credentials |
|
13 | + "method" => "_COOKIE", # the method to store credentials (_COOKIE, _SESSION) |
|
14 | + "key" => "session_id6899112", # the key in the array to store credentials |
|
15 | 15 | ], |
16 | 16 | "database" => [ |
17 | 17 | /** TABLE PREFIX: |