getPageType() public method

public getPageType ( )
Beispiel #1
0
 protected function fmt_image($ref, $width, $height)
 {
     if (!$width && !$height) {
         $width = Config::IMAGE_WIDTH;
         $height = Config::IMAGE_HEIGHT;
     }
     try {
         $page = new WikiPage($ref);
     } catch (Exception $e) {
         return $this->fmt_error('No such file: ' . $this->mklink($ref));
     }
     if ($page->getPageType() != WikiPage::TYPE_IMAGE) {
         return $this->fmt_error('Not an image: ' . $this->mklink($ref));
     }
     $url = $page->getURL();
     return "<div class=\"par image\"><a href=\"{$url}\"><img src=\"{$url}?action=image&amp;width={$width}&amp;height={$height}\" alt=\"{$page->getName()}\" /></a></div>";
 }
Beispiel #2
0
     }
     $view->display();
 } else {
     if ($special[0] == 'logout') {
         $stmt = $pdo->prepare('UPDATE ewiki_users SET "session" = NULL WHERE "user" = :user');
         $stmt->execute(array('user' => $user->user));
         $stmt->closeCursor();
         setcookie('session', '', 1, Config::PATH . '/');
         redirect(Config::PATH . '/');
     } else {
         if ($special === NULL) {
             $view->action = $action;
             $view->page = $page;
             if ($action == 'view') {
                 $view->setTemplate('page-view.php');
                 $type = $page->getPageType();
                 $view->type = $type;
                 if ($type == WikiPage::TYPE_TREE) {
                     /* FIXME: ignores current commit_id */
                     $entries = $page->listEntries();
                     usort($entries, create_function('$a, $b', 'return call_user_func(Config::TREE_VIEW_SORT, $a->getName(), $b->getName());'));
                     $view->entries = $entries;
                 } else {
                     if ($type == NULL) {
                         $view->has_history = !!count($page->getPageHistory());
                     }
                 }
                 $view->display();
             } else {
                 if ($action == 'history') {
                     $view->setTemplate('page-history.php');