return ($this->type & $type) == $type;
}
- abstract protected function run(PlPage &$page, array $args);
+ abstract protected function run(PlPage $page, array $args);
- public function call(PlPage &$page, array $args)
+ public function call(PlPage $page, array $args)
{
global $globals, $session, $platal;
if (!$session->checkAuth($this->auth)) {
$this->callback = $callback;
}
- protected function run(PlPage &$page, array $args)
+ protected function run(PlPage $page, array $args)
{
global $session, $platal;
return empty($encodedPayload) ? array() : json_decode($encodedPayload, true);
}
- protected function run(PlPage &$page, array $args)
+ protected function run(PlPage $page, array $args)
{
$method = $_SERVER['REQUEST_METHOD'];
$encodedPayload = $this->getEncodedPayload($method);
$this->callback = $callback;
}
- protected function run(PlPage &$page, array $args)
+ protected function run(PlPage $page, array $args)
{
// Retrieve the user, either from the session (less expensive, as it is
// already there), or from the in-path (user, token) pair.
parent::__construct($auth, $perms, $type);
}
- protected function run(PlPage &$page, array $args)
+ protected function run(PlPage $page, array $args)
{
return PL_WIKI;
}
$nearest_sdx = 50;
$match = null;
foreach ($this->children as $path=>$hook) {
- $lev = levenshtein($next, $path);
- if ($lev <= $nearest_lev
- && ($lev < strlen($next) / 2 || strpos($next, $path) !== false
- || strpos($path, $next) !== false)) {
- $sdx = levenshtein(soundex($next), soundex($path));
- if ($lev == $nearest_lev || $sdx < $nearest_sdx) {
- $child = $hook;
- $nearest_lev = $lev;
- $nearest_sdx = $sdx;
- $match = $path;
+ if ($path) {
+ $lev = levenshtein($next, $path);
+ if ($lev <= $nearest_lev
+ && ($lev < strlen($next) / 2 || strpos($next, $path) !== false
+ || strpos($path, $next) !== false)) {
+ $sdx = levenshtein(soundex($next), soundex($path));
+ if ($lev == $nearest_lev || $sdx < $nearest_sdx) {
+ $child = $hook;
+ $nearest_lev = $lev;
+ $nearest_sdx = $sdx;
+ $match = $path;
+ }
}
}
}
return $url;
}
- private function call_hook(PlPage &$page)
+ private function call_hook(PlPage $page)
{
$hook = $this->find_hook();
if (empty($hook)) {
/** Show the authentication form.
*/
- abstract public function force_login(PlPage& $page);
+ abstract public function force_login(PlPage $page);
+
+ protected function report_error($error)
+ {
+ PlErrorReport::report($error);
+ }
public function run()
{
}
} catch (Exception $e) {
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
- PlErrorReport::report($e);
+ $this->report_error($e);
if (self::globals()->debug) {
$page->kill(pl_entities($e->getMessage())
. '<pre>' . pl_entities("" . $e) . '</pre>');