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


PHP removePref函数代码示例

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


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

示例1: 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);
}
开发者ID:jprice,项目名称:EHCP,代码行数:33,代码来源:identity.php

示例2: removePref

}
if ($method == 'up' && $num > 1) {
    $prev = $num - 1;
    $tmp = $index_order[$prev];
    $index_order[$prev] = $index_order[$num];
    $index_order[$num] = $tmp;
} else {
    if ($method == 'down' && $num < count($index_order)) {
        $next = $num++;
        $tmp = $index_order[$next];
        $index_order[$next] = $index_order[$num];
        $index_order[$num] = $tmp;
    } else {
        if ($method == 'remove' && $num) {
            for ($i = 1; $i < 8; $i++) {
                removePref($data_dir, $username, "order{$i}");
            }
            for ($j = 1, $i = 1; $i <= count($index_order); $i++) {
                if ($i != $num) {
                    $new_ary[$j] = $index_order[$i];
                    $j++;
                }
            }
            $index_order = array();
            $index_order = $new_ary;
            if (count($index_order) < 1) {
                include_once '../src/load_prefs.php';
            }
        } else {
            if ($method == 'add' && $add) {
                /* User should not be able to insert PHP-code here */
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:31,代码来源:options_order.php

示例3: remove_filter

/**
 * FIXME: Undocumented function
 * @access private
 */
function remove_filter($id)
{
    global $data_dir, $username;
    while ($nextFilter = getPref($data_dir, $username, 'filter' . ($id + 1))) {
        setPref($data_dir, $username, 'filter' . $id, $nextFilter);
        $id++;
    }
    removePref($data_dir, $username, 'filter' . $id);
}
开发者ID:jprice,项目名称:EHCP,代码行数:13,代码来源:filters.php

示例4: sqspell_deleteWords

/**
 * Deletes user's dictionary
 * Function was modified in 1.5.1 (sqspell 0.5). Older function is suffixed
 * with '_old'
 * @param string $lang dictionary
 */
function sqspell_deleteWords($lang)
{
    global $data_dir, $username;
    removePref($data_dir, $username, 'sqspell_dict_' . $lang);
}
开发者ID:teammember8,项目名称:roundcube,代码行数:11,代码来源:sqspell_functions.php

示例5: getSig

/* Load up the Signature file */
$signature_abs = $signature = getSig($data_dir, $username, 'g');
/* Message Highlighting Rules */
$message_highlight_list = array();
/* use new way of storing highlighting rules */
if ($ser = getPref($data_dir, $username, 'hililist')) {
    $message_highlight_list = unserialize($ser);
} else {
    /* use old way */
    for ($i = 0; $hlt = getPref($data_dir, $username, "highlight{$i}"); ++$i) {
        $highlight_array = explode(',', $hlt);
        $message_highlight_list[$i]['name'] = $highlight_array[0];
        $message_highlight_list[$i]['color'] = $highlight_array[1];
        $message_highlight_list[$i]['value'] = $highlight_array[2];
        $message_highlight_list[$i]['match_type'] = $highlight_array[3];
        removePref($data_dir, $username, "highlight{$i}");
    }
    // NB: The fact that this preference is always set here means that some plugins rely on testing it to know if a user has logged in before - the "old way" above is probably long since obsolete and unneeded, but the setPref() below should not be removed
    /* store in new format for the next time */
    setPref($data_dir, $username, 'hililist', serialize($message_highlight_list));
}
/* Index order lets you change the order of the message index */
$order = getPref($data_dir, $username, 'order1');
for ($i = 1; $order; ++$i) {
    $index_order[$i] = $order;
    $order = getPref($data_dir, $username, 'order' . ($i + 1));
}
if (!isset($index_order)) {
    $index_order[1] = 1;
    $index_order[2] = 2;
    $index_order[3] = 3;
开发者ID:jprice,项目名称:EHCP,代码行数:31,代码来源:load_prefs.php

示例6: asearch_removePref

/**
 * @param string $key the pref key
 * @param integer $index the pref key index
 * @return bool status
 */
function asearch_removePref(&$key, $index)
{
    global $data_dir, $username, $search_advanced;
    return removePref($data_dir, $username, $key . ($index + !$search_advanced));
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:10,代码来源:search.php

示例7: setPref

/**
 * Sets the desired preference setting ($pref_name) to whatever is in $value
 * @ignore
 */
function setPref($data_dir, $username, $pref_name, $value)
{
    global $prefs_cache;
    if (isset($prefs_cache[$pref_name]) && $prefs_cache[$pref_name] == $value) {
        return;
    }
    if ($value === '') {
        removePref($data_dir, $username, $pref_name);
        return;
    }
    $db = new dbPrefs();
    if (isset($db->error)) {
        $db->failQuery();
    }
    $db->setKey($username, $pref_name, $value);
    $prefs_cache[$pref_name] = $value;
    assert_options(ASSERT_ACTIVE, 1);
    assert_options(ASSERT_BAIL, 1);
    assert('$value == $prefs_cache[$pref_name]');
    sqsession_register($prefs_cache, 'prefs_cache');
    return;
}
开发者ID:teammember8,项目名称:roundcube,代码行数:26,代码来源:db_prefs.php

示例8: setPref

/**
 * Set a there preference $string to $value.
 */
function setPref($data_dir, $username, $string, $value)
{
    global $prefs_cache;
    cachePrefValues($data_dir, $username);
    if (isset($prefs_cache[$string]) && $prefs_cache[$string] == $value) {
        return;
    }
    if ($value === '') {
        removePref($data_dir, $username, $string);
        return;
    }
    $prefs_cache[$string] = $value;
    savePrefValues($data_dir, $username);
}
开发者ID:jin255ff,项目名称:company_website,代码行数:17,代码来源:file_prefs.php

示例9: SaveUpdateFunction

function SaveUpdateFunction()
{
    global $username, $data_dir, $full_name, $email_address, $reply_to, $signature;
    $i = 1;
    $fakeI = 1;
    $name = 'form_for_' . $i;
    global ${$name};
    while (isset(${$name})) {
        $name = 'delete_' . $i;
        global ${$name};
        if (isset(${$name})) {
            $fakeI--;
        } else {
            do_hook('options_identities_renumber', $i, $fakeI);
            $filled = 0;
            $name = 'full_name' . $i;
            global ${$name};
            if (${$name} != '') {
                $filled++;
            }
            setPref($data_dir, $username, 'full_name' . $fakeI, ${$name});
            $name = 'email_address' . $i;
            global ${$name};
            if (${$name} != '') {
                $filled++;
            }
            setPref($data_dir, $username, 'email_address' . $fakeI, ${$name});
            $name = 'reply_to' . $i;
            global ${$name};
            if (${$name} != '') {
                $filled++;
            }
            setPref($data_dir, $username, 'reply_to' . $fakeI, ${$name});
            $name = 'signature' . $i;
            global ${$name};
            if (${$name} != '') {
                $filled++;
            }
            setSig($data_dir, $username, $fakeI, ${$name});
            if ($filled == 0) {
                $fakeI--;
            }
        }
        $fakeI++;
        $i++;
        $name = 'form_for_' . $i;
        global ${$name};
    }
    setPref($data_dir, $username, 'identities', $fakeI);
    while ($fakeI != $i) {
        removePref($data_dir, $username, 'full_name' . $fakeI);
        removePref($data_dir, $username, 'email_address' . $fakeI);
        removePref($data_dir, $username, 'reply_to' . $fakeI);
        setSig($data_dir, $username, $fakeI, "");
        $fakeI++;
    }
    setPref($data_dir, $username, 'full_name', $full_name);
    setPref($data_dir, $username, 'email_address', $email_address);
    setPref($data_dir, $username, 'reply_to', $reply_to);
    setSig($data_dir, $username, "g", $signature);
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:61,代码来源:options_identities.php

示例10: sqimap_mailbox_rename

/**
 * Renames a mailbox.
 */
function sqimap_mailbox_rename($imap_stream, $old_name, $new_name)
{
    if ($old_name != $new_name) {
        global $delimiter, $imap_server_type, $data_dir, $username;
        if (substr($old_name, -1) == $delimiter) {
            $old_name = substr($old_name, 0, strlen($old_name) - 1);
            $new_name = substr($new_name, 0, strlen($new_name) - 1);
            $postfix = $delimiter;
        } else {
            $postfix = '';
        }
        $boxesall = sqimap_mailbox_list_all($imap_stream);
        $cmd = 'RENAME "' . $old_name . '" "' . $new_name . '"';
        $data = sqimap_run_command($imap_stream, $cmd, true, $response, $message);
        sqimap_unsubscribe($imap_stream, $old_name . $postfix);
        $oldpref_thread = getPref($data_dir, $username, 'thread_' . $old_name . $postfix);
        $oldpref_collapse = getPref($data_dir, $username, 'collapse_folder_' . $old_name . $postfix);
        removePref($data_dir, $username, 'thread_' . $old_name . $postfix);
        removePref($data_dir, $username, 'collapse_folder_' . $old_name . $postfix);
        sqimap_subscribe($imap_stream, $new_name . $postfix);
        setPref($data_dir, $username, 'thread_' . $new_name . $postfix, $oldpref_thread);
        setPref($data_dir, $username, 'collapse_folder_' . $new_name . $postfix, $oldpref_collapse);
        do_hook_function('rename_or_delete_folder', $args = array($old_name, 'rename', $new_name));
        $l = strlen($old_name) + 1;
        $p = 'unformatted';
        foreach ($boxesall as $box) {
            if (substr($box[$p], 0, $l) == $old_name . $delimiter) {
                $new_sub = $new_name . $delimiter . substr($box[$p], $l);
                /* With Cyrus IMAPd >= 2.0 rename is recursive, so don't check for errors here */
                if ($imap_server_type == 'cyrus') {
                    $cmd = 'RENAME "' . $box[$p] . '" "' . $new_sub . '"';
                    $data = sqimap_run_command($imap_stream, $cmd, false, $response, $message);
                }
                $was_subscribed = sqimap_mailbox_is_subscribed($imap_stream, $box[$p]);
                if ($was_subscribed) {
                    sqimap_unsubscribe($imap_stream, $box[$p]);
                }
                $oldpref_thread = getPref($data_dir, $username, 'thread_' . $box[$p]);
                $oldpref_collapse = getPref($data_dir, $username, 'collapse_folder_' . $box[$p]);
                removePref($data_dir, $username, 'thread_' . $box[$p]);
                removePref($data_dir, $username, 'collapse_folder_' . $box[$p]);
                if ($was_subscribed) {
                    sqimap_subscribe($imap_stream, $new_sub);
                }
                setPref($data_dir, $username, 'thread_' . $new_sub, $oldpref_thread);
                setPref($data_dir, $username, 'collapse_folder_' . $new_sub, $oldpref_collapse);
                do_hook_function('rename_or_delete_folder', $args = array($box[$p], 'rename', $new_sub));
            }
        }
    }
}
开发者ID:jprice,项目名称:EHCP,代码行数:54,代码来源:imap_mailbox.php

示例11: switch

 if ($_SESSION['login'] == true) {
     switch ($_POST["action"]) {
         case "getRandomDrink":
             getRandomDrink();
             break;
         case "getBestDrink":
             getBestDrink();
             break;
         case "getSortedDrinks":
             getSortedDrinks();
             break;
         case "addPref":
             addPref();
             break;
         case "removePref":
             removePref();
             break;
         case "getAllDrinks":
             getAllDrinks();
             break;
         case "getPreferences":
             getPreferences();
             break;
         case "getDrinkTraits":
             getDrinkTraits();
             break;
         case "getDrinkInfo":
             getDrinkInfo();
             break;
         case "getRandomBestDrink":
             getRandomBestDrink();
开发者ID:Jessiesodolo,项目名称:TasteBuzz,代码行数:31,代码来源:query.php

示例12: setPref

    }
    // NB: The fact that this preference is always set here means that some plugins rely on testing it to know if a user has logged in before - the "old way" above is probably long since obsolete and unneeded, but the setPref() below should not be removed
    /* store in new format for the next time */
    setPref($data_dir, $username, 'hililist', serialize($message_highlight_list));
}
/* use the internal date of the message for sorting instead of the supplied header date */
/* OBSOLETE */
$internal_date_sort = getPref($data_dir, $username, 'internal_date_sort', SMPREF_ON);
/* Index order lets you change the order of the message index */
$order = getPref($data_dir, $username, 'order1');
if (isset($order1)) {
    removePref($data_dir, $username, 'order1');
    for ($i = 1; $order; ++$i) {
        $index_order[$i - 1] = $order - 1;
        $order = getPref($data_dir, $username, 'order' . ($i + 1));
        removePref($data_dir, $username, 'order' . ($i + 1));
    }
    if (isset($internal_date_sort) && $internal_date_sort) {
        if (in_array(SQM_COL_DATE, $index_order)) {
            $k = array_search(SQM_COL_DATE, $index_order, true);
            $index_order[$k] = SQM_COL_INT_DATE;
        }
    }
    setPref($data_dir, $username, 'index_order', serialize($index_order));
}
$index_order = getPref($data_dir, $username, 'index_order');
if (is_string($index_order)) {
    $index_order = unserialize($index_order);
}
// new Index order handling
//$default_mailbox_pref = unserialize(getPref($data_dir, $username, 'default_mailbox_pref'));
开发者ID:teammember8,项目名称:roundcube,代码行数:31,代码来源:load_prefs.php

示例13: delete_saved

function delete_saved($delete_index, $username, $data_dir)
{
    $types = array('saved_what', 'saved_where', 'saved_folder');
    $attributes = get_saved($username, $data_dir);
    foreach ($types as $key) {
        array_splice($attributes[$key], $delete_index, 1);
    }
    reset($types);
    $n = 0;
    $saved_count = count($attributes['saved_what']);
    $last_element = $saved_count + 1;
    for ($i = 1; $i <= $saved_count; $i++) {
        reset($types);
        foreach ($types as $key) {
            setPref($data_dir, $username, $key . $i, $attributes[$key][$n]);
        }
        $n++;
    }
    reset($types);
    foreach ($types as $key) {
        removePref($data_dir, $username, $key . $last_element);
    }
}
开发者ID:jprice,项目名称:EHCP,代码行数:23,代码来源:search.php

示例14: sqimap_mailbox_rename

function sqimap_mailbox_rename($imap_stream, $old_name, $new_name)
{
    if ($old_name != $new_name) {
        global $delimiter, $imap_server_type, $data_dir, $username;
        if (substr($old_name, -1) == $delimiter) {
            $old_name = substr($old_name, 0, strlen($old_name) - 1);
            $new_name = substr($new_name, 0, strlen($new_name) - 1);
            $postfix = $delimiter;
        } else {
            $postfix = '';
        }
        $boxesall = sqimap_mailbox_list($imap_stream);
        $cmd = 'RENAME "' . $old_name . '" "' . $new_name . '"';
        $data = sqimap_run_command($imap_stream, $cmd, true, $response, $message);
        sqimap_unsubscribe($imap_stream, $old_name . $postfix);
        $oldpref = getPref($data_dir, $username, 'thread_' . $old_name . $postfix);
        removePref($data_dir, $username, 'thread_' . $old_name . $postfix);
        sqimap_subscribe($imap_stream, $new_name . $postfix);
        setPref($data_dir, $username, 'thread_' . $new_name . $postfix, $oldpref);
        do_hook_function('rename_or_delete_folder', $args = array($old_name, 'rename', $new_name));
        $l = strlen($old_name) + 1;
        $p = 'unformatted';
        foreach ($boxesall as $box) {
            if (substr($box[$p], 0, $l) == $old_name . $delimiter) {
                $new_sub = $new_name . $delimiter . substr($box[$p], $l);
                if ($imap_server_type == 'cyrus') {
                    $cmd = 'RENAME "' . $box[$p] . '" "' . $new_sub . '"';
                    $data = sqimap_run_command($imap_stream, $cmd, true, $response, $message);
                }
                sqimap_unsubscribe($imap_stream, $box[$p]);
                $oldpref = getPref($data_dir, $username, 'thread_' . $box[$p]);
                removePref($data_dir, $username, 'thread_' . $box[$p]);
                sqimap_subscribe($imap_stream, $new_sub);
                setPref($data_dir, $username, 'thread_' . $new_sub, $oldpref);
                do_hook_function('rename_or_delete_folder', $args = array($box[$p], 'rename', $new_sub));
            }
        }
    }
}
开发者ID:innomatic-libs,项目名称:squirrelmaillib,代码行数:39,代码来源:imap_mailbox.php

示例15: newmail_sav_function

/**
 * Save newmail plugin settings
 */
function newmail_sav_function()
{
    global $data_dir, $username, $_FILES, $newmail_uploadsounds;
    if (sqgetGlobalVar('submit_newmail', $submit, SQ_POST)) {
        $media_enable = '';
        $media_popup = '';
        $media_recent = '';
        $media_changetitle = '';
        $media_sel = '';
        $popup_width = '';
        $popup_height = '';
        sqgetGlobalVar('media_enable', $media_enable, SQ_POST);
        sqgetGlobalVar('media_popup', $media_popup, SQ_POST);
        sqgetGlobalVar('media_recent', $media_recent, SQ_POST);
        sqgetGlobalVar('media_changetitle', $media_changetitle, SQ_POST);
        sqgetGlobalVar('popup_width', $popup_width, SQ_POST);
        sqgetGlobalVar('popup_height', $popup_height, SQ_POST);
        // sanitize height and width
        $popup_width = (int) $popup_width;
        if ($popup_width <= 0) {
            $popup_width = 200;
        }
        $popup_height = (int) $popup_height;
        if ($popup_height <= 0) {
            $popup_height = 130;
        }
        setPref($data_dir, $username, 'newmail_enable', $media_enable);
        setPref($data_dir, $username, 'newmail_popup', $media_popup);
        setPref($data_dir, $username, 'newmail_recent', $media_recent);
        setPref($data_dir, $username, 'newmail_changetitle', $media_changetitle);
        setPref($data_dir, $username, 'newmail_popup_width', $popup_width);
        setPref($data_dir, $username, 'newmail_popup_height', $popup_height);
        if (sqgetGlobalVar('newmail_unseen_notify', $newmail_unseen_notify, SQ_POST)) {
            $newmail_unseen_notify = (int) $newmail_unseen_notify;
            setPref($data_dir, $username, 'newmail_unseen_notify', $newmail_unseen_notify);
        }
        if (sqgetGlobalVar('media_sel', $media_sel, SQ_POST) && $media_sel == '(none)') {
            removePref($data_dir, $username, 'newmail_media');
        } else {
            setPref($data_dir, $username, 'newmail_media', $media_sel);
        }
        // process uploaded file
        if ($newmail_uploadsounds && isset($_FILES['media_file']['tmp_name']) && $_FILES['media_file']['tmp_name'] != '') {
            // set temp file and get media file name
            $newmail_tempmedia = getHashedDir($username, $data_dir) . "/{$username}.tempsound";
            $newmail_mediafile = getHashedFile($username, $data_dir, $username . '.sound');
            if (move_uploaded_file($_FILES['media_file']['tmp_name'], $newmail_tempmedia)) {
                // new media file is in $newmail_tempmedia
                if (file_exists($newmail_mediafile)) {
                    unlink($newmail_mediafile);
                }
                if (!rename($newmail_tempmedia, $newmail_mediafile)) {
                    // remove (userfile), if file rename fails
                    removePref($data_dir, $username, 'newmail_media');
                } else {
                    // store media type
                    if (isset($_FILES['media_file']['type']) && isset($_FILES['media_file']['name'])) {
                        setPref($data_dir, $username, 'newmail_userfile_type', newmail_get_mediatype($_FILES['media_file']['type'], $_FILES['media_file']['name']));
                    } else {
                        removePref($data_dir, $username, 'newmail_userfile_type');
                    }
                    // store file name
                    if (isset($_FILES['media_file']['name'])) {
                        setPref($data_dir, $username, 'newmail_userfile_name', basename($_FILES['media_file']['name']));
                    } else {
                        setPref($data_dir, $username, 'newmail_userfile_name', 'mediafile.unknown');
                    }
                }
            }
        }
    }
}
开发者ID:teammember8,项目名称:roundcube,代码行数:75,代码来源:functions.php


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