public function handle($what) { $f = 'handle' . ucFirst(str_replace(['-', '_'], '', $what)); if (!$what || !method_exists($this, $f)) { return null; } Util::sendNoCacheHeader(); return $this->{$f}(); }
public function display($override = '') { // Heisenbug: IE11 and FF32 will sometimes (under unknown circumstances) cache 302 redirects and stop // re-requesting them from the server but load them from local cache, thus breaking menu features. Util::sendNoCacheHeader(); if (isset($this->tabId)) { $this->pageTemplate['activeTab'] = $this->tabId; } if ($override) { $this->addAnnouncements(); include 'template/pages/' . $override . '.tpl.php'; die; } else { if ($this->tpl) { $this->prepareContent(); if (!$this->isSaneInclude('template/pages/', $this->tpl)) { die(User::isInGroup(U_GROUP_EMPLOYEE) ? 'Error: nonexistant template requested: template/pages/' . $this->tpl . '.tpl.php' : null); } $this->addAnnouncements(); include 'template/pages/' . $this->tpl . '.tpl.php'; die; } else { $this->error(); } } }
// lossless cookies and user settings case 'contactus': case 'comment': // case 'filter': // just a note: this would be accessed from filtrable pages as ?filter=typeStr (with POST-data) and forwards back to page with GET-data .. why? Hell if i know.. // case 'filter': // just a note: this would be accessed from filtrable pages as ?filter=typeStr (with POST-data) and forwards back to page with GET-data .. why? Hell if i know.. case 'go-to-comment': // find page the comment is on and forward // find page the comment is on and forward case 'locale': // subdomain-workaround, change the language $cleanName = str_replace(['-', '_'], '', ucFirst($altClass ?: $pageCall)); try { $class = 'Ajax' . $cleanName; $ajax = new $class(explode('.', $pageParam)); if ($ajax->handle($out)) { Util::sendNoCacheHeader(); if ($ajax->doRedirect) { header('Location: ' . $out, true, 302); } else { header('Content-type: ' . $ajax->getContentType()); die($out); } } else { throw new Exception('not handled as ajax'); } } catch (Exception $e) { $class = $cleanName . 'Page'; (new $class($pageCall, $pageParam))->display(); } break; /* other pages */