本文整理汇总了PHP中ps函数的典型用法代码示例。如果您正苦于以下问题:PHP ps函数的具体用法?PHP ps怎么用?PHP ps使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ps函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: plugin_multi_edit
function plugin_multi_edit()
{
$selected = ps('selected');
$method = ps('edit_method');
if (!$selected or !is_array($selected)) {
return plugin_list();
}
$where = "name IN ('" . join("','", doSlash($selected)) . "')";
switch ($method) {
case 'delete':
foreach ($selected as $name) {
if (safe_field('flags', 'txp_plugin', "name ='" . doSlash($name) . "'") & PLUGIN_LIFECYCLE_NOTIFY) {
load_plugin($name, true);
callback_event("plugin_lifecycle.{$name}", 'disabled');
callback_event("plugin_lifecycle.{$name}", 'deleted');
}
}
safe_delete('txp_plugin', $where);
break;
case 'changestatus':
foreach ($selected as $name) {
if (safe_field('flags', 'txp_plugin', "name ='" . doSlash($name) . "'") & PLUGIN_LIFECYCLE_NOTIFY) {
$status = safe_field('status', 'txp_plugin', "name ='" . doSlash($name) . "'");
load_plugin($name, true);
// NB: won't show returned messages anywhere due to potentially overwhelming verbiage.
callback_event("plugin_lifecycle.{$name}", $status ? 'disabled' : 'enabled');
}
}
safe_update('txp_plugin', 'status = (1-status)', $where);
break;
case 'changeorder':
$order = min(max(intval(ps('order')), 1), 9);
safe_update('txp_plugin', 'load_order = ' . $order, $where);
break;
}
$message = gTxt('plugin_' . ($method == 'delete' ? 'deleted' : 'updated'), array('{name}' => join(', ', $selected)));
plugin_list($message);
}
开发者ID:psic,项目名称:websites,代码行数:38,代码来源:txp_plugin.php
示例17: author_delete
function author_delete()
{
require_privs('admin.edit');
$user_id = assert_int(ps('user_id'));
$name = fetch('Realname', 'txp_users', 'user_id', $user_id);
if ($name) {
$rs = safe_delete('txp_users', "user_id = {$user_id}");
if ($rs) {
admin(gTxt('author_deleted', array('{name}' => $name)));
}
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:12,代码来源:txp_admin.php
示例18: ign_user_delete
function ign_user_delete()
{
global $ign_user_db;
$user_id = ps('user_id');
$name = fetch('Realname', $ign_user_db, 'user_id', $user_id);
if ($name) {
$rs = safe_delete($ign_user_db, "user_id = '{$user_id}'");
if ($rs) {
ign_admin(messenger('user', $name, 'deleted'));
}
}
}
开发者ID:netcarver,项目名称:ign_password_protect,代码行数:12,代码来源:ign_password_protect.php
示例19: createTxp
function createTxp()
{
$GLOBALS['textarray'] = setup_load_lang($_SESSION['lang']);
$_SESSION['name'] = ps('name');
$_SESSION['realname'] = ps('RealName');
$_SESSION['pass'] = ps('pass');
$_SESSION['email'] = ps('email');
$_SESSION['theme'] = ps('theme');
if ($_SESSION['name'] == '') {
echo n . '<div id="setup_container" class="txp-container">' . txp_setup_progress_meter(3) . n . '<div class="txp-setup">' . n . graf('<span class="error">' . setup_gTxt('name_required') . '</span>') . n . setup_back_button(__FUNCTION__) . n . '</div>' . n . '</div>';
exit;
}
if (!$_SESSION['pass']) {
echo n . '<div id="setup_container" class="txp-container">' . txp_setup_progress_meter(3) . n . '<div class="txp-setup">' . n . graf('<span class="error">' . setup_gTxt('pass_required') . '</span>') . n . setup_back_button(__FUNCTION__) . n . '</div>' . n . '</div>';
exit;
}
if (!is_valid_email($_SESSION['email'])) {
echo n . '<div id="setup_container" class="txp-container">' . txp_setup_progress_meter(3) . n . '<div class="txp-setup">' . n . graf('<span class="error">' . setup_gTxt('email_required') . '</span>') . n . setup_back_button(__FUNCTION__) . n . '</div>' . n . '</div>';
exit;
}
global $txpcfg;
if (!isset($txpcfg['db'])) {
if (!is_readable(txpath . '/config.php')) {
$problems[] = graf('<span class="error">' . setup_gTxt('config_php_not_found', array('{file}' => txpspecialchars(txpath . '/config.php')), 'raw') . '</span>');
} else {
@(include txpath . '/config.php');
}
}
if (!isset($txpcfg) || $txpcfg['db'] != $_SESSION['ddb'] || $txpcfg['table_prefix'] != $_SESSION['dprefix']) {
$problems[] = graf('<span class="error">' . setup_gTxt('config_php_does_not_match_input', 'raw') . '</span>');
echo txp_setup_progress_meter(3) . n . '<div class="txp-setup">' . n . join(n, $problems) . n . setup_config_contents() . n . '</div>' . n . '</div>';
exit;
}
$ddb = $txpcfg['db'];
$duser = $txpcfg['user'];
$dpass = $txpcfg['pass'];
$dhost = $txpcfg['host'];
$dclient_flags = isset($txpcfg['client_flags']) ? $txpcfg['client_flags'] : 0;
$dprefix = $txpcfg['table_prefix'];
$dbcharset = $txpcfg['dbcharset'];
$siteurl = str_replace("http://", '', $_SESSION['siteurl']);
$siteurl = str_replace(' ', '%20', rtrim($siteurl, "/"));
$urlpath = preg_replace('#^[^/]+#', '', $siteurl);
define("PFX", trim($dprefix));
define('TXP_INSTALL', 1);
include_once txpath . '/lib/txplib_update.php';
include txpath . '/setup/txpsql.php';
$nonce = md5(uniqid(rand(), true));
$hash = doSlash(txp_hash_password($_SESSION['pass']));
mysql_query("INSERT INTO `" . PFX . "txp_users` VALUES\n\t\t\t(1,\n\t\t\t'" . doSlash($_SESSION['name']) . "',\n\t\t\t'{$hash}',\n\t\t\t'" . doSlash($_SESSION['realname']) . "',\n\t\t\t'" . doSlash($_SESSION['email']) . "',\n\t\t\t1,\n\t\t\tnow(),\n\t\t\t'{$nonce}')");
mysql_query("update `" . PFX . "txp_prefs` set val = '" . doSlash($siteurl) . "' where `name`='siteurl'");
mysql_query("update `" . PFX . "txp_prefs` set val = '" . LANG . "' where `name`='language'");
mysql_query("update `" . PFX . "txp_prefs` set val = '" . getlocale(LANG) . "' where `name`='locale'");
mysql_query("update `" . PFX . "textpattern` set Body = replace(Body, 'siteurl', '" . doSlash($urlpath) . "'), Body_html = replace(Body_html, 'siteurl', '" . doSlash($urlpath) . "') WHERE ID = 1");
// cf. update/_to_4.2.0.php.
// TODO: Position might need altering when prefs panel layout is altered
$theme = $_SESSION['theme'] ? $_SESSION['theme'] : 'classic';
mysql_query("insert `" . PFX . "txp_prefs` set prefs_id = 1, name = 'theme_name', val = '" . doSlash($theme) . "', type = '1', event = 'admin', html = 'themename', position = '160'");
echo fbCreate();
}
开发者ID:balcides,项目名称:Cathartic_server,代码行数:60,代码来源:index.php
示例20: sed_lib_zemcontact_submit
function sed_lib_zemcontact_submit()
{
$checking_mail_field = trim(ps('mail'));
$checking_phone_field = trim(ps('phone'));
$evaluation =& get_zemcontact_evaluator();
if ($checking_mail_field != '' || $checking_phone_field != '') {
$evaluation->add_zemcontact_status(1);
}
return;
}
开发者ID:netcarver,项目名称:sed_plugin_library,代码行数:10,代码来源:sed_plugin_library.php
注:本文中的ps函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论