Example #1
0
 /**
  * Constructor for base class.
  *
  * @param string $page_id
  * @param string $title
  * @param string $relative_url
  * @param constant $login_level see pdNavMenuItem.
  * @param boolean $useStdLayout
  */
 public function __construct($page_id, $title = null, $relative_url = null, $login_level = pdNavMenuItem::MENU_NEVER, $useStdLayout = true)
 {
     if (MAINTENANCE == 1) {
         echo 'PapersDB is under maintenance, please check back later';
         exit;
     }
     session_start();
     // start buffering output, it will be displayed in the toHtml() method
     ob_start();
     // initialize session variables
     if (get_class($this) != 'add_pub1' && get_class($this) != 'add_pub2' && get_class($this) != 'add_pub3' && get_class($this) != 'add_pub4' && get_class($this) != 'add_pub_submit' && get_class($this) != 'add_author' && get_class($this) != 'author_confirm' && get_class($this) != 'add_venue') {
         pubSessionInit();
     }
     // a derived page may already have needed access to the database prior
     // to invoking the base class constructor, so only create the database
     // object if not already set
     if (!is_object($this->db)) {
         $this->db = pdDb::defaultNew();
     }
     $this->check_login();
     $this->nav_menu = new pdNavMenu($this->access_level, $page_id);
     if (isset($page_id)) {
         $nav_item = $this->nav_menu->findPageId($page_id);
         if ($nav_item != null) {
             $this->page_id = $page_id;
             $this->page_title = $nav_item->page_title;
             $this->relative_url = $nav_item->url;
             $this->login_level = $nav_item->access_level;
         }
     }
     if (!isset($page_id) || $nav_item == null) {
         $this->page_title = $title;
         $this->relative_url = relativeUrlGet();
         $this->login_level = $login_level;
     }
     if ($relative_url != null) {
         $this->relative_url = $relative_url;
     }
     $this->redirectTimeout = 0;
     $this->table = null;
     $this->form = null;
     $this->renderer = null;
     $this->loginError = false;
     $this->pageError = false;
     $this->useStdLayout = $useStdLayout;
     $this->hasHelpTooltips = false;
     // ensure that the user is logged in if a page requires login access
     if (($this->login_level >= pdNavMenuItem::MENU_LOGIN_REQUIRED || strpos($this->relative_url, 'Admin/') !== false || strpos($this->relative_url, 'diag/') !== false) && $this->access_level < 1) {
         $this->loginError = true;
         return;
     }
 }
Example #2
0
<?php

/**
 * This script is meant to be called in response to an AJAX request.
 * 
 * It returns a listing of all the publication by a specified author. The
 * author is specified in the URL query string.
 */
require_once '../includes/defines.php';
require_once 'includes/functions.php';
require_once 'includes/htmlUtils.php';
require_once 'includes/pdDb.php';
require_once 'includes/pdAuthor.php';
if (!isset($_GET['author_id'])) {
    exit('script called with invalid arguments');
}
$db = pdDb::defaultNew();
$auth = new pdAuthor();
$auth->dbLoad($db, $_GET['author_id'], pdAuthor::DB_LOAD_PUBS_ALL | pdAuthor::DB_LOAD_INTERESTS);
if (!is_array($auth->pub_list)) {
    exit('Author with id ' . $_GET['author_id'] . ' does not have any publication entries in the database');
}
echo displayPubList($db, $auth->pub_list);