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


PHP post_str函数代码示例

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


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

示例1: api_auth_oauth2_get_access_token

function api_auth_oauth2_get_access_token(&$method)
{
    # https://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-20#section-2.1
    $require_header = $GLOBALS['cfg']['api_oauth2_require_authentication_header'];
    $check_header = $GLOBALS['cfg']['api_oauth2_check_authentication_header'];
    if ($require_header || $check_header) {
        $headers = apache_request_headers();
        $token = null;
        if (!isset($headers['authorization'])) {
            if ($require_header) {
                return null;
            }
        } else {
            if (preg_match("/Bearer\\s+([a-zA-Z0-9\\+\\/\\=]+)\$/", $headers['authorization'], $m)) {
                $token = $m[1];
                $token = base64_decode($token);
            }
        }
        if ($token || $require_header) {
            return $token;
        }
    }
    if ($GLOBALS['cfg']['api_oauth2_allow_get_parameters']) {
        return request_str('access_token');
    }
    return post_str('access_token');
}
开发者ID:whosonfirst,项目名称:flamework-api,代码行数:27,代码来源:lib_api_auth_oauth2.php

示例2: mod_comment

function mod_comment()
{
    $x = "";
    $reason = post_str('reason', true);
    if ($reason) {
        $x .= "\nModerator comment: {$reason}\n";
    }
    return $x;
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:9,代码来源:forum_moderate_post_action.php

示例3: crumb_ensure_valid_crumb

function crumb_ensure_valid_crumb($template = '/page_bad_crumb.txt')
{
    $crumb = post_str('crumb');
    if (!crumb_validate_crumb($crumb, $GLOBALS['cfg']['user'])) {
        $GLOBALS['error']['badcrumb'] = 1;
        $smarty->display($template);
        exit;
    }
    return 1;
}
开发者ID:jacques,项目名称:flamework,代码行数:10,代码来源:lib_crumb.php

示例4: do_updates

function do_updates()
{
    $apps = BoincApp::enum("");
    foreach ($apps as $app) {
        $id = $app->id;
        // Change deprecated status?
        //
        $field = "deprecated_" . $id;
        $new_v = post_str($field, true) == 'on' ? 1 : 0;
        $old_v = $app->deprecated;
        if ($new_v != $old_v) {
            $app->update("deprecated={$new_v}");
        }
        $field = "weight_" . $id;
        $new_v = $_POST[$field] + 0;
        $old_v = $app->weight;
        if ($new_v != $old_v) {
            $app->update("weight={$new_v}");
        }
        $field = "homogeneous_redundancy_" . $id;
        $new_v = $_POST[$field];
        $old_v = $app->homogeneous_redundancy;
        if ($new_v != $old_v) {
            $app->update("homogeneous_redundancy={$new_v}");
        }
        $field = "homogeneous_app_version_" . $id;
        $new_v = post_str($field, true) == 'on' ? 1 : 0;
        $old_v = $app->homogeneous_app_version;
        if ($new_v != $old_v) {
            $app->update("homogeneous_app_version={$new_v}");
        }
        $field = "non_cpu_intensive_" . $id;
        $new_v = post_str($field, true) == 'on' ? 1 : 0;
        $old_v = $app->non_cpu_intensive;
        if ($new_v != $old_v) {
            $app->update("non_cpu_intensive={$new_v}");
        }
    }
    // Adding a new application
    if (post_str('add_app', true)) {
        $name = mysql_real_escape_string($_POST['add_name']);
        $user_friendly_name = mysql_real_escape_string($_POST['add_user_friendly_name']);
        if (empty($name) || empty($user_friendly_name)) {
            $commands .= "<p><font color='red'>\n                To add a new application please supply both a brief name and a\n                longer 'user-friendly' name.</font></p>\n            ";
        } else {
            $now = time();
            $cmd = "INSERT INTO app (name,user_friendly_name,create_time) " . "VALUES ('{$name}', '{$user_friendly_name}',{$now})";
            $commands .= "<P><pre>{$cmd}</pre>\n";
            mysql_query($cmd);
        }
    }
}
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:52,代码来源:manage_apps.php

示例5: api_privatesquare_venues_checkin

function api_privatesquare_venues_checkin()
{
    $venue_id = post_str("venue_id");
    $status_id = post_int32("status_id");
    if (!$venue_id) {
        api_output_error(999, "Missing venue ID");
    }
    if (!isset($status_id)) {
        api_output_error(999, "Missing status ID");
    }
    $fsq_user = foursquare_users_get_by_user_id($GLOBALS['cfg']['user']['id']);
    $checkin = array('user_id' => $GLOBALS['cfg']['user']['id'], 'venue_id' => $venue_id, 'status_id' => $status_id);
    # where am I?
    $venue = foursquare_venues_get_by_venue_id($venue_id);
    if (!$venue) {
        $rsp = foursquare_venues_archive_venue($venue_id);
        if ($rsp['ok']) {
            $venue = $rsp['venue'];
        }
    }
    if ($venue) {
        $checkin['locality'] = $venue['locality'];
        $checkin['latitude'] = $venue['latitude'];
        $checkin['longitude'] = $venue['longitude'];
    }
    # check to see if we're checking in to 4sq too
    if ($broadcast = post_str("broadcast")) {
        $method = 'checkins/add';
        $args = array('oauth_token' => $fsq_user['oauth_token'], 'venueId' => $venue_id, 'broadcast' => $broadcast);
        $more = array('method' => 'POST');
        $rsp = foursquare_api_call($method, $args, $more);
        if ($rsp['ok']) {
            $checkin['checkin_id'] = $rsp['rsp']['checkin']['id'];
        }
        # on error, then what?
    }
    if ($GLOBALS['cfg']['enable_feature_weather_tracking']) {
        loadlib("weather_google");
        $rsp = weather_google_conditions($checkin['latitude'], $checkin['longitude']);
        if ($rsp['ok']) {
            $conditions = $rsp['conditions'];
            $conditions['source'] = $rsp['source'];
            $checkin['weather'] = json_encode($conditions);
        }
    }
    $rsp = privatesquare_checkins_create($checkin);
    if (!$rsp['ok']) {
        api_output_error(999, "Check in failed");
    }
    $out = array('checkin' => $rsp['checkin']);
    api_output_ok($out);
}
开发者ID:nilswalk,项目名称:privatesquare,代码行数:52,代码来源:lib_api_privatesquare_venues.php

示例6: add_app

function add_app()
{
    $name = BoincDb::escape_string(post_str('add_name'));
    $user_friendly_name = BoincDb::escape_string(post_str('add_user_friendly_name'));
    if (empty($name) || empty($user_friendly_name)) {
        admin_error_page("To add a new application please supply both a brief name and a longer 'user-friendly' name.</font></p>");
    }
    $now = time();
    $id = BoincApp::insert("(name,user_friendly_name,create_time) VALUES ('{$name}', '{$user_friendly_name}', {$now})");
    if (!$id) {
        admin_error_page("insert failed");
    }
    echo "Application added.\n        <p>\n        You must restart the project for this to take effect.\n    ";
}
开发者ID:aggroskater,项目名称:boinc,代码行数:14,代码来源:manage_apps.php

示例7: update

function update()
{
    $id = post_int("id");
    $av = BoincAppVersion::lookup_id($id);
    if (!$av) {
        error_page("no such app version");
    }
    $n = post_str("beta", true) ? 1 : 0;
    $av->update("beta={$n}");
    $n = post_str("deprecated", true) ? 1 : 0;
    $av->update("deprecated={$n}");
    $n = post_int("min_core_version");
    $av->update("min_core_version={$n}");
    $n = post_int("max_core_version");
    $av->update("max_core_version={$n}");
    echo "<b>Updated app version {$id}.  This change will take effect when you restart the project.</b><p>";
}
开发者ID:entibasse,项目名称:superhost,代码行数:17,代码来源:manage_app_versions.php

示例8: loadlib

include "../include/init.php";
loadlib("god");
features_ensure_enabled("flickr_push");
loadlib("flickr_push");
loadlib("flickr_backups");
loadlib("flickr_push_photos");
loadlib("flickr_push_subscriptions");
$id = get_int32("id");
$sub = flickr_push_subscriptions_get_by_id($id);
if (!$sub) {
    error_404();
}
$crumb_key = "delete_feed";
$GLOBALS['smarty']->assign("crumb_key", $crumb_key);
if (post_str("delete") && crumb_check($crumb_key)) {
    $feed_rsp = flickr_push_unsubscribe($sub);
    $GLOBALS['smarty']->assign("delete_feed", $feed_rsp);
    if ($feed_rsp['ok']) {
        $sub_rsp = flickr_push_subscriptions_delete($sub);
        $GLOBALS['smarty']->assign("delete_sub", $sub_rsp);
        if ($sub_rsp['ok']) {
            $redir = "{$GLOBALS['cfg']['abs_root_url']}god/push/subscriptions/{$sub['user_id']}/";
            header("location: {$redir}");
            exit;
        }
    }
}
$topic_map = flickr_push_topic_map();
$sub['str_topic'] = $topic_map[$sub['topic_id']];
if ($sub['last_update_details']) {
开发者ID:nilswalk,项目名称:parallel-flickr,代码行数:30,代码来源:push_subscription.php

示例9: check_reply_access

    $parent_post_id = 0;
}
if ($filter != "false") {
    $filter = true;
} else {
    $filter = false;
}
check_reply_access($logged_in_user, $forum, $thread);
if (!$sort_style) {
    $sort_style = $logged_in_user->prefs->thread_sorting;
} else {
    $logged_in_user->prefs->update("thread_sorting={$sort_style}");
}
$warning = null;
if ($content && !$preview) {
    if (post_str('add_signature', true) == "add_it") {
        $add_signature = true;
    } else {
        $add_signature = false;
    }
    check_tokens($logged_in_user->authenticator);
    if (!akismet_check($logged_in_user, $content)) {
        $warning = "Your post has been flagged as spam by the Akismet anti-spam system. Please modify your text and try again.";
        $preview = tra("Preview");
    } else {
        create_post($content, $parent_post_id, $logged_in_user, $forum, $thread, $add_signature);
        header('Location: forum_thread.php?id=' . $thread->id);
    }
}
page_head(tra("Post to thread"));
show_forum_header($logged_in_user);
开发者ID:Turante,项目名称:boincweb,代码行数:31,代码来源:forum_reply.php

示例10: urldecode

$next_url = urldecode($next_url);
$next_url = sanitize_local_url($next_url);
if (strlen($next_url) == 0) {
    $next_url = "home.php";
}
$perm = false;
if (isset($_POST['stay_logged_in'])) {
    $perm = $_POST['stay_logged_in'];
}
// check for account key case.
// see if key is in URL; if not then check for POST data
//
$authenticator = get_str("key", true);
if (!$authenticator) {
    $authenticator = post_str("authenticator", true);
}
if ($authenticator) {
    login_with_auth($authenticator, $next_url, $perm);
    exit;
}
$email_addr = strtolower(sanitize_tags(post_str("email_addr", true)));
$passwd = post_str("passwd", true);
if ($email_addr && $passwd) {
    if (LDAP_HOST && !is_valid_email_addr($email_addr)) {
        login_with_ldap($email_addr, $passwd, $next_url, $perm);
    } else {
        login_with_email($email_addr, $passwd, $next_url, $perm);
    }
    exit;
}
error_page("You must supply an email address and password");
开发者ID:aggroskater,项目名称:boinc,代码行数:31,代码来源:login_action.php

示例11: get_config

//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
// This file allows people to rate posts in a thread
require_once '../inc/forum.inc';
require_once '../inc/util.inc';
$config = get_config();
if (parse_bool($config, "no_forum_rating")) {
    page_head(tra("Rating offline"));
    echo tra("This function is turned off by the project");
    page_tail();
    exit(0);
}
if (!empty($_GET['post'])) {
    $postId = get_int('post');
    $choice = post_str('submit', true);
    $rating = post_int('rating', true);
    if (!$choice) {
        $choice = get_str('choice', true);
    }
    if ($choice == SOLUTION or $choice == "p") {
        $rating = 1;
    } else {
        $rating = -1;
    }
    $user = get_logged_in_user();
    if ($choice == null && ($rating == null || $rating > 2 || $rating < -2)) {
        show_result_page(false, NULL, NULL, $choice);
    }
    $post = BoincPost::lookup_id($postId);
    $thread = BoincThread::lookup_id($post->thread);
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:31,代码来源:forum_rate.php

示例12: simulation_action

function simulation_action()
{
    $user = get_logged_in_user();
    $scen = post_str("scen");
    if (!is_dir("scenarios/{$scen}")) {
        error_page("no such scenario");
    }
    $sim_dir = "scenarios/{$scen}/simulations";
    $sim_name = create_dir_seqno($sim_dir);
    $sim_path = "{$sim_dir}/{$sim_name}";
    $policy = new POLICY("");
    $policy->duration = (double) post_str("duration");
    $policy->delta = (double) post_str("delta");
    $policy->rec_half_life = (double) post_str("rec_half_life_days") * 86400;
    $policy->existing_jobs_only = post_str("existing_jobs_only", true);
    $policy->use_hyst_fetch = post_str("use_hyst_fetch", true);
    $policy->cpu_sched_rr_only = post_str("cpu_sched_rr_only", true);
    $policy->server_uses_workload = post_str("server_uses_workload", true);
    file_put_contents("{$sim_path}/userid", "{$user->id}");
    $x = "<log_flags>\n";
    if (post_str("cpu_sched_debug", true)) {
        $x .= "<cpu_sched_debug/>\n";
    }
    if (post_str("rr_simulation", true)) {
        $x .= "<rr_simulation/>\n";
    }
    if (post_str("work_fetch_debug", true)) {
        $x .= "<work_fetch_debug/>\n";
    }
    $x .= "</log_flags>\n";
    file_put_contents("{$sim_path}/log_flags.xml", $x);
    do_sim("scenarios/{$scen}", $sim_path, $policy);
    header("Location: sim_web.php?action=show_simulation&scen={$scen}&sim={$sim_name}");
}
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:34,代码来源:sim_web.php

示例13: error_page

    case "unlock":
        $result = $thread->update("locked=0");
        $action_name = "unlocked";
        break;
    case "move":
        if ($forum->parent_type != 0) {
            error_page("No");
        }
        $fid = post_int('forumid');
        $new_forum = BoincForum::lookup_id($fid);
        $result = move_thread($thread, $forum, $new_forum);
        $action_name = "moved from {$forum->title} to {$new_forum->title}";
        break;
    case "title":
        $new_title = post_str('newtitle');
        $title = BoincDb::escape_string($new_title);
        $result = $thread->update("title='{$title}'");
        $action_name = "renamed from '{$thread->title}' to '{$new_title}'";
        break;
    default:
        error_page("Unknown action");
}
if (!$result) {
    error_page("Moderation failed");
}
$reason = post_str('reason', true);
if (!$reason) {
    $reason = "None given";
}
send_thread_moderation_email($forum, $thread, $reason, $action_name, $explanation);
header('Location: forum_thread.php?id=' . $thread->id);
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:31,代码来源:forum_moderate_thread_action.php

示例14: error_page

    if ($x != $h) {
        error_page("Invalid authenticator.\r\n\t\t\tPlease make sure you visited the complete URL;\r\n\t\t\tit may have been split across lines by your email reader.");
    }
    if (time() - $t > 86400) {
        error_page("Link has expired;\r\n\t\t\tgo <a href=get_passwd.php>here</a> to\r\n\t\t\tget a new login link by email.");
    }
    send_cookie('auth', $user->authenticator, true);
    Header("Location: home.php");
    exit;
}
// check for account key case.
// see if key is in URL; if not then check for POST data
//
$authenticator = get_str("key", true);
if (!$authenticator) {
    $authenticator = post_str("authenticator", true);
}
if (!$authenticator) {
    error_page("You must supply an account key");
}
if (substr($user->authenticator, 0, 1) == 'x') {
    //User has been bad so we are going to take away ability to post for awhile.
    error_page("This account has been administratively disabled.");
}
$user = lookup_user_auth($authenticator);
if (!$user) {
    page_head("Login failed");
    echo "There is no account with that authenticator.\r\n\t\tPlease <a href=get_passwd.php>try again</a>.\r\n\t";
    page_tail();
} else {
    Header("Location: {$next_url}");
开发者ID:Turante,项目名称:boincweb,代码行数:31,代码来源:login_action.php

示例15: make_user

            }
            if (!is_valid_country($country)) {
                echo "bad country";
                exit;
            }
            $postal_code = '';
            $user = make_user($new_email_addr, $new_name, $passwd_hash, $country, $postal_code, $project_prefs = "", $teamid = 0);
            if (!$user) {
                show_error("Couldn't create account");
            }
            if (defined('INVITE_CODES')) {
                error_log("Account '{$new_email_addr}' created using invitation code '{$invite_code}'");
            }
        }
        // Log-in user in the web
        // In success case, redirect to a fixed page so that user can
        // return to it without getting "Repost form data" stuff
        $next_url = post_str('next_url', true);
        $next_url = sanitize_local_url($next_url);
        if ($next_url) {
            Header("Location: " . URL_BASE . "{$next_url}");
        } else {
            Header("Location: " . URL_BASE . "home.php");
            send_cookie('init', "1", true);
            send_cookie('via_web', "1", true);
        }
        send_cookie('auth', $user->authenticator, true);
    }
} catch (ErrorException $e) {
    echo $e->getMessage();
}
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:31,代码来源:openid_login.php


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