Completed
Push — master ( d13b22...a2d243 )
by Justin
05:45
created
system/packages/com.jukusoft.cms.tasks/classes/tasks.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 class Tasks {
20 20
 
21
-	public static function schedule (int $limit = 3) {
21
+	public static function schedule(int $limit = 3) {
22 22
 		//execute overdued tasks
23 23
 		foreach (self::getOverduedTasks($limit) as $task) {
24 24
 			//cast task
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		}
33 33
 	}
34 34
 
35
-	public static function getOverduedTasks (int $limit = 10) : array {
35
+	public static function getOverduedTasks(int $limit = 10) : array {
36 36
 		$rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}tasks` WHERE (DATE_ADD(`last_execution`, INTERVAL `interval` MINUTE) < NOW() OR `last_execution` = '0000-00-00 00:00:00') AND `activated` = '1' LIMIT 0, :limit; ", array(
37 37
 			'limit' => array(
38 38
 				'type' => PDO::PARAM_INT,
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -18,46 +18,46 @@
 block discarded – undo
18 18
 
19 19
 class Tasks {
20 20
 
21
-	public static function schedule (int $limit = 3) {
22
-		//execute overdued tasks
23
-		foreach (self::getOverduedTasks($limit) as $task) {
24
-			//cast task
25
-			$task = Task::cast($task);
21
+    public static function schedule (int $limit = 3) {
22
+        //execute overdued tasks
23
+        foreach (self::getOverduedTasks($limit) as $task) {
24
+            //cast task
25
+            $task = Task::cast($task);
26 26
 
27
-			Logger::log(LogLevel::DEBUG, "execute task '" . $task->getTitle() . "'");
27
+            Logger::log(LogLevel::DEBUG, "execute task '" . $task->getTitle() . "'");
28 28
 
29
-			//execute task
30
-			$task->execute();
29
+            //execute task
30
+            $task->execute();
31 31
 
32
-			//check, if task is a one-time task
33
-			if ($task->deleteAfterExecution()) {
34
-				Logger::log(LogLevel::INFO, "delete task '" . $task->getTitle() . "', because delete_on_execution is enabled.");
32
+            //check, if task is a one-time task
33
+            if ($task->deleteAfterExecution()) {
34
+                Logger::log(LogLevel::INFO, "delete task '" . $task->getTitle() . "', because delete_on_execution is enabled.");
35 35
 
36
-				//delete task
37
-				$task->delete();
38
-			} else {
39
-				//update last execution timestamp
40
-				$task->setLastExecution();
41
-			}
42
-		}
43
-	}
36
+                //delete task
37
+                $task->delete();
38
+            } else {
39
+                //update last execution timestamp
40
+                $task->setLastExecution();
41
+            }
42
+        }
43
+    }
44 44
 
45
-	public static function getOverduedTasks (int $limit = 10) : array {
46
-		$rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}tasks` WHERE (DATE_ADD(`last_execution`, INTERVAL `interval` MINUTE) < NOW() OR `last_execution` = '0000-00-00 00:00:00') AND `activated` = '1' LIMIT 0, :limit; ", array(
47
-			'limit' => array(
48
-				'type' => PDO::PARAM_INT,
49
-				'value' => $limit
50
-			)
51
-		));
45
+    public static function getOverduedTasks (int $limit = 10) : array {
46
+        $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}tasks` WHERE (DATE_ADD(`last_execution`, INTERVAL `interval` MINUTE) < NOW() OR `last_execution` = '0000-00-00 00:00:00') AND `activated` = '1' LIMIT 0, :limit; ", array(
47
+            'limit' => array(
48
+                'type' => PDO::PARAM_INT,
49
+                'value' => $limit
50
+            )
51
+        ));
52 52
 
53
-		$tasks = array();
53
+        $tasks = array();
54 54
 
55
-		foreach ($rows as $row) {
56
-			$tasks[] = new Task($row);
57
-		}
55
+        foreach ($rows as $row) {
56
+            $tasks[] = new Task($row);
57
+        }
58 58
 
59
-		return $tasks;
60
-	}
59
+        return $tasks;
60
+    }
61 61
 
62 62
 }
63 63
 
Please login to merge, or discard this patch.
plugins/advancedpagetypes/classes/asciidocpage.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
 
28 28
 class Plugin_AdvancedPageTypes_AsciiDocPage extends PageType {
29 29
 
30
-	public function getAdditionalHeaderCode(): string {
31
-		$base_url = DomainUtils::getBaseURL() . "/";
30
+    public function getAdditionalHeaderCode(): string {
31
+        $base_url = DomainUtils::getBaseURL() . "/";
32 32
 
33
-		return "<!-- header javascript -->
33
+        return "<!-- header javascript -->
34 34
     			<script language=\"javascript\" type=\"text/javascript\" src=\"" . $base_url . "plugins/advancedpagetypes/asciidoc/asciidoc/browser/asciidoctor.js\"></script>";
35
-	}
35
+    }
36 36
 
37
-	public function getContent(): string {
38
-		$content = $this->getPage()->getContent();
37
+    public function getContent(): string {
38
+        $content = $this->getPage()->getContent();
39 39
 
40
-		return "<div id=\"asciidocconverter\"></div>";
41
-	}
40
+        return "<div id=\"asciidocconverter\"></div>";
41
+    }
42 42
 
43
-	public function getFooterScripts(): string {
44
-		return "<script>
43
+    public function getFooterScripts(): string {
44
+        return "<script>
45 45
 					$(document).ready(function () {
46 46
 					    var asciidoctor = Asciidoctor();
47 47
 						var content = $" . "(\"#asciidocconverter\").html();
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 						$" . "(\"#asciidocconverter\").html(content);
51 51
 					});
52 52
 				</script>";
53
-	}
53
+    }
54 54
 
55 55
 }
56 56
 
Please login to merge, or discard this patch.
system/packages/com.jukusoft.cms.plugin/extensions/storeinstaller.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -27,55 +27,55 @@
 block discarded – undo
27 27
 
28 28
 class StoreInstaller extends PluginInstaller_Plugin {
29 29
 
30
-	public function install(Plugin $plugin, array $install_json): bool {
31
-		if (isset($install_json['store'])) {
32
-			$store_dirs = $install_json['store'];
33
-
34
-			foreach ($store_dirs as $dir) {
35
-				if (is_array($dir)) {
36
-					$dir_path = STORE_PATH . $dir['dir'];
37
-					$permissions = "0" . $dir['chmod'];
38
-
39
-					//create directory, if not exists
40
-					if (!file_exists($dir_path)) {
41
-						//create directory
42
-						mkdir($dir_path);
43
-					}
44
-
45
-					chmod($dir_path, $permissions);
46
-				} else {
47
-					$dir = str_replace("..", "", $dir);
48
-
49
-					//get directory path
50
-					$dir_path = STORE_PATH . $dir;
51
-
52
-					//create directory, if not exists
53
-					if (!file_exists($dir_path)) {
54
-						//create directory
55
-						mkdir($dir_path);
56
-
57
-						if(!chmod($dir_path, 0777)) {
58
-							chmod($dir_path, 0755);
59
-
60
-							throw new IllegalStateException("Cannot change file permissions of directory '". $dir_path . "'");
61
-						}
62
-					}
63
-				}
64
-			}
65
-		}
66
-
67
-		return true;
68
-	}
69
-
70
-	public function uninstall(Plugin $plugin, array $install_json): bool {
71
-		//dont do anything, because directories should not be deleted
72
-
73
-		return true;
74
-	}
75
-
76
-	public function upgrade(Plugin $plugin, array $install_json): bool {
77
-		return $this->install($plugin, $install_json);
78
-	}
30
+    public function install(Plugin $plugin, array $install_json): bool {
31
+        if (isset($install_json['store'])) {
32
+            $store_dirs = $install_json['store'];
33
+
34
+            foreach ($store_dirs as $dir) {
35
+                if (is_array($dir)) {
36
+                    $dir_path = STORE_PATH . $dir['dir'];
37
+                    $permissions = "0" . $dir['chmod'];
38
+
39
+                    //create directory, if not exists
40
+                    if (!file_exists($dir_path)) {
41
+                        //create directory
42
+                        mkdir($dir_path);
43
+                    }
44
+
45
+                    chmod($dir_path, $permissions);
46
+                } else {
47
+                    $dir = str_replace("..", "", $dir);
48
+
49
+                    //get directory path
50
+                    $dir_path = STORE_PATH . $dir;
51
+
52
+                    //create directory, if not exists
53
+                    if (!file_exists($dir_path)) {
54
+                        //create directory
55
+                        mkdir($dir_path);
56
+
57
+                        if(!chmod($dir_path, 0777)) {
58
+                            chmod($dir_path, 0755);
59
+
60
+                            throw new IllegalStateException("Cannot change file permissions of directory '". $dir_path . "'");
61
+                        }
62
+                    }
63
+                }
64
+            }
65
+        }
66
+
67
+        return true;
68
+    }
69
+
70
+    public function uninstall(Plugin $plugin, array $install_json): bool {
71
+        //dont do anything, because directories should not be deleted
72
+
73
+        return true;
74
+    }
75
+
76
+    public function upgrade(Plugin $plugin, array $install_json): bool {
77
+        return $this->install($plugin, $install_json);
78
+    }
79 79
 
80 80
 }
81 81
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,10 +54,10 @@
 block discarded – undo
54 54
 						//create directory
55 55
 						mkdir($dir_path);
56 56
 
57
-						if(!chmod($dir_path, 0777)) {
57
+						if (!chmod($dir_path, 0777)) {
58 58
 							chmod($dir_path, 0755);
59 59
 
60
-							throw new IllegalStateException("Cannot change file permissions of directory '". $dir_path . "'");
60
+							throw new IllegalStateException("Cannot change file permissions of directory '" . $dir_path . "'");
61 61
 						}
62 62
 					}
63 63
 				}
Please login to merge, or discard this patch.
system/core/classes/security.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -34,20 +34,20 @@  discard block
 block discarded – undo
34 34
         @ini_set("expose_php", "off");
35 35
 
36 36
         //dont allow include($url) to avoid code injection
37
-		@ini_set("allow_url_include", "0");
37
+        @ini_set("allow_url_include", "0");
38 38
 
39
-		header("X-Content-Type-Options: nosniff");
39
+        header("X-Content-Type-Options: nosniff");
40 40
 
41
-		//enable internet explorer XSS protection, https://www.perpetual-beta.org/weblog/security-headers.html
42
-		header("X-XSS-Protection: 1; mode=block");
41
+        //enable internet explorer XSS protection, https://www.perpetual-beta.org/weblog/security-headers.html
42
+        header("X-XSS-Protection: 1; mode=block");
43 43
 
44
-		//https://developer.mozilla.org/de/docs/Web/HTTP/Headers/X-Frame-Options
45
-		$x_frame_options = Settings::get("x_frame_options", "SAMEORIGIN");
44
+        //https://developer.mozilla.org/de/docs/Web/HTTP/Headers/X-Frame-Options
45
+        $x_frame_options = Settings::get("x_frame_options", "SAMEORIGIN");
46 46
 
47
-		if (strcmp($x_frame_options, "none") !== 0) {
48
-			//set X-Frame-Options header to avoid clickjacking attacks
49
-			header("X-Frame-Options: " . $x_frame_options);
50
-		}
47
+        if (strcmp($x_frame_options, "none") !== 0) {
48
+            //set X-Frame-Options header to avoid clickjacking attacks
49
+            header("X-Frame-Options: " . $x_frame_options);
50
+        }
51 51
 
52 52
         /**
53 53
          * dont allow some XSS attacks or SQL Injections from host or server name
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
     }
70 70
 
71 71
     protected static function initCSRFToken () {
72
-    	if (session_status() !== PHP_SESSION_ACTIVE) {
73
-    		throw new IllegalStateException("session wasnt started yet.");
74
-    		exit;
75
-		}
72
+        if (session_status() !== PHP_SESSION_ACTIVE) {
73
+            throw new IllegalStateException("session wasnt started yet.");
74
+            exit;
75
+        }
76 76
 
77 77
         if (!isset($_SESSION['csrf_token'])) {
78 78
             /*self::$csrf_token = hash_hmac(
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             );*/
83 83
 
84 84
             //generate new CSRF token
85
-			self::generateNewCSRFToken();
85
+            self::generateNewCSRFToken();
86 86
         } else {
87 87
             //get CSRF token from string
88 88
             self::$csrf_token = $_SESSION['csrf_token'];
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
     }
91 91
 
92 92
     public static function generateNewCSRFToken () {
93
-		//generate new random token with 32 bytes
94
-		self::$csrf_token = base64_encode( openssl_random_pseudo_bytes(32));
93
+        //generate new random token with 32 bytes
94
+        self::$csrf_token = base64_encode( openssl_random_pseudo_bytes(32));
95 95
 
96
-		$_SESSION['csrf_token'] = self::$csrf_token;
97
-	}
96
+        $_SESSION['csrf_token'] = self::$csrf_token;
97
+    }
98 98
 
99 99
     public static function getCSRFToken () {
100 100
         //return CSRF token
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
     }
107 107
 
108 108
     public static function checkCSRFToken ($value = null) {
109
-    	if (is_null($value)) {
110
-    		if (!isset($_REQUEST['csrf_token']) || empty($_REQUEST['csrf_token'])) {
111
-    			return false;
112
-			}
109
+        if (is_null($value)) {
110
+            if (!isset($_REQUEST['csrf_token']) || empty($_REQUEST['csrf_token'])) {
111
+                return false;
112
+            }
113 113
 
114
-    		$value = $_REQUEST['csrf_token'];
115
-		}
114
+            $value = $_REQUEST['csrf_token'];
115
+        }
116 116
 
117 117
         return self::$csrf_token === $value;
118 118
     }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
     protected static $csrf_token = "";
6 6
 
7
-    public static function checkPHPOptions () {
7
+    public static function checkPHPOptions() {
8 8
         if (get_magic_quotes_gpc()) {
9 9
             throw new SecurityException("magic quotes is on.");
10 10
         }
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
         libxml_disable_entity_loader(true);
22 22
     }
23 23
 
24
-    public static function check () {
24
+    public static function check() {
25 25
         //check php options
26 26
         self::checkPHPOptions();
27 27
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         self::initCSRFToken();
69 69
     }
70 70
 
71
-    protected static function initCSRFToken () {
71
+    protected static function initCSRFToken() {
72 72
     	if (session_status() !== PHP_SESSION_ACTIVE) {
73 73
     		throw new IllegalStateException("session wasnt started yet.");
74 74
     		exit;
@@ -89,23 +89,23 @@  discard block
 block discarded – undo
89 89
         }
90 90
     }
91 91
 
92
-    public static function generateNewCSRFToken () {
92
+    public static function generateNewCSRFToken() {
93 93
 		//generate new random token with 32 bytes
94
-		self::$csrf_token = base64_encode( openssl_random_pseudo_bytes(32));
94
+		self::$csrf_token = base64_encode(openssl_random_pseudo_bytes(32));
95 95
 
96 96
 		$_SESSION['csrf_token'] = self::$csrf_token;
97 97
 	}
98 98
 
99
-    public static function getCSRFToken () {
99
+    public static function getCSRFToken() {
100 100
         //return CSRF token
101 101
         return self::$csrf_token;
102 102
     }
103 103
 
104
-    public static function getCSRFTokenField () {
104
+    public static function getCSRFTokenField() {
105 105
         return "<input type=\"hidden\" name=<\"csrf_token\" value=\"" . self::$csrf_token . "\" />";
106 106
     }
107 107
 
108
-    public static function checkCSRFToken ($value = null) {
108
+    public static function checkCSRFToken($value = null) {
109 109
     	if (is_null($value)) {
110 110
     		if (!isset($_REQUEST['csrf_token']) || empty($_REQUEST['csrf_token'])) {
111 111
     			return false;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         return self::$csrf_token === $value;
118 118
     }
119 119
 
120
-    public static function containsPort ($address) {
120
+    public static function containsPort($address) {
121 121
         if (strpos($address, ":") === false) {
122 122
             return false;
123 123
         }
Please login to merge, or discard this patch.
plugins/httpauth/classes/httpauth.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 	//http://php.net/manual/de/features.http-auth.php
31 31
 
32
-	public static function headerEvent () {
32
+	public static function headerEvent() {
33 33
 		//get preferences first
34 34
 		$prefs = new Preferences("plugin_httpauth");
35 35
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		}
90 90
 	}
91 91
 
92
-	protected static function sendHeader (Preferences $prefs) {
92
+	protected static function sendHeader(Preferences $prefs) {
93 93
 		$realm_name = $prefs->get("realm_name", "Website");
94 94
 
95 95
 		//send http header, so browser will show a login form
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		exit;
104 104
 	}
105 105
 
106
-	public static function logoutEvent () {
106
+	public static function logoutEvent() {
107 107
 		//because browser safes http auth credentials by default, we need to do a little trick to clear browser auth cache
108 108
 		header("Location: " . DomainUtils::getProtocol() . "foo:bar@" . DomainUtils::getBaseURL(true));
109 109
 
Please login to merge, or discard this patch.
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -27,90 +27,90 @@
 block discarded – undo
27 27
 
28 28
 class Plugin_HTTPAuth_HTTPAuth {
29 29
 
30
-	//http://php.net/manual/de/features.http-auth.php
30
+    //http://php.net/manual/de/features.http-auth.php
31 31
 
32
-	public static function headerEvent () {
33
-		//get preferences first
34
-		$prefs = new Preferences("plugin_httpauth");
32
+    public static function headerEvent () {
33
+        //get preferences first
34
+        $prefs = new Preferences("plugin_httpauth");
35 35
 
36
-		$activated = $prefs->get("activated", true);
36
+        $activated = $prefs->get("activated", true);
37 37
 
38
-		if (!$activated) {
39
-			return;
40
-		}
38
+        if (!$activated) {
39
+            return;
40
+        }
41 41
 
42
-		//check, if user is logged in
43
-		if (User::current()->isLoggedIn()) {
44
-			//http auth is not required, because user is already logged in
45
-			return;
46
-		}
42
+        //check, if user is logged in
43
+        if (User::current()->isLoggedIn()) {
44
+            //http auth is not required, because user is already logged in
45
+            return;
46
+        }
47 47
 
48
-		//check, if credentials was already send
49
-		if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
50
-			self::sendHeader($prefs);
51
-		} else {
52
-			$username = $_SERVER['PHP_AUTH_USER'];
53
-			$password = $_SERVER['PHP_AUTH_PW'];
48
+        //check, if credentials was already send
49
+        if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
50
+            self::sendHeader($prefs);
51
+        } else {
52
+            $username = $_SERVER['PHP_AUTH_USER'];
53
+            $password = $_SERVER['PHP_AUTH_PW'];
54 54
 
55
-			//try to login
56
-			$res = User::current()->loginByUsername($username, $password);
55
+            //try to login
56
+            $res = User::current()->loginByUsername($username, $password);
57 57
 
58
-			if ($res['success'] !== true) {
59
-				//send http header again
60
-				self::sendHeader($prefs);
61
-			} else {
62
-				//login successful, show redirect
63
-				if (isset($_REQUEST['redirect_url']) && !empty($_REQUEST['redirect_url'])) {
64
-					//TODO: check for security issues, maybe we should check if redirect_url is a known domain
58
+            if ($res['success'] !== true) {
59
+                //send http header again
60
+                self::sendHeader($prefs);
61
+            } else {
62
+                //login successful, show redirect
63
+                if (isset($_REQUEST['redirect_url']) && !empty($_REQUEST['redirect_url'])) {
64
+                    //TODO: check for security issues, maybe we should check if redirect_url is a known domain
65 65
 
66
-					header("Location: " . urldecode($_REQUEST['redirect_url']));
66
+                    header("Location: " . urldecode($_REQUEST['redirect_url']));
67 67
 
68
-					//flush gzip buffer
69
-					ob_end_flush();
68
+                    //flush gzip buffer
69
+                    ob_end_flush();
70 70
 
71
-					exit;
72
-				} else {
73
-					//redirect to index page
71
+                    exit;
72
+                } else {
73
+                    //redirect to index page
74 74
 
75
-					//get domain
76
-					$domain = Registry::singleton()->getObject("domain");
75
+                    //get domain
76
+                    $domain = Registry::singleton()->getObject("domain");
77 77
 
78
-					//generate index url
79
-					$index_url = DomainUtils::generateURL($domain->getHomePage());
78
+                    //generate index url
79
+                    $index_url = DomainUtils::generateURL($domain->getHomePage());
80 80
 
81
-					header("Location: " . $index_url);
81
+                    header("Location: " . $index_url);
82 82
 
83
-					//flush gzip buffer
84
-					ob_end_flush();
83
+                    //flush gzip buffer
84
+                    ob_end_flush();
85 85
 
86
-					exit;
87
-				}
88
-			}
89
-		}
90
-	}
86
+                    exit;
87
+                }
88
+            }
89
+        }
90
+    }
91 91
 
92
-	protected static function sendHeader (Preferences $prefs) {
93
-		$realm_name = $prefs->get("realm_name", "Website");
92
+    protected static function sendHeader (Preferences $prefs) {
93
+        $realm_name = $prefs->get("realm_name", "Website");
94 94
 
95
-		//send http header, so browser will show a login form
96
-		header('WWW-Authenticate: Basic realm="' . $realm_name . '"');
97
-		header('HTTP/1.0 401 Unauthorized');
95
+        //send http header, so browser will show a login form
96
+        header('WWW-Authenticate: Basic realm="' . $realm_name . '"');
97
+        header('HTTP/1.0 401 Unauthorized');
98 98
 
99
-		//text which will be sended, if user clicks on abort
100
-		echo $prefs->get("abort_text", "<h1>401 Authorization Required</h1>");
99
+        //text which will be sended, if user clicks on abort
100
+        echo $prefs->get("abort_text", "<h1>401 Authorization Required</h1>");
101 101
 
102
-		ob_end_flush();
103
-		exit;
104
-	}
102
+        ob_end_flush();
103
+        exit;
104
+    }
105 105
 
106
-	public static function logoutEvent () {
107
-		//because browser safes http auth credentials by default, we need to do a little trick to clear browser auth cache
108
-		header("Location: " . DomainUtils::getProtocol() . "foo:bar@" . DomainUtils::getBaseURL(true));
106
+    public static function logoutEvent () {
107
+        //because browser safes http auth credentials by default, we need to do a little trick to clear browser auth cache
108
+        header("Location: " . DomainUtils::getProtocol() . "foo:bar@" . DomainUtils::getBaseURL(true));
109 109
 
110
-		//echo "Location: " . DomainUtils::getProtocol() . "foo:bar@" . DomainUtils::getBaseURL(true);
110
+        //echo "Location: " . DomainUtils::getProtocol() . "foo:bar@" . DomainUtils::getBaseURL(true);
111 111
 
112
-		exit;
113
-	}
112
+        exit;
113
+    }
114 114
 
115 115
 }
116 116
 
Please login to merge, or discard this patch.
system/packages/com.jukusoft.cms.domain/classes/domainutils.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 class DomainUtils {
29 29
 
30
-	public static function getTLD ($url) {
30
+	public static function getTLD($url) {
31 31
 		$domain_tld = "";
32 32
 
33 33
 		//http://news.mullerdigital.com/2013/10/30/how-to-get-the-domain-and-tld-from-a-url-using-php-and-regular-expression/
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
 		return $domain_tld[0];
38 38
 	}
39 39
 
40
-	public static function isHTTPS () {
40
+	public static function isHTTPS() {
41 41
 		return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off";
42 42
 	}
43 43
 
44
-	public static function getPort () {
44
+	public static function getPort() {
45 45
 		return (int) $_SERVER['SERVER_PORT'];
46 46
 	}
47 47
 
48
-	public static function isProxyUsed () {
48
+	public static function isProxyUsed() {
49 49
 		return isset($_SERVER['HTTP_X_FORWARDED_HOST']) && !empty($_SERVER['HTTP_X_FORWARDED_HOST']);
50 50
 	}
51 51
 
52
-	public static function getHost () {
52
+	public static function getHost() {
53 53
 		$host = "";
54 54
 
55 55
 		if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && !empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
@@ -80,23 +80,23 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * alias to getHost()
82 82
 	 */
83
-	public static function getDomain () {
83
+	public static function getDomain() {
84 84
 		return self::getHost();
85 85
 	}
86 86
 
87
-	public static function getReferer () {
87
+	public static function getReferer() {
88 88
 		return htmlentities($_SERVER['HTTP_REFERER']);
89 89
 	}
90 90
 
91
-	public static function getRequestMethod () {
91
+	public static function getRequestMethod() {
92 92
 		return htmlspecialchars($_SERVER['REQUEST_METHOD']);
93 93
 	}
94 94
 
95
-	public static function getRequestURI () {
95
+	public static function getRequestURI() {
96 96
 		return htmlentities($_SERVER['REQUEST_URI']);
97 97
 	}
98 98
 
99
-	public static function getBaseURL (bool $without_protocol = false) {
99
+	public static function getBaseURL(bool $without_protocol = false) {
100 100
 		$url = "";
101 101
 
102 102
 		if (!$without_protocol) {//add protocol
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	/**
122 122
 	 * generate an url for a page in this form: http(s)://<Domain><Base URL><Page>
123 123
 	 */
124
-	public static function generateURL (string $page, array $params = array()) : string {
124
+	public static function generateURL(string $page, array $params = array()) : string {
125 125
 		$params_str = "";
126 126
 
127 127
 		if (count($params) > 0) {
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 		return self::getBaseURL() . "/" . $page . $params_str;
140 140
 	}
141 141
 
142
-	public static function getURL () {
142
+	public static function getURL() {
143 143
 		return self::getBaseURL() . self::getRequestURI();
144 144
 	}
145 145
 
146 146
 	/**
147 147
 	 * faster implementation of getTld()
148 148
 	 */
149
-	public static function getCurrentDomain () {
149
+	public static function getCurrentDomain() {
150 150
 		$host = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
151 151
 		$domain = explode("?", $host);
152 152
 		$host = $domain[0];
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		return /*$domain*/$host;
166 166
 	}
167 167
 
168
-	public static function getProtocol () : string {
168
+	public static function getProtocol() : string {
169 169
 		if (self::isHTTPS()) {
170 170
 			return "https://";
171 171
 		} else {
Please login to merge, or discard this patch.
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -27,157 +27,157 @@
 block discarded – undo
27 27
 
28 28
 class DomainUtils {
29 29
 
30
-	public static function getTLD ($url) {
31
-		$domain_tld = "";
30
+    public static function getTLD ($url) {
31
+        $domain_tld = "";
32 32
 
33
-		//http://news.mullerdigital.com/2013/10/30/how-to-get-the-domain-and-tld-from-a-url-using-php-and-regular-expression/
33
+        //http://news.mullerdigital.com/2013/10/30/how-to-get-the-domain-and-tld-from-a-url-using-php-and-regular-expression/
34 34
 
35
-		preg_match("/[a-z0-9\-]{1,63}\.[a-z\.]{2,6}$/", parse_url($url, PHP_URL_HOST), $domain_tld);
35
+        preg_match("/[a-z0-9\-]{1,63}\.[a-z\.]{2,6}$/", parse_url($url, PHP_URL_HOST), $domain_tld);
36 36
 
37
-		return $domain_tld[0];
38
-	}
37
+        return $domain_tld[0];
38
+    }
39 39
 
40
-	public static function isHTTPS () {
41
-		return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off";
42
-	}
40
+    public static function isHTTPS () {
41
+        return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off";
42
+    }
43 43
 
44
-	public static function getPort () {
45
-		return (int) $_SERVER['SERVER_PORT'];
46
-	}
44
+    public static function getPort () {
45
+        return (int) $_SERVER['SERVER_PORT'];
46
+    }
47 47
 
48
-	public static function isProxyUsed () {
49
-		return isset($_SERVER['HTTP_X_FORWARDED_HOST']) && !empty($_SERVER['HTTP_X_FORWARDED_HOST']);
50
-	}
48
+    public static function isProxyUsed () {
49
+        return isset($_SERVER['HTTP_X_FORWARDED_HOST']) && !empty($_SERVER['HTTP_X_FORWARDED_HOST']);
50
+    }
51 51
 
52
-	public static function getHost () {
53
-		$host = "";
52
+    public static function getHost () {
53
+        $host = "";
54 54
 
55
-		if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && !empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
56
-			$host = $_SERVER['HTTP_X_FORWARDED_HOST'];
55
+        if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && !empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
56
+            $host = $_SERVER['HTTP_X_FORWARDED_HOST'];
57 57
 
58
-			//because HTTP_X_FORWARDED_HOST can contains more than 1 host, we only want to get the last host name
59
-			$elements = explode(',', $host);
60
-			$host = end($elements);
61
-		} else if (isset($_SERVER['SERVER_NAME']) && !empty($_SERVER['SERVER_NAME'])) {
62
-			$host = $_SERVER['SERVER_NAME'];
63
-		} else if (isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])) {
64
-			$host = $_SERVER['HTTP_HOST'];
65
-		} else {
66
-			//unknown host
58
+            //because HTTP_X_FORWARDED_HOST can contains more than 1 host, we only want to get the last host name
59
+            $elements = explode(',', $host);
60
+            $host = end($elements);
61
+        } else if (isset($_SERVER['SERVER_NAME']) && !empty($_SERVER['SERVER_NAME'])) {
62
+            $host = $_SERVER['SERVER_NAME'];
63
+        } else if (isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])) {
64
+            $host = $_SERVER['HTTP_HOST'];
65
+        } else {
66
+            //unknown host
67 67
 
68
-			//use server ip
69
-			return htmlentities($_SERVER['SERVER_ADDR']);
70
-		}
68
+            //use server ip
69
+            return htmlentities($_SERVER['SERVER_ADDR']);
70
+        }
71 71
 
72
-		//TODO: remove this code
73
-		/*if ($host == "cms.chipbyte.de") {
72
+        //TODO: remove this code
73
+        /*if ($host == "cms.chipbyte.de") {
74 74
 			echo "Debugging: Invalide host!";
75 75
 			var_dump($_SERVER);
76 76
 		}*/
77 77
 
78
-		// Remove port number from host
79
-		$host = preg_replace("%:\d+$%", "", $host);
78
+        // Remove port number from host
79
+        $host = preg_replace("%:\d+$%", "", $host);
80 80
 
81
-		return trim($host);
82
-	}
81
+        return trim($host);
82
+    }
83 83
 
84
-	/**
85
-	 * get domain
86
-	 *
87
-	 * alias to getHost()
88
-	 */
89
-	public static function getDomain () {
90
-		return self::getHost();
91
-	}
84
+    /**
85
+     * get domain
86
+     *
87
+     * alias to getHost()
88
+     */
89
+    public static function getDomain () {
90
+        return self::getHost();
91
+    }
92 92
 
93
-	public static function getReferer () {
94
-		return htmlentities($_SERVER['HTTP_REFERER']);
95
-	}
93
+    public static function getReferer () {
94
+        return htmlentities($_SERVER['HTTP_REFERER']);
95
+    }
96 96
 
97
-	public static function getRequestMethod () {
98
-		return htmlspecialchars($_SERVER['REQUEST_METHOD']);
99
-	}
97
+    public static function getRequestMethod () {
98
+        return htmlspecialchars($_SERVER['REQUEST_METHOD']);
99
+    }
100 100
 
101
-	public static function getRequestURI () {
102
-		return htmlentities($_SERVER['REQUEST_URI']);
103
-	}
101
+    public static function getRequestURI () {
102
+        return htmlentities($_SERVER['REQUEST_URI']);
103
+    }
104 104
 
105
-	public static function getBaseURL (bool $without_protocol = false) {
106
-		$url = "";
105
+    public static function getBaseURL (bool $without_protocol = false) {
106
+        $url = "";
107 107
 
108
-		if (!$without_protocol) {//add protocol
109
-			if (self::isHTTPS()) {
110
-				$url .= "https://";
111
-			} else {
112
-				$url .= "http://";
113
-			}
114
-		}
108
+        if (!$without_protocol) {//add protocol
109
+            if (self::isHTTPS()) {
110
+                $url .= "https://";
111
+            } else {
112
+                $url .= "http://";
113
+            }
114
+        }
115 115
 
116
-		//add domain
117
-		$url .= self::getDomain();
116
+        //add domain
117
+        $url .= self::getDomain();
118 118
 
119
-		//check, if an specific server port is used
120
-		if (self::getPort() != 80 && self::getPort() != 433) {
121
-			$url .= ":" . self::getPort();
122
-		}
119
+        //check, if an specific server port is used
120
+        if (self::getPort() != 80 && self::getPort() != 433) {
121
+            $url .= ":" . self::getPort();
122
+        }
123 123
 
124
-		return $url;
125
-	}
124
+        return $url;
125
+    }
126 126
 
127
-	/**
128
-	 * generate an url for a page in this form: http(s)://<Domain><Base URL><Page>
129
-	 */
130
-	public static function generateURL (string $page, array $params = array()) : string {
131
-		$params_str = "";
127
+    /**
128
+     * generate an url for a page in this form: http(s)://<Domain><Base URL><Page>
129
+     */
130
+    public static function generateURL (string $page, array $params = array()) : string {
131
+        $params_str = "";
132 132
 
133
-		if (count($params) > 0) {
134
-			$params_str = "?";
133
+        if (count($params) > 0) {
134
+            $params_str = "?";
135 135
 
136
-			$array = "";
136
+            $array = "";
137 137
 
138
-			foreach ($params as $key=>$value) {
139
-				$array[] = $key . "=" . $value;
140
-			}
138
+            foreach ($params as $key=>$value) {
139
+                $array[] = $key . "=" . $value;
140
+            }
141 141
 
142
-			$params_str .= implode("&amp;", $array);
143
-		}
142
+            $params_str .= implode("&amp;", $array);
143
+        }
144 144
 
145
-		return self::getBaseURL() . "/" . $page . $params_str;
146
-	}
145
+        return self::getBaseURL() . "/" . $page . $params_str;
146
+    }
147 147
 
148
-	public static function getURL () {
149
-		return self::getBaseURL() . self::getRequestURI();
150
-	}
148
+    public static function getURL () {
149
+        return self::getBaseURL() . self::getRequestURI();
150
+    }
151 151
 
152
-	/**
153
-	 * faster implementation of getTld()
154
-	 */
155
-	public static function getCurrentDomain () {
156
-		$host = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
157
-		$domain = explode("?", $host);
158
-		$host = $domain[0];
159
-		$array = explode("/", $host);
160
-		$host = $array[0];
152
+    /**
153
+     * faster implementation of getTld()
154
+     */
155
+    public static function getCurrentDomain () {
156
+        $host = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
157
+        $domain = explode("?", $host);
158
+        $host = $domain[0];
159
+        $array = explode("/", $host);
160
+        $host = $array[0];
161 161
 
162
-		/*$domain = "";
162
+        /*$domain = "";
163 163
 
164 164
 		for ($i = 0; $i < count($array) - 1; $i++) {
165 165
 			$domain .= $array[$i];
166 166
 		}*/
167 167
 
168
-		$array1 = explode(":", $host);
169
-		$host = $array1[0];
168
+        $array1 = explode(":", $host);
169
+        $host = $array1[0];
170 170
 
171
-		return /*$domain*/$host;
172
-	}
171
+        return /*$domain*/$host;
172
+    }
173 173
 
174
-	public static function getProtocol () : string {
175
-		if (self::isHTTPS()) {
176
-			return "https://";
177
-		} else {
178
-			return "http://";
179
-		}
180
-	}
174
+    public static function getProtocol () : string {
175
+        if (self::isHTTPS()) {
176
+            return "https://";
177
+        } else {
178
+            return "http://";
179
+        }
180
+    }
181 181
 
182 182
 }
183 183
 
Please login to merge, or discard this patch.
system/packages/com.jukusoft.cms.user/classes/logoutpage.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -27,45 +27,45 @@
 block discarded – undo
27 27
 
28 28
 class LogoutPage extends HTMLPage {
29 29
 
30
-	protected $error = false;
30
+    protected $error = false;
31 31
 
32
-	public function setCustomHeader() {
33
-		//check, if session was started
34
-		PHPUtils::checkSessionStarted();
32
+    public function setCustomHeader() {
33
+        //check, if session was started
34
+        PHPUtils::checkSessionStarted();
35 35
 
36
-		if (!Security::checkCSRFToken()) {
37
-			$this->error = true;
36
+        if (!Security::checkCSRFToken()) {
37
+            $this->error = true;
38 38
 
39
-			//dont logout user, because csrf token isnt correct
40
-			return;
41
-		}
39
+            //dont logout user, because csrf token isnt correct
40
+            return;
41
+        }
42 42
 
43
-		//logout user
44
-		User::current()->logout();
43
+        //logout user
44
+        User::current()->logout();
45 45
 
46
-		Events::throwEvent("after_logout");
46
+        Events::throwEvent("after_logout");
47 47
 
48
-		//get domain
49
-		$domain = Registry::singleton()->getObject("domain");
48
+        //get domain
49
+        $domain = Registry::singleton()->getObject("domain");
50 50
 
51
-		//generate index url
52
-		$index_url = DomainUtils::generateURL($domain->getHomePage());
51
+        //generate index url
52
+        $index_url = DomainUtils::generateURL($domain->getHomePage());
53 53
 
54
-		header("Location: " . $index_url);
54
+        header("Location: " . $index_url);
55 55
 
56
-		//flush gzip buffer
57
-		ob_end_flush();
56
+        //flush gzip buffer
57
+        ob_end_flush();
58 58
 
59
-		exit;
60
-	}
59
+        exit;
60
+    }
61 61
 
62
-	public function getContent(): string {
63
-		if ($this->error) {
64
-			return "Wrong CSRF token!";
65
-		}
62
+    public function getContent(): string {
63
+        if ($this->error) {
64
+            return "Wrong CSRF token!";
65
+        }
66 66
 
67
-		return "";
68
-	}
67
+        return "";
68
+    }
69 69
 
70 70
 }
71 71
 
Please login to merge, or discard this patch.
system/core/validator/password.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 		}
62 62
 	}
63 63
 
64
-	public static function get (string $value) : string {
64
+	public static function get(string $value) : string {
65 65
 		$obj = new Validator_Password();
66 66
 		return $obj->validate($value);
67 67
 	}
Please login to merge, or discard this patch.
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -27,44 +27,44 @@
 block discarded – undo
27 27
 
28 28
 class Validator_Password implements Validator_Base {
29 29
 
30
-	public function isValide($value): bool {
31
-		$valide = true;
30
+    public function isValide($value): bool {
31
+        $valide = true;
32 32
 
33
-		//throw event, so plugins like pwned can interact
34
-		Events::throwEvent("validate_password", array(
35
-			'password' => &$value,
36
-			'valide' => &$valide
37
-		));
33
+        //throw event, so plugins like pwned can interact
34
+        Events::throwEvent("validate_password", array(
35
+            'password' => &$value,
36
+            'valide' => &$valide
37
+        ));
38 38
 
39
-		if (!$valide) {
40
-			return false;
41
-		}
39
+        if (!$valide) {
40
+            return false;
41
+        }
42 42
 
43
-		if (strlen($value) < Settings::get("password_min_length", 6)) {
44
-			return false;
45
-		}
43
+        if (strlen($value) < Settings::get("password_min_length", 6)) {
44
+            return false;
45
+        }
46 46
 
47
-		if (strlen($value) > Settings::get("password_max_length", 64)) {
48
-			//more than 64 characters arent supported
49
-			return false;
50
-		}
47
+        if (strlen($value) > Settings::get("password_max_length", 64)) {
48
+            //more than 64 characters arent supported
49
+            return false;
50
+        }
51 51
 
52
-		//everything is allowed
53
-		return true;
54
-	}
52
+        //everything is allowed
53
+        return true;
54
+    }
55 55
 
56
-	public function validate($value) {
57
-		if ($this->isValide($value)) {
58
-			return $value;
59
-		} else {
60
-			throw new SecurityException("password is not valide!");
61
-		}
62
-	}
56
+    public function validate($value) {
57
+        if ($this->isValide($value)) {
58
+            return $value;
59
+        } else {
60
+            throw new SecurityException("password is not valide!");
61
+        }
62
+    }
63 63
 
64
-	public static function get (string $value) : string {
65
-		$obj = new Validator_Password();
66
-		return $obj->validate($value);
67
-	}
64
+    public static function get (string $value) : string {
65
+        $obj = new Validator_Password();
66
+        return $obj->validate($value);
67
+    }
68 68
 
69 69
 }
70 70
 
Please login to merge, or discard this patch.
system/packages/com.jukusoft.cms.user/classes/changepasswordpage.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -27,58 +27,58 @@
 block discarded – undo
27 27
 
28 28
 class ChangePasswordPage extends PageType {
29 29
 
30
-	public function getContent() : string {
31
-		$template = new DwooTemplate("pages/changepassword");
32
-
33
-		$template->assign("form_action", DomainUtils::generateURL($this->getPage()->getAlias()));
34
-
35
-		if (isset($_REQUEST['submit'])) {
36
-			//first, check CSRF token
37
-			if (!Security::checkCSRFToken()) {
38
-				$template->assign("error_message", "Wrong CSRF token!");
39
-			} else {
40
-				if (isset($_POST['old_password']) && !empty($_POST['old_password']) && isset($_POST['new_password']) && !empty($_POST['new_password']) && isset($_POST['retry_password']) && !empty($_POST['retry_password'])) {
41
-					$old_passowrd = $_POST['old_password'];
42
-					$new_password = $_POST['new_password'];
43
-					$retry_password = $_POST['retry_password'];
44
-
45
-					//first, check old password
46
-					if (!User::current()->checkPassword($old_passowrd)) {
47
-						$template->assign("error_message", "Wrong old password!");
48
-					} else if (!PHPUtils::strEqs($new_password, $retry_password)) {
49
-						$template->assign("error_message", "New and retried passwords are not equals!");
50
-					} else {
51
-						//create new instance of validator
52
-						$validator = new Validator_Password();
53
-
54
-						//check, if password is valide
55
-						if (!$validator->isValide($new_password)) {
56
-							$min_length = Settings::get("password_min_length", 6);
57
-							$max_length = Settings::get("password_max_length", 64);
58
-
59
-							$template->assign("error_message", "New password is not valide! Min length: " . $min_length . ", max length: " . $max_length . " .");
60
-						} else {
61
-							//validate password
62
-							//$new_password = $validator->validate($new_password);
63
-
64
-							User::current()->setPassword($new_password);
65
-
66
-							$template->assign("form_submit", true);
67
-							$template->assign("success_message", "Password changed successfully!");
68
-						}
69
-					}
70
-				} else {
71
-					$template->assign("error_message", "Please complete form!");
72
-				}
73
-			}
74
-		}
75
-
76
-		return $template->getCode();
77
-	}
78
-
79
-	public function listRequiredPermissions(): array {
80
-		return array("can_edit_own_password");
81
-	}
30
+    public function getContent() : string {
31
+        $template = new DwooTemplate("pages/changepassword");
32
+
33
+        $template->assign("form_action", DomainUtils::generateURL($this->getPage()->getAlias()));
34
+
35
+        if (isset($_REQUEST['submit'])) {
36
+            //first, check CSRF token
37
+            if (!Security::checkCSRFToken()) {
38
+                $template->assign("error_message", "Wrong CSRF token!");
39
+            } else {
40
+                if (isset($_POST['old_password']) && !empty($_POST['old_password']) && isset($_POST['new_password']) && !empty($_POST['new_password']) && isset($_POST['retry_password']) && !empty($_POST['retry_password'])) {
41
+                    $old_passowrd = $_POST['old_password'];
42
+                    $new_password = $_POST['new_password'];
43
+                    $retry_password = $_POST['retry_password'];
44
+
45
+                    //first, check old password
46
+                    if (!User::current()->checkPassword($old_passowrd)) {
47
+                        $template->assign("error_message", "Wrong old password!");
48
+                    } else if (!PHPUtils::strEqs($new_password, $retry_password)) {
49
+                        $template->assign("error_message", "New and retried passwords are not equals!");
50
+                    } else {
51
+                        //create new instance of validator
52
+                        $validator = new Validator_Password();
53
+
54
+                        //check, if password is valide
55
+                        if (!$validator->isValide($new_password)) {
56
+                            $min_length = Settings::get("password_min_length", 6);
57
+                            $max_length = Settings::get("password_max_length", 64);
58
+
59
+                            $template->assign("error_message", "New password is not valide! Min length: " . $min_length . ", max length: " . $max_length . " .");
60
+                        } else {
61
+                            //validate password
62
+                            //$new_password = $validator->validate($new_password);
63
+
64
+                            User::current()->setPassword($new_password);
65
+
66
+                            $template->assign("form_submit", true);
67
+                            $template->assign("success_message", "Password changed successfully!");
68
+                        }
69
+                    }
70
+                } else {
71
+                    $template->assign("error_message", "Please complete form!");
72
+                }
73
+            }
74
+        }
75
+
76
+        return $template->getCode();
77
+    }
78
+
79
+    public function listRequiredPermissions(): array {
80
+        return array("can_edit_own_password");
81
+    }
82 82
 
83 83
 }
84 84
 
Please login to merge, or discard this patch.