• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_page_name函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_page_name函数的典型用法代码示例。如果您正苦于以下问题:PHP get_page_name函数的具体用法?PHP get_page_name怎么用?PHP get_page_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_page_name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _build_keep_form_fields

/**
 * Get hidden fields for a form representing 'keep_x'. If we are having a GET form instead of a POST form, we need to do this. This function also encodes the page name, as we'll always want that.
 *
 * @param  ID_TEXT		The page for the form to go to (blank: don't attach)
 * @param  boolean		Whether to keep all elements of the current URL represented in this form (rather than just the keep_ fields, and page)
 * @param  ?array			A list of parameters to exclude (NULL: don't exclude any)
 * @return tempcode		The builtup hidden form fields
 */
function _build_keep_form_fields($page = '', $keep_all = false, $exclude = NULL)
{
    if (is_null($exclude)) {
        $exclude = array();
    }
    if ($page == '_SELF') {
        $page = get_page_name();
    }
    $out = new ocp_tempcode();
    if (count($_GET) > 0) {
        foreach ($_GET as $key => $val) {
            if (!is_string($val)) {
                continue;
            }
            if (get_magic_quotes_gpc()) {
                $val = stripslashes($val);
            }
            if ((substr($key, 0, 5) == 'keep_' || $keep_all) && !in_array($key, $exclude) && $key != 'page' && !skippable_keep($key, $val)) {
                $out->attach(form_input_hidden($key, $val));
            }
        }
    }
    if ($page != '') {
        $out->attach(form_input_hidden('page', $page));
    }
    return $out;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:35,代码来源:urls2.php


示例2: run

 /**
  * Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
  *
  * @return tempcode  The snippet
  */
 function run()
 {
     if (get_option('is_on_rating') == '0') {
         return do_lang_tempcode('INTERNAL_ERROR');
     }
     // Has there actually been any rating?
     if (strtoupper(ocp_srv('REQUEST_METHOD')) == 'POST' || ocp_srv('HTTP_REFERER') == '') {
         $rating = either_param_integer('rating', NULL);
     } else {
         $rating = post_param_integer('rating');
         // Will fail
     }
     $content_type = get_param('content_type');
     $type = get_param('type', '');
     $content_id = get_param('id');
     $content_url = get_param('content_url', '', true);
     $content_title = get_param('content_title', '', true);
     require_code('feedback');
     actualise_specific_rating($rating, get_page_name(), get_member(), $content_type, $type, $content_id, $content_url, $content_title);
     actualise_give_rating_points();
     $template = get_param('template', NULL);
     if ($template !== '') {
         if (is_null($template)) {
             $template = 'RATING_BOX';
         }
         return display_rating($content_url, $content_title, $content_type, $content_id, $template);
     }
     return do_lang_tempcode('THANKYOU_FOR_RATING_SHORT');
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:rating.php


示例3: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     // The counter we're using
     $name = array_key_exists('param', $map) ? $map['param'] : '';
     if ($name == '-') {
         $name = get_page_name() . ':' . get_param('type', 'misc') . ':' . get_param('id', '');
     }
     if ($name == '') {
         $name = 'hits';
     }
     $start = array_key_exists('start', $map) ? intval($map['start']) : 0;
     // Set it if it's not already
     $_current_value = get_value($name);
     if (is_null($_current_value)) {
         set_value($name, strval($start));
         $current_value = $start;
     } else {
         $current_value = intval($_current_value);
         if ($start > $current_value) {
             $current_value = $start;
             set_value($name, strval($current_value));
         }
     }
     // Hit counter?
     $hit_count = array_key_exists('hit_count', $map) ? intval($map['hit_count']) : 1;
     if ($hit_count == 1) {
         update_stat($name, 1);
     }
     return do_template('MAIN_COUNT', array('NAME' => $name, 'VALUE' => strval($current_value)));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:36,代码来源:main_count.php


示例4: adminzone_extend_breadcrumbs

/**
 * Extend breadcrumbs for the Admin Zone (called by breadcrumbs_get_default_stub).
 *
 * @param  tempcode		Reference to the breadcrumbs stub we're assembling
 */
function adminzone_extend_breadcrumbs(&$stub)
{
    global $BREADCRUMB_SET_PARENTS;
    if (count($BREADCRUMB_SET_PARENTS) > 0 && !is_object($BREADCRUMB_SET_PARENTS[0][0])) {
        // Works by finding where our oldest ancestor connects on to the do-next menus, and carries from there
        list($zone, $attributes, ) = page_link_decode($BREADCRUMB_SET_PARENTS[0][0]);
        $type = array_key_exists('type', $attributes) ? $attributes['type'] : 'misc';
        $page = $attributes['page'];
        if ($page == '_SELF') {
            $page = get_page_name();
        }
        if ($zone == '_SEARCH') {
            $zone = get_module_zone($page);
        }
        if ($zone == '_SELF') {
            $zone = get_zone_name();
        }
    } else {
        // Works by finding where we connect on to the do-next menus, and carries from there
        $type = get_param('type', 'misc');
        $page = get_page_name();
        $zone = get_zone_name();
    }
    if ($page != 'admin' && $page != 'cms') {
        // Loop over menus, hunting for connection
        $hooks = find_all_hooks('systems', 'do_next_menus');
        $_hooks = array();
        $page_looking = $page;
        $page_looking = preg_replace('#^(cms|admin)\\_#', '', $page_looking);
        if (array_key_exists($page_looking, $hooks)) {
            $_hooks[$page_looking] = $hooks[$page_looking];
            unset($hooks[$page_looking]);
            $hooks = array_merge($_hooks, $hooks);
        }
        foreach ($hooks as $hook => $sources_dir) {
            $run_function = extract_module_functions(get_file_base() . '/' . $sources_dir . '/hooks/systems/do_next_menus/' . $hook . '.php', array('run'));
            if ($run_function[0] !== NULL) {
                $info = is_array($run_function[0]) ? call_user_func_array($run_function[0][0], $run_function[0][1]) : eval($run_function[0]);
                foreach ($info as $i) {
                    if ($i === NULL) {
                        continue;
                    }
                    if ($page == $i[2][0] && (!array_key_exists('type', $i[2][1]) && $type == 'misc' || array_key_exists('type', $i[2][1]) && ($type == $i[2][1]['type'] || $i[2][1]['type'] == 'misc')) && $zone == $i[2][2]) {
                        if ($i[0] == 'cms') {
                            $url = build_url(array('page' => 'cms', 'type' => $i[0] == 'cms' ? NULL : $i[0]), 'cms');
                        } else {
                            $url = build_url(array('page' => 'admin', 'type' => $i[0]), 'adminzone');
                        }
                        require_lang('menus');
                        require_lang('security');
                        $stub->attach(hyperlink($url, do_lang_tempcode(strtoupper($i[0])), false, false, do_lang_tempcode('GO_BACKWARDS_TO', @html_entity_decode(strip_tags(do_lang(strtoupper($i[0]))), ENT_QUOTES, get_charset()))));
                        //if ((!array_key_exists('type',$i[2][1])) || ($type==$i[2][1]['type'])) break;
                        return;
                    }
                }
            }
        }
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:64,代码来源:site_adminzone.php


示例5: parse_var

/**
 * Parse the text to transform variable.
 *
 * @param string $sContent The text.
 * @return string The text parsed.
 */
function parse_var($sContent)
{
    $sContent = str_replace('{site_url}', RELATIVE, $sContent);
    $sContent = str_replace('{static_url}', STATIC_URL, $sContent);
    $sContent = str_replace('{lang}', LANG, $sContent);
    $sContent = str_replace('{tpl_name}', TPL, $sContent);
    $sContent = str_replace('{site_name}', SITE_NAME, $sContent);
    $sContent = str_replace('{page_name}', get_page_name(), $sContent);
    $sContent = str_replace('{menu_links}', get_links_html(), $sContent);
    $sContent = str_replace('{menu_langs}', get_langs_html(), $sContent);
    $sContent = str_replace('{year}', date('Y'), $sContent);
    return $sContent;
}
开发者ID:joswilson,项目名称:NotJustOK,代码行数:19,代码来源:fns.php


示例6: auth_set

 function auth_set($member_id, $oauth_url)
 {
     require_lang('facebook');
     require_code('facebook_connect');
     global $FACEBOOK_CONNECT;
     $code = get_param('code', '', true);
     if ($code == '') {
         $oauth_redir_url = $FACEBOOK_CONNECT->getLoginUrl(array('redirect_uri' => $oauth_url->evaluate(), 'scope' => array('publish_stream')));
         header('Location: ' . $oauth_redir_url);
         exit;
     }
     if (!is_null(get_param('error_reason', NULL))) {
         attach_message(do_lang_tempcode('FACEBOOK_OAUTH_FAIL', escape_html(get_param('error_reason'))), 'warn');
         return false;
     }
     // oauth apparently worked
     $access_token = $FACEBOOK_CONNECT->getAccessToken();
     if (is_null($access_token)) {
         attach_message(do_lang_tempcode('FACEBOOK_OAUTH_FAIL', escape_html(do_lang('UNKNOWN'))), 'warn');
         return false;
     }
     if (is_null($member_id)) {
         /*$FACEBOOK_CONNECT->setExtendedAccessToken();		Facebook API no longer has this
         		$FACEBOOK_CONNECT->api('/oauth/access_token', 'POST',
         			array(
         				'grant_type'=>'fb_exchange_token',
         				'client_id'=>get_option('facebook_appid'),
         				'client_secret'=>get_option('facebook_secret_code'),
         				'fb_exchange_token'=>$access_token
         		    )
         		);*/
         if (get_option('facebook_uid') == '') {
             require_code('config2');
             $facebook_uid = $FACEBOOK_CONNECT->getUser();
             set_option('facebook_uid', strval($facebook_uid));
         }
     }
     if (strpos($access_token, '|') === false || is_null($member_id)) {
         $save_to = 'facebook_oauth_token';
         if (!is_null($member_id)) {
             $save_to .= '__' . strval($member_id);
         }
         set_long_value($save_to, $access_token);
     }
     if (get_page_name() != 'facebook_oauth') {
         header('Location: ' . str_replace('&syndicate_start__facebook=1', '', str_replace('oauth_in_progress=1&', 'oauth_in_progress=0&', $oauth_url->evaluate())));
         exit;
     }
     return true;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:50,代码来源:facebook.php


示例7: init__chat

 function init__chat()
 {
     global $MEMBERS_BEFRIENDED;
     $MEMBERS_BEFRIENDED = NULL;
     global $EFFECT_SETTINGS_ROWS;
     $EFFECT_SETTINGS_ROWS = NULL;
     if (!defined('CHAT_ACTIVITY_PRUNE')) {
         define('CHAT_ACTIVITY_PRUNE', 25);
         define('CHAT_BACKLOG_TIME', 60 * 5);
         // 5 minutes of messages if you enter an existing room
         define('CHAT_EVENT_PRUNE', 60 * 24);
     }
     if (get_page_name() == 'chat') {
         require_code('developer_tools');
         destrictify(false);
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:17,代码来源:chat.php


示例8: ocf_make_forum

/**
 * Make a forum.
 *
 * @param  SHORT_TEXT 	The name of the forum.
 * @param  SHORT_TEXT 	The description for the forum.
 * @param  ?AUTO_LINK	What forum category the forum will be filed with (NULL: this is the root forum).
 * @param  ?array			Permission map (NULL: do it the standard way, outside of this function). This parameter is for import/compatibility only and works upon an emulation of 'access levels' (ala ocPortal 2.5/2.6), and it is recommended to use the normal aed_module functionality for permissions setting.
 * @param  ?AUTO_LINK 	The ID of the parent forum (NULL: this is the root forum).
 * @param  integer		The position of this forum relative to other forums viewable on the same screen (if parent forum hasn't specified automatic ordering).
 * @param  BINARY			Whether post counts will be incremented if members post in the forum.
 * @param  BINARY			Whether the ordering of subforums is done automatically, alphabetically).
 * @param  LONG_TEXT		The question that is shown for newbies to the forum (blank: none).
 * @param  SHORT_TEXT	The answer to the question (blank: no specific answer.. if there's a 'question', it just requires a click-through).
 * @param  SHORT_TEXT	Either blank for no redirection, the ID of another forum we are mirroring, or a URL to redirect to.
 * @param  ID_TEXT		The order the topics are shown in, by default.
 * @param  BINARY			Whether the forum is threaded.
 * @return AUTO_LINK		The ID of the newly created forum.
 */
function ocf_make_forum($name, $description, $category_id, $access_mapping, $parent_forum, $position = 1, $post_count_increment = 1, $order_sub_alpha = 0, $intro_question = '', $intro_answer = '', $redirection = '', $order = 'last_post', $is_threaded = 0)
{
    if ($category_id == -1) {
        $category_id = NULL;
    }
    if ($parent_forum == -1) {
        $parent_forum = NULL;
    }
    if (get_page_name() != 'admin_import') {
        if (!is_null($category_id) && function_exists('ocf_ensure_category_exists')) {
            ocf_ensure_category_exists($category_id);
        }
        if (!is_null($parent_forum) && function_exists('ocf_ensure_forum_exists')) {
            ocf_ensure_forum_exists($parent_forum);
        }
    }
    $forum_id = $GLOBALS['FORUM_DB']->query_insert('f_forums', array('f_name' => $name, 'f_description' => insert_lang($description, 2, $GLOBALS['FORUM_DB']), 'f_category_id' => $category_id, 'f_parent_forum' => $parent_forum, 'f_position' => $position, 'f_order_sub_alpha' => $order_sub_alpha, 'f_post_count_increment' => $post_count_increment, 'f_intro_question' => insert_lang($intro_question, 3, $GLOBALS['FORUM_DB']), 'f_intro_answer' => $intro_answer, 'f_cache_num_topics' => 0, 'f_cache_num_posts' => 0, 'f_cache_last_topic_id' => NULL, 'f_cache_last_forum_id' => NULL, 'f_cache_last_title' => '', 'f_cache_last_time' => NULL, 'f_cache_last_username' => '', 'f_cache_last_member_id' => NULL, 'f_redirection' => $redirection, 'f_order' => $order, 'f_is_threaded' => $is_threaded), true);
    // Set permissions
    if (!is_null($access_mapping)) {
        $groups = $GLOBALS['OCF_DRIVER']->get_usergroup_list(false, true);
        foreach (array_keys($groups) as $group_id) {
            $level = 0;
            // No-access
            if (array_key_exists($group_id, $access_mapping)) {
                $level = $access_mapping[$group_id];
            }
            if ($level >= 1) {
                $GLOBALS['FORUM_DB']->query_insert('group_category_access', array('module_the_name' => 'forums', 'category_name' => strval($forum_id), 'group_id' => $group_id));
                if ($level == 1) {
                    $GLOBALS['FORUM_DB']->query_insert('gsp', array('specific_permission' => 'submit_lowrange_content', 'group_id' => $group_id, 'the_page' => '', 'module_the_name' => 'forums', 'category_name' => strval($forum_id), 'the_value' => 0));
                    $GLOBALS['FORUM_DB']->query_insert('gsp', array('specific_permission' => 'submit_midrange_content', 'group_id' => $group_id, 'the_page' => '', 'module_the_name' => 'forums', 'category_name' => strval($forum_id), 'the_value' => 0));
                }
                if ($level >= 3) {
                    $GLOBALS['FORUM_DB']->query_insert('gsp', array('specific_permission' => 'bypass_validation_lowrange_content', 'group_id' => $group_id, 'the_page' => '', 'module_the_name' => 'forums', 'category_name' => strval($forum_id), 'the_value' => 1));
                }
                if ($level >= 4) {
                    $GLOBALS['FORUM_DB']->query_insert('gsp', array('specific_permission' => 'bypass_validation_midrange_content', 'group_id' => $group_id, 'the_page' => '', 'module_the_name' => 'forums', 'category_name' => strval($forum_id), 'the_value' => 1));
                }
                // 2=May post, [3=May post instantly , 4=May start topics instantly , 5=Moderator  --  these ones will not be treated specially, so as to avoid overriding permissions unnecessary - let the admins configure it optimally manually]
            }
        }
    }
    log_it('ADD_FORUM', strval($forum_id), $name);
    return $forum_id;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:63,代码来源:ocf_forums_action.php


示例9: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     $page = array_key_exists('param', $map) && $map['param'] != '' ? $map['param'] : get_page_name();
     $zone = array_key_exists('zone', $map) ? $map['zone'] : post_param('zone', get_comcode_zone($page, false));
     if ($zone == '_SEARCH') {
         $zone = NULL;
     }
     $qmap = array('p_parent_page' => $page);
     if (!is_null($zone)) {
         $qmap['the_zone'] = $zone;
     }
     if (!has_specific_permission(get_member(), 'see_unvalidated')) {
         $qmap['p_validated'] = 1;
     }
     $children = $GLOBALS['SITE_DB']->query_select('comcode_pages', array('the_page', 'the_zone'), $qmap);
     foreach ($children as $i => $child) {
         $_title = $GLOBALS['SITE_DB']->query_value_null_ok('cached_comcode_pages', 'cc_page_title', array('the_page' => $child['the_page'], 'the_zone' => $child['the_zone']));
         if (!is_null($_title)) {
             $title = get_translated_text($_title, NULL, NULL, true);
             if (is_null($title)) {
                 $title = '';
             }
         } else {
             $title = '';
             if (get_option('is_on_comcode_page_cache') == '1') {
                 request_page($child['the_page'], false, $child['the_zone'], NULL, true);
                 $_title = $GLOBALS['SITE_DB']->query_value_null_ok('cached_comcode_pages', 'cc_page_title', array('the_page' => $child['the_page'], 'the_zone' => $child['the_zone']));
                 if (!is_null($_title)) {
                     $title = get_translated_text($_title);
                 }
             }
         }
         if ($title == '') {
             $title = escape_html(ucwords(str_replace('_', ' ', $child['the_page'])));
         }
         $child['TITLE'] = $title;
         $child['PAGE'] = $child['the_page'];
         $child['ZONE'] = $child['the_zone'];
         $children[$i] = $child;
     }
     $GLOBALS['M_SORT_KEY'] = 'TITLE';
     usort($children, 'multi_sort');
     return do_template('BLOCK_MAIN_COMCODE_PAGE_CHILDREN', array('_GUID' => '375aa1907fc6b2ca6b23ab5b5139aaef', 'CHILDREN' => $children, 'THE_PAGE' => $page, 'THE_ZONE' => $zone));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:50,代码来源:main_comcode_page_children.php


示例10: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     if (!array_key_exists('page', $map)) {
         $map['page'] = get_page_name();
     }
     if (array_key_exists('id', $map)) {
         $id = $map['id'];
     } else {
         $id = get_param('id', '0');
     }
     require_code('feedback');
     //$self_url=get_self_url();
     //$self_title=$map['page'];
     /*$test_changed=post_param('title','');
     		if ($test_changed!='')
     		{
     			decache('main_trackbacks');
     		}*/
     //actualise_post_trackbacks(1,'block_main_trackbacks',$map['page'].'_'.$map['param'].$extra,$self_url,$self_title);
     actualise_post_trackback(get_option('is_on_trackbacks') == '1', $map['page'], $id);
     return get_trackbacks($map['page'], $id, get_option('is_on_trackbacks') == '1');
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:28,代码来源:main_trackback.php


示例11: check_login

function check_login()
{
    // Detect pages where it should redirect to homepage or login page
    $page_name = get_page_name();
    if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] == true) {
        if (isset($_SESSION['user_id']) && !empty($_SESSION['user_id'])) {
            // Cast the user_id to int, and check if it is an int
            // Casting to int (multiplying by int)
            if (is_int((int) $_SESSION['user_id'])) {
                // The user is logged in
                $loggedin = true;
                if ($page_name == "login.php") {
                    redirect_to("index.php");
                }
            }
        }
    }
    if (!isset($loggedin) && $page_name != "login.php") {
        // User is not logged in
        redirect_to("login.php");
    }
}
开发者ID:Tigerwhit4,项目名称:Login_system,代码行数:22,代码来源:functions.php


示例12: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     if (!array_key_exists('param', $map)) {
         $map['param'] = 'main';
     }
     if (!array_key_exists('page', $map)) {
         $map['page'] = get_page_name();
     }
     if (array_key_exists('extra_param_from', $map)) {
         $extra = '_' . $map['extra_param_from'];
     } else {
         $extra = '';
     }
     require_code('feedback');
     $self_url = get_self_url();
     $self_title = $map['page'];
     $id = $map['page'] . '_' . $map['param'] . $extra;
     $test_changed = post_param('rating_' . $id, '');
     if ($test_changed != '') {
         decache('main_rating');
     }
     actualise_rating(true, 'block_main_rating', $id, $self_url, $self_title);
     return get_rating_box($self_url, $self_title, 'block_main_rating', $id, true);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:30,代码来源:main_rating.php


示例13: ocf_member_handle_promotion

/**
 * Check to see if a member deserves promotion, and handle it.
 *
 * @param  ?MEMBER	The member (NULL: current member).
 */
function ocf_member_handle_promotion($member_id = NULL)
{
    if (!addon_installed('points')) {
        return;
    }
    if (get_page_name() == 'admin_import') {
        return;
    }
    if (is_null($member_id)) {
        $member_id = get_member();
    }
    require_code('ocf_members');
    if (ocf_is_ldap_member($member_id)) {
        return;
    }
    require_code('points');
    $total_points = total_points($member_id);
    $groups = $GLOBALS['OCF_DRIVER']->get_members_groups($member_id, false, true);
    $or_list = '';
    foreach ($groups as $id) {
        if ($or_list != '') {
            $or_list .= ' OR ';
        }
        $or_list .= 'id=' . strval($id);
    }
    $promotions = $GLOBALS['FORUM_DB']->query('SELECT id,g_promotion_target FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_groups WHERE (' . $or_list . ') AND g_promotion_target IS NOT NULL AND g_promotion_threshold<=' . strval((int) $total_points) . ' ORDER BY g_promotion_threshold');
    $promotes_today = array();
    foreach ($promotions as $promotion) {
        $_p = $promotion['g_promotion_target'];
        if (!array_key_exists($_p, $groups) && !array_key_exists($_p, $promotes_today)) {
            // If it is our primary
            if ($GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id, 'm_primary_group') == $promotion['id']) {
                $GLOBALS['FORUM_DB']->query_update('f_members', array('m_primary_group' => $_p), array('id' => $member_id), '', 1);
            } else {
                $GLOBALS['FORUM_DB']->query_delete('f_group_members', array('gm_member_id' => $member_id, 'gm_group_id' => $_p), '', 1);
                $GLOBALS['FORUM_DB']->query_insert('f_group_members', array('gm_validated' => 1, 'gm_member_id' => $member_id, 'gm_group_id' => $_p), false, true);
                $GLOBALS['FORUM_DB']->query_delete('f_group_members', array('gm_member_id' => $member_id, 'gm_group_id' => $promotion['id']), '', 1);
                // It's a transition, so remove old membership
            }
            // Carefully update run-time cacheing
            global $USERS_GROUPS_CACHE;
            foreach (array(true, false) as $a) {
                foreach (array(true, false) as $b) {
                    if (isset($USERS_GROUPS_CACHE[$member_id][$a][$b])) {
                        $groups = $USERS_GROUPS_CACHE[$member_id][$a][$b];
                        $pos = array_search($_p, $groups);
                        if ($pos !== false) {
                            unset($groups[$pos]);
                        }
                        $groups[] = $promotion['id'];
                        $USERS_GROUPS_CACHE[$member_id][$a][$b] = $groups;
                    }
                }
            }
            $promotes_today[$_p] = 1;
        }
    }
    if (count($promotes_today) != 0) {
        $name = $GLOBALS['OCF_DRIVER']->get_member_row_field($member_id, 'm_username');
        log_it('MEMBER_PROMOTED_AUTOMATICALLY', strval($member_id), $name);
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:ocf_posts_action2.php


示例14: handle_facebook_connection_login


//.........这里部分代码省略.........
    /*if (!is_null($member)) // Useful for debugging
    	{
    		require_code('ocf_members_action2');
    		ocf_delete_member($member);
    		$member=NULL;
    	}*/
    // If logged in before using Facebook, see if they've changed their name or email or timezone on Facebook -- if so, try and update locally to match
    if (!is_null($member)) {
        if (!is_null($current_logged_in_member) && $current_logged_in_member !== NULL && !is_guest($current_logged_in_member) && $current_logged_in_member != $member) {
            return $current_logged_in_member;
        }
        // User has an active login, and the Facebook account is bound to a DIFFERENT login. Take precedence to the other login that is active on top of this
        $last_visit_time = $member[0]['m_last_visit_time'];
        if ($timezone !== NULL) {
            if (tz_time(time(), $timezone) == tz_time(time(), $member[0]['m_timezone_offset'])) {
                $timezone = $member[0]['m_timezone_offset'];
            }
            // If equivalent, don't change
        }
        $test = $GLOBALS['FORUM_DB']->query_value_null_ok('f_members', 'id', array('m_username' => $username));
        if (!is_null($test)) {
            $update_map = array('m_username' => $username, 'm_dob_day' => $dob_day, 'm_dob_month' => $dob_month, 'm_dob_year' => $dob_year);
            if ($email_address != '') {
                $update_map['m_email_address'] = $email_address;
            }
            if ($avatar_url !== NULL && ($test == '' || strpos($test, 'facebook') !== false || strpos($test, 'fbcdn') !== false)) {
                if ($timezone !== NULL) {
                    $update_map['m_timezone_offset'] = $timezone;
                }
                $update_map['m_avatar_url'] = $avatar_url;
                $update_map['m_photo_url'] = $photo_url;
                $update_map['m_photo_thumb_url'] = $photo_thumb_url;
            }
            $GLOBALS['FORUM_DB']->query_update('f_members', $update_map, array('m_password_compat_scheme' => 'facebook', 'm_pass_hash_salted' => strval($facebook_uid)), '', 1);
            if ($username != $member[0]['m_username']) {
                // Fix cacheing for usernames
                $to_fix = array('f_forums/f_cache_last_username', 'f_posts/p_poster_name_if_guest', 'f_topics/t_cache_first_username', 'f_topics/t_cache_last_username');
                foreach ($to_fix as $fix) {
                    list($table, $field) = explode('/', $fix);
                    $GLOBALS['FORUM_DB']->query_update($table, array($field => $username), array($field => $member[0]['m_username']));
                }
            }
        }
    }
    // Not logged in before using Facebook, so we need to create an account, or bind to the active ocPortal login if there is one
    $in_a_sane_place = get_page_name() != 'login' && (running_script('index') || running_script('execute_temp'));
    // If we're in some weird script, or the login module UI, it's not a sane place, don't be doing account creation yet
    if (is_null($member) && $in_a_sane_place) {
        // Bind to existing ocPortal login?
        if (!is_null($current_logged_in_member)) {
            /*if (post_param_integer('associated_confirm',0)==0)		Won't work because Facebook is currently done in JS and cookies force this. If user wishes to cancel they must go to http://www.facebook.com/settings?tab=applications and remove the app, then run a lost password reset.
            		{
            			$title=get_page_title('LOGIN_FACEBOOK_HEADER');
            			$message=do_lang_tempcode('LOGGED_IN_SURE_FACEBOOK',escape_html($GLOBALS['FORUM_DRIVER']->get_username($current_logged_in_member)));
            			$middle=do_template('YESNO_SCREEN',array('TITLE'=>$title,'TEXT'=>$message,'HIDDEN'=>form_input_hidden('associated_confirm','1'),'URL'=>get_self_url_easy()));
            			$tpl=globalise($middle,NULL,'',true);
            			$tpl->evaluate_echo();
            			exit();
            		}*/
            $GLOBALS['FORUM_DB']->query_update('f_members', array('m_password_compat_scheme' => 'facebook', 'm_pass_hash_salted' => $facebook_uid), array('id' => $current_logged_in_member), '', 1);
            require_code('site');
            require_lang('facebook');
            attach_message(do_lang_tempcode('FACEBOOK_ACCOUNT_CONNECTED', escape_html(get_site_name()), escape_html($GLOBALS['FORUM_DRIVER']->get_username($current_logged_in_member)), array(escape_html($username))), 'inform');
            return $current_logged_in_member;
        }
        // If we're still here, we have to create a new account...
        // -------------------------------------------------------
        $completion_form_submitted = post_param('email_address', '') != '';
        // If there's a conflicting username, we may need to change it (suffix a number)
        require_code('ocf_members_action2');
        $username = get_username_from_human_name($username);
        // Ask ocP to finish off the profile from the information presented in the POST environment (a standard mechanism in ocPortal, for third party logins of various kinds)
        require_lang('ocf');
        require_code('ocf_members');
        require_code('ocf_groups');
        require_code('ocf_members2');
        require_code('ocf_members_action');
        $_custom_fields = ocf_get_all_custom_fields_match(ocf_get_all_default_groups(true), NULL, NULL, NULL, 1);
        if (!$completion_form_submitted && count($_custom_fields) != 0 && get_value('no_finish_profile') !== '1') {
            $GLOBALS['FACEBOOK_FINISHING_PROFILE'] = true;
            $middle = ocf_member_external_linker_ask($username, 'facebook', $email_address, $dob_day, $dob_month, $dob_year);
            $tpl = globalise($middle, NULL, '', true);
            $tpl->evaluate_echo();
            exit;
        } else {
            $username = post_param('username', $username);
            if (count($_custom_fields) != 0 && get_value('no_finish_profile') !== '1') {
                // Was not auto-generated, so needs to be checked
                ocf_check_name_valid($username, NULL, NULL);
            }
            $member = ocf_member_external_linker($username, $facebook_uid, 'facebook', false, $email_address, $dob_day, $dob_month, $dob_year, $timezone, $language, $avatar_url, $photo_url, $photo_thumb_url);
        }
    }
    if (!is_null($member)) {
        require_code('users_inactive_occasionals');
        create_session($member, 1, isset($_COOKIE[get_member_cookie() . '_invisible']) && $_COOKIE[get_member_cookie() . '_invisible'] == '1');
        // This will mark it as confirmed
    }
    return $member;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:facebook_connect.php


示例15: is_mobile

/**
 * Look at the user's browser, and decide if they are viewing on a mobile device or not.
 *
 * @param  ?string		The user agent (NULL: get from environment, current user's browser)
 * @param  boolean		Whether to always tell the truth (even if the current page does not have mobile support)
 * @return boolean		Whether the user is using a mobile device
 */
function is_mobile($user_agent = NULL, $truth = false)
{
    $user_agent_given = $user_agent !== NULL;
    if ($user_agent === NULL) {
        $user_agent = ocp_srv('HTTP_USER_AGENT');
    }
    global $IS_MOBILE, $IS_MOBILE_TRUTH;
    if (!$user_agent_given) {
        if (($truth ? $IS_MOBILE_TRUTH : $IS_MOBILE) !== NULL) {
            return $truth ? $IS_MOBILE_TRUTH : $IS_MOBILE;
        }
    }
    if (!function_exists('get_option') || get_option('mobile_support') == '0') {
        $IS_MOBILE = false;
        $IS_MOBILE_TRUTH = false;
        return false;
    }
    global $SITE_INFO;
    if ((!isset($SITE_INFO['assume_full_mobile_support']) || $SITE_INFO['assume_full_mobile_support'] == '0') && isset($GLOBALS['FORUM_DRIVER']) && !$truth && running_script('index') && ($theme = $GLOBALS['FORUM_DRIVER']->get_theme()) != 'default') {
        $ini_path = ($theme == 'default' ? get_file_base() : get_custom_file_base()) . '/themes/' . $theme . '/theme.ini';
        if (is_file($ini_path)) {
            require_code('files');
            $details = better_parse_ini_file($ini_path);
            if (isset($details['mobile_pages']) && $details['mobile_pages'] != '' && preg_match('#(^|,)\\s*' . str_replace('#', '\\#', preg_quote(get_page_name())) . '\\s*(,|$)#', $details['mobile_pages']) == 0) {
                $IS_MOBILE = false;
                return false;
            }
        }
    }
    if (!$user_agent_given) {
        $val = get_param_integer('keep_mobile', NULL);
        if ($val !== NULL) {
            if (isset($GLOBALS['FORUM_DRIVER'])) {
                $IS_MOBILE = $val == 1;
            }
            $IS_MOBILE_TRUTH = $IS_MOBILE;
            return $IS_MOBILE;
        }
    }
    // The set of browsers
    $browsers = array('WML', 'WAP', 'Wap', 'MIDP', 'Mobile', 'Smartphone', 'WebTV', 'Minimo', 'Fennec', 'Mobile Safari', 'Android', 'lynx', 'Links', 'iPhone', 'iPod', 'Opera Mobi', 'Opera Mini', 'BlackBerry', 'Windows Phone', 'Windows CE', 'Symbian', 'nook browser', 'Blazer', 'PalmOS', 'webOS', 'SonyEricsson', 'Nintendo', 'PlayStation Portable', 'UP.Browser', 'UP.Link', 'NetFront', 'Teleca', 'UCWEB', 'DDIPOCKET', 'SEMC-Browser', 'DoCoMo', 'Xda', 'ReqwirelessWeb', 'AvantGo');
    $exceptions = array('iPad');
    if ((!isset($SITE_INFO['no_extra_mobiles']) || $SITE_INFO['no_extra_mobiles'] == '0') && is_file(get_file_base() . '/text_custom/pdas.txt')) {
        require_code('files');
        $pdas = better_parse_ini_file(get_file_base() . '/text_custom/pdas.txt');
        foreach ($pdas as $key => $val) {
            if ($val == 1) {
                $browsers[] = $key;
            } else {
                $exceptions[] = $key;
            }
        }
    }
    // The test
    $result = preg_match('/(' . implode('|', $browsers) . ')/i', $user_agent) != 0 && preg_match('/(' . implode('|', $exceptions) . ')/i', $user_agent) == 0;
    if (!$user_agent_given) {
        if (isset($GLOBALS['FORUM_DRIVER'])) {
            $IS_MOBILE = $result;
            $IS_MOBILE_TRUTH = $IS_MOBILE;
        }
    }
    return $result;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:70,代码来源:support.php


示例16: handle_symbol_preprocessing


//.........这里部分代码省略.........
            }
            require_javascript($param[0]);
            return;
        case 'FACILITATE_AJAX_BLOCK_CALL':
            require_javascript('javascript_ajax');
            return;
        case 'CSS_INCLUDE':
            if (!array_key_exists(3, $bit) || is_null($bit[3])) {
                return;
            }
            $param = $bit[3];
            foreach ($param as $i => $p) {
                if (is_object($p)) {
                    $param[$i] = $p->evaluate();
                }
            }
            require_css($param[0]);
            return;
        case 'LOAD_PANEL':
            if (!array_key_exists(3, $bit) || is_null($bit[3])) {
                return;
            }
            $param = $bit[3];
            foreach ($param as $i => $p) {
                if (is_object($p)) {
                    $param[$i] = $p->evaluate();
                }
            }
            global $LOADED_PANELS;
            if (array_key_exists(serialize($param), $LOADED_PANELS)) {
                return;
            }
            if (array_key_exists(0, $param)) {
                if (substr(get_page_name(), 0, 6) != 'panel_') {
                    if (strpos($param[0], ':') !== false) {
                        $param = array_reverse(explode(':', $param[0], 2));
                    }
                    if (substr($param[0], 0, 6) == 'panel_') {
                        $param[0] = substr($param[0], 6);
                    }
                    global $ZONE;
                    $wide_high = is_wide_high();
                    $wide = is_wide();
                    if (($wide == 0 || $wide_high == 0 && ($param[0] == 'bottom' || $param[0] == 'top')) && (get_option('site_closed') == '0' || $GLOBALS['IS_ACTUALLY_ADMIN'] || has_specific_permission(get_member(), 'access_closed_site'))) {
                        $tp_value = request_page('panel_' . $param[0], false, array_key_exists(1, $param) ? $param[1] : NULL, NULL);
                        $sub_children = array();
                        $tp_value->handle_symbol_preprocessing();
                        if ($GLOBALS['RECORD_TEMPLATES_TREE']) {
                            $children[] = array(':panel: ' . $param[0], $sub_children, isset($tp_value->fresh) ? $tp_value->fresh : false);
                        }
                        $value = $tp_value->evaluate();
                    } else {
                        $value = '';
                    }
                } else {
                    $value = '';
                }
            } else {
                $value = '';
            }
            $LOADED_PANELS[serialize($param)] = $value;
            return;
        case 'JS_TEMPCODE':
            if ($GLOBALS['RECORD_TEMPLATES_TREE']) {
                if (!array_key_exists(3, $bit) || is_null($bit[3])) {
                    return;
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:tempcode__runtime.php


示例17: load_field_restrictions

/**
 * Find all restrictions that apply to our page/type.
 *
 * @param  ?string		The page name scoped for (NULL: current page)
 * @param  ?string		The page type scoped for (NULL: current type)
 * @return array			List of fields, each of which is a map (restriction => attributes)
 */
function load_field_restrictions($this_page = NULL, $this_type = NULL)
{
    global $FIELD_RESTRICTIONS;
    if ($FIELD_RESTRICTIONS === NULL) {
        $FIELD_RESTRICTIONS = array();
        if (function_exists('xml_parser_create')) {
            $temp = new field_restriction_loader();
            if (is_null($this_page)) {
                $this_page = get_page_name();
            }
            if (is_null($this_type)) {
                $this_type = get_param('type', array_key_exists('type', $_POST) ? $_POST['type'] : 'misc');
            }
            $temp->this_page = $this_page;
            $temp->this_type = $this_type;
            $temp->go();
        }
    }
    return $FIELD_RESTRICTIONS;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:27,代码来源:input_filter.php


示例18: render_as_comment_topic

 /**
  * Render a comment topic.
  *
  * @param  ID_TEXT		Content type to show topic for
  * @param  ID_TEXT		Content ID of content type to show topic for
  * @param  boolean		Whether this resource allows comments (if not, this function does nothing - but it's nice to move out this common logic into the shared function)
  * @param  boolean		Whether the comment box will be invisible if there are not yet any comments (and you're not staff)
  * @param  ?string		The name of the forum to use (NULL: default comment forum)
  * @param  ?string		The default post to use (NULL: standard courtesy warning)
  * @param  ?mixed			The raw comment array (NULL: lookup). This is useful if we want to pass it through a filter
  * @param  boolean		Whether to skip permission checks
  * @param  boolean		Whether to reverse the posts
  * @param  ?MEMBER		User to highlight the posts of (NULL: none)
  * @param  boolean		Whether to allow ratings along with the comment (like reviews)
  * @return tempco 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_page_of_comment函数代码示例发布时间:2022-05-15
下一篇:
PHP get_page_list函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap