本文整理汇总了PHP中PHPWS_Core::errorPage方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Core::errorPage方法的具体用法?PHP PHPWS_Core::errorPage怎么用?PHP PHPWS_Core::errorPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_Core
的用法示例。
在下文中一共展示了PHPWS_Core::errorPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
public function main()
{
$auth = Current_User::getAuthorization();
if (!Current_User::isLogged() || !$auth->local_user) {
PHPWS_Core::errorPage('403');
}
$result = $this->init();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
Layout::add(PHPWS_ControlPanel::display(dgettext('users', 'The is a problem with My Page.')));
return;
} elseif (!$result) {
Layout::add(PHPWS_ControlPanel::display(dgettext('users', 'No modules are registered to My Page.')));
return;
}
$panel = My_Page::cpanel();
$module = $panel->getCurrentTab();
if (!$this->moduleIsRegistered($module)) {
Layout::add(dgettext('users', 'This module is not registered with My Page'));
return;
}
$content = My_Page::userOption($module);
if (PHPWS_Error::isError($content)) {
$content = $content->getMessage();
}
Layout::add(PHPWS_ControlPanel::display($content));
}
示例2: loadTabs
public static function loadTabs()
{
$tabs = PHPWS_ControlPanel::getAllTabs();
if (PHPWS_Error::isError($tabs)) {
PHPWS_Error::log($tabs);
PHPWS_Core::errorPage();
}
return $tabs;
}
示例3: admin
//.........这里部分代码省略.........
$this->page->loadTemplate();
$this->page->loadSections(true);
$this->killSaved($this->page->id);
$this->forms->editPage();
break;
case 'delete_page':
if (!Current_User::authorized('pagesmith', 'delete_page')) {
Current_User::disallow();
}
$this->loadPage();
$this->page->delete();
PHPWS_Cache::clearCache();
$this->loadForms();
$this->forms->pageList();
break;
case 'edit_page_header':
$this->loadPage();
$this->loadForms();
$this->forms->editPageHeader();
$javascript = true;
break;
case 'delete_section':
$this->deleteSection($_GET['sec_id']);
exit;
break;
case 'post_header':
$this->postHeader();
break;
case 'post_text':
$this->postText();
break;
case 'post_page':
$result = $this->postPage();
switch ($result) {
case -1:
$this->loadForms();
$this->page->loadSections(true);
$this->forms->editPage();
break;
case 0:
$this->message = dgettext('pagesmith', 'Not enough content to create a page.');
$this->loadForms();
$this->page->loadSections(true);
$this->forms->editPage();
break;
case 1:
$this->killSaved($this->page->id);
PHPWS_Cache::clearCache();
PHPWS_Core::reroute($this->page->url());
break;
}
break;
case 'front_page_toggle':
$db = \Database::newDB();
$db->addTable('ps_page')->addValue('front_page', 0);
$db->update();
$this->loadPage();
$this->page->front_page = (bool) $_GET['fp'];
$this->page->save();
PHPWS_Cache::clearCache();
$this->removeFromMenu();
$this->loadForms();
$this->forms->pageList();
break;
case 'shorten_links':
if (!Current_User::authorized('pagesmith', 'settings', null, null, true)) {
Current_User::disallow();
}
$this->shortenLinks();
PHPWS_Core::goBack();
break;
case 'lengthen_links':
if (!Current_User::authorized('pagesmith', 'settings', null, null, true)) {
Current_User::disallow();
}
$this->lengthenLinks();
PHPWS_Core::goBack();
break;
case 'post_settings':
if (!Current_User::authorized('pagesmith', 'settings', null, null, true)) {
Current_User::disallow();
}
$this->postSettings();
$this->message = dgettext('pagesmith', 'Settings saved');
$this->loadForms();
$this->forms->settings();
break;
default:
PHPWS_Core::errorPage('404');
break;
}
if ($javascript) {
$tpl['TITLE'] = $this->title;
$tpl['CONTENT'] = $this->content;
$tpl['MESSAGE'] = $this->message;
Layout::nakedDisplay(PHPWS_Template::process($tpl, 'pagesmith', 'admin_main.tpl'));
} else {
Layout::add(PHPWS_ControlPanel::display($this->panel->display($this->content, $this->title, $this->message)));
}
}
示例4: view
/**
* Displays the blog entry
*
* @param boolean edit If true, show edit link
* @param boolean summarized If true, this is a summarized entry
*/
public function view($edit = true, $summarized = true)
{
if (!$this->id) {
PHPWS_Core::errorPage(404);
}
$key = new Key($this->key_id);
if (!$key->allowView() || !Blog_User::allowView()) {
Current_User::requireLogin();
return dgettext('blog', 'You do not have permission to view this entry.');
}
$template['TITLE'] = sprintf('<a href="%s" rel="bookmark">%s</a>', $this->getViewLink(true), $this->title);
$template['TITLE_NO_LINK'] = $this->title;
if ($this->publish_date > time()) {
$template['UNPUBLISHED'] = dgettext('blog', 'Unpublished');
} elseif ($this->expire_date && $this->expire_date < time()) {
$template['UNPUBLISHED'] = dgettext('blog', 'Expired');
}
$template['LOCAL_DATE'] = $this->getPublishDate();
$summary = $this->getSummary(true);
$entry = $this->getEntry(true);
if ($summarized) {
if (empty($summary)) {
$template['SUMMARY'] = PHPWS_Text::parseTag($entry);
} else {
if (!empty($entry)) {
$template['READ_MORE'] = PHPWS_Text::rewriteLink(Icon::get('chevron-circle-down') . ' ' . dgettext('blog', 'Read more'), 'blog', array('id' => $this->id), null, 'Read more of this entry', 'btn btn-default');
}
$template['SUMMARY'] = PHPWS_Text::parseTag($summary);
}
} else {
$template['SUMMARY'] = PHPWS_Text::parseTag($summary);
$template['ENTRY'] = PHPWS_Text::parseTag($entry);
}
$template['IMAGE'] = $this->getFile($this->thumbnail && $summarized);
if ($edit && (Current_User::allow('blog', 'edit_blog', $this->id, 'entry') || Current_User::allow('blog', 'edit_blog') && $this->author_id == Current_User::getId())) {
$vars['blog_id'] = $this->id;
$vars['action'] = 'admin';
$vars['command'] = 'edit';
$template['EDIT_LINK'] = PHPWS_Text::secureLink(dgettext('blog', 'Edit'), 'blog', $vars);
$template['EDIT_URI'] = PHPWS_Text::linkAddress('blog', $vars, true);
if (!$summarized) {
MiniAdmin::add('blog', array(PHPWS_Text::secureLink(dgettext('blog', 'Edit blog'), 'blog', $vars)));
}
}
// Check setting for showing when the entry was posted
if (PHPWS_Settings::get('blog', 'show_posted_by')) {
$template['POSTED_BY'] = dgettext('blog', 'By');
$template['AUTHOR'] = $this->author;
}
// Check settings for showing the author of the entry
if (PHPWS_Settings::get('blog', 'show_posted_date')) {
$template['PUBLISHED'] = dgettext('blog', 'Published');
$template['POSTED_ON'] = dgettext('blog', 'Posted on');
$template['PUBLISHED_DATE'] = $this->getPublishDateShort();
}
if ($summarized) {
$view_tpl = 'view_list.tpl';
} else {
$template['COMMENT_SCRIPT'] = PHPWS_Settings::get('blog', 'comment_script');
$key->flag();
$view_tpl = 'view_full.tpl';
}
return PHPWS_Template::process($template, 'blog', $view_tpl);
}
示例5: loadTheme
/**
* Inserts the content data into the current theme
*/
public static function loadTheme($theme, $template)
{
$tpl = new PHPWS_Template();
$tpl->setRoot(PHPWS_SOURCE_DIR);
$themeDir = Layout::getThemeDir();
if (PHPWS_Error::isError($themeDir)) {
PHPWS_Error::log($themeDir);
PHPWS_Core::errorPage();
}
$result = $tpl->setFile($themeDir . 'theme.tpl', TRUE);
if (PHPWS_Error::isError($result)) {
return $result;
}
if (!empty($GLOBALS['Layout_Collapse'])) {
$template['COLLAPSE'] = 'id="layout-collapse"';
}
$template['THEME_DIRECTORY'] = Layout::getThemeDirRoot() . $theme . '/';
$template['THEME_HTTP'] = Layout::getThemeHttpRoot() . $theme . '/';
$template['SOURCE_THEME_HTTP'] = PHPWS_SOURCE_HTTP . 'themes/';
$template['SOURCE_THEME_DIR'] = PHPWS_SOURCE_DIR . 'themes/';
$tpl->setData($template);
return $tpl;
}
示例6: view
/**
* Pathing for which view to display
*/
public function view()
{
require_once PHPWS_SOURCE_DIR . 'mod/calendar/class/Event.php';
$key = new Key($this->calendar->schedule->key_id);
if (!$key->allowView()) {
$this->calendar->loadDefaultSchedule();
}
$schedule_key = $this->calendar->schedule->getKey();
if (!$this->calendar->schedule->public && !$schedule_key->allowView()) {
PHPWS_Core::errorPage('403');
}
\Layout::disableRobots();
$current_date = $this->calendar->current_date * 1000;
switch ($this->current_view) {
case 'day':
$this->content = $this->day();
break;
case 'grid':
if (ALLOW_CACHE_LITE && Current_User::allow('calendar')) {
if (strftime('%Y%m', $this->calendar->today) == strftime('%Y%m', $this->calendar->current_date)) {
$current_date = $this->calendar->today * 1000;
}
$this->resetCacheLink('grid', $this->calendar->int_month, $this->calendar->int_year, $this->calendar->schedule->id);
}
$this->content = $this->month_grid();
break;
case 'list':
if (ALLOW_CACHE_LITE && Current_User::allow('calendar')) {
$this->resetCacheLink('list', $this->calendar->int_month, $this->calendar->int_year, $this->calendar->schedule->id);
}
$this->content = $this->month_list();
break;
case 'week':
$this->content = $this->week();
break;
case 'event':
if (isset($_REQUEST['page'])) {
$event_id = (int) $_REQUEST['page'];
} elseif (isset($_REQUEST['event_id'])) {
$event_id = $_REQUEST['event_id'];
} else {
$this->content = $this->day();
}
if (!$this->loadEvent($event_id) || !$this->event->id) {
$this->content = $this->day();
break;
}
if (isset($_REQUEST['js'])) {
$this->content = $this->event(true);
Layout::nakedDisplay($this->content);
return;
} else {
$this->content = $this->event();
}
break;
default:
$this->content = dgettext('calendar', 'Incorrect option');
break;
}
if ($this->calendar->schedule->checkPermissions()) {
if ($this->calendar->schedule->id) {
require_once PHPWS_SOURCE_DIR . 'mod/calendar/class/Admin.php';
$event = new Calendar_Event(0, $this->calendar->schedule);
Layout::add(\Calendar_Admin::eventModal($event));
\Calendar_Admin::includeEventJS();
$link = '<a style="cursor:pointer" class="add-event" data-schedule-id="' . $this->calendar->schedule->id . '" data-date="' . $current_date * 1000 . '">Add event</a>';
MiniAdmin::add('calendar', $link);
MiniAdmin::add('calendar', $this->calendar->schedule->uploadEventsLink());
}
}
if ($this->current_view == 'event') {
$this->event->flagKey();
} else {
$schedule_key->flag();
}
}
示例7: _accessDenied
/**
* Called when a user tries to access functionality he/she has no permission to access
*
* @access private
*/
function _accessDenied()
{
PHPWS_Core::errorPage('400');
}
示例8:
<?php
/**
* Description
* @author Jeff Tickle <jtickle at tux dot appstate dot edu>
*/
// If no one else has set $_REQUEST['module'] by this point and Core wants us to
// forward, 404.
if (isset($GLOBALS['Forward']) && !array_key_exists('module', $_REQUEST)) {
PHPWS_Core::errorPage(404);
}
示例9: loadDB
/**
* Loads a connection
*
* @param string $dsn
* @param string $tbl_prefix
* @param boolean $force_reconnect
* @param boolean $show_error
* @return boolean
*/
public static function loadDB($dsn = null, $tbl_prefix = null, $force_reconnect = false, $show_error = true)
{
if (!isset($dsn)) {
if (!defined('PHPWS_DSN')) {
exit(_('Cannot load database. DSN not defined.'));
}
$dsn = PHPWS_DSN;
if (defined('PHPWS_TABLE_PREFIX')) {
$tbl_prefix = PHPWS_TABLE_PREFIX;
}
}
/**
* if $dsn is already set and force_reconnect is false, don't bother on a reconnect
*/
if (isset($GLOBALS['PHPWS_DB']['dsn']) && $GLOBALS['PHPWS_DB']['dsn'] == $dsn && !$force_reconnect) {
return;
}
if (isset($GLOBALS['PHPWS_DB']['connection'])) {
$GLOBALS['PHPWS_DB']['connection']->disconnect();
}
$dbname = PHPWS_DB::getDbName($dsn);
$pear_db = new MDB2();
$connect = $pear_db->connect($dsn, array('persistent' => false));
if (PHPWS_Error::isError($connect)) {
if (CLEAR_DSN) {
$connect->userinfo = str_replace($dsn, '-- DSN removed --', $connect->userinfo);
}
PHPWS_Error::log($connect);
if ($show_error) {
PHPWS_Core::errorPage();
} else {
return $connect;
}
}
PHPWS_DB::logDB(sprintf(_('Connected to database "%s"'), $dbname));
// Load the factory files
$type = $connect->dbsyntax;
$result = PHPWS_Core::initCoreClass('DB/' . $type . '.php');
if ($result == false) {
PHPWS_DB::logDB(_('Failed to connect.'));
PHPWS_Error::log(PHPWS_FILE_NOT_FOUND, 'core', 'PHPWS_DB::loadDB', PHPWS_SOURCE_DIR . 'core/class/DB/' . $type . '.php');
PHPWS_Core::errorPage();
}
$class_name = $type . '_PHPWS_SQL';
$dblib = new $class_name();
if (!empty($dblib->portability)) {
$connect->setOption('portability', $dblib->portability);
}
$connect->setOption('seqcol_name', 'id');
$GLOBALS['PHPWS_DB']['lib'] = $dblib;
$GLOBALS['PHPWS_DB']['dsn'] = $dsn;
$GLOBALS['PHPWS_DB']['connection'] = $connect;
$GLOBALS['PHPWS_DB']['tbl_prefix'] = $tbl_prefix;
$GLOBALS['PHPWS_DB']['type'] = $type;
return true;
}
示例10: post
public function post()
{
\PHPWS_Core::errorPage('404');
}
示例11: main
public static function main()
{
if (isset($_REQUEST['blog_id'])) {
$blog = new Blog((int) $_REQUEST['blog_id']);
} elseif (isset($_REQUEST['id'])) {
$blog = new Blog((int) $_REQUEST['id']);
} else {
$blog = new Blog();
}
if (!isset($_REQUEST['action'])) {
if ($blog->id) {
$action = 'view_comments';
} else {
$action = 'view';
}
} else {
$action = $_REQUEST['action'];
}
switch ($action) {
case 'view_comments':
Layout::addStyle('blog');
Layout::addPageTitle($blog->title);
if (Current_User::allow('blog', 'edit_blog')) {
Blog_User::miniAdminList();
}
if ($blog->publish_date > time() && !Current_User::allow('blog')) {
PHPWS_Core::errorPage('404');
} else {
$content = $blog->view(true, false);
}
break;
case 'view':
if (isset($_GET['y'])) {
$day = 1;
$month = 1;
$year = $_GET['y'];
if (isset($_GET['m'])) {
$month = $_GET['m'];
if (isset($_GET['d'])) {
$day = $_GET['d'];
$start_date = mktime(0, 0, 0, $month, $day, $year);
$end_date = mktime(23, 59, 59, $month, $day, $year);
} else {
$start_day = 1;
$end_day = (int) date('t', mktime(0, 0, 0, $month, 1, $year));
$start_date = mktime(0, 0, 0, $month, 1, $year);
$end_date = mktime(0, 0, 0, $month, $end_day, $year);
}
} else {
$start_date = mktime(0, 0, 0, 1, 1, $year);
$end_date = mktime(0, 0, 0, 12, 31, $year);
}
} else {
$start_date = null;
$end_date = null;
}
$content = Blog_User::show($start_date, $end_date);
Layout::add($content, 'blog', 'view', true);
return;
break;
case 'submit':
if (Current_User::allow('blog', 'edit_blog')) {
PHPWS_Core::reroute(PHPWS_Text::linkAddress('blog', array('action' => 'admin', 'tab' => 'new'), 1));
} else {
PHPWS_Core::errorPage(403);
}
break;
default:
PHPWS_Core::errorPage(404);
break;
}
Layout::add($content);
}
示例12: disallow
public static function disallow($message = null)
{
if (!isset($message)) {
$message = dgettext('users', 'Improper permission level for action requested.');
}
Security::log($message);
PHPWS_Core::errorPage('403');
}
示例13: confirmUser
public function confirmUser()
{
$hash = $_GET['hash'];
if (preg_match('/\\W/', $hash)) {
Security::log(sprintf(dgettext('users', 'User tried to send bad hash (%s) to confirm user.'), $hash));
PHPWS_Core::errorPage('400');
}
$db = new PHPWS_DB('users_signup');
$db->addWhere('authkey', $hash);
$row = $db->select('row');
if (PHPWS_Error::logIfError($row)) {
return false;
} elseif (empty($row)) {
return false;
} else {
$user_id =& $row['user_id'];
$user = new PHPWS_User($user_id);
// If the deadline has not yet passed, approve the user, save, and return true
if ($row['deadline'] > time()) {
$db->delete();
$user->approved = 1;
if (PHPWS_Error::logIfError($user->save())) {
return false;
} else {
User_Action::assignDefaultGroup($user);
return true;
}
} else {
// If the deadline has passed, delete the user and return false.
$user->delete();
return false;
}
}
}
示例14: process
public function process()
{
if (!Current_User::allow('checkin')) {
Current_User::disallow();
}
if (isset($_REQUEST['aop'])) {
if ($_REQUEST['aop'] == 'switch') {
if (Current_User::allow('checkin', 'settings')) {
$cmd = 'settings';
} elseif (Current_User::allow('checkin', 'assign_visitors')) {
$cmd = 'assign';
} else {
$cmd = 'waiting';
}
} else {
$cmd = $_REQUEST['aop'];
}
} elseif ($_REQUEST['tab']) {
$cmd = $_REQUEST['tab'];
} else {
PHPWS_Core::errorPage('404');
}
$js = false;
$js = isset($_GET['print']);
switch ($cmd) {
case 'finish_meeting':
$this->finishMeeting();
PHPWS_Core::goBack();
break;
case 'start_meeting':
$this->startMeeting();
PHPWS_Core::goBack();
break;
case 'sendback':
$this->sendBack();
PHPWS_Core::goBack();
break;
case 'unavailable':
$this->unavailable();
PHPWS_Core::goBack();
break;
case 'available':
$this->available();
PHPWS_Core::goBack();
break;
case 'report':
if (!PHPWS_Settings::get('checkin', 'staff_see_reports') && !Current_User::allow('checkin', 'assign_visitors')) {
Current_User::disallow();
}
if (isset($_GET['daily_report'])) {
$this->dailyReport(isset($_GET['print']));
} elseif (isset($_GET['summary_report'])) {
$this->summaryReport();
} else {
$this->report();
}
//$this->report2();
break;
case 'daily_report':
if (!PHPWS_Settings::get('checkin', 'staff_see_reports') && !Current_User::allow('checkin', 'assign_visitors')) {
Current_User::disallow();
}
break;
case 'month_report':
if (!Current_User::allow('checkin', 'assign_visitors')) {
Current_User::disallow();
}
$this->monthReport(isset($_GET['print']));
break;
case 'visitor_report':
if (!Current_User::allow('checkin', 'assign_visitors')) {
Current_User::disallow();
}
$this->visitorReport(isset($_GET['print']));
break;
case 'reassign':
// Called via ajax
if (Current_User::authorized('checkin', 'assign_visitors')) {
if (isset($_GET['staff_id']) && $_GET['staff_id'] >= 0 && isset($_GET['visitor_id'])) {
$this->loadVisitor($_GET['visitor_id']);
$staff_id = $this->visitor->assigned;
$db = new PHPWS_DB('checkin_visitor');
$db->addValue('assigned', (int) $_GET['staff_id']);
$db->addWhere('id', (int) $_GET['visitor_id']);
PHPWS_Error::logIfError($db->update());
printf('staff_id %s, visitor_id %s', $_GET['staff_id'], $_GET['visitor_id']);
$this->loadStaff($staff_id);
/*
if ($this->staff->status == 3) {
$this->staff->status = 0;
$this->staff->save();
}
*/
}
}
exit;
break;
case 'move_up':
if (Current_User::allow('checkin', 'assign_visitors')) {
$db = new PHPWS_DB('checkin_staff');
//.........这里部分代码省略.........
示例15: userMenu
public function userMenu($action = null)
{
$javascript = false;
if (empty($action)) {
if (!isset($_REQUEST['uop'])) {
PHPWS_Core::errorPage('404');
}
$action = $_REQUEST['uop'];
}
switch ($action) {
case 'message':
$this->loadMessage();
if (empty($this->message)) {
PHPWS_Core::home();
}
$this->title = dgettext('signup', 'Signup');
break;
case 'signup_sheet':
$this->loadPeep();
$this->loadForm('user_signup');
break;
case 'slot_signup':
if ($this->postPeep()) {
if ($this->saveUnregistered()) {
$this->forwardMessage(dgettext('signup', 'You should receive an email allowing you to verify your application.<br />You have one hour to confirm your application.'), dgettext('signup', 'Thank you'));
$this->sendMessage();
} else {
$this->loadForm('user_signup');
}
} else {
$this->loadForm('user_signup');
}
break;
case 'confirm':
$this->confirmPeep();
$this->purgeOverdue();
break;
}
$tpl['TITLE'] = $this->title;
$tpl['MESSAGE'] = $this->message;
$tpl['CONTENT'] = $this->content;
if ($javascript) {
Layout::nakedDisplay(PHPWS_Template::process($tpl, 'signup', 'usermain.tpl'));
} else {
Layout::add(PHPWS_Template::process($tpl, 'signup', 'usermain.tpl'));
}
}