本文整理汇总了PHP中getPref函数的典型用法代码示例。如果您正苦于以下问题:PHP getPref函数的具体用法?PHP getPref怎么用?PHP getPref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPref函数的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: Mail_Fetch_Servers
/**
* @return array
*/
function Mail_Fetch_Servers()
{
global $data_dir, $username;
$mailfetch = array();
$mailfetch['server_number'] = getPref($data_dir, $username, "mailfetch_server_number");
if (!isset($mailfetch['server_number']) || $mailfetch['server_number'] < 1) {
$mailfetch['server_number'] = 0;
}
$mailfetch['cypher'] = getPref($data_dir, $username, "mailfetch_cypher");
for ($i = 0; $i < $mailfetch['server_number']; $i++) {
$mailfetch[$i]['server'] = getPref($data_dir, $username, "mailfetch_server_{$i}");
$mailfetch[$i]['port'] = getPref($data_dir, $username, "mailfetch_port_{$i}");
$mailfetch[$i]['alias'] = getPref($data_dir, $username, "mailfetch_alias_{$i}");
$mailfetch[$i]['user'] = getPref($data_dir, $username, "mailfetch_user_{$i}");
$mailfetch[$i]['pass'] = getPref($data_dir, $username, "mailfetch_pass_{$i}");
if ($mailfetch['cypher'] == 'on') {
$mailfetch[$i]['pass'] = decrypt($mailfetch[$i]['pass']);
}
if ($mailfetch[$i]['pass'] == '') {
sqgetGlobalVar("pass_{$i}", $mailfetch[$i]['pass'], SQ_POST);
}
$mailfetch[$i]['lmos'] = getPref($data_dir, $username, "mailfetch_lmos_{$i}");
$mailfetch[$i]['login'] = getPref($data_dir, $username, "mailfetch_login_{$i}");
$mailfetch[$i]['uidl'] = getPref($data_dir, $username, "mailfetch_uidl_{$i}");
$mailfetch[$i]['subfolder'] = getPref($data_dir, $username, "mailfetch_subfolder_{$i}");
if ($mailfetch[$i]['alias'] == '') {
$mailfetch[$i]['alias'] == $mailfetch[$i]['server'];
}
// Authentication type (added in 1.5.2)
$mailfetch[$i]['auth'] = getPref($data_dir, $username, "mailfetch_auth_{$i}", MAIL_FETCH_AUTH_USER);
// Connection type (added in 1.5.2)
$mailfetch[$i]['type'] = getPref($data_dir, $username, "mailfetch_type_{$i}", MAIL_FETCH_USE_PLAIN);
}
return $mailfetch;
}
示例3: 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);
}
示例4: auto_cc_loading_prefs
function auto_cc_loading_prefs()
{
global $username, $data_dir;
global $auto_cc_cc_addr;
global $auto_cc_bcc_addr;
$auto_cc_bcc_addr = getPref($data_dir, $username, "auto_cc_bcc_addr");
$auto_cc_cc_addr = getPref($data_dir, $username, "auto_cc_cc_addr");
}
示例5: getBoxStructure
/**
* Recursively iterates a mailboxes object to build a data structure that is
* easy for template authors to work with.
FIXME: well.... why not document that data structure here?
*
* @param object $boxes Object of the class mailboxes
* @author Steve Brown
* @since 1.5.2
*/
function getBoxStructure($boxes)
{
global $data_dir, $username, $icon_theme_path;
// Stop condition
if (empty($boxes)) {
return array();
}
$mailbox = $boxes->mailboxname_full;
$mailboxURL = urlencode($mailbox);
$box = array();
$box['MailboxFullName'] = $mailbox;
$box['MailboxName'] = $boxes->mailboxname_sub;
$box['MessageCount'] = !empty($boxes->total) ? $boxes->total : 0;
$box['UnreadCount'] = !empty($boxes->unseen) ? $boxes->unseen : 0;
// Needed in case user enables cummulative message counts
$box['CummulativeMessageCount'] = getMessageCount($boxes, 'total');
$box['CummulativeUnreadCount'] = getMessageCount($boxes, 'unseen');
$box['ViewLink'] = array('Target' => 'right', 'URL' => 'right_main.php?PG_SHOWALL=0&startMessage=1&mailbox=' . $mailboxURL);
$box['IsRecent'] = isset($boxes->recent) && $boxes->recent;
$box['IsSpecial'] = isset($boxes->is_special) && $boxes->is_special;
$box['IsRoot'] = isset($boxes->is_root) && $boxes->is_root;
$box['IsNoSelect'] = isset($boxes->is_noselect) && $boxes->is_noselect;
$box['IsInbox'] = isset($boxes->is_inbox) && $boxes->is_inbox;
$box['IsSent'] = isset($boxes->is_sent) && $boxes->is_sent;
$box['IsTrash'] = isset($boxes->is_trash) && $boxes->is_trash;
$box['IsDraft'] = isset($boxes->is_draft) && $boxes->is_draft;
$box['IsNoInferiors'] = isset($boxes->is_noinferiors) && $boxes->is_noinferiors;
$collapse = getPref($data_dir, $username, 'collapse_folder_' . $mailbox);
$collapse = $collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse;
$collapse = (int) $collapse == SM_BOX_COLLAPSED;
$box['IsCollapsed'] = $collapse;
/*
* Check for an image needed here. If the file exists in $icon_theme_path
* assume the template provides all icons. If not, we will use the
* SQM default images. If icons have been disabled, $icon_theme_path
* will be NULL.
*/
$text_icon = $box['IsCollapsed'] ? '+' : '-';
$icon_file = $box['IsCollapsed'] ? 'plus.png' : 'minus.png';
$icon_alt = $box['IsCollapsed'] ? 'Expand Box' : 'Collapse Box';
$icon = getIcon($icon_theme_path, $icon_file, $text_icon, $icon_alt);
$box['CollapseLink'] = array('Target' => 'left', 'URL' => 'left_main.php?' . ($box['IsCollapsed'] ? 'unfold' : 'fold') . '=' . $mailboxURL, 'Icon' => $icon . ' ');
$box['ChildBoxes'] = array();
for ($i = 0; $i < count($boxes->mbxs); $i++) {
$box['ChildBoxes'][] = getBoxStructure($boxes->mbxs[$i]);
}
// if plugins want to add some text or link after the folder name in
// the folder list, they should add to the "ExtraOutput" array element
// in $box (remember, it's passed through the hook by reference) -- making
// sure to play nice with other plugins by *concatenating* to "ExtraOutput"
// and NOT by overwriting it
//
// known users of this hook:
// empty_folders
//
do_hook('left_main_after_each_folder', $box);
return $box;
}
示例6: bug_report_block_do
/**
* Register bug report option block
*
* @since 1.4.14
*
* @access private
*
*/
function bug_report_block_do()
{
global $username, $data_dir, $optpage_data, $bug_report_visible;
$bug_report_visible = getPref($data_dir, $username, 'bug_report_visible', FALSE);
$optpage_data['grps']['bug_report'] = _("Bug Reports");
$optionValues = array();
$optionValues[] = array('name' => 'bug_report_visible', 'caption' => _("Show button in toolbar"), 'type' => SMOPT_TYPE_BOOLEAN, 'refresh' => SMOPT_REFRESH_ALL, 'initial_value' => false);
$optpage_data['vals']['bug_report'] = $optionValues;
}
示例7: getMailerDelim
function getMailerDelim()
{
global $mailers;
if (getPref('mailer') == 'colon') {
return ",";
} else {
// return ";";
return "%3B";
}
}
示例8: fortune_show_options
/**
* Add fortune options
* @access private
*/
function fortune_show_options()
{
global $optpage_data, $username, $data_dir, $fortune_visible;
$fortune_visible = getPref($data_dir, $username, 'fortune_visible');
$optgrp = _("Fortunes");
$optvals = array();
$optvals[] = array('name' => 'fortune_visible', 'caption' => _("Show fortunes at top of mailbox"), 'type' => SMOPT_TYPE_BOOLEAN, 'refresh' => SMOPT_REFRESH_NONE);
$optpage_data['grps']['fortune'] = $optgrp;
$optpage_data['vals']['fortune'] = $optvals;
}
示例9: fortune
/**
* Show fortune
* @access private
*/
function fortune()
{
global $fortune_visible, $username, $data_dir;
$fortune_visible = getPref($data_dir, $username, 'fortune_visible');
// Don't show fortune if not enabled
if (empty($fortune_visible)) {
return;
}
include_once SM_PATH . 'plugins/fortune/fortune_functions.php';
fortune_show();
}
示例10: get_tab_car_spec_cdt2
function get_tab_car_spec_cdt2()
{
$tab_car_spec = array();
$cdt2_car_spec_liste = getPref($_SESSION['login'], "cdt2_car_spec_liste", "");
if ($cdt2_car_spec_liste != "") {
$tab = explode(';', $cdt2_car_spec_liste);
for ($loop = 0; $loop < count($tab); $loop++) {
$tab_car_spec[] = $tab[$loop] . ";";
}
}
return $tab_car_spec;
}
示例11: get_identities
/**
* Returns an array of all the identities.
* Array is keyed: full_name, reply_to, email_address, index, signature
* @return array full_name,reply_to,email_address,index,signature
*/
function get_identities()
{
global $username, $data_dir;
$num_ids = getPref($data_dir, $username, 'identities');
$identities = array();
/* We always have this one, even if the user doesn't use multiple identities */
$identities[] = array('full_name' => getPref($data_dir, $username, 'full_name'), 'email_address' => getPref($data_dir, $username, 'email_address'), 'reply_to' => getPref($data_dir, $username, 'reply_to'), 'signature' => getSig($data_dir, $username, 'g'), 'index' => 0);
/* If there are any others, add them to the array */
if (!empty($num_ids) && $num_ids > 1) {
for ($i = 1; $i < $num_ids; $i++) {
$identities[] = array('full_name' => getPref($data_dir, $username, 'full_name' . $i), 'email_address' => getPref($data_dir, $username, 'email_address' . $i), 'reply_to' => getPref($data_dir, $username, 'reply_to' . $i), 'signature' => getSig($data_dir, $username, $i), 'index' => $i);
}
}
return $identities;
}
示例12: get_non_rfc_lists
/**
* Get current list of subscribed non-RFC-compliant mailing lists for logged-in user
*
* @return array The list of mailing list addresses, keyed by integer index
*/
function get_non_rfc_lists()
{
global $username, $data_dir;
$lists = getPref($data_dir, $username, 'non_rfc_lists', array());
$new_lists = array();
if (!empty($lists)) {
$lists = explode(':', $lists);
foreach ($lists as $list) {
list($index, $list_addr) = explode('_', $list);
if ((!empty($index) || $index === '0') && !empty($list_addr)) {
$new_lists[$index] = $list_addr;
}
}
}
$lists = $new_lists;
sort($lists);
return $lists;
}
示例13: checkForJavascript
function checkForJavascript($reset = FALSE)
{
global $data_dir, $username, $javascript_on, $javascript_setting;
if (!$reset && sqGetGlobalVar('javascript_on', $javascript_on, SQ_SESSION)) {
return $javascript_on;
}
if (($reset || !isset($javascript_setting)) && (sqGetGlobalVar('user_is_logged_in', $user_is_logged_in, SQ_SESSION) && $user_is_logged_in)) {
$javascript_setting = getPref($data_dir, $username, 'javascript_setting', SMPREF_JS_AUTODETECT);
}
if (!sqGetGlobalVar('new_js_autodetect_results', $js_autodetect_results) && !sqGetGlobalVar('js_autodetect_results', $js_autodetect_results)) {
$js_autodetect_results = SMPREF_JS_OFF;
}
if ($javascript_setting == SMPREF_JS_AUTODETECT) {
$javascript_on = $js_autodetect_results;
} else {
$javascript_on = $javascript_setting;
}
sqsession_register($javascript_on, 'javascript_on');
return $javascript_on;
}
示例14: 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;
}
}
示例15: load_optpage_data_personal
/**
* This function builds an array with all the information about
* the options available to the user, and returns it. The options
* are grouped by the groups in which they are displayed.
* For each option, the following information is stored:
* - name: the internal (variable) name
* - caption: the description of the option in the UI
* - type: one of SMOPT_TYPE_*
* - refresh: one of SMOPT_REFRESH_*
* - size: one of SMOPT_SIZE_*
* - save: the name of a function to call when saving this option
* @return array all option information
*/
function load_optpage_data_personal()
{
global $data_dir, $username, $edit_identity, $edit_name, $edit_reply_to, $full_name, $reply_to, $email_address, $signature, $tzChangeAllowed, $timeZone, $domain;
/* Set the values of some global variables. */
$full_name = getPref($data_dir, $username, 'full_name');
$reply_to = getPref($data_dir, $username, 'reply_to');
$email_address = getPref($data_dir, $username, 'email_address', SMPREF_NONE);
$signature = getSig($data_dir, $username, 'g');
// set email_address to default value, if it is not set in user's preferences
if ($email_address == SMPREF_NONE) {
if (preg_match("/(.+)@(.+)/", $username)) {
$email_address = $username;
} else {
$email_address = $username . '@' . $domain;
}
}
/* Build a simple array into which we will build options. */
$optgrps = array();
$optvals = array();
/******************************************************/
/* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */
/******************************************************/
/*** Load the Contact Information Options into the array ***/
$optgrps[SMOPT_GRP_CONTACT] = _("Name and Address Options");
$optvals[SMOPT_GRP_CONTACT] = array();
/* Build a simple array into which we will build options. */
$optvals = array();
if (!isset($edit_identity)) {
$edit_identity = TRUE;
}
if ($edit_identity || $edit_name) {
$optvals[SMOPT_GRP_CONTACT][] = array('name' => 'full_name', 'caption' => _("Full Name"), 'type' => SMOPT_TYPE_STRING, 'refresh' => SMOPT_REFRESH_NONE, 'size' => SMOPT_SIZE_HUGE);
} else {
$optvals[SMOPT_GRP_CONTACT][] = array('name' => 'full_name', 'caption' => _("Full Name"), 'type' => SMOPT_TYPE_COMMENT, 'refresh' => SMOPT_REFRESH_NONE, 'comment' => $full_name);
}
if ($edit_identity) {
$optvals[SMOPT_GRP_CONTACT][] = array('name' => 'email_address', 'caption' => _("E-mail Address"), 'type' => SMOPT_TYPE_STRING, 'refresh' => SMOPT_REFRESH_NONE, 'size' => SMOPT_SIZE_HUGE);
} else {
$optvals[SMOPT_GRP_CONTACT][] = array('name' => 'email_address', 'caption' => _("E-mail Address"), 'type' => SMOPT_TYPE_COMMENT, 'refresh' => SMOPT_REFRESH_NONE, 'comment' => sm_encode_html_special_chars($email_address));
}
if ($edit_identity || $edit_reply_to) {
$optvals[SMOPT_GRP_CONTACT][] = array('name' => 'reply_to', 'caption' => _("Reply To"), 'type' => SMOPT_TYPE_STRING, 'refresh' => SMOPT_REFRESH_NONE, 'size' => SMOPT_SIZE_HUGE);
} else {
//TODO: For many users, this is redundant to the email address above, especially if not editable -- so here instead of a comment, we could just hide it... in fact, that's what we'll do, but keep this code for posterity in case someone decides we shouldn't do this
/*
$optvals[SMOPT_GRP_CONTACT][] = array(
'name' => 'reply_to',
'caption' => _("Reply To"),
'type' => SMOPT_TYPE_COMMENT,
'refresh' => SMOPT_REFRESH_NONE,
'comment' => sm_encode_html_special_chars($reply_to),
);
*/
}
$optvals[SMOPT_GRP_CONTACT][] = array('name' => 'signature', 'caption' => _("Signature"), 'type' => SMOPT_TYPE_TEXTAREA, 'refresh' => SMOPT_REFRESH_NONE, 'size' => SMOPT_SIZE_MEDIUM, 'save' => 'save_option_signature');
if ($edit_identity) {
$identities_link_value = '<a href="options_identities.php">' . _("Edit Advanced Identities") . '</a> ' . _("(discards changes made on this form so far)");
$optvals[SMOPT_GRP_CONTACT][] = array('name' => 'identities_link', 'caption' => _("Multiple Identities"), 'type' => SMOPT_TYPE_COMMENT, 'refresh' => SMOPT_REFRESH_NONE, 'comment' => $identities_link_value);
}
if ($tzChangeAllowed || function_exists('date_default_timezone_set')) {
$TZ_ARRAY[SMPREF_NONE] = _("Same as server");
$aTimeZones = sq_get_tz_array();
unset($message);
if (!empty($aTimeZones)) {
// check if current timezone is linked to other TZ and update it
if ($timeZone != SMPREF_NONE && $timeZone != "" && isset($aTimeZones[$timeZone]['LINK'])) {
$timeZone = $aTimeZones[$timeZone]['LINK'];
// TODO: recheck setting of $timeZone
// setPref($data_dir,$username,'timezone',$timeZone);
}
// sort time zones by name. sq_get_tz_array() returns sorted by key.
// asort($aTimeZones);
// add all 'TZ' entries to TZ_ARRAY
foreach ($aTimeZones as $TzKey => $TzData) {
if (!isset($TzData['LINK'])) {
// Old display format
$TZ_ARRAY[$TzKey] = $TzKey;
// US Eastern standard time (America/New_York) - needs asort($aTimeZones)
//$TZ_ARRAY[$TzKey] = (isset($TzData['NAME']) ? $TzData['NAME']." ($TzKey)" : "($TzKey)");
// US Eastern standard time if NAME is present or America/New_York if NAME not present
// needs sorting after all data is added or uasort()
//$TZ_ARRAY[$TzKey] = (isset($TzData['NAME']) ? $TzData['NAME'] : $TzKey);
// (America/New_Your) US Eastern standard time
//$TZ_ARRAY[$TzKey] = "($TzKey)" . (isset($TzData['NAME']) ? ' '.$TzData['NAME'] : '');
}
}
} else {
//.........这里部分代码省略.........