@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | //reset OpCache in debug mode |
| 16 | 16 | if (CLEAR_OP_CACHE) { |
| 17 | - //http://php.net/manual/en/function.opcache-reset.php |
|
| 18 | - //http://php.net/manual/en/function.opcache-invalidate.php |
|
| 19 | - opcache_reset(); |
|
| 17 | + //http://php.net/manual/en/function.opcache-reset.php |
|
| 18 | + //http://php.net/manual/en/function.opcache-invalidate.php |
|
| 19 | + opcache_reset(); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | //throw event |
@@ -27,33 +27,33 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | //check, if redirect is enabled |
| 29 | 29 | if ($domain->isRedirectUrl()) { |
| 30 | - if ($domain->getRedirectCode() == 301) { |
|
| 31 | - header("HTTP/1.1 301 Moved Permanently"); |
|
| 32 | - } else if ($domain->getRedirectCode() == 302) { |
|
| 33 | - header("HTTP/1.1 302 Found"); |
|
| 34 | - } |
|
| 30 | + if ($domain->getRedirectCode() == 301) { |
|
| 31 | + header("HTTP/1.1 301 Moved Permanently"); |
|
| 32 | + } else if ($domain->getRedirectCode() == 302) { |
|
| 33 | + header("HTTP/1.1 302 Found"); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - header("Location: " + $domain->getRedirectUrl()); |
|
| 37 | - header("Connection: close"); |
|
| 36 | + header("Location: " + $domain->getRedirectUrl()); |
|
| 37 | + header("Connection: close"); |
|
| 38 | 38 | |
| 39 | - exit; |
|
| 39 | + exit; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | //check, if gzip compression is enabled |
| 43 | 43 | if (Settings::get("gzip_compression", false)) { |
| 44 | - //use gzip compression |
|
| 45 | - ob_start(); |
|
| 44 | + //use gzip compression |
|
| 45 | + ob_start(); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | //TODO: remove this code in production |
| 49 | 49 | if (isset($_REQUEST['clear_cache'])) { |
| 50 | - //clear cache |
|
| 51 | - Cache::clear(); |
|
| 50 | + //clear cache |
|
| 51 | + Cache::clear(); |
|
| 52 | 52 | |
| 53 | - //clear gettext cache |
|
| 54 | - PHPUtils::clearGetTextCache(); |
|
| 53 | + //clear gettext cache |
|
| 54 | + PHPUtils::clearGetTextCache(); |
|
| 55 | 55 | |
| 56 | - echo "Clear cache!<br />"; |
|
| 56 | + echo "Clear cache!<br />"; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | //create new instance of registry |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | //check, if user has folder permissions |
| 104 | 104 | if (!$folder->checkPermissions(PermissionChecker::current())) { |
| 105 | - //user dont has permissions to access folder |
|
| 106 | - $page->load("error403"); |
|
| 105 | + //user dont has permissions to access folder |
|
| 106 | + $page->load("error403"); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | //set folder |
@@ -115,12 +115,12 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | //check, if user has page permissions |
| 117 | 117 | if (!$page_type->checkPermissions(PermissionChecker::current())) { |
| 118 | - //user dont has custom permissions to access page |
|
| 119 | - $page->load("error403"); |
|
| 118 | + //user dont has custom permissions to access page |
|
| 119 | + $page->load("error403"); |
|
| 120 | 120 | |
| 121 | - //create page type |
|
| 122 | - $page_type = PageLoader::loadInstance($page->getPageType()); |
|
| 123 | - $page_type->setPage($page); |
|
| 121 | + //create page type |
|
| 122 | + $page_type = PageLoader::loadInstance($page->getPageType()); |
|
| 123 | + $page_type->setPage($page); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | //check page rights |
@@ -132,17 +132,17 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | //check, if page is not published |
| 134 | 134 | if (!$page->isPublished()) { |
| 135 | - //another permission is required, because page is not published yet |
|
| 136 | - $page_permission = "see_draft"; |
|
| 135 | + //another permission is required, because page is not published yet |
|
| 136 | + $page_permission = "see_draft"; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (!$page_rights->checkRights($user->getID(), $groups->listGroupIDs(), $page_permission)) { |
| 140 | - //user dont has custom permissions to access page |
|
| 141 | - $page->load("error403"); |
|
| 140 | + //user dont has custom permissions to access page |
|
| 141 | + $page->load("error403"); |
|
| 142 | 142 | |
| 143 | - //create page type |
|
| 144 | - $page_type = PageLoader::loadInstance($page->getPageType()); |
|
| 145 | - $page_type->setPage($page); |
|
| 143 | + //create page type |
|
| 144 | + $page_type = PageLoader::loadInstance($page->getPageType()); |
|
| 145 | + $page_type->setPage($page); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | $registry->storeObject("page", $page); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $redirect_url = urlencode(DomainUtils::getURL()); |
| 162 | 162 | |
| 163 | 163 | if (isset($_REQUEST['redirect_url']) && !empty($_REQUEST['redirect_url'])) { |
| 164 | - $redirect_url = $_REQUEST['redirect_url']; |
|
| 164 | + $redirect_url = $_REQUEST['redirect_url']; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $registry->setSetting("login_url", DomainUtils::getBaseURL() . "/" . Settings::get("login_page", "login") . "?action=login&redirect_url=" . $redirect_url); |
@@ -183,60 +183,60 @@ discard block |
||
| 183 | 183 | $registry->setSetting("footer", ""); |
| 184 | 184 | |
| 185 | 185 | Events::throwEvent("Show page", array( |
| 186 | - 'registry' => &$registry |
|
| 186 | + 'registry' => &$registry |
|
| 187 | 187 | )); |
| 188 | 188 | |
| 189 | 189 | //show page here |
| 190 | 190 | if ($page_type->showDesign()) { |
| 191 | - //show page with design |
|
| 192 | - StyleController::showPage($registry, $page, $page_type); |
|
| 191 | + //show page with design |
|
| 192 | + StyleController::showPage($registry, $page, $page_type); |
|
| 193 | 193 | } else { |
| 194 | - //only show content |
|
| 195 | - echo $page_type->getContent(); |
|
| 194 | + //only show content |
|
| 195 | + echo $page_type->getContent(); |
|
| 196 | 196 | |
| 197 | - if ($page_type->exitAfterOutput()) { |
|
| 198 | - //flush gzip cache |
|
| 199 | - ob_end_flush(); |
|
| 197 | + if ($page_type->exitAfterOutput()) { |
|
| 198 | + //flush gzip cache |
|
| 199 | + ob_end_flush(); |
|
| 200 | 200 | |
| 201 | - exit; |
|
| 202 | - } |
|
| 201 | + exit; |
|
| 202 | + } |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | $end_time = microtime(true); |
| 206 | 206 | $exec_time = $end_time - $start_time; |
| 207 | 207 | |
| 208 | 208 | if ($page_type->showHTMLComments()) { |
| 209 | - //benchmark code |
|
| 210 | - if (ACTIVATE_BENCHMARK) { |
|
| 211 | - echo "<!-- page was generated in " . $exec_time . " seconds -->\n"; |
|
| 212 | - echo "<!-- mobile detection executed in " . $mobile_detection_exec_time . " seconds, isMobile: " . ($registry->getSetting("isMobile") ? "true" : "false") . " -->\n"; |
|
| 213 | - |
|
| 214 | - //benchmark dwoo template engine |
|
| 215 | - foreach (DwooTemplate::listFileBenchmark() as $file=>$exec_time) { |
|
| 216 | - echo "<!-- Dwoo benchmark file '" . $file . "': " . $exec_time . " seconds -->\n"; |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - foreach (CSSBuilder::listBenchmarks() as $key=>$exec_time) { |
|
| 220 | - echo "<!-- css generation of file '" . $key . "': " . $exec_time . " seconds -->\n"; |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - foreach (JSBuilder::listBenchmarks() as $key=>$exec_time) { |
|
| 224 | - echo "<!-- js generation of file '" . $key . "': " . $exec_time . " seconds -->\n"; |
|
| 225 | - } |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - if (DEBUG_MODE) { |
|
| 229 | - echo "<!-- userID: " . User::current()->getID() . ", username: " . User::current()->getUsername() . " -->\n"; |
|
| 230 | - echo "<!-- " . Database::getInstance()->countQueries() . " sql queries executed -->\n"; |
|
| 231 | - echo "<!-- pref_lang: " . $registry->getSetting("pref_lang") . " -->\n"; |
|
| 232 | - echo "<!-- lang_token: " . $registry->getSetting("lang_token") . " -->\n"; |
|
| 233 | - |
|
| 234 | - if (DEBUG_SQL_QUERIES) { |
|
| 235 | - foreach (Database::getInstance()->listQueryHistory() as $query_array) { |
|
| 236 | - echo "<!-- query: " . $query_array['query'] . " -->\n"; |
|
| 237 | - } |
|
| 238 | - } |
|
| 239 | - } |
|
| 209 | + //benchmark code |
|
| 210 | + if (ACTIVATE_BENCHMARK) { |
|
| 211 | + echo "<!-- page was generated in " . $exec_time . " seconds -->\n"; |
|
| 212 | + echo "<!-- mobile detection executed in " . $mobile_detection_exec_time . " seconds, isMobile: " . ($registry->getSetting("isMobile") ? "true" : "false") . " -->\n"; |
|
| 213 | + |
|
| 214 | + //benchmark dwoo template engine |
|
| 215 | + foreach (DwooTemplate::listFileBenchmark() as $file=>$exec_time) { |
|
| 216 | + echo "<!-- Dwoo benchmark file '" . $file . "': " . $exec_time . " seconds -->\n"; |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + foreach (CSSBuilder::listBenchmarks() as $key=>$exec_time) { |
|
| 220 | + echo "<!-- css generation of file '" . $key . "': " . $exec_time . " seconds -->\n"; |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + foreach (JSBuilder::listBenchmarks() as $key=>$exec_time) { |
|
| 224 | + echo "<!-- js generation of file '" . $key . "': " . $exec_time . " seconds -->\n"; |
|
| 225 | + } |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + if (DEBUG_MODE) { |
|
| 229 | + echo "<!-- userID: " . User::current()->getID() . ", username: " . User::current()->getUsername() . " -->\n"; |
|
| 230 | + echo "<!-- " . Database::getInstance()->countQueries() . " sql queries executed -->\n"; |
|
| 231 | + echo "<!-- pref_lang: " . $registry->getSetting("pref_lang") . " -->\n"; |
|
| 232 | + echo "<!-- lang_token: " . $registry->getSetting("lang_token") . " -->\n"; |
|
| 233 | + |
|
| 234 | + if (DEBUG_SQL_QUERIES) { |
|
| 235 | + foreach (Database::getInstance()->listQueryHistory() as $query_array) { |
|
| 236 | + echo "<!-- query: " . $query_array['query'] . " -->\n"; |
|
| 237 | + } |
|
| 238 | + } |
|
| 239 | + } |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | //flush gzip cache |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | //execute tasks |
| 254 | 254 | if (!Settings::get("cronjon_enabled", true)) { |
| 255 | - Tasks::schedule(Settings::get("max_tasks_on_site", 3)); |
|
| 255 | + Tasks::schedule(Settings::get("max_tasks_on_site", 3)); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | ?> |
| 259 | 259 | \ No newline at end of file |