本文整理汇总了PHP中safe_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP safe_delete函数的具体用法?PHP safe_delete怎么用?PHP safe_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了safe_delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'));
}
示例2: 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);
}
示例3: section_prune
function section_prune($id)
{
$s = safe_row('*', 'txp_section', "id='" . doSlash($id) . "'");
// can't delete the default section
if (!$s or empty($s['parent'])) {
return false;
}
# FIXME: move articles to the parent section first?
# what if the parent is 'default'?
return safe_delete('txp_section', "lft between '" . $s['lft'] . "' and '" . $s['rgt'] . "'");
}
示例4: deleteArticleID
/**
* Delete the article given the id
* @param mixed(string|integer) $article_id the ID of the article to delete
* @return boolean true on success deletion
*/
function deleteArticleID($article_id)
{
$article_id = assert_int($article_id);
if ($this->loggedin && has_privs('article.delete', $this->txp_user)) {
return safe_delete('textpattern', "ID = {$article_id}");
} elseif ($this->loggedin && has_privs('article.delete.own', $this->txp_user)) {
$r = safe_field('ID', 'textpattern', "ID = {$article_id} AND AuthorID='" . doSlash($this->txp_user) . "'");
if ($r || has_privs('article.delete', $this->txp_user)) {
return safe_delete('textpattern', "ID = {$article_id}");
}
}
return false;
}
示例5: 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);
}
示例6: log_list
function log_list()
{
pagetop(gTxt('visitor_logs'));
extract(get_prefs());
safe_delete("txp_log", "`time` < date_sub(now(),interval " . $expire_logs_after . " day)");
safe_optimize("txp_log");
safe_repair("txp_log");
$page = gps('page');
$total = getCount('txp_log', "1");
$limit = 50;
$numPages = ceil($total / $limit);
$page = !$page ? 1 : $page;
$offset = ($page - 1) * $limit;
$nav[] = $page > 1 ? PrevNextLink("log", $page - 1, gTxt('prev'), 'prev') : '';
$nav[] = sp . small($page . '/' . $numPages) . sp;
$nav[] = $page != $numPages ? PrevNextLink("log", $page + 1, gTxt('next'), 'next') : '';
$rs = safe_rows_start("*, unix_timestamp(time) as stamp", "txp_log", "1 order by time desc limit {$offset},{$limit}");
if ($rs) {
echo startTable('list'), assHead('time', 'host', 'page', 'referrer');
$stamp = '';
while ($a = nextRow($rs)) {
extract($a);
if ($refer) {
$referprint = preg_replace("/^www\\./", "", chunk(htmlspecialchars($refer), 50));
$referprint = '<a href="http://' . htmlspecialchars($refer) . '">' . $referprint . '</a>';
} else {
$referprint = ' ';
}
$pageprint = preg_replace('/\\/$/', '', htmlspecialchars(substr($page, 1)));
$pageprint = $pageprint == '' ? '' : '<a href="' . htmlspecialchars($page) . '" target="_blank">' . chunk($pageprint, 50) . '</a>';
if ($method == 'POST') {
$pageprint = '<b>' . $pageprint . '</b>';
}
$fstamp = date("n/j g:i a", $stamp + tz_offset());
$hostprint = chunk($host, 40);
echo tr(td($fstamp) . td($hostprint) . td($pageprint) . td($referprint));
unset($refer, $referprint, $page, $pageprint);
}
echo '<tr><td colspan="4" align="right" style="padding:10px">', join('', $nav), "</td></tr>", endTable();
} else {
echo graf(gTxt('no_refers_recorded'), ' align="center"');
}
}
示例7: multiedit_post
function multiedit_post()
{
$type = ps('type');
$method = ps('method');
$things = ps('selected');
$root = tree_root_id('txp_category', "type='" . doSlash($type) . "'");
if ($things) {
foreach ($things as $catid) {
$catid = assert_int($catid);
if ($method == 'delete') {
if (safe_delete('txp_category', "id={$catid}")) {
safe_update('txp_category', "parent=" . doSlash($root), "type='" . doSlash($type) . "' and parent='" . doSlash($catid) . "'");
$categories[] = $catid;
}
}
}
tree_rebuild_full('txp_category', "type='" . doSlash($type) . "'");
$this->_message(gTxt($type . '_categories_deleted', array('{list}' => join(', ', $categories))));
}
$this->_set_view('list');
}
示例8: install
/**
* Installer
* @param string $event Admin-side event.
* @param string $step Admin-side, plugin-lifecycle step.
*/
public static function install($event = '', $step = '')
{
global $prefs;
if ($step == 'deleted') {
safe_delete('txp_prefs', "name like 'rah\\_bitly\\_%'");
return;
}
if (isset($prefs['rah_bitly_version']) && $prefs['rah_bitly_version'] == self::$version) {
return;
}
$position = 250;
foreach (array('login', 'apikey', 'field') as $name) {
if (!isset($prefs['rah_bitly_' . $name])) {
$html = $name == 'field' ? 'rah_bitly_fields' : 'text_input';
safe_insert('txp_prefs', "prefs_id=1,\n\t\t\t\t\tname='rah_bitly_" . $name . "',\n\t\t\t\t\tval='',\n\t\t\t\t\ttype=1,\n\t\t\t\t\tevent='rah_bitly',\n\t\t\t\t\thtml='{$html}',\n\t\t\t\t\tposition=" . $position);
$prefs['rah_bitly_' . $name] = '';
}
$position++;
}
set_pref('rah_bitly_version', self::$version, 'rah_bitly', 2, '', 0);
$prefs['rah_bitly_version'] = self::$version;
}
示例9: safe_query
safe_query("alter ignore table " . safe_pfx('txp_category') . " modify parent INT not null");
$types = safe_column('distinct type', 'txp_category', '1=1');
foreach ($types as $type) {
$root = safe_field('id', 'txp_category', "type='" . doSlash($type) . "' and name='root' and parent=0");
if (!$root) {
$root = safe_insert('txp_category', "name='root', type='" . doSlash($type) . "', parent=0");
}
safe_update('txp_category', "parent='" . $root . "'", "type='" . doSlash($type) . "' and parent=0 and id != '" . $root . "'");
tree_rebuild_full('txp_category', "type='" . doSlash($type) . "'");
}
// index on form type
safe_upgrade_index('txp_form', 'type_idx', '', 'type');
// dropdown ui for certain prefs
safe_upgrade_table('txp_prefs', array('choices' => 'varchar(64)'));
safe_update('txp_prefs', "html='checkbox'", "html='yesnoradio'");
safe_update('txp_prefs', "html='text'", "html='text_input'");
safe_update('txp_prefs', "choices='commentmode', html='select'", "html='commentmode'");
safe_update('txp_prefs', "choices='logging', html='select'", "html='logging'");
safe_update('txp_prefs', "choices='production_stati', html='radio'", "html='prod_levels'");
safe_update('txp_prefs', "choices='gmtoffsets', html='select'", "html='gmtoffset_select'");
safe_update('txp_prefs', "choices='weeks', html='select'", "html='weeks'");
safe_update('txp_prefs', "choices='languages', html='select'", "html='languages'");
safe_update('txp_prefs', "choices='permlinkmodes', html='radio'", "html='permlinkmodes'");
safe_update('txp_prefs', "choices='dateformats', html='select'", "html='dateformats'");
// change previous Textile prefs into matching markup class names from classMarkup.php
$use_textile = safe_field('val', 'txp_prefs', "name='use_textile'");
$markups = array('txprawxhtml', 'txptextile', 'txpnl2br');
if (!empty($markups[$use_textile])) {
safe_insert('txp_prefs', "prefs_id = 1, event='publish', name = 'markup_default', val = '{$markups[$use_textile]}', type = '0', html='select', choices='markups'");
safe_delete('txp_prefs', "name='use_textile'");
}
示例10: 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)));
}
}
}
示例11: safe_update
}
safe_update('textpattern', "Keywords=TRIM(BOTH ',' FROM REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(Keywords,'\n',','),'\r',','),'\t',','),' ',' '),' ',' '),' ',' '),' ,',','),', ',','),',,,,',','),',,',','),',,',','))", "Keywords != ''");
// shift preferences to more intuitive spots
// give positions, leave enough room for later additions
safe_update('txp_prefs', "position = 20", "name in(\n\t\t'sitename',\n\t\t'comments_on_default',\n\t\t'img_dir',\n\t\t'comments_require_name',\n\t\t'syndicate_body_or_excerpt',\n\t\t'title_no_widow'\n\t)");
safe_update('txp_prefs', "position = 40", "name in(\n\t\t'siteurl',\n\t\t'comments_default_invite',\n\t\t'file_base_path',\n\t\t'comments_require_email',\n\t\t'rss_how_many',\n\t\t'articles_use_excerpts'\n\t)");
safe_update('txp_prefs', "position = 60", "name in('\n\t\tsite_slogan',\n\t\t'comments_moderate',\n\t\t'never_display_email',\n\t\t'file_max_upload_size',\n\t\t'show_comment_count_in_feed',\n\t\t'allow_form_override'\n\t)");
safe_update('txp_prefs', "position = 80", "name in(\n\t\t'production_status',\n\t\t'comments_disabled_after',\n\t\t'tempdir',\n\t\t'comment_nofollow',\n\t\t'include_email_atom',\n\t\t'attach_titles_to_permalinks'\n\t)");
safe_update('txp_prefs', "position = 100", "name in(\n\t\t'gmtoffset',\n\t\t'comments_auto_append',\n\t\t'plugin_cache_dir',\n\t\t'permalink_title_format',\n\t\t'use_mail_on_feeds_id'\n\t)");
safe_update('txp_prefs', "position = 120", "name in(\n\t\t'is_dst',\n\t\t'comments_mode',\n\t\t'override_emailcharset'\n\t)");
safe_update('txp_prefs', "position = 120, event = 'publish'", "name = 'send_lastmod'");
safe_update('txp_prefs', "position = 140", "name in(\n\t\t'dateformat',\n\t\t'comments_dateformat',\n\t\t'spam_blacklists',\n\t\t'lastmod_keepalive'\n\t)");
safe_update('txp_prefs', "position = 160", "name in(\n\t\t'archive_dateformat',\n\t\t'comments_are_ol',\n\t\t'comment_means_site_updated',\n\t\t'ping_weblogsdotcom'\n\t)");
safe_update('txp_prefs', "position = 180", "name in('permlink_mode','comments_sendmail','ping_textpattern_com')");
safe_update('txp_prefs', "position = 200", "name in('use_textile','expire_logs_after')");
safe_update('txp_prefs', "position = 220", "name in('logging','use_dns')");
safe_update('txp_prefs', "position = 240", "name in('use_comments','max_url_len')");
safe_update('txp_prefs', "position = 260", "name = 'use_plugins'");
safe_update('txp_prefs', "position = 280", "name = 'admin_side_plugins'");
safe_update('txp_prefs', "position = 300", "name = 'allow_page_php_scripting'");
safe_update('txp_prefs', "position = 320", "name = 'allow_article_php_scripting'");
safe_update('txp_prefs', "position = 340", "name = 'allow_raw_php_scripting'");
safe_update('txp_prefs', "position = 120, type = 1", "name = 'comments_disallow_images'");
safe_update('txp_prefs', "event = 'comments'", "name in(\n\t\t'never_display_email',\n\t\t'comment_nofollow',\n\t\t'spam_blacklists',\n\t\t'comment_means_site_updated'\n\t)");
safe_update('txp_prefs', "event = 'feeds'", "name in(\n\t\t'syndicate_body_or_excerpt',\n\t\t'rss_how_many',\n\t\t'show_comment_count_in_feed',\n\t\t'include_email_atom',\n\t\t'use_mail_on_feeds_id'\n\t)");
# 'Textile links' feature removed due to unclear specs.
safe_delete('txp_prefs', "event='link' and name='textile_links'");
# Use TextileRestricted lite/fat in comments?
if (!safe_field('name', 'txp_prefs', "name = 'comments_use_fat_textile'")) {
safe_insert('txp_prefs', "prefs_id = 1, name = 'comments_use_fat_textile', val = '0', type = '1', event='comments', html='yesnoradio', position='130'");
}
示例12: log_list
/**
* The main panel listing all log hits.
*
* @param string|array $message The activity message
*/
function log_list($message = '')
{
global $event, $log_list_pageby, $expire_logs_after;
pagetop(gTxt('tab_logs'), $message);
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if ($sort === '') {
$sort = get_pref('log_sort_column', 'time');
} else {
if (!in_array($sort, array('ip', 'host', 'page', 'refer', 'method', 'status'))) {
$sort = 'time';
}
set_pref('log_sort_column', $sort, 'log', 2, '', 0, PREF_PRIVATE);
}
if ($dir === '') {
$dir = get_pref('log_sort_dir', 'desc');
} else {
$dir = $dir == 'asc' ? "asc" : "desc";
set_pref('log_sort_dir', $dir, 'log', 2, '', 0, PREF_PRIVATE);
}
$expire_logs_after = assert_int($expire_logs_after);
safe_delete('txp_log', "time < DATE_SUB(NOW(), INTERVAL {$expire_logs_after} DAY)");
switch ($sort) {
case 'ip':
$sort_sql = "ip {$dir}";
break;
case 'host':
$sort_sql = "host {$dir}";
break;
case 'page':
$sort_sql = "page {$dir}";
break;
case 'refer':
$sort_sql = "refer {$dir}";
break;
case 'method':
$sort_sql = "method {$dir}";
break;
case 'status':
$sort_sql = "status {$dir}";
break;
default:
$sort = 'time';
$sort_sql = "time {$dir}";
break;
}
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$search = new Filter($event, array('ip' => array('column' => 'txp_log.ip', 'label' => gTxt('IP')), 'host' => array('column' => 'txp_log.host', 'label' => gTxt('host')), 'page' => array('column' => 'txp_log.page', 'label' => gTxt('page')), 'refer' => array('column' => 'txp_log.refer', 'label' => gTxt('referrer')), 'method' => array('column' => 'txp_log.method', 'label' => gTxt('method')), 'status' => array('column' => 'txp_log.status', 'label' => gTxt('status'), 'type' => 'integer')));
list($criteria, $crit, $search_method) = $search->getFilter(array('status' => array('can_list' => true)));
$search_render_options = array('placeholder' => 'search_logs');
$total = safe_count('txp_log', "{$criteria}");
echo n . tag(hed(gTxt('tab_logs'), 1, array('class' => 'txp-heading')), 'div', array('class' => 'txp-layout-2col-cell-1'));
$searchBlock = n . tag($search->renderForm('log_list', $search_render_options), 'div', array('class' => 'txp-layout-2col-cell-2', 'id' => $event . '_control'));
$contentBlockStart = n . tag_start('div', array('class' => 'txp-layout-1col', 'id' => $event . '_container'));
if ($total < 1) {
if ($criteria != 1) {
echo $searchBlock . $contentBlockStart . graf(span(null, array('class' => 'ui-icon ui-icon-info')) . ' ' . gTxt('no_results_found'), array('class' => 'alert-block information'));
} else {
echo $contentBlockStart . graf(span(null, array('class' => 'ui-icon ui-icon-info')) . ' ' . gTxt('no_refers_recorded'), array('class' => 'alert-block information'));
}
echo n . tag_end('div');
return;
}
$limit = max($log_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo $searchBlock . $contentBlockStart;
$rs = safe_rows_start("*, UNIX_TIMESTAMP(time) AS uTime", 'txp_log', "{$criteria} ORDER BY {$sort_sql} LIMIT {$offset}, {$limit}");
if ($rs) {
echo n . tag(toggle_box('log_detail'), 'div', array('class' => 'txp-list-options')) . n . tag_start('form', array('class' => 'multi_edit_form', 'id' => 'log_form', 'name' => 'longform', 'method' => 'post', 'action' => 'index.php')) . n . tag_start('div', array('class' => 'txp-listtables')) . n . tag_start('table', array('class' => 'txp-list')) . n . tag_start('thead') . tr(hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' class="txp-list-col-multi-edit" scope="col" title="' . gTxt('toggle_all_selected') . '"') . column_head('time', 'time', 'log', true, $switch_dir, $crit, $search_method, ('time' == $sort ? "{$dir} " : '') . 'txp-list-col-time') . column_head('IP', 'ip', 'log', true, $switch_dir, $crit, $search_method, ('ip' == $sort ? "{$dir} " : '') . 'txp-list-col-ip') . column_head('host', 'host', 'log', true, $switch_dir, $crit, $search_method, ('host' == $sort ? "{$dir} " : '') . 'txp-list-col-host log_detail') . column_head('page', 'page', 'log', true, $switch_dir, $crit, $search_method, ('page' == $sort ? "{$dir} " : '') . 'txp-list-col-page') . column_head('referrer', 'refer', 'log', true, $switch_dir, $crit, $search_method, ('refer' == $sort ? "{$dir} " : '') . 'txp-list-col-refer') . column_head('method', 'method', 'log', true, $switch_dir, $crit, $search_method, ('method' == $sort ? "{$dir} " : '') . 'txp-list-col-method log_detail') . column_head('status', 'status', 'log', true, $switch_dir, $crit, $search_method, ('status' == $sort ? "{$dir} " : '') . 'txp-list-col-status log_detail')) . n . tag_end('thead') . n . tag_start('tbody');
while ($a = nextRow($rs)) {
extract($a, EXTR_PREFIX_ALL, 'log');
if ($log_refer) {
$log_refer = href(txpspecialchars(soft_wrap(preg_replace('#^http://#', '', $log_refer), 30)), txpspecialchars($log_refer), ' target="_blank"');
}
if ($log_page) {
$log_anchor = preg_replace('/\\/$/', '', $log_page);
$log_anchor = soft_wrap(substr($log_anchor, 1), 30);
$log_page = href(txpspecialchars($log_anchor), txpspecialchars($log_page), ' target="_blank"');
if ($log_method == 'POST') {
$log_page = strong($log_page);
}
}
echo tr(td(fInput('checkbox', 'selected[]', $log_id), '', 'txp-list-col-multi-edit') . hCell(gTime($log_uTime), '', ' class="txp-list-col-time" scope="row"') . td(href(txpspecialchars($log_ip), 'https://whois.domaintools.com/' . rawurlencode($log_ip), array('rel' => 'external', 'target' => '_blank')), '', 'txp-list-col-ip') . td(txpspecialchars($log_host), '', 'txp-list-col-host log_detail') . td($log_page, '', 'txp-list-col-page') . td($log_refer, '', 'txp-list-col-refer') . td(txpspecialchars($log_method), '', 'txp-list-col-method log_detail') . td($log_status, '', 'txp-list-col-status log_detail'));
}
echo n . tag_end('tbody') . n . tag_end('table') . n . tag_end('div') . log_multiedit_form($page, $sort, $dir, $crit, $search_method) . tInput() . n . tag_end('form') . n . tag_start('div', array('class' => 'txp-navigation', 'id' => $event . '_navigation')) . pageby_form('log', $log_list_pageby) . nav_form('log', $page, $numPages, $sort, $dir, $crit, $search_method, $total, $limit) . n . tag_end('div');
}
echo n . tag_end('div');
}
示例13: safe_delete
if ((include txpath . DS . 'update' . DS . '_to_4.3.0.php') !== false) {
$dbversion = '4.3.0';
}
}
if (version_compare($dbversion, '4.4.0', '<')) {
if ((include txpath . DS . 'update' . DS . '_to_4.4.0.php') !== false) {
$dbversion = '4.4.0';
}
}
if (version_compare($dbversion, '4.4.1', '<')) {
if ((include txpath . DS . 'update' . DS . '_to_4.4.1.php') !== false) {
$dbversion = '4.4.1';
}
}
if (version_compare($dbversion, '4.4.2', '<')) {
if ((include txpath . DS . 'update' . DS . '_to_4.4.2.php') !== false) {
$dbversion = '4.4.2';
}
}
// keep track of updates for svn users
safe_delete('txp_prefs', "name = 'dbupdatetime'");
safe_insert('txp_prefs', "prefs_id=1, name='dbupdatetime',val='" . max(newest_file(), time()) . "', type='2'");
// update version
safe_delete('txp_prefs', "name = 'version'");
safe_insert('txp_prefs', "prefs_id=1, name='version',val='{$dbversion}', type='2'");
// updated, baby. So let's get the fresh prefs and send them to languages
define('TXP_UPDATE_DONE', 1);
$event = 'prefs';
$step = 'list_languages';
$prefs = get_prefs();
extract($prefs);
示例14: 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'));
}
示例15: remove_language
/**
* Remove all language strings for the given lang code.
*
* Removed language code is specified with 'lang_code' HTTP POST
* parameter.
*/
function remove_language()
{
$lang_code = ps('lang_code');
$ret = safe_delete('txp_lang', "lang = '" . doSlash($lang_code) . "'");
if ($ret) {
callback_event('lang_deleted', '', 0, $lang_code);
$msg = gTxt($lang_code) . sp . gTxt('deleted');
} else {
$msg = gTxt('cannot_delete', array('{thing}' => $lang_code));
}
list_languages($msg);
}