本文整理汇总了PHP中COM_handle404函数的典型用法代码示例。如果您正苦于以下问题:PHP COM_handle404函数的具体用法?PHP COM_handle404怎么用?PHP COM_handle404使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COM_handle404函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: define
<?php
// +---------------------------------------------------------------------------+
// | databox_function 共通&navbarMenu設定 |
// +---------------------------------------------------------------------------+
// $Id: databox_function.php
// public_html/admin/plugins/databox/databox_function.php
// 20100924 tsuchitani AT ivywe DOT co DOT jp
// 20120509 fieldset add
define('THIS_PLUGIN', 'databox');
require_once '../../../lib-common.php';
if (!in_array('databox', $_PLUGINS)) {
COM_handle404();
exit;
}
require_once $_CONF['path'] . 'plugins/databox/lib/ppNavbar.php';
$edt_flg = FALSE;
// 権限チェック
if (SEC_hasRights('databox.admin')) {
} else {
$information = array();
$information['pagetitle'] = $MESSAGE[30];
$display = "";
$display .= COM_startBlock($MESSAGE[30], '', COM_getBlockTemplate('_msg_block', 'header'));
$display .= $MESSAGE[35];
$display .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
COM_accessLog("User {$_USER['username']} tried to illegally access the databox administration screen.");
$display = DATABOX_displaypage($pi_name, '_admin', $display, $information);
COM_output($display);
exit;
}
示例2: foreach
foreach ($usergroups as $group) {
$groups[] = $group;
}
$groupAccessList = implode(',', $groups);
//$category = 1;
$sql = "SELECT * FROM {$_TABLES['forum_categories']}";
if ($category > 0) {
$sql .= " WHERE id = {$category}";
}
$sql .= " ORDER BY cat_order ASC";
$categoryQuery = DB_query($sql);
$numCategories = DB_numRows($categoryQuery);
// Check to see if requesting a category that does not exist
if ($category == "0" or $category > 0 and $numCategories == 0) {
$base_url = "{$_CONF['site_url']}/forum/index.php";
COM_handle404($base_url);
}
$forumlisting = COM_newTemplate(CTL_plugin_templatePath('forum'));
$forumlisting->set_file(array('forumlisting' => 'homepage.thtml', 'category_record' => 'categorylisting.thtml', 'forum_icons' => 'forum_icons.thtml', 'forum_links' => 'forum_links.thtml'));
$forumlisting->set_block('category_record', 'forum_record');
$blocks = array('new_icon', 'quiet_icon', 'active_icon', 'normal_icon', 'normalnew_icon', 'sticky_icon', 'stickynew_icon', 'locked_icon', 'lockednew_icon');
foreach ($blocks as $block) {
$forumlisting->set_block('forum_icons', $block);
}
$blocks = array('newpost_link', 'markread_link', 'categorymenu_link');
foreach ($blocks as $block) {
$forumlisting->set_block('forum_links', $block);
}
$forumlisting->set_var('imgset', $CONF_FORUM['imgset']);
$forumlisting->set_var('forumindeximg', '<img alt="forum index" src="' . gf_getImage('forumindex') . '"' . XHTML . '>');
$forumlisting->set_var('phpself', $_CONF['site_url'] . '/forum/index.php');
示例3: COM_showMessage
$display .= COM_showMessage($msg, 'polls');
}
$display .= polllist();
$display = COM_createHTMLDocument($display, array('pagetitle' => $LANG_POLLS['pollstitle']));
} else {
if (isset($_POST['aid']) && count($_POST['aid']) == $nquestions && !isset($_COOKIE['poll-' . $pid])) {
setcookie('poll-' . $pid, implode('-', $aid), time() + $_PO_CONF['pollcookietime'], $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure']);
$display .= POLLS_pollsave($pid, $aid);
$display = COM_createHTMLDocument($display);
} elseif (!empty($pid)) {
$result = DB_query("SELECT topic, meta_description, meta_keywords FROM {$_TABLES['polltopics']} WHERE pid = '{$pid}'" . COM_getPermSQL('AND'));
$A = DB_fetchArray($result);
$polltopic = $A['topic'];
if (empty($polltopic)) {
// poll doesn't exist or user doesn't have access
COM_handle404($_CONF['site_url'] . '/polls/index.php');
} else {
// Meta Tags
$headercode = '';
if ($_PO_CONF['meta_tags'] > 0) {
$headercode = LB . PLG_getMetaTags('poll', $pid, array(array('name' => 'description', 'content' => stripslashes($A['meta_description'])), array('name' => 'keywords', 'content' => stripslashes($A['meta_keywords']))));
}
if ($msg > 0) {
$display .= COM_showMessage($msg, 'polls');
}
if (isset($_POST['aid'])) {
$display .= COM_showMessageText($LANG_POLLS['answer_all'] . ' "' . $polltopic . '"', $LANG_POLLS['not_saved']);
}
if (DB_getItem($_TABLES['polltopics'], 'is_open', "pid = '{$pid}'") != 1) {
$aid = -1;
// poll closed - show result
示例4: service_get_staticpages
//.........这里部分代码省略.........
// WE ASSUME $output doesn't have any confidential fields
// Generate output now (omly if not grabing a template since template is combined with variables first and then generated)
if (!isset($args['template'])) {
$output['sp_content'] = SP_render_content($page, $output['sp_content'], $output['sp_php'], $output['cache_time'], $output['template_id']);
}
} else {
// an error occured (page not found, access denied, ...)
/**
* if the user has edit permissions and the page does not exist,
* send them to the editor so they can create it "wiki style"
*/
$create_page = false;
if ($mode !== 'autotag' && $count == 0 && SEC_hasRights('staticpages.edit')) {
// check again without permissions
if (DB_count($_TABLES['staticpage'], 'sp_id', $page) == 0) {
$url = $_CONF['site_admin_url'] . '/plugins/staticpages/index.php?mode=edit&sp_new_id=' . $page . '&msg=21';
$output = COM_refresh($url);
$create_page = true;
}
}
if (!$create_page) {
if (empty($page)) {
$failflg = 0;
} else {
$failflg = DB_getItem($_TABLES['staticpage'], 'sp_nf', "sp_id = '{$page}'");
}
if ($failflg) {
$output .= SEC_loginRequiredForm();
if ($mode !== 'autotag') {
$output = COM_createHTMLDocument($output, array('rightblock' => true));
}
} else {
if ($mode !== 'autotag') {
COM_handle404();
}
}
}
return PLG_RET_ERROR;
}
if ($args['gl_svc']) {
// This date format is PHP 5 only,
// but only the web-service uses the value
$output['published'] = date('c', strtotime($output['created']));
$output['updated'] = date('c', strtotime($output['modified']));
$output['id'] = $page;
$output['title'] = $output['sp_title'];
$output['page_title'] = $output['sp_page_title'];
$output['category'] = TOPIC_getTopicIdsForObject('staticpages', $page);
$output['content'] = $output['sp_content'];
$output['content_type'] = 'html';
$owner_data = SESS_getUserDataFromId($output['owner_id']);
$output['author_name'] = $owner_data['username'];
$output['link_edit'] = $page;
}
} else {
$output = array();
$mode = '';
if (isset($args['mode'])) {
$mode = $args['mode'];
}
$perms = SP_getPerms();
if (!empty($perms)) {
$perms = ' WHERE ' . $perms;
}
$offset = 0;
if (isset($args['offset'])) {
示例5: CMT_handleView
/**
* Handles a comment view request
*
* @copyright Vincent Furia 2005
* @author Vincent Furia, vinny01 AT users DOT sourceforge DOT net
* @param string $format 'threaded', 'nested', or 'flat'
* @param string $order 'ASC' or 'DESC' or blank
* @param int $page Page number of comments to display
* @param boolean $view View or display (true for view)
* @return string HTML (possibly a refresh)
*/
function CMT_handleView($format, $order, $page, $view = true)
{
global $_CONF, $_TABLES, $_USER;
$display = '';
$cid = 0;
if ($view) {
if (isset($_REQUEST[CMT_CID])) {
$cid = COM_applyFilter($_REQUEST[CMT_CID], true);
}
} else {
if (isset($_REQUEST[CMT_PID])) {
$cid = COM_applyFilter($_REQUEST[CMT_PID], true);
}
}
if ($cid <= 0) {
COM_handle404();
}
$sql = "SELECT sid, title, type FROM {$_TABLES['comments']} WHERE cid = {$cid}";
$A = DB_fetchArray(DB_query($sql));
$sid = $A['sid'];
$title = $A['title'];
$type = $A['type'];
$display = PLG_displayComment($type, $sid, $cid, $title, $order, $format, $page, $view);
if (!$display) {
COM_handle404();
}
$display = COM_showMessageFromParameter() . $display;
$display = COM_createHTMLDocument($display, array('pagetitle' => $title));
return $display;
}
示例6: USER_showProfile
/**
* Shows a profile for a user
* This grabs the user profile for a given user and displays it
*
* @param int $uid User ID of profile to get
* @param boolean $preview whether being called as preview from My Account
* @param int $msg Message to display (if != 0)
* @param string $plugin optional plugin name for message
* @return string HTML for user profile page
*/
function USER_showProfile($uid, $preview = false, $msg = 0, $plugin = '')
{
global $_CONF, $_TABLES, $_USER, $_IMAGE_TYPE, $LANG01, $LANG04, $LANG09, $LANG28, $LANG_LOGIN, $LANG_ADMIN;
$retval = '';
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['profileloginrequired'] == 1)) {
$retval .= SEC_loginRequiredForm();
$retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG_LOGIN[1]));
return $retval;
}
$result = DB_query("SELECT {$_TABLES['users']}.uid,username,fullname,regdate,homepage,about,location,pgpkey,photo,email,status FROM {$_TABLES['userinfo']},{$_TABLES['users']} WHERE {$_TABLES['userinfo']}.uid = {$_TABLES['users']}.uid AND {$_TABLES['users']}.uid = {$uid}");
$numRows = DB_numRows($result);
if ($numRows == 0) {
// no such user
COM_handle404();
}
$A = DB_fetchArray($result);
if ($A['status'] == USER_ACCOUNT_DISABLED && !SEC_hasRights('user.edit')) {
COM_displayMessageAndAbort(30, '', 403, 'Forbidden');
}
if ($A['status'] != USER_ACCOUNT_ACTIVE && !SEC_hasRights('user.edit')) {
COM_handle404();
}
$display_name = COM_getDisplayName($uid, $A['username'], $A['fullname']);
$display_name = htmlspecialchars($display_name);
if (!$preview) {
if ($msg > 0) {
$retval .= COM_showMessage($msg, $plugin);
}
}
// format date/time to user preference
$currentTime = COM_getUserDateTimeFormat($A['regdate']);
$A['regdate'] = $currentTime[0];
$user_templates = COM_newTemplate($_CONF['path_layout'] . 'users');
$user_templates->set_file(array('profile' => 'profile.thtml', 'email' => 'email.thtml', 'row' => 'commentrow.thtml', 'strow' => 'storyrow.thtml'));
$user_templates->set_var('start_block_userprofile', COM_startBlock($LANG04[1] . ' ' . $display_name));
$user_templates->set_var('end_block', COM_endBlock());
$user_templates->set_var('lang_username', $LANG04[2]);
if ($_CONF['show_fullname'] == 1) {
if (empty($A['fullname'])) {
$userName = $A['username'];
$fullName = '';
} else {
$userName = $A['fullname'];
$fullName = $A['username'];
}
} else {
$userName = $A['username'];
$fullName = $A['fullname'];
}
$userName = htmlspecialchars($userName);
$fullName = htmlspecialchars($fullName);
if ($A['status'] == USER_ACCOUNT_DISABLED) {
$userName = sprintf('<s title="%s">%s</s>', $LANG28[42], $userName);
if (!empty($fullName)) {
$fullName = sprintf('<s title="%s">%s</s>', $LANG28[42], $fullName);
}
}
$user_templates->set_var('username', $userName);
$user_templates->set_var('user_fullname', $fullName);
if ($preview) {
$user_templates->set_var('edit_icon', '');
$user_templates->set_var('edit_link', '');
$user_templates->set_var('user_edit', '');
} elseif (!COM_isAnonUser() && $_USER['uid'] == $uid) {
$edit_icon = '<img src="' . $_CONF['layout_url'] . '/images/edit.' . $_IMAGE_TYPE . '" alt="' . $LANG01[48] . '" title="' . $LANG01[48] . '"' . XHTML . '>';
$edit_link_url = COM_createLink($edit_icon, $_CONF['site_url'] . '/usersettings.php');
$user_templates->set_var('edit_icon', $edit_icon);
$user_templates->set_var('edit_link', $edit_link_url);
$user_templates->set_var('user_edit', $edit_link_url);
} elseif (SEC_hasRights('user.edit')) {
$edit_icon = '<img src="' . $_CONF['layout_url'] . '/images/edit.' . $_IMAGE_TYPE . '" alt="' . $LANG_ADMIN['edit'] . '" title="' . $LANG_ADMIN['edit'] . '"' . XHTML . '>';
$edit_link_url = COM_createLink($edit_icon, "{$_CONF['site_admin_url']}/user.php?mode=edit&uid={$A['uid']}");
$user_templates->set_var('edit_icon', $edit_icon);
$user_templates->set_var('edit_link', $edit_link_url);
$user_templates->set_var('user_edit', $edit_link_url);
}
if (isset($A['photo']) && empty($A['photo'])) {
$A['photo'] = '(none)';
// user does not have a photo
}
$photo = USER_getPhoto($uid, $A['photo'], $A['email'], -1);
$user_templates->set_var('user_photo', $photo);
$user_templates->set_var('lang_membersince', $LANG04[67]);
$user_templates->set_var('user_regdate', $A['regdate']);
$user_templates->set_var('lang_email', $LANG04[5]);
$user_templates->set_var('user_id', $uid);
$user_templates->set_var('uid', $uid);
if ($A['email'] != '') {
$user_templates->set_var('lang_sendemail', $LANG04[81]);
$user_templates->parse('email_option', 'email', true);
//.........这里部分代码省略.........
示例7: COM_startBlock
}
}
} else {
// no stories to display
if ($page == 1) {
if (!isset($_CONF['hide_no_news_msg']) || $_CONF['hide_no_news_msg'] == 0) {
$display .= COM_startBlock($LANG05[1], '', COM_getBlockTemplate('_msg_block', 'header')) . $LANG05[2];
$display .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
}
$display .= PLG_showCenterblock(3, $page, $topic);
// bottom blocks
} else {
$topic_url = '';
if (!empty($topic)) {
$topic_url = COM_buildURL($_CONF['site_url'] . '/index.php?topic=' . $topic);
}
COM_handle404($topic_url);
}
}
$header = '';
if ($topic) {
// Meta Tags
if ($_CONF['meta_tags'] > 0) {
$result = DB_query("SELECT meta_description, meta_keywords FROM {$_TABLES['topics']} WHERE tid = '{$topic}'");
$A = DB_fetcharray($result);
$header .= LB . PLG_getMetaTags('homepage', '', array(array('name' => 'description', 'content' => stripslashes($A['meta_description'])), array('name' => 'keywords', 'content' => stripslashes($A['meta_keywords']))));
}
}
$display = COM_createHTMLDocument($display, array('breadcrumbs' => $breadcrumbs, 'headercode' => $header, 'rightblock' => true));
// Output page
COM_output($display);
示例8: ForumHeader
function ForumHeader($forum, $showtopic, &$display)
{
global $_TABLES, $_CONF, $CONF_FORUM, $LANG_GF01, $LANG_GF02;
$navbar = COM_newTemplate(CTL_plugin_templatePath('forum'));
$navbar->set_file(array('topicheader' => 'navbar.thtml'));
$navbar->set_var('search_forum', f_forumsearch());
$navbar->set_var('select_forum', f_forumjump());
if ($CONF_FORUM['usermenu'] == 'navbar') {
if ($forum == 0) {
$navbar->set_var('navmenu', forumNavbarMenu($LANG_GF01['INDEXPAGE']));
} else {
$navbar->set_var('navmenu', forumNavbarMenu());
}
} else {
$navbar->set_var('navmenu', '');
}
$navbar->parse('output', 'topicheader');
$display .= $navbar->finish($navbar->get_var('output'));
if ($forum != '' || $showtopic != '') {
if ($showtopic != '') {
$forum_id = DB_getItem($_TABLES['forum_topic'], 'forum', "id='{$showtopic}'");
$grp_id = DB_getItem($_TABLES['forum_forums'], 'grp_id', "forum_id='{$forum_id}'");
} elseif ($forum != "") {
$grp_id = DB_getItem($_TABLES['forum_forums'], 'grp_id', "forum_id='{$forum}'");
}
$groupname = DB_getItem($_TABLES['groups'], 'grp_name', "grp_id='{$grp_id}'");
if (!SEC_inGroup($groupname)) {
$display .= alertMessage($LANG_GF02['msg77'], $LANG_GF01['ACCESSERROR']);
COM_handle404("{$_CONF['site_url']}/forum/index.php");
exit;
}
}
}