Completed
Push — master ( 11f6f2...df9156 )
by Julius
02:06
created
lib/Util.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 		foreach ($nav as $app)
48 48
 			$nav_tmp[$app['href']] = $app;
49 49
 		foreach ($order as $app)
50
-			if(array_key_exists($app, $nav_tmp))
50
+			if (array_key_exists($app, $nav_tmp))
51 51
 				$result[$app] = $nav_tmp[$app];
52 52
 		foreach ($nav as $app)
53 53
 			if (!array_key_exists($app['href'], $result))
Please login to merge, or discard this patch.
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,24 +34,28 @@
 block discarded – undo
34 34
 	public function getAppOrder() {
35 35
 		$order_user = $this->appConfig->getUserValue('order', $this->userId);
36 36
 		$order_default = $this->appConfig->getAppValue('order');
37
-		if ($order_user !== null && $order_user !== "")
38
-			$order = $order_user;
39
-		else
40
-			$order = $order_default;
37
+		if ($order_user !== null && $order_user !== "") {
38
+					$order = $order_user;
39
+		} else {
40
+					$order = $order_default;
41
+		}
41 42
 		return $order;
42 43
 	}
43 44
 
44 45
 	public function matchOrder($nav, $order) {
45 46
 		$nav_tmp = array();
46 47
 		$result = array();
47
-		foreach ($nav as $app)
48
-			$nav_tmp[$app['href']] = $app;
49
-		foreach ($order as $app)
50
-			if(array_key_exists($app, $nav_tmp))
48
+		foreach ($nav as $app) {
49
+					$nav_tmp[$app['href']] = $app;
50
+		}
51
+		foreach ($order as $app) {
52
+					if(array_key_exists($app, $nav_tmp))
51 53
 				$result[$app] = $nav_tmp[$app];
52
-		foreach ($nav as $app)
53
-			if (!array_key_exists($app['href'], $result))
54
+		}
55
+		foreach ($nav as $app) {
56
+					if (!array_key_exists($app['href'], $result))
54 57
 				$result[$app['href']] = $app;
58
+		}
55 59
 		return $result;
56 60
 	}
57 61
 
Please login to merge, or discard this patch.
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -27,36 +27,36 @@
 block discarded – undo
27 27
 
28 28
 class Util {
29 29
 
30
-	private $userId;
31
-	private $appConfig;
32
-
33
-	public function __construct(ConfigService $appConfig, $userId) {
34
-		$this->userId = $userId;
35
-		$this->appConfig = $appConfig;
36
-	}
37
-
38
-	public function getAppOrder() {
39
-		$order_user = $this->appConfig->getUserValue('order', $this->userId);
40
-		$order_default = $this->appConfig->getAppValue('order');
41
-		if ($order_user !== null && $order_user !== "")
42
-			$order = $order_user;
43
-		else
44
-			$order = $order_default;
45
-		return $order;
46
-	}
47
-
48
-	public function matchOrder($nav, $order) {
49
-		$nav_tmp = array();
50
-		$result = array();
51
-		foreach ($nav as $app)
52
-			$nav_tmp[$app['href']] = $app;
53
-		foreach ($order as $app)
54
-			if(array_key_exists($app, $nav_tmp))
55
-				$result[$app] = $nav_tmp[$app];
56
-		foreach ($nav as $app)
57
-			if (!array_key_exists($app['href'], $result))
58
-				$result[$app['href']] = $app;
59
-		return $result;
60
-	}
30
+    private $userId;
31
+    private $appConfig;
32
+
33
+    public function __construct(ConfigService $appConfig, $userId) {
34
+        $this->userId = $userId;
35
+        $this->appConfig = $appConfig;
36
+    }
37
+
38
+    public function getAppOrder() {
39
+        $order_user = $this->appConfig->getUserValue('order', $this->userId);
40
+        $order_default = $this->appConfig->getAppValue('order');
41
+        if ($order_user !== null && $order_user !== "")
42
+            $order = $order_user;
43
+        else
44
+            $order = $order_default;
45
+        return $order;
46
+    }
47
+
48
+    public function matchOrder($nav, $order) {
49
+        $nav_tmp = array();
50
+        $result = array();
51
+        foreach ($nav as $app)
52
+            $nav_tmp[$app['href']] = $app;
53
+        foreach ($order as $app)
54
+            if(array_key_exists($app, $nav_tmp))
55
+                $result[$app] = $nav_tmp[$app];
56
+        foreach ($nav as $app)
57
+            if (!array_key_exists($app['href'], $result))
58
+                $result[$app['href']] = $app;
59
+        return $result;
60
+    }
61 61
 
62 62
 }
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Controller/AppController.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,14 +52,14 @@
 block discarded – undo
52 52
 	 */
53 53
     public function index() {
54 54
     	$order = json_decode($this->util->getAppOrder());
55
-		if($order !== null && sizeof($order)>0) {
55
+		if ($order !== null && sizeof($order) > 0) {
56 56
 			$firstPage = $order[0];
57 57
 		} else {
58 58
 			$appId = 'files';
59
-			if(getenv('front_controller_active') === 'true') {
60
-				$firstPage = $this->urlGenerator->getAbsoluteURL('/apps/' . $appId . '/');
59
+			if (getenv('front_controller_active') === 'true') {
60
+				$firstPage = $this->urlGenerator->getAbsoluteURL('/apps/'.$appId.'/');
61 61
 			} else {
62
-				$firstPage = $this->urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/');
62
+				$firstPage = $this->urlGenerator->getAbsoluteURL('/index.php/apps/'.$appId.'/');
63 63
 			}
64 64
 		}
65 65
         return new RedirectResponse($firstPage);
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -36,33 +36,33 @@
 block discarded – undo
36 36
     private $userId;
37 37
     private $appConfig;
38 38
     private $urlGenerator;
39
-	private $util;
39
+    private $util;
40 40
 
41 41
     public function __construct($appName, IRequest $request, ConfigService $appConfig, IURLGenerator $urlGenerator, Util $util, $userId) {
42 42
         parent::__construct($appName, $request);
43 43
         $this->userId = $userId;
44 44
         $this->appConfig = $appConfig;
45 45
         $this->urlGenerator = $urlGenerator;
46
-		$this->util = $util;
46
+        $this->util = $util;
47 47
     }
48 48
 
49
-	/**
50
-	 * @NoCSRFRequired
51
-	 * @NoAdminRequired
52
-	 * @return RedirectResponse
53
-	 */
49
+    /**
50
+     * @NoCSRFRequired
51
+     * @NoAdminRequired
52
+     * @return RedirectResponse
53
+     */
54 54
     public function index() {
55
-    	$order = json_decode($this->util->getAppOrder());
56
-		if($order !== null && sizeof($order)>0) {
57
-			$firstPage = $order[0];
58
-		} else {
59
-			$appId = 'files';
60
-			if(getenv('front_controller_active') === 'true') {
61
-				$firstPage = $this->urlGenerator->getAbsoluteURL('/apps/' . $appId . '/');
62
-			} else {
63
-				$firstPage = $this->urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/');
64
-			}
65
-		}
55
+        $order = json_decode($this->util->getAppOrder());
56
+        if($order !== null && sizeof($order)>0) {
57
+            $firstPage = $order[0];
58
+        } else {
59
+            $appId = 'files';
60
+            if(getenv('front_controller_active') === 'true') {
61
+                $firstPage = $this->urlGenerator->getAbsoluteURL('/apps/' . $appId . '/');
62
+            } else {
63
+                $firstPage = $this->urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/');
64
+            }
65
+        }
66 66
         return new RedirectResponse($firstPage);
67 67
     }
68 68
 
Please login to merge, or discard this patch.
appinfo/routes.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@
 block discarded – undo
22 22
  */
23 23
 
24 24
 return [
25
-	'routes' => [
26
-		['name' => 'app#index', 'url' => '/', 'verb' => 'GET'],
27
-		['name' => 'settings#getOrder', 'url' => 'ajax/order.php', 'verb' => 'GET'],
28
-		['name' => 'settings#savePersonal', 'url' => 'ajax/personal.php', 'verb' => 'GET'],
29
-		['name' => 'settings#saveDefaultOrder', 'url' => 'ajax/admin.php', 'verb' => 'GET'],
30
-	]
25
+    'routes' => [
26
+        ['name' => 'app#index', 'url' => '/', 'verb' => 'GET'],
27
+        ['name' => 'settings#getOrder', 'url' => 'ajax/order.php', 'verb' => 'GET'],
28
+        ['name' => 'settings#savePersonal', 'url' => 'ajax/personal.php', 'verb' => 'GET'],
29
+        ['name' => 'settings#saveDefaultOrder', 'url' => 'ajax/admin.php', 'verb' => 'GET'],
30
+    ]
31 31
 ];
Please login to merge, or discard this patch.
lib/Service/ConfigService.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -27,28 +27,28 @@
 block discarded – undo
27 27
 
28 28
 class ConfigService {
29 29
 
30
-	private $config;
31
-	private $appName;
30
+    private $config;
31
+    private $appName;
32 32
 
33
-	public function __construct(IConfig $config, $appName) {
34
-		$this->config = $config;
35
-		$this->appName = $appName;
36
-	}
33
+    public function __construct(IConfig $config, $appName) {
34
+        $this->config = $config;
35
+        $this->appName = $appName;
36
+    }
37 37
 
38
-	public function getAppValue($key) {
39
-		return $this->config->getAppValue($this->appName, $key);
40
-	}
38
+    public function getAppValue($key) {
39
+        return $this->config->getAppValue($this->appName, $key);
40
+    }
41 41
 
42
-	public function setAppValue($key, $value) {
43
-		$this->config->setAppValue($this->appName, $key, $value);
44
-	}
42
+    public function setAppValue($key, $value) {
43
+        $this->config->setAppValue($this->appName, $key, $value);
44
+    }
45 45
 
46
-	public function getUserValue($key, $userId) {
47
-		return $this->config->getUserValue($userId, $this->appName, $key);
48
-	}
46
+    public function getUserValue($key, $userId) {
47
+        return $this->config->getUserValue($userId, $this->appName, $key);
48
+    }
49 49
 
50
-	public function setUserValue($key, $userId, $value) {
51
-		$this->config->setUserValue($userId, $this->appName, $key, $value);
52
-	}
50
+    public function setUserValue($key, $userId, $value) {
51
+        $this->config->setUserValue($userId, $this->appName, $key, $value);
52
+    }
53 53
 
54 54
 }
Please login to merge, or discard this patch.
lib/Controller/SettingsController.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -32,78 +32,78 @@
 block discarded – undo
32 32
 
33 33
 class SettingsController extends Controller {
34 34
 
35
-	private $userId;
36
-	private $appConfig;
37
-	private $navigationManager;
38
-	private $util;
35
+    private $userId;
36
+    private $appConfig;
37
+    private $navigationManager;
38
+    private $util;
39 39
 
40
-	public function __construct($appName, IRequest $request, ConfigService $appConfig, INavigationManager $urlGenerator, Util $util, $userId) {
41
-		parent::__construct($appName, $request);
42
-		$this->userId = $userId;
43
-		$this->appConfig = $appConfig;
44
-		$this->navigationManager = $urlGenerator;
45
-		$this->util = $util;
46
-	}
40
+    public function __construct($appName, IRequest $request, ConfigService $appConfig, INavigationManager $urlGenerator, Util $util, $userId) {
41
+        parent::__construct($appName, $request);
42
+        $this->userId = $userId;
43
+        $this->appConfig = $appConfig;
44
+        $this->navigationManager = $urlGenerator;
45
+        $this->util = $util;
46
+    }
47 47
 
48
-	/**
49
-	 * Admin: render admin page
50
-	 * FIXME: Move to dedicated class
51
-	 *
52
-	 * @return TemplateResponse
53
-	 */
54
-	public function adminIndex() {
55
-		// Private API call
56
-		$navigation = $this->navigationManager->getAll();
57
-		$order = json_decode($this->appConfig->getAppValue('order'));
58
-		$nav = $this->util->matchOrder($navigation, $order);
59
-		return new TemplateResponse(
60
-			$this->appName,
61
-			'admin',
62
-			["nav" => $nav],
63
-			'blank'
64
-		);
65
-	}
48
+    /**
49
+     * Admin: render admin page
50
+     * FIXME: Move to dedicated class
51
+     *
52
+     * @return TemplateResponse
53
+     */
54
+    public function adminIndex() {
55
+        // Private API call
56
+        $navigation = $this->navigationManager->getAll();
57
+        $order = json_decode($this->appConfig->getAppValue('order'));
58
+        $nav = $this->util->matchOrder($navigation, $order);
59
+        return new TemplateResponse(
60
+            $this->appName,
61
+            'admin',
62
+            ["nav" => $nav],
63
+            'blank'
64
+        );
65
+    }
66 66
 
67
-	/**
68
-	 * Admin: save default order
69
-	 *
70
-	 * @param $order
71
-	 * @return array response
72
-	 */
73
-	public function saveDefaultOrder($order) {
74
-		if (!is_null($order)) {
75
-			$this->appConfig->setAppValue('order', $order);
76
-		}
77
-		return array('status' => 'success', 'order' => $order);
78
-	}
67
+    /**
68
+     * Admin: save default order
69
+     *
70
+     * @param $order
71
+     * @return array response
72
+     */
73
+    public function saveDefaultOrder($order) {
74
+        if (!is_null($order)) {
75
+            $this->appConfig->setAppValue('order', $order);
76
+        }
77
+        return array('status' => 'success', 'order' => $order);
78
+    }
79 79
 
80
-	/**
81
-	 * Return order for current user
82
-	 *
83
-	 * @NoAdminRequired
84
-	 * @return array response
85
-	 */
86
-	public function getOrder() {
87
-		$order = $this->util->getAppOrder();
88
-		return array('status' => 'success', 'order' => $order);
89
-	}
80
+    /**
81
+     * Return order for current user
82
+     *
83
+     * @NoAdminRequired
84
+     * @return array response
85
+     */
86
+    public function getOrder() {
87
+        $order = $this->util->getAppOrder();
88
+        return array('status' => 'success', 'order' => $order);
89
+    }
90 90
 
91
-	/**
92
-	 * Save order for current user
93
-	 *
94
-	 * @NoAdminRequired
95
-	 * @param $order string
96
-	 * @return array response
97
-	 */
98
-	public function savePersonal($order) {
99
-		$this->appConfig->setUserValue('order', $this->userId, $order);
100
-		$response = array(
101
-			'status' => 'success',
102
-			'data' => array('message' => 'User order saved successfully.'),
103
-			'order' => $order
104
-		);
105
-		return $response;
106
-	}
91
+    /**
92
+     * Save order for current user
93
+     *
94
+     * @NoAdminRequired
95
+     * @param $order string
96
+     * @return array response
97
+     */
98
+    public function savePersonal($order) {
99
+        $this->appConfig->setUserValue('order', $this->userId, $order);
100
+        $response = array(
101
+            'status' => 'success',
102
+            'data' => array('message' => 'User order saved successfully.'),
103
+            'order' => $order
104
+        );
105
+        return $response;
106
+    }
107 107
 
108 108
 
109 109
 }
Please login to merge, or discard this patch.
lib/AppInfo/Application.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@
 block discarded – undo
28 28
 
29 29
 class Application extends App {
30 30
 
31
-	public function __construct(array $urlParams = array()) {
32
-		parent::__construct('apporder', $urlParams);
33
-		$container = $this->getContainer();
34
-		$container->registerService('ConfigService', function($c) {
35
-			return new ConfigService(
36
-				$c->query('Config'),
37
-				$c->query('AppName')
38
-			);
39
-		});
40
-	}
31
+    public function __construct(array $urlParams = array()) {
32
+        parent::__construct('apporder', $urlParams);
33
+        $container = $this->getContainer();
34
+        $container->registerService('ConfigService', function($c) {
35
+            return new ConfigService(
36
+                $c->query('Config'),
37
+                $c->query('AppName')
38
+            );
39
+        });
40
+    }
41 41
 }
Please login to merge, or discard this patch.