本文整理汇总了PHP中is_guest函数的典型用法代码示例。如果您正苦于以下问题:PHP is_guest函数的具体用法?PHP is_guest怎么用?PHP is_guest使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_guest函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_tab
/**
* Standard modular render function for profile tabs edit hooks.
*
* @param MEMBER The ID of the member who is being viewed
* @param MEMBER The ID of the member who is doing the viewing
* @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
* @return ?array A tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set)
*/
function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
{
$title = do_lang_tempcode('DELETE_MEMBER');
$order = 200;
// Actualiser
$delete_account = post_param_integer('delete', 0);
if ($delete_account == 1) {
if (is_guest($member_id_of)) {
warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
}
ocf_delete_member($member_id_of);
inform_exit(do_lang_tempcode('SUCCESS'));
}
if ($leave_to_ajax_if_possible) {
return NULL;
}
// UI fields
$username = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of);
$text = do_lang_tempcode('_DELETE_MEMBER' . ($member_id_of == get_member() ? '_SUICIDAL' : ''), escape_html($username));
$fields = new ocp_tempcode();
require_code('form_templates');
$fields->attach(form_input_tick(do_lang_tempcode('DELETE'), do_lang_tempcode('DESCRIPTION_DELETE'), 'delete', false));
$javascript = '';
return array($title, $fields, $text, $javascript, $order);
}
示例2: run
/**
* Standard modular run function for newsletter hooks.
*
* @param TIME The time that the entries found must be newer than
* @param LANGUAGE_NAME The language the entries found must be in
* @param string Category filter to apply
* @param BINARY Whether to use full article instead of summary
* @return array Tuple of result details
*/
function run($cutoff_time, $lang, $filter, $in_full = 1)
{
if (!addon_installed('news')) {
return array();
}
require_lang('news');
$new = new ocp_tempcode();
require_code('ocfiltering');
$or_list = ocfilter_to_sqlfragment($filter, 'news_category');
$or_list_2 = ocfilter_to_sqlfragment($filter, 'news_entry_category');
$rows = $GLOBALS['SITE_DB']->query('SELECT title,news,news_article,id,date_and_time,submitter FROM ' . get_table_prefix() . 'news LEFT JOIN ' . get_table_prefix() . 'news_category_entries ON news_entry=id WHERE validated=1 AND date_and_time>' . strval((int) $cutoff_time) . ' AND ((' . $or_list . ') OR (' . $or_list_2 . ')) ORDER BY date_and_time DESC', 300);
if (count($rows) == 300) {
return array();
}
$rows = remove_duplicate_rows($rows, 'id');
foreach ($rows as $row) {
$_url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), get_module_zone('news'), NULL, false, false, true);
$url = $_url->evaluate();
$name = get_translated_text($row['title'], NULL, $lang);
$description = get_translated_text($row[$in_full == 1 ? 'news_article' : 'news'], NULL, $lang);
if ($description == '') {
$description = get_translated_text($row[$in_full == 1 ? 'news' : 'news_article'], NULL, $lang);
}
$member_id = is_guest($row['submitter']) ? NULL : strval($row['submitter']);
$new->attach(do_template('NEWSLETTER_NEW_RESOURCE_FCOMCODE', array('_GUID' => '4eaf5ec00db1f0b89cef5120c2486521', 'MEMBER_ID' => $member_id, 'URL' => $url, 'NAME' => $name, 'DESCRIPTION' => $description)));
}
return array($new, do_lang('NEWS', '', '', '', $lang));
}
示例3: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
if (get_forum_type() != 'ocf') {
warn_exit(do_lang_tempcode('NO_OCF'));
} else {
ocf_require_all_forum_stuff();
}
require_code('ocf_forumview');
if (is_guest()) {
access_denied('NOT_AS_GUEST');
}
require_css('ocf');
$type = get_param('type', 'misc');
if ($type == 'misc') {
list($title, $content) = $this->new_posts();
} elseif ($type == 'unread') {
list($title, $content) = $this->unread_topics();
} elseif ($type == 'recently_read') {
list($title, $content) = $this->recently_read();
} else {
$title = new ocp_tempcode();
$content = new ocp_tempcode();
}
$ret = ocf_wrapper($title, do_template('OCF_VFORUM', array('_GUID' => '8dca548982d65500ab1800ceec2ddc61', 'CONTENT' => $content)));
return $ret;
}
示例4: get_content
function get_content()
{
if ($this->content !== NULL) {
return $this->content;
}
if (!isloggedin() || is_guest($this->context)) {
return $this->content;
}
$this->content = new stdClass();
$this->content->footer = '';
$this->content->icons = array();
if (!$this->import_checklist_plugin()) {
$this->content->items = array(get_string('nochecklistplugin', 'block_checklist'));
return $this->content;
}
if (!empty($this->config->checklistoverview)) {
return $this->show_checklist_overview();
}
if (!empty($this->config->checklistid)) {
return $this->show_single_checklist($this->config->checklistid);
}
// No checklist configured.
$this->content->items = array(get_string('nochecklist', 'block_checklist'));
return $this->content;
}
示例5: ocf_may_attach_poll
/**
* Find whether a member may attach a poll to a detailed topic.
*
* @param AUTO_LINK The topic.
* @param ?MEMBER The topic owner (NULL: ask the DB for it).
* @param ?boolean Whether the topic already has a poll (NULL: ask the DB for it).
* @param ?MEMBER The forum the topic is in (NULL: ask the DB for it).
* @param ?MEMBER The member we are checking for (NULL: current member).
* @return boolean The answer.
*/
function ocf_may_attach_poll($topic_id, $topic_owner = NULL, $has_poll_already = NULL, $forum_id = NULL, $member_id = NULL)
{
if (is_null($topic_owner)) {
$topic_info = $GLOBALS['FORUM_DB']->query_select('f_topics', array('*'), array('id' => $topic_id), '', 1);
if (!array_key_exists(0, $topic_info)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$topic_owner = $topic_info[0]['t_cache_first_member_id'];
$has_poll_already = !is_null($topic_info[0]['t_poll_id']);
$forum_id = $topic_info[0]['t_forum_id'];
}
if (is_null($member_id)) {
$member_id = get_member();
}
if ($has_poll_already) {
return false;
}
if ($topic_owner == $member_id && !is_guest($member_id)) {
return true;
}
if (ocf_may_moderate_forum($forum_id, $member_id)) {
return true;
}
return false;
}
示例6: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
unset($map);
$forum = get_forum_type();
$out = new ocp_tempcode();
if ($forum != 'none') {
// Standard welcome back vs into greeting
$member = get_member();
if (is_guest($member)) {
$redirect = get_self_url(true, true);
$login_url = build_url(array('page' => 'login', 'type' => 'misc', 'redirect' => $redirect), get_module_zone('login'));
$join_url = $GLOBALS['FORUM_DRIVER']->join_url();
$join_bits = do_template('JOIN_OR_LOGIN', array('LOGIN_URL' => $login_url, 'JOIN_URL' => $join_url));
$p = do_lang_tempcode('WELCOME', $join_bits);
$out->attach(paragraph($p, 'hhrt4dsgdsgd'));
} else {
$out->attach(paragraph(do_lang_tempcode('WELCOME_BACK', escape_html($GLOBALS['FORUM_DRIVER']->get_username($member))), 'gfgdf9gjd'));
}
}
$message = get_option('welcome_message');
if (has_actual_page_access(get_member(), 'admin_config')) {
if ($message != '') {
$message .= ' [[page="_SEARCH:admin_config:category:SITE#group_GENERAL"]' . do_lang('EDIT') . '[/page]]';
}
}
$out->attach(comcode_to_tempcode($message, NULL, true));
return $out;
}
示例7: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
unset($map);
if (get_forum_type() != 'ocf') {
return new ocp_tempcode();
}
if (is_guest()) {
return new ocp_tempcode();
}
require_css('side_blocks');
ocf_require_all_forum_stuff();
require_code('ocf_notifications');
// Only show what's new in week. Some forums may want to tweak this, but forums themselves only mark unread topics for a week.
$rows = ocf_get_pp_rows();
// if (count($rows)==0) return new ocp_tempcode();
require_lang('ocf');
$out = new ocp_tempcode();
foreach ($rows as $topic) {
$topic_url = build_url(array('page' => 'topicview', 'id' => $topic['id'], 'type' => 'findpost'), get_module_zone('topicview'));
$topic_url->attach('#post_' . strval($topic['id']));
$title = $topic['t_cache_first_title'];
$date = get_timezoned_date($topic['t_cache_last_time'], true);
$username = $topic['t_cache_last_username'];
$member_link = $GLOBALS['OCF_DRIVER']->member_profile_url($topic['t_cache_last_member_id'], false, true);
$num_posts = $topic['t_cache_num_posts'];
$out->attach(do_template('TOPIC_LIST', array('_GUID' => '55ae21a9f8d67ba6237c118a18b9657b', 'USER_LINK' => $member_link, 'TOPIC_LINK' => $topic_url, 'TITLE' => $title, 'DATE' => $date, 'DATE_RAW' => strval($topic['t_cache_last_time']), 'USERNAME' => $username, 'NUM_POSTS' => integer_format($num_posts))));
}
$send_url = build_url(array('page' => 'topics', 'type' => 'new_pt', 'redirect' => SELF_REDIRECT), get_module_zone('topics'));
if (!ocf_may_make_personal_topic()) {
$send_url = new ocp_tempcode();
}
$view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => get_member()), get_module_zone('members'), NULL, true, false, false, 'tab__pts');
return do_template('BLOCK_SIDE_OCF_PERSONAL_TOPICS', array('_GUID' => '9376cd47884a78f3d1914c176b67ee28', 'SEND_URL' => $send_url, 'VIEW_URL' => $view_url, 'CONTENT' => $out, 'FORUM_NAME' => do_lang_tempcode('PERSONAL_TOPICS')));
}
示例8: run
/**
* Standard modular run function.
*
* @param MEMBER The ID of the member we are getting link hooks for
* @return array List of tuples for results. Each tuple is: type,title,url
*/
function run($member_id)
{
if (!addon_installed('chat')) {
return array();
}
$modules = array();
if (has_actual_page_access(get_member(), 'chat', get_page_zone('chat'))) {
if (!is_guest() && $member_id != get_member()) {
require_lang('chat');
require_code('chat');
if (!$GLOBALS['FORUM_DRIVER']->is_staff($member_id)) {
if (!member_blocked($member_id)) {
$modules[] = array('contact', do_lang_tempcode('EXPLAINED_BLOCK_MEMBER'), build_url(array('page' => 'chat', 'type' => 'blocking_add', 'member_id' => $member_id, 'redirect' => get_self_url(true)), get_module_zone('chat')));
if (has_specific_permission(get_member(), 'start_im')) {
$modules[] = array('contact', do_lang_tempcode('START_IM'), build_url(array('page' => 'chat', 'type' => 'misc', 'enter_im' => $member_id), get_module_zone('chat')));
}
} else {
$modules[] = array('contact', do_lang_tempcode('EXPLAINED_UNBLOCK_MEMBER'), build_url(array('page' => 'chat', 'type' => 'blocking_remove', 'member_id' => $member_id, 'redirect' => get_self_url(true)), get_module_zone('chat')));
}
}
if (!member_befriended($member_id)) {
$modules[] = array('contact', do_lang_tempcode('MAKE_BUDDY'), build_url(array('page' => 'chat', 'type' => 'buddy_add', 'member_id' => $member_id, 'redirect' => get_self_url(true)), get_module_zone('chat')));
} else {
$modules[] = array('contact', do_lang_tempcode('DUMP_BUDDY'), build_url(array('page' => 'chat', 'type' => 'buddy_remove', 'member_id' => $member_id, 'redirect' => get_self_url(true)), get_module_zone('chat')));
}
}
}
return $modules;
}
示例9: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
require_lang('bookmarks');
require_code('bookmarks');
require_css('bookmarks');
if (is_guest()) {
access_denied('NOT_AS_GUEST');
}
// Decide what we're doing
$type = get_param('type', 'misc');
if ($type == 'misc') {
return $this->manage_bookmarks();
}
if ($type == '_manage') {
return $this->_manage_bookmarks();
}
if ($type == '_edit') {
return $this->_edit_bookmark();
}
if ($type == 'ad') {
return $this->ad();
}
if ($type == '_ad') {
return $this->_ad();
}
return new ocp_tempcode();
}
示例10: run
/**
* Standard modular run function for realtime-rain hooks.
*
* @param TIME Start of time range.
* @param TIME End of time range.
* @return array A list of template parameter sets for rendering a 'drop'.
*/
function run($from, $to)
{
$drops = array();
if (has_actual_page_access(get_member(), 'chat')) {
require_code('chat');
$rows = $GLOBALS['SITE_DB']->query('SELECT ip_address,the_message,user_id AS member_id,date_and_time AS timestamp,room_id FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'chat_messages WHERE system_message=0 AND date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
foreach ($rows as $row) {
if (!check_chatroom_access($row['room_id'], true)) {
continue;
}
$timestamp = $row['timestamp'];
$member_id = $row['member_id'];
$message = get_translated_text($row['the_message']);
if (strpos($message, '[private') !== false) {
continue;
}
$message = strip_comcode($message);
if ($message == '') {
continue;
}
$drops[] = rain_get_special_icons($row['ip_address'], $timestamp, NULL, $message) + array('TYPE' => 'chat', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => rain_truncate_for_title($message), 'IMAGE' => is_guest($member_id) ? rain_get_country_image($row['ip_address']) : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => $message, 'URL' => build_url(array('page' => 'points', 'type' => 'member', 'id' => $member_id), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'room_' . strval($row['room_id']));
}
}
return $drops;
}
示例11: require_capability
/**
* Do any security checks needed for the passed action
*
* @param string $action
*/
public function require_capability($action)
{
global $PAGE;
require_capability('mod/hsuforum:viewdiscussion', $PAGE->context);
if (is_guest($PAGE->context)) {
print_error('noguest');
}
}
示例12: run
/**
* Standard modular run function for RSS hooks.
*
* @param string A list of categories we accept from
* @param TIME Cutoff time, before which we do not show results from
* @param string Prefix that represents the template set we use
* @set RSS_ ATOM_
* @param string The standard format of date to use for the syndication type represented in the prefix
* @param integer The maximum number of entries to return, ordering by date
* @return ?array A pair: The main syndication section, and a title (NULL: error)
*/
function run($_filters, $cutoff, $prefix, $date_string, $max)
{
if (!addon_installed('tickets')) {
return NULL;
}
if (!has_actual_page_access(get_member(), 'tickets')) {
return NULL;
}
if (is_guest()) {
return NULL;
}
require_code('tickets');
require_code('tickets2');
$ticket_types = ocfilter_to_idlist_using_callback($_filters, '', NULL, NULL, NULL, NULL, false);
if (count($ticket_types) != 0) {
$rows = array();
foreach ($ticket_types as $ticket_type) {
if (!has_category_access(get_member(), 'tickets', get_translated_text($ticket_type))) {
continue;
}
$rows = array_merge($rows, get_tickets(get_member(), $ticket_type, false, false, true));
}
} else {
$rows = get_tickets(get_member(), NULL, false, false, true);
}
require_code('feedback');
$content = new ocp_tempcode();
foreach ($rows as $i => $row) {
if ($i == $max) {
break;
}
if ($row['lasttime'] < $cutoff) {
continue;
}
$ticket_id = extract_topic_identifier($row['description']);
$ticket_type = $GLOBALS['SITE_DB']->query_value_null_ok('tickets', 'ticket_type', array('ticket_id' => $ticket_id));
$author = $row['firstusername'];
$date = date($date_string, $row['firsttime']);
$edit_date = date($date_string, $row['lasttime']);
$title = xmlentities($row['firsttitle']);
$summary = xmlentities($row['firstpost']->evaluate());
$category = '';
$category_raw = '';
if (!is_null($ticket_type)) {
$category = get_translated_text($ticket_type);
$category_raw = strval($ticket_type);
}
$view_url = build_url(array('page' => 'tickets', 'type' => 'ticket', 'id' => $ticket_id), get_module_zone('tickets'), NULL, false, false, true);
if ($prefix == 'RSS_' && get_option('is_on_comments') == '1') {
$if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'b4f25f5cf68304f8d402bb06851489d6', 'COMMENT_URL' => $view_url, 'ID' => strval($ticket_id)));
} else {
$if_comments = new ocp_tempcode();
}
$content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $ticket_id, 'NEWS' => '', 'DATE' => $date)));
}
require_lang('tickets');
return array($content, do_lang('SUPPORT_TICKETS'));
}
示例13: get_entry_points
/**
* Standard modular entry-point finder function.
*
* @return ?array A map of entry points (type-code=>language-code) (NULL: disabled).
*/
function get_entry_points()
{
if (get_forum_type() == 'ocf') {
return array();
}
if (is_guest()) {
return array();
}
return array('misc' => 'NOTIFICATIONS');
}
示例14: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
if (!is_guest()) {
require_code('menus');
$built = build_stored_menu('popup', '_bookmarks');
if (is_null($built)) {
return new ocp_tempcode();
}
return $built;
}
return new ocp_tempcode();
}
示例15: run
/**
* Standard modular run function for preview hooks.
*
* @return array A pair: The preview, the updated post Comcode
*/
function run()
{
// Find review, if there is one
$individual_review_ratings = array();
$review_rating = post_param('review_rating', '');
if ($review_rating != '') {
$individual_review_ratings[''] = array('REVIEW_TITLE' => '', 'REVIEW_RATING' => $review_rating);
}
$poster_name = $GLOBALS['FORUM_DRIVER']->get_username(get_member());
$post = comcode_to_tempcode(post_param('post'));
// OCF renderings of poster
static $hooks = NULL;
if (is_null($hooks)) {
$hooks = find_all_hooks('modules', 'topicview');
}
static $hook_objects = NULL;
if (is_null($hook_objects)) {
$hook_objects = array();
foreach (array_keys($hooks) as $hook) {
require_code('hooks/modules/topicview/' . filter_naughty_harsh($hook));
$object = object_factory('Hook_' . filter_naughty_harsh($hook), true);
if (is_null($object)) {
continue;
}
$hook_objects[$hook] = $object;
}
}
if (!is_guest()) {
require_code('ocf_members2');
$poster_details = ocf_show_member_box(get_member(), false, $hooks, $hook_objects, false);
} else {
$custom_fields = new ocp_tempcode();
$poster_details = new ocp_tempcode();
}
if (addon_installed('ocf_forum')) {
if (!is_guest()) {
$poster = do_template('OCF_POSTER_MEMBER', array('ONLINE' => true, 'ID' => strval(get_member()), 'POSTER_DETAILS' => $poster_details, 'PROFILE_URL' => $GLOBALS['FORUM_DRIVER']->member_profile_url(get_member(), false, true), 'POSTER_USERNAME' => $poster_name));
} else {
$poster = do_template('OCF_POSTER_GUEST', array('IP_LINK' => '', 'POSTER_DETAILS' => $poster_details, 'POSTER_USERNAME' => $poster_name));
}
} else {
$poster = make_string_tempcode(escape_html($poster_name));
// Should never happen actually, as applies discounts hook from even running
}
$highlight = false;
$datetime_raw = time();
$datetime = get_timezoned_date(time());
$poster_url = $GLOBALS['FORUM_DRIVER']->member_profile_url(get_member());
$title = post_param('title', '');
$tpl = do_template('POST', array('INDIVIDUAL_REVIEW_RATINGS' => $individual_review_ratings, 'HIGHLIGHT' => $highlight, 'TITLE' => $title, 'TIME_RAW' => strval($datetime_raw), 'TIME' => $datetime, 'POSTER_URL' => $poster_url, 'POSTER_NAME' => $poster_name, 'POST' => $post, 'POSTER_ID' => strval(get_member()), 'POSTER' => $poster, 'POSTER_DETAILS' => $poster_details, 'ID' => '', 'CHILDREN' => '', 'RATING' => '', 'EMPHASIS' => '', 'BUTTONS' => '', 'TOPIC_ID' => '', 'UNVALIDATED' => '', 'IS_SPACER_POST' => false, 'NUM_TO_SHOW_LIMIT' => '0'));
return array($tpl, NULL);
}