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


PHP stripPost函数代码示例

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


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

示例1: prefs_save

/**
 * Commits prefs to the database.
 */
function prefs_save()
{
    global $prefs, $gmtoffset, $is_dst, $auto_dst, $timezone_key, $txp_user;
    // Update custom fields count from database schema and cache it as a hidden pref.
    // TODO: move this when custom fields are refactored.
    $max_custom_fields = count(preg_grep('/^custom_\\d+/', getThings("DESCRIBE " . safe_pfx('textpattern'))));
    set_pref('max_custom_fields', $max_custom_fields, 'publish', 2);
    $sql = array();
    $sql[] = "prefs_id = 1 AND event != '' AND type IN (" . PREF_CORE . ", " . PREF_PLUGIN . ", " . PREF_HIDDEN . ")";
    $sql[] = "(user_name = '' OR (user_name = '" . doSlash($txp_user) . "' AND name NOT IN (\n            SELECT name FROM " . safe_pfx('txp_prefs') . " WHERE user_name = ''\n        )))";
    if (!get_pref('use_comments', 1, 1)) {
        $sql[] = "event != 'comments'";
    }
    $prefnames = safe_rows_start("name, event, user_name, val", 'txp_prefs', join(" AND ", $sql));
    $post = stripPost();
    if (isset($post['tempdir']) && empty($post['tempdir'])) {
        $post['tempdir'] = find_temp_dir();
    }
    if (!empty($post['file_max_upload_size'])) {
        $post['file_max_upload_size'] = real_max_upload_size($post['file_max_upload_size']);
    }
    if (isset($post['auto_dst'])) {
        $prefs['auto_dst'] = $auto_dst = $post['auto_dst'];
        if (isset($post['is_dst']) && !$post['auto_dst']) {
            $is_dst = $post['is_dst'];
        }
    }
    // Forge $gmtoffset and $is_dst from $timezone_key if present.
    if (isset($post['timezone_key'])) {
        $key = $post['timezone_key'];
        $tzd = Txp::get('\\Textpattern\\Date\\Timezone')->getTimeZones();
        if (isset($tzd[$key])) {
            $prefs['timezone_key'] = $timezone_key = $key;
            $post['gmtoffset'] = $prefs['gmtoffset'] = $gmtoffset = $tzd[$key]['offset'];
            $post['is_dst'] = $prefs['is_dst'] = $is_dst = Txp::get('\\Textpattern\\Date\\Timezone')->isDst(null, $key);
        }
    }
    if (isset($post['siteurl'])) {
        $post['siteurl'] = preg_replace('#^https?://#', '', rtrim($post['siteurl'], '/ '));
    }
    while ($a = nextRow($prefnames)) {
        extract($a);
        if (!isset($post[$name]) || !has_privs('prefs.' . $event)) {
            continue;
        }
        if ($name === 'logging' && $post[$name] === 'none' && $post[$name] !== $val) {
            safe_truncate('txp_log');
        }
        if ($name === 'expire_logs_after' && (int) $post[$name] !== (int) $val) {
            safe_delete('txp_log', "time < DATE_SUB(NOW(), INTERVAL " . intval($post[$name]) . " DAY)");
        }
        update_pref($name, (string) $post[$name], null, null, null, null, (string) $user_name);
    }
    update_lastmod('preferences_saved');
    prefs_list(gTxt('preferences_saved'));
}
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:59,代码来源:txp_prefs.php

示例2: prefs_save

/**
 * Commits prefs to the database.
 */
function prefs_save()
{
    global $prefs, $gmtoffset, $is_dst, $auto_dst, $timezone_key, $txp_user;
    // Update custom fields count from database schema and cache it as a hidden pref.
    // TODO: move this when custom fields are refactored.
    $max_custom_fields = count(preg_grep('/^custom_\\d+/', getThings('describe ' . safe_pfx('textpattern'))));
    set_pref('max_custom_fields', $max_custom_fields, 'publish', 2);
    $sql = array();
    $sql[] = 'prefs_id = 1 and event != "" and type in(' . PREF_CORE . ', ' . PREF_PLUGIN . ', ' . PREF_HIDDEN . ')';
    $sql[] = "(user_name = '' or (user_name='" . doSlash($txp_user) . "' and name not in(\n            select name from " . safe_pfx('txp_prefs') . " where user_name = ''\n        )))";
    if (!get_pref('use_comments', 1, 1)) {
        $sql[] = "event != 'comments'";
    }
    $prefnames = safe_rows_start("name, event, user_name, val", 'txp_prefs', join(' and ', $sql));
    $post = stripPost();
    if (isset($post['tempdir']) && empty($post['tempdir'])) {
        $post['tempdir'] = find_temp_dir();
    }
    if (!empty($post['file_max_upload_size'])) {
        $post['file_max_upload_size'] = real_max_upload_size($post['file_max_upload_size']);
    }
    if (isset($post['auto_dst'])) {
        $prefs['auto_dst'] = $auto_dst = $post['auto_dst'];
        if (isset($post['is_dst']) && !$post['auto_dst']) {
            $is_dst = $post['is_dst'];
        }
    }
    // Forge $gmtoffset and $is_dst from $timezone_key if present.
    if (isset($post['timezone_key'])) {
        $key = $post['timezone_key'];
        $tzd = Txp::get('Textpattern_Date_Timezone')->getTimeZones();
        if (isset($tzd[$key])) {
            $prefs['timezone_key'] = $timezone_key = $key;
            $post['gmtoffset'] = $prefs['gmtoffset'] = $gmtoffset = $tzd[$key]['offset'];
            $post['is_dst'] = $prefs['is_dst'] = $is_dst = Txp::get('Textpattern_Date_Timezone')->isDst(null, $key);
        }
    }
    if (isset($post['siteurl'])) {
        $post['siteurl'] = preg_replace('#^https?://#', '', rtrim($post['siteurl'], '/ '));
    }
    while ($a = nextRow($prefnames)) {
        extract($a);
        if (!isset($post[$name]) || !has_privs('prefs.' . $event)) {
            continue;
        }
        if ($name === 'logging' && $post[$name] === 'none' && $post[$name] !== $val) {
            safe_truncate('txp_log');
        }
        if ($name === 'expire_logs_after' && (int) $post[$name] !== (int) $val) {
            safe_delete('txp_log', 'time < date_sub(now(), interval ' . intval($post[$name]) . ' day)');
        }
        update_pref($name, (string) $post[$name], null, null, null, null, (string) $user_name);
    }
    update_lastmod();
    prefs_list(gTxt('preferences_saved'));
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:59,代码来源:txp_prefs.php

示例3: getComment

function getComment()
{
    // comment spam filter plugins: call this function to fetch comment contents
    $c = psa(array('parentid', 'name', 'email', 'web', 'message', 'backpage', 'remember'));
    $n = array();
    foreach (stripPost() as $k => $v) {
        if (preg_match('#^[A-Fa-f0-9]{32}$#', $k . $v)) {
            $n[] = doSlash($k . $v);
        }
    }
    $c['nonce'] = '';
    $c['secret'] = '';
    if (!empty($n)) {
        $rs = safe_row('nonce, secret', 'txp_discuss_nonce', "nonce in ('" . join("','", $n) . "')");
        $c['nonce'] = $rs['nonce'];
        $c['secret'] = $rs['secret'];
    }
    $c['message'] = ps(md5('message' . $c['secret']));
    return $c;
}
开发者ID:evanfarrar,项目名称:opensprints.org,代码行数:20,代码来源:comment.php

示例4: advanced_prefs_save

function advanced_prefs_save()
{
    $prefnames = safe_column("name", "txp_prefs", "prefs_id = 1 AND type = 1");
    $post = doSlash(stripPost());
    if (empty($post['tempdir'])) {
        $post['tempdir'] = doSlash(find_temp_dir());
    }
    if (!empty($post['file_max_upload_size'])) {
        $post['file_max_upload_size'] = real_max_upload_size($post['file_max_upload_size']);
    }
    foreach ($prefnames as $prefname) {
        if (isset($post[$prefname])) {
            safe_update("txp_prefs", "val = '" . $post[$prefname] . "'", "name = '" . doSlash($prefname) . "' and prefs_id = 1");
        }
    }
    update_lastmod();
    advanced_prefs(gTxt('preferences_saved'));
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:18,代码来源:txp_prefs.php

示例5: advanced_prefs_save

function advanced_prefs_save()
{
    // update custom fields count from database schema and cache it as a hidden pref
    $max_custom_fields = count(preg_grep('/^custom_\\d+/', getThings('describe `' . PFX . 'textpattern`')));
    set_pref('max_custom_fields', $max_custom_fields, 'publish', 2);
    // safe all regular advanced prefs
    $prefnames = safe_column("name", "txp_prefs", "prefs_id = 1 AND type = 1");
    $post = doSlash(stripPost());
    if (empty($post['tempdir'])) {
        $post['tempdir'] = doSlash(find_temp_dir());
    }
    if (!empty($post['file_max_upload_size'])) {
        $post['file_max_upload_size'] = real_max_upload_size($post['file_max_upload_size']);
    }
    foreach ($prefnames as $prefname) {
        if (isset($post[$prefname])) {
            safe_update("txp_prefs", "val = '" . $post[$prefname] . "'", "name = '" . doSlash($prefname) . "' and prefs_id = 1");
        }
    }
    update_lastmod();
    advanced_prefs(gTxt('preferences_saved'));
}
开发者ID:psic,项目名称:websites,代码行数:22,代码来源:txp_prefs.php

示例6: advanced_prefs_save

function advanced_prefs_save()
{
    $prefnames = safe_column("name", "txp_prefs", "prefs_id='1' AND type='1'");
    $post = doSlash(stripPost());
    if (!empty($post['file_max_upload_size'])) {
        $post['file_max_upload_size'] = real_max_upload_size($post['file_max_upload_size']);
    }
    foreach ($prefnames as $prefname) {
        if (isset($post[$prefname])) {
            safe_update("txp_prefs", "val = '" . $post[$prefname] . "'", "name = '{$prefname}' and prefs_id ='1'");
        }
    }
    advanced_prefs(gTxt('preferences_saved'));
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:14,代码来源:txp_prefs.php

示例7: getComment

function getComment()
{
    // comment spam filter plugins: call this function to fetch comment contents
    $c = psa(array('parentid', 'name', 'email', 'web', 'message', 'backpage', 'remember'));
    $n = array();
    foreach (stripPost() as $k => $v) {
        if (strlen($k . $v) == 32) {
            $n[] = "'" . doSlash($k . $v) . "'";
        }
    }
    $c['nonce'] = '';
    $c['secret'] = '';
    if (!empty($n)) {
        $rs = safe_row('nonce, secret', 'txp_discuss_nonce', "nonce in (" . join(',', $n) . ")");
        $c['nonce'] = $rs['nonce'];
        $c['secret'] = $rs['secret'];
    }
    return $c;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:19,代码来源:comment.php

示例8: yab_shop_prefs_save

/**
 * Save prefs setting in admin ui
 *
 * @return string Message for pagetop()
 */
function yab_shop_prefs_save()
{
    $post = doSlash(stripPost());
    $prefnames = safe_column("name", "yab_shop_prefs", "prefs_id = 1 AND type = 1");
    foreach ($prefnames as $prefname) {
        if (isset($post[$prefname])) {
            safe_update("yab_shop_prefs", "val = '" . $post[$prefname] . "'", "name = '" . doSlash($prefname) . "' and prefs_id = 1");
        }
    }
    return yab_shop_admin_lang('prefs_updated');
}
开发者ID:NatemcM,项目名称:yab_shop,代码行数:16,代码来源:yab_shop_admin.php


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