@@ -18,225 +18,225 @@ |
||
| 18 | 18 | |
| 19 | 19 | class StyleRules { |
| 20 | 20 | |
| 21 | - protected static $rules = array(); |
|
| 22 | - protected static $initialized = false; |
|
| 23 | - |
|
| 24 | - protected static $allowed_types = array("DOMAIN", "FOLDER", "MEDIA", "LANGUAGE"); |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * default constructor |
|
| 28 | - */ |
|
| 29 | - public function __construct() { |
|
| 30 | - // |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - public static function getStyle (Registry &$registry, string $default_style_name) : string { |
|
| 34 | - //load all rules, if absent |
|
| 35 | - self::initIfAbsent(); |
|
| 36 | - |
|
| 37 | - return self::applyRules(-1, $registry, $default_style_name); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - protected static function applyRules (int $parentID, Registry &$registry, $default_value) : string { |
|
| 41 | - if (!isset(self::$rules[$parentID])) { |
|
| 42 | - //parentID isnt set in array |
|
| 43 | - return $default_value; |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - //get all root rules |
|
| 47 | - $root_rules = self::$rules[$parentID]; |
|
| 48 | - |
|
| 49 | - $style_name = $default_value; |
|
| 50 | - |
|
| 51 | - //iterate through rules |
|
| 52 | - foreach ($root_rules as $rule) { |
|
| 53 | - $type = $rule['type']; |
|
| 54 | - $expected_value = $rule['expected_value']; |
|
| 55 | - |
|
| 56 | - //validate condition |
|
| 57 | - if (self::checkCondition($type, $expected_value, $registry)) { |
|
| 58 | - //set new default value |
|
| 59 | - $style_name = $rule['style_name']; |
|
| 60 | - $parentID = $rule['rule_id']; |
|
| 61 | - |
|
| 62 | - //search for next rules |
|
| 63 | - return self::applyRules($parentID, $registry, $style_name); |
|
| 64 | - |
|
| 65 | - break; |
|
| 66 | - } |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - return $style_name; |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * check, if a condition is true |
|
| 74 | - * |
|
| 75 | - * @param $type condition type ("DOMAIN", "FOLDER", "MEDIA", "LANGUAGE") |
|
| 76 | - * @param $expected_value expected value |
|
| 77 | - * @param $registry instance of Registry |
|
| 78 | - * |
|
| 79 | - * @return true, if condition is true |
|
| 80 | - */ |
|
| 81 | - public static function checkCondition (string $type, string $expected_value, Registry &$registry) : bool { |
|
| 82 | - $type = strtoupper($type); |
|
| 83 | - |
|
| 84 | - //check, if condition type is allowed |
|
| 85 | - if (!in_array($type, self::$allowed_types)) { |
|
| 86 | - throw new IllegalArgumentException("condition type '" . $type . "' is unknown."); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - //TODO: check condition |
|
| 90 | - switch ($type) { |
|
| 91 | - case "DOMAIN": |
|
| 92 | - //get current domain |
|
| 93 | - $current_domain = $registry->getSetting("domain_name"); |
|
| 94 | - |
|
| 95 | - //compare expected domain with |
|
| 96 | - return strcmp($current_domain, $expected_value) === 0; |
|
| 97 | - |
|
| 98 | - break; |
|
| 99 | - case "FOLDER": |
|
| 100 | - $page_folder = $registry->getSetting("folder"); |
|
| 101 | - |
|
| 102 | - return PHPUtils::startsWith($page_folder, $expected_value); |
|
| 103 | - |
|
| 104 | - break; |
|
| 105 | - case "MEDIA": |
|
| 106 | - switch (strtoupper($expected_value)) { |
|
| 107 | - case "MOBILE": |
|
| 108 | - //mobile devices (mbile phone / tablet) |
|
| 109 | - return $registry->getSetting("isMobile"); |
|
| 110 | - |
|
| 111 | - break; |
|
| 112 | - case "MOBILE_PHONE": |
|
| 113 | - //mobile phone (iOS / android phone) |
|
| 114 | - return Browser::isMobilePhone(); |
|
| 115 | - |
|
| 116 | - break; |
|
| 117 | - case "TABLET": |
|
| 118 | - //tablet (iPad / android tablet) |
|
| 119 | - return Browser::isTablet(); |
|
| 120 | - |
|
| 121 | - break; |
|
| 122 | - case "DESKTOP": |
|
| 123 | - //desktop browsers |
|
| 124 | - return !$registry->getSetting("isMobile"); |
|
| 125 | - |
|
| 126 | - break; |
|
| 127 | - case "ANDROID": |
|
| 128 | - //android phones & tablets |
|
| 129 | - return Browser::isAndroid(); |
|
| 130 | - |
|
| 131 | - break; |
|
| 132 | - case "IOS": |
|
| 133 | - //iPod / iPhone / iPad |
|
| 134 | - return Browser::isAppleiOS(); |
|
| 135 | - |
|
| 136 | - break; |
|
| 137 | - case "ALL": |
|
| 138 | - //all devices |
|
| 139 | - return true; |
|
| 140 | - |
|
| 141 | - break; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - break; |
|
| 145 | - case "PREF_LANG": |
|
| 146 | - //get prefered user language token |
|
| 147 | - $lang_token = Lang::getPrefLangToken(); |
|
| 148 | - |
|
| 149 | - return strcmp($lang_token, strtolower($expected_value)) == 0; |
|
| 150 | - |
|
| 151 | - break; |
|
| 152 | - case "SUPPORTED_LANG": |
|
| 153 | - //get current user language token |
|
| 154 | - $lang_tokens = $_SERVER['HTTP_ACCEPT_LANGUAGE']; |
|
| 155 | - |
|
| 156 | - //check, if language is supported by browser |
|
| 157 | - return stripos($lang_tokens, $expected_value) !== false; |
|
| 158 | - |
|
| 159 | - break; |
|
| 160 | - case "DEFAULT": |
|
| 161 | - //default value, if all other conditions are false |
|
| 162 | - return true; |
|
| 163 | - |
|
| 164 | - break; |
|
| 165 | - default: |
|
| 166 | - throw new IllegalStateException("Unknown style rule type: " . $type); |
|
| 167 | - break; |
|
| 168 | - } |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - public static function loadAllRules () { |
|
| 172 | - if (Cache::contains("style", "style-rules")) { |
|
| 173 | - self::$rules = Cache::get("style", "style-rules"); |
|
| 174 | - } else { |
|
| 175 | - //get all style rules from database |
|
| 176 | - $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}style_rules` WHERE `activated` = '1' ORDER BY `order`; "); |
|
| 177 | - |
|
| 178 | - $rules = array(); |
|
| 179 | - |
|
| 180 | - foreach ($rows as $row) { |
|
| 181 | - $parentID = $row['parent']; |
|
| 182 | - |
|
| 183 | - if (!isset($rules[$parentID])) { |
|
| 184 | - $rules[$parentID] = array(); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - $rules[$parentID][] = $row; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - if (!isset($rules[-1])) { |
|
| 191 | - $rules[-1] = array(); |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - self::$rules = $rules; |
|
| 195 | - |
|
| 196 | - //cache array |
|
| 197 | - Cache::put("style", "style-rules", self::$rules); |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - //set initialized flag |
|
| 201 | - self::$initialized = true; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - protected static function initIfAbsent () { |
|
| 205 | - if (!self::$initialized) { |
|
| 206 | - self::loadAllRules(); |
|
| 207 | - } |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - public static function createRuleWithPredefinedID (int $ruleID, string $type, string $expected_value, string $style_name, int $parent = -1, int $order = 10) { |
|
| 211 | - $type = strtoupper($type); |
|
| 212 | - |
|
| 213 | - if ($type !== "DOMAIN" && $type !== "FOLDER" && $type !== "MEDIA" && $type !== "PREF_LANG" && $type !== "SUPPORTED_LANG") { |
|
| 214 | - throw new IllegalArgumentException("unknown style rule type '" , $type . "'!"); |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - Database::getInstance()->execute("INSERT INTO `{praefix}style_rules` ( |
|
| 21 | + protected static $rules = array(); |
|
| 22 | + protected static $initialized = false; |
|
| 23 | + |
|
| 24 | + protected static $allowed_types = array("DOMAIN", "FOLDER", "MEDIA", "LANGUAGE"); |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * default constructor |
|
| 28 | + */ |
|
| 29 | + public function __construct() { |
|
| 30 | + // |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + public static function getStyle (Registry &$registry, string $default_style_name) : string { |
|
| 34 | + //load all rules, if absent |
|
| 35 | + self::initIfAbsent(); |
|
| 36 | + |
|
| 37 | + return self::applyRules(-1, $registry, $default_style_name); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + protected static function applyRules (int $parentID, Registry &$registry, $default_value) : string { |
|
| 41 | + if (!isset(self::$rules[$parentID])) { |
|
| 42 | + //parentID isnt set in array |
|
| 43 | + return $default_value; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + //get all root rules |
|
| 47 | + $root_rules = self::$rules[$parentID]; |
|
| 48 | + |
|
| 49 | + $style_name = $default_value; |
|
| 50 | + |
|
| 51 | + //iterate through rules |
|
| 52 | + foreach ($root_rules as $rule) { |
|
| 53 | + $type = $rule['type']; |
|
| 54 | + $expected_value = $rule['expected_value']; |
|
| 55 | + |
|
| 56 | + //validate condition |
|
| 57 | + if (self::checkCondition($type, $expected_value, $registry)) { |
|
| 58 | + //set new default value |
|
| 59 | + $style_name = $rule['style_name']; |
|
| 60 | + $parentID = $rule['rule_id']; |
|
| 61 | + |
|
| 62 | + //search for next rules |
|
| 63 | + return self::applyRules($parentID, $registry, $style_name); |
|
| 64 | + |
|
| 65 | + break; |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + return $style_name; |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * check, if a condition is true |
|
| 74 | + * |
|
| 75 | + * @param $type condition type ("DOMAIN", "FOLDER", "MEDIA", "LANGUAGE") |
|
| 76 | + * @param $expected_value expected value |
|
| 77 | + * @param $registry instance of Registry |
|
| 78 | + * |
|
| 79 | + * @return true, if condition is true |
|
| 80 | + */ |
|
| 81 | + public static function checkCondition (string $type, string $expected_value, Registry &$registry) : bool { |
|
| 82 | + $type = strtoupper($type); |
|
| 83 | + |
|
| 84 | + //check, if condition type is allowed |
|
| 85 | + if (!in_array($type, self::$allowed_types)) { |
|
| 86 | + throw new IllegalArgumentException("condition type '" . $type . "' is unknown."); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + //TODO: check condition |
|
| 90 | + switch ($type) { |
|
| 91 | + case "DOMAIN": |
|
| 92 | + //get current domain |
|
| 93 | + $current_domain = $registry->getSetting("domain_name"); |
|
| 94 | + |
|
| 95 | + //compare expected domain with |
|
| 96 | + return strcmp($current_domain, $expected_value) === 0; |
|
| 97 | + |
|
| 98 | + break; |
|
| 99 | + case "FOLDER": |
|
| 100 | + $page_folder = $registry->getSetting("folder"); |
|
| 101 | + |
|
| 102 | + return PHPUtils::startsWith($page_folder, $expected_value); |
|
| 103 | + |
|
| 104 | + break; |
|
| 105 | + case "MEDIA": |
|
| 106 | + switch (strtoupper($expected_value)) { |
|
| 107 | + case "MOBILE": |
|
| 108 | + //mobile devices (mbile phone / tablet) |
|
| 109 | + return $registry->getSetting("isMobile"); |
|
| 110 | + |
|
| 111 | + break; |
|
| 112 | + case "MOBILE_PHONE": |
|
| 113 | + //mobile phone (iOS / android phone) |
|
| 114 | + return Browser::isMobilePhone(); |
|
| 115 | + |
|
| 116 | + break; |
|
| 117 | + case "TABLET": |
|
| 118 | + //tablet (iPad / android tablet) |
|
| 119 | + return Browser::isTablet(); |
|
| 120 | + |
|
| 121 | + break; |
|
| 122 | + case "DESKTOP": |
|
| 123 | + //desktop browsers |
|
| 124 | + return !$registry->getSetting("isMobile"); |
|
| 125 | + |
|
| 126 | + break; |
|
| 127 | + case "ANDROID": |
|
| 128 | + //android phones & tablets |
|
| 129 | + return Browser::isAndroid(); |
|
| 130 | + |
|
| 131 | + break; |
|
| 132 | + case "IOS": |
|
| 133 | + //iPod / iPhone / iPad |
|
| 134 | + return Browser::isAppleiOS(); |
|
| 135 | + |
|
| 136 | + break; |
|
| 137 | + case "ALL": |
|
| 138 | + //all devices |
|
| 139 | + return true; |
|
| 140 | + |
|
| 141 | + break; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + break; |
|
| 145 | + case "PREF_LANG": |
|
| 146 | + //get prefered user language token |
|
| 147 | + $lang_token = Lang::getPrefLangToken(); |
|
| 148 | + |
|
| 149 | + return strcmp($lang_token, strtolower($expected_value)) == 0; |
|
| 150 | + |
|
| 151 | + break; |
|
| 152 | + case "SUPPORTED_LANG": |
|
| 153 | + //get current user language token |
|
| 154 | + $lang_tokens = $_SERVER['HTTP_ACCEPT_LANGUAGE']; |
|
| 155 | + |
|
| 156 | + //check, if language is supported by browser |
|
| 157 | + return stripos($lang_tokens, $expected_value) !== false; |
|
| 158 | + |
|
| 159 | + break; |
|
| 160 | + case "DEFAULT": |
|
| 161 | + //default value, if all other conditions are false |
|
| 162 | + return true; |
|
| 163 | + |
|
| 164 | + break; |
|
| 165 | + default: |
|
| 166 | + throw new IllegalStateException("Unknown style rule type: " . $type); |
|
| 167 | + break; |
|
| 168 | + } |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + public static function loadAllRules () { |
|
| 172 | + if (Cache::contains("style", "style-rules")) { |
|
| 173 | + self::$rules = Cache::get("style", "style-rules"); |
|
| 174 | + } else { |
|
| 175 | + //get all style rules from database |
|
| 176 | + $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}style_rules` WHERE `activated` = '1' ORDER BY `order`; "); |
|
| 177 | + |
|
| 178 | + $rules = array(); |
|
| 179 | + |
|
| 180 | + foreach ($rows as $row) { |
|
| 181 | + $parentID = $row['parent']; |
|
| 182 | + |
|
| 183 | + if (!isset($rules[$parentID])) { |
|
| 184 | + $rules[$parentID] = array(); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + $rules[$parentID][] = $row; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + if (!isset($rules[-1])) { |
|
| 191 | + $rules[-1] = array(); |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + self::$rules = $rules; |
|
| 195 | + |
|
| 196 | + //cache array |
|
| 197 | + Cache::put("style", "style-rules", self::$rules); |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + //set initialized flag |
|
| 201 | + self::$initialized = true; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + protected static function initIfAbsent () { |
|
| 205 | + if (!self::$initialized) { |
|
| 206 | + self::loadAllRules(); |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + public static function createRuleWithPredefinedID (int $ruleID, string $type, string $expected_value, string $style_name, int $parent = -1, int $order = 10) { |
|
| 211 | + $type = strtoupper($type); |
|
| 212 | + |
|
| 213 | + if ($type !== "DOMAIN" && $type !== "FOLDER" && $type !== "MEDIA" && $type !== "PREF_LANG" && $type !== "SUPPORTED_LANG") { |
|
| 214 | + throw new IllegalArgumentException("unknown style rule type '" , $type . "'!"); |
|
| 215 | + } |
|
| 216 | + |
|
| 217 | + Database::getInstance()->execute("INSERT INTO `{praefix}style_rules` ( |
|
| 218 | 218 | `rule_id`, `type`, `expected_value`, `style_name`, `parent`, `order`, `activated` |
| 219 | 219 | ) VALUES ( |
| 220 | 220 | :ruleID, :type, :value, :style, :parent, :order, '1' |
| 221 | 221 | ) ON DUPLICATE KEY UPDATE `order` = :order; ", array( |
| 222 | - 'ruleID' => $ruleID, |
|
| 223 | - 'type' => $type, |
|
| 224 | - 'value' => $expected_value, |
|
| 225 | - 'style' => $style_name, |
|
| 226 | - 'parent' => $parent, |
|
| 227 | - 'order' => $order |
|
| 228 | - )); |
|
| 229 | - |
|
| 230 | - //clear cache |
|
| 231 | - Cache::clear("style", "style-rules"); |
|
| 232 | - } |
|
| 233 | - |
|
| 234 | - public static function deleteRule (int $ruleID) { |
|
| 235 | - Database::getInstance()->execute("DELETE FROM `{praefix}style_rules` WHERE `rule_id` = :ruleID; ", array('ruleID' => $ruleID)); |
|
| 236 | - |
|
| 237 | - //clear cache |
|
| 238 | - Cache::clear("style", "style-rules"); |
|
| 239 | - } |
|
| 222 | + 'ruleID' => $ruleID, |
|
| 223 | + 'type' => $type, |
|
| 224 | + 'value' => $expected_value, |
|
| 225 | + 'style' => $style_name, |
|
| 226 | + 'parent' => $parent, |
|
| 227 | + 'order' => $order |
|
| 228 | + )); |
|
| 229 | + |
|
| 230 | + //clear cache |
|
| 231 | + Cache::clear("style", "style-rules"); |
|
| 232 | + } |
|
| 233 | + |
|
| 234 | + public static function deleteRule (int $ruleID) { |
|
| 235 | + Database::getInstance()->execute("DELETE FROM `{praefix}style_rules` WHERE `rule_id` = :ruleID; ", array('ruleID' => $ruleID)); |
|
| 236 | + |
|
| 237 | + //clear cache |
|
| 238 | + Cache::clear("style", "style-rules"); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | 241 | } |
| 242 | 242 | |
@@ -6,74 +6,74 @@ |
||
| 6 | 6 | |
| 7 | 7 | //allow including of mysql.cfg only once (for security reasons) |
| 8 | 8 | if (defined('MYSQL_CONFIG_INCLUDED')) { |
| 9 | - echo "Error! Cannot include mysql.cfg again (because for security reasons)."; |
|
| 10 | - exit; |
|
| 9 | + echo "Error! Cannot include mysql.cfg again (because for security reasons)."; |
|
| 10 | + exit; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | define('MYSQL_CONFIG_INCLUDED', true); |
| 14 | 14 | |
| 15 | 15 | $mysql_settings = array( |
| 16 | - /** |
|
| 17 | - * MySQL Host |
|
| 18 | - * |
|
| 19 | - * For example "localhost" or the ip of your mysql server |
|
| 20 | - */ |
|
| 21 | - 'host' => "localhost", |
|
| 16 | + /** |
|
| 17 | + * MySQL Host |
|
| 18 | + * |
|
| 19 | + * For example "localhost" or the ip of your mysql server |
|
| 20 | + */ |
|
| 21 | + 'host' => "localhost", |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * MySQL Port |
|
| 25 | - * |
|
| 26 | - * by default 3306 |
|
| 27 | - */ |
|
| 28 | - 'port' => 3306, |
|
| 23 | + /** |
|
| 24 | + * MySQL Port |
|
| 25 | + * |
|
| 26 | + * by default 3306 |
|
| 27 | + */ |
|
| 28 | + 'port' => 3306, |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * MySQL database user |
|
| 32 | - * |
|
| 33 | - * If you have an choice: Dont use "root" ! |
|
| 34 | - */ |
|
| 35 | - 'username' => "root", |
|
| 30 | + /** |
|
| 31 | + * MySQL database user |
|
| 32 | + * |
|
| 33 | + * If you have an choice: Dont use "root" ! |
|
| 34 | + */ |
|
| 35 | + 'username' => "root", |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * MySQL database password |
|
| 39 | - */ |
|
| 40 | - 'password' => "<Insert your password here>", |
|
| 37 | + /** |
|
| 38 | + * MySQL database password |
|
| 39 | + */ |
|
| 40 | + 'password' => "<Insert your password here>", |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * MySQL database name |
|
| 44 | - */ |
|
| 45 | - 'database' => "pscf", |
|
| 42 | + /** |
|
| 43 | + * MySQL database name |
|
| 44 | + */ |
|
| 45 | + 'database' => "pscf", |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * MySQL table praefix (praefix before table name, for example "prefix_<Table Name>") |
|
| 49 | - * |
|
| 50 | - * Also "" is allowed |
|
| 51 | - */ |
|
| 52 | - 'praefix' => "pscf_", |
|
| 47 | + /** |
|
| 48 | + * MySQL table praefix (praefix before table name, for example "prefix_<Table Name>") |
|
| 49 | + * |
|
| 50 | + * Also "" is allowed |
|
| 51 | + */ |
|
| 52 | + 'praefix' => "pscf_", |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * optional PhpMyAdmin configuration to show PhpMyAdmin menu or other thinks in administration panel |
|
| 56 | - */ |
|
| 57 | - 'phpmyadmin' => array( |
|
| 58 | - 'enabled' => false, |
|
| 59 | - 'link' => "<Insert your PhpMyAdmin Link here (optional)>", |
|
| 54 | + /** |
|
| 55 | + * optional PhpMyAdmin configuration to show PhpMyAdmin menu or other thinks in administration panel |
|
| 56 | + */ |
|
| 57 | + 'phpmyadmin' => array( |
|
| 58 | + 'enabled' => false, |
|
| 59 | + 'link' => "<Insert your PhpMyAdmin Link here (optional)>", |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * should phpMyAdmin shown in administration panel? |
|
| 63 | - * |
|
| 64 | - * true / false |
|
| 65 | - */ |
|
| 66 | - 'admin_access' => true |
|
| 67 | - ), |
|
| 61 | + /** |
|
| 62 | + * should phpMyAdmin shown in administration panel? |
|
| 63 | + * |
|
| 64 | + * true / false |
|
| 65 | + */ |
|
| 66 | + 'admin_access' => true |
|
| 67 | + ), |
|
| 68 | 68 | |
| 69 | - 'options' => array( |
|
| 70 | - /** |
|
| 71 | - * use connection pooling, dont create an new connection on every request, use connection caching |
|
| 72 | - * |
|
| 73 | - * @link http://php.net/manual/de/pdo.connections.php |
|
| 74 | - */ |
|
| 75 | - PDO::ATTR_PERSISTENT => true |
|
| 76 | - ) |
|
| 69 | + 'options' => array( |
|
| 70 | + /** |
|
| 71 | + * use connection pooling, dont create an new connection on every request, use connection caching |
|
| 72 | + * |
|
| 73 | + * @link http://php.net/manual/de/pdo.connections.php |
|
| 74 | + */ |
|
| 75 | + PDO::ATTR_PERSISTENT => true |
|
| 76 | + ) |
|
| 77 | 77 | ); |
| 78 | 78 | |
| 79 | 79 | ?> |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | error_reporting(E_ALL); |
| 28 | 28 | |
| 29 | 29 | $config = array( |
| 30 | - 'PHP_BENCHMARK' => true |
|
| 30 | + 'PHP_BENCHMARK' => true |
|
| 31 | 31 | ); |
| 32 | 32 | |
| 33 | 33 | ?> |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | require(ROOT_PATH . "system/packages/com.jukusoft.cms.xtpl/xtpl/caching_xtemplate.class.php"); |
| 37 | 37 | |
| 38 | 38 | if (!file_exists(ROOT_PATH . "/twig_performance/cache/")) { |
| 39 | - mkdir(ROOT_PATH . "/twig_performance/cache/"); |
|
| 39 | + mkdir(ROOT_PATH . "/twig_performance/cache/"); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $template = new CachingXTemplate(dirname(__FILLE__) . "/index.tpl"); |
@@ -21,30 +21,30 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | 23 | $autoloader_classes = array( |
| 24 | - "system/core/exception/classloaderexception.php", |
|
| 25 | - "system/core/classes/dbdriver.php", |
|
| 26 | - "system/core/driver/mysqldriver.php", |
|
| 27 | - "system/core/classes/database.php", |
|
| 28 | - "system/core/classes/security.php", |
|
| 29 | - "system/core/classes/icache.php", |
|
| 30 | - "system/core/classes/cache.php", |
|
| 31 | - "system/core/classes/phputils.php", |
|
| 32 | - "system/core/driver/filecache.php", |
|
| 33 | - "system/core/classes/events.php", |
|
| 34 | - "system/packages/com.jukusoft.cms.settings/classes/settings.php", |
|
| 35 | - "system/packages/com.jukusoft.cms.xtpl/classes/template.php", |
|
| 36 | - "system/packages/com.jukusoft.cms.xtpl/xtpl/xtemplate.class.php", |
|
| 37 | - "system/packages/com.jukusoft.cms.xtpl/xtpl/caching_xtemplate.class.php", |
|
| 38 | - "system/packages/com.jukusoft.cms.browser/classes/browser.php", |
|
| 39 | - "system/packages/com.jukusoft.cms.lang/classes/lang.php", |
|
| 40 | - "system/packages/com.jukusoft.cms.style/classes/stylerules.php", |
|
| 41 | - "system/packages/com.jukusoft.cms.style/classes/stylecontroller.php", |
|
| 42 | - "system/packages/com.jukusoft.cms.page/classes/page.php", |
|
| 43 | - "system/packages/com.jukusoft.cms.page/classes/pagetype.php", |
|
| 44 | - "system/packages/com.jukusoft.cms.htmlpage/classes/htmlpage.php", |
|
| 45 | - "system/packages/com.jukusoft.cms.user/classes/user.php", |
|
| 46 | - "system/packages/com.jukusoft.cms.cssbuilder/classes/cssbuilder.php", |
|
| 47 | - "system/packages/com.jukusoft.cms.jsbuilder/classes/jsbuilder.php" |
|
| 24 | + "system/core/exception/classloaderexception.php", |
|
| 25 | + "system/core/classes/dbdriver.php", |
|
| 26 | + "system/core/driver/mysqldriver.php", |
|
| 27 | + "system/core/classes/database.php", |
|
| 28 | + "system/core/classes/security.php", |
|
| 29 | + "system/core/classes/icache.php", |
|
| 30 | + "system/core/classes/cache.php", |
|
| 31 | + "system/core/classes/phputils.php", |
|
| 32 | + "system/core/driver/filecache.php", |
|
| 33 | + "system/core/classes/events.php", |
|
| 34 | + "system/packages/com.jukusoft.cms.settings/classes/settings.php", |
|
| 35 | + "system/packages/com.jukusoft.cms.xtpl/classes/template.php", |
|
| 36 | + "system/packages/com.jukusoft.cms.xtpl/xtpl/xtemplate.class.php", |
|
| 37 | + "system/packages/com.jukusoft.cms.xtpl/xtpl/caching_xtemplate.class.php", |
|
| 38 | + "system/packages/com.jukusoft.cms.browser/classes/browser.php", |
|
| 39 | + "system/packages/com.jukusoft.cms.lang/classes/lang.php", |
|
| 40 | + "system/packages/com.jukusoft.cms.style/classes/stylerules.php", |
|
| 41 | + "system/packages/com.jukusoft.cms.style/classes/stylecontroller.php", |
|
| 42 | + "system/packages/com.jukusoft.cms.page/classes/page.php", |
|
| 43 | + "system/packages/com.jukusoft.cms.page/classes/pagetype.php", |
|
| 44 | + "system/packages/com.jukusoft.cms.htmlpage/classes/htmlpage.php", |
|
| 45 | + "system/packages/com.jukusoft.cms.user/classes/user.php", |
|
| 46 | + "system/packages/com.jukusoft.cms.cssbuilder/classes/cssbuilder.php", |
|
| 47 | + "system/packages/com.jukusoft.cms.jsbuilder/classes/jsbuilder.php" |
|
| 48 | 48 | ); |
| 49 | 49 | |
| 50 | 50 | ?> |
@@ -431,7 +431,7 @@ |
||
| 431 | 431 | * @return $this |
| 432 | 432 | */ |
| 433 | 433 | public static function templateFactory(Core $core, $resourceId, $cacheTime = null, $cacheId = null, |
| 434 | - $compileId = null, ITemplate $parentTemplate = null) |
|
| 434 | + $compileId = null, ITemplate $parentTemplate = null) |
|
| 435 | 435 | { |
| 436 | 436 | return new self($resourceId, $cacheTime, $cacheId, $compileId); |
| 437 | 437 | } |
@@ -199,7 +199,7 @@ |
||
| 199 | 199 | * @throws SecurityException |
| 200 | 200 | */ |
| 201 | 201 | public static function templateFactory(Core $core, $resourceId, $cacheTime = null, $cacheId = null, |
| 202 | - $compileId = null, ITemplate $parentTemplate = null) |
|
| 202 | + $compileId = null, ITemplate $parentTemplate = null) |
|
| 203 | 203 | { |
| 204 | 204 | if (DIRECTORY_SEPARATOR === '\\') { |
| 205 | 205 | $resourceId = str_replace(array("\t", "\n", "\r", "\f", "\v"), array( |
@@ -157,5 +157,5 @@ |
||
| 157 | 157 | * @return ITemplate|false|null |
| 158 | 158 | */ |
| 159 | 159 | public static function templateFactory(Core $core, $resourceId, $cacheTime = null, $cacheId = null, |
| 160 | - $compileId = null, ITemplate $parentTemplate = null); |
|
| 160 | + $compileId = null, ITemplate $parentTemplate = null); |
|
| 161 | 161 | } |
@@ -59,13 +59,13 @@ |
||
| 59 | 59 | define('DWOO_PATH', ROOT_PATH . "system/packages/com.jukusoft.cms.dwoo/dwoo/lib/"); |
| 60 | 60 | |
| 61 | 61 | function dwoo_autoload ($class_name) { |
| 62 | - $class_name = str_replace("\\", "/", $class_name); |
|
| 62 | + $class_name = str_replace("\\", "/", $class_name); |
|
| 63 | 63 | |
| 64 | - if (file_exists(DWOO_PATH . $class_name . ".php")) { |
|
| 65 | - require(DWOO_PATH . $class_name . ".php"); |
|
| 66 | - } else { |
|
| 67 | - echo "Cannot load class '" . $class_name . "'!"; |
|
| 68 | - } |
|
| 64 | + if (file_exists(DWOO_PATH . $class_name . ".php")) { |
|
| 65 | + require(DWOO_PATH . $class_name . ".php"); |
|
| 66 | + } else { |
|
| 67 | + echo "Cannot load class '" . $class_name . "'!"; |
|
| 68 | + } |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | //register autoloader |