require_once( '../functions/page_header.php' );
function is_logged_in () {
- global $squirrelmail_language, $frame_top;
+ global $squirrelmail_language, $frame_top, $base_uri;
if ( session_is_registered('user_is_logged_in') ) {
return;
}
- if (!isset($frame_top)) {
+ if (!isset($frame_top) || $frame_top == '' ) {
$frame_top = '_top';
}
echo "<body bgcolor=\"ffffff\">\n" .
'<br><br><center><b>' .
_("You must be logged in to access this page.").'</b><br><br>' .
- "<a href=\"../src/login.php\" target=\"$frame_top\">"._("Go to the login page")."</a>\n" .
+ "<a href=\"$base_uri/src/login.php\" target=\"$frame_top\">"._("Go to the login page")."</a>\n" .
"</center></body></html>\n";
exit;
}
$sm_notAlias = $languages[$sm_notAlias]['ALIAS'];
}
- if ( isset($sm_language) &&
+ if ( isset($sm_language) &&
$use_gettext &&
$sm_language != '' &&
isset($languages[$sm_notAlias]['CHARSET']) ) {
bindtextdomain( 'squirrelmail', '../locale/' );
- textdomain( 'squirrelmail' );
- if ( !ini_get('safe_mode') &&
+ textdomain( 'squirrelmail' );
+ if ( !ini_get('safe_mode') &&
getenv( 'LC_ALL' ) != $sm_notAlias ) {
putenv( "LC_ALL=$sm_notAlias" );
putenv( "LANG=$sm_notAlias" );
putenv( "LANGUAGE=$sm_notAlias" );
}
- setlocale('LC_ALL', $sm_notAlias);
+ setlocale(LC_ALL, $sm_notAlias);
$squirrelmail_language = $sm_notAlias;
header( 'Content-Type: text/html; charset=' . $languages[$sm_notAlias]['CHARSET'] );
}
* message blindly with the system-wide $default_charset.
*/
global $data_dir, $username, $default_charset, $languages;
-
+
$my_language = getPref($data_dir, $username, 'language');
if (!$my_language) {
return;
$color_string = $color[4];
if ($GLOBALS['alt_index_colors']) {
- if (!isset($GLOBALS["row_count"])) {
- $GLOBALS["row_count"] = 0;
+ if (!isset($GLOBALS['row_count'])) {
+ $GLOBALS['row_count'] = 0;
}
$GLOBALS['row_count']++;
- if ($GLOBALS["row_count"] % 2) {
- if (!isset($color[12])) $color[12] = '#EAEAEA';
+ if ($GLOBALS['row_count'] % 2) {
+ if (!isset($color[12])) {
+ $color[12] = '#EAEAEA';
+ }
$color_string = $color[12];
}
}
/** msg_header contains generic variables for values that **/
/** could be in a header. **/
- var $type0 = '', $type1 = '', $boundary = '', $charset = '';
- var $encoding = '', $size = 0, $to = array(), $from = '', $date = '';
- var $cc = array(), $bcc = array(), $reply_to = '', $subject = '';
- var $id = 0, $mailbox = '', $description = '', $filename = '';
- var $entity_id = 0, $message_id = 0, $name = '';
- // var $priority = "";
+ var $type0 = '', $type1 = '', $boundary = '', $charset = '',
+ $encoding = '', $size = 0, $to = array(), $from = '', $date = '',
+ $cc = array(), $bcc = array(), $reply_to = '', $subject = '',
+ $id = 0, $mailbox = '', $description = '', $filename = '',
+ $entity_id = 0, $message_id = 0, $name = '', $priority = 3;
}
class message {
define('SMOPT_SIZE_MEDIUM', 2);
define('SMOPT_SIZE_LARGE', 3);
define('SMOPT_SIZE_HUGE', 4);
+define('SMOPT_SIZE_NORMAL', 5);
define('SMOPT_SAVE_DEFAULT', 'save_option');
define('SMOPT_SAVE_NOOP', 'save_option_noop');
function createWidget_String() {
switch ($this->size) {
- case SMOPT_SIZE_TINY: $width = 5; break;
- case SMOPT_SIZE_SMALL: $width = 12; break;
- case SMOPT_SIZE_LARGE: $width = 38; break;
- case SMOPT_SIZE_HUGE: $width = 50; break;
+ case SMOPT_SIZE_TINY:
+ $width = 5;
+ break;
+ case SMOPT_SIZE_SMALL:
+ $width = 12;
+ break;
+ case SMOPT_SIZE_LARGE:
+ $width = 38;
+ break;
+ case SMOPT_SIZE_HUGE:
+ $width = 50;
+ break;
case SMOPT_SIZE_NORMAL:
- default: $width = 25;
+ default:
+ $width = 25;
}
$result = "<INPUT NAME=\"new_$this->name\" VALUE=\"$this->value\" SIZE=\"$width\">";
* $Id$
*/
+/*
global $prefs_are_cached, $prefs_cache;
if ( !session_is_registered('prefs_are_cached') ||
!isset( $prefs_cache) ||
- !is_array( $prefs_cache) ||
+ !is_array( $prefs_cache) ||
substr( phpversion(), 0, 3 ) == '4.1' ) {
$prefs_are_cached = false;
$prefs_cache = array();
}
+*/
/**
* Check the preferences into the session cache.
*/
function cachePrefValues($data_dir, $username) {
global $prefs_are_cached, $prefs_cache;
-
- if ($prefs_are_cached) {
+
+ if ( isset($prefs_are_cached) && $prefs_are_cached) {
return;
}
}
fclose($file);
- $prefs_are_cached = true;
+ $prefs_are_cached = TRUE;
- session_register('prefs_cache');
- session_register('prefs_are_cached');
+ session_register('prefs_cache');
+ session_register('prefs_are_cached');
}
/**
}
$line = charset_decode($charset, $line);
$line = str_replace("\t", ' ', $line);
-
+
parseUrl ($line);
-
+
$Quotes = 0;
$pos = 0;
- while (1) {
+
+ while ( $line <> '' ) {
if ($line[$pos] == ' ') {
$pos ++;
} else if (strpos($line, '>', $pos) === $pos) {
define('SMOPT_TYPE_THEME', 10);
define('SMOPT_TYPE_PLUGINS', 11);
define('SMOPT_TYPE_LDAP', 12);
+define('SMOPT_TYPE_EXTERNAL', 32);
global $languages;
$defcfg = array( '$config_version' => array( 'name' => _("Config File Version"),
'type' => SMOPT_TYPE_COMMENT,
'size' => 7 ),
+ 'SM_ver' => array( 'name' => _("Squirrelmail Version"),
+ 'type' => SMOPT_TYPE_EXTERNAL,
+ 'value' => "$version" ),
+ 'PHP_ver' => array( 'name' => _("PHP Version"),
+ 'type' => SMOPT_TYPE_EXTERNAL,
+ 'value' => phpversion() ),
/* --------------------------------------------------------*/
'Group1' => array( 'name' => _("Organization Preferences"),
'type' => SMOPT_TYPE_TITLE ),
'Group2' => array( 'name' => _("Server Settings"),
'type' => SMOPT_TYPE_TITLE ),
'$domain' => array( 'name' => _("Mail Domain"),
- 'type' => SMOPT_TYPE_STRING,
- 'size' => 40 ),
+ 'type' => SMOPT_TYPE_STRING,
+ 'size' => 40 ),
'$imapServerAddress' => array( 'name' => _("IMAP Server Address"),
'type' => SMOPT_TYPE_STRING,
'size' => 40 ),
'$imapPort' => array( 'name' => _("IMAP Server Port"),
- 'type' => SMOPT_TYPE_INTEGER ),
+ 'type' => SMOPT_TYPE_INTEGER ),
'$imap_server_type' => array( 'name' => _("IMAP Server Type"),
'type' => SMOPT_TYPE_STRLIST,
'posvals' => array( 'cyrus' => _("Cyrus IMAP server"),
'type' => SMOPT_TYPE_STRING,
'size' => 40 ),
'$smtpPort' => array( 'name' => _("SMTP Server Port"),
- 'type' => SMOPT_TYPE_INTEGER ),
+ 'type' => SMOPT_TYPE_INTEGER ),
'$use_authenticated_smtp' => array( 'name' => _("Authenticated SMTP"),
'type' => SMOPT_TYPE_BOOLEAN ),
'$invert_time' => array( 'name' => _("Invert Time"),
'type' => SMOPT_TYPE_TITLE ),
'$addrbook_dsn' => array( 'name' => _("Address book DSN"),
'type' => SMOPT_TYPE_STRING,
- 'size' => 40 ),
+ 'size' => 40 ),
'$addrbook_table' => array( 'name' => _("Address book table"),
'type' => SMOPT_TYPE_STRING,
'size' => 40,
'type' => SMOPT_TYPE_STRING,
'size' => 40 ),
/* --------------------------------------------------------*/
- '$config_use_color' => array( 'type' => SMOPT_TYPE_HIDDEN )
+ '$config_use_color' => array( 'name' => '',
+ 'type' => SMOPT_TYPE_HIDDEN )
/* --------------------------------------------------------*/
);
break;
case 'C':
// Comments
- if ( $line{$j}.$line{$j+1} == '*/' ) {
+ if ( $s > $j + 1 &&
+ $line{$j}.$line{$j+1} == '*/' ) {
$mode = '';
$j++;
}
}
break;
default:
- if ( strtoupper( substr( $line, $j, 7 ) ) == 'GLOBAL ' ) {
+ if ( $line{$j} == '$' ) {
+ // We must detect $key name
+ $mode = 'K';
+ $key = '$';
+ } else if ( $s < $j + 2 ) {
+ } else if ( strtoupper( substr( $line, $j, 7 ) ) == 'GLOBAL ' ) {
// Skip untill next ;
$mode = ';';
$j += 6;
} else if ( $line{$j} == '#' || $line{$j}.$line{$j+1} == '//' ) {
// Delete till the end of the line
$j = $s;
- } else if ( $line{$j} == '$' ) {
- // We must detect $key name
- $mode = 'K';
- $key = '$';
}
}
}
parseConfig( '../config/config_default.php' );
parseConfig( $cfgfile );
-$colapse = array( 'Titles' => FALSE,
- 'Group1' => getPref($data_dir, $username, 'adm_Group1', FALSE ),
- 'Group2' => getPref($data_dir, $username, 'adm_Group2', TRUE ),
- 'Group3' => getPref($data_dir, $username, 'adm_Group3', TRUE ),
- 'Group4' => getPref($data_dir, $username, 'adm_Group4', TRUE ),
- 'Group5' => getPref($data_dir, $username, 'adm_Group5', TRUE ),
- 'Group6' => getPref($data_dir, $username, 'adm_Group6', TRUE ),
- 'Group7' => getPref($data_dir, $username, 'adm_Group7', TRUE ),
- 'Group8' => getPref($data_dir, $username, 'adm_Group8', TRUE ) );
+$colapse = array( 'Titles' => 'off',
+ 'Group1' => getPref($data_dir, $username, 'adm_Group1', 'off' ),
+ 'Group2' => getPref($data_dir, $username, 'adm_Group2', 'on' ),
+ 'Group3' => getPref($data_dir, $username, 'adm_Group3', 'on' ),
+ 'Group4' => getPref($data_dir, $username, 'adm_Group4', 'on' ),
+ 'Group5' => getPref($data_dir, $username, 'adm_Group5', 'on' ),
+ 'Group6' => getPref($data_dir, $username, 'adm_Group6', 'on' ),
+ 'Group7' => getPref($data_dir, $username, 'adm_Group7', 'on' ),
+ 'Group8' => getPref($data_dir, $username, 'adm_Group8', 'on' ) );
if ( isset( $switch ) ) {
- $colapse[$switch] = !$colapse[$switch];
+
+ if ( $colapse[$switch] == 'on' ) {
+ $colapse[$switch] = 'off';
+ } else {
+ $colapse[$switch] = 'on';
+ }
setPref($data_dir, $username, "adm_$switch", $colapse[$switch] );
+
}
-echo "<form action=options.php method=post>" .
+echo "<form action=options.php method=post name=options>" .
"<br><center><table width=95% bgcolor=\"$color[5]\"><tr><td>".
"<table width=100% cellspacing=0 bgcolor=\"$color[4]\">" ,
"<tr bgcolor=\"$color[5]\"><th colspan=2>" . _("Configuration Administrator") . "</th></tr>";
if ( isset( $defcfg[$k] ) ) {
$name = $defcfg[$k]['name'];
$type = $defcfg[$k]['type'];
- $size = $defcfg[$k]['size'];
+ if ( isset( $defcfg[$k]['size'] ) ) {
+ $size = $defcfg[$k]['size'];
+ } else {
+ $size = 40;
+ }
} else if ( $l == 'true' ) {
$v = 'TRUE';
$type = SMOPT_TYPE_BOOLEAN;
$type = SMOPT_TYPE_LDAP;
}
- if( $type == SMOPT_TYPE_TITLE || !$colapse[$act_grp] ) {
+ if( $type == SMOPT_TYPE_TITLE || $colapse[$act_grp] == 'off' ) {
switch ( $type ) {
case SMOPT_TYPE_LDAP:
case SMOPT_TYPE_THEME:
case SMOPT_TYPE_HIDDEN:
break;
+ case SMOPT_TYPE_EXTERNAL:
+ echo "<tr><td>$name</td><td><b>" .
+ $defcfg[$k]['value'] .
+ "</b></td></tr>";
+ break;
case SMOPT_TYPE_TITLE:
- if ( $colapse[$k] ) {
+ if ( $colapse[$k] == 'on' ) {
$sw = '(+)';
} else {
$sw = '(-)';
}
/* Special Themes Block */
-if ( !($colapse['Group7']) ) {
+if ( $colapse['Group7'] == 'off' ) {
$i = 0;
echo '<tr><th>' . _("Theme Name") .
'</th><th>' . _("Theme Path") .
}
/* Special Plugins Block */
-if ( $colapse['Group8'] ) {
+if ( $colapse['Group8'] == 'on' ) {
$sw = '(+)';
} else {
$sw = '(-)';
"<a href=options.php?switch=Group8 STYLE=\"text-decoration:none\"><b>$sw</b> </a>" .
_("Plugins") . '</th></tr>';
-if( !$colapse['Group8'] ) {
+if( $colapse['Group8'] == 'off' ) {
$fd = opendir( '../plugins/' );
$op_plugin = array();
$plugins = array();
if ( isset( $HTTP_POST_VARS['plg'] ) ) {
foreach ( $op_plugin as $plg ) {
- if ( $HTTP_POST_VARS["plgs_$plg"] == 'on' ) {
+ if ( isset( $HTTP_POST_VARS["plgs_$plg"] ) &&
+ $HTTP_POST_VARS["plgs_$plg"] == 'on' ) {
$plugins[] = $plg;
}
}
}
echo '<tr>' .
"<td>$plg</td><td><input$sw type=checkbox name=plgs_$plg></td>".
- '</tr>';
+ "</tr>\n";
}
echo '</td></tr></table>';
"/**\n".
" * SquirrelMail Configuration File\n".
" * Created using the Administrator Plugin\n".
- " */\n" );
+ " */\n".
+ "GLOBAL \$version;\n" );
/*
fwrite( $fp, 'GLOBAL ' );
$next_month = date( 'm', $next_date);
$prev_year = date( 'Y', $prev_date);
$next_year = date( 'Y', $next_date );
+ $self = 'calendar.php';
echo "<TR BGCOLOR=\"$color[0]\"><TD>" .
"<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">" .
if (isset($calendardata[$cdate])){
$i=0;
while ($calfoo = each($calendardata[$cdate])) {
- $calbar = $calendardata[$cdate][$calfoo[key]];
- echo ($calbar[priority]==1) ? "<FONT COLOR=\"$color[1]\">$calbar[title]</FONT><br>\n" : "$calbar[title]<br>\n";
+ $calbar = $calendardata[$cdate][$calfoo['key']];
+ echo ($calbar['priority']==1) ? "<FONT COLOR=\"$color[1]\">$calbar[title]</FONT><br>\n" : "$calbar[title]<br>\n";
$i=$i+1;
if($i==2){
break;
}
-if($month <= 0){
+if( !isset( $month ) || $month <= 0){
$month = date( 'm' );
}
-if($year <= 0){
+if( !isset($year) || $year <= 0){
$year = date( 'Y' );
}
-if($day <= 0){
+if( !isset($day) || $day <= 0){
$day = date( 'd' );
}
if (file_exists($filename)){
$fp = fopen ($filename,'r');
- }
- if ($fp){
- while ($fdata = fgetcsv ($fp, 4096, '|')) {
- $calendardata[$fdata[0]][$fdata[1]] = array( 'length' => $fdata[2],
- 'priority' => $fdata[3],
- 'title' => $fdata[4],
- 'message' => $fdata[5],
- 'reminder' => $fdata[6] );
+
+ if ($fp){
+ while ($fdata = fgetcsv ($fp, 4096, '|')) {
+ $calendardata[$fdata[0]][$fdata[1]] = array( 'length' => $fdata[2],
+ 'priority' => $fdata[3],
+ 'title' => $fdata[4],
+ 'message' => $fdata[5],
+ 'reminder' => $fdata[6] );
+ }
+ fclose ($fp);
}
- fclose ($fp);
}
}
$fp = fopen ($filetmp,"w");
if ($fp) {
while ( $calfoo = each ($calendardata)) {
- while ( $calbar = each ($calfoo[value])) {
- $calfoobar = $calendardata[$calfoo[key]][$calbar[key]];
+ while ( $calbar = each ($calfoo['value'])) {
+ $calfoobar = $calendardata[$calfoo['key']][$calbar['key']];
$calstr = "$calfoo[key]|$calbar[key]|$calfoobar[length]|$calfoobar[priority]|$calfoobar[title]|$calfoobar[message]|$calfoobar[reminder]\n";
fwrite($fp, $calstr, 4096);
}
if (isset($calendardata[$cdate])){
while ( $calfoo = each($calendardata[$cdate])){
- $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo[key]];
+ $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['key']];
}
}
}
$eo=0;
}
- $ehour = substr($calfoo[key],0,2);
- $eminute = substr($calfoo[key],2,2);
- if (!is_array($calfoo[value])){
+ $ehour = substr($calfoo['key'],0,2);
+ $eminute = substr($calfoo['key'],2,2);
+ if (!is_array($calfoo['value'])){
echo " <TR BGCOLOR=\"$color[$eo]\"><TD>$ehour:$eminute</TD>\n" .
" <TD> </TD>\n" .
- " <TD ALIGN=CENTER><FONT SIZE=-1><A HREF=\"event_create.php?year=$year&month=$month&day=$day&hour=".substr($calfoo[key],0,2)."\">".
+ " <TD ALIGN=CENTER><FONT SIZE=-1><A HREF=\"event_create.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."\">".
_("ADD") . "</A></FONT></TD></TR>\n";
} else {
- $calbar=$calfoo[value];
- if ($calbar[length]!=0){
- $elength = '-'.date('H:i',mktime($ehour,$eminute+$calbar[length],0,1,1,0));
+ $calbar=$calfoo['value'];
+ if ($calbar['length']!=0){
+ $elength = '-'.date('H:i',mktime($ehour,$eminute+$calbar['length'],0,1,1,0));
} else {
$elength='';
}
echo " <TR BGCOLOR=\"$color[$eo]\"><TD>$ehour:$eminute$elength</TD>\n" .
" <TD>[";
- echo ($calbar[priority]==1) ? "<FONT COLOR=\"$color[1]\">$calbar[title]</FONT>" : "$calbar[title]";
+ echo ($calbar['priority']==1) ? "<FONT COLOR=\"$color[1]\">$calbar[title]</FONT>" : "$calbar[title]";
echo"] $calbar[message] </TD>\n" .
" <TD ALIGN=CENTER><FONT SIZE=-1><nobr>\n" .
- "<A HREF=\"event_edit.php?year=$year&month=$month&day=$day&hour=".substr($calfoo[key],0,2)."&minute=".substr($calfoo[key],2,2)."\">".
+ "<A HREF=\"event_edit.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."&minute=".substr($calfoo['key'],2,2)."\">".
_("EDIT") . "</A> | \n" .
- "<A HREF=\"event_delete.php?dyear=$year&dmonth=$month&dday=$day&dhour=".substr($calfoo[key],0,2)."&dminute=".substr($calfoo[key],2,2)."&year=$year&month=$month&day=$day\">" .
+ "<A HREF=\"event_delete.php?dyear=$year&dmonth=$month&dday=$day&dhour=".substr($calfoo['key'],0,2)."&dminute=".substr($calfoo['key'],2,2)."&year=$year&month=$month&day=$day\">" .
_("DEL") . '</A>' .
" </nobr></FONT></TD></TR>\n";
}
- $i++;
}
}
-if ($month <= 0){
+if ( !isset($month) || $month <= 0){
$month = date( 'm' );
}
-if ($year <= 0){
+if ( !isset($year) || $year <= 0){
$year = date( 'Y' );
}
-if ($day <= 0){
+if (!isset($day) || $day <= 0){
$day = date( 'd' );
}
-if ($hour <= 0){
+if (!isset($hour) || $hour <= 0){
$hour = '08';
}
$event_text=nl2br($event_text);
$event_text=ereg_replace ("\n", "", $event_text);
$event_text=ereg_replace ("\r", "", $event_text);
- $calendardata["$month$day$year"]["$event_hour$event_minute"] = array("length"=>"$event_length","priority"=>"$event_priority","title"=>"$event_title","message"=>"$event_text");
+ $calendardata["$month$day$year"]["$event_hour$event_minute"] =
+ array( 'length' => $event_length,
+ 'priority' => $event_priority,
+ 'title' => $event_title,
+ 'message' => $event_text,
+ 'reminder' => '' );
//save
writecalendardata();
echo " <TABLE BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">\n".
}
function sent_subfolders_load_prefs() {
- global $use_sent_subfolders;
- global $sent_subfolders_setting, $sent_subfolders_base;
+ global $use_sent_subfolders, $data_dir, $username,
+ $sent_subfolders_setting, $sent_subfolders_base;
$use_sent_subfolders = getPref
($data_dir, $username, 'use_sent_subfolders', SMPREF_OFF);
* If $MOD is undefined, use "init", else check for security
* breaches.
*/
-if (!$MOD){
+if (!isset($MOD) || !$MOD){
$MOD='init';
} else {
sqspell_ckMOD($MOD);
* If $MOD is unspecified, assign "init" to it. Else check for
* security breach attempts.
*/
-if (!$MOD){
+if (!isset($MOD) || !$MOD){
$MOD = 'options_main';
} else {
sqspell_ckMOD($MOD);
require_once('../src/load_prefs.php');
displayPageHeader($color, 'None');
- if ($submit_translate) {
+ if (isset($submit_translate) && $submit_translate ) {
if (isset($translate_translate_server)) {
setPref($data_dir, $username, 'translate_server', $translate_translate_server);
} else {
echo '<B>' . _("Successfully Saved Options") . ": $optpage_name</B><BR>\n";
/* If $max_refresh != SMOPT_REFRESH_NONE, provide a refresh link. */
- if ($max_refresh == SMOPT_REFRESH_FOLDERLIST) {
+ if ( !isset( $max_refresh ) ) {
+ } else if ($max_refresh == SMOPT_REFRESH_FOLDERLIST) {
echo '<A HREF="../src/left_main.php" TARGET="left">' . _("Refresh Folder List") . '</A><BR>';
} else if ($max_refresh) {
echo '<A HREF="../src/webmail.php?right_frame=options.php" TARGET="' . $frame_top . '">' . _("Refresh Page") . '</A><BR>';
}
/* There is a problem with registered vars in 4.1 */
+/*
if( substr( phpversion(), 0, 3 ) == '4.1' ) {
$use_mailbox_cache = FALSE;
}
+*/
if ($use_mailbox_cache && session_is_registered('msgs')) {
showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
// if the page is called from a search link or button update recent values
// in pref files here
-if ($submit == "Search" && !empty($what)) {
+if ( !isset( $submit ) ) {
+ $submit = '';
+} else if ($submit == 'Search' && !empty($what)) {
update_recent($what_array, $what, "search_what", $username, $data_dir);
update_recent($where_array, $where, "search_where", $username, $data_dir);
update_recent($folder_array, $mailbox, "search_folder", $username, $data_dir);
}
// if the page is called from a "forget recent" link remove search from pref file
-elseif ($submit == "forget") {
+elseif ($submit == 'forget') {
forget_recent($count, $username, $data_dir);
}
// if the page is called from a "save recent" link add search to saved searches
-elseif ($submit == "save") {
+elseif ($submit == 'save') {
save_recent($count, $username, $data_dir);
}
-elseif ($submit == "delete") {
+elseif ($submit == 'delete') {
delete_saved($count, $username, $data_dir);
}
// if the page is called from a "delete saved" link delete saved search
do_hook('search_before_form');
echo "<BR>\n".
- " <table width=\"100%\">\n".
- " <TR><td bgcolor=\"$color[0]\">\n".
- " <CENTER><B>"._("Search")."</B></CENTER>\n".
- " </TD></TR>\n".
- " </TABLE>\n";
-# ' <TR><td align=center>';
+ "<table width=\"100%\">\n".
+ "<TR><td bgcolor=\"$color[0]\">\n".
+ "<CENTER><B>" . _("Search") . "</B></CENTER>\n".
+ "</TD></TR>\n".
+ "</TABLE>\n";
-// update the recent and saved searches from the pref files
+// update the recent and saved searches from the pref files
$what_array = get_recent("search_what", $username, $data_dir);
$where_array = get_recent("search_where", $username, $data_dir);
$folder_array = get_recent("search_folder", $username, $data_dir);
$recent_count = getPref($data_dir, $username, 'search_memory', 0);
-$saved_what_array = get_saved("saved_what", $username, $data_dir);
+$saved_what_array = get_saved("saved_what", $username, $data_dir);
$saved_where_array = get_saved("saved_where", $username, $data_dir);
$saved_folder_array = get_saved("saved_folder", $username, $data_dir);
$saved_count = count($saved_what_array);
/* Saved Search Table */
if ($saved_count > 0) {
echo "<BR>\n"
- . "<TABLE WIDTH=\"95%\" BGCOLOR=\"$color[9]\" ALIGN=\"CENTER\" CELLPADDING=1 CELLSPACING=1>"
- . '<TR><TD align=center><B>Saved Searches</B></TD></TR><TR><TD>'
- . '<TABLE WIDTH="100%" ALIGN="CENTER" CELLPADDING=0 CELLSPACING=0>';
+ . "<TABLE WIDTH=\"95%\" BGCOLOR=\"$color[9]\" ALIGN=\"CENTER\" CELLPADDING=1 CELLSPACING=1>"
+ . '<TR><TD align=center><B>Saved Searches</B></TD></TR><TR><TD>'
+ . '<TABLE WIDTH="100%" ALIGN="CENTER" CELLPADDING=0 CELLSPACING=0>';
for ($i=0; $i < $saved_count; ++$i) {
- if ($i % 2) {
- echo "<TR BGCOLOR=\"$color[0]\">";
- } else {
+ if ($i % 2) {
+ echo "<TR BGCOLOR=\"$color[0]\">";
+ } else {
echo "<TR BGCOLOR=\"$color[4]\">";
}
echo "<TD WIDTH=\"35%\">$saved_folder_array[$i]</TD>"
- . "<TD ALIGN=LEFT>$saved_what_array[$i]</TD>"
- . "<TD ALIGN=CENTER>$saved_where_array[$i]</TD>"
- . '<TD ALIGN=RIGHT>'
- . '<A HREF=search.php'
- . '?mailbox=' . urlencode($saved_folder_array[$i])
- . '&what=' . urlencode($saved_what_array[$i])
- . '&where=' . urlencode($saved_where_array[$i])
- . '>' . _("edit") . '</A>'
- . ' | '
- . '<A HREF=search.php'
- . '?mailbox=' . urlencode($saved_folder_array[$i])
- . '&what=' . urlencode($saved_what_array[$i])
- . '&where=' . urlencode($saved_where_array[$i])
- . '&submit=Search_no_update'
- . '>' . _("search") . '</A>'
- . ' | '
- . "<A HREF=search.php?count=$i&submit=delete>"
- . _("delete")
- . '</A>'
- . '</TD></TR>';
+ . "<TD ALIGN=LEFT>$saved_what_array[$i]</TD>"
+ . "<TD ALIGN=CENTER>$saved_where_array[$i]</TD>"
+ . '<TD ALIGN=RIGHT>'
+ . '<A HREF=search.php'
+ . '?mailbox=' . urlencode($saved_folder_array[$i])
+ . '&what=' . urlencode($saved_what_array[$i])
+ . '&where=' . urlencode($saved_where_array[$i])
+ . '>' . _("edit") . '</A>'
+ . ' | '
+ . '<A HREF=search.php'
+ . '?mailbox=' . urlencode($saved_folder_array[$i])
+ . '&what=' . urlencode($saved_what_array[$i])
+ . '&where=' . urlencode($saved_where_array[$i])
+ . '&submit=Search_no_update'
+ . '>' . _("search") . '</A>'
+ . ' | '
+ . "<A HREF=search.php?count=$i&submit=delete>"
+ . _("delete")
+ . '</A>'
+ . '</TD></TR>';
}
echo "</TABLE></TD></TR></TABLE>\n";
}
}
else {
echo " <OPTION VALUE=\"$box\">$box2</OPTION>\n";
- }
+ }
}
}
echo "<OPTION VALUE=\"All Folders\"";
echo ' </SELECT>'.
" </TD>\n".
" <TD ALIGN=\"CENTER\">\n";
+if ( !isset( $what ) ) {
+ $what = '';
+}
$what_disp = str_replace(',', ' ', $what);
$what_disp = str_replace('\\\\', '\\', $what_disp);
$what_disp = str_replace('\\"', '"', $what_disp);
"</TD></TR></TABLE>\n";
-do_hook("search_after_form");
+do_hook('search_after_form');
-// search all folders option still in the works. returns a table for each
-// folder it finds a match in. The toggle all link does not work
+/*
+ search all folders option still in the works. returns a table for each
+ folder it finds a match in. The toggle all link does not work
+*/
-
-if ($search_all == "all") {
- $mailbox == "";
+if ($search_all == 'all') {
+ $mailbox == '';
$boxcount = count($boxes);
- echo "<BR><CENTER><B>Search Results</B><CENTER><BR>\n";
+ echo '<BR><CENTER><B>' .
+ _("Search Results") .
+ "</B><CENTER><BR>\n";
for ($x=0;$x<$boxcount;$x++) {
if (!in_array('noselect', $boxes[$x]['flags'])) {
- $mailbox = $boxes[$x]['unformatted'];
- }
+ $mailbox = $boxes[$x]['unformatted'];
+ }
if (($submit == "Search" || $submit == "Search_no_update") && !empty($what)) {
sqimap_mailbox_select($imapConnection, $mailbox);
- $count_all = sqimap_search($imapConnection, $where, $what, $mailbox, $color, $pos, $search_all, $count_all);
- }
+ $count_all = sqimap_search($imapConnection, $where, $what, $mailbox, $color, 0, $search_all, $count_all);
+ }
+ }
+ if ($count_all == 0) {
+ echo '<br><b>' .
+ _("No Messages found") .
+ '</b><br>';
}
- if ($count_all == 0) {
- echo "<br><b>No Messages found</b><br>";
- }
}
-// search one folder option
+// search one folder option
else {
- if (($submit == "Search" || $submit == "Search_no_update") && !empty($what)) {
- echo "<BR><CENTER><B>Search Results</B></CENTER>\n";
+ if (($submit == 'Search' || $submit == 'Search_no_update') && !empty($what)) {
+ echo '<BR><CENTER><B>' .
+ _("Search Results") .
+ "</B></CENTER>\n";
sqimap_mailbox_select($imapConnection, $mailbox);
- sqimap_search($imapConnection, $where, $what, $mailbox, $color, $pos, $search_all, $count_all);
+ sqimap_search($imapConnection, $where, $what, $mailbox, $color, 0, $search_all, $count_all);
}
}
-// must have search terms to search
+// must have search terms to search
-if ($submit == "Search" && empty($what)) {
+if ($submit == 'Search' && empty($what)) {
echo "<BR><CENTER><B>Please enter something to search for</B></CENTER>\n";
}