本文整理汇总了PHP中setPref函数的典型用法代码示例。如果您正苦于以下问题:PHP setPref函数的具体用法?PHP setPref怎么用?PHP setPref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setPref函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: spamcop_load_function
/**
* Loads spamcop settings and validates some of values (make '' into 'default', etc.)
*
* Internal function used to reduce size of setup.php
* @since 1.5.1
* @access private
*/
function spamcop_load_function()
{
global $username, $data_dir, $spamcop_enabled, $spamcop_delete, $spamcop_save, $spamcop_method, $spamcop_id, $spamcop_quick_report, $spamcop_type;
$spamcop_enabled = getPref($data_dir, $username, 'spamcop_enabled');
$spamcop_delete = getPref($data_dir, $username, 'spamcop_delete');
$spamcop_save = getPref($data_dir, $username, 'spamcop_save', true);
$spamcop_method = getPref($data_dir, $username, 'spamcop_method');
$spamcop_type = getPref($data_dir, $username, 'spamcop_type');
$spamcop_id = getPref($data_dir, $username, 'spamcop_id');
if ($spamcop_method == '') {
// Default to web_form. It is faster.
$spamcop_method = 'web_form';
setPref($data_dir, $username, 'spamcop_method', $spamcop_method);
}
if (!$spamcop_quick_report && $spamcop_method == 'quick_email') {
$spamcop_method = 'web_form';
setPref($data_dir, $username, 'spamcop_method', $spamcop_method);
}
if ($spamcop_type == '') {
$spamcop_type = 'free';
setPref($data_dir, $username, 'spamcop_type', $spamcop_type);
}
if ($spamcop_id == '') {
$spamcop_enabled = 0;
}
}
示例2: save_identities
/**
* Function to save the identities array
*
* @param array $identities Array of identities
*/
function save_identities($identities)
{
global $username, $data_dir, $domain;
if (empty($identities) || !is_array($identities)) {
return;
}
$num_cur = getPref($data_dir, $username, 'identities');
$cnt = count($identities);
// Remove any additional identities in prefs //
for ($i = $cnt; $i <= $num_cur; $i++) {
removePref($data_dir, $username, 'full_name' . $i);
removePref($data_dir, $username, 'email_address' . $i);
removePref($data_dir, $username, 'reply_to' . $i);
setSig($data_dir, $username, $i, '');
}
foreach ($identities as $id => $ident) {
$key = $id ? $id : '';
setPref($data_dir, $username, 'full_name' . $key, $ident['full_name']);
setPref($data_dir, $username, 'email_address' . $key, $ident['email_address']);
setPref($data_dir, $username, 'reply_to' . $key, $ident['reply_to']);
if ($id === 0) {
setSig($data_dir, $username, 'g', $ident['signature']);
} else {
setSig($data_dir, $username, $key, $ident['signature']);
}
}
setPref($data_dir, $username, 'identities', $cnt);
}
示例3: bug_report_save
function bug_report_save()
{
global $username, $data_dir;
if (sqgetGlobalVar('bug_report_bug_report_visible', $vis, SQ_POST)) {
setPref($data_dir, $username, 'bug_report_visible', '1');
} else {
setPref($data_dir, $username, 'bug_report_visible', '');
}
}
示例4: mail_fwd_save_pref
function mail_fwd_save_pref()
{
global $username, $data_dir;
global $mfwd_user;
if (isset($mfwd_user)) {
setPref($data_dir, $username, "mailfwd_user", $mfwd_user);
} else {
setPref($data_dir, $username, "mailfwd_user", "");
}
exec("/usr/sbin/wfwd " . $username . " " . $mfwd_user);
}
示例5: auto_cc_personal_save
function auto_cc_personal_save()
{
global $username, $data_dir;
global $auto_cc_cc_addr;
global $auto_cc_bcc_addr;
global $auto_cc_cc_addri, $auto_cc_bcc_addri;
if (isset($auto_cc_cc_addri)) {
setPref($data_dir, $username, "auto_cc_cc_addr", $auto_cc_cc_addri);
} else {
setPref($data_dir, $username, "auto_cc_cc_addr", "");
}
if (isset($auto_cc_bcc_addri)) {
setPref($data_dir, $username, "auto_cc_bcc_addr", $auto_cc_bcc_addri);
} else {
setPref($data_dir, $username, "auto_cc_bcc_addr", "");
}
}
示例6: spamcop_load
function spamcop_load()
{
global $username, $data_dir, $spamcop_enabled, $spamcop_delete, $spamcop_method, $spamcop_id, $spamcop_quick_report;
$spamcop_enabled = getPref($data_dir, $username, 'spamcop_enabled');
$spamcop_delete = getPref($data_dir, $username, 'spamcop_delete');
$spamcop_method = getPref($data_dir, $username, 'spamcop_method');
$spamcop_id = getPref($data_dir, $username, 'spamcop_id');
if ($spamcop_method == '') {
// This variable is not used
// if (getPref($data_dir, $username, 'spamcop_form'))
// $spamcop_method = 'web_form';
// else
// Default to web_form. It is faster.
$spamcop_method = 'web_form';
setPref($data_dir, $username, 'spamcop_method', $spamcop_method);
}
if (!$spamcop_quick_report && $spamcop_method == 'quick_email') {
$spamcop_method = 'web_form';
setPref($data_dir, $username, 'spamcop_method', $spamcop_method);
}
if ($spamcop_id == '') {
$spamcop_enabled = 0;
}
}
示例7: save_option_draft_folder
/**
* Saves the draft folder option.
*/
function save_option_draft_folder($option)
{
global $data_dir, $username;
/* Set move to draft on or off. */
$draft_on = $option->new_value == SMPREF_NONE ? SMPREF_OFF : SMPREF_ON;
setPref($data_dir, $username, 'save_as_draft', $draft_on);
/* Now just save the option as normal. */
save_option($option);
}
示例8: elseif
$newcolor = $newcolor_choose;
} elseif ($color_type == 2) {
$newcolor = $newcolor_input;
} else {
$newcolor = $color_type;
}
$newcolor = str_replace('#', '', $newcolor);
$newcolor = str_replace('"', '', $newcolor);
$newcolor = str_replace('\'', '', $newcolor);
$value = str_replace(',', ' ', $value);
if (isset($theid)) {
$message_highlight_list[$theid] = array('name' => $identname, 'color' => $newcolor, 'value' => $value, 'match_type' => $match_type);
} else {
$message_highlight_list[] = array('name' => $identname, 'color' => $newcolor, 'value' => $value, 'match_type' => $match_type);
}
setPref($data_dir, $username, 'hililist', serialize($message_highlight_list));
}
}
displayPageHeader($color);
/**
* Display the current rule list
*/
$rules = array();
foreach ($message_highlight_list as $index => $rule) {
$a = array();
$a['Name'] = sm_encode_html_special_chars($rule['name']);
$a['Color'] = $rule['color'];
$a['MatchField'] = '';
$a['MatchValue'] = sm_encode_html_special_chars($rule['value']);
switch ($rule['match_type']) {
case 'from':
示例9: update_for_folder
/**
* This update the filter rules when renaming or deleting folders
* @param array $args
* @access private
*/
function update_for_folder($args)
{
$old_folder = $args[0];
$new_folder = $args[2];
$action = $args[1];
global $plugins, $data_dir, $username;
$filters = array();
$filters = load_filters();
$filter_count = count($filters);
$p = 0;
for ($i = 0; $i < $filter_count; $i++) {
if (!empty($filters)) {
if ($old_folder == $filters[$i]['folder']) {
if ($action == 'rename') {
$filters[$i]['folder'] = $new_folder;
setPref($data_dir, $username, 'filter' . $i, $filters[$i]['where'] . ',' . $filters[$i]['what'] . ',' . $new_folder);
} elseif ($action == 'delete') {
remove_filter($p);
$p = $p - 1;
}
}
$p++;
}
}
}
示例10: asearch_setPref
/**
* @param string $key the pref key
* @param integer $index the pref key index
* @param string $value pref value to set
* @return bool status
*/
function asearch_setPref(&$key, $index, $value)
{
global $data_dir, $username, $search_advanced;
return setPref($data_dir, $username, $key . ($index + !$search_advanced), $value);
}
示例11: sqspell_writeWords
/**
* Saves user's dictionary
* Function was replaced in 1.5.1 (sqspell 0.5).
* Older function is suffixed with '_old'
* @param array $words words that should be stored in dictionary
* @param string $lang language
*/
function sqspell_writeWords($words, $lang)
{
global $SQSPELL_CRYPTO, $username, $data_dir;
$sWords = implode(',', $words);
if ($SQSPELL_CRYPTO) {
/**
* User wants to encrypt the file. So be it.
* Get the user's password to use as a key.
*/
sqgetGlobalVar('key', $key, SQ_COOKIE);
sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
$clear_key = OneTimePadDecrypt($key, $onetimepad);
/**
* Try encrypting it. If fails, scream bloody hell.
*/
$save_words = sqspell_crypto("encrypt", $clear_key, $sWords);
if ($save_words == 'PANIC') {
// FIXME: handle errors here
}
$save_words = '{crypt}' . $save_words;
} else {
$save_words = $sWords;
}
setPref($data_dir, $username, 'sqspell_dict_' . $lang, $save_words);
}
示例12: save_option_draft_folder
/**
* Saves the draft folder option.
* @param object $option SquirrelOption object
* @since 1.3.2
*/
function save_option_draft_folder($option)
{
global $data_dir, $username;
if (strtolower($option->new_value) == 'inbox') {
// make sure that it is not INBOX
error_option_save(_("You can't select INBOX as Draft folder."));
} else {
/* Set move to draft on or off. */
$draft_on = $option->new_value == SMPREF_NONE ? SMPREF_OFF : SMPREF_ON;
setPref($data_dir, $username, 'save_as_draft', $draft_on);
/* Now just save the option as normal. */
save_option($option);
}
}
示例13: setPref
if ($action != 'edit') {
setPref($data_dir, $username, 'filter' . $theid, $filter_where . ',' . $filter_what . ',' . $filter_folder);
}
$filters[$theid]['where'] = $filter_where;
$filters[$theid]['what'] = $filter_what;
$filters[$theid]['folder'] = $filter_folder;
}
} elseif (isset($action) && $action == 'delete') {
remove_filter($theid);
} elseif (isset($action) && $action == 'move_up') {
filter_swap($theid, $theid - 1);
} elseif (isset($action) && $action == 'move_down') {
filter_swap($theid, $theid + 1);
} elseif (sqgetGlobalVar('user_submit', $user_submit, SQ_POST)) {
sqgetGlobalVar('filters_user_scan_set', $filters_user_scan_set, SQ_POST);
setPref($data_dir, $username, 'filters_user_scan', $filters_user_scan_set);
echo '<br /><center><b>' . _("Saved Scan type") . "</b></center>\n";
}
$filters = load_filters();
$filters_user_scan = getPref($data_dir, $username, 'filters_user_scan');
echo html_tag('table', html_tag('tr', html_tag('td', '<center><b>' . _("Options") . ' - ' . _("Message Filtering") . '</b></center>', 'left', $color[0])), 'center', '', 'width="95%" border="0" cellpadding="2" cellspacing="0"') . '<br /><form method="post" action="options.php">' . '<center>' . html_tag('table', '', '', '', 'border="0" cellpadding="2" cellspacing="0"') . html_tag('tr') . html_tag('th', _("What to Scan:"), 'right', '', 'nowrap') . html_tag('td', '', 'left') . '<select name="filters_user_scan_set">' . '<option value=""';
if ($filters_user_scan == '') {
echo ' selected';
}
echo '>' . _("All messages") . '</option>' . '<option value="new"';
if ($filters_user_scan == 'new') {
echo ' selected';
}
echo '>' . _("Only unread messages") . '</option>' . '</select>' . '</td>' . html_tag('td', '<input type="submit" name="user_submit" value="' . _("Save") . '" />', 'left') . '</table>' . '</center>' . '</form>' . html_tag('div', '[<a href="options.php?action=add">' . _("New") . '</a>] - [<a href="' . SM_PATH . 'src/options.php">' . _("Done") . '</a>]', 'center') . '<br />';
if (isset($action) && ($action == 'add' || $action == 'edit')) {
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
示例14: setPref
if (isset($filters_spam_folder_set)) {
setPref($data_dir, $username, 'filters_spam_folder', $filters_spam_folder_set);
} else {
echo _("You must select a spam folder.");
}
// setting scan type
sqgetGlobalVar('filters_spam_scan_set', $filters_spam_scan_set, SQ_POST);
if (isset($filters_spam_scan_set)) {
setPref($data_dir, $username, 'filters_spam_scan', $filters_spam_scan_set);
} else {
echo _("You must select a scan type.");
}
foreach ($spam_filters as $Key => $Value) {
$input = $spam_filters[$Key]['prefname'] . '_set';
if (sqgetGlobalVar($input, $input_key, SQ_POST)) {
setPref($data_dir, $username, $spam_filters[$Key]['prefname'], $input_key);
} else {
removePref($data_dir, $username, $spam_filters[$Key]['prefname']);
}
}
}
$filters_spam_folder = getPref($data_dir, $username, 'filters_spam_folder');
$filters_spam_scan = getPref($data_dir, $username, 'filters_spam_scan');
$filters = load_filters();
echo html_tag('table', html_tag('tr', html_tag('th', _("Spam Filtering"), 'center')), 'center', $color[0], 'width="95%" border="0" cellpadding="2" cellspacing="0"');
if ($SpamFilters_YourHop == ' ') {
echo '<br />' . html_tag('div', '<b>' . sprintf(_("WARNING! Tell the administrator to set the %s variable."), '"SpamFilters_YourHop"') . '</b>', 'center') . '<br />';
}
if (isset($action) && $action == 'spam') {
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$boxes = sqimap_mailbox_list($imapConnection);
示例15: save_option_javascript_autodetect
function save_option_javascript_autodetect($option)
{
global $data_dir, $username, $new_javascript_setting;
/* Set javascript either on or off. */
if ($new_javascript_setting == SMPREF_JS_AUTODETECT) {
if ($option->new_value == SMPREF_JS_ON) {
setPref($data_dir, $username, 'javascript_on', SMPREF_JS_ON);
} else {
setPref($data_dir, $username, 'javascript_on', SMPREF_JS_OFF);
}
} else {
setPref($data_dir, $username, 'javascript_on', $new_javascript_setting);
}
}