Example #1
0
/**
 * 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;
    }
}
Example #2
0
/**
 * 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);
}
Example #3
0
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', '');
    }
}
Example #4
0
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);
}
Example #5
0
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", "");
    }
}
Example #6
0
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;
    }
}
Example #7
0
/**
 * 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);
}
            $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':
Example #9
0
/**
 * 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++;
        }
    }
}
Example #10
0
/**
 * @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);
}
/**
 * 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);
}
Example #12
0
/**
 * 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);
    }
}
Example #13
0
        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);
Example #14
0
    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."), '&quot;SpamFilters_YourHop&quot;') . '</b>', 'center') . '<br />';
}
if (isset($action) && $action == 'spam') {
    $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
    $boxes = sqimap_mailbox_list($imapConnection);
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);
    }
}
Example #16
0
/**
 * Save fortune prefs
 * @access private
 */
function fortune_save()
{
    global $username, $data_dir;
    if (sqgetGlobalVar('fortune_fortune_visible', $fortune_fortune_visible, SQ_POST)) {
        setPref($data_dir, $username, 'fortune_visible', '1');
    } else {
        setPref($data_dir, $username, 'fortune_visible', '');
    }
}
Example #17
0
/**
 * Address book sorting options
 *
 * returns address book sorting order
 * @return integer book sorting options order
 */
function get_abook_sort()
{
    global $data_dir, $username;
    /* get sorting order */
    if (sqgetGlobalVar('abook_sort_order', $temp, SQ_GET)) {
        $abook_sort_order = (int) $temp;
        if ($abook_sort_order < 0 or $abook_sort_order > 8) {
            $abook_sort_order = 8;
        }
        setPref($data_dir, $username, 'abook_sort_order', $abook_sort_order);
    } else {
        /* get previous sorting options. default to unsorted */
        $abook_sort_order = getPref($data_dir, $username, 'abook_sort_order', 8);
    }
    return $abook_sort_order;
}
Example #18
0
        setPref($data_dir, $username, 'spamcop_delete', '');
        break;
    case 'delete':
        setPref($data_dir, $username, 'spamcop_delete', 1);
        break;
    case 'meth':
        if (isset($meth)) {
            setPref($data_dir, $username, 'spamcop_method', $meth);
        }
        break;
    case 'save_id':
        if (isset($ID)) {
            $ID = trim($ID);
            $ID = preg_replace('/@.*/', '', $ID);
            $ID = preg_replace('/.*\\./', '', $ID);
            setPref($data_dir, $username, 'spamcop_id', $ID);
        }
        break;
}
global $spamcop_enabled, $spamcop_delete, $spamcop_quick_report;
spamcop_load();
?>
      <br />
      <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">
      <tr><td bgcolor="<?php 
echo $color[0];
?>
">
         <center><b>
	 <?php 
echo _("Options") . " - " . _("Spam reporting");
Example #19
0
function mail_fetch_folderact($args)
{
    global $username, $data_dir;
    if (empty($args) || !is_array($args)) {
        return;
    }
    /* Should be 3 ars, 1: old folder, 2: action, 3: new folder */
    if (count($args) != 3) {
        return;
    }
    list($old_folder, $action, $new_folder) = $args;
    $mailfetch_server_number = getPref($data_dir, $username, 'mailfetch_server_number');
    for ($i = 0; $i < $mailfetch_server_number; $i++) {
        $mailfetch_subfolder = getPref($data_dir, $username, 'mailfetch_subfolder_' . $i);
        if ($mailfetch_subfolder != $old_folder) {
            continue;
        }
        if ($action == 'delete') {
            setPref($data_dir, $username, 'mailfetch_subfolder_' . $i, 'INBOX');
        } elseif ($action == 'rename') {
            setPref($data_dir, $username, 'mailfetch_subfolder_' . $i, $new_folder);
        }
    }
}
Example #20
0
/**
 * Update sent_subfolders settings
 *
 * function updates default sent folder value and 
 * creates required imap folders
 */
function sent_subfolders_update_sentfolder()
{
    global $sent_folder, $auto_create_special, $auto_create_done;
    global $sent_subfolders_base, $sent_subfolders_setting;
    global $data_dir, $imapServerAddress, $imapPort;
    global $use_sent_subfolders, $move_to_sent, $imap_server_type;
    sqgetGlobalVar('username', $username, SQ_SESSION);
    sqgetGlobalVar('key', $key, SQ_COOKIE);
    sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
    if ($use_sent_subfolders || $move_to_sent) {
        $year = date('Y');
        $month = date('m');
        $quarter = sent_subfolder_getQuarter($month);
        /*
            Regarding the structure we've got three main possibilities.
            One sent holder. level 0.
            Multiple year holders with messages in it. level 1.
            Multiple year folders with holders in it. level 2.
        */
        /*
                if( $imap_server_type == 'uw' ) {
                    $cnd_delimiter = '';
                } else {
                    $cnd_delimiter = $delimiter;
                }
        */
        $cnd_delimiter = $delimiter;
        switch ($sent_subfolders_setting) {
            case SMPREF_SENT_SUBFOLDERS_YEARLY:
                $level = 1;
                $sent_subfolder = $sent_subfolders_base . $cnd_delimiter . $year;
                break;
            case SMPREF_SENT_SUBFOLDERS_QUARTERLY:
                $level = 2;
                $sent_subfolder = $sent_subfolders_base . $cnd_delimiter . $year . $delimiter . $quarter;
                $year_folder = $sent_subfolders_base . $year;
                break;
            case SMPREF_SENT_SUBFOLDERS_MONTHLY:
                $level = 2;
                $sent_subfolder = $sent_subfolders_base . $cnd_delimiter . $year . $delimiter . $month;
                $year_folder = $sent_subfolders_base . $year;
                break;
            case SMPREF_SENT_SUBFOLDERS_DISABLED:
            default:
                $level = 0;
                $sent_subfolder = $sent_folder;
                $year_folder = $sent_folder;
        }
        /* If this folder is NOT the current sent folder, update stuff. */
        if ($sent_subfolder != $sent_folder) {
            /* First, update the sent folder. */
            setPref($data_dir, $username, 'sent_folder', $sent_subfolder);
            setPref($data_dir, $username, 'move_to_sent', SMPREF_ON);
            $sent_folder = $sent_subfolder;
            $move_to_sent = SMPREF_ON;
            /* Auto-create folders, if they do not yet exist. */
            if ($sent_folder != 'none') {
                /* Create the imap connection. */
                $ic = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10);
                /* Auto-create the year folder, if it does not yet exist. */
                if (!sqimap_mailbox_exists($ic, $year_folder)) {
                    sqimap_mailbox_create($ic, $year_folder, $level == 1 ? '' : 'noselect');
                } else {
                    if (!sqimap_mailbox_is_subscribed($ic, $year_folder)) {
                        sqimap_subscribe($ic, $year_folder);
                    }
                }
                /* Auto-create the subfolder, if it does not yet exist. */
                if (!sqimap_mailbox_exists($ic, $sent_folder)) {
                    sqimap_mailbox_create($ic, $sent_folder, '');
                } else {
                    if (!sqimap_mailbox_is_subscribed($ic, $sent_subfolder)) {
                        sqimap_subscribe($ic, $sent_subfolder);
                    }
                }
                /* Close the imap connection. */
                sqimap_logout($ic);
            }
        }
    }
}
Example #21
0
            for ($i = $mf_sn; $i < $mailfetch_server_number; $i++) {
                $tmp = $i + 1;
                setPref($data_dir, $username, 'mailfetch_server_' . $i, getPref($data_dir, $username, 'mailfetch_server_' . $tmp));
                setPref($data_dir, $username, 'mailfetch_port_' . $i, getPref($data_dir, $username, 'mailfetch_port_' . $tmp));
                setPref($data_dir, $username, 'mailfetch_alias_' . $i, getPref($data_dir, $username, 'mailfetch_alias_' . $tmp));
                setPref($data_dir, $username, 'mailfetch_user_' . $i, getPref($data_dir, $username, 'mailfetch_user_' . $tmp));
                setPref($data_dir, $username, 'mailfetch_pass_' . $i, getPref($data_dir, $username, 'mailfetch_pass_' . $tmp));
                setPref($data_dir, $username, 'mailfetch_lmos_' . $i, getPref($data_dir, $username, 'mailfetch_lmos_' . $tmp));
                setPref($data_dir, $username, 'mailfetch_login_' . $i, getPref($data_dir, $username, 'mailfetch_login_' . $tmp));
                setPref($data_dir, $username, 'mailfetch_fref_' . $i, getPref($data_dir, $username, 'mailfetch_fref_' . $tmp));
                setPref($data_dir, $username, 'mailfetch_subfolder_' . $i, getPref($data_dir, $username, 'mailfetch_subfolder_' . $tmp));
                setPref($data_dir, $username, 'mailfetch_auth_' . $i, getPref($data_dir, $username, 'mailfetch_auth_' . $tmp, MAIL_FETCH_AUTH_USER));
                setPref($data_dir, $username, 'mailfetch_type_' . $i, getPref($data_dir, $username, 'mailfetch_type_' . $tmp, MAIL_FETCH_USE_PLAIN));
                setPref($data_dir, $username, 'mailfetch_uidl_' . $i, getPref($data_dir, $username, 'mailfetch_uidl_' . $tmp));
            }
            setPref($data_dir, $username, "mailfetch_server_number", $mailfetch_server_number);
        }
        $mf_action = 'config';
        break;
}
$mailfetch_server_number = getPref($data_dir, $username, 'mailfetch_server_number', 0);
$mailfetch_cypher = getPref($data_dir, $username, 'mailfetch_cypher');
if ($mailfetch_server_number < 1) {
    $mailfetch_server_number = 0;
}
for ($i = 0; $i < $mailfetch_server_number; $i++) {
    $mailfetch_server_[$i] = getPref($data_dir, $username, "mailfetch_server_{$i}");
    $mailfetch_port_[$i] = getPref($data_dir, $username, "mailfetch_port_{$i}");
    $mailfetch_alias_[$i] = getPref($data_dir, $username, "mailfetch_alias_{$i}");
    $mailfetch_user_[$i] = getPref($data_dir, $username, "mailfetch_user_{$i}");
    $mailfetch_pass_[$i] = getPref($data_dir, $username, "mailfetch_pass_{$i}");
    for ($i = 0; $i < count($GLOBALS['bayesspam_ignore_folders']); $i++) {
        setPref($GLOBALS['data_dir'], $GLOBALS['username'], 'bayesspam_ignore_folders_' . $i, $GLOBALS['bayesspam_ignore_folders'][$i]);
    }
} elseif ($_REQUEST['action'] == 'ignore_rem' && isset($_REQUEST['ignore_rem'])) {
    for ($i = 0; $i <= count($GLOBALS['bayesspam_ignore_folders']); $i++) {
        removePref($GLOBALS['data_dir'], $GLOBALS['username'], 'bayesspam_ignore_folders_' . $i);
    }
    $GLOBALS['bayesspam_ignore_folders'] = array_diff($GLOBALS['bayesspam_ignore_folders'], array($_REQUEST['ignore_rem']));
    $temp = array();
    foreach ($GLOBALS['bayesspam_ignore_folders'] as $value) {
        $temp[] = $value;
    }
    $GLOBALS['bayesspam_ignore_folders'] = $temp;
    array_merge($GLOBALS['bayesspam_ignore_folders'], array());
    for ($i = 0; $i < count($GLOBALS['bayesspam_ignore_folders']); $i++) {
        setPref($GLOBALS['data_dir'], $GLOBALS['username'], 'bayesspam_ignore_folders_' . $i, $GLOBALS['bayesspam_ignore_folders'][$i]);
    }
} elseif ($_REQUEST['action'] == 'rebuild') {
    bayesspam_rebuild_corpus();
} elseif ($_REQUEST['action'] == 'empty') {
    bayesspam_nuke_db();
}
bayesspam_load();
$res = $GLOBALS['bayesdbhandle']->query("SELECT nonspamCount FROM " . $GLOBALS['bayesdbprefix'] . "users WHERE UserName='******'bayes_username'] . "'");
if (!DB::isError($res)) {
    $row = $res->fetchRow();
    $nonspamCount = $row['nonspamCount'];
} else {
    echo $res->getDebugInfo();
}
$res = $GLOBALS['bayesdbhandle']->query("SELECT spamCount FROM " . $GLOBALS['bayesdbprefix'] . "users WHERE UserName='******'bayes_username'] . "'");
                include_once '../src/load_prefs.php';
            }
        } else {
            if ($method == 'add' && $add) {
                /* User should not be able to insert PHP-code here */
                $add = str_replace('<?', '..', $add);
                $add = ereg_replace('<.*script.*language.*php.*>', '..', $add);
                $add = str_replace('<%', '..', $add);
                $index_order[count($index_order) + 1] = $add;
            }
        }
    }
}
if ($method) {
    for ($i = 1; $i <= count($index_order); $i++) {
        setPref($data_dir, $username, "order{$i}", $index_order[$i]);
    }
}
echo html_tag('table', html_tag('tr', html_tag('td', _("The index order is the order that the columns are arranged in the message index. You can add, remove, and move columns around to customize them to fit your needs."))), '', '', '', 'width="65%" border="0" cellpadding="0" cellspacing="0"') . "<br />\n";
if (count($index_order)) {
    echo html_tag('table', '', '', '', ' cellspacing="0" cellpadding="0" border="0"') . "\n";
    for ($i = 1; $i <= count($index_order); $i++) {
        $tmp = $index_order[$i];
        echo html_tag('tr');
        echo html_tag('td', '<small><a href="options_order.php?method=up&amp;num=' . $i . '">' . _("up") . '</a></small>');
        echo html_tag('td', '<small>&nbsp;|&nbsp;</small>');
        echo html_tag('td', '<small><a href="options_order.php?method=down&amp;num=' . $i . '">' . _("down") . '</a></small>');
        echo html_tag('td', '<small>&nbsp;|&nbsp;</small>');
        echo html_tag('td');
        /* Always show the subject */
        if ($tmp != 4) {
Example #24
0
        default:
            $clk = getDayAbrv(date('w', time())) . date(', ' . $hr, time());
    }
    $clk = str_replace(' ', '&nbsp;', $clk);
    echo '<small><span style="white-space: nowrap;">' . str_replace(' ', '&nbsp;', _("Last Refresh")) . ":</span><br /><span style=\"white-space: nowrap;\">{$clk}</span></small><br />";
}
/* Next, display the refresh button. */
echo '<small style="white-space: nowrap;">(<a href="../src/left_main.php" target="left">' . _("Check mail") . '</a>)</small></td></tr></table><br />';
/* Lastly, display the folder list. */
if ($collapse_folders) {
    /* If directed, collapse or uncollapse a folder. */
    if (isset($fold)) {
        setPref($data_dir, $username, 'collapse_folder_' . $fold, SM_BOX_COLLAPSED);
    } else {
        if (isset($unfold)) {
            setPref($data_dir, $username, 'collapse_folder_' . $unfold, SM_BOX_UNCOLLAPSED);
        }
    }
}
sqgetGlobalVar('force_refresh', $force_refresh, SQ_GET);
if (!isset($boxes)) {
    // auto_create_done
    $boxes = sqimap_mailbox_list($imapConnection, $force_refresh);
}
/* Prepare do do out collapsedness and visibility computation. */
$curbox = 0;
$boxcount = count($boxes);
/* Compute the collapsedness and visibility of each box. */
while ($curbox < $boxcount) {
    $boxes[$curbox]['visible'] = TRUE;
    compute_folder_children($curbox, $boxcount);
function setSig($data_dir, $username, $number, $string)
{
    if ($number == "g") {
        $key = '___signature___';
    } else {
        $key = sprintf('___sig%s___', $number);
    }
    setPref($data_dir, $username, $key, $string);
    return;
}
Example #26
0
/**
 * Update sent_subfolders settings
 *
 * function updates default sent folder value and
 * creates required imap folders
 */
function sent_subfolders_update_sentfolder_do()
{
    global $sent_folder, $username, $data_dir, $imapServerAddress, $imapPort, $imap_stream_options, $move_to_sent;
    sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
    $use_sent_subfolders = getPref($data_dir, $username, 'use_sent_subfolders', SMPREF_OFF);
    $sent_subfolders_setting = getPref($data_dir, $username, 'sent_subfolders_setting', SMPREF_SENT_SUBFOLDERS_DISABLED);
    $sent_subfolders_base = getPref($data_dir, $username, 'sent_subfolders_base', $sent_folder);
    if ($use_sent_subfolders || $move_to_sent) {
        $year = date('Y');
        $month = date('m');
        $quarter = sent_subfolder_getQuarter($month);
        /**
         * Regarding the structure we've got three main possibilities.
         * One sent holder. level 0.
         * Multiple year holders with messages in it. level 1.
         * Multiple year folders with holders in it. level 2.
         */
        switch ($sent_subfolders_setting) {
            case SMPREF_SENT_SUBFOLDERS_YEARLY:
                $level = 1;
                $sent_subfolder = $sent_subfolders_base . $delimiter . $year;
                break;
            case SMPREF_SENT_SUBFOLDERS_QUARTERLY:
                $level = 2;
                $sent_subfolder = $sent_subfolders_base . $delimiter . $year . $delimiter . $quarter;
                $year_folder = $sent_subfolders_base . $delimiter . $year;
                break;
            case SMPREF_SENT_SUBFOLDERS_MONTHLY:
                $level = 2;
                $sent_subfolder = $sent_subfolders_base . $delimiter . $year . $delimiter . $month;
                $year_folder = $sent_subfolders_base . $delimiter . $year;
                break;
            case SMPREF_SENT_SUBFOLDERS_DISABLED:
            default:
                $level = 0;
                $sent_subfolder = $sent_folder;
                $year_folder = $sent_folder;
        }
        /* If this folder is NOT the current sent folder, update stuff. */
        if ($sent_subfolder != $sent_folder) {
            /* Auto-create folders, if they do not yet exist. */
            if ($sent_subfolder != 'none') {
                /* Create the imap connection. */
                $ic = sqimap_login($username, false, $imapServerAddress, $imapPort, 10, $imap_stream_options);
                $boxes = false;
                /**
                 * If sent_subfolder can't store messages (noselect) ||
                 * year_folder can't store subfolders (noinferiors) in level=2 setup ||
                 * subfolder_base can't store subfolders (noinferiors), setup is broken
                 */
                if (sqimap_mailbox_is_noselect($ic, $sent_subfolder, $boxes) || $level == 2 && sqimap_mailbox_is_noinferiors($ic, $year_folder, $boxes) || sqimap_mailbox_is_noinferiors($ic, $sent_subfolders_base, $boxes)) {
                    error_box(_("Sent subfolders options are misconfigured."));
                } else {
                    if ($level == 2) {
                        /* Auto-create the year folder, if it does not yet exist. */
                        if (!sqimap_mailbox_exists($ic, $year_folder)) {
                            sqimap_mailbox_create($ic, $year_folder, 'noselect');
                            // TODO: safety check for imap servers that can't create subfolders
                        } else {
                            if (!sqimap_mailbox_is_subscribed($ic, $year_folder)) {
                                sqimap_subscribe($ic, $year_folder);
                            }
                        }
                    }
                    /* Auto-create the subfolder, if it does not yet exist. */
                    if (!sqimap_mailbox_exists($ic, $sent_subfolder)) {
                        sqimap_mailbox_create($ic, $sent_subfolder, '');
                    } else {
                        if (!sqimap_mailbox_is_subscribed($ic, $sent_subfolder)) {
                            sqimap_subscribe($ic, $sent_subfolder);
                        }
                    }
                    /* Update sent_folder setting in prefs only if the base
                       subfolders setting is not the same as the normal sent
                       folder...  otherwise, it is quite misleading to the user.
                       If the sent folder is the same as the subfolders base, it's
                       OK to leave the sent folder as is.
                       The sent_folder setting itself needs to be the actual
                       subfolder (not the base) for proper functionality */
                    if ($sent_subfolders_base != $sent_folder) {
                        setPref($data_dir, $username, 'sent_folder', $sent_subfolders_base);
                        setPref($data_dir, $username, 'move_to_sent', SMPREF_ON);
                        setPref($data_dir, $username, 'translate_special_folders', SMPREF_OFF);
                    }
                    $sent_folder = $sent_subfolder;
                    $move_to_sent = SMPREF_ON;
                }
                /* Close the imap connection. */
                sqimap_logout($ic);
            }
        }
    }
}
Example #27
0
if (sqGetGlobalVar('deletelist', $deletelist, SQ_FORM) && is_array($deletelist) && !empty($deletelist)) {
    // interface currently does not support multiple deletions at once
    // but we'll support it here anyway -- the index values of this
    // array are the only thing we care about and need to be the
    // index number of the list to be deleted
    //
    foreach (array_keys($deletelist) as $index) {
        unset($lists[$index]);
    }
    sort($lists);
    $temp_lists = array();
    foreach ($lists as $index => $list_addr) {
        $temp_lists[] = $index . '_' . $list_addr;
    }
    setPref($data_dir, $username, 'non_rfc_lists', implode(':', $temp_lists));
}
// add list?
//
if (sqGetGlobalVar('addlist', $ignore, SQ_FORM) && sqGetGlobalVar('newlist', $newlist, SQ_FORM)) {
    $lists[] = $newlist;
    sort($lists);
    $temp_lists = array();
    foreach ($lists as $index => $list_addr) {
        $temp_lists[] = $index . '_' . $list_addr;
    }
    setPref($data_dir, $username, 'non_rfc_lists', implode(':', $temp_lists));
}
displayPageHeader($color);
$oTemplate->assign('lists', $lists);
$oTemplate->display('plugins/listcommands/non_rfc_lists.tpl');
$oTemplate->display('footer.tpl');
function setUserPref($username, $pref, $value)
{
    global $data_dir;
    setPref($data_dir, $username, $pref, $value);
}
Example #29
0
function newmail_sav()
{
    global $data_dir, $username;
    if (sqgetGlobalVar('submit_newmail', $submit, SQ_POST)) {
        $media_enable = '';
        $media_popup = '';
        $media_allbox = '';
        $media_recent = '';
        $media_changetitle = '';
        $media_sel = '';
        sqgetGlobalVar('media_enable', $media_enable, SQ_POST);
        sqgetGlobalVar('media_popup', $media_popup, SQ_POST);
        sqgetGlobalVar('media_allbox', $media_allbox, SQ_POST);
        sqgetGlobalVar('media_recent', $media_recent, SQ_POST);
        sqgetGlobalVar('media_changetitle', $media_changetitle, SQ_POST);
        sqgetGlobalVar('popup_height', $newmail_popup_height, SQ_POST);
        sqgetGlobalVar('popup_width', $newmail_popup_width, SQ_POST);
        setPref($data_dir, $username, 'newmail_enable', $media_enable);
        setPref($data_dir, $username, 'newmail_popup', $media_popup);
        setPref($data_dir, $username, 'newmail_allbox', $media_allbox);
        setPref($data_dir, $username, 'newmail_recent', $media_recent);
        setPref($data_dir, $username, 'newmail_popup_height', $newmail_popup_height);
        setPref($data_dir, $username, 'newmail_popup_width', $newmail_popup_width);
        setPref($data_dir, $username, 'newmail_changetitle', $media_changetitle);
        if (sqgetGlobalVar('media_sel', $media_sel, SQ_POST) && ($media_sel == '(none)' || $media_sel == '(local media)')) {
            removePref($data_dir, $username, 'newmail_media');
        } else {
            setPref($data_dir, $username, 'newmail_media', $media_sel);
        }
    }
}
Example #30
0
                } else {
                    Mail_Fetch_Status(_("Delete failed:") . htmlspecialchars($pop3->ERROR));
                }
            }
        } else {
            echo "{$Line}";
            Mail_Fetch_Status(_("Error Appending Message!"));
            Mail_Fetch_Status(_("Closing POP"));
            $pop3->quit();
            Mail_Fetch_Status(_("Logging out from IMAP"));
            sqimap_logout($imap_stream);
            // not gurantee corect!
            Mail_Fetch_Status(_("Saving UIDL"));
            setPref($data_dir, $username, "mailfetch_uidl_{$i_loop}", $mailfetch_uidl[$i - 1]);
            exit;
        }
    }
    Mail_Fetch_Status(_("Closing POP"));
    $pop3->quit();
    Mail_Fetch_Status(_("Logging out from IMAP"));
    sqimap_logout($imap_stream);
    if (is_array($mailfetch_uidl)) {
        Mail_Fetch_Status(_("Saving UIDL"));
        setPref($data_dir, $username, "mailfetch_uidl_{$i_loop}", array_pop($mailfetch_uidl));
    }
    Mail_Fetch_Status(_("Done"));
}
?>
</center>
</body>
</html>