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


PHP ps函数代码示例

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


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

示例1: clean

function clean($message = '')
{
    global $prefs;
    extract($prefs);
    pagetop("Cache Cleaner", ps("txp_token") === md5($lastmod) ? "Successful" : "Token expired. Please try again.");
    if (ps("txp_token") === md5($lastmod)) {
        echo "<div align=\"center\" style=\"margin-top:3em\">";
        printf("Deleted %s files. Cache is clean.", '' . txp_flushdir(true));
        echo "</div>";
    }
    echo "<div align=\"center\" style=\"margin-top:3em\">";
    echo form(tag("Cache-Cleaner", "h3") . graf("Usually you don't need to do that. Cache is <b>automatically</b> cleared <br />1)\n\t\t\t\t  after a certain amount of time <br />2) when a comment is posted, edited or moderated\n\t\t\t      <br />3) after a page-template or form-tag is modified.<br />4) after template import.<br />5) after article update.<br /><br />" . fInput("hidden", "txp_token", md5($lastmod)) . fInput("submit", "clean_cache", "Clean all cached Files", "smallerbox") . eInput("cache") . sInput("clean"), " style=\"text-align:center\""));
    echo tag("Cache Statistics", "h3");
    global $path_to_site;
    $count = array('size' => 0, 'num' => 0);
    $txp_cache_dir = txpath . "/cache";
    if (!empty($txp_cache_dir) and $fp = opendir($txp_cache_dir)) {
        while (false !== ($file = readdir($fp))) {
            if ($file[0] != ".") {
                $count['size'] += filesize("{$txp_cache_dir}/{$file}");
                ++$count['num'];
            }
        }
        closedir($fp);
        printf("There are %d cache files with a total size of %d kb.", $count['num'], floor($count['size'] / 1000));
    } else {
        echo "Cache is empty.";
    }
    include $path_to_site . '/textpattern/lib/txp_cache/cache-config.php';
    echo "</div>";
}
开发者ID:nope,项目名称:Tipattern,代码行数:31,代码来源:txp_cache.php

示例2: doTxpValidate

function doTxpValidate()
{
    global $logout, $txpcfg;
    $p_userid = ps('p_userid');
    $p_password = ps('p_password');
    $logout = gps('logout');
    $stay = ps('stay');
    if ($logout) {
        setcookie('txp_login', '', time() - 3600);
    }
    if (!empty($_COOKIE['txp_login']) and !$logout) {
        // cookie exists
        @(list($c_userid, $cookie_hash) = split(',', $_COOKIE['txp_login']));
        $nonce = safe_field('nonce', 'txp_users', "name='{$c_userid}'");
        if (md5($c_userid . $nonce) === $cookie_hash && $nonce) {
            // check nonce
            $GLOBALS['txp_user'] = $c_userid;
            // cookie is good, create $txp_user
            return '';
        } else {
            // something's gone wrong
            $GLOBALS['txp_user'] = '';
            setcookie('txp_login', '', time() - 3600);
            return gTxt('bad_cookie');
        }
    } elseif ($p_userid and $p_password) {
        // no cookie, but incoming login vars
        sleep(3);
        // should grind dictionary attacks to a halt
        if (txp_validate($p_userid, $p_password)) {
            $nonce = safe_field('nonce', 'txp_users', "name='{$p_userid}'");
            if (!$nonce) {
                define('TXP_UPDATE', 1);
                include_once txpath . '/update/_update.php';
                exit(graf('Please reload'));
            }
            if ($stay) {
                // persistent cookie required
                setcookie('txp_login', $p_userid . ',' . md5($p_userid . $nonce), time() + 3600 * 24 * 365);
                // expires in 1 year
            } else {
                // session-only cookie required
                setcookie('txp_login', $p_userid . ',' . md5($p_userid . $nonce));
                setcookie('txp_nostay', '1', time() + 3600 * 24 * 365);
                // remember nostay for 1 year
            }
            $GLOBALS['txp_user'] = $p_userid;
            // login is good, create $txp_user
            return '';
        } else {
            $GLOBALS['txp_user'] = '';
            return gTxt('could_not_log_in');
        }
    } else {
        $GLOBALS['txp_user'] = '';
        return gTxt('login_to_textpattern');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:58,代码来源:txp_auth.php

示例3: page_delete

function page_delete()
{
    if (ps('name') == 'default') {
        return page_edit();
    }
    $name = doSlash(ps('name'));
    safe_delete("txp_page", "name='{$name}'");
    page_edit(messenger('page', $name, 'deleted'));
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:9,代码来源:txp_page.php

示例4: page_delete

function page_delete()
{
    $name = doSlash(ps('name'));
    if ($name == 'default') {
        return page_edit();
    }
    safe_delete('txp_page', "name = '{$name}'");
    $message = gTxt('page_deleted', array('{name}' => $name));
    page_edit($message);
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:10,代码来源:txp_page.php

示例5: doTxpValidate

function doTxpValidate()
{
    global $logout, $txpcfg;
    $p_userid = ps('p_userid');
    $p_password = ps('p_password');
    $logout = gps('logout');
    $stay = ps('stay');
    if ($logout) {
        setcookie('txp_login', ' ', time() - 3600);
    }
    if (isset($_COOKIE['txp_login']) and !$logout) {
        // cookie exists
        list($c_userid, $cookie_hash) = split(',', $_COOKIE['txp_login']);
        $nonce = safe_field('nonce', 'txp_users', "name='{$c_userid}'");
        if (md5($c_userid . $nonce) == $cookie_hash) {
            // check secret word
            $GLOBALS['txp_user'] = $c_userid;
            // cookie is good, create $txp_user
            return '';
        } else {
            // something's gone wrong
            $GLOBALS['txp_user'] = '';
            setcookie('txp_login', '', time() - 3600);
            return gTxt('bad_cookie');
        }
    } elseif ($p_userid and $p_password) {
        // no cookie, but incoming login vars
        sleep(3);
        // should grind dictionary attacks to a halt
        if (txp_validate($p_userid, $p_password)) {
            $nonce = safe_field('nonce', 'txp_users', "name='{$p_userid}'");
            if (!$nonce) {
                exit(graf('Missing authentication information. 
										Please run _update.php'));
            }
            if ($stay) {
                // persistent cookie required
                setcookie('txp_login', $p_userid . ',' . md5($p_userid . $nonce), time() + 3600 * 24 * 365);
                // expires in 1 year
            } else {
                // session-only cookie required
                setcookie('txp_login', $p_userid . ',' . md5($p_userid . $nonce));
            }
            $GLOBALS['txp_user'] = $p_userid;
            // login is good, create $txp_user
            return '';
        } else {
            $GLOBALS['txp_user'] = '';
            return gTxt('could_not_log_in');
        }
    } else {
        $GLOBALS['txp_user'] = '';
        return gTxt('login_to_textpattern');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:55,代码来源:txp_auth.php

示例6: txp_article_table

 function txp_article_table()
 {
     $table = new txp_article_table();
     $setup_comment_invite = addslashes(gTxt('setup_comment_invite') == 'setup_comment_invite' ? 'Comment' : gTxt('setup_comment_invite'));
     $name = ps('name');
     if (empty($name)) {
         $name = 'textpattern';
     }
     if (!$table->row(array('id' => 1))) {
         $table->insert(array('id' => ZEM_INCVAL, 'posted' => 'now()', 'author_id' => "{$name}", 'lastmod' => 'now()', 'title' => 'First Post', 'body' => 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec rutrum est eu mauris. In volutpat blandit felis. Suspendisse eget pede. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Quisque sed arcu. Aenean purus nulla, condimentum ac, pretium at, commodo sit amet, turpis. Aenean lacus. Ut in justo. Ut viverra dui vel ante. Duis imperdiet porttitor mi. Maecenas at lectus eu justo porta tempus. Cras fermentum ligula non purus. Duis id orci non magna rutrum bibendum. Mauris tincidunt, massa in rhoncus consectetuer, lectus dui ornare enim, ut egestas ipsum purus id urna. Vestibulum volutpat porttitor metus. Donec congue vehicula ante.', 'body_html' => '	<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec rutrum est eu mauris. In volutpat blandit felis. Suspendisse eget pede. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Quisque sed arcu. Aenean purus nulla, condimentum ac, pretium at, commodo sit amet, turpis. Aenean lacus. Ut in justo. Ut viverra dui vel ante. Duis imperdiet porttitor mi. Maecenas at lectus eu justo porta tempus. Cras fermentum ligula non purus. Duis id orci non magna rutrum bibendum. Mauris tincidunt, massa in rhoncus consectetuer, lectus dui ornare enim, ut egestas ipsum purus id urna. Vestibulum volutpat porttitor metus. Donec congue vehicula ante.</p>\\n\\n\\n ', 'excerpt' => '', 'excerpt_html' => '\\n\\n\\n ', 'annotate' => 1, 'annotateinvite' => "{$setup_comment_invite}", 'comments_count' => 1, 'status' => 4, 'markup_body' => 1, 'markup_excerpt' => 1, 'section' => 'article', 'url_title' => 'first-post', 'uid' => 'becfea8fd42801204463b23701199f28', 'feed_time' => 'now()'));
     }
 }
开发者ID:bgarrels,项目名称:textpattern,代码行数:12,代码来源:data.php

示例7: export

function export($message = '')
{
    global $prefs;
    extract($prefs);
    $template = new template();
    pagetop(gTxt('template'), $message);
    print "\n    <style type='text/css'>\n        .success { color: #009900; }\n        .failure { color: #FF0000; }\n    </style>\n\t\t\t\n    <table cellpadding='0' cellspacing='0' border='0' id='list' align='center'>\n        <tr>\n            <td>\n    ";
    $dir = ps('export_dir');
    $dir = str_replace(array(" "), array("-"), $dir);
    $template->export($dir);
    print "\n          </td>\n      </tr>\n  </table>\n  ";
}
开发者ID:nope,项目名称:Tipattern,代码行数:12,代码来源:txp_template.php

示例8: doTxpValidate

function doTxpValidate()
{
    global $logout, $txpcfg, $txp_user;
    $p_userid = ps('p_userid');
    $p_password = ps('p_password');
    $logout = gps('logout');
    $stay = ps('stay');
    if ($logout) {
        setcookie('txp_login', '', time() - 3600);
    }
    if (!empty($_COOKIE['txp_login']) and !$logout) {
        @(list($c_userid, $cookie_hash) = split(',', cs('txp_login')));
        $nonce = safe_field('nonce', 'txp_users', "name='" . doSlash($c_userid) . "'");
        if ($nonce && $nonce === md5($c_userid . pack('H*', $cookie_hash))) {
            // cookie is good, create $txp_user
            $txp_user = $c_userid;
            return '';
        } else {
            // something's gone wrong
            $txp_user = '';
            setcookie('txp_login', '', time() - 3600);
            return gTxt('bad_cookie');
        }
    } elseif ($p_userid and $p_password) {
        sleep(3);
        // should grind dictionary attacks to a halt
        if (txp_validate($p_userid, $p_password)) {
            $cookie_hash = md5(uniqid(rand()));
            safe_update('txp_users', "nonce = '" . doSlash(md5($p_userid . pack('H*', $cookie_hash))) . "'", "name = '" . doSlash($p_userid) . "'");
            if ($stay) {
                setcookie('txp_login', $p_userid . ',' . $cookie_hash, time() + 3600 * 24 * 365);
                // expires in 1 year
                if (cs('txp_nostay')) {
                    setcookie('txp_nostay', '', time() - 3600);
                }
            } else {
                setcookie('txp_login', $p_userid . ',' . $cookie_hash);
                setcookie('txp_nostay', '1', time() + 3600 * 24 * 365);
                // remember nostay for 1 year
            }
            $txp_user = $p_userid;
            // login is good, create $txp_user
            return '';
        } else {
            $txp_user = '';
            return gTxt('could_not_log_in');
        }
    } else {
        $txp_user = '';
        return gTxt('login_to_textpattern');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:52,代码来源:txp_auth.php

示例9: _sed_article_delete_callback

function _sed_article_delete_callback($event, $step)
{
    #	When an article is deleted from the DB we need to recalc the
    # first post year and last update year, just in case that article
    # was setting one or both of those dates...
    if (!empty($step) and 'list_multi_edit' == $step) {
        require_privs('article');
        $method = ps('method');
        $things = ps('selected');
        if ($things and $method == 'delete') {
            _update_cache();
        }
    }
}
开发者ID:netcarver,项目名称:sed_copyright,代码行数:14,代码来源:sed_copyrght.php

示例10: page_delete

function page_delete()
{
    $name = ps('name');
    $count = safe_count('txp_section', "page = '" . doSlash($name) . "'");
    if ($name == 'error_default') {
        return page_edit();
    }
    if ($count) {
        $message = gTxt('page_used_by_section', array('{name}' => $name, '{count}' => $count));
    } else {
        safe_delete('txp_page', "name = '" . doSlash($name) . "'");
        $message = gTxt('page_deleted', array('{name}' => $name));
    }
    page_edit($message);
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:15,代码来源:txp_page.php

示例11: form_multi_edit

function form_multi_edit()
{
    $method = ps('method');
    $forms = ps('selected_forms');
    if (is_array($forms)) {
        if ($method == 'delete') {
            foreach ($forms as $name) {
                if (form_delete($name)) {
                    $deleted[] = $name;
                }
            }
            form_edit(messenger('form', join(', ', $deleted), 'deleted'));
        }
    } else {
        form_edit('nothing to delete');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:17,代码来源:txp_form.php

示例12: asy_jpcachecleaner

function asy_jpcachecleaner($event, $step)
{
    global $lastmod, $prefs, $path_to_site;
    // ps() returns the contents of POST vars, if any;
    if (ps("step") === "clean") {
        pagetop("JPCache Cleaner", ps("asy_token") === md5($lastmod) ? "Successful" : "Token expired. Please try again.");
        if (ps("asy_token") === md5($lastmod)) {
            echo "<div align=\"center\" style=\"margin-top:3em\">";
            printf("Deleted %s files. Cache is clean.", '' . asy_flushdir(true));
            echo "</div>";
        }
    } else {
        pagetop("JPCache Cleaner");
    }
    echo "<div align=\"center\" style=\"margin-top:3em\">";
    echo form(tag("JPCache-Cleaner", "h3") . graf("Usually you don't need to do that. Cache is <b>automatically</b> cleared <br />1)\n\t\t\t\t  after a certain amount of time <br />2) when a comment is posted, edited or moderated\n\t\t\t      <br />3) after a page-template or form-tag is is modified.<br /><br />" . fInput("hidden", "asy_token", md5($lastmod)) . fInput("submit", "clean_cache", "Clean all cached Files", "smallerbox") . eInput("asy_jpcache") . sInput("clean"), " style=\"text-align:center\""));
    echo tag("Cache Statistics", "h3");
    global $path_to_site;
    $count = array('size' => 0, 'num' => 0);
    $asy_cache_dir = $path_to_site . '/jpcache/cache';
    if (!empty($asy_cache_dir) and $fp = opendir($asy_cache_dir)) {
        while (false !== ($file = readdir($fp))) {
            if ($file[0] != ".") {
                $count['size'] += filesize("{$asy_cache_dir}/{$file}");
                ++$count['num'];
            }
        }
        closedir($fp);
        printf("There are %d cache files with a total size of %d kb.", $count['num'], floor($count['size'] / 1000));
    } else {
        echo "Cache is empty.";
    }
    include $path_to_site . '/jpcache/jpcache-config.php';
    /*		if (@$JPCACHE_TXPLOG_DO == 1 && $prefs['logging']=='all'){
    			echo tag("Read-Write-Ratio<sup>1</sup>","h3");;
    			$cachehits = safe_field('COUNT( id ) as hit', 'txp_log', "page LIKE '%#cachehit'");
    			$totalhits = getThing("SELECT MIN(time) FROM ".PFX."txp_log WHERE page LIKE '%#cachehit'");
    			$totalhits = getThing("SELECT COUNT(id) FROM ".PFX."txp_log WHERE time > '". $totalhits."'");
    			printf("There were <b>%d</b> cache-reads recorded and <b>%d</b> possible cache-writes. <br />Average number of reads per write: <b>%01.2f</b>",$cachehits, $totalhits-$cachehits, (($totalhits-$cachehits) > 0) ? ($cachehits/($totalhits-$cachehits)) : '0');
    			echo "<br /><br /><sup>1</sup>This is a (low) Approximation. Initially wait a week before numbers become meaningful.";
    		}
    */
    echo "</div>";
}
开发者ID:rwetzlmayr,项目名称:asy_jpcache,代码行数:44,代码来源:asy_jpcache.plugin.php

示例13: form_multi_edit

function form_multi_edit()
{
    global $essential_forms;
    $method = ps('edit_method');
    $forms = ps('selected_forms');
    if ($forms and is_array($forms)) {
        if ($method == 'delete') {
            foreach ($forms as $name) {
                if (!in_array($name, $essential_forms) && form_delete($name)) {
                    $deleted[] = $name;
                }
            }
            $message = gTxt('forms_deleted', array('{list}' => join(', ', $deleted)));
            form_edit($message);
        }
    } else {
        form_edit();
    }
}
开发者ID:nope,项目名称:Tipattern,代码行数:19,代码来源:txp_form.php

示例14: rss_admin_editlink

function rss_admin_editlink($event, $step)
{
    global $rss_ae_cookie;
    include txpath . '/include/txp_prefs.php';
    if (!isset($rss_ae_cookie)) {
        $rss_ae_cookie = "rss_article_edit";
        $rs = safe_insert('txp_prefs', "name='rss_ae_cookie', val='{$rss_ae_cookie}', prefs_id='1'");
    }
    if (gps("add")) {
        safe_update("txp_prefs", "val = '" . addslashes(ps('rss_ae_cookie')) . "'", "name = 'rss_ae_cookie' and prefs_id ='1'");
        setcookie($rss_ae_cookie, $rss_ae_cookie, time() + 31536000, "/");
        header("Location: index.php?event=editlink");
    } else {
        if (gps("rem")) {
            safe_update("txp_prefs", "val = '" . addslashes(ps('rss_ae_cookie')) . "'", "name = 'rss_ae_cookie' and prefs_id ='1'");
            setcookie($rss_ae_cookie, $rss_ae_cookie, time() - 3600, "/");
            header("Location: index.php?event=editlink");
        }
    }
    pagetop("Edit Link");
    $aeset = isset($_COOKIE[$rss_ae_cookie]) ? "" : " not";
    $tdaStyle = ' style="text-align:right;vertical-align:middle"';
    echo form(startTable("list") . tr(tdcs(hed("Add/Remove Public Site Article Edit Link", 1), 2)) . tr(tda(graf('Cookie ' . $rss_ae_cookie . ' is' . $aeset . ' set.', ' align="center"'), ' colspan="2"')) . tr(tda(gTxt('Cookie Name:'), ' style="text-align:right;vertical-align:middle"') . tda(text_input("rss_ae_cookie", $rss_ae_cookie, '20'), ' ')) . tr(tda(graf(fInput("submit", "add", gTxt("Add Edit Link"), "publish") . fInput("submit", "rem", gTxt("Remove Edit Link"), "publish") . eInput("editlink"), ' align="center"'), ' colspan="2"')) . endTable());
}
开发者ID:netcarver,项目名称:rss_article_edit,代码行数:24,代码来源:rss_article_edit.php

示例15: valid_token

 /**
  * Validates a token.
  *
  * @return bool
  */
 protected function valid_token()
 {
     $args = func_get_args();
     return ps('token') === md5(join('', $args) . ps('origin') . form_token() . get_pref('blog_uid'));
 }
开发者ID:bgarrels,项目名称:textpattern,代码行数:10,代码来源:txp_pane.php


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