/** * Check if user has access to administrative functions * * @return boolean */ function adm_check_user() { global $PHP_SELF, $plugins; require_once SM_PATH . 'functions/global.php'; if (!in_array('administrator', $plugins)) { return FALSE; } if (!sqgetGlobalVar('username', $username, SQ_SESSION)) { $username = ''; } /* This needs to be first, for all non_options pages */ if (strpos('options.php', $PHP_SELF)) { $auth = FALSE; } else { if (file_exists(SM_PATH . 'plugins/administrator/admins')) { $auths = file(SM_PATH . 'plugins/administrator/admins'); array_walk($auths, 'adm_array_trim'); $auth = in_array($username, $auths); } else { if (file_exists(SM_PATH . 'config/admins')) { $auths = file(SM_PATH . 'config/admins'); array_walk($auths, 'adm_array_trim'); $auth = in_array($username, $auths); } else { if (($adm_id = fileowner(SM_PATH . 'config/config.php')) && function_exists('posix_getpwuid')) { $adm = posix_getpwuid($adm_id); $auth = $username == $adm['name']; } else { $auth = FALSE; } } } } return $auth; }
/** * Does the actual password changing (meaning it calls the hook function * from the backend that does this. If something goes wrong, return error * message(s). If everything ok, change the password in the session so the * user doesn't have to log out, and redirect back to the options screen. */ function cpw_do_change() { global $cpw_backend; sqgetGlobalVar('cpw_curpass', $curpw, SQ_POST); sqgetGlobalVar('cpw_newpass', $newpw, SQ_POST); sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION); sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); sqgetGlobalVar('key', $key, SQ_COOKIE); sqgetGlobalVar('username', $username, SQ_SESSION); require_once SM_PATH . 'plugins/change_password/backend/' . $cpw_backend . '.php'; $msgs = do_hook('change_password_dochange', $temp = array('username' => &$username, 'curpw' => &$curpw, 'newpw' => &$newpw)); /* something bad happened, return */ if (count($msgs) > 0) { return $msgs; } /* update our password stored in the session */ $onetimepad = OneTimePadCreate(strlen($newpw)); sqsession_register($onetimepad, 'onetimepad'); $key = OneTimePadEncrypt($newpw, $onetimepad); sqsetcookie('key', $key, 0, $base_uri); /* make sure we write the session data before we redirect */ session_write_close(); header('Location: ' . SM_PATH . 'src/options.php?optmode=submit&optpage=change_password&plugin_change_password=1&smtoken=' . sm_generate_security_token()); exit; }
/** * Check the preferences into the session cache. * * @param string $data_dir * @param string $username * * @since 1.1.3 * */ function cachePrefValues($data_dir, $username) { global $prefs_are_cached, $prefs_cache; sqgetGlobalVar('prefs_are_cached', $prefs_are_cached, SQ_SESSION); if (isset($prefs_are_cached) && $prefs_are_cached) { sqgetGlobalVar('prefs_cache', $prefs_cache, SQ_SESSION); // sm_print_r($prefs_cache); // exit; return; } sqsession_unregister('prefs_cache'); sqsession_unregister('prefs_are_cached'); /* Calculate the filename for the user's preference file */ $filename = getHashedFile($username, $data_dir, "{$username}.pref"); /* A call to checkForPrefs here should take eliminate the need for */ /* this to be called throughout the rest of the SquirrelMail code. */ checkForPrefs($data_dir, $username, $filename); /* Make sure that the preference file now DOES exist. */ if (!file_exists($filename)) { logout_error(sprintf(_("Preference file, %s, does not exist. Log out, and log back in to create a default preference file."), $filename)); exit; } /* Open the file, or else display an error to the user. */ if (!($file = @fopen($filename, 'r'))) { logout_error(sprintf(_("Preference file, %s, could not be opened. Contact your system administrator to resolve this issue."), $filename)); exit; } /* Read in the preferences. */ $highlight_num = 0; while (!feof($file)) { $pref = ''; /* keep reading a pref until we reach an eol (\n (or \r for macs)) */ while ($read = fgets($file, 1024)) { $pref .= $read; if (strpos($read, "\n") || strpos($read, "\r")) { break; } } $pref = trim($pref); $equalsAt = strpos($pref, '='); if ($equalsAt > 0) { $key = substr($pref, 0, $equalsAt); $value = substr($pref, $equalsAt + 1); //FIXME: this code is not in db_prefs.php that I can see /* this is to 'rescue' old-style highlighting rules. */ if (substr($key, 0, 9) == 'highlight') { $key = 'highlight' . $highlight_num; $highlight_num++; } //FIXME: this code is not in db_prefs.php that I can see if ($value != '') { $prefs_cache[$key] = $value; } } } fclose($file); $prefs_are_cached = TRUE; sqsession_register($prefs_cache, 'prefs_cache'); sqsession_register($prefs_are_cached, 'prefs_are_cached'); }
/** * @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; }
function SquirrelOption($name, $caption, $type, $refresh_level, $possible_values = '') { /* Set the basic stuff. */ $this->name = $name; $this->caption = $caption; $this->type = $type; $this->refresh_level = $refresh_level; $this->possible_values = $possible_values; $this->size = SMOPT_SIZE_MEDIUM; $this->comment = ''; $this->script = ''; /* Check for a current value. */ if (isset($GLOBALS[$name])) { $this->value = $GLOBALS[$name]; } else { $this->value = ''; } /* Check for a new value. */ if (!sqgetGlobalVar("new_{$name}", $this->new_value, SQ_POST)) { $this->new_value = ''; } /* Set the default save function. */ if ($type != SMOPT_TYPE_HIDDEN && $type != SMOPT_TYPE_COMMENT) { $this->save_function = SMOPT_SAVE_DEFAULT; } else { $this->save_function = SMOPT_SAVE_NOOP; } }
/** * 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', ''); } }
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', ''); } }
function bayesspam_button_action($id) { if ($GLOBALS['bayesdbhandle'] == null) { return; } if (!isset($id) || !is_array($id)) { return; } sqgetGlobalVar('markSpam', $markSpam, SQ_POST); sqgetGlobalVar('markHam', $markHam, SQ_POST); if (isset($markSpam)) { for ($i = 0; $i < count($id); $i++) { bayesspam_learn_single($GLOBALS['imapConnection'], $GLOBALS['mailbox'], $id[$i], 'spam'); } if ($GLOBALS['bayesspam_delete']) { sqimap_msgs_list_delete($GLOBALS['imapConnection'], $GLOBALS['mailbox'], $id); sqimap_mailbox_expunge($GLOBALS['imapConnection'], $GLOBALS['mailbox']); } else { if (sqimap_mailbox_exists($GLOBALS['imapConnection'], $GLOBALS['bayesspam_folder'])) { if ($GLOBALS['mailbox'] == $GLOBALS['bayesspam_folder']) { sqimap_msgs_list_move($GLOBALS['imapConnection'], $id, $GLOBALS['trash_folder']); } else { sqimap_msgs_list_move($GLOBALS['imapConnection'], $id, $GLOBALS['bayesspam_folder']); } sqimap_mailbox_expunge($GLOBALS['imapConnection'], $GLOBALS['mailbox']); foreach ($id as $i) { for ($a = 0; $a < count($GLOBALS['aMailbox']['UIDSET'][0]); $a++) { if ($GLOBALS['aMailbox']['UIDSET'][0][$a] == $i) { unset($GLOBALS['aMailbox']['UIDSET'][0][$a]); } } foreach ($GLOBALS['aMailbox']['MSG_HEADERS'] as $m) { if ($m['UID'] == $i) { unset($GLOBALS['aMailbox']['MSG_HEADERS'][$i]); } } } // reindex the arrays $GLOBALS['aMailbox']['MSG_HEADERS'] = array_values($GLOBALS['aMailbox']['MSG_HEADERS']); $GLOBALS['aMailbox']['UIDSET'][0] = array_values($GLOBALS['aMailbox']['UIDSET'][0]); $GLOBALS['aMailbox']['EXISTS'] -= count($id); // Change the startMessage number if the mailbox was changed if ($GLOBALS['aMailbox']['PAGEOFFSET'] - 1 >= $GLOBALS['aMailbox']['EXISTS']) { $GLOBALS['aMailbox']['PAGEOFFSET'] = $GLOBALS['aMailbox']['PAGEOFFSET'] > $GLOBALS['aMailbox']['LIMIT'] ? $GLOBALS['aMailbox']['PAGEOFFSET'] - $GLOBALS['aMailbox']['LIMIT'] : 1; $GLOBALS['aMailbox']['OFFSET'] = $GLOBALS['aMailbox']['PAGEOFFSET'] - 1; } } } } else { if (isset($markHam)) { for ($i = 0; $i < count($id); $i++) { bayesspam_learn_single($GLOBALS['imapConnection'], $GLOBALS['mailbox'], $id[$i], 'nonspam'); } } } }
function view_header($header, $mailbox, $color) { sqgetGlobalVar('QUERY_STRING', $queryStr, SQ_SERVER); $ret_addr = SM_PATH . 'src/read_body.php?' . $queryStr; displayPageHeader($color, $mailbox); echo '<br />' . '<table width="100%" cellpadding="2" cellspacing="0" border="0" ' . 'align="center">' . "\n" . '<tr><td bgcolor="' . $color[9] . '" width="100%" align="center"><b>' . _("Viewing Full Header") . '</b> - ' . '<a href="'; echo_template_var($ret_addr); echo '">' . _("View message") . "</a></b></td></tr></table>\n"; echo_template_var($header, array('<table width="99%" cellpadding="2" cellspacing="0" border="0" ' . "align=center>\n" . '<tr><td>', '<nobr><tt><b>', '</b>', '</tt></nobr>', '</td></tr></table>' . "\n")); echo '</body></html>'; }
/** * Check if user has access to administrative functions * * @return boolean */ function adm_check_user() { global $plugins; /* fail if the plugin is not enabled */ if (!in_array('administrator', $plugins)) { return FALSE; } if (!sqgetGlobalVar('username', $username, SQ_SESSION)) { $username = ''; } /* This needs to be first, for all non_options pages */ //if (!defined('PAGE_NAME') || strpos(PAGE_NAME, 'options') === FALSE) { if (!defined('PAGE_NAME') || PAGE_NAME != 'administrator_options' && PAGE_NAME != 'options') { $auth = FALSE; } else { if (file_exists(SM_PATH . 'plugins/administrator/admins')) { $auths = file(SM_PATH . 'plugins/administrator/admins'); array_walk($auths, 'adm_array_trim'); $auth = in_array($username, $auths); } else { if (file_exists(SM_PATH . 'config/admins')) { $auths = file(SM_PATH . 'config/admins'); array_walk($auths, 'adm_array_trim'); $auth = in_array($username, $auths); } else { if (($adm_id = fileowner(SM_PATH . 'config/config.php')) && function_exists('posix_getpwuid')) { $adm = posix_getpwuid($adm_id); $auth = $username == $adm['name']; } else { $auth = FALSE; } } } } return $auth; }
/** * @ignore */ function cachePrefValues($username) { global $prefs_are_cached, $prefs_cache; sqgetGlobalVar('prefs_are_cached', $prefs_are_cached, SQ_SESSION); if ($prefs_are_cached) { sqgetGlobalVar('prefs_cache', $prefs_cache, SQ_SESSION); return; } sqsession_unregister('prefs_cache'); sqsession_unregister('prefs_are_cached'); $db = new dbPrefs(); if (isset($db->error)) { printf(_("Preference database error (%s). Exiting abnormally"), $db->error); exit; } $db->fillPrefsCache($username); if (isset($db->error)) { printf(_("Preference database error (%s). Exiting abnormally"), $db->error); exit; } $prefs_are_cached = true; sqsession_register($prefs_cache, 'prefs_cache'); sqsession_register($prefs_are_cached, 'prefs_are_cached'); }
sqgetGlobalVar('filters_spam_folder_set', $filters_spam_folder_set, SQ_POST); 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);
<?php /** * Message Details plugin - top frame with buttons * * Plugin to view the RFC822 raw message output and the bodystructure of a message * * @author Marc Groot Koerkamp * @copyright Copyright © 2002 Marc Groot Koerkamp, The Netherlands * @copyright Copyright © 2004-2009 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id: message_details_top.php 13549 2009-04-15 22:00:49Z jervfors $ * @package plugins * @subpackage message_details */ /** @ignore */ define('SM_PATH', '../../'); /* SquirrelMail required files. */ require_once SM_PATH . 'include/validate.php'; displayHtmlHeader(_("Message Details"), "<script language=\"javascript\">\n" . "<!--\n" . "function printPopup() {\n" . "parent.frames[1].focus();\n" . "parent.frames[1].print();\n" . "}\n" . "-->\n" . "</script>\n", FALSE); sqgetGlobalVar('passed_id', $passed_id, SQ_GET); if (!sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET)) { $passed_ent_id = 0; } sqgetGlobalVar('mailbox', $mailbox, SQ_GET); echo "<body text=\"{$color['8']}\" bgcolor=\"{$color['3']}\" link=\"{$color['7']}\" vlink=\"{$color['7']}\" alink=\"{$color['7']}\">\n" . '<center><b>' . '<form action="' . SM_PATH . 'src/download.php" method="GET">' . '<input type="button" value="' . _("Print") . '" onClick="printPopup()" /> ' . '<input type="button" value="' . _("Close Window") . '" onClick="window.parent.close()" /> ' . '<input type="submit" value="' . _("Save Message") . '" /> ' . '<input type="hidden" name="mailbox" value="' . urlencode($mailbox) . '" />' . '<input type="hidden" name="passed_id" value="' . urlencode($passed_id) . '" />' . '<input type="hidden" name="ent_id" value="' . urlencode($passed_ent_id) . '" />' . '<input type="hidden" name="absolute_dl" value="true" />' . '</form>' . '</b>' . '</body>' . "</html>\n";
sqgetGlobalVar('username', $username, SQ_SESSION); sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); sqgetGlobalVar('mailbox', $mailbox, SQ_POST); /* end globals */ if ($mailbox == '') { displayPageHeader($color, 'None'); plain_error_message(_("You have not selected a folder to delete. Please do so.") . '<br /><a href="../src/folders.php">' . _("Click here to go back") . '</a>.', $color); exit; } if (sqgetGlobalVar('backingout', $tmp, SQ_POST)) { $location = get_location(); header("Location: {$location}/folders.php"); exit; } if (!sqgetGlobalVar('confirmed', $tmp, SQ_POST)) { displayPageHeader($color, 'None'); echo '<br />' . html_tag('table', '', 'center', '', 'width="95%" border="0"') . html_tag('tr', html_tag('td', '<b>' . _("Delete Folder") . '</b>', 'center', $color[0])) . html_tag('tr') . html_tag('td', '', 'center', $color[4]) . sprintf(_("Are you sure you want to delete %s?"), str_replace(array(' ', '<', '>'), array(' ', '<', '>'), imap_utf7_decode_local($mailbox))) . addForm('folders_delete.php', 'post') . "<p>\n" . addHidden('mailbox', $mailbox) . addSubmit(_("Yes"), 'confirmed') . addSubmit(_("No"), 'backingout') . '</p></form><br /></td></tr></table>'; exit; } $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); $boxes = sqimap_mailbox_list($imap_stream); $numboxes = count($boxes); global $delete_folder; if (substr($mailbox, -1) == $delimiter) { $mailbox_no_dm = substr($mailbox, 0, strlen($mailbox) - 1); } else { $mailbox_no_dm = $mailbox; } /** lets see if we CAN move folders to the trash.. otherwise, ** just delete them **/
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); } } }
<?php /** * testsound.php * * Copyright (c) 1999-2006 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * $Id: testsound.php 10633 2006-02-03 22:27:56Z jervfors $ */ define('SM_PATH', '../../'); /* SquirrelMail required files. */ require_once SM_PATH . 'include/validate.php'; require_once SM_PATH . 'functions/global.php'; require_once SM_PATH . 'functions/html.php'; displayHtmlHeader(_("Test Sound"), '', FALSE); echo '<body bgcolor="' . $color[4] . '" topmargin=0 leftmargin=0 rightmargin=0 marginwidth=0 marginheight=0>' . "\n"; if (!sqgetGlobalVar('sound', $sound, SQ_GET)) { $sound = 'Click.wav'; } elseif ($sound == '(none)') { echo '<center><form><br /><br />' . '<b>' . _("No sound specified") . '</b><br /><br />' . '<input type="button" name="close" value="' . _("Close") . '" onClick="window.close()">' . '</form></center>' . '</body></html>'; return; } echo html_tag('table', html_tag('tr', html_tag('td', '<embed src="' . htmlspecialchars($sound) . '" hidden="true" autostart="true" width="2" height="2">' . '<br>' . '<b>' . _("Loading the sound...") . '</b><br>' . '<form>' . '<input type="button" name="close" value=" ' . _("Close") . ' " onClick="window.close()">' . '</form>', 'center')), 'center') . '</body></html>';
* @subpackage themes */ /** Prevent direct script loading */ if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) { die; } /** load required functions */ include_once SM_PATH . 'functions/global.php'; global $theme; if (!sqsession_is_registered('random_theme_good_theme')) { $good_themes = array(); foreach ($theme as $data) { if (substr($data['PATH'], -18) != '/themes/random.php') { $good_themes[] = $data['PATH']; } } if (count($good_themes) == 0) { $good_themes[] = '../themes/default.php'; } $which = mt_rand(0, count($good_themes)); $random_theme_good_theme = $good_themes[$which]; // remove current sm_path from theme name $path = preg_quote(SM_PATH, '/'); $random_theme_good_theme = preg_replace("/^{$path}/", '', $random_theme_good_theme); // store it in session sqsession_register($random_theme_good_theme, 'random_theme_good_theme'); } else { // get random theme stored in session sqgetGlobalVar('random_theme_good_theme', $random_theme_good_theme); } @(include_once SM_PATH . $random_theme_good_theme);
} //Added on 09-11-2005 to avoid loading the webmail vtiger_files in Email process if ($_REQUEST['smodule'] != '') { define('SM_PATH', 'modules/squirrelmail-1.4.4/'); /* SquirrelMail required vtiger_files. */ require_once SM_PATH . 'functions/strings.php'; require_once SM_PATH . 'functions/imap_general.php'; require_once SM_PATH . 'functions/imap_messages.php'; require_once SM_PATH . 'functions/i18n.php'; require_once SM_PATH . 'functions/mime.php'; require_once SM_PATH . 'include/load_prefs.php'; //require_once(SM_PATH . 'class/mime/Message.class.php'); require_once SM_PATH . 'class/mime.class.php'; sqgetGlobalVar('key', $key, SQ_COOKIE); sqgetGlobalVar('username', $username, SQ_SESSION); sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); $mailbox = 'INBOX'; } require_once 'modules/Emails/Emails.php'; require_once 'include/logging.php'; require_once 'include/database/PearDatabase.php'; $local_log =& LoggerManager::getLogger('index'); $focus = new Emails(); global $current_user, $mod_strings, $app_strings; if (isset($_REQUEST['description']) && $_REQUEST['description'] != '') { $_REQUEST['description'] = fck_from_html($_REQUEST['description']); } $all_to_ids = $_REQUEST["hidden_toid"]; $all_to_ids .= $_REQUEST["saved_toid"]; $_REQUEST["saved_toid"] = $all_to_ids; //we always save the email with "save" status and when it is sent it is marked as SENT
/** * Init plugin * @access private */ function squirrelmail_plugin_init_filters() { global $squirrelmail_plugin_hooks; if (sqgetGlobalVar('mailbox', $mailbox, SQ_FORM)) { sqgetGlobalVar('mailbox', $mailbox, SQ_FORM); } else { $mailbox = 'INBOX'; } $squirrelmail_plugin_hooks['left_main_before']['filters'] = 'start_filters'; if (isset($mailbox) && $mailbox == 'INBOX') { $squirrelmail_plugin_hooks['right_main_after_header']['filters'] = 'start_filters'; } $squirrelmail_plugin_hooks['optpage_register_block']['filters'] = 'filters_optpage_register_block'; $squirrelmail_plugin_hooks['special_mailbox']['filters'] = 'filters_special_mailbox'; $squirrelmail_plugin_hooks['rename_or_delete_folder']['filters'] = 'update_for_folder'; $squirrelmail_plugin_hooks['webmail_bottom']['filters'] = 'start_filters'; }
*/ Define('SM_PATH', '../'); /* SquirrelMail required files. */ require_once SM_PATH . 'include/validate.php'; require_once SM_PATH . 'functions/date.php'; require_once SM_PATH . 'functions/page_header.php'; require_once SM_PATH . 'functions/mime.php'; require_once SM_PATH . 'include/load_prefs.php'; /* globals */ sqgetGlobalVar('username', $username, SQ_SESSION); sqgetGlobalVar('key', $key, SQ_COOKIE); sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); sqgetGlobalVar('passed_id', $passed_id, SQ_GET); sqgetGlobalVar('mailbox', $mailbox, SQ_GET); sqgetGlobalVar('ent_id', $ent_id, SQ_GET); sqgetGlobalVar('startMessage', $startMessage, SQ_GET); /* end globals */ $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); sqimap_mailbox_select($imapConnection, $mailbox); displayPageHeader($color, 'None'); echo '<br /><table width="100%" border="0" cellspacing="0" cellpadding="2" ' . 'align="center">' . "\n" . '<tr><td bgcolor="' . $color[0] . '">' . '<b><center>' . _("Viewing a Business Card") . " - "; $msg_url = 'read_body.php?mailbox=' . urlencode($mailbox) . '&startMessage=' . urlencode($startMessage) . '&passed_id=' . urlencode($passed_id); $msg_url = set_url_var($msg_url, 'ent_id', 0); echo '<a href="' . $msg_url . '">' . _("View message") . '</a>'; echo '</center></b></td></tr>'; $message = sqimap_get_message($imapConnection, $passed_id, $mailbox); $entity_vcard = getEntity($message, $ent_id); $vcard = mime_fetch_body($imapConnection, $passed_id, $ent_id); $vcard = decodeBody($vcard, $entity_vcard->header->encoding); $vcard = explode("\n", $vcard); foreach ($vcard as $l) {
* @ignore */ define('SM_PATH', '../'); /* SquirrelMail required files. */ require_once SM_PATH . 'include/validate.php'; require_once SM_PATH . 'functions/global.php'; require_once SM_PATH . 'functions/imap_mailbox.php'; require_once SM_PATH . 'functions/html.php'; require_once SM_PATH . 'functions/display_messages.php'; require_once SM_PATH . 'functions/forms.php'; /* get globals we may need */ sqgetGlobalVar('key', $key, SQ_COOKIE); sqgetGlobalVar('username', $username, SQ_SESSION); sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); sqgetGlobalVar('old', $old, SQ_POST); /* end of get globals */ if ($old == '') { displayPageHeader($color, 'None'); plain_error_message(_("You have not selected a folder to rename. Please do so.") . '<br /><a href="../src/folders.php">' . _("Click here to go back") . '</a>.', $color); exit; } if (substr($old, strlen($old) - strlen($delimiter)) == $delimiter) { $isfolder = TRUE; $old = substr($old, 0, strlen($old) - 1); } else { $isfolder = FALSE; } $old = imap_utf7_decode_local($old); // displayable mailbox format is without folder prefix on front global $folder_prefix;
/** * Adds href and text keys to attachment_common array for vcard attachments * @param array $Args attachment $type hook arguments * @since 1.2.0 */ function attachment_common_link_vcard(&$Args) { global $base_uri; sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER); $Args[0]['attachment_common']['href'] = $base_uri . 'src/vcard.php?' . $QUERY_STRING; $Args[0]['attachment_common']['href'] = set_url_var($Args[0]['attachment_common']['href'], 'ent_id', $Args[4]); $Args[0]['attachment_common']['text'] = _("View Business Card"); $Args[5] = $Args[0]['attachment_common']['href']; }
* @subpackage listcommands */ define('SM_PATH', '../../'); /* SquirrelMail required files. */ require_once SM_PATH . 'include/validate.php'; include_once SM_PATH . 'functions/page_header.php'; include_once SM_PATH . 'include/load_prefs.php'; include_once SM_PATH . 'functions/html.php'; require_once SM_PATH . 'functions/identity.php'; displayPageHeader($color, null); /* get globals */ sqgetGlobalVar('mailbox', $mailbox, SQ_GET); sqgetGlobalVar('send_to', $send_to, SQ_GET); sqgetGlobalVar('subject', $subject, SQ_GET); sqgetGlobalVar('body', $body, SQ_GET); sqgetGlobalVar('action', $action, SQ_GET); switch ($action) { case 'help': $out_string = _("This will send a message to %s requesting help for this list. You will receive an emailed response at the address below."); break; case 'subscribe': $out_string = _("This will send a message to %s requesting that you will be subscribed to this list. You will be subscribed with the address below."); break; case 'unsubscribe': $out_string = _("This will send a message to %s requesting that you will be unsubscribed from this list. It will try to unsubscribe the adress below."); break; default: error_box(sprintf(_("Unknown action: %s"), htmlspecialchars($action)), $color); exit; } echo html_tag('p', '', 'left') . html_tag('table', '', 'center', $color[0], 'border="0" width="75%"') . "\n" . html_tag('tr', html_tag('th', _("Mailinglist") . ' ' . _($action), '', $color[9])) . html_tag('tr') . html_tag('td', '', 'left');
define('SM_PATH', '../'); } /** SquirrelMail required files. */ require_once SM_PATH . 'include/validate.php'; require_once SM_PATH . 'functions/global.php'; require_once SM_PATH . 'functions/date.php'; require_once SM_PATH . 'functions/display_messages.php'; require_once SM_PATH . 'functions/addressbook.php'; require_once SM_PATH . 'functions/plugin.php'; require_once SM_PATH . 'functions/strings.php'; require_once SM_PATH . 'functions/html.php'; sqgetGlobalVar('session', $session, SQ_POST); sqgetGlobalVar('mailbox', $mailbox, SQ_POST); sqgetGlobalVar('addrquery', $addrquery, SQ_POST); sqgetGlobalVar('listall', $listall, SQ_POST); sqgetGlobalVar('backend', $backend, SQ_POST); /** * Insert hidden data */ function addr_insert_hidden() { global $body, $subject, $send_to, $send_to_cc, $send_to_bcc, $mailbox, $identity, $session; if (substr($body, 0, 1) == "\r") { echo addHidden('body', "\n" . $body); } else { echo addHidden('body', $body); } echo addHidden('session', $session) . addHidden('subject', $subject) . addHidden('send_to', $send_to) . addHidden('send_to_bcc', $send_to_bcc) . addHidden('send_to_cc', $send_to_cc) . addHidden('identity', $identity) . addHidden('mailbox', $mailbox) . addHidden('from_htmladdr_search', 'true'); } /** * List search results
<?php /** * sqspell_config.php -- SquirrelSpell Configuration file. * * Copyright (c) 1999-2006 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * @version $Id: sqspell_config.php 10633 2006-02-03 22:27:56Z jervfors $ * @package plugins * @subpackage squirrelspell */ require_once SM_PATH . 'functions/prefs.php'; /* Just for poor wretched souls with E_ALL. :) */ global $data_dir; sqgetGlobalVar('username', $username, SQ_SESSION); /** * Example: * * $SQSPELL_APP = array( 'English' => 'ispell -a', * 'Spanish' => 'ispell -d spanish -a' ); * You can replace ispell with aspell keeping the same commandline: * $SQSPELL_APP = array( 'English' => 'aspell -a', * 'Spanish' => 'aspell -d spanish -a' ); */ $SQSPELL_APP = array('English' => 'ispell -a', 'Spanish' => 'ispell -d spanish -a'); $SQSPELL_APP_DEFAULT = 'English'; $SQSPELL_WORDS_FILE = getHashedFile($username, $data_dir, "{$username}.words"); $SQSPELL_EREG = 'ereg';
* @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail */ /** This is the image page */ define('PAGE_NAME', 'image'); /** * Include the SquirrelMail initialization file. */ require '../include/init.php'; displayPageHeader($color); /* globals */ sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT); sqgetGlobalVar('mailbox', $mailbox, SQ_GET); sqgetGlobalVar('ent_id', $ent_id, SQ_GET); sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER); /* end globals */ echo '<br />' . '<table width="100%" border="0" cellspacing="0" cellpadding="2" align="center">' . "\n" . '<tr><td bgcolor="' . $color[0] . '">' . '<div style="text-align: center;"><b>' . _("Viewing an image attachment") . " - "; $msg_url = 'read_body.php?' . $QUERY_STRING; $msg_url = set_url_var($msg_url, 'ent_id', 0); echo '<a href="' . $msg_url . '">' . _("View message") . '</a>'; $DownloadLink = '../src/download.php?passed_id=' . $passed_id . '&mailbox=' . urlencode($mailbox) . '&ent_id=' . urlencode($ent_id) . '&absolute_dl=true'; ?> </b></div></td></tr> <tr><td align="center"> <a href="<?php echo $DownloadLink; ?> "><?php echo _("Download this as a file"); ?>
require_once SM_PATH . 'functions/mime.php'; require_once SM_PATH . 'functions/html.php'; sqgetGlobalVar('key', $key, SQ_COOKIE); sqgetGlobalVar('username', $username, SQ_SESSION); sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER); sqgetGlobalVar('messages', $messages); sqgetGlobalVar('passed_id', $passed_id, SQ_GET); if (sqgetGlobalVar('mailbox', $temp, SQ_GET)) { $mailbox = $temp; } if (!sqgetGlobalVar('ent_id', $ent_id, SQ_GET)) { $ent_id = ''; } if (!sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET)) { $passed_ent_id = ''; } $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox); $message =& $messages[$mbx_response['UIDVALIDITY']][$passed_id]; $message_ent = $message->getEntity($ent_id); if ($passed_ent_id) { $message =& $message->getEntity($passed_ent_id); } $header = $message_ent->header; $type0 = $header->type0; $type1 = $header->type1; $charset = $header->getParameter('charset'); $encoding = strtolower($header->encoding); $msg_url = 'read_body.php?' . $QUERY_STRING;
/** * Replacement of mb_list_encodings function * * This function provides replacement for function that is available only * in php 5.x. Function does not test all mbstring encodings. Only the ones * that might be used in SM translations. * * Supported strings are stored in session in order to reduce number of * mb_internal_encoding function calls. * * If mb_list_encodings() function is present, code uses it. Main difference * from original function behaviour - array values are lowercased in order to * simplify use of returned array in in_array() checks. * * If you want to test all mbstring encodings - fill $list_of_encodings * array. * @return array list of encodings supported by php mbstring extension * @since 1.5.1 and 1.4.6 */ function sq_mb_list_encodings() { // check if mbstring extension is present if (!function_exists('mb_internal_encoding')) { return array(); } // php 5+ function if (function_exists('mb_list_encodings')) { $ret = mb_list_encodings(); array_walk($ret, 'sq_lowercase_array_vals'); return $ret; } // don't try to test encodings, if they are already stored in session if (sqgetGlobalVar('mb_supported_encodings', $mb_supported_encodings, SQ_SESSION)) { return $mb_supported_encodings; } // save original encoding $orig_encoding = mb_internal_encoding(); $list_of_encoding = array('pass', 'auto', 'ascii', 'jis', 'utf-8', 'sjis', 'euc-jp', 'iso-8859-1', 'iso-8859-2', 'iso-8859-7', 'iso-8859-9', 'iso-8859-15', 'koi8-r', 'koi8-u', 'big5', 'gb2312', 'gb18030', 'windows-1251', 'windows-1255', 'windows-1256', 'tis-620', 'iso-2022-jp', 'euc-cn', 'euc-kr', 'euc-tw', 'uhc', 'utf7-imap'); $supported_encodings = array(); foreach ($list_of_encoding as $encoding) { // try setting encodings. suppress warning messages if (@mb_internal_encoding($encoding)) { $supported_encodings[] = $encoding; } } // restore original encoding mb_internal_encoding($orig_encoding); // register list in session sqsession_register($supported_encodings, 'mb_supported_encodings'); return $supported_encodings; }
* @ignore */ define('SM_PATH', '../'); /* SquirrelMail required files. */ require_once SM_PATH . 'include/validate.php'; require_once SM_PATH . 'functions/imap.php'; require_once SM_PATH . 'functions/plugin.php'; require_once SM_PATH . 'functions/html.php'; require_once SM_PATH . 'functions/forms.php'; displayPageHeader($color, 'None'); /* get globals we may need */ sqgetGlobalVar('username', $username, SQ_SESSION); sqgetGlobalVar('key', $key, SQ_COOKIE); sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); sqgetGlobalVar('success', $success, SQ_GET); /* end of get globals */ echo '<br />' . html_tag('table', '', 'center', $color[0], 'width="95%" cellpadding="1" cellspacing="0" border="0"') . html_tag('tr') . html_tag('td', '', 'center') . '<b>' . _("Folders") . '</b>' . html_tag('table', '', 'center', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"') . html_tag('tr') . html_tag('td', '', 'center', $color[4]); if (isset($success) && $success) { $td_str = '<b>'; switch ($success) { case 'subscribe': $td_str .= _("Subscribed successfully!"); break; case 'unsubscribe': $td_str .= _("Unsubscribed successfully!"); break; case 'delete': $td_str .= _("Deleted folder successfully!"); break; case 'create':
function sqauth_save_password($pass) { sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION); $onetimepad = OneTimePadCreate(strlen($pass)); sqsession_register($onetimepad, 'onetimepad'); $key = OneTimePadEncrypt($pass, $onetimepad); sqsetcookie('key', $key, false, $base_uri); return $key; }