/** * 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; } }
public function __construct() { parent::__construct(null, 'Publication Submitted', 'Admin/add_pub_submit.php', pdNavMenuItem::MENU_NEVER); if ($this->loginError) { return; } if (!isset($_SESSION['state']) || $_SESSION['state'] != 'pub_add') { $this->pageError = true; return; } $pub =& $_SESSION['pub']; $user =& $_SESSION['user']; if ($pub->pub_id != null) { echo 'The following PapersDB entry has been modified:<p/>'; } else { echo 'The following PapersDB entry has been added to the database:<p/>'; } $pub->submit = $user->name; $pub->dbSave($this->db); // deal with paper if (isset($_SESSION['paper'])) { if ($_SESSION['paper'] != 'none') { $pub->paperSave($this->db, $_SESSION['paper']); } else { $pub->deletePaper($this->db); } } if (isset($_SESSION['attachments']) && count($_SESSION['attachments']) > 0) { for ($i = 0, $n = count($_SESSION['attachments']); $i < $n; $i++) { assert('isset($_SESSION["att_types"][$i])'); $pub->attSave($this->db, $_SESSION['attachments'][$i], $_SESSION['att_types'][$i]); } } if (isset($_SESSION['removed_atts']) && count($_SESSION['removed_atts']) > 0) { foreach ($_SESSION['removed_atts'] as $filename) { $pub->deleteAttByFilename($this->db, $filename); } } if ($this->debug) { debugVar('$pub', $pub); } // does pub entry require validation? if ($pub->validationRequired($this->db) && $user->isAdministrator()) { $pub->markValid($this->db); } else { $pub->markPending($this->db); } echo $pub->getCitationHtml(), getPubIcons($this->db, $pub, 0xf, '../'); pubSessionInit(); }