当前位置: 首页>>代码示例>>PHP>>正文


PHP forward函数代码示例

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


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

示例1: __construct

 function __construct()
 {
     adminGateKeeper();
     $ip = pageArray(2);
     if ($ip) {
         new BlacklistIp($ip);
         $params = array("type" => "User", "metadata_name_value_pairs" => array(array("name" => "ip1", "value" => $ip), array("name" => "ip2", "value" => $ip)), "metadata_name_value_pairs_operand" => "OR");
         $users = getEntities($params);
         $tables = Dbase::getAllTables(false);
         foreach ($users as $user) {
             new BlacklistEmail($user->email);
             $guid = $user->guid;
             foreach ($tables as $table) {
                 $entities = getEntities(array("type" => $table, "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => $guid), array("name" => "container_guid", "value" => $guid)), "metadata_name_value_pairs_operand" => "OR"));
                 if ($entities) {
                     foreach ($entities as $entity) {
                         $entity->delete();
                     }
                 }
             }
             $user->delete();
         }
         new SystemMessage("Ip {$ip} has been banned, and all users using it have been deleted.");
         forward("home");
     }
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:26,代码来源:BanIpActionHandler.php

示例2: notifications_page_handler

/**
 * Route page requests
 *
 * @param array $page Array of url parameters
 * @return bool
 */
function notifications_page_handler($page)
{
    gatekeeper();
    $current_user = elgg_get_logged_in_user_entity();
    // default to personal notifications
    if (!isset($page[0])) {
        $page[0] = 'personal';
    }
    if (!isset($page[1])) {
        forward("notifications/{$page[0]}/{$current_user->username}");
    }
    $user = get_user_by_username($page[1]);
    if ($user->guid != $current_user->guid && !$current_user->isAdmin()) {
        forward();
    }
    $base = elgg_get_plugins_path() . 'notifications';
    // note: $user passed in
    switch ($page[0]) {
        case 'group':
            require "{$base}/groups.php";
            break;
        case 'personal':
            require "{$base}/index.php";
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:nogsus,项目名称:Elgg,代码行数:35,代码来源:start.php

示例3: _elgg_cron_page_handler

/**
 * Cron handler
 *
 * @param array $page Pages
 *
 * @return bool
 * @throws CronException
 * @access private
 */
function _elgg_cron_page_handler($page)
{
    if (!isset($page[0])) {
        forward();
    }
    if (PHP_SAPI !== 'cli' && elgg_get_config('security_protect_cron')) {
        elgg_signed_request_gatekeeper();
    }
    $period = strtolower($page[0]);
    $allowed_periods = elgg_get_config('elgg_cron_periods');
    if ($period != 'run' && !in_array($period, $allowed_periods)) {
        throw new \CronException("{$period} is not a recognized cron period.");
    }
    if ($period == 'run') {
        _elgg_cron_run();
    } else {
        // Get a list of parameters
        $params = array();
        $params['time'] = time();
        // Data to return to
        $old_stdout = "";
        ob_start();
        $msg_key = "cron_latest:{$period}:msg";
        $msg = elgg_echo('admin:cron:started', [$period, date('r', time())]);
        elgg_get_site_entity()->setPrivateSetting($msg_key, $msg);
        $old_stdout = elgg_trigger_plugin_hook('cron', $period, $params, $old_stdout);
        $std_out = ob_get_clean();
        $msg = $std_out . $old_stdout;
        echo $msg;
        elgg_get_site_entity()->setPrivateSetting($msg_key, $msg);
    }
    return true;
}
开发者ID:elgg,项目名称:elgg,代码行数:42,代码来源:cron.php

示例4: twitter_api_pagehandler

/**
 * Serves pages for twitter.
 *
 * @param array $page
 */
function twitter_api_pagehandler($page)
{
    if (!isset($page[0])) {
        forward();
    }
    switch ($page[0]) {
        case 'authorize':
            twitter_api_authorize();
            break;
        case 'revoke':
            twitter_api_revoke();
            break;
        case 'forward':
            twitter_api_forward();
            break;
        case 'login':
            twitter_api_login();
            break;
        case 'interstitial':
            gatekeeper();
            // only let twitter users do this.
            $guid = elgg_get_logged_in_user_guid();
            $twitter_name = elgg_get_plugin_user_setting('twitter_name', $guid, 'twitter_api');
            if (!$twitter_name) {
                register_error(elgg_echo('twitter_api:invalid_page'));
                forward();
            }
            $pages = dirname(__FILE__) . '/pages/twitter_api';
            include "{$pages}/interstitial.php";
            break;
        default:
            forward();
            break;
    }
}
开发者ID:redvabel,项目名称:Vabelgg,代码行数:40,代码来源:start.php

示例5: spam_login_filter_verify_action_hook

function spam_login_filter_verify_action_hook($hook, $entity_type, $returnvalue, $params)
{
    //Check against stopforumspam and domain blacklist
    $email = get_input('email');
    $ip = spam_login_filter_get_ip();
    if (spam_login_filter_check_spammer($email, $ip)) {
        return true;
    } else {
        //Check if the ip exists
        $options = array("type" => "object", "subtype" => "spam_login_filter_ip", "metadata_name_value_pairs" => array("name" => "ip_address", "value" => $ip), "count" => TRUE);
        $ia = elgg_set_ignore_access(true);
        $spam_login_filter_ip_list = elgg_get_entities_from_metadata($options);
        if ($spam_login_filter_ip_list == 0) {
            //Create the banned ip
            $ip_obj = new ElggObject();
            $ip_obj->subtype = 'spam_login_filter_ip';
            $ip_obj->access_id = ACCESS_PRIVATE;
            $ip_obj->ip_address = $ip;
            $ip_obj->owner_guid = elgg_get_site_entity()->guid;
            $ip_obj->container_guid = elgg_get_site_entity()->guid;
            $ip_obj->save();
        }
        elgg_set_ignore_access($ia);
        //return false;
        forward();
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:27,代码来源:start.php

示例6: notifications_page_handler

/**
 * Route page requests
 *
 * @param array $page Array of url parameters
 * @return bool
 */
function notifications_page_handler($page)
{
    elgg_gatekeeper();
    $current_user = elgg_get_logged_in_user_entity();
    // default to personal notifications
    if (!isset($page[0])) {
        $page[0] = 'personal';
    }
    if (!isset($page[1])) {
        forward("notifications/{$page[0]}/{$current_user->username}");
    }
    set_input('username', $page[1]);
    // note: $user passed in
    switch ($page[0]) {
        case 'group':
            echo elgg_view_resource('notifications/groups');
            break;
        case 'personal':
            echo elgg_view_resource('notifications/index');
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:bhargavgarlapati,项目名称:Elgg,代码行数:31,代码来源:start.php

示例7: __construct

 public function __construct()
 {
     Setting::set("allow_video_uploads", getInput("allow_video_uploads"));
     Setting::set("ffmpeg_ffmprobe_executable_path", getInput("ffmpeg_ffmprobe_executable_path"));
     new SystemMessage("Your settings have been updated.");
     forward();
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:7,代码来源:VideoSettingsActionHandler.php

示例8: __construct

 public function __construct()
 {
     if (!pageArray(2) || !pageArray(3)) {
         return false;
     }
     $email = pageArray(2);
     $code = pageArray(3);
     runHook("action:verify_email:before");
     $access = getIgnoreAccess();
     setIgnoreAccess();
     $user = getEntities(array("type" => "User", "metadata_name_value_pairs" => array(array("name" => "email", "value" => $email), array("name" => "email_verification_code", "value" => $code))));
     setIgnoreAccess($access);
     if (!$user) {
         new SystemMessage(translate("system_message:email_could_not_be_verified"));
         forward("home");
     }
     $user = $user[0];
     $user->email_verification_code = NULL;
     $user->verified = "true";
     $user->save();
     runHook("action:verify_email:after");
     new SystemMessage(translate("system_message:email_verified"));
     new Activity($user->guid, "activity:joined", array($user->getURL(), $user->full_name));
     forward("login");
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:25,代码来源:VerifyEmailActionHandler.php

示例9: stripe_page_handler

/**
 * Stripe related pages
 *
 * @param array $page
 * @param string $handler
 * @return boolean
 */
function stripe_page_handler($page, $handler)
{
    gatekeeper();
    $username = elgg_extract(0, $page, false);
    if ($username) {
        $user = get_user_by_username($username);
    }
    if (!elgg_instanceof($user) || !$user->canEdit()) {
        $user = elgg_get_logged_in_user_entity();
        forward("{$handler}/{$user->username}");
    }
    elgg_set_context('settings');
    elgg_set_page_owner_guid($user->guid);
    elgg_push_breadcrumb(elgg_echo('stripe:billing'), 'billing');
    $context = elgg_extract(1, $page, 'cards');
    $action = elgg_extract(2, $page, 'all');
    $view = "stripe/pages/{$context}/{$action}";
    if (elgg_view_exists($view)) {
        $params = array('entity' => $user, 'id' => elgg_extract(3, $page, false), 'context' => $page);
        $title = elgg_echo("stripe:{$context}:{$action}");
        $content = elgg_view($view, $params);
        $sidebar = elgg_view('stripe/sidebar', $params);
        $filter = elgg_view("stripe/filters/{$context}/{$action}", $params);
    }
    if ($content) {
        if (elgg_is_xhr()) {
            echo $content;
        } else {
            $layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'sidebar' => $sidebar, 'filter' => $filter));
            echo elgg_view_page($title, $layout);
        }
        return true;
    }
    return false;
}
开发者ID:Daltonmedia,项目名称:stripe,代码行数:42,代码来源:page_handlers.php

示例10: elgg_modifications_pagesetup

function elgg_modifications_pagesetup()
{
    $user = elgg_get_logged_in_user_entity();
    if (!$user) {
        return;
    }
    if (elgg_in_context("accept_terms")) {
        return;
    }
    $site = elgg_get_site_entity();
    if ($site->isPublicPage()) {
        return;
    }
    if (!empty($_SESSION["terms_accepted"])) {
        return;
    }
    if (elgg_get_plugin_setting("accept_terms", "elgg_modifications") === "no") {
        return;
    }
    $user_ts = $user->getPrivateSetting("general_terms_accepted");
    if (empty($user_ts)) {
        $_SESSION["terms_forward_from"] = current_page_url();
        forward("accept_terms");
    } else {
        // user has accepted the terms, so don't check again
        $_SESSION["terms_accepted"] = $user_ts;
    }
}
开发者ID:pleio,项目名称:elgg_modifications,代码行数:28,代码来源:start.php

示例11: profile_page_handler

/**
 * Profile page handler
 *
 * @param array $page Array of URL segments passed by the page handling mechanism
 * @return bool
 */
function profile_page_handler($page)
{
    if (isset($page[0])) {
        $username = $page[0];
        $user = get_user_by_username($username);
        elgg_set_page_owner_guid($user->guid);
    } elseif (elgg_is_logged_in()) {
        forward(elgg_get_logged_in_user_entity()->getURL());
    }
    // short circuit if invalid or banned username
    if (!$user || $user->isBanned() && !elgg_is_admin_logged_in()) {
        register_error(elgg_echo('profile:notfound'));
        forward();
    }
    $action = NULL;
    if (isset($page[1])) {
        $action = $page[1];
    }
    if ($action == 'edit') {
        // use the core profile edit page
        $base_dir = elgg_get_root_path();
        require "{$base_dir}pages/profile/edit.php";
        return true;
    }
    $content = elgg_view('profile/layout', array('entity' => $user));
    $body = elgg_view_layout('one_column', array('content' => $content));
    echo elgg_view_page($user->name, $body);
    return true;
}
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:35,代码来源:start.php

示例12: cron_page_handler

/**
 * Cron handler for redirecting pages.
 *
 * @param unknown_type $page
 */
function cron_page_handler($page)
{
    global $CONFIG;
    if ($page[0]) {
        switch (strtolower($page[0])) {
            case 'minute':
            case 'fiveminute':
            case 'fifteenmin':
            case 'halfhour':
            case 'hourly':
            case 'daily':
            case 'weekly':
            case 'monthly':
            case 'yearly':
            case 'reboot':
                set_input('period', $page[0]);
                break;
            default:
                throw new CronException(sprintf(elgg_echo('CronException:unknownperiod'), $page[0]));
        }
        // Include cron handler
        include $CONFIG->path . "engine/handlers/cron_handler.php";
    } else {
        forward();
    }
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:cron.php

示例13: _elgg_comments_page_handler

/**
 * Page handler for generic comments manipulation.
 *
 * @param array $page
 * @return bool
 * @access private
 */
function _elgg_comments_page_handler($page)
{
    switch ($page[0]) {
        case 'edit':
            elgg_gatekeeper();
            if (empty($page[1])) {
                register_error(elgg_echo('generic_comment:notfound'));
                forward(REFERER);
            }
            $comment = get_entity($page[1]);
            if (!$comment instanceof \ElggComment || !$comment->canEdit()) {
                register_error(elgg_echo('generic_comment:notfound'));
                forward(REFERER);
            }
            $target = $comment->getContainerEntity();
            if (!$target instanceof \ElggEntity) {
                register_error(elgg_echo('generic_comment:notfound'));
                forward(REFERER);
            }
            $title = elgg_echo('generic_comments:edit');
            elgg_push_breadcrumb($target->getDisplayName(), $target->getURL());
            elgg_push_breadcrumb($title);
            $params = array('entity' => $target, 'comment' => $comment, 'is_edit_page' => true);
            $content = elgg_view_form('comment/save', null, $params);
            $params = array('content' => $content, 'title' => $title, 'filter' => '');
            $body = elgg_view_layout('content', $params);
            echo elgg_view_page($title, $body);
            return true;
            break;
        default:
            return false;
            break;
    }
}
开发者ID:sephiroth88,项目名称:Elgg,代码行数:41,代码来源:comments.php

示例14: __construct

 public function __construct()
 {
     $guid = pageArray(2);
     adminGateKeeper();
     $plugin = getEntity($guid);
     Setting::updateSettingsTable();
     clearCache();
     Cache::clear();
     Cache::clear();
     if ($plugin->enable()) {
         new SystemMessage("Plugin Enabled");
         new Cache("enabled_plugins_", false, "site");
         new Cache("enabled_plugins_reversed", false, "site");
         Systemvariable::set("setup_complete", false);
         forward("admin/plugins");
     }
     Setting::updateSettingsTable();
     clearCache();
     Cache::clear();
     Cache::clear();
     Admintab::deleteAll();
     $translations = getEntities(array("type" => "Translationentity"));
     if ($translations) {
         foreach ($translations as $translation) {
             $translation->delete();
         }
     }
     new SystemMessage("Your plugin can't be enabled.  Check requirements");
     forward("admin/plugins");
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:30,代码来源:EnablePluginActionHandler.php

示例15: uservalidationbyemail_page_handler

/**
 * Get security token, forward to action.
 *
 * @param unknown_type $page
 * @return unknown_type
 */
function uservalidationbyemail_page_handler($page)
{
    global $CONFIG;
    if (isset($page[0]) && $page[0] == 'confirm') {
        $code = sanitise_string(get_input('c', FALSE));
        $user_guid = get_input('u', FALSE);
        // new users are not enabled by default.
        $access_status = access_get_show_hidden_status();
        access_show_hidden_entities(true);
        $user = get_entity($user_guid);
        if ($code && $user) {
            if (uservalidationbyemail_validate_email($user_guid, $code)) {
                system_message(elgg_echo('email:confirm:success'));
                $user = get_entity($user_guid);
                $user->enable();
                notify_user($user_guid, $CONFIG->site->guid, sprintf(elgg_echo('email:validate:success:subject'), $user->username), sprintf(elgg_echo('email:validate:success:body'), $user->name), NULL, 'email');
            } else {
                register_error(elgg_echo('email:confirm:fail'));
            }
        } else {
            register_error(elgg_echo('email:confirm:fail'));
        }
        access_show_hidden_entities($access_status);
    } else {
        register_error(elgg_echo('email:confirm:fail'));
    }
    forward();
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:34,代码来源:start.php


注:本文中的forward函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。