本文整理汇总了PHP中error::show404方法的典型用法代码示例。如果您正苦于以下问题:PHP error::show404方法的具体用法?PHP error::show404怎么用?PHP error::show404使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类error
的用法示例。
在下文中一共展示了error::show404方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete()
{
// Get URI vars
$slugID = urldecode(utf8::trim(uri::segment(4)));
// Do we have a slug ID?
if ($slugID == '') {
error::show404();
}
// Get user
if (!($user = $this->users_model->getUser($slugID)) || !$user['active'] || !$user['verified']) {
error::show404();
} elseif ($user['user_id'] == session::item('user_id')) {
router::redirect($user['slug']);
}
// Does user exist?
if (!($blocked = $this->users_blocked_model->getUser($user['user_id'], true))) {
view::setError(__('no_blocked_user', 'users_blocked'));
router::redirect('users/blocked');
}
// Delete blocked user
$this->users_blocked_model->deleteBlockedUser(session::item('user_id'), $user['user_id']);
// Success
view::setInfo(__('user_unblocked', 'users_blocked'));
router::redirect(input::get('page') ? 'users/blocked' : $user['slug']);
}
示例2: view
public function view()
{
// Get URI vars
$newsID = (int) uri::segment(3);
// Get news entry
if (!$newsID || !($news = $this->news_model->getEntry($newsID, 'in_view')) || !$news['active']) {
error::show404();
}
// Do we have views enabled?
if (config::item('news_views', 'news')) {
// Update views counter
$this->news_model->updateViews($newsID);
}
// Load ratings
if (config::item('news_rating', 'news') == 'stars') {
// Load votes model
loader::model('comments/votes');
// Get votes
$news['user_vote'] = $this->votes_model->getVote('news', $newsID);
} elseif (config::item('news_rating', 'news') == 'likes') {
// Load likes model
loader::model('comments/likes');
// Get likes
$news['user_vote'] = $this->likes_model->getLike('news', $newsID);
}
// Assign vars
view::assign(array('newsID' => $newsID, 'news' => $news));
// Set title
view::setTitle($news['data_title']);
// Set meta tags
view::setMetaDescription($news['data_meta_description']);
view::setMetaKeywords($news['data_meta_keywords']);
// Load view
view::load('news/view');
}
示例3: __construct
public function __construct()
{
parent::__construct();
if (!config::item('timeline_active', 'timeline') || !users_helper::isLoggedin()) {
error::show404();
}
loader::model('timeline/notices', array(), 'timeline_notices_model');
}
示例4: __construct
public function __construct()
{
parent::__construct();
if (!config::item('feedback_active', 'feedback')) {
error::show404();
} elseif (!session::permission('feedback_access', 'feedback')) {
view::noAccess();
}
loader::model('feedback/feedback');
}
示例5: __construct
public function __construct()
{
parent::__construct();
if (!config::item('reports_active', 'reports')) {
error::show404();
} elseif (!users_helper::isLoggedin()) {
router::redirect('users/login');
}
loader::model('reports/reports');
loader::model('reports/subjects', array(), 'reports_subjects_model');
}
示例6: __construct
public function __construct()
{
parent::__construct();
// Is user loggedin ?
if (!users_helper::isLoggedin()) {
router::redirect('users/login');
} elseif (!config::item('visitors_active', 'users')) {
error::show404();
}
loader::model('users/visitors', array(), 'users_visitors_model');
}
示例7: user
public function user()
{
// Get URI vars
$slugID = urldecode(utf8::trim(uri::segment(3)));
// Do we have a slug ID?
if ($slugID == '') {
error::show404();
}
// Is this our own account?
if (strcasecmp($slugID, session::item('slug_id')) == 0) {
$this->manage();
return;
}
// Get user
if (!($user = $this->users_model->getUser($slugID)) || !$user['active'] || !$user['verified']) {
error::show404();
}
// Does user have permission to view this user group/type and browse albums?
if (!in_array($user['group_id'], session::permission('users_groups_browse', 'users')) || !in_array($user['type_id'], session::permission('users_types_browse', 'users')) || !session::permission('albums_browse', 'pictures')) {
view::noAccess();
} elseif (!$this->users_model->getPrivacyAccess($user['user_id'], isset($user['config']['privacy_profile']) ? $user['config']['privacy_profile'] : 1)) {
view::noAccess($user['slug']);
}
// Parameters
$params = array('join_columns' => array('`a`.`user_id`=' . $user['user_id']), 'join_items' => array(), 'privacy' => $user['user_id'], 'select_users' => false);
// Process filters
$params = $this->parseCounters($params, 'user');
// Process query string
$qstring = $this->parseQuerystring(config::item('user_albums_per_page', 'pictures'), $params['max']);
// Get albums
$albums = array();
if ($params['total']) {
$albums = $this->pictures_albums_model->getAlbums('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit'], $params);
}
// Set pagination
$config = array('base_url' => config::siteURL('pictures/user/' . $user['slug_id'] . '?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => $params['max'], 'items_per_page' => config::item('user_albums_per_page', 'pictures'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('slugID' => $slugID, 'user' => $user, 'albums' => $albums, 'pagination' => $pagination));
// Set meta tags
$this->metatags_model->set('pictures', 'albums_user', array('user' => $user));
// Set title
view::setTitle(__('pictures_albums', 'system_navigation'), false);
// Set trail
view::setTrail($user['slug'], $user['name']);
view::setTrail('pictures/user/' . $user['slug_id'], __('pictures_albums', 'system_navigation'));
// Assign actions
if (session::permission('albums_search', 'pictures') && ($params['total'] || input::post_get('do_search'))) {
view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#albums-search\').toggle();return false;'));
}
// Load view
view::load('pictures/albums/user');
}
示例8: css
public function css()
{
// echo 123;
// exit;
$template = strtolower(uri::segment(3));
if ($template != 'cp' && !in_array($template, config::item('templates', 'core', 'keywords'))) {
error::show404();
}
$output = $this->getStylesheets($template, $template == 'cp' ? true : false);
codebreeder::setHeader('Content-Type: text/css');
echo $output;
exit;
}
示例9: __construct
public function __construct()
{
parent::__construct();
if (!config::item('messages_active', 'messages')) {
error::show404();
} elseif (!users_helper::isLoggedin()) {
router::redirect('users/login');
} elseif (!session::permission('messages_access', 'messages')) {
view::noAccess();
}
// Set trail
view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
view::setTrail('messages/manage', __('messages', 'system_navigation'));
loader::model('messages/messages');
}
示例10: notifications
public function notifications()
{
if (!config::item('notifications_edit', 'users')) {
error::show404();
}
// Create notifications settings
$settings = array('general' => array('name' => __('options_general', 'users_notifications'), 'keyword' => 'general', 'type' => 'checkbox', 'items' => array(), 'value' => array()));
// Filter hook
$settings = hook::filter('users/settings/notifications/options', $settings);
// Assign vars
view::assign(array('settings' => $settings));
// Process form values
if (input::post('do_save_notifications')) {
$this->_saveNotifications($settings);
}
// Set title
view::setTitle(__('notifications', 'users'));
// Load view
view::load('users/settings/notifications');
}
示例11: view
public function view()
{
// Get URI vars
$adID = (int) uri::segment(3);
// Get ad
if (!$adID || !($ad = $this->classifieds_model->getAd($adID, 'in_view')) || !$ad['active'] && $ad['user_id'] != session::item('user_id')) {
error::show404();
}
// Is this our own ad?
if ($ad['user_id'] == session::item('user_id')) {
// Assign user from session to variable
$user = session::section('session');
} else {
// Get user
if (!($user = $this->users_model->getUser($ad['user_id'])) || !$user['active'] || !$user['verified']) {
error::show404();
}
// Does user have permission to view this user group/type and view ads?
if (!in_array($user['group_id'], session::permission('users_groups_browse', 'users')) || !in_array($user['type_id'], session::permission('users_types_browse', 'users')) || !session::permission('ads_view', 'classifieds')) {
view::noAccess();
}
}
// Do we have views enabled?
if (config::item('ad_views', 'classifieds')) {
// Update views counter
$this->classifieds_model->updateViews($adID);
}
// Get fields
$fields = $this->fields_model->getFields('classifieds', 0, 'view', 'in_view');
// Load ratings
if (config::item('ad_rating', 'classifieds') == 'stars') {
// Load votes model
loader::model('comments/votes');
// Get votes
$ad['user_vote'] = $this->votes_model->getVote('classified_ad', $adID);
} elseif (config::item('ad_rating', 'classifieds') == 'likes') {
// Load likes model
loader::model('comments/likes');
// Get likes
$ad['user_vote'] = $this->likes_model->getLike('classified_ad', $adID);
}
// Assign vars
view::assign(array('adID' => $adID, 'ad' => $ad, 'user' => $user));
// Set meta tags
$this->metatags_model->set('classifieds', 'classifieds_view', array('user' => $user, 'ad' => $ad));
// Set title
view::setTitle($ad['data_title'] . ($ad['post_date'] < date_helper::now() - config::item('ad_expiration', 'classifieds') * 60 * 60 * 24 ? ' - ' . __('ad_expired', 'classifieds') : ''), false);
// Set trail
if ($user['user_id'] == session::item('user_id')) {
view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
view::setTrail('classifieds/manage', __('classifieds', 'system_navigation'));
} else {
view::setTrail($user['slug'], $user['name']);
view::setTrail('classifieds/user/' . $user['slug_id'], __('classifieds', 'system_navigation'));
}
// Assign actions
if ($user['user_id'] == session::item('user_id')) {
view::setAction('classifieds/pictures/upload/' . $adID, __('pictures_new', 'classifieds'), array('class' => 'icon-text icon-classifieds-pictures-new', 'data-role' => 'modal', 'data-title' => __('pictures_new', 'classifieds')));
if ($ad['total_pictures'] + $ad['total_pictures_i'] > 0) {
view::setAction('classifieds/pictures/index/' . $adID, __('pictures', 'classifieds'), array('class' => 'icon-text icon-classifieds-pictures'));
}
}
// Load view
view::load('classifieds/view');
}
示例12: view
public function view()
{
// Get URI vars
$blogID = (int) uri::segment(3);
// Get blog
if (!$blogID || !($blog = $this->blogs_model->getBlog($blogID, 'in_view')) || !$blog['active'] && $blog['user_id'] != session::item('user_id')) {
error::show404();
}
// Is this our own blog?
if ($blog['user_id'] == session::item('user_id')) {
// Assign user from session to variable
$user = session::section('session');
} else {
// Get user
if (!($user = $this->users_model->getUser($blog['user_id'])) || !$user['active'] || !$user['verified']) {
error::show404();
}
// Does user have permission to view this user group/type and view blogs?
if (!in_array($user['group_id'], session::permission('users_groups_browse', 'users')) || !in_array($user['type_id'], session::permission('users_types_browse', 'users')) || !session::permission('blogs_view', 'blogs')) {
view::noAccess();
} elseif (!$this->users_model->getPrivacyAccess($user['user_id'], isset($user['config']['privacy_profile']) ? $user['config']['privacy_profile'] : 1) || !$this->users_model->getPrivacyAccess($user['user_id'], $blog['privacy'])) {
view::noAccess($user['slug']);
}
}
// Do we have views enabled?
if (config::item('blog_views', 'blogs')) {
// Update views counter
$this->blogs_model->updateViews($blogID);
}
// Load ratings
if (config::item('blog_rating', 'blogs') == 'stars') {
// Load votes model
loader::model('comments/votes');
// Get votes
$blog['user_vote'] = $this->votes_model->getVote('blog', $blogID);
} elseif (config::item('blog_rating', 'blogs') == 'likes') {
// Load likes model
loader::model('comments/likes');
// Get likes
$blog['user_vote'] = $this->likes_model->getLike('blog', $blogID);
}
// Assign vars
view::assign(array('blogID' => $blogID, 'blog' => $blog, 'user' => $user));
// Set meta tags
$this->metatags_model->set('blogs', 'blogs_view', array('user' => $user, 'blog' => $blog));
// Set title
view::setTitle($blog['data_title'], false);
// Set trail
if ($user['user_id'] == session::item('user_id')) {
view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
view::setTrail('blogs/manage', __('blogs', 'system_navigation'));
} else {
view::setTrail($user['slug'], $user['name']);
view::setTrail('blogs/user/' . $user['slug_id'], __('blogs', 'system_navigation'));
}
// Load view
view::load('blogs/view');
}
示例13: delete
public function delete()
{
// Is user loggedin ?
if (!users_helper::isLoggedin()) {
router::redirect('users/login');
}
// Get URI vars
$slugID = urldecode(utf8::trim(uri::segment(4)));
// Do we have a slug ID?
if ($slugID == '') {
error::show404();
}
// Get user
if (!($user = $this->users_model->getUser($slugID)) || !$user['active'] || !$user['verified']) {
error::show404();
} elseif ($user['user_id'] == session::item('user_id')) {
router::redirect($user['slug']);
}
// Does friend exist?
if (!($friend = $this->users_friends_model->getFriend($user['user_id'], false))) {
view::setError(__('no_friend', 'users_friends'));
router::redirect($user['slug']);
}
// Delete friend
$this->users_friends_model->deleteFriend($friend['user_id'], $friend['friend_id'], $friend['active']);
// Success
view::setInfo(__($friend['active'] ? 'friend_deleted' : 'friend_canceled', 'users_friends'));
router::redirect(input::get('page') ? 'users/friends/requests' : $user['slug']);
}
示例14: offline
public function offline()
{
// Get page
if (!($page = $this->pages_model->getPage('site/offline', 'in_view'))) {
error::show404();
}
// Do we have views enabled?
if (config::item('page_views', 'pages')) {
// Update views counter
$this->pages_model->updateViews($page['page_id']);
}
// Show offline error
error::show($page['data_body'], 200, $page['data_title']);
}
示例15: view
public function view()
{
// Get URI vars
$pictureID = (int) uri::segment(4);
// Get picture
if (!$pictureID || !($picture = $this->classifieds_pictures_model->getPicture($pictureID, 'in_view')) || !$picture['active'] && $picture['user_id'] != session::item('user_id')) {
error::show404();
}
// Get ad
if (!($ad = $this->classifieds_model->getAd($picture['ad_id'], 'in_view'))) {
error::show404();
}
// Is this our own picture?
if ($picture['user_id'] == session::item('user_id')) {
// Assign user from session to variable
$user = session::section('session');
} else {
// Get user
if (!($user = $this->users_model->getUser($picture['user_id'])) || !$user['active'] || !$user['verified']) {
error::show404();
}
}
$previousPicture = $nextPicture = array();
$previousURL = $nextURL = '';
// Does album have more than 1 active picture?
if ($ad['total_pictures'] > 1) {
// Get previous/next pictures
list($previousPicture, $nextPicture) = $this->classifieds_pictures_model->getPictureSiblings(session::item('user_id'), $picture['ad_id'], $picture['order_id'], $user['user_id'] != session::item('user_id') ? $ad['total_pictures'] : $ad['total_pictures'] + $ad['total_pictures_i']);
if ($previousPicture) {
$previousURL = 'classifieds/pictures/view/' . $previousPicture['picture_id'] . '/' . text_helper::slug($previousPicture['data_description'] ? $previousPicture['data_description'] : '', 100);
}
if ($nextPicture) {
$nextURL = 'classifieds/pictures/view/' . $nextPicture['picture_id'] . '/' . text_helper::slug($nextPicture['data_description'] ? $nextPicture['data_description'] : '', 100);
}
}
// Assign vars
view::assign(array('pictureID' => $pictureID, 'picture' => $picture, 'ad' => $ad, 'user' => $user, 'previousURL' => $previousURL, 'nextURL' => $nextURL));
// Set meta tags
$this->metatags_model->set('classifieds', 'classifieds_view', array('user' => $user, 'ad' => $ad, 'picture' => $picture));
// Set title
view::setTitle($ad['data_title'] . ($picture['data_description'] ? ' - ' . $picture['data_description'] : ''), false);
// Set trail
if ($user['user_id'] == session::item('user_id')) {
view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
view::setTrail('classifieds/manage', __('classifieds', 'system_navigation'));
} else {
view::setTrail($user['slug'], $user['name']);
view::setTrail('classifieds/user/' . $user['slug_id'], __('classifieds', 'system_navigation'));
}
view::setTrail('classifieds/view/' . $ad['ad_id'] . '/' . text_helper::slug($ad['data_title'], 100), __('ad_view', 'classifieds'), array('side' => true));
// Assign actions
view::setAction(false, __('pictures_view_counter', 'classifieds', array('%current' => $picture['order_id'], '%total' => $user['user_id'] != session::item('user_id') ? $ad['total_pictures'] : $ad['total_pictures'] + $ad['total_pictures_i'])));
// Load view
view::load('classifieds/pictures/view');
}