@@ -52,6 +52,9 @@ |
||
52 | 52 | return $ret; |
53 | 53 | } |
54 | 54 | |
55 | + /** |
|
56 | + * @param integer $count |
|
57 | + */ |
|
55 | 58 | public function addPluginLinks($count, $plugins) |
56 | 59 | { |
57 | 60 | $secure_menu = array(); |
@@ -14,8 +14,7 @@ |
||
14 | 14 | if($ret === false || strlen($ret) === 0) |
15 | 15 | { |
16 | 16 | return '/'; |
17 | - } |
|
18 | - else if($ret[strlen($ret)-1] !== '/') |
|
17 | + } else if($ret[strlen($ret)-1] !== '/') |
|
19 | 18 | { |
20 | 19 | $ret .= '/'; |
21 | 20 | } |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | $script_dir = dirname(__FILE__); |
11 | 11 | $ret = substr($script_dir, strlen($root)); |
12 | 12 | |
13 | - if($ret === false || strlen($ret) === 0) |
|
13 | + if ($ret === false || strlen($ret) === 0) |
|
14 | 14 | { |
15 | 15 | return '/'; |
16 | 16 | } |
17 | - else if($ret[strlen($ret)-1] !== '/') |
|
17 | + else if ($ret[strlen($ret)-1] !== '/') |
|
18 | 18 | { |
19 | 19 | $ret .= '/'; |
20 | 20 | } |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | $script_dir = dirname(__FILE__); |
27 | 27 | $plugin_files = glob($script_dir.'/*/plugin.php'); |
28 | 28 | $count = count($plugin_files); |
29 | - for($i = 0; $i < $count; $i++) |
|
29 | + for ($i = 0; $i < $count; $i++) |
|
30 | 30 | { |
31 | 31 | include($plugin_files[$i]); |
32 | 32 | } |
33 | 33 | $ret = array(); |
34 | - foreach(get_declared_classes() as $class) |
|
34 | + foreach (get_declared_classes() as $class) |
|
35 | 35 | { |
36 | - if(is_subclass_of($class, 'SecurePlugin')) |
|
36 | + if (is_subclass_of($class, 'SecurePlugin')) |
|
37 | 37 | { |
38 | 38 | $ret[] = new $class(); |
39 | 39 | } |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | public function addPluginLinks($count, $plugins) |
45 | 45 | { |
46 | 46 | $secure_menu = array(); |
47 | - for($i = 0; $i < $count; $i++) |
|
47 | + for ($i = 0; $i < $count; $i++) |
|
48 | 48 | { |
49 | 49 | $ret = $plugins[$i]->get_secure_menu_entries($this, $this->user); |
50 | - if($ret !== false) |
|
50 | + if ($ret !== false) |
|
51 | 51 | { |
52 | 52 | $secure_menu = array_merge($secure_menu, $ret); |
53 | 53 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | function add_links() |
80 | 80 | { |
81 | - if($this->user !== false) |
|
81 | + if ($this->user !== false) |
|
82 | 82 | { |
83 | 83 | $this->addPluginLinks($this->plugin_count, $this->plugins); |
84 | 84 | } |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | function get_secure_child_entry_points() |
88 | 88 | { |
89 | 89 | $entry_points = ''; |
90 | - for($i = 0; $i < $this->plugin_count; $i++) |
|
90 | + for ($i = 0; $i < $this->plugin_count; $i++) |
|
91 | 91 | { |
92 | 92 | $ret = $this->plugins[$i]->get_plugin_entry_point(); |
93 | - if($ret !== false) |
|
93 | + if ($ret !== false) |
|
94 | 94 | { |
95 | 95 | $entry_points .= '<li><a href="'.$ret['link'].'">'.$ret['name'].'</a></li>'; |
96 | 96 | } |
@@ -10,13 +10,13 @@ |
||
10 | 10 | public function login($request, $response, $args) |
11 | 11 | { |
12 | 12 | $params = $request->getParams(); |
13 | - if(!isset($params['username']) || !isset($params['password'])) |
|
13 | + if (!isset($params['username']) || !isset($params['password'])) |
|
14 | 14 | { |
15 | 15 | return $response->withStatus(400); |
16 | 16 | } |
17 | 17 | $auth = AuthProvider::getInstance(); |
18 | 18 | $res = $auth->login($params['username'], $params['password']); |
19 | - if($res === false) |
|
19 | + if ($res === false) |
|
20 | 20 | { |
21 | 21 | return $response->withStatus(403); |
22 | 22 | } |
@@ -19,8 +19,7 @@ |
||
19 | 19 | if($res === false) |
20 | 20 | { |
21 | 21 | return $response->withStatus(403); |
22 | - } |
|
23 | - else |
|
22 | + } else |
|
24 | 23 | { |
25 | 24 | return $response->withJson($res); |
26 | 25 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | function add_links() |
22 | 22 | { |
23 | - if($this->user !== false) |
|
23 | + if ($this->user !== false) |
|
24 | 24 | { |
25 | 25 | $this->addPluginLinks($this->plugin_count, $this->plugins); |
26 | 26 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -require __DIR__ . '/vendor/autoload.php'; |
|
2 | +require __DIR__.'/vendor/autoload.php'; |
|
3 | 3 | |
4 | -spl_autoload_register(function ($class) { |
|
4 | +spl_autoload_register(function($class) { |
|
5 | 5 | |
6 | 6 | // project-specific namespace prefix |
7 | 7 | $prefix = 'Flipside\\Secure\\'; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | // replace the namespace prefix with the base directory, replace namespace |
23 | 23 | // separators with directory separators in the relative class name, append |
24 | 24 | // with .php |
25 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
25 | + $file = $base_dir.str_replace('\\', '/', $relative_class).'.php'; |
|
26 | 26 | |
27 | 27 | // if the file exists, require it |
28 | 28 | if (file_exists($file)) { |