Completed
Push — master ( d13b22...a2d243 )
by Justin
05:45
created
system/packages/com.jukusoft.cms.admin/classes/settingspage.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -27,93 +27,93 @@
 block discarded – undo
27 27
 
28 28
 class SettingsPage extends PageType {
29 29
 
30
-	public function getContent(): string {
31
-		$template = new DwooTemplate("pages/settings");
30
+    public function getContent(): string {
31
+        $template = new DwooTemplate("pages/settings");
32 32
 
33
-		$template->assign("form_action", DomainUtils::generateURL("admin/settings", array("option" => "save")));
34
-		$template->assign("content", "");
33
+        $template->assign("form_action", DomainUtils::generateURL("admin/settings", array("option" => "save")));
34
+        $template->assign("content", "");
35 35
 
36
-		$categories = array();
36
+        $categories = array();
37 37
 
38
-		$all_settings_by_category = Settings::listAllSettingsByCategory();
38
+        $all_settings_by_category = Settings::listAllSettingsByCategory();
39 39
 
40
-		$save = false;
41
-		$save_success = true;
42
-		$invalide_field = "";
40
+        $save = false;
41
+        $save_success = true;
42
+        $invalide_field = "";
43 43
 
44
-		if (isset($_REQUEST['option']) && $_REQUEST['option'] == "save") {
45
-			$save = true;
46
-		}
44
+        if (isset($_REQUEST['option']) && $_REQUEST['option'] == "save") {
45
+            $save = true;
46
+        }
47 47
 
48
-		//check permission
49
-		if (!PermissionChecker::current()->hasRight("can_edit_global_settings")) {
50
-			$save = false;
51
-		}
48
+        //check permission
49
+        if (!PermissionChecker::current()->hasRight("can_edit_global_settings")) {
50
+            $save = false;
51
+        }
52 52
 
53
-		$template->assign("permission_to_edit_settings", PermissionChecker::current()->hasRight("can_edit_global_settings"));
53
+        $template->assign("permission_to_edit_settings", PermissionChecker::current()->hasRight("can_edit_global_settings"));
54 54
 
55
-		foreach (SettingsCategory::listAllCategories() as $category) {
56
-			$category = SettingsCategory::cast($category);
55
+        foreach (SettingsCategory::listAllCategories() as $category) {
56
+            $category = SettingsCategory::cast($category);
57 57
 
58
-			$settings = array();
58
+            $settings = array();
59 59
 
60
-			if (isset($all_settings_by_category[$category->getCategory()])) {
61
-				//list settings
62
-				$rows = $all_settings_by_category[$category->getCategory()];
60
+            if (isset($all_settings_by_category[$category->getCategory()])) {
61
+                //list settings
62
+                $rows = $all_settings_by_category[$category->getCategory()];
63 63
 
64
-				foreach ($rows as $key=>$row) {
65
-					$datatype = $row['datatype'];
66
-					$datatype_params = unserialize($row['datatype_params']);
64
+                foreach ($rows as $key=>$row) {
65
+                    $datatype = $row['datatype'];
66
+                    $datatype_params = unserialize($row['datatype_params']);
67 67
 
68
-					$obj = new $datatype();
68
+                    $obj = new $datatype();
69 69
 
70
-					if (!($obj instanceof DataType_Base)) {
71
-						throw new IllegalArgumentException("obj of class name '" . $datatype . "' has to be an instance of DataType_Base.");
72
-					}
70
+                    if (!($obj instanceof DataType_Base)) {
71
+                        throw new IllegalArgumentException("obj of class name '" . $datatype . "' has to be an instance of DataType_Base.");
72
+                    }
73 73
 
74
-					//load instance
75
-					$obj->load($row, $datatype_params);
74
+                    //load instance
75
+                    $obj->load($row, $datatype_params);
76 76
 
77
-					if ($save) {
78
-						//try to validate
79
-						if (!$obj->val()) {
80
-							$save_success = false;
81
-							$invalide_field = $obj->getTitle();
82
-						} else {
83
-							//save object
84
-							$obj->save();
85
-						}
86
-					}
77
+                    if ($save) {
78
+                        //try to validate
79
+                        if (!$obj->val()) {
80
+                            $save_success = false;
81
+                            $invalide_field = $obj->getTitle();
82
+                        } else {
83
+                            //save object
84
+                            $obj->save();
85
+                        }
86
+                    }
87 87
 
88
-					$settings[] = array(
89
-						'title' => Translator::translateTitle($row['title']),
90
-						'description' => Translator::translateTitle($row['description']),
91
-						'code' => $obj->getFormCode()
92
-					);
93
-				}
94
-			}
88
+                    $settings[] = array(
89
+                        'title' => Translator::translateTitle($row['title']),
90
+                        'description' => Translator::translateTitle($row['description']),
91
+                        'code' => $obj->getFormCode()
92
+                    );
93
+                }
94
+            }
95 95
 
96
-			$categories[] = array(
97
-				'title' => $category->getTitle(),
98
-				'settings' => $settings
99
-			);
100
-		}
96
+            $categories[] = array(
97
+                'title' => $category->getTitle(),
98
+                'settings' => $settings
99
+            );
100
+        }
101 101
 
102
-		Settings::saveAsync();
102
+        Settings::saveAsync();
103 103
 
104
-		//set state
105
-		$template->assign("save_success", (boolean) ($save && $save_success));
106
-		$template->assign("save_failed", (boolean) ($save && !$save_success));
107
-		$template->assign("invalide_field", $invalide_field);
104
+        //set state
105
+        $template->assign("save_success", (boolean) ($save && $save_success));
106
+        $template->assign("save_failed", (boolean) ($save && !$save_success));
107
+        $template->assign("invalide_field", $invalide_field);
108 108
 
109
-		$template->assign("categories", $categories);
109
+        $template->assign("categories", $categories);
110 110
 
111
-		return $template->getCode();
112
-	}
111
+        return $template->getCode();
112
+    }
113 113
 
114
-	public function listRequiredPermissions(): array {
115
-		return array("can_see_global_settings", "can_edit_global_settings");
116
-	}
114
+    public function listRequiredPermissions(): array {
115
+        return array("can_see_global_settings", "can_edit_global_settings");
116
+    }
117 117
 
118 118
 }
119 119
 
Please login to merge, or discard this patch.
system/core/datatype/mail.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,23 +27,23 @@
 block discarded – undo
27 27
 
28 28
 class DataType_Mail extends DataType_Base {
29 29
 
30
-	public function getFormCode(): string {
31
-		return "<input type=\"email\" name=\"" . $this->getInputName() . "\" value=\"" . $this->getValue() . "\" class=\"form-control\" />";
32
-	}
30
+    public function getFormCode(): string {
31
+        return "<input type=\"email\" name=\"" . $this->getInputName() . "\" value=\"" . $this->getValue() . "\" class=\"form-control\" />";
32
+    }
33 33
 
34
-	public function validate(string $value): bool {
35
-		$allow_empty_string = true;
34
+    public function validate(string $value): bool {
35
+        $allow_empty_string = true;
36 36
 
37
-		if (empty($value)) {
38
-			return true;
39
-		}
37
+        if (empty($value)) {
38
+            return true;
39
+        }
40 40
 
41
-		return filter_var($value, FILTER_VALIDATE_EMAIL) !== false;
42
-	}
41
+        return filter_var($value, FILTER_VALIDATE_EMAIL) !== false;
42
+    }
43 43
 
44
-	protected function saveAsync($value) {
45
-		Settings::setAsync($this->getKey(), (string) $value);
46
-	}
44
+    protected function saveAsync($value) {
45
+        Settings::setAsync($this->getKey(), (string) $value);
46
+    }
47 47
 }
48 48
 
49 49
 ?>
Please login to merge, or discard this patch.
system/core/datatype/integer.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 DataType_Integer extends DataType_Base {
29 29
 
30
-	public function getFormCode(): string {
31
-		$min = null;
32
-		$max = null;
33
-		$unit = null;
34
-
35
-		if (is_array($this->getDatatypeParams())) {
36
-			$array = $this->getDatatypeParams();
37
-
38
-			if (isset($array['min'])) {
39
-				$min = (int) $array['min'];
40
-			}
41
-
42
-			if (isset($array['max'])) {
43
-				$max = (int) $array['max'];
44
-			}
45
-
46
-			if (isset($array['unit'])) {
47
-				$unit = $array['unit'];
48
-			}
49
-		}
50
-
51
-		return "<input type=\"number\" name=\"" . $this->getInputName() . "\" value=\"" . $this->getValue() . "\" step=\"1\"" . ($min != null ? " min=\"" . $min . "\"" : "") . "" . ($max != null ? " max=\"" . $max . "\"" : "") . " class=\"form-control\" />" . ($unit != null ? " " . $unit : "");
52
-	}
53
-
54
-	public function validate(string $value): bool {
55
-		$min = null;
56
-		$max = null;
57
-		$unit = null;
58
-
59
-		if (is_array($this->getDatatypeParams())) {
60
-			$array = $this->getDatatypeParams();
61
-
62
-			if (isset($array['min'])) {
63
-				$min = (int) $array['min'];
64
-			}
65
-
66
-			if (isset($array['max'])) {
67
-				$max = (int) $array['max'];
68
-			}
69
-
70
-			if (isset($array['unit'])) {
71
-				$unit = $array['unit'];
72
-			}
73
-		}
74
-
75
-		$val = new Validator_Int();
76
-		return $val->isValide($value) && ($min == null || $value >= $min);
77
-	}
78
-
79
-	protected function saveAsync($value) {
80
-		Settings::setAsync($this->getKey(), (int) $value);
81
-	}
30
+    public function getFormCode(): string {
31
+        $min = null;
32
+        $max = null;
33
+        $unit = null;
34
+
35
+        if (is_array($this->getDatatypeParams())) {
36
+            $array = $this->getDatatypeParams();
37
+
38
+            if (isset($array['min'])) {
39
+                $min = (int) $array['min'];
40
+            }
41
+
42
+            if (isset($array['max'])) {
43
+                $max = (int) $array['max'];
44
+            }
45
+
46
+            if (isset($array['unit'])) {
47
+                $unit = $array['unit'];
48
+            }
49
+        }
50
+
51
+        return "<input type=\"number\" name=\"" . $this->getInputName() . "\" value=\"" . $this->getValue() . "\" step=\"1\"" . ($min != null ? " min=\"" . $min . "\"" : "") . "" . ($max != null ? " max=\"" . $max . "\"" : "") . " class=\"form-control\" />" . ($unit != null ? " " . $unit : "");
52
+    }
53
+
54
+    public function validate(string $value): bool {
55
+        $min = null;
56
+        $max = null;
57
+        $unit = null;
58
+
59
+        if (is_array($this->getDatatypeParams())) {
60
+            $array = $this->getDatatypeParams();
61
+
62
+            if (isset($array['min'])) {
63
+                $min = (int) $array['min'];
64
+            }
65
+
66
+            if (isset($array['max'])) {
67
+                $max = (int) $array['max'];
68
+            }
69
+
70
+            if (isset($array['unit'])) {
71
+                $unit = $array['unit'];
72
+            }
73
+        }
74
+
75
+        $val = new Validator_Int();
76
+        return $val->isValide($value) && ($min == null || $value >= $min);
77
+    }
78
+
79
+    protected function saveAsync($value) {
80
+        Settings::setAsync($this->getKey(), (int) $value);
81
+    }
82 82
 }
83 83
 
84 84
 ?>
Please login to merge, or discard this patch.
system/packages/com.jukusoft.cms.plugin/extensions/pageinstaller.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -27,50 +27,50 @@
 block discarded – undo
27 27
 
28 28
 class PageInstaller extends PluginInstaller_Plugin {
29 29
 
30
-	public function install(Plugin $plugin, array $install_json): bool {
31
-		if (isset($install_json['pages'])) {
32
-			foreach ($install_json['pages'] as $page) {
33
-				$alias = $page['alias'];
34
-				$title = $page['title'];
35
-				$pagetype = $page['pagetype'];
36
-				$content = (isset($page['content']) ? $page['content'] : "");
37
-				$folder = (isset($page['folder']) ? $page['folder'] : "/");
38
-				$global_menu = (isset($page['global_menu']) ? intval($page['global_menu']) : -1);
39
-				$local_menu = (isset($page['local_menu']) ? intval($page['local_menu']) : -1);
40
-				$parentID = (isset($page['parentID']) ? intval($page['parentID']) : -1);
41
-				$sitemap = (isset($page['sitemap']) ? boolval($page['sitemap']) : true);
42
-				$published = (isset($page['published']) ? boolval($page['published']) : true);
43
-				$editable = (isset($page['editable']) ? boolval($page['editable']) : true);
44
-				$author = (isset($page['author']) ? $page['author'] : "System");
30
+    public function install(Plugin $plugin, array $install_json): bool {
31
+        if (isset($install_json['pages'])) {
32
+            foreach ($install_json['pages'] as $page) {
33
+                $alias = $page['alias'];
34
+                $title = $page['title'];
35
+                $pagetype = $page['pagetype'];
36
+                $content = (isset($page['content']) ? $page['content'] : "");
37
+                $folder = (isset($page['folder']) ? $page['folder'] : "/");
38
+                $global_menu = (isset($page['global_menu']) ? intval($page['global_menu']) : -1);
39
+                $local_menu = (isset($page['local_menu']) ? intval($page['local_menu']) : -1);
40
+                $parentID = (isset($page['parentID']) ? intval($page['parentID']) : -1);
41
+                $sitemap = (isset($page['sitemap']) ? boolval($page['sitemap']) : true);
42
+                $published = (isset($page['published']) ? boolval($page['published']) : true);
43
+                $editable = (isset($page['editable']) ? boolval($page['editable']) : true);
44
+                $author = (isset($page['author']) ? $page['author'] : "System");
45 45
 
46
-				Page::createIfAbsent($alias, $title, $pagetype, $content, $folder, $global_menu, $local_menu, $parentID, $sitemap, $published, $editable, false, $author);
47
-			}
48
-		}
46
+                Page::createIfAbsent($alias, $title, $pagetype, $content, $folder, $global_menu, $local_menu, $parentID, $sitemap, $published, $editable, false, $author);
47
+            }
48
+        }
49 49
 
50
-		return true;
51
-	}
50
+        return true;
51
+    }
52 52
 
53
-	public function uninstall(Plugin $plugin, array $install_json): bool {
54
-		if (isset($install_json['pages'])) {
55
-			foreach ($install_json['pages'] as $page) {
56
-				$alias = $page['alias'];
57
-				$autoremove_on_uninstall = boolval($page['autoremove_on_uninstall']);
53
+    public function uninstall(Plugin $plugin, array $install_json): bool {
54
+        if (isset($install_json['pages'])) {
55
+            foreach ($install_json['pages'] as $page) {
56
+                $alias = $page['alias'];
57
+                $autoremove_on_uninstall = boolval($page['autoremove_on_uninstall']);
58 58
 
59
-				if ($autoremove_on_uninstall) {
60
-					Page::delete($alias);
61
-				}
62
-			}
63
-		}
59
+                if ($autoremove_on_uninstall) {
60
+                    Page::delete($alias);
61
+                }
62
+            }
63
+        }
64 64
 
65
-		return true;
66
-	}
65
+        return true;
66
+    }
67 67
 
68
-	public function upgrade(Plugin $plugin, array $install_json): bool {
69
-		//TODO: remove old pages, which arent longer used
68
+    public function upgrade(Plugin $plugin, array $install_json): bool {
69
+        //TODO: remove old pages, which arent longer used
70 70
 
71
-		//install supports ON DUPLICATE KEY
72
-		$this->install($plugin, $install_json);
73
-	}
71
+        //install supports ON DUPLICATE KEY
72
+        $this->install($plugin, $install_json);
73
+    }
74 74
 
75 75
 }
76 76
 
Please login to merge, or discard this patch.
system/packages/com.jukusoft.cms.plugin/extensions/pagetypeinstaller.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -27,36 +27,36 @@
 block discarded – undo
27 27
 
28 28
 class PageTypeInstaller extends PluginInstaller_Plugin {
29 29
 
30
-	public function install(Plugin $plugin, array $install_json): bool {
31
-		if (isset($install_json['pagetypes'])) {
32
-			foreach ($install_json['pagetypes'] as $pagetype) {
33
-				$class_name = $pagetype['class_name'];
34
-				$title = $pagetype['title'];
35
-				$permissions = (isset($pagetype['create_permissions']) ? $pagetype['create_permissions'] : array("none"));
36
-				$advanced = (isset($pagetype['advanced']) ? boolval($pagetype['advanced']) : false);
37
-				$order = (isset($pagetype['order']) ? intval($pagetype['order']) : 100);
38
-
39
-				//create page type
40
-				PageType::createPageType($class_name, $title, $advanced, $order, $permissions, "plugin_" . $plugin->getName());
41
-			}
42
-		}
43
-
44
-		return true;
45
-	}
46
-
47
-	public function uninstall(Plugin $plugin, array $install_json): bool {
48
-		//remove all page types which was created by this plugin
49
-		PageType::removePageTypesByOwner("plugin_" . $plugin->getName());
50
-
51
-		return true;
52
-	}
53
-
54
-	public function upgrade(Plugin $plugin, array $install_json): bool {
55
-		//TODO: remove page types, which arent longer in install json
56
-
57
-		//install supports ON DUPLICATE KEY
58
-		return $this->install($plugin, $install_json);
59
-	}
30
+    public function install(Plugin $plugin, array $install_json): bool {
31
+        if (isset($install_json['pagetypes'])) {
32
+            foreach ($install_json['pagetypes'] as $pagetype) {
33
+                $class_name = $pagetype['class_name'];
34
+                $title = $pagetype['title'];
35
+                $permissions = (isset($pagetype['create_permissions']) ? $pagetype['create_permissions'] : array("none"));
36
+                $advanced = (isset($pagetype['advanced']) ? boolval($pagetype['advanced']) : false);
37
+                $order = (isset($pagetype['order']) ? intval($pagetype['order']) : 100);
38
+
39
+                //create page type
40
+                PageType::createPageType($class_name, $title, $advanced, $order, $permissions, "plugin_" . $plugin->getName());
41
+            }
42
+        }
43
+
44
+        return true;
45
+    }
46
+
47
+    public function uninstall(Plugin $plugin, array $install_json): bool {
48
+        //remove all page types which was created by this plugin
49
+        PageType::removePageTypesByOwner("plugin_" . $plugin->getName());
50
+
51
+        return true;
52
+    }
53
+
54
+    public function upgrade(Plugin $plugin, array $install_json): bool {
55
+        //TODO: remove page types, which arent longer in install json
56
+
57
+        //install supports ON DUPLICATE KEY
58
+        return $this->install($plugin, $install_json);
59
+    }
60 60
 
61 61
 }
62 62
 
Please login to merge, or discard this patch.
system/packages/com.jukusoft.cms.folder/classes/folder.php 2 patches
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -27,219 +27,219 @@
 block discarded – undo
27 27
 
28 28
 class Folder {
29 29
 
30
-	protected $folder = "";
31
-	protected $row = array();
32
-
33
-	protected static $load_count = 0;
34
-
35
-	public function __construct($folder) {
36
-		$this->folder = $folder;
37
-	}
38
-
39
-	public function load ($folder) {
40
-		self::$load_count++;
41
-
42
-		if (self::$load_count > 50) {
43
-			throw new IllegalStateException("reached max allowed number of Folder::load() calls (to prevent recursion).");
44
-		}
45
-
46
-		//escape string
47
-		//$folder = Database::getInstance()->escape($folder);
30
+    protected $folder = "";
31
+    protected $row = array();
32
+
33
+    protected static $load_count = 0;
34
+
35
+    public function __construct($folder) {
36
+        $this->folder = $folder;
37
+    }
38
+
39
+    public function load ($folder) {
40
+        self::$load_count++;
41
+
42
+        if (self::$load_count > 50) {
43
+            throw new IllegalStateException("reached max allowed number of Folder::load() calls (to prevent recursion).");
44
+        }
45
+
46
+        //escape string
47
+        //$folder = Database::getInstance()->escape($folder);
48 48
 
49
-		if (empty($folder)) {
50
-			$folder = "/";
51
-		}
49
+        if (empty($folder)) {
50
+            $folder = "/";
51
+        }
52 52
 
53
-		if (Cache::contains("folder", "folder-" . $folder)) {
54
-			$this->row = Cache::get("folder", "folder-" . $folder);
55
-		} else {
56
-			$row = Database::getInstance()->getRow("SELECT * FROM `{praefix}folder` WHERE `folder` = :folder; ", array('folder' => $folder));
57
-
58
-			if (!$row) {
59
-				//load upper folder
60
-				if (strcmp($folder, "/") !== 0) {
61
-					//load upper dir
62
-					$folder = self::getUpperDir($folder);
53
+        if (Cache::contains("folder", "folder-" . $folder)) {
54
+            $this->row = Cache::get("folder", "folder-" . $folder);
55
+        } else {
56
+            $row = Database::getInstance()->getRow("SELECT * FROM `{praefix}folder` WHERE `folder` = :folder; ", array('folder' => $folder));
57
+
58
+            if (!$row) {
59
+                //load upper folder
60
+                if (strcmp($folder, "/") !== 0) {
61
+                    //load upper dir
62
+                    $folder = self::getUpperDir($folder);
63 63
 
64
-					$this->load($folder);
65
-				} else {
66
-					throw new IllegalStateException("no main folder / is defined. Please insert folder '/'.");
67
-				}
68
-			} else {
69
-				$this->row = $row;
70
-			}
64
+                    $this->load($folder);
65
+                } else {
66
+                    throw new IllegalStateException("no main folder / is defined. Please insert folder '/'.");
67
+                }
68
+            } else {
69
+                $this->row = $row;
70
+            }
71 71
 
72
-			Cache::put("folder", "folder-" . $folder, $this->row);
73
-		}
74
-	}
72
+            Cache::put("folder", "folder-" . $folder, $this->row);
73
+        }
74
+    }
75 75
 
76
-	public function getFolder () : string {
77
-		return $this->row['folder'];
78
-	}
76
+    public function getFolder () : string {
77
+        return $this->row['folder'];
78
+    }
79 79
 
80
-	public function listRequiredPermissions () : array {
81
-		return explode("|", $this->row['permissions']);
82
-	}
80
+    public function listRequiredPermissions () : array {
81
+        return explode("|", $this->row['permissions']);
82
+    }
83 83
 
84
-	public function checkPermissions (PermissionChecker $permission_checker) : bool {
85
-		foreach ($this->listRequiredPermissions() as $permission) {
86
-			if ($permission_checker->hasRight($permission)) {
87
-				return true;
88
-			} else if ($permission === "none") {
89
-				return true;
90
-			}
91
-		}
84
+    public function checkPermissions (PermissionChecker $permission_checker) : bool {
85
+        foreach ($this->listRequiredPermissions() as $permission) {
86
+            if ($permission_checker->hasRight($permission)) {
87
+                return true;
88
+            } else if ($permission === "none") {
89
+                return true;
90
+            }
91
+        }
92 92
 
93
-		return false;
94
-	}
93
+        return false;
94
+    }
95 95
 
96
-	public function isHidden () : bool {
97
-		return $this->row['hidden'] == 1;
98
-	}
96
+    public function isHidden () : bool {
97
+        return $this->row['hidden'] == 1;
98
+    }
99 99
 
100
-	public function hasCustomMainMenu () : bool {
101
-		return $this->row['main_menu'] != -1;
102
-	}
100
+    public function hasCustomMainMenu () : bool {
101
+        return $this->row['main_menu'] != -1;
102
+    }
103 103
 
104
-	public function getMainMenu () : int {
105
-		return $this->row['main_menu'];
106
-	}
104
+    public function getMainMenu () : int {
105
+        return $this->row['main_menu'];
106
+    }
107 107
 
108
-	public function hasCustomLocalMenu () : bool {
109
-		return $this->row['local_menu'] != -1;
110
-	}
108
+    public function hasCustomLocalMenu () : bool {
109
+        return $this->row['local_menu'] != -1;
110
+    }
111 111
 
112
-	public function getLocalMenu () : int {
113
-		return $this->row['local_menu'];
114
-	}
112
+    public function getLocalMenu () : int {
113
+        return $this->row['local_menu'];
114
+    }
115 115
 
116
-	public function isTitleTranslationEnabled () {
117
-		return $this->row['title_translation_support'] == 1;
118
-	}
116
+    public function isTitleTranslationEnabled () {
117
+        return $this->row['title_translation_support'] == 1;
118
+    }
119 119
 
120
-	public function isActivated () : bool {
121
-		return $this->row['activated'] == 1;
122
-	}
120
+    public function isActivated () : bool {
121
+        return $this->row['activated'] == 1;
122
+    }
123 123
 
124
-	public static function getFolderByPage (string $page) : string {
125
-		$array = explode("/", $page);
124
+    public static function getFolderByPage (string $page) : string {
125
+        $array = explode("/", $page);
126 126
 
127
-		if (sizeof($array) <= 2 && empty($array[0])) {
128
-			return "/";
129
-		}
127
+        if (sizeof($array) <= 2 && empty($array[0])) {
128
+            return "/";
129
+        }
130 130
 
131
-		//remove last element
132
-		array_pop($array);
131
+        //remove last element
132
+        array_pop($array);
133 133
 
134
-		return implode("/", $array) . "/";
135
-	}
134
+        return implode("/", $array) . "/";
135
+    }
136 136
 
137
-	public static function getUpperDir ($dir) {
138
-		if (PHPUtils::endsWith($dir, "/")) {
139
-			//remove last slash
140
-			$dir = substr($dir, 0, -1);
141
-		}
142
-
143
-		$array = explode("/", $dir);
137
+    public static function getUpperDir ($dir) {
138
+        if (PHPUtils::endsWith($dir, "/")) {
139
+            //remove last slash
140
+            $dir = substr($dir, 0, -1);
141
+        }
142
+
143
+        $array = explode("/", $dir);
144 144
 
145
-		if (sizeof($array) <= 2 && empty($array[0])) {
146
-			return "/";
147
-		}
145
+        if (sizeof($array) <= 2 && empty($array[0])) {
146
+            return "/";
147
+        }
148 148
 
149
-		//remove last element
150
-		array_pop($array);
149
+        //remove last element
150
+        array_pop($array);
151 151
 
152
-		return implode("/", $array) . "/";
153
-	}
154
-
155
-	public static function createFolder (string $folder, bool $hidden = false, array $permissions = array(), int $main_menu = -1, int $local_menu = -1, string $force_template = "none", bool $title_translation = true) {
156
-		//escape string
157
-		//$folder = Database::getInstance()->escape($folder);
158
-
159
-		$permissions_str = implode("|", $permissions);
152
+        return implode("/", $array) . "/";
153
+    }
154
+
155
+    public static function createFolder (string $folder, bool $hidden = false, array $permissions = array(), int $main_menu = -1, int $local_menu = -1, string $force_template = "none", bool $title_translation = true) {
156
+        //escape string
157
+        //$folder = Database::getInstance()->escape($folder);
158
+
159
+        $permissions_str = implode("|", $permissions);
160 160
 
161
-		if (sizeof($permissions) == 0) {
162
-			$permissions_str = "none";
163
-		}
161
+        if (sizeof($permissions) == 0) {
162
+            $permissions_str = "none";
163
+        }
164 164
 
165
-		Database::getInstance()->execute("INSERT INTO `{praefix}folder` (
165
+        Database::getInstance()->execute("INSERT INTO `{praefix}folder` (
166 166
 			`folder`, `force_template`, `main_menu`, `local_menu`, `permissions`, `title_translation_support`, `hidden`, `activated`
167 167
 		) VALUES (
168 168
 			:folder, :templatename, :main_menu, :local_menu, :permissions, :title_translation_support, :hidden, '1'
169 169
 		); ", array(
170
-			'folder' => $folder,
171
-			'templatename' => $force_template,
172
-			'main_menu' => $main_menu,
173
-			'local_menu' => $local_menu,
174
-			'permissions' => $permissions_str,
175
-			'title_translation_support' => ($title_translation ? 1 : 0),
176
-			'hidden' => $hidden ? 1 : 0
177
-		));
178
-
179
-		//clear cache
180
-		Cache::clear("folder");
181
-	}
182
-
183
-	public static function createFolderIfAbsent (string $folder, bool $hidden = false, array $permissions = array(), int $main_menu = -1, int $local_menu = -1, string $force_template = "none", bool $title_translation = true) {
184
-		//escape string
185
-		//$folder = Database::getInstance()->escape($folder);
186
-
187
-		$permissions_str = implode("|", $permissions);
188
-
189
-		if (sizeof($permissions) == 0) {
190
-			$permissions_str = "none";
191
-		}
192
-
193
-		Database::getInstance()->execute("INSERT INTO `{praefix}folder` (
170
+            'folder' => $folder,
171
+            'templatename' => $force_template,
172
+            'main_menu' => $main_menu,
173
+            'local_menu' => $local_menu,
174
+            'permissions' => $permissions_str,
175
+            'title_translation_support' => ($title_translation ? 1 : 0),
176
+            'hidden' => $hidden ? 1 : 0
177
+        ));
178
+
179
+        //clear cache
180
+        Cache::clear("folder");
181
+    }
182
+
183
+    public static function createFolderIfAbsent (string $folder, bool $hidden = false, array $permissions = array(), int $main_menu = -1, int $local_menu = -1, string $force_template = "none", bool $title_translation = true) {
184
+        //escape string
185
+        //$folder = Database::getInstance()->escape($folder);
186
+
187
+        $permissions_str = implode("|", $permissions);
188
+
189
+        if (sizeof($permissions) == 0) {
190
+            $permissions_str = "none";
191
+        }
192
+
193
+        Database::getInstance()->execute("INSERT INTO `{praefix}folder` (
194 194
 			`folder`, `force_template`, `main_menu`, `local_menu`, `permissions`, `title_translation_support`, `hidden`, `activated`
195 195
 		) VALUES (
196 196
 			:folder, :templatename, :main_menu, :local_menu, :permissions, :title_translation_support, :hidden, '1'
197 197
 		) ON DUPLICATE KEY UPDATE `hidden` = :hidden, `permissions` = :permissions, `force_template` = :templatename; ", array(
198
-			'folder' => $folder,
199
-			'templatename' => $force_template,
200
-			'main_menu' => $main_menu,
201
-			'local_menu' => $local_menu,
202
-			'permissions' => $permissions_str,
203
-			'title_translation_support' => ($title_translation ? 1 : 0),
204
-			'hidden' => $hidden ? 1 : 0
205
-		));
206
-
207
-		//clear cache
208
-		Cache::clear("folder");
209
-	}
210
-
211
-	public static function deleteFolder ($folder) {
212
-		//escape string
213
-		//$folder = Database::getInstance()->escape($folder);
214
-
215
-		Database::getInstance()->execute("DELETE FROM `{praefix}folder` WHERE `folder` = :folder; ", array('folder' => $folder));
216
-	}
217
-
218
-	public static function listFolders (bool $include_hidden_folders = false) {
219
-		if (Cache::contains("folder", "list_" . ($include_hidden_folders ? "hidden" : "not_hidden"))) {
220
-			return Cache::get("folder", "list_" . ($include_hidden_folders ? "hidden" : "not_hidden"));
221
-		} else {
222
-			$rows = array();
223
-
224
-			if ($include_hidden_folders) {
225
-				$rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}folder` WHERE `activated` = 1; ");
226
-			} else {
227
-				$rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}folder` WHERE `hidden` = 0 AND `activated` = 1; ");
228
-			}
229
-
230
-			Cache::put("folder", "list_" . ($include_hidden_folders ? "hidden" : "not_hidden"), $rows);
231
-
232
-			return $rows;
233
-		}
234
-	}
235
-
236
-	public static function exists (string $folder) : bool {
237
-		$row = Database::getInstance()->getRow("SELECT * FROM `{praefix}folder` WHERE `folder` = :folder; ", array(
238
-			'folder' => $folder
239
-		));
240
-
241
-		return $row !== false;
242
-	}
198
+            'folder' => $folder,
199
+            'templatename' => $force_template,
200
+            'main_menu' => $main_menu,
201
+            'local_menu' => $local_menu,
202
+            'permissions' => $permissions_str,
203
+            'title_translation_support' => ($title_translation ? 1 : 0),
204
+            'hidden' => $hidden ? 1 : 0
205
+        ));
206
+
207
+        //clear cache
208
+        Cache::clear("folder");
209
+    }
210
+
211
+    public static function deleteFolder ($folder) {
212
+        //escape string
213
+        //$folder = Database::getInstance()->escape($folder);
214
+
215
+        Database::getInstance()->execute("DELETE FROM `{praefix}folder` WHERE `folder` = :folder; ", array('folder' => $folder));
216
+    }
217
+
218
+    public static function listFolders (bool $include_hidden_folders = false) {
219
+        if (Cache::contains("folder", "list_" . ($include_hidden_folders ? "hidden" : "not_hidden"))) {
220
+            return Cache::get("folder", "list_" . ($include_hidden_folders ? "hidden" : "not_hidden"));
221
+        } else {
222
+            $rows = array();
223
+
224
+            if ($include_hidden_folders) {
225
+                $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}folder` WHERE `activated` = 1; ");
226
+            } else {
227
+                $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}folder` WHERE `hidden` = 0 AND `activated` = 1; ");
228
+            }
229
+
230
+            Cache::put("folder", "list_" . ($include_hidden_folders ? "hidden" : "not_hidden"), $rows);
231
+
232
+            return $rows;
233
+        }
234
+    }
235
+
236
+    public static function exists (string $folder) : bool {
237
+        $row = Database::getInstance()->getRow("SELECT * FROM `{praefix}folder` WHERE `folder` = :folder; ", array(
238
+            'folder' => $folder
239
+        ));
240
+
241
+        return $row !== false;
242
+    }
243 243
 
244 244
 }
245 245
 
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		$this->folder = $folder;
37 37
 	}
38 38
 
39
-	public function load ($folder) {
39
+	public function load($folder) {
40 40
 		self::$load_count++;
41 41
 
42 42
 		if (self::$load_count > 50) {
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 		}
74 74
 	}
75 75
 
76
-	public function getFolder () : string {
76
+	public function getFolder() : string {
77 77
 		return $this->row['folder'];
78 78
 	}
79 79
 
80
-	public function listRequiredPermissions () : array {
80
+	public function listRequiredPermissions() : array {
81 81
 		return explode("|", $this->row['permissions']);
82 82
 	}
83 83
 
84
-	public function checkPermissions (PermissionChecker $permission_checker) : bool {
84
+	public function checkPermissions(PermissionChecker $permission_checker) : bool {
85 85
 		foreach ($this->listRequiredPermissions() as $permission) {
86 86
 			if ($permission_checker->hasRight($permission)) {
87 87
 				return true;
@@ -93,35 +93,35 @@  discard block
 block discarded – undo
93 93
 		return false;
94 94
 	}
95 95
 
96
-	public function isHidden () : bool {
96
+	public function isHidden() : bool {
97 97
 		return $this->row['hidden'] == 1;
98 98
 	}
99 99
 
100
-	public function hasCustomMainMenu () : bool {
100
+	public function hasCustomMainMenu() : bool {
101 101
 		return $this->row['main_menu'] != -1;
102 102
 	}
103 103
 
104
-	public function getMainMenu () : int {
104
+	public function getMainMenu() : int {
105 105
 		return $this->row['main_menu'];
106 106
 	}
107 107
 
108
-	public function hasCustomLocalMenu () : bool {
108
+	public function hasCustomLocalMenu() : bool {
109 109
 		return $this->row['local_menu'] != -1;
110 110
 	}
111 111
 
112
-	public function getLocalMenu () : int {
112
+	public function getLocalMenu() : int {
113 113
 		return $this->row['local_menu'];
114 114
 	}
115 115
 
116
-	public function isTitleTranslationEnabled () {
116
+	public function isTitleTranslationEnabled() {
117 117
 		return $this->row['title_translation_support'] == 1;
118 118
 	}
119 119
 
120
-	public function isActivated () : bool {
120
+	public function isActivated() : bool {
121 121
 		return $this->row['activated'] == 1;
122 122
 	}
123 123
 
124
-	public static function getFolderByPage (string $page) : string {
124
+	public static function getFolderByPage(string $page) : string {
125 125
 		$array = explode("/", $page);
126 126
 
127 127
 		if (sizeof($array) <= 2 && empty($array[0])) {
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		return implode("/", $array) . "/";
135 135
 	}
136 136
 
137
-	public static function getUpperDir ($dir) {
137
+	public static function getUpperDir($dir) {
138 138
 		if (PHPUtils::endsWith($dir, "/")) {
139 139
 			//remove last slash
140 140
 			$dir = substr($dir, 0, -1);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		return implode("/", $array) . "/";
153 153
 	}
154 154
 
155
-	public static function createFolder (string $folder, bool $hidden = false, array $permissions = array(), int $main_menu = -1, int $local_menu = -1, string $force_template = "none", bool $title_translation = true) {
155
+	public static function createFolder(string $folder, bool $hidden = false, array $permissions = array(), int $main_menu = -1, int $local_menu = -1, string $force_template = "none", bool $title_translation = true) {
156 156
 		//escape string
157 157
 		//$folder = Database::getInstance()->escape($folder);
158 158
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 		Cache::clear("folder");
181 181
 	}
182 182
 
183
-	public static function createFolderIfAbsent (string $folder, bool $hidden = false, array $permissions = array(), int $main_menu = -1, int $local_menu = -1, string $force_template = "none", bool $title_translation = true) {
183
+	public static function createFolderIfAbsent(string $folder, bool $hidden = false, array $permissions = array(), int $main_menu = -1, int $local_menu = -1, string $force_template = "none", bool $title_translation = true) {
184 184
 		//escape string
185 185
 		//$folder = Database::getInstance()->escape($folder);
186 186
 
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
 		Cache::clear("folder");
209 209
 	}
210 210
 
211
-	public static function deleteFolder ($folder) {
211
+	public static function deleteFolder($folder) {
212 212
 		//escape string
213 213
 		//$folder = Database::getInstance()->escape($folder);
214 214
 
215 215
 		Database::getInstance()->execute("DELETE FROM `{praefix}folder` WHERE `folder` = :folder; ", array('folder' => $folder));
216 216
 	}
217 217
 
218
-	public static function listFolders (bool $include_hidden_folders = false) {
218
+	public static function listFolders(bool $include_hidden_folders = false) {
219 219
 		if (Cache::contains("folder", "list_" . ($include_hidden_folders ? "hidden" : "not_hidden"))) {
220 220
 			return Cache::get("folder", "list_" . ($include_hidden_folders ? "hidden" : "not_hidden"));
221 221
 		} else {
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 		}
234 234
 	}
235 235
 
236
-	public static function exists (string $folder) : bool {
236
+	public static function exists(string $folder) : bool {
237 237
 		$row = Database::getInstance()->getRow("SELECT * FROM `{praefix}folder` WHERE `folder` = :folder; ", array(
238 238
 			'folder' => $folder
239 239
 		));
Please login to merge, or discard this patch.
system/packages/com.jukusoft.cms.admin/classes/createpagepage.php 1 patch
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -27,126 +27,126 @@
 block discarded – undo
27 27
 
28 28
 class CreatePagePage extends PageType {
29 29
 
30
-	public function getContent(): string {
31
-		$template = new DwooTemplate("pages/createpage");
30
+    public function getContent(): string {
31
+        $template = new DwooTemplate("pages/createpage");
32 32
 
33
-		$errors = array();
34
-
35
-		if (isset($_REQUEST['action']) && $_REQUEST['action'] === "create" && PermissionChecker::current()->hasRight("can_create_pages")) {
36
-			//try to create a new page
37
-
38
-			//first, get all values
39
-			if (!isset($_REQUEST['folder']) || empty($_REQUEST['folder'])) {
40
-				$errors[] = "Folder is not set!";
41
-			}
33
+        $errors = array();
34
+
35
+        if (isset($_REQUEST['action']) && $_REQUEST['action'] === "create" && PermissionChecker::current()->hasRight("can_create_pages")) {
36
+            //try to create a new page
37
+
38
+            //first, get all values
39
+            if (!isset($_REQUEST['folder']) || empty($_REQUEST['folder'])) {
40
+                $errors[] = "Folder is not set!";
41
+            }
42 42
 
43
-			if (!isset($_REQUEST['page_alias']) || empty($_REQUEST['page_alias'])) {
44
-				$errors[] = "Page alias isn't set!";
45
-			}
43
+            if (!isset($_REQUEST['page_alias']) || empty($_REQUEST['page_alias'])) {
44
+                $errors[] = "Page alias isn't set!";
45
+            }
46 46
 
47
-			if (!isset($_REQUEST['title']) || empty($_REQUEST['title'])) {
48
-				$errors[] = "Title is't set!";
49
-			}
50
-
51
-			if (!isset($_REQUEST['pagetype']) || empty($_REQUEST['pagetype'])) {
52
-				$errors[] = "Pagetype is't set!";
53
-			}
54
-
55
-			if (empty($errors)) {
56
-				$folder = $_REQUEST['folder'];
57
-				$alias = $_REQUEST['page_alias'];
58
-				$title = $_REQUEST['title'];
59
-				$pagetype = $_REQUEST['pagetype'];
60
-
61
-				//check, if folder exists
62
-				if (!Folder::exists($folder)) {
63
-					$errors[] = "Folder '" . htmlentities($folder) . "' doesn't exists!";
64
-				}
65
-
66
-				//check, if page alias already exists
67
-				$page_full_alias = $folder . $alias;
68
-
69
-				if (PHPUtils::startsWith($page_full_alias, "/")) {
70
-					//remove / at beginning
71
-					$page_full_alias = substr($page_full_alias, 1);
72
-				}
73
-
74
-				if (Page::exists($page_full_alias)) {
75
-					$errors[] = "Page alias '" . htmlentities($page_full_alias) . "' already exists!";
76
-				}
77
-
78
-				//remove html characters in title
79
-				$title = htmlentities($title);
80
-
81
-				//check, if pagetype exists
82
-				if (!PageType::exists($pagetype)) {
83
-					$errors[] = "Pagetype '" . htmlentities($pagetype) . "' doesn't exists!";
84
-				}
85
-
86
-				Events::throwEvent("before_create_page", array(
87
-					'folder' => &$folder,
88
-					'alias' => &$alias,
89
-					'full_alias' => &$page_full_alias,
90
-					'title' => &$title,
91
-					'pagetype' => &$pagetype
92
-				));
93
-
94
-				if (empty($errors)) {
95
-					$pageID = Page::createIfAbsent($page_full_alias, htmlentities($title), $pagetype, "", $folder, -1, -1, -1, true, false, true, true, User::current()->getUsername());
96
-
97
-					Events::throwEvent("after_create_page", array(
98
-						'pageID' => $pageID
99
-					));
100
-
101
-					//redirect header
102
-					header("Location: " . DomainUtils::generateURL("admin/edit_page", array("edit" => $pageID)));
103
-
104
-					exit;
105
-				}
106
-			}
107
-		}
108
-
109
-		//set form action url
110
-		$template->assign("action_url", DomainUtils::generateURL($this->getPage()->getAlias(), array("action" => "create")));
111
-		$template->assign("username", User::current()->getUsername());
112
-
113
-		$template->assign("errors", $errors);
114
-
115
-		//list page types
116
-		$page_types_rows = PageType::listPageTypes();
117
-		$page_types = array();
118
-
119
-		foreach ($page_types_rows as $row) {
120
-			$page_types[] = array(
121
-				'title' => htmlentities(Translator::translateTitle($row['title'])),
122
-				'class_name' => $row['page_type']
123
-			);
124
-		}
125
-
126
-		$template->assign("pagetypes", $page_types);
127
-
128
-		$folders = array();
129
-
130
-		foreach (Folder::listFolders(false) as $row) {
131
-			$folders[] = array(
132
-				'folder' => $row['folder'],
133
-				'hidden' => $row['hidden'] == 1,
134
-				'is_root_folder' => $row['folder'] === "/"
135
-			);
136
-		}
137
-
138
-		$template->assign("folders", $folders);
139
-
140
-		return $template->getCode();
141
-	}
142
-
143
-	public function getFooterScripts(): string {
144
-		return "";
145
-	}
146
-
147
-	public function listRequiredPermissions(): array {
148
-		return array("can_create_pages");
149
-	}
47
+            if (!isset($_REQUEST['title']) || empty($_REQUEST['title'])) {
48
+                $errors[] = "Title is't set!";
49
+            }
50
+
51
+            if (!isset($_REQUEST['pagetype']) || empty($_REQUEST['pagetype'])) {
52
+                $errors[] = "Pagetype is't set!";
53
+            }
54
+
55
+            if (empty($errors)) {
56
+                $folder = $_REQUEST['folder'];
57
+                $alias = $_REQUEST['page_alias'];
58
+                $title = $_REQUEST['title'];
59
+                $pagetype = $_REQUEST['pagetype'];
60
+
61
+                //check, if folder exists
62
+                if (!Folder::exists($folder)) {
63
+                    $errors[] = "Folder '" . htmlentities($folder) . "' doesn't exists!";
64
+                }
65
+
66
+                //check, if page alias already exists
67
+                $page_full_alias = $folder . $alias;
68
+
69
+                if (PHPUtils::startsWith($page_full_alias, "/")) {
70
+                    //remove / at beginning
71
+                    $page_full_alias = substr($page_full_alias, 1);
72
+                }
73
+
74
+                if (Page::exists($page_full_alias)) {
75
+                    $errors[] = "Page alias '" . htmlentities($page_full_alias) . "' already exists!";
76
+                }
77
+
78
+                //remove html characters in title
79
+                $title = htmlentities($title);
80
+
81
+                //check, if pagetype exists
82
+                if (!PageType::exists($pagetype)) {
83
+                    $errors[] = "Pagetype '" . htmlentities($pagetype) . "' doesn't exists!";
84
+                }
85
+
86
+                Events::throwEvent("before_create_page", array(
87
+                    'folder' => &$folder,
88
+                    'alias' => &$alias,
89
+                    'full_alias' => &$page_full_alias,
90
+                    'title' => &$title,
91
+                    'pagetype' => &$pagetype
92
+                ));
93
+
94
+                if (empty($errors)) {
95
+                    $pageID = Page::createIfAbsent($page_full_alias, htmlentities($title), $pagetype, "", $folder, -1, -1, -1, true, false, true, true, User::current()->getUsername());
96
+
97
+                    Events::throwEvent("after_create_page", array(
98
+                        'pageID' => $pageID
99
+                    ));
100
+
101
+                    //redirect header
102
+                    header("Location: " . DomainUtils::generateURL("admin/edit_page", array("edit" => $pageID)));
103
+
104
+                    exit;
105
+                }
106
+            }
107
+        }
108
+
109
+        //set form action url
110
+        $template->assign("action_url", DomainUtils::generateURL($this->getPage()->getAlias(), array("action" => "create")));
111
+        $template->assign("username", User::current()->getUsername());
112
+
113
+        $template->assign("errors", $errors);
114
+
115
+        //list page types
116
+        $page_types_rows = PageType::listPageTypes();
117
+        $page_types = array();
118
+
119
+        foreach ($page_types_rows as $row) {
120
+            $page_types[] = array(
121
+                'title' => htmlentities(Translator::translateTitle($row['title'])),
122
+                'class_name' => $row['page_type']
123
+            );
124
+        }
125
+
126
+        $template->assign("pagetypes", $page_types);
127
+
128
+        $folders = array();
129
+
130
+        foreach (Folder::listFolders(false) as $row) {
131
+            $folders[] = array(
132
+                'folder' => $row['folder'],
133
+                'hidden' => $row['hidden'] == 1,
134
+                'is_root_folder' => $row['folder'] === "/"
135
+            );
136
+        }
137
+
138
+        $template->assign("folders", $folders);
139
+
140
+        return $template->getCode();
141
+    }
142
+
143
+    public function getFooterScripts(): string {
144
+        return "";
145
+    }
146
+
147
+    public function listRequiredPermissions(): array {
148
+        return array("can_create_pages");
149
+    }
150 150
 
151 151
 }
152 152
 
Please login to merge, or discard this patch.
system/packages/com.jukusoft.cms.sitemap/classes/sitemappage.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -27,50 +27,50 @@
 block discarded – undo
27 27
 
28 28
 class SitemapPage extends PageType {
29 29
 
30
-	public function getContentType(): string {
31
-		return "text/xml; charset=" . $this->getCharset();
32
-	}
30
+    public function getContentType(): string {
31
+        return "text/xml; charset=" . $this->getCharset();
32
+    }
33 33
 
34
-	public function getContent(): string {
35
-		$template = new DwooTemplate(PACKAGE_PATH . "com.jukusoft.cms.sitemap/template/sitemap.tpl");
34
+    public function getContent(): string {
35
+        $template = new DwooTemplate(PACKAGE_PATH . "com.jukusoft.cms.sitemap/template/sitemap.tpl");
36 36
 
37
-		$urls = array();
37
+        $urls = array();
38 38
 
39
-		$rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}pages` WHERE `sitemap` = '1' AND `published` = '1' AND `activated` = '1'; ");
39
+        $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}pages` WHERE `sitemap` = '1' AND `published` = '1' AND `activated` = '1'; ");
40 40
 
41
-		foreach ($rows as $row) {
42
-			$entry = array();
41
+        foreach ($rows as $row) {
42
+            $entry = array();
43 43
 
44
-			//generate url to page
45
-			$entry['loc'] = DomainUtils::generateURL($row['alias']);
44
+            //generate url to page
45
+            $entry['loc'] = DomainUtils::generateURL($row['alias']);
46 46
 
47
-			//get last modified timestamp
48
-			$last_update = ($row['last_update'] === "0000-00-00 00:00:00" ? $row['created'] : $row['last_update']);
47
+            //get last modified timestamp
48
+            $last_update = ($row['last_update'] === "0000-00-00 00:00:00" ? $row['created'] : $row['last_update']);
49 49
 
50
-			//timezone berlin
51
-			$timezone = "+01:00";
50
+            //timezone berlin
51
+            $timezone = "+01:00";
52 52
 
53
-			//convert last modification timestamp to w3c timestamp: https://www.w3.org/TR/NOTE-datetime
54
-			$entry['lastmod'] = date('Y-m-d\TH:i:s', strtotime($last_update)) . $timezone;
53
+            //convert last modification timestamp to w3c timestamp: https://www.w3.org/TR/NOTE-datetime
54
+            $entry['lastmod'] = date('Y-m-d\TH:i:s', strtotime($last_update)) . $timezone;
55 55
 
56
-			$entry['changefreq'] = strtolower($row['sitemap_changefreq']);
57
-			$entry['priority'] = $row['sitemap_priority'];
56
+            $entry['changefreq'] = strtolower($row['sitemap_changefreq']);
57
+            $entry['priority'] = $row['sitemap_priority'];
58 58
 
59
-			$urls[] = $entry;
60
-		}
59
+            $urls[] = $entry;
60
+        }
61 61
 
62
-		$template->assign("urls", $urls);
62
+        $template->assign("urls", $urls);
63 63
 
64
-		return $template->getCode();
65
-	}
64
+        return $template->getCode();
65
+    }
66 66
 
67
-	public function showDesign() {
68
-		return false;
69
-	}
67
+    public function showDesign() {
68
+        return false;
69
+    }
70 70
 
71
-	public function showHTMLComments(): bool {
72
-		return false;
73
-	}
71
+    public function showHTMLComments(): bool {
72
+        return false;
73
+    }
74 74
 
75 75
 }
76 76
 
Please login to merge, or discard this patch.
styles/admin/bower_components/ckeditor/samples/old/assets/posteddata.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,22 +27,22 @@
 block discarded – undo
27 27
 
28 28
 if (!empty($_POST))
29 29
 {
30
-	foreach ( $_POST as $key => $value )
31
-	{
32
-		if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
33
-			continue;
30
+    foreach ( $_POST as $key => $value )
31
+    {
32
+        if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
33
+            continue;
34 34
 
35
-		if ( get_magic_quotes_gpc() )
36
-			$value = htmlspecialchars( stripslashes((string)$value) );
37
-		else
38
-			$value = htmlspecialchars( (string)$value );
35
+        if ( get_magic_quotes_gpc() )
36
+            $value = htmlspecialchars( stripslashes((string)$value) );
37
+        else
38
+            $value = htmlspecialchars( (string)$value );
39 39
 ?>
40 40
 		<tr>
41 41
 			<th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th>
42 42
 			<td><pre class="samples"><?php echo $value; ?></pre></td>
43 43
 		</tr>
44 44
 	<?php
45
-	}
45
+    }
46 46
 }
47 47
 ?>
48 48
 	</table>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,18 +27,18 @@
 block discarded – undo
27 27
 
28 28
 if (!empty($_POST))
29 29
 {
30
-	foreach ( $_POST as $key => $value )
30
+	foreach ($_POST as $key => $value)
31 31
 	{
32
-		if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
32
+		if ((!is_string($value) && !is_numeric($value)) || !is_string($key))
33 33
 			continue;
34 34
 
35
-		if ( get_magic_quotes_gpc() )
36
-			$value = htmlspecialchars( stripslashes((string)$value) );
35
+		if (get_magic_quotes_gpc())
36
+			$value = htmlspecialchars(stripslashes((string) $value));
37 37
 		else
38
-			$value = htmlspecialchars( (string)$value );
38
+			$value = htmlspecialchars((string) $value);
39 39
 ?>
40 40
 		<tr>
41
-			<th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th>
41
+			<th style="vertical-align: top"><?php echo htmlspecialchars((string) $key); ?></th>
42 42
 			<td><pre class="samples"><?php echo $value; ?></pre></td>
43 43
 		</tr>
44 44
 	<?php
Please login to merge, or discard this patch.
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,14 +29,16 @@
 block discarded – undo
29 29
 {
30 30
 	foreach ( $_POST as $key => $value )
31 31
 	{
32
-		if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
33
-			continue;
32
+		if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) {
33
+					continue;
34
+		}
34 35
 
35
-		if ( get_magic_quotes_gpc() )
36
-			$value = htmlspecialchars( stripslashes((string)$value) );
37
-		else
38
-			$value = htmlspecialchars( (string)$value );
39
-?>
36
+		if ( get_magic_quotes_gpc() ) {
37
+					$value = htmlspecialchars( stripslashes((string)$value) );
38
+		} else {
39
+					$value = htmlspecialchars( (string)$value );
40
+		}
41
+		?>
40 42
 		<tr>
41 43
 			<th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th>
42 44
 			<td><pre class="samples"><?php echo $value; ?></pre></td>
Please login to merge, or discard this patch.