[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] email/inc class.mail_filters.inc.php, 1.8 class.mail_
From: |
skwashd |
Subject: |
[Phpgroupware-cvs] email/inc class.mail_filters.inc.php, 1.8 class.mail_msg.inc.php, 1.5 class.mail_msg_base.inc.php, 1.80 class.mail_dcom_pop3.inc.php, 1.12 class.mail_dcom_nntp.inc.php, 1.5 class.mail_dcom_base_sock.inc.php, 1.25 class.mail_dcom_imap.inc.php, 1.22 class.mail_dcom_imap_sock.inc.php, 1.16 class.mail_msg_display.inc.php, 1.42 class.mail_msg_wrappers.inc.php, 1.39 class.spell_struct.inc.php, 1.3 class.spell_svc_none.inc.php, 1.3 class.spell_svc_php.inc.php, 1.3 class.spell.inc.php, 1.3 class.so_mail_msg.inc.php, 1.2 class.mail_send.inc.php, 1.12 class.msg_bootstrap.inc.php, 1.3 class.mail_dcom_base.inc.php, 1.10 class.mail_dcom.inc.php, 1.11 class.boaction.inc.php, 1.18 class.boattach_file.inc.php, 1.5 class.bocompose.inc.php, 1.9 class.bofilters.inc.php, 1.15 class.bosend.inc.php, 1.12 class.html_widgets.inc.php, 1.4 class.bopreferences.inc.php, 1.24 class.bomessage.inc.php, 1.15 class.bofolder.inc.php, 1.9 class.boindex.inc.php, 1.31 class.svc_debug.inc.php, 1.2 hook_settings.inc.php, 1.4 class.svc_ nextmatches.inc.php, 1.3 hook_preferences.inc.php, 1.15 class.uiindex.inc.php, 1.23 class.uijsaddressbook.inc.php, 1.4 class.uimessage.inc.php, 1.12 class.uifolder.inc.php, 1.6 class.uifilters.inc.php, 1.15 class.ui_mail_debug.inc.php, 1.3 hook_notifywindow_simple.inc.php, 1.10 class.uicompose.inc.php, 1.6 class.uipreferences.inc.php, 1.18 class.uiattach_file.inc.php, 1.3 hook_manual.inc.php, 1.9 hook_home.inc.php, 1.57 hook_admin.inc.php, 1.8 hook_notifywindow.inc.php, 1.12 functions.inc.php, 1.118 class.email_service.inc.php, 1.2 hook_login.inc.php, 1.2 class.uisearch.inc.php, 1.2 |
Date: |
Thu, 24 Feb 2005 12:50:30 -0000 |
Update of email/inc
Modified Files:
Branch: MAIN
class.mail_filters.inc.php lines: +1 -1
class.mail_msg.inc.php lines: +1 -1
class.mail_msg_base.inc.php lines: +823 -338
class.mail_dcom_pop3.inc.php lines: +1 -1
class.mail_dcom_nntp.inc.php lines: +1 -1
class.mail_dcom_base_sock.inc.php lines: +25 -0
class.mail_dcom_imap.inc.php lines: +4 -4
class.mail_dcom_imap_sock.inc.php lines: +31 -1
class.mail_msg_display.inc.php lines: +652 -314
class.mail_msg_wrappers.inc.php lines: +640 -86
class.spell_struct.inc.php lines: +1 -1
class.spell_svc_none.inc.php lines: +1 -1
class.spell_svc_php.inc.php lines: +1 -1
class.spell.inc.php lines: +20 -12
class.so_mail_msg.inc.php lines: +693 -50
class.mail_send.inc.php lines: +37 -7
class.msg_bootstrap.inc.php lines: +36 -17
class.mail_dcom_base.inc.php lines: +43 -3
class.mail_dcom.inc.php lines: +4 -0
class.boaction.inc.php lines: +206 -132
class.boattach_file.inc.php lines: +6 -6
class.bocompose.inc.php lines: +113 -14
class.bofilters.inc.php lines: +50 -38
class.bosend.inc.php lines: +123 -3
class.html_widgets.inc.php lines: +1773 -1609
class.bopreferences.inc.php lines: +162 -325
class.bomessage.inc.php lines: +250 -52
class.bofolder.inc.php lines: +78 -13
class.boindex.inc.php lines: +49 -18
class.svc_debug.inc.php lines: +232 -9
hook_settings.inc.php lines: +1 -1
class.svc_nextmatches.inc.php lines: +3 -3
hook_preferences.inc.php lines: +23 -1
class.uiindex.inc.php lines: +72 -71
class.uijsaddressbook.inc.php lines: +1 -1
class.uimessage.inc.php lines: +193 -78
class.uifolder.inc.php lines: +27 -31
class.uifilters.inc.php lines: +159 -139
class.ui_mail_debug.inc.php lines: +307 -189
hook_notifywindow_simple.inc.php lines: +1 -1
class.uicompose.inc.php lines: +29 -32
class.uipreferences.inc.php lines: +96 -114
class.uiattach_file.inc.php lines: +1 -1
hook_manual.inc.php lines: +1 -1
hook_home.inc.php lines: +249 -153
hook_admin.inc.php lines: +19 -17
hook_notifywindow.inc.php lines: +1 -1
functions.inc.php lines: +2 -1
Added Files:
Branch: MAIN
class.email_service.inc.php lines: +259 -0
hook_login.inc.php lines: +5 -0
class.uisearch.inc.php lines: +457 -0
Log Message:
merge from 16
====================================================
====================================================
====================================================
Index: email/inc/class.mail_msg_base.inc.php
diff -u email/inc/class.mail_msg_base.inc.php:1.79
email/inc/class.mail_msg_base.inc.php:1.80
--- email/inc/class.mail_msg_base.inc.php:1.79 Sat Mar 29 23:19:49 2003
+++ email/inc/class.mail_msg_base.inc.php Thu Dec 30 23:13:50 2004
@@ -234,6 +234,9 @@
var $a = array();
var $acctnum = 0;
var $fallback_default_acctnum = 0;
+
+ // this object is 3 files, each an object "extending" the
other, this prevents 3 constructor calls
+ var $been_constructed = False;
// data storage for caching functions moved to SO object
var $so = '##NOTHING##';
@@ -264,8 +267,8 @@
var $browser = 0;
// use message UIDs instead of "message sequence numbers" in
requests to the mail server
var $force_msg_uids = True;
- // phpgw 0.9.14 was last for old template system, after that is
xslt, make note of version below
- var $phpgw_0914_orless = '-1';
+ // phpgw 0.9.16 was last for old template system, after that is
xslt, make note of version below
+ var $phpgw_before_xslt = '-1';
// raw prefs, before we process them to extract extra acct
and/or filters data, not of much use
var $unprocessed_prefs=array();
// raw filters array for use by the filters class, we just put
the data here, that is all, while collecting other prefs
@@ -277,9 +280,17 @@
// delete URI data is buffered to here, then executed at one
time (FUTURE)
var $buffered_delete_commmands = array();
// I think crypto var this is no longer used, uses global
crypto now I think (which does little anyway, w/o mcrypt)
- var $crypto;
+ //var $crypto;
+
+ // reply messages get this "quoting" prefix to each line, see
bocompose and bosend
+ //var $reply_prefix = '>';
+ var $reply_prefix = '> ';
+ //var $reply_prefix = '| ';
// ---- Data Caching ----
+ var $use_cached_prefs = True;
+ //var $use_cached_prefs = False;
+
// (A) session data caching in appsession, for data that is
temporary in nature
// right now this means msgball_list in appsession, and a bunch
of stuff we generate (mailsvr_str) stored in L1 cache
// also tries to appsession cache the "processed prefs" during
begin_request (NOTE: expire this on pref subit so new prefs actually take
effect)
@@ -310,9 +321,9 @@
// EXTRA ACCOUNTS
// used for looping thru extra account data during begin request
var $ex_accounts_count = 0;
- // extra_acounts[X][acctnum] = integer
- // extra_acounts[X][status] = empty | enabled | disabled
- var $extra_acounts = array();
+ // extra_accounts[X][acctnum] = integer
+ // extra_accounts[X][status] = empty | enabled | disabled
+ var $extra_accounts = array();
// same as above but includes the default account, makes
checking streams easier
var $extra_and_default_acounts = array();
@@ -336,6 +347,8 @@
var $debug_args_oop_access = 0;
var $debug_args_special_handlers = 0;
var $debug_index_page_display = 0;
+ // this is just being implemented
+ var $debug_message_display = 0;
// dormant code, "longterm_caching" currently OBSOLETE
var $debug_longterm_caching = 0;
//var $skip_args_special_handlers = 'get_mailsvr_callstr,
get_mailsvr_namespace, get_mailsvr_delimiter, get_folder_list';
@@ -343,22 +356,47 @@
var $skip_args_special_handlers = '';
/*!
- @function mail_msg
- @abstract CONSTRUCTOR
+ @function mail_msg_base
+ @abstract CONSTRUCTOR place holder, does nothing
*/
- function mail_msg()
+ function mail_msg_base()
{
+ if (($this->debug_logins > 0) &&
(is_object($this->dbug->out))) { $this->dbug->out('mail_msg('.__LINE__.'):
*constructor*: $GLOBALS[PHP_SELF] = ['.$GLOBALS['PHP_SELF'].'] $this->acctnum =
['.$this->acctnum.'] get_class($this) : "'.get_class($this).'" ;
get_parent_class($this) : "'.get_parent_class($this).'"<br>'); }
+ if ($this->debug_logins > 0) { echo
'mail_msg('.__LINE__.'): *constructor*: $GLOBALS[PHP_SELF] =
['.$GLOBALS['PHP_SELF'].'] $this->acctnum = ['.$this->acctnum.']
get_class($this) : "'.get_class($this).'" ; get_parent_class($this) :
"'.get_parent_class($this).'"<br>'; }
+ return;
+ }
+
+ /*!
+ @function initialize_mail_msg
+ @abstract the real CONSTRUCTOR needs to be called by name.
+ @discussion This used to be called in the final extends file to
this aggregrate class.
+ NEW now called only from bootstrap class, because the
preferences API class keeps constructing
+ this object for every account it makes preferences for, I would
change that but changing the API
+ is like moving a mountain, so I remove all auto constructor
functions and make this have to
+ be called explicitly to stop useless runthroughs caused by
preferences API.
+ */
+ function initialize_mail_msg()
+ {
+ if ($this->been_constructed == True)
+ {
+ // do not run thru this again, probably one of
the "extends" objects call this
+ return;
+ }
+ // Set this so we do not run thru this again
+ $this->been_constructed = True;
+
+ // ... OK ... now we actually do the CONSTRUCTOR
// svc_debug object goes here
if ($this->dbug == '##NOTHING##')
{
$this->dbug = CreateObject('email.svc_debug');
}
- //if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg: *constructor*: $GLOBALS[PHP_SELF] =
['.$GLOBALS['PHP_SELF'].'] $this->acctnum = ['.$this->acctnum.']
get_class($this) : "'.get_class($this).'" ; get_parent_class($this) :
"'.get_parent_class($this).'"<br>'); }
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: *constructor*: $this->acctnum =
['.$this->acctnum.'] ; $this->a DUMP:', $this->a); }
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: *constructor*: extra data $p1 (if provided):
'.serialize($p1).'<br>'); }
+ if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg.initialize_mail_msg('.__LINE__.'): ENTERING manual
*constructor*: $GLOBALS[PHP_SELF] = ['.$GLOBALS['PHP_SELF'].'] $this->acctnum =
['.$this->acctnum.'] get_class($this) : "'.get_class($this).'" ;
get_parent_class($this) : "'.get_parent_class($this).'"<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.initialize_mail_msg('.__LINE__.'): manual
*constructor*: $this->acctnum = ['.$this->acctnum.'] ; $this->a DUMP:',
$this->a); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.initialize_mail_msg('.__LINE__.'): manual
*constructor*: extra data $p1 (if provided): '.serialize($p1).'<br>'); }
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: *constructor*: checking and or setting GET and POST
reference based on PHP version<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.initialize_mail_msg('.__LINE__.'): manual
*constructor*: checking and or setting GET and POST reference based on PHP
version<br>'); }
// make GPC reference for php versions < 4.1 and > 4.2
// since this constructor is apparently called many
times
// during the script run (not sure why) we check if
we've already done it first
@@ -399,10 +437,11 @@
$this->ref_SESSION =
&$GLOBALS['HTTP_SESSION_VARS'];
}
}
-
+
// SO object has data storage functions
if ($this->so == '##NOTHING##')
{
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.initialize_mail_msg('.__LINE__.'): manual
*constructor*: creating sub SO object "so_mail_msg"<br>'); }
$this->so = CreateObject('email.so_mail_msg');
}
@@ -410,23 +449,64 @@
// TEMPORARY ONLY DURING MIGRATION AND TABLE DEVELOPMENT
if ($this->use_private_table)
{
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.initialize_mail_msg('.__LINE__.'): manual
*constructor*: checking if "so_am_table_exists"<br>'); }
if ($this->so->so_am_table_exists() == False)
{
$this->use_private_table = False;
}
}
+ // UNDER DEVELOPMENT when to use cached preferences
+ if ($this->use_cached_prefs == True)
+ {
+ // any preferences page menuaction is a NO NO
to cached prefs
+ if (stristr($this->ref_GET['menuaction'],
'preferences.'))
+ {
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.initialize_mail_msg('.__LINE__.'): manual
*constructor*: string "preferences." is in menuaction so NO CACHED PREFS,
setting $this->use_cached_prefs to False<br>'); }
+ $this->use_cached_prefs = False;
+ }
+ }
+
+ // UNDER DEVELOPMENT bulk data query from AngleMail DB
+ // only necessary to grab huge bulk data for INDEX page
+ // and some other menuactions too, but we will add more
later
+ if ((stristr($this->ref_GET['menuaction'],
'email.uiindex'))
+ || (stristr($this->ref_GET['menuaction'],
'email.uimessage.message')))
+ {
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.initialize_mail_msg('.__LINE__.'): manual
*constructor*: calling $this->so->so_prop_use_group_data(True)<br>'); }
+ //$this->so->use_group_data = True;
+ $this->so->so_prop_use_group_data(True);
+ }
+ else
+ {
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.initialize_mail_msg('.__LINE__.'): manual
*constructor*: calling $this->so->so_prop_use_group_data(False)<br>'); }
+ //$this->so->use_group_data = False;
+ $this->so->so_prop_use_group_data(False);
+ }
+
// trying this new thing for template porting issues
- if ($this->phpgw_0914_orless == '-1')
+ // relfbecker recommends NOT using a version test for
xslt check
+ if ($this->phpgw_before_xslt == '-1')
{
- $this->phpgw_0914_orless =
!isset($GLOBALS['phpgw']->xslttpl);
+ if (is_object($GLOBALS['phpgw']->xslttpl))
+ {
+ $this->phpgw_before_xslt = False;
+ }
+ else
+ {
+ $this->phpgw_before_xslt = True;
+ }
+ }
/*
+ // relfbecker recommends NOT using a version test for
xslt check
+ if ($this->phpgw_before_xslt == '-1')
+ {
$this_ver =
$GLOBALS['phpgw_info']['server']['versions']['phpgwapi'];
$pre_xslt_ver = '0.9.14.0.1.1';
if (!$this_ver)
{
// damn stupid fallback if the api
moves the version to another place
- $this->phpgw_0914_orless = True;
+ $this->phpgw_before_xslt = True;
}
// this is a function in phpgwapi
"common_functions" file for phpgw 0.9.15+
elseif (function_exists(amorethanb))
@@ -434,12 +514,12 @@
if (amorethanb($this_ver,
$pre_xslt_ver))
{
// this phpgw version is after
the switch to xslt templates
- $this->phpgw_0914_orless =
False;
+ $this->phpgw_before_xslt =
False;
}
else
{
// this phpgw version is NOT in
the xslt era
- $this->phpgw_0914_orless = True;
+ $this->phpgw_before_xslt = True;
}
}
else
@@ -447,15 +527,16 @@
if
($GLOBALS['phpgw']->common->cmp_version_long($this_ver, $pre_xslt_ver))
{
// this phpgw version is after
the switch to xslt templates
- $this->phpgw_0914_orless =
False;
+ $this->phpgw_before_xslt =
False;
}
else
{
// this phpgw version is NOT in
the xslt era
- $this->phpgw_0914_orless = True;
+ $this->phpgw_before_xslt = True;
}
- }*/
+ }
}
+ */
$this->known_external_args = array(
// === NEW GPC "OBJECTS" or Associative Arrays
===
@@ -548,6 +629,16 @@
// (c) send_message.php: when set to "forward"
and used with "fwd_proc" instructs on how to construct
// the SMTP mail
'action',
+ // ---- orig_action: string ----
+ // USAGE:
+ // preserves the original "action" of the
compose page because new and forward body lines
+ // need to be shorter then reply to we need to
remember the desired "action" and store it here
+ // also used to preserve this thru the spell
check process too
+ // initially we only put this only in the GET
part of GPC
+ // why is this different, "orig_action" can
have the value "new" meaning new mail
+ // whereas plain old "action" can not tell us
of a new mail situation, not right now anyway,
+ // so the "new" value can be preserved to the
send code and also thru the spell page and back too
+ 'orig_action',
// === MESSAGE NUMBER AND MIME PART REFERENCES
===
// *update* now in msgball
@@ -723,7 +814,8 @@
// experimental: Set Flag indicative we've run
thru this function
'already_grab_class_args_gpc'
);
- //if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg: constructor: $this->known_args[] dump<pre>';
print_r($this->known_args); echo '</pre>'); }
+ //if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.initialize_mail_msg('.__LINE__.'): manual
constructor: $this->known_args[] DUMP:', $this->known_args); }
+ if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg.initialize_mail_msg('.__LINE__.'): manual
*constructor*: LEAVING<br>'); }
}
/*!
@@ -736,8 +828,8 @@
// ---- BEGIN request from Mailserver / Initialize This Mail
Session -----
function begin_request($args_array)
{
- if ($this->debug_logins > 0) {
$this->dbug->out('<br>mail_msg: begin_request: ENTERING'.'<br>'); }
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: feed var args_array[] DUMP:',
$args_array); }
+ if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): ENTERING'.'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): feed var args_array[]
DUMP:', $args_array); }
// Grab GPC vars, after we get an acctnum, we'll put
them in the appropriate account's "args" data
// issue?: which acctnum arg array would this be
talking to when we inquire about "already_grab_class_args_gpc"?
@@ -745,35 +837,35 @@
&&
((string)$this->get_arg_value('already_grab_class_args_gpc') != '') )
{
// somewhere, there's already been a call to
grab_class_args_gpc(), do NOT re-run
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: "already_grab_class_args_gpc" is
set, do not re-grab<br>'); }
- if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg: begin_request: "already_grab_class_args_gpc"
pre-existing $this->get_all_args() DUMP:', $this->get_all_args()); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'):
"already_grab_class_args_gpc" is set, do not re-grab<br>'); }
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'):
"already_grab_class_args_gpc" pre-existing $this->get_all_args() DUMP:',
$this->get_all_args()); }
$got_args=array();
}
else
{
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: "already_grab_class_args_gpc" is NOT
set, call grab_class_args_gpc() now<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'):
"already_grab_class_args_gpc" is NOT set, call grab_class_args_gpc() now<br>');
}
$got_args=array();
$got_args = $this->grab_class_args_gpc();
}
// FIND THE "BEST ACCTNUM" and set it
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: about to call:
get_best_acctnum($args_array, $got_args) <br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): about to call:
get_best_acctnum($args_array, $got_args) <br>'); }
$acctnum = $this->get_best_acctnum($args_array,
$got_args);
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: "get_best_acctnum" returns $acctnum
['.$acctnum.']<br>'); }
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: * * * *SETTING CLASS ACCTNUM* * * *
by calling $this->set_acctnum('.serialize($acctnum).')<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): "get_best_acctnum"
returns $acctnum ['.$acctnum.']<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): * * * *SETTING CLASS
ACCTNUM* * * * by calling $this->set_acctnum('.serialize($acctnum).')<br>'); }
$this->set_acctnum($acctnum);
// SET GOT_ARGS TO THAT ACCTNUM
// use that acctnum to set "got_args" to the appropiate
acctnum
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: about to call:
$this->set_arg_array($got_args); <br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): about to call:
$this->set_arg_array($got_args); <br>'); }
$this->set_arg_array($got_args, $acctnum);
- if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg: begin_request: post set_arg_array
$this->get_all_args() DUMP:', $this->get_all_args()); }
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): post set_arg_array
$this->get_all_args() DUMP:', $this->get_all_args()); }
// Initialize Internal Args
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: about to call:
"init_internal_args_and_set_them('.$acctnum.')"<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): about to call:
"init_internal_args_and_set_them('.$acctnum.')"<br>'); }
$this->init_internal_args_and_set_them($acctnum);
- if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg: begin_request: POST "grab_class_args_gpc",
"get_best_acctnum", and "init_internal_args_and_set_them" :
this->get_all_args() DUMP:', $this->get_all_args()); }
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): POST
"grab_class_args_gpc", "get_best_acctnum", and
"init_internal_args_and_set_them" : this->get_all_args() DUMP:',
$this->get_all_args()); }
// (chopped out the re-use existing object code - never
worked right, maybe later...)
@@ -784,247 +876,428 @@
if (($GLOBALS['phpgw_info']['server']['sessions_type']
== 'db')
|| ($this->use_private_table == True))
{
+ /*
+ if (! is_object($this->so))
+ {
+ $this->initialize_mail_msg();
+ }
+ */
+
// REF_SESSION should not really be in
$_SESSION namespace so RE-CREATE all this outside of php4 sessions
$this->so->prep_db_session_compat('begin_request LINE '.__LINE__);
}
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: about to create_email_preferences
and setup extra accounts<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): about to handle email
preferences and setup extra accounts<br>'); }
// ---- Obtain Preferences Data ----
/*
// UNDER DEVELOPMEMT: caching the prefs data
- // see if our "processed prefs" (what we make below)
were appsession cached by us already
- // FORGET IT THIS IS AS COMPLICATED AS DOING IT FOR REAL
- $appsession_cached_prefs =
$this->read_session_cache_item('cached_prefs', $acctnum);
- if (($this->session_cache_enabled == True)
- && ($appsession_cached_prefs))
+ // data we need to DB save to cache final processed
prefs
+ $this->unprocessed_prefs
+ $this->raw_filters
+ $this->ex_accounts_count
+ $this->extra_accounts
+ $this->extra_and_default_acounts
+ $this->a[X]->prefs
+ // where X is the account number, we can use
"set_pref_array(array_data, acctnum) for each account
+
+ // ok lets make an array to hold this data in the DB
+ $cached_prefs = array();
+ $cached_prefs['unprocessed_prefs'] = array();
+ $cached_prefs['raw_filters'] = array();
+ $cached_prefs['ex_accounts_count'] = '0';
+ $cached_prefs['extra_accounts'] = array();
+ $cached_prefs['extra_and_default_acounts'] = array();
+ $cached_prefs['a'] = array();
+ */
+ // ---- GET FROM CACHE THE COMPLETED PREF DATA
+ //$this->use_cached_prefs = True;
+ //$this->use_cached_prefs = False;
+ if ($this->use_cached_prefs == False)
{
- $appsession_cached_prefs =
unserialize($appsession_cached_prefs);
- //['cached_prefs'] has several sub elements
that fill out the prefs we need
- // (a) unprocessed_prefs that we keep around,
disabled account name access this because disabled accounts do not get
processed prefs
- $this->unprocessed_prefs = array();
- $this->unprocessed_prefs['email'] = array();
- $this->unprocessed_prefs['email'] =
$appsession_cached_prefs['cached_prefs']['unprocessed_prefs'];
- // (b) filter data we got from prefs and cached
- $this->raw_filters = array();
- if
((isset($appsession_cached_prefs['cached_prefs']['raw_filters']))
- &&
(is_array($appsession_cached_prefs['cached_prefs']['raw_filters'])))
+ $cached_prefs = $this->nothing;
+ }
+ else
+ {
+ /*
+ // data we need to DB save to cache final
processed prefs
+ $this->unprocessed_prefs
+ $this->raw_filters
+ $this->ex_accounts_count
+ $this->extra_accounts
+ $this->extra_and_default_acounts
+ $this->a[X]->['prefs']
+ // where X is the account number, we can use
"set_pref_array(array_data, acctnum) for each account
+
+ // ok this is what we should get from the DB
storage (we use appsession for now)
+ $cached_prefs = array();
+ $cached_prefs['unprocessed_prefs'] = array();
+ $cached_prefs['raw_filters'] = array();
+ $cached_prefs['ex_accounts_count'] = '0';
+ $cached_prefs['extra_accounts'] = array();
+ $cached_prefs['extra_and_default_acounts'] =
array();
+ $cached_prefs['a'] = array();
+ */
+ // get the data from appsession, we use
compression to avoid problems unserializing
+ $my_location = '0;cached_prefs';
+ $cached_prefs =
$this->so->so_appsession_passthru($my_location);
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): raw $cached_prefs as
returned from cache DUMP:', $cached_prefs); }
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): raw serialized
$cached_prefs is '.htmlspecialchars(serialize($cached_prefs)).'<br>'); }
+ }
+
+ // ok if we actually got cached_prefs then maybe we can
use them
+ if (($this->use_cached_prefs == True)
+ && ((string)$cached_prefs != $this->nothing)
+ && (is_array($cached_prefs))
+ && (isset($cached_prefs['extra_and_default_acounts'])))
+ {
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): raw $cached_prefs
deemed to actually have usable data, so process it<br>'); }
+ // UN-defang the filters
+ // NO remember that filters are left in defang
(htmlquotes encoded) form
+ // UNTIL they are going to be used, then
bofilters defangs them
+ //for ($x=0; $x <
count($cached_prefs['raw_filters']); $x++)
+ //{
+ //
$cached_prefs['raw_filters'][$x]['filtername'] =
$this->db_defang_decode($cached_prefs['raw_filters'][$x]['filtername']);
+ //
$cached_prefs['raw_filters'][$x]['source_accounts']['folder'] =
$this->db_defang_decode($cached_prefs['raw_filters'][$x]['source_accounts']['folder']);
+ // for ($y=0; $y <
count($cached_prefs['raw_filters']['matches']); $y++)
+ // {
+ //
$cached_prefs['raw_filters'][$x]['matches'][$y]['matchthis']
+ // =
$this->db_defang_decode($cached_prefs['raw_filters'][$x]['matches'][$y]['matchthis']);
+ // }
+ // for ($y=0; $y <
count($cached_prefs['raw_filters']['actions']); $y++)
+ // {
+ //
$cached_prefs['raw_filters'][$x]['actions'][$y]['folder']
+ // =
$this->db_defang_decode($cached_prefs['raw_filters'][$x]['actions'][$y]['folder']);
+ // }
+ //}
+ // UN-defang the rest of the prefs that may
need it
+ $defang_these = array();
+ $defang_these[0] = 'passwd';
+ $defang_these[1] = 'email_sig';
+ $defang_these[2] = 'trash_folder_name';
+ $defang_these[3] = 'sent_folder_name';
+ $defang_these[4] = 'userid';
+ $defang_these[5] = 'address';
+ $defang_these[6] = 'mail_folder';
+ $defang_these[7] = 'fullname';
+ $defang_these[8] = 'account_name';
+ $loops =
count($cached_prefs['extra_and_default_acounts']);
+ for ($i=0; $i < $loops; $i++)
{
- $this->raw_filters =
$appsession_cached_prefs['cached_prefs']['raw_filters'];
+ for ($x=0; $x < count($defang_these);
$x++)
+ {
+ $defang_word =
$defang_these[$x];
+ if
(isset($cached_prefs['a'][$i]['prefs'][$defang_word]))
+ {
+
$cached_prefs['a'][$i]['prefs'][$defang_word]
+ =
$this->db_defang_decode($cached_prefs['a'][$i]['prefs'][$defang_word]);
+ }
+ }
}
- // (c) prefs for default account 0, ALSO are
the "backwards compatibility prefs data
-
$this->set_pref_array($appsession_cached_prefs['cached_prefs']['acct_0'], 0);
- if
(is_array($GLOBALS['phpgw_info']['user']['preferences']['email']) == False)
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): retrieved $cached_prefs
AFTER UN-defang DUMP:', $cached_prefs); }
+ // lets fill the data
+ $this->unprocessed_prefs =
$cached_prefs['unprocessed_prefs'];
+ $this->raw_filters =
$cached_prefs['raw_filters'];
+ $this->ex_accounts_count =
$cached_prefs['ex_accounts_count'];
+ $this->extra_accounts =
$cached_prefs['extra_accounts'];
+ $this->extra_and_default_acounts =
$cached_prefs['extra_and_default_acounts'];
+ $loops =
count($this->extra_and_default_acounts);
+ for ($i=0; $i < $loops; $i++)
{
-
$GLOBALS['phpgw_info']['user']['preferences']['email'] = array();
-
$GLOBALS['phpgw_info']['user']['preferences']['email'] =
$appsession_cached_prefs['cached_prefs']['acct_0'];
+
$this->set_pref_array($cached_prefs['a'][$i]['prefs'], $i);
}
- // (d) the rest of the accounts, what are their
account numbers?
- // since some accts could be disabled, they
need not be contiguously numbered, disabled accts do not get processed prefs
- $ex_acct_nums = array();
- if
(isset($appsession_cached_prefs['cached_prefs']['ex_accounts_nums']))
- {
- $ex_acct_nums =
explode(',',$appsession_cached_prefs['cached_prefs']['ex_accounts_nums']);
- }
- //(e) fill in this array containing some info
about these accounts status, acct 0 is always done because we know acct 0
always exists
- $this->extra_and_default_acounts = array();
- $this->extra_and_default_acounts[0]['acctnum']
= 0;
- $this->extra_and_default_acounts[0]['status'] =
'enabled';
- // (f) fill in this item with data about the
number of accounts
- $this->ex_accounts_count = count($ex_acct_nums);
- // (g) fill the prefs for extra accounts if
necessary
-
$this->extra_and_default_acounts[$i+1]['acctnum'] =
$this->extra_accounts[$i]['acctnum'];
-
$this->extra_and_default_acounts[$i+1]['status'] =
$this->extra_accounts[$i]['status'];
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): successfully retrieved
and applied $cached_prefs<br>'); }
}
- */
-
- // obtain the preferences from the database, put them
in $this->unprocessed_prefs, note THIS GETS ALL PREFS for some reason, not just
email prefs?
- //if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg: begin_request: BEFORE "create_email_preferences"
GLOBALS[phpgw_info][user][preferences] DUMP<pre>';
print_r($GLOBALS['phpgw_info']['user']['preferences']); echo '</pre>'); }
- //$this->unprocessed_prefs =
$GLOBALS['phpgw']->preferences->create_email_preferences();
- $tmp_email_only_prefs = array();
- $tmp_email_only_prefs =
$GLOBALS['phpgw']->preferences->create_email_preferences();
- // clean "unprocessed_prefs" so all prefs oher than
email are NOT included
- $this->unprocessed_prefs = array();
- $this->unprocessed_prefs['email'] = array();
- $this->unprocessed_prefs['email'] =
$tmp_email_only_prefs['email'];
- $tmp_email_only_prefs = array();
- unset($tmp_email_only_prefs);
- //if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg: begin_request: AFTER "create_email_preferences"
GLOBALS[phpgw_info][user][preferences] DUMP<pre>';
print_r($GLOBALS['phpgw_info']['user']['preferences']); echo '</pre>'); }
-
- // BACKWARDS COMPAT for apps that have no clue what
multiple accounts are about
- // fill email's
$GLOBALS['phpgw_info']['user']['preferences'] with the data for backwards
compatibility (we don't use that)
- // damn, where did email's prefs get filled already?
Where are they getting filled, anyway do not re-fill if not needed
- // NO - IT IS POSSIBLE THIS MAY NOT CATCH ALL PREF
CHANGES IN CORNER CASES
- //if
(is_array($GLOBALS['phpgw_info']['user']['preferences']['email']) == False)
+ //$allow_prefs_shortcut = True;
+ //$allow_prefs_shortcut = False;
+ //if
((is_array($GLOBALS['phpgw_info']['user']['preferences']['email']) == True)
+ //&& ($allow_prefs_shortcut == True))
//{
- //$GLOBALS['phpgw_info']['user']['preferences']
= $this->unprocessed_prefs;
-
$GLOBALS['phpgw_info']['user']['preferences']['email'] = array();
-
$GLOBALS['phpgw_info']['user']['preferences']['email'] =
$this->unprocessed_prefs['email'];
+ // if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): prefs array already
created by the API, NOT calling "create_email_preferences"<br>'); }
+ // $this->unprocessed_prefs = array();
+ // $this->unprocessed_prefs['email'] = array();
+ // $this->unprocessed_prefs['email'] =
$GLOBALS['phpgw_info']['user']['preferences']['email'];
+ // if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): did NOT call
create_email_preferences, prefs were already available in
$GLOBALS["phpgw_info"]["user"]["preferences"]["email"] <br>'); }
//}
- //echo 'dump3 <pre>';
print_r($GLOBALS['phpgw_info']['user']['preferences']); echo '</pre>';
- // BUT DO NOT put unneeded stuff in there,
[ex_accounts] and [filters] multilevel arrays
- // are not needed for mackward compat, we need them
internally but external apps do not use this raw data
- if
(isset($GLOBALS['phpgw_info']['user']['preferences']['email']['ex_accounts']))
- {
-
$GLOBALS['phpgw_info']['user']['preferences']['email']['ex_accounts'] = array();
-
unset($GLOBALS['phpgw_info']['user']['preferences']['email']['ex_accounts']);
- }
- if
(isset($GLOBALS['phpgw_info']['user']['preferences']['email']['filters']))
- {
-
$GLOBALS['phpgw_info']['user']['preferences']['email']['filters'] = array();
-
unset($GLOBALS['phpgw_info']['user']['preferences']['email']['filters']);
- }
- if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg: begin_request: AFTER backwards_compat and cleaning
GLOBALS[phpgw_info][user][preferences] DUMP:',
$GLOBALS['phpgw_info']['user']['preferences']); }
-
- // first, put the filter data from prefs in a holding
var for use by the filters class if needed
- // raw filters array for use by the filters class, we
just put the data here, that is all, while collecting other prefs
- $this->raw_filters = array();
- if
((isset($this->unprocessed_prefs['email']['filters']))
- &&
(is_array($this->unprocessed_prefs['email']['filters'])))
- {
- $this->raw_filters =
$this->unprocessed_prefs['email']['filters'];
- // not get that out of "unprocessed_prefs"
because it is not needed there any more
- $this->unprocessed_prefs['email']['filters'] =
array();
-
unset($this->unprocessed_prefs['email']['filters']);
- }
- //if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg: begin_request: put filter data in
$this->raw_filters DUMP<pre>'; print_r($this->raw_filters); echo '</pre>'); }
-
- // second, set the prefs for the default, base acct 0,
BUT do not give it data it does not need
- // we already got "filters" out of "unprocessed_prefs",
so when setting acct0 prefs, do not give it the "ex_accounts" array
- $acct0_prefs_cleaned = array();
- $acct0_prefs_cleaned = $this->unprocessed_prefs;
- if
((isset($acct0_prefs_cleaned['email']['ex_accounts']))
- &&
(is_array($acct0_prefs_cleaned['email']['ex_accounts'])))
- {
- $acct0_prefs_cleaned['email']['ex_accounts'] =
array();
-
unset($acct0_prefs_cleaned['email']['ex_accounts']);
- }
- // now we can use that to set the prefs for the base
account
-
- // --- process pres for in multi account enviornment
---
- // for our use, put prefs in a class var to be accessed
thru OOP-style access calls in mail_msg_wrapper
- // since we know these prefs to be the top level
prefs, for the default email account, force them into acctnum 0
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: putting top level, default account,
pref data in acct 0 with $this->set_pref_array($acct0_prefs_cleaned[email], 0);
<br>'); }
- if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg: begin_request: $acct0_prefs_cleaned[email] DUMP:',
$acct0_prefs_cleaned['email']); }
-
//$this->set_pref_array($this->unprocessed_prefs['email'], 0);
- $this->set_pref_array($acct0_prefs_cleaned['email'], 0);
- $acct0_prefs_cleaned = array();
- unset($acct0_prefs_cleaned);
-
-
- // === EXTRA ACCOUNTS ===
- // they are located in an array based at
$this->unprocessed_prefs['email']['ex_accounts'][]
- // determine what extra accounts have been defined
- // note: php3 DOES have is_array(), ok to use it here
- if
((isset($this->unprocessed_prefs['email']['ex_accounts']))
- &&
(is_array($this->unprocessed_prefs['email']['ex_accounts'])))
+ else
{
- $this->ex_accounts_count =
count($this->unprocessed_prefs['email']['ex_accounts']);
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request:
$this->unprocessed_prefs[email][ex_accounts] is set and is_array, its count:
$this->ex_accounts_count: ['.$this->ex_accounts_count.']<br>'); }
- if ($this->debug_logins > 2) {
$this->dbug->out('$this->unprocessed_prefs[email][ex_accounts] DUMP:',
$this->unprocessed_prefs['email']['ex_accounts']); }
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: about to process extra account data
; $this->ex_accounts_count: ['.$this->ex_accounts_count.']<br>'); }
- // note: extra accounts lowest possible value =
1, NOT 0
- // also, $key, although numbered integers, may
not be conticuous lowest to highest (may be empty or missing elements inbetween)
-
- // ---- what accounts have some data defined
- // array_extra_accounts[X]['acctnum'] : integer
- // array_extra_accounts[X]['status'] string =
"enabled" | "disabled" | "empty"
- //while(list($key,$value) =
each($this->unprocessed_prefs['email']['ex_accounts']))
- while(list($key,$value) =
each($this->unprocessed_prefs['email']['ex_accounts']))
- {
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: inside loop: for each
$this->unprocessed_prefs[email][ex_accounts] ; $key: ['.serialize($key).']
$value DUMP:', $value); }
- // if we are here at all then this
array item must have some data defined
- $next_pos =
count($this->extra_accounts);
- $this->extra_accounts[$next_pos] =
array();
-
$this->extra_accounts[$next_pos]['acctnum'] = (int)$key;
- // ---- is this account "enabled",
"disabled" or is this array item "empty"
- // first, see if it has essential data,
if not, it's an empty array item
- if (
(!isset($this->unprocessed_prefs['email']['ex_accounts'][$key]['fullname']))
- ||
(!isset($this->unprocessed_prefs['email']['ex_accounts'][$key]['email_sig']))
- ||
(!isset($this->unprocessed_prefs['email']['ex_accounts'][$key]['layout'])) )
- {
- // this account lacks essential
data needed to describe an account, it must be an "empty" element
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: inside loop: account ['.$key.'] is
*empty*: $this->unprocessed_prefs[email][ex_accounts]['.$key.']:
['.serialize($this->unprocessed_prefs['email']['ex_accounts'][$key]).']<br>'); }
-
$this->extra_accounts[$next_pos]['status'] = 'empty';
- }
- // ... so the account is not empty ...
- elseif (
(isset($this->unprocessed_prefs['email']['ex_accounts'][$key]['ex_account_enabled']))
- &&
((string)$this->unprocessed_prefs['email']['ex_accounts'][$key]['ex_account_enabled']
!= ''))
- {
- // this account is defined AND
enabled,
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: inside loop: account ['.$key.'] is
*enabled*:
$this->unprocessed_prefs[email][ex_accounts]['.$key.'][ex_account_enabled]:
['.serialize($this->unprocessed_prefs['email']['ex_accounts'][$key]['ex_account_enabled']).']<br>');
}
-
$this->extra_accounts[$next_pos]['status'] = 'enabled';
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): $cached_prefs either
disabled or no data was cached<br>'); }
+ // make this empty without question, since
cached prefs were not recovered
+ $cached_prefs = array();
+ // IT SEEMS PREFS FOR ACCT 0 NEED TO RUN THRU
THIS TO FILL "Account Name" thingy
+ // obtain the preferences from the database,
put them in $this->unprocessed_prefs, note THIS GETS ALL PREFS for some reason,
not just email prefs?
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): BEFORE processing email
prefs, GLOBALS[phpgw_info][user][preferences][email] DUMP:',
$GLOBALS['phpgw_info']['user']['preferences']['email']); }
+
+ //$this->unprocessed_prefs =
$GLOBALS['phpgw']->preferences->create_email_preferences();
+ $tmp_email_only_prefs = array();
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): calling
create_email_preferences, may be time consuming<br>'); }
+ $tmp_email_only_prefs =
$GLOBALS['phpgw']->preferences->create_email_preferences();
+ // clean "unprocessed_prefs" so all prefs oher
than email are NOT included
+ $this->unprocessed_prefs = array();
+ $this->unprocessed_prefs['email'] = array();
+ $this->unprocessed_prefs['email'] =
$tmp_email_only_prefs['email'];
+ $tmp_email_only_prefs = array();
+ unset($tmp_email_only_prefs);
+ //if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): AFTER
"create_email_preferences" GLOBALS[phpgw_info][user][preferences] DUMP<pre>';
print_r($GLOBALS['phpgw_info']['user']['preferences']); echo '</pre>'); }
+
+ // BACKWARDS COMPAT for apps that have no clue
what multiple accounts are about
+ // fill email's
$GLOBALS['phpgw_info']['user']['preferences'] with the data for backwards
compatibility (we don't use that)
+ // damn, where did email's prefs get filled
already? Where are they getting filled, anyway do not re-fill if not needed
+ // NO - IT IS POSSIBLE THIS MAY NOT CATCH ALL
PREF CHANGES IN CORNER CASES
+ if
(is_array($GLOBALS['phpgw_info']['user']['preferences']['email']) == False)
+ {
+
//$GLOBALS['phpgw_info']['user']['preferences'] = $this->unprocessed_prefs;
+
$GLOBALS['phpgw_info']['user']['preferences']['email'] = array();
+
$GLOBALS['phpgw_info']['user']['preferences']['email'] =
$this->unprocessed_prefs['email'];
+ }
+ //echo 'dump3 <pre>';
print_r($GLOBALS['phpgw_info']['user']['preferences']); echo '</pre>';
+ // BUT DO NOT put unneeded stuff in there,
[ex_accounts] and [filters] multilevel arrays
+ // are not needed for mackward compat, we need
them internally but external apps do not use this raw data
+ //if
(isset($GLOBALS['phpgw_info']['user']['preferences']['email']['ex_accounts']))
+ //{
+ //
$GLOBALS['phpgw_info']['user']['preferences']['email']['ex_accounts'] = array();
+ //
unset($GLOBALS['phpgw_info']['user']['preferences']['email']['ex_accounts']);
+ //}
+ //if
(isset($GLOBALS['phpgw_info']['user']['preferences']['email']['filters']))
+ //{
+ //
$GLOBALS['phpgw_info']['user']['preferences']['email']['filters'] = array();
+ //
unset($GLOBALS['phpgw_info']['user']['preferences']['email']['filters']);
+ //}
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): AFTER backwards_compat
and cleaning GLOBALS[phpgw_info][user][preferences] DUMP:',
$GLOBALS['phpgw_info']['user']['preferences']); }
+
+
+ // first, put the filter data from prefs in a
holding var for use by the filters class if needed
+ // raw filters array for use by the filters
class, we just put the data here, that is all, while collecting other prefs
+ $this->raw_filters = array();
+ if
((isset($this->unprocessed_prefs['email']['filters']))
+ &&
(is_array($this->unprocessed_prefs['email']['filters'])))
+ {
+ $this->raw_filters =
$this->unprocessed_prefs['email']['filters'];
+ // not get that out of
"unprocessed_prefs" because it is not needed there any more
+
$this->unprocessed_prefs['email']['filters'] = array();
+
unset($this->unprocessed_prefs['email']['filters']);
+ }
+ //if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): put filter data in
$this->raw_filters DUMP<pre>'; print_r($this->raw_filters); echo '</pre>'); }
+
+ // second, set the prefs for the default, base
acct 0, BUT do not give it data it does not need
+ // we already got "filters" out of
"unprocessed_prefs", so when setting acct0 prefs, do not give it the
"ex_accounts" array
+ $acct0_prefs_cleaned = array();
+ $acct0_prefs_cleaned = $this->unprocessed_prefs;
+ if
((isset($acct0_prefs_cleaned['email']['ex_accounts']))
+ &&
(is_array($acct0_prefs_cleaned['email']['ex_accounts'])))
+ {
+
$acct0_prefs_cleaned['email']['ex_accounts'] = array();
+
unset($acct0_prefs_cleaned['email']['ex_accounts']);
+ }
+ // now we can use that to set the prefs for the
base account
+
+ // --- process pres for in multi account
enviornment ---
+ // for our use, put prefs in a class var to be
accessed thru OOP-style access calls in mail_msg_wrapper
+ // since we know these prefs to be the top
level prefs, for the default email account, force them into acctnum 0
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): putting top level,
default account, pref data in acct 0 with
$this->set_pref_array($acct0_prefs_cleaned[email], 0); <br>'); }
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'):
$acct0_prefs_cleaned[email] DUMP:', $acct0_prefs_cleaned['email']); }
+
//$this->set_pref_array($this->unprocessed_prefs['email'], 0);
+
$this->set_pref_array($acct0_prefs_cleaned['email'], 0);
+ $acct0_prefs_cleaned = array();
+ unset($acct0_prefs_cleaned);
+
+
+ // === EXTRA ACCOUNTS ===
+ // they are located in an array based at
$this->unprocessed_prefs['email']['ex_accounts'][]
+ // determine what extra accounts have been
defined
+ // note: php3 DOES have is_array(), ok to use
it here
+ if
((isset($this->unprocessed_prefs['email']['ex_accounts']))
+ &&
(is_array($this->unprocessed_prefs['email']['ex_accounts'])))
+ {
+ $this->ex_accounts_count =
count($this->unprocessed_prefs['email']['ex_accounts']);
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'):
$this->unprocessed_prefs[email][ex_accounts] is set and is_array, its count:
$this->ex_accounts_count: ['.$this->ex_accounts_count.']<br>'); }
+ if ($this->debug_logins > 2) {
$this->dbug->out('$this->unprocessed_prefs[email][ex_accounts] DUMP:',
$this->unprocessed_prefs['email']['ex_accounts']); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): about to process extra
account data ; $this->ex_accounts_count: ['.$this->ex_accounts_count.']<br>'); }
+ // note: extra accounts lowest possible
value = 1, NOT 0
+ // also, $key, although numbered
integers, may not be conticuous lowest to highest (may be empty or missing
elements inbetween)
+
+ // ---- what accounts have some data
defined
+ // array_extra_accounts[X]['acctnum'] :
integer
+ // array_extra_accounts[X]['status']
string = "enabled" | "disabled" | "empty"
+ //while(list($key,$value) =
each($this->unprocessed_prefs['email']['ex_accounts']))
+ while(list($key,$value) =
each($this->unprocessed_prefs['email']['ex_accounts']))
+ {
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): inside loop: for each
$this->unprocessed_prefs[email][ex_accounts] ; $key: ['.serialize($key).']
$value DUMP:', $value); }
+ // if we are here at all then
this array item must have some data defined
+ $next_pos =
count($this->extra_accounts);
+
$this->extra_accounts[$next_pos] = array();
+
$this->extra_accounts[$next_pos]['acctnum'] = (int)$key;
+ // ---- is this account
"enabled", "disabled" or is this array item "empty"
+ // first, see if it has
essential data, if not, it's an empty array item
+ if (
(!isset($this->unprocessed_prefs['email']['ex_accounts'][$key]['fullname']))
+ ||
(!isset($this->unprocessed_prefs['email']['ex_accounts'][$key]['email_sig']))
+ ||
(!isset($this->unprocessed_prefs['email']['ex_accounts'][$key]['layout'])) )
+ {
+ // this account lacks
essential data needed to describe an account, it must be an "empty" element
+ if ($this->debug_logins
> 1) { $this->dbug->out('mail_msg.begin_request('.__LINE__.'): inside loop:
account ['.$key.'] is *empty*:
$this->unprocessed_prefs[email][ex_accounts]['.$key.']:
['.serialize($this->unprocessed_prefs['email']['ex_accounts'][$key]).']<br>'); }
+
$this->extra_accounts[$next_pos]['status'] = 'empty';
+ }
+ // ... so the account is not
empty ...
+ elseif (
(isset($this->unprocessed_prefs['email']['ex_accounts'][$key]['ex_account_enabled']))
+ &&
((string)$this->unprocessed_prefs['email']['ex_accounts'][$key]['ex_account_enabled']
!= ''))
+ {
+ // this account is
defined AND enabled,
+ if ($this->debug_logins
> 1) { $this->dbug->out('mail_msg.begin_request('.__LINE__.'): inside loop:
account ['.$key.'] is *enabled*:
$this->unprocessed_prefs[email][ex_accounts]['.$key.'][ex_account_enabled]:
['.serialize($this->unprocessed_prefs['email']['ex_accounts'][$key]['ex_account_enabled']).']<br>');
}
+
$this->extra_accounts[$next_pos]['status'] = 'enabled';
+ }
+ else
+ {
+ // this account is
defined BUT not enabled
+ if ($this->debug_logins
> 1) { $this->dbug->out('mail_msg.begin_request('.__LINE__.'): inside loop:
account ['.$key.'] is *disabled*:
$this->unprocessed_prefs[email][ex_accounts]['.$key.'][ex_account_enabled]:
['.serialize($this->unprocessed_prefs['email']['ex_accounts'][$key]['ex_account_enabled']).']<br>');
}
+
$this->extra_accounts[$next_pos]['status'] = 'disabled';
+ }
+
+ // IF ENABLED, then
+ if
($this->extra_accounts[$next_pos]['status'] == 'enabled')
+ {
+ // PROCESS EXTRA
ACCOUNT PREFS
+ // run thru the create
prefs function requesting this particular acctnum
+ // fills in certain
missing data, and does some sanity checks, and any data processing that may be
necessary
+ $sub_tmp_prefs =
array();
+ // we "fool"
create_email_preferences into processing extra account info as if it were top
level data
+ // by specifing the
secong function arg as the integer of this particular enabled account
+ $this_ex_acctnum =
$this->extra_accounts[$next_pos]['acctnum'];
+ if ($this->debug_logins
> 1) { $this->dbug->out('mail_msg.begin_request('.__LINE__.'): CALLING
create_email_preferences("", $this_ex_acctnum) for specific account, where
$this_ex_acctnum: ['.serialize($this_ex_acctnum).'] <br>'); }
+ $sub_tmp_prefs =
$GLOBALS['phpgw']->preferences->create_email_preferences('', $this_ex_acctnum);
+ // now put these
processed prefs in the correct location in our prefs array
+
$this->set_pref_array($sub_tmp_prefs['email'], $this_ex_acctnum);
+ }
}
- else
+ // extra_and_default_acounts is the
same as above but has default account inserted at position zero
+ $this->extra_and_default_acounts =
array();
+ // first put in the default account
+
$this->extra_and_default_acounts[0]['acctnum'] = 0;
+
$this->extra_and_default_acounts[0]['status'] = 'enabled';
+ // now add whetever extra accounts we
processed above
+ $loops = count($this->extra_accounts);
+ for ($i=0; $i < $loops; $i++)
{
- // this account is defined BUT
not enabled
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: inside loop: account ['.$key.'] is
*disabled*:
$this->unprocessed_prefs[email][ex_accounts]['.$key.'][ex_account_enabled]:
['.serialize($this->unprocessed_prefs['email']['ex_accounts'][$key]['ex_account_enabled']).']<br>');
}
-
$this->extra_accounts[$next_pos]['status'] = 'disabled';
+
$this->extra_and_default_acounts[$i+1]['acctnum'] =
$this->extra_accounts[$i]['acctnum'];
+
$this->extra_and_default_acounts[$i+1]['status'] =
$this->extra_accounts[$i]['status'];
}
-
- // IF ENABLED, then
- if
($this->extra_accounts[$next_pos]['status'] == 'enabled')
- {
- // PROCESS EXTRA ACCOUNT PREFS
- // run thru the create prefs
function requesting this particular acctnum
- // fills in certain missing
data, and does some sanity checks, and any data processing that may be necessary
- $sub_tmp_prefs = array();
- // we "fool"
create_email_preferences into processing extra account info as if it were top
level data
- // by specifing the secong
function arg as the integer of this particular enabled account
- $this_ex_acctnum =
$this->extra_accounts[$next_pos]['acctnum'];
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: about to call
create_email_preferences("", $this_ex_acctnum) where $this_ex_acctnum:
['.serialize($this_ex_acctnum).'] <br>'); }
- $sub_tmp_prefs =
$GLOBALS['phpgw']->preferences->create_email_preferences('', $this_ex_acctnum);
- // now put these processed
prefs in the correct location in our prefs array
-
$this->set_pref_array($sub_tmp_prefs['email'], $this_ex_acctnum);
- }
- }
- // extra_and_default_acounts is the same as
above but has default account inserted at position zero
- $this->extra_and_default_acounts = array();
- // first put in the default account
- $this->extra_and_default_acounts[0]['acctnum']
= 0;
- $this->extra_and_default_acounts[0]['status'] =
'enabled';
- // now add whetever extra accounts we processed
above
- $loops =
count($GLOBALS['phpgw']->msg->extra_accounts);
- for ($i=0; $i < $loops; $i++)
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): $this->extra_accounts
DUMP:', $this->extra_accounts); }
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'):
$this->extra_and_default_acounts DUMP:', $this->extra_and_default_acounts); }
+ }
+ else
{
-
$this->extra_and_default_acounts[$i+1]['acctnum'] =
$this->extra_accounts[$i]['acctnum'];
-
$this->extra_and_default_acounts[$i+1]['status'] =
$this->extra_accounts[$i]['status'];
+ $this->ex_accounts_count = 0;
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'):
$this->unprocessed_prefs[email][ex_accounts] NOT set or NOT is_array,
$this->ex_accounts_count: ['.$this->ex_accounts_count.']<br>'); }
}
- if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg: begin_request: $this->extra_accounts DUMP:',
$this->extra_accounts); }
- if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg: begin_request: $this->extra_and_default_acounts
DUMP:', $this->extra_and_default_acounts); }
- }
- else
+ // if NO extra accounts axist, we STILL need to
put the default account inextra_and_default_acounts
+ // extra_and_default_acounts will not have been
handled whatsoever if no extra accounts exist
+ // so make sure the default account is there
+ if (count($this->extra_and_default_acounts) ==
0)
+ {
+ $this->extra_and_default_acounts =
array();
+ // first put in the default account
+
$this->extra_and_default_acounts[0]['acctnum'] = 0;
+
$this->extra_and_default_acounts[0]['status'] = 'enabled';
+ }
+ // -end- extra account init handling
+ }
+
+ //if ($this->debug_logins > 2) { echo
'mail_msg.begin_request('.__LINE__.'): POST create_email_preferences
GLOBALS[phpgw_info][user][preferences][email] dump:<pre>';
print_r($GLOBALS['phpgw_info']['user']['preferences']['email']) ; echo
'</pre>';}
+ //if ($this->debug_logins > 2) { echo
'mail_msg.begin_request('.__LINE__.'): POST create_email_preferences
$this->get_all_prefs() dump:<pre>'; print_r($this->get_all_prefs()) ; echo
'</pre>';}
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): POST
create_email_preferences direct access dump of $this->a DUMP:', $this->a); }
+ //if ($this->debug_logins > 2) { echo
'mail_msg.begin_request('.__LINE__.'): preferences->create_email_preferences
called, GLOBALS[phpgw_info][user][preferences] dump:<pre>';
print_r($GLOBALS['phpgw_info']['user']['preferences']) ; echo '</pre>';}
+ //if ($this->debug_logins > 2) { echo
'mail_msg.begin_request('.__LINE__.'): preferences->create_email_preferences
called, GLOBALS[phpgw_info][user] dump:<pre>';
print_r($GLOBALS['phpgw_info']['user']) ; echo '</pre>';}
+ //if ($this->debug_logins > 2) { echo
'mail_msg.begin_request('.__LINE__.'): preferences->create_email_preferences
called, GLOBALS[phpgw_info] dump:<pre>'; print_r($GLOBALS['phpgw_info']) ; echo
'</pre>';}
+ //if ($this->debug_logins > 2) { echo
'mail_msg.begin_request('.__LINE__.'): preferences->create_email_preferences
called, GLOBALS[phpgw] dump:<pre>'; print_r($GLOBALS['phpgw']) ; echo '</pre>';}
+
+ // ---- CACHE THE COMPLETED PREF DATA
+ if (($this->use_cached_prefs == True)
+ && (!$cached_prefs))
{
- $this->ex_accounts_count = 0;
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request:
$this->unprocessed_prefs[email][ex_accounts] NOT set or NOT is_array,
$this->ex_accounts_count: ['.$this->ex_accounts_count.']<br>'); }
- }
- // if NO extra accounts axist, we STILL need to put the
default account inextra_and_default_acounts
- // extra_and_default_acounts will not have been handled
whatsoever if no extra accounts exist
- // so make sure the default account is there
- if (count($this->extra_and_default_acounts) == 0)
- {
- $this->extra_and_default_acounts = array();
- // first put in the default account
- $this->extra_and_default_acounts[0]['acctnum']
= 0;
- $this->extra_and_default_acounts[0]['status'] =
'enabled';
+ // for whever reason we did not get any data
from the stored prefs
+ /*
+ // data we need to DB save to cache final
processed prefs
+ $this->unprocessed_prefs
+ $this->raw_filters
+ $this->ex_accounts_count
+ $this->extra_accounts
+ $this->extra_and_default_acounts
+ $this->a[X]->['prefs']
+ // where X is the account number, we can use
"set_pref_array(array_data, acctnum) for each account
+ */
+ // ok lets make an array to hold this data in
the DB
+ $cached_prefs = array();
+ $cached_prefs['unprocessed_prefs'] = array();
+ $cached_prefs['raw_filters'] = array();
+ $cached_prefs['ex_accounts_count'] = '0';
+ $cached_prefs['extra_accounts'] = array();
+ $cached_prefs['extra_and_default_acounts'] =
array();
+ $cached_prefs['a'] = array();
+ // lets fill the data
+ $cached_prefs['unprocessed_prefs'] =
$this->unprocessed_prefs;
+ $cached_prefs['raw_filters'] =
$this->raw_filters;
+ // defang the filters
+ // NO remember bofilters defangs, htmlquotes
encodes, the filters FOR US
+ // they are stored in the preferences DB
already in defanged state
+ // we never need to degang or UN-defang filters
+ // because bofilters handles ALL that for us
+ //for ($x=0; $x <
count($cached_prefs['raw_filters']); $x++)
+ //{
+ //
$cached_prefs['raw_filters'][$x]['filtername'] =
$this->db_defang_encode($cached_prefs['raw_filters'][$x]['filtername']);
+ //
$cached_prefs['raw_filters'][$x]['source_accounts']['folder'] =
$this->db_defang_encode($cached_prefs['raw_filters'][$x]['source_accounts']['folder']);
+ // for ($y=0; $y <
count($cached_prefs['raw_filters']['matches']); $y++)
+ // {
+ //
$cached_prefs['raw_filters'][$x]['matches'][$y]['matchthis']
+ // =
$this->db_defang_encode($cached_prefs['raw_filters'][$x]['matches'][$y]['matchthis']);
+ // }
+ // for ($y=0; $y <
count($cached_prefs['raw_filters']['actions']); $y++)
+ // {
+ //
$cached_prefs['raw_filters'][$x]['actions'][$y]['folder']
+ // =
$this->db_defang_encode($cached_prefs['raw_filters'][$x]['actions'][$y]['folder']);
+ // }
+ //}
+ $cached_prefs['ex_accounts_count'] =
$this->ex_accounts_count;
+ $cached_prefs['extra_accounts'] =
$this->extra_accounts;
+ $cached_prefs['extra_and_default_acounts'] =
$this->extra_and_default_acounts;
+ $cached_prefs['a'] = array();
+ $defang_these = array();
+ $defang_these[0] = 'passwd';
+ $defang_these[1] = 'email_sig';
+ $defang_these[2] = 'trash_folder_name';
+ $defang_these[3] = 'sent_folder_name';
+ $defang_these[4] = 'userid';
+ $defang_these[5] = 'address';
+ $defang_these[6] = 'mail_folder';
+ $defang_these[7] = 'fullname';
+ $defang_these[8] = 'account_name';
+ $loops =
count($this->extra_and_default_acounts);
+ for ($i=0; $i < $loops; $i++)
+ {
+ $cached_prefs['a'][$i] = array();
+ $cached_prefs['a'][$i]['prefs'] =
array();
+ $cached_prefs['a'][$i]['prefs'] =
$this->a[$i]['prefs'];
+ // defang
+ for ($x=0; $x < count($defang_these);
$x++)
+ {
+ $defang_word = $defang_these[$x];
+ if
(isset($cached_prefs['a'][$i]['prefs'][$defang_word]))
+ {
+
$cached_prefs['a'][$i]['prefs'][$defang_word] =
$this->db_defang_encode($cached_prefs['a'][$i]['prefs'][$defang_word]);
+ }
+ }
+ }
+ // just use account 0 for this eventhough the
prefs are for every account
+ $my_location = '0;cached_prefs';
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): POST
create_email_preferences we made the $cached_prefs for storage DUMP:',
$cached_prefs); }
+ $this->so->so_appsession_passthru($my_location,
$cached_prefs);
}
- // -end- extra account init handling
-
- //if ($this->debug_logins > 2) { echo 'mail_msg:
begin_request: POST create_email_preferences
GLOBALS[phpgw_info][user][preferences][email] dump:<pre>';
print_r($GLOBALS['phpgw_info']['user']['preferences']['email']) ; echo
'</pre>';}
- //if ($this->debug_logins > 2) { echo 'mail_msg:
begin_request: POST create_email_preferences $this->get_all_prefs()
dump:<pre>'; print_r($this->get_all_prefs()) ; echo '</pre>';}
- if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg: begin_request: POST create_email_preferences direct
access dump of $this->a DUMP:', $this->a); }
- //if ($this->debug_logins > 2) { echo 'mail_msg:
begin_request: preferences->create_email_preferences called,
GLOBALS[phpgw_info][user][preferences] dump:<pre>';
print_r($GLOBALS['phpgw_info']['user']['preferences']) ; echo '</pre>';}
- //if ($this->debug_logins > 2) { echo 'mail_msg:
begin_request: preferences->create_email_preferences called,
GLOBALS[phpgw_info][user] dump:<pre>'; print_r($GLOBALS['phpgw_info']['user'])
; echo '</pre>';}
- //if ($this->debug_logins > 2) { echo 'mail_msg:
begin_request: preferences->create_email_preferences called,
GLOBALS[phpgw_info] dump:<pre>'; print_r($GLOBALS['phpgw_info']) ; echo
'</pre>';}
- //if ($this->debug_logins > 2) { echo 'mail_msg:
begin_request: preferences->create_email_preferences called, GLOBALS[phpgw]
dump:<pre>'; print_r($GLOBALS['phpgw']) ; echo '</pre>';}
// ---- SET important class vars ----
$this->att_files_dir =
$GLOBALS['phpgw_info']['server']['temp_dir'].SEP.$GLOBALS['phpgw_info']['user']['sessionid'];
// and.or get some vars we will use later in this
function
$mailsvr_callstr =
$this->get_arg_value('mailsvr_callstr');
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: $mailsvr_callstr
'.$mailsvr_callstr.'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): $mailsvr_callstr
'.$mailsvr_callstr.'<br>'); }
// set class var "$this->cache_mailsvr_data" based on
prefs info
// FIXME: why have this in 2 places, just keep it in
prefs (todo)
@@ -1032,32 +1305,32 @@
if ((isset($this->cache_mailsvr_data_disabled))
&& ($this->cache_mailsvr_data_disabled == True))
{
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: OLD DEFUNCT OPTION folder cache
DISABLED, $this->cache_mailsvr_data_disabled =
'.serialize($this->cache_mailsvr_data_disabled).'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): OLD DEFUNCT OPTION
folder cache DISABLED, $this->cache_mailsvr_data_disabled =
'.serialize($this->cache_mailsvr_data_disabled).'<br>'); }
$this->cache_mailsvr_data = False;
}
elseif (($this->get_isset_pref('cache_data'))
&& ($this->get_pref_value('cache_data') != ''))
{
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: OLD DEFUNCT OPTION folder cache is
enabled in user prefs'.'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): OLD DEFUNCT OPTION
folder cache is enabled in user prefs'.'<br>'); }
$this->cache_mailsvr_data = True;
}
else
{
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: OLD DEFUNCT OPTION folder cache is
NOT enabled in user prefs'.'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): OLD DEFUNCT OPTION
folder cache is NOT enabled in user prefs'.'<br>'); }
$this->cache_mailsvr_data = False;
}
// ---- Should We Login -----
if (!isset($args_array['do_login']))
{
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: $args_array[do_login] was NOT set,
so we set it to default value "FALSE"'.'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): $args_array[do_login]
was NOT set, so we set it to default value "FALSE"'.'<br>'); }
$args_array['do_login'] = False;
}
// ---- newer 3 way do_login_ex value from the
bootstrap class
if ( (!defined(BS_LOGIN_NOT_SPECIFIED))
|| (!isset($args_array['do_login_ex'])) )
{
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: $args_array[do_login_ex] not set,
getting default from a temp local bootstrap object'.'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'):
$args_array[do_login_ex] not set, getting default from a temp local bootstrap
object'.'<br>'); }
// that means somewhere the bootstrap class has
been run
$local_bootstrap =
CreateObject('email.msg_bootstrap');
$local_bootstrap->set_do_login($args_array['do_login'], 'begin_request');
@@ -1065,7 +1338,7 @@
$local_bootstrap = '';
unset($local_bootstrap);
}
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: $args_array[] DUMP
['.serialize($args_array).']'.'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): $args_array[] DUMP
['.serialize($args_array).']'.'<br>'); }
/*
// ---- Are We In Newsmode Or Not -----
@@ -1120,30 +1393,52 @@
{
// IF we already have a cached_folder_list, we
DO NOT NEED to immediately log in
// if and when a login is required, calls to
"ensure_stream_and_folder" will take care of that login
- $appsession_cached_folder_list =
$this->read_session_cache_item('folder_list', $acctnum);
- if ($this->debug_logins > 1) {
$this->dbug->out('begin_request: LINE '.__LINE__.' check for
$appsession_cached_folder_list DUMP:', $appsession_cached_folder_list); }
- if ($appsession_cached_folder_list)
+ // actually, we could even test the L1 class
cashed folder_list first, that is a sure sign we have the data
+ // note _direct_access_arg_value returns NULL
(nothing) if that arg is not set
+ $L1_cached_folder_list =
$this->_direct_access_arg_value('folder_list', $acctnum);
+ if ($this->debug_logins > 1) {
$this->dbug->out('begin_request: LINE '.__LINE__.' check for
$L1_cached_folder_list DUMP:', $L1_cached_folder_list); }
+ if ((isset($L1_cached_folder_list) == False)
+ || (!$L1_cached_folder_list))
+ {
+ $appsession_cached_folder_list =
$this->read_session_cache_item('folder_list', $acctnum);
+ if ($this->debug_logins > 1) {
$this->dbug->out('begin_request: LINE '.__LINE__.' check for
$appsession_cached_folder_list DUMP:', $appsession_cached_folder_list); }
+ // while we are here, if we got a
folder list now put it in L1 cache so no more aueries to the DB
+ // but only if it a new style, full
folder_list including the folder_short elements
+ if
(isset($appsession_cached_folder_list[0]['folder_short']))
+ {
+ // cache the result in "Level 1
cache" class object var
+ if (($this->debug_logins > 1)
|| ($this->debug_args_special_handlers > 1)) { $this->dbug->out('begin_request:
LINE '.__LINE__.' while we are here, put folder_list into Level 1 class var
"cache" so no more queries to DB for this<br>'); }
+
$this->set_arg_value('folder_list', $appsession_cached_folder_list, $acctnum);
+ }
+ }
+ else
+ {
+ // we have L1 data, no need to query
the database
+ $appsession_cached_folder_list =
$L1_cached_folder_list;
+ }
+ if (($L1_cached_folder_list)
+ || ($appsession_cached_folder_list))
{
// in this case, extreme caching is in
use, AND we already have cached data, so NO NEED TO LOGIN
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: session extreme caching IS in use,
AND we have a cached "folder_list", which means should also have all necessary
cached data, so NO LOGIN NEEDED<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): session extreme caching
IS in use, AND we have a cached "folder_list", which means should also have all
necessary cached data, so NO LOGIN NEEDED<br>'); }
$decision_to_login = False;
// get a few more things that we would
otherwise get during the login code (which we'll be skiping)
$processed_folder_arg =
$this->get_best_folder_arg($args_array, $got_args, $acctnum);
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: session extreme caching IS in use,
Login may NOT occur, so about to issue: $this->set_arg_value("folder",
'.$processed_folder_arg.', '.serialize($acctnum).')<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): session extreme caching
IS in use, Login may NOT occur, so about to issue:
$this->set_arg_value("folder", '.$processed_folder_arg.',
'.serialize($acctnum).')<br>'); }
$this->set_arg_value('folder',
$processed_folder_arg, $acctnum);
if ( $this->get_isset_pref('userid')
&& ($this->get_pref_value('userid') !=
''))
{
$user =
$this->get_pref_value('userid');
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: session extreme caching IS in use,
Login may NOT occur, so about to issue:
$this->set_arg_value("mailsvr_account_username", '.$user.',
'.serialize($acctnum).')<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): session extreme caching
IS in use, Login may NOT occur, so about to issue:
$this->set_arg_value("mailsvr_account_username", '.$user.',
'.serialize($acctnum).')<br>'); }
$this->set_arg_value('mailsvr_account_username', $user, $acctnum);
}
}
else
{
// in this case, extreme caching is in
use, HOWEVER we do not have necessary cached data, so WE NEED A LOGIN
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: session extreme caching IS in use,
but we do NOT have a cached "folder_list", meaning we probably do NOT have any
cached data, so we NEED A LOGIN, allow it if requested<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): session extreme caching
IS in use, but we do NOT have a cached "folder_list", meaning we probably do
NOT have any cached data, so we NEED A LOGIN, allow it if requested<br>'); }
$decision_to_login = True;
}
}
@@ -1154,13 +1449,13 @@
// get a few more things that we would
otherwise get during the login code (which we'll be skiping)
$processed_folder_arg =
$this->get_best_folder_arg($args_array, $got_args, $acctnum);
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request ('.__LINE__.'): we are NOT allowed to
log in (see code this line) but we still need to get this info, so about to
issue: $this->set_arg_value("folder", '.$processed_folder_arg.',
'.serialize($acctnum).')<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): we are NOT allowed to
log in (see code this line) but we still need to get this info, so about to
issue: $this->set_arg_value("folder", '.$processed_folder_arg.',
'.serialize($acctnum).')<br>'); }
$this->set_arg_value('folder',
$processed_folder_arg, $acctnum);
if ( $this->get_isset_pref('userid')
&& ($this->get_pref_value('userid') != ''))
{
$user = $this->get_pref_value('userid');
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request ('.__LINE__.'): we are NOT allowed to
log in (see code this line) but we still need to get this info, so about to
issue: $this->set_arg_value("mailsvr_account_username", '.$user.',
'.serialize($acctnum).')<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): we are NOT allowed to
log in (see code this line) but we still need to get this info, so about to
issue: $this->set_arg_value("mailsvr_account_username", '.$user.',
'.serialize($acctnum).')<br>'); }
$this->set_arg_value('mailsvr_account_username', $user, $acctnum);
}
}
@@ -1192,40 +1487,40 @@
{
// extreme caching and logins handled above in
the first if .. then
// if we are here, generally we are allowed to
login
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: session extreme caching is NOT in
use, any begin_request logins ARE allowed <br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): session extreme caching
is NOT in use, any begin_request logins ARE allowed <br>'); }
$decision_to_login = True;
}
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: <u>maybe about to enter login
sequence</u>, $args_array[]: ['.serialize($args_array).'] ; $decision_to_login
['.serialize($decision_to_login).'] <br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): <u>maybe about to enter
login sequence</u>, $args_array[]: ['.serialize($args_array).'] ;
$decision_to_login ['.serialize($decision_to_login).'] <br>'); }
// now actually use that test result
if ($decision_to_login == True)
{
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: entered and starting login sequence
<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): entered and starting
login sequence <br>'); }
// ---- Get Email Password
if ($this->get_isset_pref('passwd') == False)
{
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request:
this->a[$this->acctnum][prefs][passwd] NOT set, fallback to
$GLOBALS[phpgw_info][user][passwd]'.'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'):
this->a[$this->acctnum][prefs][passwd] NOT set, fallback to
$GLOBALS[phpgw_info][user][passwd]'.'<br>'); }
// DO NOT alter the password and put
that altered password BACK into the preferences array
// why not? used to have a reason, but
that was obviated, no reason at the moment
//$this->set_pref_value('passwd',$GLOBALS['phpgw_info']['user']['passwd']);
//$this->a[$this->acctnum]['prefs']['passwd'] =
$GLOBALS['phpgw_info']['user']['passwd'];
$pass =
$GLOBALS['phpgw_info']['user']['passwd'];
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: pass grabbed from
GLOBALS[phpgw_info][user][passwd] =
'.htmlspecialchars(serialize($pass)).'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): pass grabbed from
GLOBALS[phpgw_info][user][passwd] =
'.htmlspecialchars(serialize($pass)).'<br>'); }
}
else
{
// DO NOT alter the password and do NOT
put that altered password BACK into the preferences array
// keep the one in GLOBALS in encrypted
form if possible ????
$pass = $this->get_pref_value('passwd');
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: pass from prefs: already defanged
for us, but still encrypted <pre>'.$pass.'</pre><br>'."\r\n"); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): pass from prefs:
already defanged for us, but still encrypted <pre>'.$pass.'</pre><br>'."\r\n");
}
// IMPORTANT: (this note on "defanging"
still valid as of Jan 24, 2002
// the last thing you do before saving
to the DB is "de-fang"
// so the FIRST thing class prefs does
when reading from the db MUST be to "UN-defang", and that IS what happens there
// so by now phpgwapi/class.preferences
has ALREADY done the "de-fanging"
$pass =
$this->decrypt_email_passwd($pass);
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: pass from prefs: decrypted:
<pre>'.$pass.'</pre><br>'."\r\n"); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): pass from prefs:
decrypted: <pre>'.$pass.'</pre><br>'."\r\n"); }
}
// ---- ISSET CHECK for userid and passwd to
avoid garbage logins ----
if ( $this->get_isset_pref('userid')
@@ -1240,13 +1535,13 @@
// FIXME make this use an official
error function
// problem - invalid or nonexistant
info for userid and/or passwd
//if ($this->debug_logins > 0) {
- echo 'mail_msg: begin_request:
ERROR: userid or passwd empty'."<br>\r\n"
+ echo
'mail_msg.begin_request('.__LINE__.'): ERROR: userid or passwd empty'."<br>\r\n"
.' * *
$this->get_pref_value(userid) = '
.$this->get_pref_value('userid')."<br>\r\n"
.' * * if the userid is
filled, then it must be the password that is missing'."<br>\r\n"
.' * * tell your admin
if a) you have a custom email password or not when reporting this
error'."<br>\r\n";
//}
- if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg: begin_request: LEAVING with ERROR: userid or passwd
empty<br>'); }
+ if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): LEAVING with ERROR:
userid or passwd empty<br>'); }
return False;
}
@@ -1264,7 +1559,7 @@
$this_server_type =
$this->get_pref_value('mail_server_type');
// ok, now put that object into the array
//$this_acctnum = $this->get_acctnum();
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: creating new dcom_holder at
$GLOBALS[phpgw_dcom_'.$acctnum.'] = new mail_dcom_holder'.'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): creating new
dcom_holder at $GLOBALS[phpgw_dcom_'.$acctnum.'] = new
mail_dcom_holder'.'<br>'); }
$GLOBALS['phpgw_dcom_'.$acctnum] = new
mail_dcom_holder;
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom =
CreateObject("email.mail_dcom", $this_server_type);
// initialize the dcom class variables
@@ -1286,12 +1581,13 @@
//@set_time_limit(60);
// login to INBOX because we know that
always(?) should exist on an imap server and pop server
// after we are logged in we can get additional
info that will lead us to the desired folder (if not INBOX)
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: about to call dcom->open:
$GLOBALS["phpgw_dcom_".$acctnum('.$acctnum.')]->dcom->open('.$mailsvr_callstr."INBOX".',
'.$user.', '.$pass.', )'.'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): about to call
dcom->open:
$GLOBALS["phpgw_dcom_".$acctnum('.$acctnum.')]->dcom->open('.$mailsvr_callstr."INBOX".',
'.$user.', '.$pass.', )'.'<br>'); }
+ if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): <font color="red">MAIL
SERVER COMMAND</font>'.'<br>'); }
$mailsvr_stream =
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->open($mailsvr_callstr."INBOX", $user,
$pass, '');
$pass = '';
//@set_time_limit(0);
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: open returns $mailsvr_stream =
['.serialize($mailsvr_stream).']<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): open returns
$mailsvr_stream = ['.serialize($mailsvr_stream).']<br>'); }
// Logged In Success or Faliure check
if ( (!isset($mailsvr_stream))
@@ -1299,7 +1595,7 @@
{
// set the "mailsvr_stream" to blank so
all will know the login failed
$this->set_arg_value('mailsvr_stream',
'');
- if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg: begin_request: LEAVING with ERROR: failed to open
mailsvr_stream : '.$mailsvr_stream.'<br>'); }
+ if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): LEAVING with ERROR:
failed to open mailsvr_stream : '.$mailsvr_stream.'<br>'); }
// we return false, but SHOULD WE ERROR
EXIT HERE?
return False;
}
@@ -1312,47 +1608,48 @@
// ---- Get additional Data now that we are
logged in to the mail server ----
// namespace is often obtained by directly
querying the mailsvr
$mailsvr_namespace =
$this->get_arg_value('mailsvr_namespace');
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: $mailsvr_namespace:
'.serialize($mailsvr_namespace).'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): $mailsvr_namespace:
'.serialize($mailsvr_namespace).'<br>'); }
$mailsvr_delimiter =
$this->get_arg_value('mailsvr_delimiter');
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: $mailsvr_delimiter:
'.serialize($mailsvr_delimiter).'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): $mailsvr_delimiter:
'.serialize($mailsvr_delimiter).'<br>'); }
// FIND FOLDER VALUE
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: <b> *** FIND FOLDER VALUE ***
</b><br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): <b> *** FIND FOLDER
VALUE *** </b><br>'); }
// get best available, most legit, folder value
that we can find, and prep it in
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: about to call:
"get_best_folder_arg($args_array, $got_args, $acctnum(='.$acctnum.'))"<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): about to call:
"get_best_folder_arg($args_array, $got_args, $acctnum(='.$acctnum.'))"<br>'); }
$processed_folder_arg =
$this->get_best_folder_arg($args_array, $got_args, $acctnum);
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: "get_best_folder_arg" returns
$processed_folder_arg
['.htmlspecialchars(serialize($processed_folder_arg)).']<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): "get_best_folder_arg"
returns $processed_folder_arg
['.htmlspecialchars(serialize($processed_folder_arg)).']<br>'); }
// ---- Switch To Desired Folder If Necessary
----
if ($processed_folder_arg == 'INBOX')
{
// NO need to switch to another folder
// put this $processed_folder_arg in
arg "folder", replacing any unprocessed value that may have been there
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: NO need to switch folders, about to
issue: $this->set_arg_value("folder", '.$processed_folder_arg.',
'.serialize($acctnum).')<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): NO need to switch
folders, about to issue: $this->set_arg_value("folder",
'.$processed_folder_arg.', '.serialize($acctnum).')<br>'); }
$this->set_arg_value('folder',
$processed_folder_arg, $acctnum);
}
else
{
// switch to the desired folder now
that we are sure we have it's official name
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: need to switch folders (reopen) from
INBOX to $processed_folder_arg: '.$processed_folder_arg.'<br>'); }
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: about to issue:
$GLOBALS[phpgw_dcom_'.$acctnum.']->dcom->reopen('.$mailsvr_stream.',
'.$mailsvr_callstr.$processed_folder_arg,', )'.'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): need to switch folders
(reopen) from INBOX to $processed_folder_arg: '.$processed_folder_arg.'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): about to issue:
$GLOBALS[phpgw_dcom_'.$acctnum.']->dcom->reopen('.$mailsvr_stream.',
'.$mailsvr_callstr.$processed_folder_arg,', )'.'<br>'); }
//$did_reopen =
$tmp_a['dcom']->reopen($mailsvr_stream, $mailsvr_callstr.$processed_folder_arg,
'');
+ if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg: begin_request('.__LINE__.'): <font color="red">MAIL
SERVER COMMAND</font>'.'<br>'); }
$did_reopen =
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->reopen($mailsvr_stream,
$mailsvr_callstr.$processed_folder_arg, '');
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: reopen returns:
'.serialize($did_reopen).'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): reopen returns:
'.serialize($did_reopen).'<br>'); }
// error check
if ($did_reopen == False)
{
- if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg: begin_request: LEAVING with re-open ERROR, closing
stream, FAILED to reopen (change folders) $mailsvr_stream ['.$mailsvr_stream.']
INBOX to ['.$mailsvr_callstr.$processed_folder_arg.'<br>'); }
+ if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): LEAVING with re-open
ERROR, closing stream, FAILED to reopen (change folders) $mailsvr_stream
['.$mailsvr_stream.'] INBOX to
['.$mailsvr_callstr.$processed_folder_arg.'<br>'); }
// log out since we could not
reopen, something must have gone wrong
$this->end_request();
return False;
}
else
{
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: Successful switch folders (reopen)
from (default initial folder) INBOX to ['.$processed_folder_arg.']<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): Successful switch
folders (reopen) from (default initial folder) INBOX to
['.$processed_folder_arg.']<br>'); }
// put this
$processed_folder_arg in arg "folder", since we were able to successfully
switch folders
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: switched folders (via reopen), about
to issue: $this->set_arg_value("folder", '.$processed_folder_arg.',
$acctnum(='.$acctnum.'))<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): switched folders (via
reopen), about to issue: $this->set_arg_value("folder",
'.$processed_folder_arg.', $acctnum(='.$acctnum.'))<br>'); }
$this->set_arg_value('folder',
$processed_folder_arg, $acctnum);
}
}
@@ -1365,11 +1662,11 @@
.'&fldball[acctnum]='.$this->get_acctnum()
.'&sort='.$this->get_arg_value('sort')
.'&order='.$this->get_arg_value('order');
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: about to call
$this->set_arg_value(index_refresh_uri, $this_index_refresh_uri,
$acctnum(='.$acctnum.')); ; where $this_index_refresh_uri:
'.htmlspecialchars($this_index_refresh_uri).'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): about to call
$this->set_arg_value(index_refresh_uri, $this_index_refresh_uri,
$acctnum(='.$acctnum.')); ; where $this_index_refresh_uri:
'.htmlspecialchars($this_index_refresh_uri).'<br>'); }
$this->set_arg_value('index_refresh_uri',
$this_index_refresh_uri, $acctnum);
- if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg: begin_request: about to leave, direct access dump
of $this->a DUMP:', $this->a); }
- if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg: begin_request: LEAVING, success'.'<br>'); }
+ if ($this->debug_logins > 2) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): about to leave, direct
access dump of $this->a DUMP:', $this->a); }
+ if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): LEAVING,
success'.'<br>'); }
// returning this is vestigal, not really
necessary, but do it anyway
// it's importance is that it returns something
other then "False" on success
return $this->get_arg_value('mailsvr_stream',
$acctnum);
@@ -1385,7 +1682,7 @@
.'&fldball[acctnum]='.$this->get_acctnum()
.'&sort='.$this->get_arg_value('sort')
.'&order='.$this->get_arg_value('order');
- if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request: about to call
$this->set_arg_value(index_refresh_uri, $this_index_refresh_uri,
$acctnum(='.$acctnum.')); ; where $this_index_refresh_uri:
'.htmlspecialchars($this_index_refresh_uri).'<br>'); }
+ if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg.begin_request('.__LINE__.'): about to call
$this->set_arg_value(index_refresh_uri, $this_index_refresh_uri,
$acctnum(='.$acctnum.')); ; where $this_index_refresh_uri:
'.htmlspecialchars($this_index_refresh_uri).'<br>'); }
$this->set_arg_value('index_refresh_uri',
$this_index_refresh_uri, $acctnum);
//if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: begin_request ('.__LINE__.'): LEAVING, we were NOT
allowed to, $args_array[do_login]: ['.serialize($args_array['do_login']).'] if
TRUE, then we must return *something* so calling function does NOT think error,
so return $args_array[do_login] <br>'); }
@@ -1460,7 +1757,8 @@
$mailsvr_stream =
$this->get_arg_value('mailsvr_stream', $this_acctnum);
if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg: end_request: stream exists, for $this_acctnum
['.$this_acctnum.'] , $mailsvr_stream : ['.$mailsvr_stream.'] ; logging
out'.'<br>'); }
// SLEEP seems to give the server time
to send its OK response, used tcpdump to confirm this
- sleep(1);
+ //sleep(1);
+ if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg: end_request('.__LINE__.'): <font color="red">MAIL
SERVER COMMAND</font>'.'<br>'); }
$GLOBALS['phpgw_dcom_'.$this_acctnum]->dcom->close($mailsvr_stream);
// sleep here does not have any effect
//sleep(1);
@@ -1605,6 +1903,7 @@
// log in to INBOX because we know INBOX should
exist on every mail server, "reopen" to desired folder (if different) later
//@set_time_limit(60);
if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: ensure_stream_and_folder: about to call dcom->open:
$GLOBALS[phpgw_dcom_'.$acctnum.']->dcom->open('.$mailsvr_callstr."INBOX".',
'.$user.', '.$pass.', )'.'<br>'); }
+ if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg: ensure_stream_and_folder('.__LINE__.'): <font
color="red">MAIL SERVER COMMAND</font>'.'<br>'); }
$mailsvr_stream =
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->open($mailsvr_callstr."INBOX", $user,
$pass, '');
$pass = '';
//@set_time_limit(0);
@@ -1752,6 +2051,7 @@
{
if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: ensure_stream_and_folder('.__LINE__.'): need to
switch folders (reopen) from $preped_current_folder_arg
['.$preped_current_folder_arg.'] to $preped_folder: '.$preped_folder.'<br>'); }
if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: ensure_stream_and_folder('.__LINE__.'): about to
issue: $GLOBALS[phpgw_dcom_'.$acctnum.']->dcom->reopen('.$mailsvr_stream.',
'.$mailsvr_callstr.$preped_folder,', )'.'<br>'); }
+ if ($this->debug_logins > 0) {
$this->dbug->out('mail_msg: ensure_stream_and_folder('.__LINE__.'): <font
color="red">MAIL SERVER COMMAND</font>'.'<br>'); }
$did_reopen =
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->reopen($mailsvr_stream,
$mailsvr_callstr.$preped_folder, '');
if ($this->debug_logins > 1) {
$this->dbug->out('mail_msg: ensure_stream_and_folder('.__LINE__.'): reopen
returns: '.serialize($did_reopen).'<br>'); }
if ($did_reopen == False)
@@ -2161,7 +2461,8 @@
$feed_folder = $this->get_arg_value('folder');
}
//echo 'prep_folder_out: param $feed_folder
['.$feed_folder.'], :: ';
- $preped_folder =
$GLOBALS['phpgw']->msg->ensure_one_urlencoding($feed_folder);
+ $preped_folder =
$this->ensure_one_urlencoding($feed_folder);
+ $preped_folder = str_replace('&', '%26',
$preped_folder);
//echo ' $preped_folder ['.$preped_folder.']<br>';
return $preped_folder;
}
@@ -2785,9 +3086,38 @@
}
/*!
+ @function folder_list_change_callback
+ @abstract dcom class callback to alert when dcom class has made
a change to the folder list
+ @param $acctnum OPTIONAL
+ discussion CACHE NOTE: this item is saved in the appsession
cache, the folder_list, so altering
+ that list requires wiping that saved info because it has become
stale.
+ @author Angles
+ */
+ function folder_list_change_callback($acctnum='')
+ {
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg: folder_list_change_callback('.__LINE__.'):
ENTERING, param $acctnum ['.$acctnum.']<br>'); }
+ // what acctnum is operative here, we can only get a
folder list for one account at a time (obviously)
+ if ((!isset($acctnum))
+ || ((string)$acctnum == ''))
+ {
+ $acctnum = $this->get_acctnum();
+ }
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg: folder_list_change_callback('.__LINE__.'): willo
use $acctnum ['.$acctnum.']<br>'); }
+ // class dcom recorded a change in the folder list
+ // supposed to happen when create or delete or rename
mailbox is called
+ // dcom class will callback to this function to handle
cleanup of stale folder_list data
+ // expire cached data
+ if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg: folder_list_change_callback('.__LINE__.'): calling
$this->expire_session_cache_item(folder_list, '.$acctnum.') <br>'); }
+ $sucess =
$this->expire_session_cache_item('folder_list', $acctnum);
+
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg: folder_list_change_callback('.__LINE__.'): LEAVING,
returning $sucess ['.$sucess.']<br>'); }
+ return $sucess;
+ }
+
+ /*!
@function get_folder_list
@abstract list of folders in a numbered array, each element
has 2 properties, "folder_long" and "folder_short"
- @param $mailsvr_stream DEPRECIATED - do not use
+ @param $acctnum (int) OPTIONAL
@param $force_refresh boolean, will cause any cached folder
data to expire, and "fresh" data is retrieved from the mailserver
@return array numbered, with each numbered element having
array keys "folder_long" and "folder_short"
@discussion returns a numbered array, each element has 2
properties, "folder_long" and "folder_short"
@@ -2804,13 +3134,13 @@
*/
function get_folder_list($acctnum='', $force_refresh=False)
{
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg: get_folder_list: ENTERING<br>'); }
// what acctnum is operative here, we can only get a
folder list for one account at a time (obviously)
if ((!isset($acctnum))
|| ((string)$acctnum == ''))
{
$acctnum = $this->get_acctnum();
}
- if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg: get_folder_list: ENTERING<br>'); }
if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg: get_folder_list: for the rest of this function we
will use $acctnum: ['.$acctnum.'] <br>'); }
// hardcore debug
if (stristr($this->skip_args_special_handlers,
'get_folder_list'))
@@ -2828,6 +3158,7 @@
// check if class dcom reports that the folder list has
changed
// is this accounts dcom object has not been created
yet, then obviously we did not just change its folder list
+ // NOTE THIS IS OBSOLETED - THE DCOM CLASS NOW USES
CALLBACK FUNCTION "folder_list_change_callback"
if ((is_object($GLOBALS['phpgw_dcom_'.$acctnum]->dcom))
&&
($GLOBALS['phpgw_dcom_'.$acctnum]->dcom->folder_list_changed == True))
{
@@ -2896,21 +3227,31 @@
{
//if
($this->debug_args_special_handlers > 1) { echo 'mail_msg: get_folder_list:
using *Prefs DB* cached folder list data<br>';}
if ($this->debug_args_special_handlers
> 1) { $this->dbug->out('mail_msg: get_folder_list: using appsession cached
folder list data<br>'); }
- // cached folder list does NOT contain
"folder_short" data
- // that cuts cached data in 1/2, no
need to cache something this easy to deduce
- // therefor... add FOLDER SHORT element
to cached_data array structure
- if ($this->debug_args_special_handlers
> 1) { $this->dbug->out('mail_msg: get_folder_list: (L1) adding [folder_short]
element to $cached_data array<br>'); }
- for ($i=0; $i<count($cached_data);$i++)
- {
- $my_folder_long =
$cached_data[$i]['folder_long'];
- $my_folder_acctnum =
$cached_data[$i]['acctnum'];
- $my_folder_short =
$this->get_folder_short($my_folder_long, $my_folder_acctnum);
- if
($this->debug_args_special_handlers > 1) { $this->dbug->out('* * mail_msg:
get_folder_list: add folder_short loop (L1) ['.$i.']: $my_folder_long
['.$my_folder_long.'] ; $my_folder_acctnum ['.$my_folder_acctnum.'] ;
$my_folder_short ['.$my_folder_short.']<br>'); }
-
$cached_data[$i]['folder_short'] = $my_folder_short;
-
//$cached_data[$i]['folder_short'] =
$this->get_folder_short($cached_data[$i]['folder_long']);
- if
($this->debug_args_special_handlers > 2) { $this->dbug->out(' * *
$cached_data['.$i.'][folder_long]='.htmlspecialchars($cached_data[$i]['folder_long']).'
;
$cached_data['.$i.'][folder_short]='.htmlspecialchars($cached_data[$i]['folder_short']).'<br>');
}
+ if
(!isset($cached_data[0]['folder_short']))
+ {
+ // OLD cached folder list does
NOT contain "folder_short" data
+ // that cuts cached data in
1/2, no need to cache something this easy to deduce
+ // therefor... add FOLDER SHORT
element to cached_data array structure
+ if
($this->debug_args_special_handlers > 1) { $this->dbug->out('mail_msg:
get_folder_list: (L1) adding [folder_short] element to $cached_data
array<br>'); }
+ for ($i=0;
$i<count($cached_data);$i++)
+ {
+ $my_folder_long =
$cached_data[$i]['folder_long'];
+ $my_folder_acctnum =
$cached_data[$i]['acctnum'];
+ $my_folder_short =
$this->get_folder_short($my_folder_long, $my_folder_acctnum);
+ if
($this->debug_args_special_handlers > 1) { $this->dbug->out('* * mail_msg:
get_folder_list: add folder_short loop (L1) ['.$i.']: $my_folder_long
['.$my_folder_long.'] ; $my_folder_acctnum ['.$my_folder_acctnum.'] ;
$my_folder_short ['.$my_folder_short.']<br>'); }
+
$cached_data[$i]['folder_short'] = $my_folder_short;
+
//$cached_data[$i]['folder_short'] =
$this->get_folder_short($cached_data[$i]['folder_long']);
+ if
($this->debug_args_special_handlers > 2) { $this->dbug->out(' * *
$cached_data['.$i.'][folder_long]='.htmlspecialchars($cached_data[$i]['folder_long']).'
;
$cached_data['.$i.'][folder_short]='.htmlspecialchars($cached_data[$i]['folder_short']).'<br>');
}
+ }
+ if
($this->debug_args_special_handlers > 2) { $this->dbug->out('mail_msg:
get_folder_list: $cached_data *after* adding "folder_short" data DUMP:',
$cached_data); }
+ // -----------
+ // SAVE DATA TO APPSESSION DB
CACHE (WITH the [folder_short] data)
+ // -----------
+ // save "folder_list" (WITH
ADDED folder short data) to appsession data store
+ // new style folder_list is
stored FULL, has all elements
+ if
($this->debug_args_special_handlers > 1) { $this->dbug->out('mail_msg:
get_folder_list: added folder short, now resave in DB as new style, complete
folder list, set appsession cache $this->save_session_cache_item(folder_list,
$cached_data, '.$acctnum.']) <br>'); }
+
$this->save_session_cache_item('folder_list', $cached_data, $acctnum);
}
- if ($this->debug_args_special_handlers
> 2) { $this->dbug->out('mail_msg: get_folder_list: $cached_data *after* adding
"folder_short" data DUMP:', $cached_data); }
// cache the result in "Level 1 cache"
class object var
if ($this->debug_args_special_handlers
> 1) { $this->dbug->out('mail_msg: get_folder_list: put folder_list into Level
1 class var "cache" $this->set_arg_value(folder_list, $cached_data,
'.$acctnum.');<br>'); }
$this->set_arg_value('folder_list',
$cached_data, $acctnum);
@@ -3074,15 +3415,17 @@
}
}
if ($this->debug_args_special_handlers > 2) {
$this->dbug->out('mail_msg: get_folder_list: my_folder_list with only
"folder_long" DUMP:', $my_folder_list); }
- // -----------
- // SAVE DATA TO APPSESSION DB CACHE (without the
[folder_short] data)
- // -----------
- // save "folder_list" (without folder short data) to
appsession data store
- if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg: get_folder_list: set appsession cache
$this->save_session_cache_item(folder_list, $my_folder_list, '.$acctnum.'])
<br>'); }
- $this->save_session_cache_item('folder_list',
$my_folder_list, $acctnum);
+ // NEW just save the complete list, leaving out the
folder short does not reduce size my a material amount
+ //// -----------
+ //// SAVE DATA TO APPSESSION DB CACHE (without the
[folder_short] data)
+ //// -----------
+ //// save "folder_list" (without folder short data) to
appsession data store
+ //if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg: get_folder_list: set appsession cache
$this->save_session_cache_item(folder_list, $my_folder_list, '.$acctnum.'])
<br>'); }
+ //$this->save_session_cache_item('folder_list',
$my_folder_list, $acctnum);
// add FOLDER SHORT element to folder_list array
structure
// that cuts cached data in 1/2, no need to cache
something this easy to deduce
+ // NEW: forget about it, just add folder short THEN
SAVE it, additional data is not that much more
for ($i=0; $i<count($my_folder_list);$i++)
{
$my_folder_long =
$my_folder_list[$i]['folder_long'];
@@ -3091,6 +3434,15 @@
if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg: get_folder_list: add folder_short loop['.$i.']:
$my_folder_long ['.$my_folder_long.'] ; $my_folder_acctnum
['.$my_folder_acctnum.'] ; $my_folder_short ['.$my_folder_short.']<br>'); }
$my_folder_list[$i]['folder_short'] =
$my_folder_short;
}
+
+ // -----------
+ // SAVE DATA TO APPSESSION DB CACHE (WITH the
[folder_short] data)
+ // -----------
+ // save "folder_list" (WITH ADDED folder short data)
to appsession data store
+ // new style folder_list is stored FULL, has all
elements
+ if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg: get_folder_list: set appsession cache
$this->save_session_cache_item(folder_list, $my_folder_list, '.$acctnum.'])
<br>'); }
+ $this->save_session_cache_item('folder_list',
$my_folder_list, $acctnum);
+
// cache the result to "level 1 cache" class arg holder
var
if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg: get_folder_list: set Level 1 class var "cache"
$this->set_arg_value(folder_list, $my_folder_list, '.$acctnum.') <br>'); }
$this->set_arg_value('folder_list', $my_folder_list,
$acctnum);
@@ -3256,7 +3608,7 @@
}
// DECISION: no more than 4 DIRECTORIES DEEP of
recursion
- $num_slashes =
$GLOBALS['phpgw']->msg->substr_count_ex($folder_long, "/");
+ $num_slashes = $this->substr_count_ex($folder_long,
"/");
if (($home_type_namespace)
&& ($num_slashes >= 4))
{
@@ -4606,9 +4958,24 @@
}
}
- // my implementation of a PHP4 only function
/*!
@function body_hard_wrap
+ @abstract Wrap test calls either the php4 wordwrap OR
optionally sucky native code
+ @author Angles
+ @discussion when php3 compat was necessary I made a sucky hand
made body wrap,
+ but now php4 is expected so this function should call the php4
function wordwrap instead.
+ */
+ function body_hard_wrap($in='', $size=78)
+ {
+ // use sucky hand made function
+ //return $this->body_hard_wrap_ex($in, $size);
+ // use the php4 builting function
+ return wordwrap($in, $size, "\r\n");
+
+ }
+ // my implementation of a PHP4 only function
+ /*!
+ @function body_hard_wrap_ex
@abstract my implementation of a PHP4 only function which keeps
lines of text under a certain length.
@author Angles
@discussion Keeps lines of text under a certain length, adding
linebreaks to break up lines if
@@ -4622,7 +4989,7 @@
php4 function which does the same, but at the time of this
functions origination it
was necessary to implement all non php3 functions with a
compatibility function.
*/
- function body_hard_wrap($in, $size=80)
+ function body_hard_wrap_ex($in, $size=80)
{
// this function formats lines according to the defined
// linesize. Linebrakes (\n\n) are added when
neccessary,
@@ -4674,6 +5041,56 @@
return $out;
}
+ /*!
+ @function recall_desired_action
+ @abstract used to preserve if this originated as a reply,
replyall, forward, or new mail
+ @author Angles
+ @discussion Used in both bocompose and bosend so we put it here
for general access.
+ Line lengths will differ for new mail and forwarded orig body,
vs. reply mail that has longer
+ lines. So this preserves this info for later use. Particularly
we like to preserve this thru the spelling pass also.
+ We look for GPC args "action" or "orig_action", as keys, and
their
+ values are limited to "reply", "replyall", "forward", and
"new", with "new" being deduced on the
+ initial compose page call and put into "orig_action" for later
use, while the others possible "action"
+ values simply get stored in "orig_action" no deduction is
required, it is specified.
+ If new future actions are added, adjust this function
accordingly.
+ @access public
+ */
+ function recall_desired_action()
+ {
+ // what action are we dealing with here, reply(all),
forward, or newmail
+ // we care because new and forward get different line
length then reply mail that has ">"
+ $orig_action = 'unknown';
+ if (($this->get_isset_arg('action'))
+ && (
+ ($this->get_arg_value('action') == 'forward')
+ || ($this->get_arg_value('action') == 'reply')
+ || ($this->get_arg_value('action') ==
'replyall')
+ )
+ )
+ {
+ $orig_action = $this->get_arg_value('action');
+ }
+ elseif (($this->get_isset_arg('orig_action'))
+ && (
+ ($this->get_arg_value('orig_action') ==
'forward')
+ || ($this->get_arg_value('orig_action') ==
'reply')
+ || ($this->get_arg_value('orig_action') ==
'replyall')
+ || ($this->get_arg_value('orig_action') ==
'new')
+ )
+ )
+ {
+ $orig_action =
$this->get_arg_value('orig_action');
+ }
+ else
+ {
+ // if not reply, replyall, nor forward
"action", then we have NEW message
+ // if this is set now then the above
"orig_action" should preserve it
+ $orig_action = 'new';
+ }
+ return $orig_action;
+ }
+
+
/**************************************************************************\
*
* Functions PHP Should Have OR Functions From PHP4+ Backported
to PHP3 *
@@ -4808,7 +5225,37 @@
return True;
}
}
-
+
+ /*!
+ @function is_serialized_smarter
+ @abstract find out if a string is already serialized, BUT NOT
FOOLED BY SLASH problems on unserizalize.
+ @param $string_data SHOULD be a string
+ */
+ function is_serialized_smarter($string_data)
+ {
+ if ((is_string($string_data))
+ && (unserialize($string_data) == False))
+ {
+ // when you unserialize a normal
(not-serialized) string, you get False
+ // HOWEVER slashes may b0rk unserialize, do not
be fooled, it is still serialized
+ // so use a second test here, piss poor test,
but it helps
+ if (stristr($string_data, ':"stdClass":'))
+ {
+ // unserialize failed but the source
str appears to look like a serialized thing
+ return True;
+ }
+ else
+ {
+ // second test still says this is not
serialized str
+ return False;
+ }
+ }
+ else
+ {
+ return True;
+ }
+ }
+
// PHP3 SAFE Version of "substr_count"
/*!
@function substr_count_ex
@@ -5047,6 +5494,9 @@
Does a loop thru existing accounts. NOTE THIS REALLY WIPES DATA
completely, it is not
very smart, it wipes cached data that may still be useful, so
this really does clear the cache.
UNDER DEVELOPMEMT
+ UPDATE we use folder as a key in msgball_list but batch expire
still works because
+ it wipes data based on a key prior to folder name, same as with
other data that has a
+ folder name in its data key.
*/
function batch_expire_cached_items($called_by='not_specified',
$only_msgball_list=False)
{
@@ -5123,7 +5573,7 @@
// we only care about doing this is caching is
enabled
// this should already be cached, if not, it
will be after this call
// this works OK for both php4 sessions AND
sessions_db
- $msg_headers =
$GLOBALS['phpgw']->msg->phpgw_header($msgball);
+ $msg_headers = $this->phpgw_header($msgball);
if ($this->debug_events > 2) {
$this->dbug->out('email_msg_base: event_msg_seen('.__LINE__.'): SEEN-UNSEEN
"phpgw_header" examination for $msg_headers DUMP:', $msg_headers); }
//if ($this->debug_events > 2) {
$this->dbug->out('email_msg_base: event_msg_seen('.__LINE__.'): (extreme mode)
SEEN-UNSEEN "phpgw_header" examination for $msg_headers <br> *
'.serialize($msg_headers).'<br>'); }
$did_alter = False;
@@ -5286,8 +5736,10 @@
// so we have data in the cache?
$data_name = 'msgball_list';
// currently we DO NOT use the $extra_keys param for
msgball_list data
+ // UPDATE YES NOW WE USE FOLDER NAME IN THE DATA KEYS
FOR MSGBALL_LIST
+ $ex_folder = $urlencoded_folder;
// get session data
- if (($this->debug_events > 1) ||
($this->debug_session_caching > 1)) { echo 'mail_msg:
event_msg_move_or_delete('.__LINE__.'): DIRECT CALL to get appsession data for
$location ['.$location.'], $app ['.$app.']<br>'; }
+ //if (($this->debug_events > 1) ||
($this->debug_session_caching > 1)) { echo 'mail_msg:
event_msg_move_or_delete('.__LINE__.'): DIRECT CALL to get appsession data for
$location ['.$location.'], $app ['.$app.']<br>'; }
//$cached_msgball_data =
$GLOBALS['phpgw']->session->appsession($location,$app);
//$cached_msgball_data =
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name];
@@ -5306,28 +5758,34 @@
if (($GLOBALS['phpgw_info']['server']['sessions_type']
== 'db')
|| ($this->use_private_table == True))
{
- if
((isset($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list'])
== False)
- ||
(!$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list']))
+ if
((isset($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list'][$ex_folder])
== False)
+ ||
(!$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list'][$ex_folder]))
{
- $my_location =
(string)$acctnum.';msgball_list';
- if ($this->debug_events > 1) {
$this->dbug->out('email_msg_base: event_msg_move_or_delete('.__LINE__.'):
(extreme mode) sessions_type is
['.$GLOBALS['phpgw_info']['server']['sessions_type'].'] SO we have this
additional step to read data from phpgw_app_sessions table, $my_location
['.$my_location.']<br>'); }
+ //$my_location =
(string)$acctnum.';msgball_list';
+ // NOW WE USE FOLDER TOO as a data key
for msgball_list
+ $my_location =
(string)$acctnum.';msgball_list;'.$ex_folder;
+ if (($this->debug_events > 1) ||
($this->debug_session_caching > 1)) { echo 'mail_msg:
event_msg_move_or_delete('.__LINE__.'): DIRECT CALL to get appsession data for
$location ['.$location.'], $app ['.$app.']<br>'; }
+ if ($this->debug_events > 1) {
$this->dbug->out('email_msg_base: event_msg_move_or_delete('.__LINE__.'):
(extreme mode) sessions_type is
['.$GLOBALS['phpgw_info']['server']['sessions_type'].'] SO we have this
additional step to read data from a database table, $my_location
['.$my_location.']<br>'); }
if ($this->use_private_table == True)
{
-
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list']
- =
$this->so->so_get_data($my_location);
+
//$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list'][$ex_folder]
+ // =
$this->so->so_get_data($my_location);
+ // TRY USING COMPRESSION for
msgball_list
+
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list'][$ex_folder]
+ =
$this->so->so_get_data($my_location, True);
}
else
{
-
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list']
+
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list'][$ex_folder]
=
$GLOBALS['phpgw']->session->appsession($my_location, 'email');
}
- //if ($this->debug_events > 2) {
$this->dbug->out('email_msg_base: event_msg_move_or_delete('.__LINE__.'):
(extreme mode) [email][dat]['.$acctnum.'][msgball_list] DUMP:<pre>';
print_r($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list']);
echo '</pre>'); }
+ //if ($this->debug_events > 2) {
$this->dbug->out('email_msg_base: event_msg_move_or_delete('.__LINE__.'):
(extreme mode) [email][dat]['.$acctnum.'][msgball_list] DUMP:<pre>';
print_r($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list'][ex_folder]);
echo '</pre>'); }
}
}
- $cached_msgball_data =&
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list'];
+ $cached_msgball_data =&
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list'][$ex_folder];
- if (($this->debug_events > 2) &&
($this->debug_allow_magball_list_dumps)) { $this->dbug->out('mail_msg:
event_msg_move_or_delete('.__LINE__.'): restored $cached_msgball_data DUMP:',
$cached_msgball_data); }
+ if (($this->debug_events > 2) &&
($this->debug_allow_magball_list_dumps)) { $this->dbug->out('mail_msg:
event_msg_move_or_delete('.__LINE__.'): for $my_location ['.$my_location.'],
restored $cached_msgball_data DUMP:', $cached_msgball_data); }
if ((!$cached_msgball_data)
&& ($this->session_cache_extreme == False))
@@ -5350,7 +5808,7 @@
// expire entire msgball_list and the
folder_status_info
if ($this->debug_events > 1) {
$this->dbug->out('mail_msg: event_msg_move_or_delete: ('.__LINE__.')
(non-extreme mode) calling $this->expire_session_cache_item("msgball_list",
'.$msgball['acctnum'].')<br>'); }
// FUTURE: if each account ever saves
msgball_list for individual folders instead of just one folder per account,
then add extra_keys to this command
-
$this->expire_session_cache_item('msgball_list', $msgball['acctnum']);
+
$this->expire_session_cache_item('msgball_list', $msgball['acctnum'],
$ex_folder);
// ANYTIME a message is moved out of a folder,
we need to remove any cached "msg_structure" and "phpgw_header" data
// damn why are we doing this in non-extreme
mode?
@@ -5437,8 +5895,8 @@
if (($this->debug_events > 2) &&
($this->debug_allow_magball_list_dumps)) { $this->dbug->out('mail_msg:
event_msg_move_or_delete('.__LINE__.'): (extreme mode) (step 1) array_splice of
$cached_msgball_data[msgball_list] results in this $cached_msgball_data DUMP:',
$cached_msgball_data); }
// save altered data back into the cache
- // NOT needed if using a REFERENCE
- if (($this->debug_session_caching > 1)
|| ($this->debug_events > 1)) { $this->dbug->out('mail_msg:
event_msg_move_or_delete: ('.__LINE__.') saving altered msgball_list directly
to appsession, location: ['.$location.'] $app ['.$app.']<br>'); }
+ // NOT needed if using a REFERENCE and
only using regular appsession (i.e. NOT the anglemail table)
+ //if (($this->debug_session_caching >
1) || ($this->debug_events > 1)) { $this->dbug->out('mail_msg:
event_msg_move_or_delete: ('.__LINE__.') saving altered msgball_list directly
to appsession, location: ['.$location.'] $app ['.$app.']<br>'); }
// COMMENT IF USING REF, UNCOMMENT IF
NOT USING REFERENCES
//$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list']
= $cached_msgball_data;
@@ -5446,15 +5904,23 @@
if
(($GLOBALS['phpgw_info']['server']['sessions_type'] == 'db')
|| ($this->use_private_table == True))
{
- $my_location =
(string)$acctnum.';msgball_list';
- if ($this->debug_events > 1) {
$this->dbug->out('email_msg_base: event_msg_move_or_delete('.__LINE__.'):
(extreme mode) sessions_type is
['.$GLOBALS['phpgw_info']['server']['sessions_type'].'] SO we have this
additional step to save data to phpgw_app_sessions table, $my_location
['.$my_location.']<br>'); }
+ //$my_location =
(string)$acctnum.';msgball_list';
+ // NOW WE USE FOLDER TOO as a
data key for msgball_list
+ $my_location =
(string)$acctnum.';msgball_list;'.$ex_folder;
+ if ($this->debug_events > 1) {
$this->dbug->out('email_msg_base: event_msg_move_or_delete('.__LINE__.'):
(extreme mode) sessions_type is
['.$GLOBALS['phpgw_info']['server']['sessions_type'].'] SO we have this
additional step to save data to a database table, $my_location
['.$my_location.'], if using anglemail table this step is always
necessary<br>'); }
if ($this->use_private_table ==
True)
{
-
$this->so->so_set_data($my_location,
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list']);
+
//$this->so->so_set_data($my_location,
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list']);
+ // TRY USING
COMPRESSION for msgball_list (only available for anglemail table)
+ $this->so->so_set_data(
+ $my_location,
+
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list'][$ex_folder],
+ True
+ );
}
else
{
-
$GLOBALS['phpgw']->session->appsession($my_location, 'email',
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list']);
+
$GLOBALS['phpgw']->session->appsession($my_location, 'email',
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum]['msgball_list'][$ex_folder]);
}
}
$did_alter = True;
@@ -5672,6 +6138,23 @@
}
/*!
+ @function href_maketag_class
+ @abstract will generate a typical A HREF html item with
optional CLASS value for css specs
+ */
+ function href_maketag_class($href_link='',$href_text='default
text', $css_class_name='')
+ {
+ if ($css_class_name != '')
+ {
+ $class_prop=' class="'.$css_class_name.'" ';
+ }
+ else
+ {
+ $class_prop='';
+ }
+ return '<a '.$class_prop.' href="' .$href_link .'">'
.$href_text .'</a>' ."\n";
+ }
+
+ /*!
@function img_maketag
@abstract will generate a typical IMG html item
*/
@@ -5686,10 +6169,12 @@
if ($alt != '')
{
$alt_tag = ' alt="['.$alt.']"';
+ $title_tag = ' title="'.$alt.'"';
}
else
{
$alt_tag = ' alt="['.$alt_default_txt.']"';
+ $title_tag = '';
}
if ($height != '')
{
@@ -5715,7 +6200,7 @@
{
$border_tag = '';
}
- $image_html = '<img src="'.$location.'"' .$height_tag
.$width_tag .$border_tag .$alt_tag .'>';
+ $image_html = '<img src="'.$location.'"' .$height_tag
.$width_tag .$border_tag .$title_tag .$alt_tag .'>';
return $image_html;
}
====================================================
====================================================
====================================================
Index: email/inc/class.mail_dcom_base_sock.inc.php
diff -u email/inc/class.mail_dcom_base_sock.inc.php:1.24
email/inc/class.mail_dcom_base_sock.inc.php:1.25
--- email/inc/class.mail_dcom_base_sock.inc.php:1.24 Fri Mar 14 04:00:48 2003
+++ email/inc/class.mail_dcom_base_sock.inc.php Thu Dec 30 23:13:50 2004
@@ -318,6 +318,8 @@
*/
class mail_dcom_base extends network
{
+ // OBSOLETED "folder_list_changed" by the newer function
"folder_list_did_change"
+ var $folder_list_changed=False;
// Cached Data
// raw message data from the server, some raw data, some
exploded into a string list
var $header_glob = '';
@@ -598,6 +600,29 @@
}
/*!
+ @function folder_list_did_change
+ @abstract if folder is created, deleted, or renamed this this
function handles cleanup of stale data in main msg object.
+ @discussion THIS IS A COPY OF THE FUNCTION IN THE NON-SOCK
CLASS, THEY SHOULD BE THE SAME
+ @author Angles
+ */
+ function folder_list_did_change()
+ {
+ // NOTE THIS FLAG "folder_list_changed" IS NOW
OBSOLETED SINCE THIS
+ // CALLBACK FUNCTION IS PROVEN TO WORK
+ $this->folder_list_changed = True;
+ if (is_object($GLOBALS['phpgw']->msg))
+ {
+ // call that classes "callback" function
designed to handle cleaning stale folder_list there
+ $sucess =
$GLOBALS['phpgw']->msg->folder_list_change_callback();
+ // if it was handled correctly, then reset the
"folder_list_changed" because we did our job
+ if ($sucess)
+ {
+ $this->folder_list_changed = False;
+ }
+ }
+ }
+
+ /*!
@function create_header
@abstract ?
@author unknown, maybe Skeeter ? Rehberg ? Engo ?
====================================================
Index: email/inc/class.mail_dcom_imap.inc.php
diff -u email/inc/class.mail_dcom_imap.inc.php:1.21
email/inc/class.mail_dcom_imap.inc.php:1.22
--- email/inc/class.mail_dcom_imap.inc.php:1.21 Fri Mar 14 04:00:51 2003
+++ email/inc/class.mail_dcom_imap.inc.php Thu Dec 30 23:13:50 2004
@@ -44,20 +44,20 @@
function createmailbox($stream,$mailbox)
{
$mailbox = $this->utf7_encode($mailbox);
- $this->folder_list_changed = True;
+ $this->folder_list_did_change();
return imap_createmailbox($stream,$mailbox);
}
function deletemailbox($stream,$mailbox)
{
- $this->folder_list_changed = True;
+ $this->folder_list_did_change();
$mailbox = $this->utf7_encode($mailbox);
return imap_deletemailbox($stream,$mailbox);
}
function renamemailbox($stream,$mailbox_old,$mailbox_new)
{
- $this->folder_list_changed = True;
+ $this->folder_list_did_change();
$mailbox_old = $this->utf7_encode($mailbox_old);
$mailbox_new = $this->utf7_encode($mailbox_new);
return
imap_renamemailbox($stream,$mailbox_old,$mailbox_new);
====================================================
Index: email/inc/class.mail_dcom_imap_sock.inc.php
diff -u email/inc/class.mail_dcom_imap_sock.inc.php:1.15
email/inc/class.mail_dcom_imap_sock.inc.php:1.16
--- email/inc/class.mail_dcom_imap_sock.inc.php:1.15 Fri Mar 14 04:00:52 2003
+++ email/inc/class.mail_dcom_imap_sock.inc.php Thu Dec 30 23:13:50 2004
@@ -36,7 +36,20 @@
may be just one line, skeeter is listed as an author for that function.
*/
class mail_dcom extends mail_dcom_base
- {
+ {
+
+ /**
+ * This stops users from using email if they do not have
php-imap enabled
+ *
+ address@hidden skwashd
+ */
+ function mail_dcom()
+ {
+ echo "<br>\n" . lang('php-imap support not installed -
exiting') . "<br>\n";
+ echo lang('contact your system administrator');
+ exit;
+ }
+
/**************************************************************************\
* data analysis specific to IMAP data communications
\**************************************************************************/
@@ -274,6 +287,8 @@
{
// not yet implemented
if ($this->debug_dcom >= 1) { echo 'imap: call to
unimplemented socket function: createmailbox<br>'; }
+ // eventually this will use this function to call for
expiration of stale cached data, if any
+ //$this->folder_list_did_change();
return true;
}
/*!
@@ -284,8 +299,23 @@
{
// not yet implemented
if ($this->debug_dcom >= 1) { echo 'imap: call to
unimplemented socket function: deletemailbox<br>'; }
+ // eventually this will use this function to call for
expiration of stale cached data, if any
+ //$this->folder_list_did_change();
+ return true;
+ }
+ /*!
+ @function renamemailbox
+ @abstract not yet implemented in IMAP sockets module
+ */
+ function renamemailbox($stream,$mailbox_old,$mailbox_new)
+ {
+ // not yet implemented
+ if ($this->debug_dcom >= 1) { echo 'imap: call to
unimplemented socket function: renamemailbox<br>'; }
+ // eventually this will use this function to call for
expiration of stale cached data, if any
+ //$this->folder_list_did_change();
return true;
}
+
/*!
@function expunge
@abstract not yet implemented in IMAP sockets module
====================================================
Index: email/inc/class.mail_msg_display.inc.php
diff -u email/inc/class.mail_msg_display.inc.php:1.41
email/inc/class.mail_msg_display.inc.php:1.42
--- email/inc/class.mail_msg_display.inc.php:1.41 Sun May 25 21:38:27 2003
+++ email/inc/class.mail_msg_display.inc.php Thu Dec 30 23:13:50 2004
@@ -24,7 +24,7 @@
\**************************************************************************/
/* $Id$ */
-
+
// include this last, it extends mail_msg_wrappers which extends
mail_msg_base
// so (1) include mail_msg_base, (2) incluse mail_msg_wrappers
extending mail_msg_base
// then (3) include mail_msg which extends mail_msg_wrappers and, by
inheritance, mail_msg_base
@@ -32,21 +32,36 @@
{
/*!
+ @function mail_msg
+ @abstract Constructor
+ @discussion normally this would call $this->initialize_mail_msg which
is a function in the base class,
+ HOWEVER I had to stop the auto constructor runthrough because
preferences class API keeps making
+ copies of this object thus calling the constructor unnecessarily for
what the pref API needs, which is
+ only a few functions in this object, SO NOW this class has NO real auto
called constructor,
+ instead the initialization function needs to be explicitly called,
which it is in the bootstrap class.
+ */
+ function mail_msg()
+ {
+ //$this->initialize_mail_msg();
+ return;
+ }
+
+ /*!
@function get_common_langs
- @abstract Certain strings commonly used with folder names have langs
available here. Example lang for INBOX.
- @param (string) OPTIONAL if no param is given, an array of available
langs is returned,
- or pass a param like "lang_inbox" and if we have the lang, we return
the langed string, if your param is
- not in the langs handled here, an error string is returned.
- @result (string or array) no param returns an associative array in key,
value style, a param returns a string
- of the lang you requested or an error string if we have no lang for the
param.
- @discussion Certain strings are used so often in an email app that we
should put them here
- to make translations easier by centralizing some common lang calls.
This function concentrates
- on langs associated with folder names, such as the lang for "INBOX", or
for "Sent", or for "Folder".
- On first call this finction fills an $this->common_langs array, and
only filles it with a small
- group of the selected langs handled in this function. If no param
provided this returns the whole array of
- langs handled here. Or pass a string param and this return its lang if
it is handled here, otherwise
- an error string is returned. Most langes are not needed in the core
object, so they are not provided in this function.
- Check this function to see what langs are contained here.
+ @abstract Certain strings commonly used with folder names have langs
available here. Example lang for INBOX.
+ @param (string) OPTIONAL if no param is given, an array of available
langs is returned,
+ or pass a param like "lang_inbox" and if we have the lang, we return
the langed string, if your param is
+ not in the langs handled here, an error string is returned.
+ @result (string or array) no param returns an associative array in key,
value style, a param returns a string
+ of the lang you requested or an error string if we have no lang for the
param.
+ @discussion Certain strings are used so often in an email app that we
should put them here
+ to make translations easier by centralizing some common lang calls.
This function concentrates
+ on langs associated with folder names, such as the lang for "INBOX", or
for "Sent", or for "Folder".
+ On first call this finction fills an $this->common_langs array, and
only filles it with a small
+ group of the selected langs handled in this function. If no param
provided this returns the whole array of
+ langs handled here. Or pass a string param and this return its lang if
it is handled here, otherwise
+ an error string is returned. Most langes are not needed in the core
object, so they are not provided in this function.
+ Check this function to see what langs are contained here.
@author Angles
*/
function get_common_langs($this_word='##NOTHING##')
@@ -89,28 +104,28 @@
/*!
@function common_folder_is
- @abstract Quick, limited match for folder name matching certain common
IMAP folders, such as Sent, INBOX, or Trash.
- @param $query_fldball (array of type fldball) A fldball with the name
of folder you are wondering about.
- @param $match_fld_name (known string) can be INBOX, Sent, or Trash.
- @result Boolean True if param $query_fld_name is a match to
$match_fld_name, False otherwise.
- @discussion Certain folder may exist on any IMAP server, such as Sent,
INBOX, and Trash.
- This function is limited to these common folder names only, it is not a
generic lookup function.
- This is a quick way to check if the given folder is in fact one of
these common IMAP folders,
- because these folders often require different handling for their
message list display. For example the
- Sent folder displays who a message is TO, not who the message is FROM,
as with all other folders.
- Also, names such as Sent and Trash depend on user preference values
that are not required to be in
- known "folder long" form, so the string to match to also requires
special handling to eventually
- compare correctly. This function processes each param for accurate
matching.
+ @abstract Quick, limited match for folder name matching certain common
IMAP folders, such as Sent, INBOX, or Trash.
+ @param $query_fldball (array of type fldball) A fldball with the name
of folder you are wondering about.
+ @param $match_fld_name (known string) can be INBOX, Sent, or Trash.
+ @result Boolean True if param $query_fld_name is a match to
$match_fld_name, False otherwise.
+ @discussion Certain folder may exist on any IMAP server, such as Sent,
INBOX, and Trash.
+ This function is limited to these common folder names only, it is not a
generic lookup function.
+ This is a quick way to check if the given folder is in fact one of
these common IMAP folders,
+ because these folders often require different handling for their
message list display. For example the
+ Sent folder displays who a message is TO, not who the message is FROM,
as with all other folders.
+ Also, names such as Sent and Trash depend on user preference values
that are not required to be in
+ known "folder long" form, so the string to match to also requires
special handling to eventually
+ compare correctly. This function processes each param for accurate
matching.
@author Angles
*/
function common_folder_is($query_fldball='##NOTHING##',
$match_fld_name='##NOTHING##')
{
- if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: ENTERING
<br>'); }
- if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: param
$query_fldball ['.htmlspecialchars(serialize($query_fldball)).'] param
$match_fld_name ['.htmlspecialchars($match_fld_name).']<br>'); }
-
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: ENTERING
<br>'); }
+ if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: param
$query_fldball ['.htmlspecialchars(serialize($query_fldball)).'] param
$match_fld_name ['.htmlspecialchars($match_fld_name).']<br>'); }
+
//return 'FIX ME: stub function not completed.
mail_msg_display.common_folder_is LINE '.__LINE__;
$acctnum = $query_fldball['acctnum'];
-
+
/*
if ( $this->get_folder_short($this->get_arg_value('folder'))
!=
$this->get_folder_short($this->get_pref_value('sent_folder_name')))
@@ -118,40 +133,46 @@
// blaaaa
}
*/
- if (($query_fldball == $this->nothing)
- || ($match_fld_name == $this->nothing))
+ if (((string)$query_fldball == $this->nothing)
+ || ((string)$match_fld_name == $this->nothing))
{
- if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: LEAVING
with Error, not enough param data supplied, so returning False<br>'); }
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: LEAVING
with Error, not enough param data supplied, so returning False<br>'); }
return False;
}
elseif (($match_fld_name != 'INBOX')
&& (strtolower($match_fld_name) != 'trash')
&& (strtolower($match_fld_name) != 'sent'))
{
- if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: LEAVING
with Error, param $match_fld_name ['.htmlspecialchars($match_fld_name).'] is
not INBOX nor Trash, nor Sent, this function can not test for anything else, so
returning False<br>'); }
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: LEAVING
with Error, param $match_fld_name ['.htmlspecialchars($match_fld_name).'] is
not INBOX nor Trash, nor Sent, this function can not test for anything else, so
returning False<br>'); }
return False;
}
elseif ($this->is_ball_data($query_fldball, 'any') == False)
{
- if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: LEAVING
with Error, input data fails
$this->is_ball_data('.htmlspecialchars(serialize($query_fldball)).', "any"), so
returning False<br>'); }
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: LEAVING
with Error, input data fails
$this->is_ball_data('.htmlspecialchars(serialize($query_fldball)).', "any"), so
returning False<br>'); }
return False;
}
+ if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is:
$query_fldball DUMP:', $query_fldball); }
+
// First, handle the easiest test - INBOX
if (($match_fld_name == 'INBOX')
&& ($query_fldball['folder'] == 'INBOX'))
{
- if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: LEAVING,
returning True, tested for and found INBOX<br>'); }
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: LEAVING,
returning True, tested for and found INBOX<br>'); }
return True;
}
+ else
+ {
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is:
match_fld_name and $query_fldball["folder"], either one nor both were INBOX, so
did not match the test, so continue with more checks...<br>'); }
+ }
// continue ...
// does the mailserver have folders, if not then there is NO
trash folder no matter what
if ($this->get_mailsvr_supports_folders($acctnum) == False)
{
- if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: LEAVING,
mailserver does NOT support folders, and not testing for INBOX, so returning
False<br>'); }
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: LEAVING,
mailserver does NOT support folders, and not testing for INBOX, so returning
False<br>'); }
return False;
}
// continue ...
-
+
// handle looking for Trash match
if (strtolower($match_fld_name) == 'trash')
{
@@ -163,23 +184,23 @@
}
else
{
- if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: LEAVING,
with ERROR, we should not ever get here because param sanity test is above,
param $match_fld_name ['.htmlspecialchars($match_fld_name).'] needs to be
either "Trash" or "Sent" at this point in the code, but it is not<br>'); }
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: LEAVING,
with ERROR, we should not ever get here because param sanity test is above,
param $match_fld_name ['.htmlspecialchars($match_fld_name).'] needs to be
either "Trash" or "Sent" at this point in the code, but it is not<br>'); }
return False;
}
// use that $needle to use the same code to handle both Trash
and Sent matchings
- if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: now
testing if input data is "'.$needle.'" folder ...<br>'); }
+ if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: now
testing if input data is "'.$needle.'" folder ...<br>'); }
// are we even supposed to use a trash or sent folder
if ( (!$this->get_isset_pref('use_'.$needle.'_folder',
$acctnum))
|| (!$this->get_pref_value('use_'.$needle.'_folder', $acctnum))
)
{
- if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: [test:
'.$needle.'] LEAVING, returning False, testing for '.$needle.' folder but user
preferences do NOT even want a '.$needle.' folder<br>'); }
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: [test:
'.$needle.'] LEAVING, returning False, testing for '.$needle.' folder but user
preferences do NOT even want a '.$needle.' folder<br>'); }
return False;
}
-
+
// does the trash folder actually exist ?
- if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: [test:
'.$needle.'] humm... does the "'.$needle.'" folder actually exist ::
this->get_pref_value("'.$needle.'_folder_name", '.$acctnum.') =
['.htmlspecialchars($this->get_pref_value($needle.'_folder_name',
$acctnum)).']<br>'); }
+ if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: [test:
'.$needle.'] humm... does the "'.$needle.'" folder actually exist ::
this->get_pref_value("'.$needle.'_folder_name", '.$acctnum.') =
['.htmlspecialchars($this->get_pref_value($needle.'_folder_name',
$acctnum)).']<br>'); }
$found_needle_folder_long = $this->folder_lookup('',
$this->get_pref_value($needle.'_folder_name', $acctnum));
- if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: [test:
'.$needle.'] did lookup on pref value for "'.$needle.'" folder, got
$found_needle_folder_long
['.htmlspecialchars($found_needle_folder_long).']<br>'); }
+ if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: [test:
'.$needle.'] did lookup on pref value for "'.$needle.'" folder, got
$found_needle_folder_long
['.htmlspecialchars($found_needle_folder_long).']<br>'); }
if ((isset($found_needle_folder_long))
&& ($found_needle_folder_long != ''))
{
@@ -192,30 +213,30 @@
// do we even need to continue
if ($havefolder == False)
{
- if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: [test:
'.$needle.'] LEAVING, returning False, testing for '.$needle.' folder, user
preferences DO want a '.$needle.' folder, but that folder does NOT exist, so
param certainly can not be a real '.$needle.' folder. <br>'); }
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_display)('.__LINE__.'): common_folder_is: [test:
'.$needle.'] LEAVING, returning False, testing for '.$needle.' folder, user
preferences DO want a '.$needle.' folder, but that folder does NOT exist, so
param certainly can not be a real '.$needle.' folder. <br>'); }
return False;
}
// so the trash folder exists, does it match the param to test
against
- if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: [test:
'.$needle.'] "'.$needle.'" folder exist, does it match a prepped param fldball,
get prepped fldball folder string top use for the comparing<br>'); }
+ if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: [test:
'.$needle.'] "'.$needle.'" folder exist, does it match a prepped param fldball,
get prepped fldball folder string top use for the comparing<br>'); }
$query_folder_long =
$this->prep_folder_in($query_fldball['folder'], $acctnum);
- if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: [test:
'.$needle.'] now we have folder long names to compare, does $query_folder_long
['.htmlspecialchars($query_folder_long).'] equal $found_needle_folder_long
['.htmlspecialchars($found_needle_folder_long).'] <br>'); }
+ if ($this->debug_args_special_handlers > 1) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: [test:
'.$needle.'] now we have folder long names to compare, does $query_folder_long
['.htmlspecialchars($query_folder_long).'] equal $found_needle_folder_long
['.htmlspecialchars($found_needle_folder_long).'] <br>'); }
if ($query_folder_long == $found_needle_folder_long)
{
- if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: LEAVING,
return True, match '.$needle.', and found '.$needle.' folder exists and matched
the input ball data <br>'); }
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: LEAVING,
return True, match '.$needle.', and found '.$needle.' folder exists and matched
the input ball data <br>'); }
return True;
}
else
{
- if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: LEAVING,
return False, match '.$needle.', and found '.$needle.' folder exists BUT input
ball data does not match it. <br>'); }
+ if ($this->debug_args_special_handlers > 0) {
$this->dbug->out('mail_msg(_wrappers)('.__LINE__.'): common_folder_is: LEAVING,
return False, match '.$needle.', and found '.$needle.' folder exists BUT input
ball data does not match it. <br>'); }
return False;
}
}
-
+
/*!
@function all_folders_listbox
- @abstract gets a list of all folders available to the user, and makes
an HTML listbox widget with that data.
- BEING PHASED OUT, REPLACED BY HTML WIDGET CLASS, soon to be DEPRECIATED.
- @param $feed_args[] array or args that you will "feed" into the
function, contains the following members
+ @abstract gets a list of all folders available to the user, and makes
an HTML listbox widget with that data.
+ BEING PHASED OUT, REPLACED BY HTML WIDGET CLASS, soon to be DEPRECIATED.
+ @param $feed_args[] array or args that you will "feed" into the
function, contains the following members
['mailsvr_stream'] : integer : the stream where the data
communications with the mailserver takes place
['pre_select_folder'] : string : if you want a particular
folder already selected in the listbox, put that foldername
here. Note you must know the name of the folder as it
will aooear in the kistbox for this to work.
@@ -226,15 +247,15 @@
['widget_name'] : string : name of the select widget :
important for form post usage. Default "folder"
['embeded_extra_data'] : string : OPTIONAL, if this is
specified, the value='' becomes "fake_uri_data"
in order to contain the extra data. Mostly used to
include the acctnum for the folder.
- In this case, the "widget_name" is appended with
"_fake_uri" which tells the script to
+ In this case, the "widget_name" is appended with
"_fake_uri" which tells the script to
use "explode_fake_uri()" to get the data, which it then
inserts back into the HTTP_POST_VARS
as if the data had never been embeeded. NOTE: such data
should be urlencode'd just as if this
were a URI, however "prep_folder_out" takes care of
this for the folder name automatically.
['on_change'] : string : the HTML select widget's "onChange"
value. Default: "document.switchbox.submit()'"
'[first_line_txt'] : string : the text that initially is
displayed in the select widget, used for information only,
like a descriptive label, it does not have any
important data usage. Default: "lang('switch current folder to')"
- @result string representing an HTML listbox widget
- @discussion BEING PHASED OUT, REPLACED BY HTML WIDGET CLASS, altough
this function *may*
+ @result string representing an HTML listbox widget
+ @discussion BEING PHASED OUT, REPLACED BY HTML WIDGET CLASS, altough
this function *may*
be retaied just to generate the raw data, but not the actual html.
@access private
*/
@@ -246,7 +267,7 @@
}
//$debug_widget = True;
$debug_widget = False;
-
+
$acctnum = $this->get_acctnum();
// establish fallback default args
$local_args = Array(
@@ -379,7 +400,7 @@
} else {
$item_tags = $item_tags .'<option
value="'.$option_value.'"'.$sel.'>' .$folder_short;
}
-
+
// "show_num_new" is currently BROKEN
// do we show the number of new
(unseen) messages for this folder
@@ -442,7 +463,7 @@
{
$feed_args=array();
}
-
+
$acctnum = $this->get_acctnum();
// establish fallback default args
$local_args = Array(
@@ -457,7 +478,7 @@
'acctnum_key_name' => 'acctnum',
'on_change' =>
'document.switchbox.submit()',
'first_line_txt' => lang('switch current folder
to')
- );
+ );
// loop thru $local_args[], replacing defaults with any args
specified in $feed_args[]
if ($debug_mega_listbox > 1) {
$this->dbug->out('folders_mega_listbox('.__LINE__.'): $feed_args data DUMP:',
$feed_args); }
if (count($feed_args) == 0)
@@ -496,9 +517,9 @@
}
// at this point, local_args[] has anything that was passed in
the feed_args[]
if ($debug_mega_listbox > 1) {
$this->dbug->out('folders_mega_listbox('.__LINE__.'):FINAL Listbox Local
Args:<br>'.serialize($local_args).'<br>'); }
-
+
$item_tags = '';
-
+
// we need the loop to include the default account AS WELL AS
the extra accounts
for ($x=0; $x < count($this->extra_and_default_acounts); $x++)
{
@@ -531,7 +552,7 @@
break;
}
// ... back to working code
-
+
// iterate thru the folder list, building the
HTML tags using that data
for ($i=0; $i<count($folder_list);$i++)
{
@@ -553,22 +574,22 @@
// this logic determines we should not
include a certain folder in the combobox list
if ($folder_short !=
$this->get_folder_short($local_args['skip_folder']))
{
- // we need to make value="X"
imitate URI type data, so we can embed the acctnum data
- // for the folder in there with
folder name, whereas normally option value="X" can only
- // hold no nore than one data
item as limited by BOTH html and php 's treatment of a combobox
-
+ // we need to make value="X"
imitate URI type data, so we can embed the acctnum data
+ // for the folder in there with
folder name, whereas normally option value="X" can only
+ // hold no nore than one data
item as limited by BOTH html and php 's treatment of a combobox
+
$option_value =
'&'.$local_args['folder_key_name'].'='.$this->prep_folder_out($folder_long)
.'&'.$local_args['acctnum_key_name'].'='.$folder_acctnum;
-
+
$text_blurb =
'['.$folder_acctnum.'] '.$folder_short;
-
+
$item_tags .= '<option
value="'.$option_value.'"'.$sel.'>'.$text_blurb.'</option>'."\r\n";
}
}
}
}
// now $item_tags contains the internal (i.e. "option" items)
folder list for this "select" combobox widget
-
+
// ---- add the HTML tags that surround this internal list
data ----
if ((isset($local_args['on_change']))
&& ($local_args['on_change'] != ''))
@@ -579,7 +600,7 @@
{
$on_change_tag = '';
}
-
+
// the widget_name with "_fake_uri" tells the script what to do
with this data
$listbox_widget =
'<select name="'.$local_args['widget_name'].'"
'.$on_change_tag.'>'
@@ -590,28 +611,28 @@
if ($debug_mega_listbox > 0) {
$this->dbug->out('folders_mega_listbox('.__LINE__.'): LEAVING<br>'); }
return $listbox_widget;
}
-
-
+
+
// ---- Messages Sort Order Start and Msgnum -----
/*!
@function fill_sort_order_start_msgnum
@abstract alias to "fill_sort_order_start" because msgnum is NO LONGER
handled here, function was renamed.
@author Angles
- @discussion alias function for backward compatibility only, useful only
until the rest of the code calls the
+ @discussion alias function for backward compatibility only, useful only
until the rest of the code calls the
real function "fill_sort_order_start"
*/
function fill_sort_order_start_msgnum()
{
$this->fill_sort_order_start();
}
-
+
/*!
@function fill_sort_order_start
@abstract handles determining what values sort, order, and start should
have.
@author Angles
- @discussion if sort, order, and start are available in the GPC vars and
are valid (values work, not out of range) then
- those GPC vars are used as source data. If not, then data is generated
accourding to the users prefs for sort and order,
- abd start is assumed 0 if not otherwise provided in the GPC vars. NOTE:
MSGNUM IS NO LONGER HANDLED
+ @discussion if sort, order, and start are available in the GPC vars and
are valid (values work, not out of range) then
+ those GPC vars are used as source data. If not, then data is generated
accourding to the users prefs for sort and order,
+ abd start is assumed 0 if not otherwise provided in the GPC vars. NOTE:
MSGNUM IS NO LONGER HANDLED
IN THIS FUNCTION so it was renamed from "fill_sort_order_start_msgnum"
to "fill_sort_order_start".
@syntax These are the PHP Sorting definitions and what they do and what
their int value is.
SORTDATE: 0 //This is the Date that the senders email client stanp
the message with
@@ -719,32 +740,45 @@
/*!
@function prev_next_navigation
@abstract ?
+ @discussion Adding ex_acctnum and ex_folder params AS AN EXPERIMENT.
@author Angles
*/
- function prev_next_navigation($old_method_totalmessages=0)
+ function prev_next_navigation($old_method_totalmessages=0,
$ex_acctnum='', $ex_folder='')
{
//$debug_nav = True;
//$debug_nav = False;
$debug_nav = $this->debug_index_page_display;
if ($debug_nav > 0) { $this->dbug->out('mail_msg_display:
prev_next_navigation('.__LINE__.'): ENTERING, (try debug_index_page_display = 3
to see data dumps)<br>'); }
- // this gets a verified non stale msgball_list and puts it in
cache, or uses the one in cache if it passes verified and not stale test
- $this->get_msgball_list();
// but we do not want a COPY of this data it can be thousands
of items, so we try to get a reference
$nav_data = array();
$nav_data['msgball_list'] = array();
- $ex_acctnum = $this->get_acctnum();
+ // TESTING THIS AS AN OPTIONAL PARAM HERE
+ // we used to obtain it here no matter what, now it may be
passed as a param
+ if ((!isset($ex_acctnum))
+ || ((string)$ex_acctnum == ''))
+ {
+ $ex_acctnum = $this->get_acctnum();
+ }
+ // TESTING THIS AS AN OPTIONAL PARAM HERE
+ if ((!isset($ex_folder))
+ || ((string)$ex_folder == ''))
+ {
+ $ex_folder =
$this->prep_folder_out($this->get_arg_value('folder', $acctnum));
+ }
+ // TESTING this gets a verified non stale msgball_list and puts
it in cache, or uses the one in cache if it passes verified and not stale test
+ //$this->get_msgball_list($ex_acctnum, $ex_folder);
+ // remember the actual msgball_list is a sub element of an
array that includes validity info
if (($this->session_cache_enabled == True)
- &&
(isset($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list']['msgball_list'])))
- //&&
(isset($GLOBALS['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list']['msgball_list'])))
+ &&
(isset($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list'][$ex_folder]['msgball_list'])))
+ //&&
(isset($GLOBALS['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list']['msgball_list'][$ex_folder])))
{
- $nav_data['msgball_list'] =&
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list']['msgball_list'];
- //$nav_data['msgball_list'] =&
$GLOBALS['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list']['msgball_list'];
+ $nav_data['msgball_list'] =&
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list'][$ex_folder]['msgball_list'];
}
else
{
// ok we could not obtain a reference for some reason,
get a COPY then
- $nav_data['msgball_list'] = $this->get_msgball_list();
+ $nav_data['msgball_list'] =
$this->get_msgball_list($ex_acctnum, $ex_folder);
}
//$nav_data['msgnum_idx'] =
$this->array_search_ex($this->get_arg_value('["msgball"]["msgnum"]'),
$nav_data['msgball_list']);
@@ -807,9 +841,9 @@
$nav_data['prev_msg'] = $nav_data['active_msgnum_idx']
- 1;
$nav_data['method'] = 'old_broken';
}
-
+
if ($debug_nav > 2) { $this->dbug->out('mail_msg_display:
prev_next_navigation('.__LINE__.'): step1 $nav_data[] DUMP:', $nav_data); }
-
+
// if it's not possible to have a prev message, then make
"prev_msg" False
if ($nav_data['active_msgnum_idx'] <= $nav_data['lowest_left'])
{
@@ -826,20 +860,20 @@
if ($debug_nav > 0) { $this->dbug->out('mail_msg_display:
prev_next_navigation('.__LINE__.'): LEAVING<br>'); }
return $nav_data;
}
-
+
/*!
- @function all_ex_accounts_listbox
+ @function all_ex_accounts_listbox DEPRECIATED
@abstract Creates a listbox with all email accounts.
- @discussion Used in the switch account combobox, and the filers page
too, I think. The listbox
- is sort of an HTML widget. For the raw data, see the function, it is
easy to get the data without the
- HTML if you want that.
+ @discussion Used in the switch account combobox, and the filers page
too, I think. The listbox
+ is sort of an HTML widget. For the raw data, see the function, it is
easy to get the data without the
+ HTML if you want that. DEPRECIATED now should use function in widgets
class.
@author Angles
*/
function all_ex_accounts_listbox($feed_args)
{
// $this->ex_accounts_count
// $this->extra_accounts
-
+
if(!$feed_args)
{
$feed_args=array();
@@ -1041,7 +1075,7 @@
// ---- High-Level Function To Get The "so-and-so" wrote String -----
/*!
@function get_who_wrote
- @abstract
+ @abstract PROBABLY NO LONGER USED
@author Angles and code from previous maintainer
*/
function get_who_wrote($msg)
@@ -1070,7 +1104,9 @@
$personal = trim($from->personal);
// non-us-ascii chars in headers MUST be specially
encoded, so decode them (if any) now
$personal = $this->decode_header_string($personal);
- //$personal = $this->qprint_rfc_header($personal);
+ ////$personal = $this->qprint_rfc_header($personal);
+ // escape certain undesirable chars before HTML display
+ $personal = $this->htmlspecialchars_encode($personal);
$personal = $personal .'
('.$from->mailbox.'@'.$from->host.')';
}
return $personal;
@@ -1124,19 +1160,53 @@
/* * * * * * * * * * *
*
- * = = = = = = MIME ANALYSIS = = = = =
+ * = = = = = = MIME ANALYSIS = = = = =
*
* * * * * * * * * * */
// ---- Message Structure Analysis -----
/*!
@function get_flat_pgw_struct
- @abstract Message Structure Analysis, make multilevel php message
struct into a flat array
- @param $struct (php structure from ?)
- @discussion This is the meat of the home grown MIME analysis this app
uses.
+ @abstract Message Structure Analysis, make multilevel php message
struct into a flat array aka "part_nice"
+ @param $struct (php structure from ?)
+ @discussion This is the meat of the home grown MIME analysis this app
uses.
@author Angles
*/
function get_flat_pgw_struct($struct)
{
+ if ($this->debug_message_display > 0) {
$this->dbug->out('mail_msg(display).get_flat_pgw_struct: ENTERING <br>'); }
+ //if ($this->debug_message_display > 1) {
$this->dbug->out('mail_msg(display).get_flat_pgw_struct: param $msgball
['.serialize($msgball).']<br>'); }
+ if ($this->debug_message_display > 2) {
$this->dbug->out('mail_msg(display).get_flat_pgw_struct: param $struct DUMP:',
$struct); }
+
+ /*
+ // NO NEED TO CACHE THIS DATA, NO CONTACT WITH MAILSERVER IS
NEEDED FOR THIS DATA
+ // try to get it from cache, this function handles checking for
session_cache_extreme True or False
+ if ($this->session_cache_extreme == True)
+ {
+ if ((isset($msgball['folder']))
+ && (trim($msgball['folder']) != '')
+ && (isset($msgball['acctnum']))
+ && ((string)($msgball['acctnum']) != ''))
+ {
+ $ex_folder = $msgball['folder'];
+ $ex_msgnum = $msgball['msgnum'];
+ }
+ else
+ {
+ $ex_folder = $this->prep_folder_out();
+ $ex_msgnum = $this->get_acctnum();
+ }
+ // the cached data is returned as a ready to use array
if it exists, or False if not existing
+ $cache_flat_pgw_struct =
$this->read_session_cache_item('flat_pgw_struct', $acctnum, $ex_folder,
$ex_msgnum);
+ //echo '** flat_pgw_struct: $specific_key
['.$specific_key.'] :: $cache_flat_pgw_struct DUMP<pre>';
print_r($cache_phpgw_header); echo '</pre>';
+ if ($cache_flat_pgw_struct)
+ {
+ if ($this->debug_message_display > 0) {
$this->dbug->out('mail_msg(display).get_flat_pgw_struct: LEAVING returning
cached data<br>'); }
+ return $cache_flat_pgw_struct;
+ }
+ }
+ if ($this->debug_message_display > 1) {
$this->dbug->out('mail_msg(display).get_flat_pgw_struct: beginning ... no
cached data available or caching is not enabled<br>'); }
+ */
+
if (isset($this->not_set))
{
$not_set = $this->not_set;
@@ -1145,7 +1215,7 @@
{
$not_set = '-1';
}
-
+
// get INITIAL part structure / array from the fetchstructure
variable
if ((!isset($struct->parts[0]) || (!$struct->parts[0])))
{
@@ -1155,13 +1225,13 @@
{
$part = $struct->parts;
}
-
+
//$part = Array();
//$part[0] = $struct;
- //echo '<br>INITIAL var part serialized:<br>' .serialize($part)
.'<br><br>';
+ //echo '<br>INITIAL var part serialized:<br>' .serialize($part)
.'<br><br>';
- $d1_num_parts = count($part);
+ $d1_num_parts = count($part);
$part_nice = Array();
// get PRIMARY level part information
@@ -1174,7 +1244,7 @@
$d1_mime_num = (string)($d1+1);
$part_nice[$array_position] =
$this->pgw_msg_struct($part[$d1], $not_set, $d1_mime_num, ($d1+1),
$d1_num_parts, 1);
if ($deepest_level < 1) { $deepest_level=1; }
-
+
// get SECONDARY/EMBEDDED level part information
$d1_array_pos = $array_position;
if ($part_nice[$d1_array_pos]['ex_num_subparts'] !=
$not_set)
@@ -1187,7 +1257,7 @@
$array_position++;
$part_nice[$array_position] =
$this->pgw_msg_struct($d2_part, $d1_array_pos, $d2_mime_num, ($d2+1),
$d2_num_parts, 2);
if ($deepest_level < 2) {
$deepest_level=2; }
-
+
// get THIRD/EMBEDDED level part
information
$d2_array_pos = $array_position;
if ($d2_part['ex_num_subparts'] !=
$not_set)
@@ -1200,7 +1270,7 @@
$array_position++;
$part_nice[$array_position] = $this->pgw_msg_struct($d3_part, $d2_array_pos,
$d3_mime_num, ($d3+1), $d3_num_parts, 3);
if ($deepest_level < 3)
{ $deepest_level=3; }
-
+
// get FOURTH/EMBEDDED
level part information
$d3_array_pos =
$array_position;
if
($d3_part['ex_num_subparts'] != $not_set)
@@ -1213,7 +1283,7 @@
$array_position++;
$part_nice[$array_position] = $this->pgw_msg_struct($d4_part, $d3_array_pos,
$d4_mime_num, ($d4+1), $d4_num_parts, 4);
if
($deepest_level < 4) { $deepest_level=4; }
-
+
// get
FIFTH LEVEL EMBEDDED level part information
$d4_array_pos = $array_position;
if
($d4_part['ex_num_subparts'] != $not_set)
@@ -1226,7 +1296,7 @@
$array_position++;
$part_nice[$array_position] = $this->pgw_msg_struct($d5_part,
$d4_array_pos, $d5_mime_num, ($d5+1), $d5_num_parts, 5);
if ($deepest_level < 5) { $deepest_level=5; }
-
+
// get SIXTH LEVEL EMBEDDED level part information
$d5_array_pos = $array_position;
if ($d5_part['ex_num_subparts'] != $not_set)
@@ -1239,7 +1309,7 @@
$array_position++;
$part_nice[$array_position] =
$this->pgw_msg_struct($d6_part, $d5_array_pos, $d6_mime_num, ($d6+1),
$d6_num_parts, 6);
if ($deepest_level < 6) { $deepest_level=6; }
-
+
// get SEVENTH LEVEL EMBEDDED level part information
$d6_array_pos = $array_position;
if ($d6_part['ex_num_subparts'] != $not_set)
@@ -1252,7 +1322,7 @@
$array_position++;
$part_nice[$array_position] =
$this->pgw_msg_struct($d7_part, $d6_array_pos, $d7_mime_num, ($d7+1),
$d7_num_parts, 7);
if ($deepest_level < 7) {
$deepest_level=7; }
-
+
// get EIGTH LEVEL EMBEDDED level part
information
$d7_array_pos = $array_position;
if ($d7_part['ex_num_subparts'] !=
$not_set)
@@ -1265,7 +1335,7 @@
$array_position++;
$part_nice[$array_position] = $this->pgw_msg_struct($d8_part, $d7_array_pos,
$d8_mime_num, ($d8+1), $d8_num_parts, 8);
if ($deepest_level < 8)
{ $deepest_level=8; }
-
+
// get NINTH LEVEL
EMBEDDED level part information
$d8_array_pos =
$array_position;
if
($d8_part['ex_num_subparts'] != $not_set)
@@ -1278,7 +1348,7 @@
$array_position++;
$part_nice[$array_position] = $this->pgw_msg_struct($d9_part, $d8_array_pos,
$d9_mime_num, ($d9+1), $d9_num_parts, 9);
if
($deepest_level < 9) { $deepest_level=9; }
-
+
// get
10th LEVEL EMBEDDED level part information
$d9_array_pos = $array_position;
if
($d9_part['ex_num_subparts'] != $not_set)
@@ -1291,7 +1361,7 @@
$array_position++;
$part_nice[$array_position] = $this->pgw_msg_struct($d10_part,
$d9_array_pos, $d10_mime_num, ($d10+1), $d10_num_parts, 10);
if ($deepest_level < 10) { $deepest_level=10; }
-
+
// get 11th LEVEL EMBEDDED level part information
$d10_array_pos = $array_position;
if ($d10_part['ex_num_subparts'] != $not_set)
@@ -1343,7 +1413,7 @@
// CONTINUE WITH THE ANALYSIS
- // ---- Mime Characteristics Analysis and more Attachments
Detection -----
+ // ---- Mime Characteristics Analysis and more Attachments
Detection -----
// ANALYSIS LOOP Part 1
for ($i = 0; $i < count($part_nice); $i++)
{
@@ -1376,11 +1446,11 @@
{
for ($p = 0; $p <
$part_nice[$i]['ex_num_param_pairs']; $p++)
{
- if
+ if
(
-
(($part_nice[$i]['params'][$p]['attribute'] == 'name')
+
(($part_nice[$i]['params'][$p]['attribute'] == 'name')
||
($part_nice[$i]['params'][$p]['attribute'] == 'filename'))
-
+
&&
($part_nice[$i]['params'][$p]['value'] != $not_set)
)
{
@@ -1397,11 +1467,11 @@
{
for ($p = 0; $p <
$part_nice[$i]['ex_num_dparam_pairs']; $p++)
{
- if
+ if
(
-
(($part_nice[$i]['dparams'][$p]['attribute'] == 'name')
+
(($part_nice[$i]['dparams'][$p]['attribute'] == 'name')
||
($part_nice[$i]['dparams'][$p]['attribute'] == 'filename'))
-
+
&&
($part_nice[$i]['dparams'][$p]['value'] != $not_set)
)
{
@@ -1411,7 +1481,7 @@
}
}
}
-
+
// Attachment Detection PART2 = if a part has
encoding=base64 , then treat as an attachment
// eventhough the above code did not find a name
for the part
if (($part_nice[$i]['encoding'] == 'base64')
@@ -1444,7 +1514,7 @@
{
// NOTE: if a part has a name in the
params, the it would have been handled
// before this if..then block. Thus, to
get to this point in the code means
- // we MUST have a base64 part with NO
NAME -
+ // we MUST have a base64 part with NO
NAME -
// NOR does it have an OBVIOUS
type/subtype (text/plain)
// we have NO CHOICE but to treat it as
an attachment
$part_nice[$i]['ex_attachment'] = True;
@@ -1472,21 +1542,22 @@
// sometimes the name's extention is the only
info we have, i.e. ".doc" implies a WORD file
//$part_nice['ex_part_name'] = 'no_name.att';
}
-
-
+
+
/*!
@concept MIME PART CATAGORIZATION in get_flat_pgw_struct
- @abstract Anglemail uses an custom flat mime analysis
which gives human understandable names to MIME parts.
- @example POSSIBLE VALUES FOR [ " m_description " ] ARE
+ @abstract Anglemail uses an custom flat mime analysis
which gives human understandable names to MIME parts.
+ @example POSSIBLE VALUES FOR [ " m_description " ] ARE
container
packagelist
presentable/image
attachment
presentable
- @syntax RULES for determining m_description are
+ @syntax RULES for determining m_description are
a) if no subpart(s) then we have either "presentable"
or "attachment"
b) if subpart(s) and a boundary param, then we have a
"packagelist" (HeadersOnly)
- c) else we have a container
+ c) else we have a container.
+ Presentable can be qualified with "image".
*/
if ((int)$part_nice[$i]['ex_num_subparts'] < 1)
{
@@ -1512,6 +1583,7 @@
else
{
// not an attachment, nor an attachment
that's an image for inline display
+ // so it is presentable
$part_nice[$i]['m_description'] =
'presentable';
}
}
@@ -1525,14 +1597,16 @@
// c) else we have a container
$part_nice[$i]['m_description'] = 'container';
}
-
+
// ------ KEYWORD LIST -------
-
+
// probably will be depreciated
// at least for now, keywords "plain" and "html" are
needed below
$part_nice[$i]['m_keywords'] = '';
if ((stristr($part_nice[$i]['subtype'], 'plain'))
- || (stristr($part_nice[$i]['subtype'], 'html')))
+ || (stristr($part_nice[$i]['subtype'], 'html'))
+ // enriched = part of APPLE MAIL multipart /
alternative subpart where the html part usually is
+ || (stristr($part_nice[$i]['subtype'], 'enriched')))
{
$part_nice[$i]['m_keywords'] .=
$part_nice[$i]['subtype'] .' ';
}
@@ -1541,22 +1615,173 @@
{
$part_nice[$i]['m_keywords'] .=
$part_nice[$i]['encoding'] .' ';
}
-
-
+
+ // keyword "alt_hide"
+ // Also a keywords we use can be "alt_hide" which means
that the
+ // part is part of an alternative pair of parts and
this one can be hidden because
+ // it is the simpler text part, while we desire to show
the html part as the better-to-show
+ // part, and showing 2 of the same, i.e. both of the
alternatives, is undesirable.
+ // so is a presentable part of an alternative pair of
parts
+ if ($part_nice[$i]['m_description'] == 'presentable')
+ {
+ // TEST THIS:
+ // (a) is the part text/plain
+ // (b) if so, is that parent marked as
multipart/related
+ //// (c) is the very next part HTML, because
apple uses "enhanced" which looks b0rked,
+ //// so that case needs the simpler part to
also be shown.
+ ////UPDATE this (c) thing will fail if the html
is in a related nest, so skip this check
+ // and CHECK 2 TIMES: note that we test 2 times
+ // (1) the first is where the mail has only 2
parts
+ // and AngleMail flatening code has left the
top level headers out of the
+ // flat array, as it does sometimes.
+ // (2) the first is where the mail has a
RELATED subgroup that is at the 1st level debth
+ // i.e. the first thing below the top level
headers themselves, thus
+ // and AngleMail flatening code has left the
top level headers out of the
+ // flat array, as it does sometimes, so we need
to look back 2 steps to those top level headers
+ // that are only available thru the
$struct->type thing because our flattening code
+ // has left the top level headers out of the
flat array, as it does sometimes
+ // (3) The second is for anything deep enough
so that the parent part IS in the
+ // flat array, which is more typical.
+ $presentable_parent_idx =
$part_nice[$i]['ex_parent_flat_idx'];
+ if (
+ ($part_nice[$i]['type'] == 'text')
+ && ($part_nice[$i]['subtype'] == 'plain')
+ && ($part_nice[$i]['ex_parent_flat_idx'] ==
$not_set)
+ //&& (stristr($struct->type, 'multipart'))
+ && ((string)$struct->type == '1') // "1" =
"multipart"
+ && (stristr($struct->subtype, 'alternative'))
+ )
+ {
+ // SET THIS FLAG: then, in presentation
loop, we can decide not to show it
+ $part_nice[$i]['m_keywords'] .=
'alt_hide' .' ';
+ }
+ // scanario (2) as outlined above
+ elseif (
+ ($part_nice[$i]['type'] == 'text')
+ && ($part_nice[$i]['subtype'] == 'plain')
+ &&
($part_nice[$presentable_parent_idx]['ex_parent_flat_idx'] == $not_set)
+ && (stristr($struct->type, 'multipart'))
+ // SHOULD BE THIS && ((string)$struct->type
== '1') // "1" = "multipart"
+ && (stristr($struct->subtype, 'alternative'))
+ //&& ($part_nice[$i+1]['type'] == 'text')
+ //&& ($part_nice[$i+1]['subtype'] == 'html')
+ )
+ {
+ // SET THIS FLAG: then, in presentation
loop, we can decide not to show it
+ $part_nice[$i]['m_keywords'] .=
'alt_hide' .' ';
+ }
+ // scenario (3) as outlined above
+ // same as (1) above but we do not need to look
all the way back to the top level headers
+ // i.e. because the parent part is included in
the flat parts array
+ elseif (
+ ($part_nice[$i]['ex_level_debth'] > 1)
+ && ($part_nice[$i]['type'] == 'text')
+ && ($part_nice[$i]['subtype'] == 'plain')
+ && ($part_nice[$presentable_parent_idx]['type']
== 'multipart')
+ &&
($part_nice[$presentable_parent_idx]['subtype'] == 'alternative')
+ //&& ($part_nice[$i+1]['type'] == 'text')
+ //&& ($part_nice[$i+1]['subtype'] == 'html')
+ )
+ {
+ // SET THIS FLAG: then, in presentation
loop, we can decide not to show it
+ $part_nice[$i]['m_keywords'] .=
'alt_hide' .' ';
+ }
+ }
+ // more keyword "alt_hide"
+ // ALSO use this same kind of test to hide images that
get swapped into the main related part,
+ // so we do not show these images on their own
+ if ($part_nice[$i]['m_description'] ==
'presentable/image')
+ {
+ //echo '('.__LINE__.') presentable/image ,
$struct->type ['.$struct->type.'] , $struct->subtype
['.$struct->subtype.']<br>';
+ // TEST THIS:
+ // * IS the parent marked as multipart/related
+ // and CHECK 2 TIMES: note that we test 2 times
+ // (1) the first is where the mail has only 2
parts
+ // and AngleMail flatening code has left the
top level headers out of the
+ // flat array, as it does sometimes.
+ // (2) The second is for anything deep enough
so that the parent part IS in the
+ // flat array, which is more typical.
+ $presentable_parent_idx =
$part_nice[$i]['ex_parent_flat_idx'];
+ if (
+ //ok I am an image, is my parent the top
level headers
+ ($part_nice[$i]['ex_parent_flat_idx'] ==
$not_set)
+ && ((string)$struct->type == '1') // "1" =
"multipart"
+ && (stristr($struct->subtype, 'related'))
+ )
+ {
+ //echo '('.__LINE__.')
presentable/image , alt_hide related to top level<br>';
+ // SET THIS FLAG: then, in presentation
loop, we can decide not to show it
+ $part_nice[$i]['m_keywords'] .=
'alt_hide' .' ';
+ }
+ // same as above but we do not need to look all
the way back to the top level headers
+ // ie because the parent part is included in
the flat parts array
+ elseif (
+ ($part_nice[$i]['ex_level_debth'] > 1)
+ && ($part_nice[$presentable_parent_idx]['type']
== 'multipart')
+ &&
($part_nice[$presentable_parent_idx]['subtype'] == 'related')
+ )
+ {
+ // SET THIS FLAG: then, in presentation
loop, we can decide not to show it
+ $part_nice[$i]['m_keywords'] .=
'alt_hide' .' ';
+ }
+ }
+
// ------ EXCEPTIONS TO THE RULES -------
-
+
// = = = = = Exceptions for Less-Standard Subtypes = =
= = =
//"m_description" set above will work *most all* the
time. However newer standards
- // are encouraged to make use of the "subtype" param,
not create new "type"s
+ // are encouraged to make use of the "subtype" param,
not create new "type"s
// the following "multipart/SUBTYPES" should be treated
as
// "container" instead of "packagelist"
-
- // (1) Exception: multipart/RELATED: for ex. Outl00k
Stationary handling
+
+ // (1a) Exception: multipart/RELATED: for ex. Outl00k
Stationary handling
// where an HTML part has references to other parts
(images) in it
- // treat it's *child* multipart/alternative as
"container", not as "packagelist"
+ // the first 2 tests simple set a "m_html_related_kids"
flag
+ // the 3rd test is another form of exception concerning
related parts
+ // which requires a change to "container" instead of
"packagelist"
$part_nice[$i]['m_html_related_kids'] = False;
$parent_idx = $part_nice[$i]['ex_parent_flat_idx'];
- if (($part_nice[$i]['ex_level_debth'] > 1) // does not
apply to level1, b/c level1 has no parent
+ // level 1 has no parent in part_nice because we skip
to presentable stuff
+ // so in that case we need to check top level headers
+ if (
+ ($part_nice[$i]['type'] == 'text')
+ && ($part_nice[$i]['subtype'] == 'html')
+ && ($part_nice[$parent_idx]['type'] == 'multipart')
+ && ($part_nice[$parent_idx]['subtype'] == 'alternative')
+ && ($part_nice[$parent_idx]['ex_parent_flat_idx'] ==
$not_set)
+ && (stristr($struct->subtype, 'RELATED'))
+ )
+ {
+ // SET THIS FLAG: then, in presentation loop,
see if a HTML part
+ // has a parent with this flag - if so, replace
"id" reference(s) with
+ // http... mime reference(s). Example: MS
Stationary mail's image background
+ $part_nice[$parent_idx]['m_html_related_kids']
= True;
+ //$part_nice[$i]['m_keywords'] .= 'id_swap' .'
';
+ $part_nice[$i]['m_keywords'] .= 'related' .' ';
+ }
+ // same as above but we do not need to look all the way
back to the top level headers
+ // ie an html part with a parent that is explicitly set
as RELATED
+ elseif (
+ ($part_nice[$i]['ex_level_debth'] > 1)
+ && ($part_nice[$i]['type'] == 'text')
+ && ($part_nice[$i]['subtype'] == 'html')
+ && ($part_nice[$parent_idx]['type'] == 'multipart')
+ && ($part_nice[$parent_idx]['subtype'] == 'related')
+ )
+ {
+ // SET THIS FLAG: then, in presentation loop,
see if a HTML part
+ // has a parent with this flag - if so, replace
"id" reference(s) with
+ // http... mime reference(s). Example: MS
Stationary mail's image background
+ $part_nice[$parent_idx]['m_html_related_kids']
= True;
+ //$part_nice[$i]['m_keywords'] .= 'id_swap' .'
';
+ $part_nice[$i]['m_keywords'] .= 'related' .' ';
+ }
+ // (1b) Exception: multipart/RELATED: for ex. Outl00k
Stationary handling
+ // where an HTML part has references to other parts
(images) in it
+ // treat it's *child* multipart/alternative as
"container", not as "packagelist"
+ // similar to above but more serious, MANIPULATE
"container" vs. "packagelist"
+ // while also determining is it has related html style
child parts
+ elseif (($part_nice[$i]['ex_level_debth'] > 1) // does
not apply to level1, b/c level1 has no parent
&& ($part_nice[$i]['type'] == 'multipart')
&& ($part_nice[$i]['subtype'] == 'alternative')
&& ($part_nice[$parent_idx]['type'] == 'multipart')
@@ -1565,13 +1790,40 @@
// NOTE: treat it's *child*
multipart/alternative as "container", not as "packagelist"
$part_nice[$i]['m_description'] = 'container';
$part_nice[$i]['m_keywords'] .= 'Force
Container, id_swap' .' ';
- // SET THIS FLAG: then, in presentation loop,
see if a HTML part
- // has a parent with this flag - if so, replace
"id" reference(s) with
+ // SET THIS FLAG: then, in presentation loop,
see if a HTML part
+ // has a parent with this flag - if so, replace
"id" reference(s) with
// http... mime reference(s). Example: MS
Stationary mail's image background
$part_nice[$i]['m_html_related_kids'] = True;
$part_nice[$i]['m_keywords'] .= 'id_swap' .' ';
}
-
+ // (1c) Exception: multipart/RELATED: for ex.
"courier-users digest, Vol 1 #2565 - 6 msgs" segment 3.1
+ // DAMN this is similar to exception 1b, I wonder if I
screwed 1b up and 1c is the real thing?
+ // where an HTML part has references to other parts
(images) in it
+ // treat it's *child* multipart/alternative as
"container", not as "packagelist"
+ // similar to above but more serious, MANIPULATE
"container" vs. "packagelist"
+ // while also determining is it has related html style
child parts
+ //this is tricky because it is part of a segment
alternative, and this is the htm part encased in a related subsegment
+ // - 3.1.0 segment header (multipart / alternative)
+ // -- 3.1.1 plain part (text / plain)
+ // --- 3.1.2 related subpart (subsegment) in entirety,
both html part and image part (multipart / related) *** NEEDS TO BE A CONTAINER
***
+ // ---- 3.1.2.1 html part of the related segment (text
/ html)
+ // ---- 3.1.2.2 image part of the related subsegment
(image / gif)
+ elseif (($part_nice[$i]['ex_level_debth'] > 1) // does
not apply to level1, b/c level1 has no parent
+ && ($part_nice[$i]['type'] == 'multipart')
+ && ($part_nice[$i]['subtype'] == 'related')
+ && ($part_nice[$parent_idx]['type'] == 'multipart')
+ && ($part_nice[$parent_idx]['subtype'] ==
'alternative'))
+ {
+ // NOTE: treat it's *child*
multipart/alternative as "container", not as "packagelist"
+ $part_nice[$i]['m_description'] = 'container';
+ $part_nice[$i]['m_keywords'] .= 'Force
Container, id_swap' .' ';
+ // SET THIS FLAG: then, in presentation loop,
see if a HTML part
+ // has a parent with this flag - if so, replace
"id" reference(s) with
+ // http... mime reference(s). Example: MS
Stationary mail's image background
+ $part_nice[$i]['m_html_related_kids'] = True;
+ $part_nice[$i]['m_keywords'] .= 'id_swap' .' ';
+ }
+
// (2) Exception: multipart/APPLEDOUBLE (ex. mac thru
X.400 gateway)
// treat as "container", not as "packagelist"
if (($part_nice[$i]['type'] == 'multipart')
@@ -1580,18 +1832,18 @@
$part_nice[$i]['m_description'] = 'container';
$part_nice[$i]['m_keywords'] .= 'Force
Container' .' ';
}
-
+
// ------ MAKE "SMART" MIME PART NUMBER -------
-
+
// ---Use Mime Number Dumb To Make ex_mime_number_smart
$new_mime_dumb = $part_nice[$i]['ex_mime_number_dumb'];
$part_nice[$i]['ex_mime_number_smart'] =
$this->mime_number_smart($part_nice, $i, $new_mime_dumb);
-
+
// ----- Make Smart Mime Number THE PRIMARY MIME
NUMBER we will use
//$part_nice[$i]['m_part_num_mime'] =
$part_nice[$i]['ex_mime_number_smart'];
// TEMPORARY HACK FOR SOCKET POP3 CLASS - feed it DUMB
mime part numbers
-
+
if
((isset($GLOBALS['phpgw_dcom_'.$this->acctnum]->dcom->imap_builtin))
&&
($GLOBALS['phpgw_dcom_'.$this->acctnum]->dcom->imap_builtin == False)
&& (stristr($this->get_pref_value('mail_server_type'),
'pop3')))
@@ -1604,32 +1856,34 @@
// Make Smart Mime Number THE PRIMARY MIME
NUMBER we will use
$part_nice[$i]['m_part_num_mime'] =
$part_nice[$i]['ex_mime_number_smart'];
}
-
+
// ------ MAKE CLICKABLE HREF TO THIS PART -------
-
+
// make an URL and a Clickable Link to directly acces
this part
//$click_info =
$this->make_part_clickable($part_nice[$i], $this->get_arg_value('folder'),
$this->get_arg_value('["msgball"]["msgnum"]'));
$click_info =
$this->make_part_clickable($part_nice[$i], $this->get_arg_value('msgball'));
$part_nice[$i]['ex_part_href'] =
$click_info['part_href'];
$part_nice[$i]['ex_part_clickable'] =
$click_info['part_clickable'];
- }
-
+ }
+
// finally, return the customized flat phpgw msg structure array
+ if ($this->debug_message_display > 2) {
$this->dbug->out('mail_msg(display).get_flat_pgw_struct: returning $part_nice
DUMP:', $part_nice); }
+ if ($this->debug_message_display > 0) {
$this->dbug->out('mail_msg(display).get_flat_pgw_struct: LEAVING we made a
$part_nice, returning it<br>'); }
return $part_nice;
}
/*!
@function pgw_msg_struct
- @abstract Mime analysis, make multilevel php message structure into a
flat array with human understandable information.
- @param $part
- @param $parent_flat_idx
- @param $feed_dumb_mime
- @param $feed_i
- @param $feed_loops
- @param $feed_debth
- @discussion Part of the home grown MIME analysis in this app. This
function is used by the
- big loop stuff in function "get_flat_pgw_struct", I can not remember
what all these params do
- at this moment.
+ @abstract Mime analysis, make multilevel php message structure into a
flat array with human understandable information.
+ @param $part
+ @param $parent_flat_idx
+ @param $feed_dumb_mime
+ @param $feed_i
+ @param $feed_loops
+ @param $feed_debth
+ @discussion Part of the home grown MIME analysis in this app. This
function is used by the
+ big loop stuff in function "get_flat_pgw_struct", I can not remember
what all these params do
+ at this moment.
@author Angles
*/
function pgw_msg_struct($part, $parent_flat_idx, $feed_dumb_mime,
$feed_i, $feed_loops, $feed_debth)
@@ -1642,19 +1896,21 @@
{
$not_set = '-1';
}
-
+
//echo 'BEGIN pgw_msg_struct<br>';
//echo var_dump($part);
//echo '<br>';
-
+
// TRANSLATE PART STRUCTURE CONSTANTS INTO STRINGS OR TRUE/FALSE
// see php manual page function.imap-fetchstructure.php
-
+
// 1: TYPE
$part_nice['type'] = $not_set; // Default value if not filled
- if (isset($part->type) && $part->type)
+ // note that 0 (the number ZERO) IS A VALID possible value
here, so 0 != not filled !
+ if ((isset($part->type))
+ && (trim((string)$part->type) != ''))
{
- switch ($part->type)
+ switch ((int)$part->type)
{
case TYPETEXT : $part_type = 'text';
break;
case TYPEMULTIPART : $part_type =
'multipart'; break;
@@ -1676,12 +1932,14 @@
{
$part_nice['type'] = 'text';
}
-
+
// 2: ENCODING
$part_nice['encoding'] = $not_set; // Default value if not
filled
- if (isset($part->encoding) && $part->encoding)
+ // note that 0 (the number ZERO) IS A VALID possible value
here, so 0 != not filled !
+ if ((isset($part->encoding))
+ && (trim((string)$part->encoding) != ''))
{
- switch ($part->encoding)
+ switch ((int)$part->encoding)
{
case ENC7BIT : $part_encoding =
'7bit'; break;
case ENC8BIT : $part_encoding =
'8bit'; break;
@@ -1816,7 +2074,7 @@
}
}
// ADDITIONAL INFORMATION (often uses array key "ex_" )
-
+
// "dumb" mime part number based only on array position, will
be made "smart" later
$part_nice['ex_mime_number_dumb'] = $feed_dumb_mime;
$part_nice['ex_parent_flat_idx'] = $parent_flat_idx;
@@ -1824,45 +2082,45 @@
$part_nice['ex_level_iteration'] = $feed_i;
$part_nice['ex_level_max_loops'] = $feed_loops;
$part_nice['ex_level_debth'] = $feed_debth;
-
+
//echo 'BEGIN DUMP<br>';
//echo var_dump($part_nice);
//echo '<br>END DUMP<br>';
-
+
return $part_nice;
}
/*!
@function mime_number_smart
- @abstract Make a "dumb" mime part number (based only on array position)
into a "Smart" mime
- number that a server understands as per the RFC for IMAP.
- @param $part_nice
- @param $flat_idx
- @param $new_mime_dumb
- @discussion Part of the home grown MIME analysis in this app. So called
"dumb" mime number is
- based only on the zero based array location of the part. The array is
like a tree, the numbers like
- branches, all in numerical sequence. However, to get a MIME part from a
server the "dumb" number
- must be changed into the kind of part numbering as per the RFC for
IMAP. As an aside, note that in
- certain places where I know I am using the sockets class, not the PHP
imap extension, I take a shortcut
- and pass the "dumb" number to the sockets dcom class because it is
easier to do straing array number location.
- However, for any situation interacting with a real IMAP server requires
the "smart" conversion done
- in this function.
+ @abstract Make a "dumb" mime part number (based only on array position)
into a "Smart" mime
+ number that a server understands as per the RFC for IMAP.
+ @param $part_nice
+ @param $flat_idx
+ @param $new_mime_dumb
+ @discussion Part of the home grown MIME analysis in this app. So called
"dumb" mime number is
+ based only on the zero based array location of the part. The array is
like a tree, the numbers like
+ branches, all in numerical sequence. However, to get a MIME part from a
server the "dumb" number
+ must be changed into the kind of part numbering as per the RFC for
IMAP. As an aside, note that in
+ certain places where I know I am using the sockets class, not the PHP
imap extension, I take a shortcut
+ and pass the "dumb" number to the sockets dcom class because it is
easier to do straing array number location.
+ However, for any situation interacting with a real IMAP server requires
the "smart" conversion done
+ in this function.
@author Angles
*/
function mime_number_smart($part_nice, $flat_idx, $new_mime_dumb)
{
$not_set = $this->not_set;
-
+
// ---- Construct a "Smart" mime number
-
+
//$debug = True;
$debug = False;
//if (($flat_idx >= 25) && ($flat_idx <= 100))
//{
// $debug = True;
//}
-
+
if ($debug) { $this->dbug->out('ENTER mime_number_smart<br>'); }
if ($debug) { $this->dbug->out('fed var flat_idx: '.
$flat_idx.'<br>'); }
if ($debug) { $this->dbug->out('fed var new_mime_dumb: '.
$new_mime_dumb.'<br>'); }
@@ -1872,7 +2130,7 @@
$smart_mime_number = 'error 1 in mime_number_smart';
break;
}
-
+
// explode new_mime_dumb into an array
$exploded_mime_dumb = Array();
if (strlen($new_mime_dumb) == 1)
@@ -1885,14 +2143,14 @@
if ($debug) { $this->dbug->out('strlen(new_mime_dumb) =
1 :: FALSE<br>'); }
$exploded_mime_dumb = explode('.', $new_mime_dumb);
}
-
+
// cast all values in exploded_mime_dumb as integers
for ($i = 0; $i < count($exploded_mime_dumb); $i++)
{
$exploded_mime_dumb[$i] = (int)$exploded_mime_dumb[$i];
}
if ($debug) { $this->dbug->out('exploded_mime_dumb
'.serialize($exploded_mime_dumb).'<br>'); }
-
+
// make an array of all parts of this family tree, from the
current part (the outermost) to innermost (closest to debth level 1)
$dumbs_part_nice = Array();
//loop BACKWARDS
@@ -1915,11 +2173,11 @@
}
//if ($debug) { $this->dbug->out('dumbs_part_nice serialized:
'.serialize($dumbs_part_nice) .'<br>'); }
//if ($debug) { $this->dbug->out('serialize exploded_mime_dumb:
'.serialize($exploded_mime_dumb).'<br>'); }
-
+
// NOTE: Packagelist -> Container EXCEPTION Conversions
// a.k.a "Exceptions for Less-Standart Subtypes"
// are located in the analysis loop done that BEFORE you enter
this function
-
+
// Reconstruct the Dumb Mime Number string into a "SMART" Mime
Number string
// RULE: Dumb Mime parts that have "m_description" =
"packagelist" (i.e. it's a header part)
// should be ommitted when constructing the Smart Mime
Number
@@ -1927,7 +2185,7 @@
// (a) debth 1 parts that are "packagelist" *never* get
altered in any way
// (b) outermost debth parts that are "packagelist" get a
value of "0", not ommitted
// (c) for 2 "packagelist"s in sucession, the first one
gets a "1", not ommitted
-
+
// apply the rules
$smart_mime_number_array = Array();
for ($i = 0; $i < count($dumbs_part_nice); $i++)
@@ -1968,7 +2226,7 @@
}
}
}
-
+
// for 2 "packagelist"s in sucession, the first one gets a "1",
not ommitted
for ($i = 0; $i < count($dumbs_part_nice); $i++)
{
@@ -1979,7 +2237,7 @@
$smart_mime_number_array[$i-1] = 1;
}
}
-
+
// make the "smart mime number" based on the info gathered and
the above rules
// as applied to the smart_mime_number_array
$smart_mime_number = '';
@@ -2001,20 +2259,20 @@
/*!
@function make_part_clickable
- @abstract message text which could be an href or mail to can be made
clickable.
- @param $part_nice
- @param $msgball
+ @abstract message text which could be an href or mail to can be made
clickable.
+ @param $part_nice
+ @param $msgball
@author Inherited from previous maintainer, Angles refined only
*/
function make_part_clickable($part_nice, $msgball)
{
$not_set = $this->not_set;
-
+
// Part Number used to request parts from the server
$m_part_num_mime = $part_nice['m_part_num_mime'];
-
+
$part_name = $part_nice['ex_part_name'];
-
+
// make a URL to directly access this part
if ($part_nice['type'] != $not_set)
{
@@ -2050,9 +2308,11 @@
.'&type=' .$url_part_type
.'&subtype=' .$url_part_subtype
.'&name=' .$url_part_name
- .'&encoding=' .$url_part_encoding);
+ .'&encoding=' .$url_part_encoding);
// Make CLICKABLE link directly to this attachment or part
$href_part_name = $this->decode_header_string($part_name);
+ // escape certain undesirable chars before HTML display
+ $href_part_name =
$this->htmlspecialchars_encode($href_part_name);
// ex_part_clickable
$ex_part_clickable = '<a
href="'.$ex_part_href.'">'.$href_part_name.'</a>';
// put these two vars in an array, and pass it back to the
calling process
@@ -2066,10 +2326,10 @@
@function make_clickable
@abstract message text which could be an href or mail to can be made
clickable.
@author See Discussion
- @discussion This code inherited from previous maintainer, who said this
-
+ @discussion This code inherited from previous maintainer, who said this
-
function make_clickable taken from text_to_links() in the SourceForge
Snipplet Library
http://sourceforge.net/snippet/detail.php?type=snippet&id=100004
- modified to make mailto: addresses compose in phpGW (not by Angles)
+ modified to make mailto: addresses compose in phpGW (not by Angles)
*/
function make_clickable($data, $folder)
{
@@ -2087,6 +2347,7 @@
$line = eregi_replace("(http://[^ )\r\n]+)","<A
href=\"\\1\" target=\"_new\">\\1</A>",$line);
$line = eregi_replace("(https://[^ )\r\n]+)","<A
href=\"\\1\" target=\"_new\">\\1</A>",$line);
$line = eregi_replace("(ftp://[^ )\r\n]+)","<A
href=\"\\1\" target=\"_new\">\\1</A>",$line);
+ $line = eregi_replace("(irc://[^ )\r\n]+)","<A
href=\"\\1\">\\1</A>",$line);//added by skwashd for chatzilla :)
$line =
eregi_replace("([-a-z0-9_]+(\.[_a-z0-9-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)+))",
"<a
href=\"".$GLOBALS['phpgw']->link("/".$GLOBALS['phpgw_info']['flags']['currentapp']."/compose.php","folder=".$this->prep_folder_out($folder))
."&to=\\1\">\\1</a>", $line);
@@ -2100,7 +2361,7 @@
@function has_this_param
@abstract does a MIME param array contain a certain attribute.
@param $param_array
- @param $needle
+ @param $needle
@author Angles
@discussion can take as input either a php structure or an anglemail
flat part array.
For example, an attribute could be "filename" and its value could be
"image.png", this
@@ -2148,7 +2409,7 @@
/*!
@function array_keys_str
@abstract debug function, report all "keys" in an associative array of
"key - value"
- @param $my_array
+ @param $my_array
@author Angles
*/
function array_keys_str($my_array)
@@ -2164,8 +2425,8 @@
@param none, it uses the class args described below in "discussion"
@result string which has either (a) a langed report to show the user
about the move or delete that just occured
or (b) an empty string indicating no move or delete actions were taken,
so none need to report anything
- @discussion See the example for the discussion.
- @example This is really the discussion. This function uses the
following class args
+ @discussion See the example for the discussion.
+ @example This is really the discussion. This function uses the
following class args
['args']['td'] "td" means "Total Deleted", if it's filled it
contains the number of messages that were deleted
['args']['tm'] "tm" means "Total Moved", if it's filled it
contains the number of messages that were moved
['args']['tf'] "tf" means "To Folder", if it's filled it
contains the name of the folder that messages were moved to
@@ -2206,25 +2467,28 @@
&& ($this->get_arg_value('tf') != ''))
{
$_tf =
$this->prep_folder_in($this->get_arg_value('tf'));
+ // NOTE if the folder name has html unfriendly
chars, like " or <, we need to do this just in case
+ //echo '$this->htmlspecialchars_encode($_tf)
['.$this->htmlspecialchars_encode($_tf).'] <br>';
+ $_tf = $this->htmlspecialchars_encode($_tf);
}
else
{
$_tf = 'empty';
}
// with the name of the "To Folder" we can build our
report string
- if ($this->get_arg_value('tm') == 0)
+ if ($this->get_arg_value('tm') == 0)
{
// these args are filled, indicating a MOVE was
attempted
// but since 0 messages were in fact moved,
there must have been an error
- $report_this = lang("Error moving messages
to").' '.$_tf;
+ $report_this = lang('Error moving messages
to').' '.$_tf;
}
elseif ($this->get_arg_value('tm') == 1)
{
- $report_this = lang("1 message has been moved
to").' '.$_tf;
+ $report_this = lang('1 message has been moved
to').' '.$_tf;
}
else
{
- $report_this = $this->get_arg_value('tm').'
'.lang("messages have been moved to").' '.$_tf;
+ $report_this = $this->get_arg_value('tm').'
'.lang('messages have been moved to').' '.$_tf;
}
}
else
@@ -2257,24 +2521,24 @@
/*!
@function report_total_foldersize_conditional
- @abstract MAYBE get the total of all messges sizes in a folder added up
to "folder size" ONLY IF SPECIFIED.
- @param $force_showsize (boolean) OPTIONAL, if not provided the arg
value "force_showsize" is used, if available,
- which is usually submitted via GPC by the user. However, if this param
IS provided, it is used instead
- of the arg value (overriding the arg value). In which case, if True,
then we really so get the size, if False this function
- does NOT get the size. If neither the arg value not this param are
specified, the default is False, do not
- get size data.
+ @abstract MAYBE get the total of all messges sizes in a folder added up
to "folder size" ONLY IF SPECIFIED.
+ @param $force_showsize (boolean) OPTIONAL, if not provided the arg
value "force_showsize" is used, if available,
+ which is usually submitted via GPC by the user. However, if this param
IS provided, it is used instead
+ of the arg value (overriding the arg value). In which case, if True,
then we really so get the size, if False this function
+ does NOT get the size. If neither the arg value not this param are
specified, the default is False, do not
+ get size data.
@result string, either (a) folder size nicely formatted for human
readability, or (b) an empty string
if it was not OK to obtain the data according to the speed skip test
- @discussion total size of all emails in this folder added up, if its
OK to get that data.
- Getting folder size *can* take long time if alot of mail is in the
folder, which put unneeded load on the IMAP server,
+ @discussion total size of all emails in this folder added up, if its
OK to get that data.
+ Getting folder size *can* take long time if alot of mail is in the
folder, which put unneeded load on the IMAP server,
Additionally, there are 2 ways to get folder stats about a folder, one
way ALWAYS requests the size from
- the mailserver, the other way does NOT request the size from the
mailserver. For speed reasons,
- we only use the way that does NOT ask for the size, and additionally we
may cache that data too.
- However, if the user specifically requests the folder size, only then
do we actually use the IMAP function
- that will return the size. If various logic determines we are
specifically to get the size data, then we
- get the data and return it in human formatted format. Otherwise we do
NOT get the size, and return
- an empty string.
- @author Angles
+ the mailserver, the other way does NOT request the size from the
mailserver. For speed reasons,
+ we only use the way that does NOT ask for the size, and additionally we
may cache that data too.
+ However, if the user specifically requests the folder size, only then
do we actually use the IMAP function
+ that will return the size. If various logic determines we are
specifically to get the size data, then we
+ get the data and return it in human formatted format. Otherwise we do
NOT get the size, and return
+ an empty string.
+ @author Angles
*/
function
report_total_foldersize_conditional($force_showsize='##NOTHING##')
{
@@ -2297,11 +2561,16 @@
// in this case, user has requested override of this
speed skip option
$do_show_size = True;
}
+ elseif ($this->get_isset_pref('show_foldersize'))
+ {
+ // user has set the pref to always show the size of the
folder
+ $do_show_size = True;
+ }
// if we get to here and $do_show_size has not specifically
been set to True, then False is the fallback default
-
+
// if it's ok to obtain size, and size IS obtained, this
$return_folder_size will be filled
$return_folder_size = '';
-
+
// ---- Get The Folder Size if it's OK ----
if ($do_show_size)
{
@@ -2311,35 +2580,35 @@
}
return $return_folder_size;
}
-
+
/*!
@function get_msg_list_display
@abstract make an array containing all necessary data to display an
"index.php" type list of mesasages
- @param $folder_info (array) OPTIONAL. Array elements as defined in
return from
- function "get_folder_status_info". This is primarily a time saver, if
you already have the data,
- then pass it, else this function will obtain the data for itself.
- @param $folder_info (array of integers) OPTIONAL. integers representing
a list of message numbers we
- should display, pass this data if you have search results to show, for
example. If this is not present,
- then this function get a numbered array list of all message numbers in
that folder, sorted and ordered
- according to preferences and/or user submitted page view args.
- @result array See Example for an explanation of what is in the returned
array.
- @discussion Kind of a "black box" function to generate all data needed
to make a message
- list page. This function returns an associative array of data only, no
markup (I think).
- See the Example for more information.
- @example This is the structure of the associative array returned by
this function.
+ @param $folder_info (array) OPTIONAL. Array elements as defined in
return from
+ function "get_folder_status_info". This is primarily a time saver, if
you already have the data,
+ then pass it, else this function will obtain the data for itself.
+ @param $folder_info (array of integers) OPTIONAL. integers representing
a list of message numbers we
+ should display, pass this data if you have search results to show, for
example. If this is not present,
+ then this function get a numbered array list of all message numbers in
that folder, sorted and ordered
+ according to preferences and/or user submitted page view args.
+ @result array See Example for an explanation of what is in the returned
array.
+ @discussion Kind of a "black box" function to generate all data needed
to make a message
+ list page. This function returns an associative array of data only, no
markup (I think).
+ See the Example for more information.
+ @example This is the structure of the associative array returned by
this function.
"first_item" boolean, flag indicating this is the first item in the
array, the first message
to display, states the obvious, but the index tpl uses it to
show a form tag only once
"back_color" used in html UI's to alternate the color or each row of
data
"has_attachment" attachment dection code has determined that this
message has attachment(s)
which tells the UI to show the user something, like a paperclip
image.
- "msgnum" the number the mail server has assigned this message, used for
fetching.
- "subject" message subject text suitable for display, text only.
+ "msgnum" the number the mail server has assigned this message, used for
fetching.
+ "subject" message subject text suitable for display, text only.
"subject_link" URL that will request this message from the server, use
with "subject" to make an HREF
"size" message size suitable for display
- "is_unseen" this message has NOT yet been viewed by the client.
- "from_name" Part 1 of 2 of the From String to show the user. This part
1 is the "personal"
- data of the From person if it's available, if not we have no
choice but to show
- the plain address of the from person.
+ "is_unseen" this message has NOT yet been viewed by the client.
+ "from_name" Part 1 of 2 of the From String to show the user. This part
1 is the "personal"
+ data of the From person if it's available, if not we have no
choice but to show
+ the plain address of the from person.
"display_address_from" Part 2 of 2 of the From String to show the user.
This part 2 contains
any additional info the user prefers to see in the From String,
which can be either
(a) the plain address of the From person, or
@@ -2373,7 +2642,7 @@
//$debug_msg_list_display = 3;
$debug_msg_list_display = $this->debug_index_page_display;
if ($debug_msg_list_display > 0) {
$this->dbug->out('mail_msg_display: get_msg_list_display('.__LINE__.'):
ENTERING<br>'); }
-
+
if(!$folder_info)
{
$folder_info=array();
@@ -2391,21 +2660,21 @@
$folder_info = array();
$folder_info = $this->get_folder_status_info();
/*!
- @capability get_folder_status_info info used in the
get_msg_list_display function.
- @discussion Duhhh, why is this document info here, it
belongs with the
- "get_folder_status_info" itself. Anyway, here goes.
- Recall that the "get_folder_status_info" function
returns this array.
- UPDATE ME this has changed some.
- @example UPDATE ME this should be moved to the
"get_folder_status_info" doc string itself.
+ @capability get_folder_status_info info used in the
get_msg_list_display function.
+ @discussion Duhhh, why is this document info here, it
belongs with the
+ "get_folder_status_info" itself. Anyway, here goes.
+ Recall that the "get_folder_status_info" function
returns this array.
+ UPDATE ME this has changed some.
+ @example UPDATE ME this should be moved to the
"get_folder_status_info" doc string itself.
folder_info["is_imap"] boolean - pop3 server do not
know what is "new" or not, IMAP servers do
folder_info["folder_checked"] string - the folder
checked, as processed by the msg class, which may have done a lookup on the
folder name
folder_info["alert_string"] string - langd string to
show the user about status of new messages in this folder
folder_info["number_new"] integer - for IMAP the number
"recent" and/or "unseen"messages, for POP3 the total number of messages
folder_info["number_all"] integer - for IMAP and POP3
the total number messages in the folder
- and some validity data used for caching.
+ and some validity data used for caching.
*/
}
-
+
// initialize return structure
$msg_list_display = Array();
// if no message are available to show, return an empty aray
@@ -2413,29 +2682,37 @@
{
return $msg_list_display;
}
-
+
// we have messages to list, continue...
// if we were passed an array of message numbers to show, use
that, if not then
// get a numbered array list of all message numbers in that
folder, sorted and ordered
if (!$msgball_list)
{
+ // NOW WE USE FOLDER NAME ALSO IN THE DATA KEY FOR
MSGBALL_LIST
+ $ex_folder = $folder_info['fldball']['folder'];
+
// msgball_list may be thousands of items, try to fill
the cache and get a reference
//GLOBALS[phpgw_session][phpgw_app_sessions][email]
- $this->get_msgball_list();
- $ex_acctnum = $this->get_acctnum();
+ // fill the cache ? - NO this is folly
+ //$this->get_msgball_list();
+ //$ex_acctnum = $this->get_acctnum();
+ // TESTING get the acctnum from the folder info
+ $ex_acctnum = $folder_info['fldball']['acctnum'];
if (($this->session_cache_enabled == True)
- &&
(isset($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list']['msgball_list'])))
+ &&
(isset($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list'][$ex_folder]['msgball_list'])))
//&&
(isset($GLOBALS['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list']['msgball_list'])))
{
- $msgball_list =&
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list']['msgball_list'];
+ $msgball_list =&
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list'][$ex_folder]['msgball_list'];
//$msgball_list =&
$GLOBALS['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list']['msgball_list'];
- //{ echo 'mail_msg_display:
get_msg_list_display('.__LINE__.'): $msgball_list *REFERENCE* DUMP:<pre>';
print_r($msgball_list); echo '</pre>'; }
+ //{ echo 'mail_msg_display:
get_msg_list_display('.__LINE__.'): $msgball_list *REFERENCE* DUMP:<pre>';
print_r($msgball_list); echo '</pre>'; }
//$msgball_list =
$GLOBALS['phpgw_session']['phpgw_app_sessions']['email']['dat'][$ex_acctnum]['msgball_list']['msgball_list'];
}
else
{
// ok we could not obtain a reference for some
reason, get a COPY then
- $msgball_list = $this->get_msgball_list();
+ //$msgball_list = $this->get_msgball_list();
+ // EXPERIMENT with passing arge to this
+ $msgball_list =
$this->get_msgball_list($ex_acctnum, $ex_folder);
}
}
@@ -2451,7 +2728,7 @@
{
$totaltodisplay = $folder_info['number_all'];
}
-
+
if ($this->get_isset_arg('start'))
{
$start = $this->get_arg_value('start');
@@ -2465,7 +2742,7 @@
for ($i=$start; $i < $totaltodisplay; $i++)
{
$this_loop_msgball =
$this->ball_data_parse_str($msgball_list[$i]);
- if ($debug_msg_list_display > 2) {
$this->dbug->out('mail_msg_display: get_msg_list_display: $msgball_list['.$i.']
['.$msgball_list[$i].'] $this_loop_msgball data DUMP:', $this_loop_msgball); }
+ if ($debug_msg_list_display > 2) {
$this->dbug->out('mail_msg_display: get_msg_list_display: $msgball_list['.$i.']
['.$msgball_list[$i].'] $this_loop_msgball data DUMP:', $this_loop_msgball); }
// we use $x to sequentially fill the $msg_list_display
array
//$x++;
$x = $x + 1;
@@ -2488,18 +2765,18 @@
////$msg_list_display[$x]['back_color'] =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($msg_list_display[$x-1]['back_color']);
/*!
- @capability Inside "get_msg_list_display", SHOW
ATTACHMENT CLIP issue.
+ @capability Inside "get_msg_list_display", SHOW
ATTACHMENT CLIP issue.
@discussion SKIP this for POP3 - fetchstructure for
POP3 requires download the WHOLE msg
- so PHP can build the fetchstructure data (IMAP server
does this internally). This
- applies to builtin IMAP extension and the sockets POP3
class.
+ so PHP can build the fetchstructure data (IMAP server
does this internally). This
+ applies to builtin IMAP extension and the sockets POP3
class.
*/
-
+
// THIS skips attachmant check only for POP3
socket (not build in) situations
//if
((isset($GLOBALS['phpgw_dcom_'.$this->acctnum]->dcom->imap_builtin))
//&&
($GLOBALS['phpgw_dcom_'.$this->acctnum]->dcom->imap_builtin == False)
//&&
(stristr($this->get_pref_value('mail_server_type'), 'pop3')))
// ... but ...
- // THIS skips attachment check for ALL POP3
situations
+ // THIS skips attachment check for ALL POP3
situations
// it is WAY SLOW to check for attachments like
this with POP3
if (stristr($this->get_pref_value('mail_server_type'),
'pop3'))
{
@@ -2513,16 +2790,64 @@
// now examine that msg_struct for signs of an
attachment
$msg_list_display[$x]['has_attachment'] =
$this->has_real_attachment($msg_structure);
}
-
+
// Message Information: THE MESSAGE'S HEADERS ENVELOPE
DATA
$hdr_envelope = $this->phpgw_header($this_loop_msgball);
-
+
+ /*
+ // begin GMT handling by "acros"
+ // pongo bien la hora de los correos (GMT)
+# echo"hora inicial $hdr_envelope->date<br>";
+# echo"hora inicial
$hdr_envelope->udate<br>";
+///modificacion
+$msg_date2=$hdr_envelope->date;
+$comma = strpos($msg_date2,',');
+ if($comma)
+ {
+ $msg_date2 = substr($msg_date2,$comma + 2);
+ }
+ //echo 'Msg Date : '.$msg_date."<br>\n";
+ $dta = array();
+ $ta = array();
+
+ $dta = explode(' ',$msg_date2);
+ $ta = explode(':',$dta[3]);
+ if(substr($dta[4],0,3) <> 'GMT')
+ {
+ $tzoffset = substr($dta[4],0,1);
+ (int)$tzhours = substr($dta[4],1,2);
+ (int)$tzmins = substr($dta[4],3,2);
+#echo"$ta[0] y $tzoffset";
+ switch ($tzoffset)
+ {
+ case '+':
+ (int)$ta[0] -= (int)$tzhours;
+ (int)$ta[1] -= (int)$tzmins;
+#echo"$ta[0]";
+ break;
+ case '-':
+ (int)$ta[0] += (int)$tzhours;
+ (int)$ta[1] += (int)$tzmins;
+ break;
+ }
+ }
+
+ $new_time =
mktime($ta[0],$ta[1],$ta[2],$GLOBALS['month_array'][strtolower($dta[1])],$dta[0],$dta[2])
- ((60 * 60) *
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tzoffset']));
+$new_time2=gmdate("D, d M Y H:m:s",$new_time)." GMT";
+$hdr_envelope->date = $new_time2;
+$hdr_envelope->udate = $new_time;
+#echo"hora final $hdr_envelope->udate<br>";
+#echo"hora final $hdr_envelope->date<br>";
+ #$message_date =
$GLOBALS['phpgw']->common->show_date($msg_headers->udate);
+//fin modificacion
+// end GMT handling by "acros"
+ */
// MESSAGE REFERENCE (a) NUMBER (b) FOLDER (c) ACCTNUM
and (d) FAKE_URL EMBEDDED MULTI DATA
$msg_list_display[$x]['msgnum'] =
$this_loop_msgball['msgnum'];
$msg_list_display[$x]['folder'] =
$this_loop_msgball['folder'];
$msg_list_display[$x]['acctnum'] =
$this_loop_msgball['acctnum'];
$msg_list_display[$x]['uri'] =
$this_loop_msgball['uri'];
-
+
// SUBJECT
// NOTE: the acctnum MUST be matched to this individual
message and folder
$msg_list_display[$x]['subject'] =
$this->get_subject($hdr_envelope,'');
@@ -2533,7 +2858,7 @@
.'&sort='.$this->get_arg_value('sort')
.'&order='.$this->get_arg_value('order')
.'&start='.$this->get_arg_value('start'));
-
+
// SIZE
if ($this->newsmode)
{
@@ -2545,7 +2870,7 @@
{
$msg_list_display[$x]['size'] =
$this->format_byte_size($hdr_envelope->Size);
}
-
+
// FLAG HANDLING - initialize some vars
$msg_list_display[$x]['is_unseen'] = False;
$msg_list_display[$x]['is_answered'] = False;
@@ -2559,26 +2884,26 @@
if (stristr($msg_list_display[$x]['flags'], 'Seen') ==
False)
{
$msg_list_display[$x]['is_unseen'] = True;
- }
+ }
if (stristr($msg_list_display[$x]['flags'], 'Answered'))
{
$msg_list_display[$x]['is_answered'] = True;
- }
+ }
if (stristr($msg_list_display[$x]['flags'], 'Flagged'))
{
$msg_list_display[$x]['is_flagged'] = True;
- }
+ }
if (stristr($msg_list_display[$x]['flags'], 'Deleted'))
{
$msg_list_display[$x]['is_deleted'] = True;
- }
+ }
if (stristr($msg_list_display[$x]['flags'], 'Draft'))
{
$msg_list_display[$x]['is_draft'] = True;
- }
+ }
// FROM and REPLY TO HANDLING
-
+
// ---- What to use as From Person's target email
address ----
// $reply is used to construct the "from link" below,
it determines the target address
// to send mail to when the user clicks on a clickable
"from string" that is an HREF
@@ -2599,14 +2924,14 @@
}
//$replyto = $this->make_rfc2822_address($reply);
$replyto = $reply->mailbox.'@'.$reply->host;
-
+
/*!
@capability FROM DISPLAYABLE String
@abstract display the "from" data according to user
preferences
- @result string which is actually part 2 of 2 of the
From String,
+ @result string which is actually part 2 of 2 of the
From String,
with "from_name" being part 1 of 2.
- @discussion See the Example for some background on the
terms used here.
- @example First some background on the terms used here
+ @discussion See the Example for some background on the
terms used here.
+ @example First some background on the terms used here
* "plain address" means the "address@hidden" part
* "personal" means the name string that may be
associated with that address
in the headers that would look like this if
present: "Joe Dough" <address@hidden>
@@ -2617,7 +2942,7 @@
of course, if the personal data is not available, then
we show the plain anyway
ISSUE 3: and if that plain address should be the "from"
or "reply to (if any)" as the plain address part
of the display string. There IS actually an option to
display the plain address of the specified
- "ReplyTo" header in the From String the user wants to
see.
+ "ReplyTo" header in the From String the user wants to
see.
*/
$from = $hdr_envelope->from[0];
if (!$from->personal)
@@ -2633,7 +2958,9 @@
{
$personal = $replyto;
}
-
+ // escape certain undesirable chars before HTML display
+ $personal = $this->htmlspecialchars_encode($personal);
+
if (($this->get_pref_value('show_addresses') == 'from')
&& ($personal != $from->mailbox.'@'.$from->host))
{
@@ -2654,7 +2981,7 @@
@capabability From String includes ReplyTo
plain address
@discussion according to preferences, for the
displayed "From" string the user wants to
see the "personal" data AND the plain address
of the "ReplyTo" header, if available.
- To visually indicate this is reply to address,
we surround in in < >
+ To visually indicate this is reply to address,
we surround in in < >
instead of ( ) which we use to surround the
"from" plain address, as used above.
Note: even though we use the "personal" name
from the From header, we show
with it the plain address from the ReplyTo
header. This is how this preference works :)
@@ -2667,7 +2994,7 @@
{
/*!
@capabability user sees ONLY the "plain
address" of the From person
- @discussion The displayed "From String" the
user will see is
+ @discussion The displayed "From String" the
user will see is
the "plain address" of the From person ONLY, no
"personal" data is ahown.
This happens as a fallback option when the
user's assumed desire to see the
"personal" data is unable to be fulfilled
because that "personal" data for the
@@ -2676,11 +3003,12 @@
$msg_list_display[$x]['display_address_from'] =
'';
$msg_list_display[$x]['who_to'] =
$from->mailbox.'@'.$from->host;
}
-
+
// ---- From Name ----
// Part 1 of 2 of the From string (see above)
// NOTE: wasn't this decode_header_string proc already
done above?
- $msg_list_display[$x]['from_name'] =
$this->decode_header_string($personal);
+ //$msg_list_display[$x]['from_name'] =
$this->decode_header_string($personal);
+ $msg_list_display[$x]['from_name'] = $personal;
// ---- From Link ----
// this is a URL that can be used to turn the "From
String" into a clickable link
@@ -2700,7 +3028,7 @@
{
$msg_list_display[$x]['from_link'] =
$msg_list_display[$x]['from_link'] .'&personal='.urlencode($personal);
}
-
+
// if it's a long plain address with no spaces, then
add a space to the TD can wrap the text
if ((!strstr($msg_list_display[$x]['from_name'], " "))
&& (strlen($msg_list_display[$x]['from_name']) > 15)
@@ -2712,6 +3040,7 @@
// DATE
// date_time has both date and time, which probably is
long enough to make a TD cell wrap text to 2 lines
$msg_date_time =
$GLOBALS['phpgw']->common->show_date($hdr_envelope->udate);
+//echo"$msg_date_time";
if($GLOBALS['phpgw']->common->show_date($hdr_envelope->udate,'Ymd') !=
date('Ymd'))
{
// this strips the time part, leaving only the
date, better for single line TD cells
@@ -2725,17 +3054,24 @@
// *raw* date for utility purposes, such as appending
and specifying a date
// php built in append does not let you specify the
data during an append
//$msg_list_display[$x]['msg_date_raw'] =
$hdr_envelope->udate;
-
+
// TO info for the "Sent" folder
// ---- To: Message Data -----
$to_data_array = array();
if (!$hdr_envelope->to)
{
- $to_data_final = lang('undisclosed_recipients');
+ $to_data_final = lang('undisclosed recipients');
}
else
{
- for ($z = 0; $z < count($hdr_envelope->to);
$z++)
+ $to_loops = count($hdr_envelope->to);
+ // begin test of Maz Num of To loop limitation
+ $max_to_loops = 25;
+ if ($to_loops > $max_to_loops)
+ {
+ $to_loops = $max_to_loops;
+ }
+ for ($z = 0; $z < $to_loops; $z++)
{
$topeople = $hdr_envelope->to[$z];
$to_plain =
$topeople->mailbox.'@'.$topeople->host;
@@ -2745,39 +3081,41 @@
}
else
{
- $to_person =
$GLOBALS['phpgw']->msg->decode_header_string($topeople->personal);
+ $to_person =
$this->decode_header_string($topeople->personal);
}
+ // escape certain undesirable chars
before HTML display
+ $to_person =
$this->htmlspecialchars_encode($to_person);
$to_data_array[$z] = $to_person;
}
// throw a spacer comma in between addresses,
if more than one
$to_data_final = implode(', ',$to_data_array);
}
$msg_list_display[$x]['to_data_final'] = $to_data_final;
-
+
}
if ($debug_msg_list_display > 2) {
$this->dbug->out('mail_msg_display: get_msg_list_display: exiting
$msg_list_display[] DUMP', $msg_list_display); }
if ($debug_msg_list_display > 0) {
$this->dbug->out('mail_msg_display: get_msg_list_display('.__LINE__.'):
LEAVING<br>'); }
return $msg_list_display;
}
-
+
/*!
@function _image_on
@abstract temp replacement for phpgwapi image_on until it supports
images in different dirs.
- @discussion Email themes have a group of similar looking images grouped
into a directory with
- somewhat standard names that AngleMail understands as a themed image
set. phpgwapi does not
- currently support subdirectories under the template images directory.
Params are only to match the
- phpgw api function, we do not really use them. As of this writting, Feb
2003, images used for all themes,
- i.e. are not in a theme subdir but are used, are check and attach on
the index page, they are not even
- sized, and, these are sized but not themed, on the message view page,
are view_nofmt, view_formatted,
- view_headers, view_raw, and view_printable. Remember if these are
themed they must be moved
- into the subdirs, all of them, even if they are copies, and removed
from the main images dir, so it is
- obvious if they are group themed or not.
+ @discussion Email themes have a group of similar looking images grouped
into a directory with
+ somewhat standard names that AngleMail understands as a themed image
set. phpgwapi does not
+ currently support subdirectories under the template images directory.
Params are only to match the
+ phpgw api function, we do not really use them. As of this writting, Feb
2003, images used for all themes,
+ i.e. are not in a theme subdir but are used, are check and attach on
the index page, they are not even
+ sized, and, these are sized but not themed, on the message view page,
are view_nofmt, view_formatted,
+ view_headers, view_raw, and view_printable. Remember if these are
themed they must be moved
+ into the subdirs, all of them, even if they are copies, and removed
from the main images dir, so it is
+ obvious if they are group themed or not.
@author Angles
*/
function _image_on($appname,$image,$extension='_on',$navbar=False)
{
- //$prefer_ext = '.gif';
- $prefer_ext = '.png';
+ $prefer_ext = '.gif';
+ //$prefer_ext = '.png';
return
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$appname.'/templates/default/images'.'/'.$image.$prefer_ext;
}
====================================================
Index: email/inc/class.mail_msg_wrappers.inc.php
diff -u email/inc/class.mail_msg_wrappers.inc.php:1.38
email/inc/class.mail_msg_wrappers.inc.php:1.39
--- email/inc/class.mail_msg_wrappers.inc.php:1.38 Sun May 25 21:38:27 2003
+++ email/inc/class.mail_msg_wrappers.inc.php Thu Dec 30 23:13:50 2004
@@ -42,6 +42,15 @@
class mail_msg_wrappers extends mail_msg_base
{
+ /*!
+ @function mail_msg_wrappers
+ @abstract CONSTRUCTOR place holder, does nothing
+ */
+ function mail_msg_wrappers()
+ {
+ return;
+ }
+
// ==== Functions For Getting Information About A Message ====
/*!
@@ -152,7 +161,7 @@
/*!
@function phpgw_header
- @abstract wrapper for IMAP_HEADER, phpgw supplies the nedessary
stream arg and mail_dcom reference
+ @abstract wrapper for IMAP_HEADER, phpgw supplies the necessary
stream arg and mail_dcom reference
@param $msgball (typed array)
@result returns the php IMAP_HEADER data
@discussion Wrapper supplies the needed mailsvr_stream arg to
IMAP_HEADER.
@@ -247,6 +256,10 @@
$this->ensure_stream_and_folder($msgball,
'phpgw_header'.' LINE '.__LINE__);
$mailsvr_stream =
$this->get_arg_value('mailsvr_stream', $acctnum);
$data =
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->header($mailsvr_stream,
$msgball['msgnum']);
+
+ // fix escape problem FORGET THIS FOR
NOW
+
//$this->cache_clean_phpgw_header($data);
+
// PUT THIS IN CACHE
// if "session_cache_extreme" is True
if (($data)
@@ -262,6 +275,10 @@
//$msgball['folder'] =
$this->get_arg_value('folder');
$msgball['folder'] =
$this->prep_folder_out($this->get_arg_value('folder'));
}
+
+ // fix escape problem
+
//$this->cache_clean_phpgw_header($data);
+
// this is the way we pass phpgw_header
data to the caching function
$meta_data = array();
$meta_data['msgball'] = array();
@@ -285,6 +302,107 @@
}
/*!
+ @function cache_clean_phpgw_header
+ @abstract ?
+ @param $msg_headers (php struct from header) btw it is a
refrence OOP directly on param
+ @author Angles
+ @discussion ?
+
+ function cache_clean_phpgw_header(&$msg_headers)
+ {
+ //$debug = 0;
+ $debug = 3;
+
+ if (
+ (!isset($msg_headers))
+ || (!$msg_headers )
+ //|| ($this->session_cache_extreme == False)
+ )
+ {
+ return '';
+ }
+ // toaddress
+ // to[]
+ // fromaddress
+ // from[]
+ // reply_toaddress
+ // reply_to[]
+ // senderaddress
+ // sender[]
+ // cc[]
+
+ if ($debug > 2) {
$this->dbug->out('wrappers.cache_clean_phpgw_header('.__LINE__.'): BEFORE
$msg_headers DUMP:', $msg_headers); }
+ // toaddress
+ if ($msg_headers->toaddress)
+ {
+ $msg_headers->toaddress =
addslashes($msg_headers->toaddress);
+ }
+
+ // to[]
+ if ($msg_headers->to)
+ {
+ $loops = count($msg_headers->to);
+ for($i=0;$i<$loops;$i++)
+ {
+ $thingy =& $msg_headers->to[$i];
+ $thingy->personal =
addslashes($thingy->personal);
+ }
+ }
+ // fromaddress
+ if ($msg_headers->fromaddress)
+ {
+ $msg_headers->fromaddress =
addslashes($msg_headers->fromaddress);
+ }
+ // from[]
+ if ($msg_headers->from)
+ {
+ $loops = count($msg_headers->from);
+ for($i=0;$i<$loops;$i++)
+ {
+ $thingy =& $msg_headers->from[$i];
+ $thingy->personal =
addslashes($thingy->personal);
+ }
+ }
+
+ // reply_toaddress
+ if ($msg_headers->reply_toaddress)
+ {
+ $msg_headers->reply_toaddress =
addslashes($msg_headers->reply_toaddress);
+ }
+ // reply_to[]
+ if ($msg_headers->reply_to)
+ {
+ $loops = count($msg_headers->reply_to);
+ for($i=0;$i<$loops;$i++)
+ {
+ $thingy =& $msg_headers->reply_to[$i];
+ $thingy->personal =
addslashes($thingy->personal);
+ }
+ }
+
+ // senderaddress
+ if ($msg_headers->senderaddress)
+ {
+ $msg_headers->senderaddress =
addslashes($msg_headers->senderaddress);
+ }
+ // sender[]
+ if ($msg_headers->sender)
+ {
+ $loops = count($msg_headers->sender);
+ for($i=0;$i<$loops;$i++)
+ {
+ $thingy =& $msg_headers->sender[$i];
+ $thingy->personal =
addslashes($thingy->personal);
+ }
+ }
+
+ // cc[]
+
+ if ($debug > 2) {
$this->dbug->out('wrappers.cache_clean_phpgw_header('.__LINE__.'): AFTER
$msg_headers DUMP:', $msg_headers); }
+ }
+ */
+
+ /*!
@function phpgw_fetchheader
@abstract returns the message RAW headers as a blob, or long
string.
@param $msgball (typed array)
@@ -409,6 +527,60 @@
$msgball = $this->get_arg_value('msgball');
}
$acctnum = $msgball['acctnum'];
+ // why is this next check needed?
+ if ((!isset($acctnum))
+ || ((string)$acctnum == ''))
+ {
+ $acctnum = $this->get_acctnum();
+ }
+
+ // TRY CACHED DATA
+ $cached_phpgw_fetchbody =
$this->read_session_cache_item('phpgw_fetchbody', $msgball['acctnum'],
$msgball['folder'], $msgball['msgnum'], $msgball['part_no']);
+ if ($cached_phpgw_fetchbody)
+ {
+ // notice of event
+ $this->event_msg_seen($msgball,
'phpgw_fetchbody');
+ return $cached_phpgw_fetchbody;
+ }
+ // if we get here we need to contact mailserver
+ $this->ensure_stream_and_folder($msgball,
'phpgw_fetchbody'.' LINE '.__LINE__);
+ $mailsvr_stream =
$this->get_arg_value('mailsvr_stream', $acctnum);
+ $msgnum = $msgball['msgnum'];
+ $part_no = $msgball['part_no'];
+ //echo 'mail_msg(_wrappers): phpgw_fetchbody:
processed: $acctnum: '.$acctnum.'; $mailsvr_stream:
'.serialize($mailsvr_stream).'; $msgnum: '.$msgnum.'; $part_no:
'.$part_no.'<br> * $msgball dump<pre>'; print_r($msgball); echo '</pre>';
+
+ $data = '';
+ $data =
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->fetchbody($mailsvr_stream, $msgnum,
$part_no, $flags);
+
+ if ($data)
+ {
+ // notice of event
+ $this->event_msg_seen($msgball,
'phpgw_fetchbody');
+ // SET_CACHE_ITEM
+ $meta_data = array();
+ $meta_data['msgball'] = $msgball;
+ $meta_data['phpgw_fetchbody'] = $data;
+
$this->save_session_cache_item('phpgw_fetchbody', $meta_data, $acctnum);
+ $meta_data = array();
+ return $data;
+ }
+ else
+ {
+ return False;
+ }
+ }
+
+ /*
+ // OLD FUNCTION
+ function phpgw_fetchbody($msgball='', $flags='')
+ {
+ //echo 'mail_msg(_wrappers): phpgw_fetchbody: ENTERING,
$msgball dump<pre>'; print_r($msgball); echo '</pre>';
+ if ( (!isset($msgball))
+ || ($msgball == '') )
+ {
+ $msgball = $this->get_arg_value('msgball');
+ }
+ $acctnum = $msgball['acctnum'];
if ((!isset($acctnum))
|| ((string)$acctnum == ''))
{
@@ -425,7 +597,7 @@
return
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->fetchbody($mailsvr_stream, $msgnum,
$part_no, $flags);
}
-
+ */
// ===== Functions For Getting Information About A Folder =====
// returns an array of integers which are refer to all the
messages in a folder ("INBOX") sorted and ordered
@@ -467,10 +639,16 @@
// DO NOT SPECIFY FOLDER unless you *really*
know what you are doing
// typically "best" folder and acctnum are
obtained during begin request
// right now only specialized filter searching
requires tp specify a folder
+
+ // UPDATE WE NOW USE A FOLDER ARG IN THE DATA
KEY
+ // not sure how that changes any of this, if at
all
+ // in this case, not even an acctnum was
passed, so obviously a folder is out of the question here
+
$fake_fldball = array();
$fake_fldball['acctnum'] = $acctnum;
$fake_fldball['folder'] = $folder;
- $this->ensure_stream_and_folder($fake_fldball,
'get_msgball_list'.' LINE '.__LINE__);
+ // WHY DO THIS HERE?
+
//$this->ensure_stream_and_folder($fake_fldball, 'get_msgball_list'.' LINE
'.__LINE__);
// ok, so now we KNOW the stream exists and
folder value is what we need for this desired account
}
elseif ((!isset($acctnum))
@@ -485,7 +663,14 @@
// $cached_msgball_data[msgball_list]
// $cached_msgball_data[validity]
// BUT IT RETURNS TO US THE ACTUAL "msgball_list" part,
*NOT* WITH THE OTHER STUFF TOO
- $cached_msgball_list =
$this->read_session_cache_item('msgball_list', $acctnum);
+ //$cached_msgball_list =
$this->read_session_cache_item('msgball_list', $acctnum);
+ // NOW WE USE FOLDER NAME AS A DATA KEY TOO
+ if ((!isset($folder))
+ || ((string)$folder == ''))
+ {
+ $folder =
$this->prep_folder_out($this->get_arg_value('folder', $acctnum));
+ }
+ $cached_msgball_list =
$this->read_session_cache_item('msgball_list', $acctnum, $folder);
if ($cached_msgball_list)
{
if ($this->debug_wrapper_dcom_calls > 0) {
$this->dbug->out('mail_msg(wrappers).get_msgball_list: ('.__LINE__.') LEAVING,
returning appsession cached "msgball_list"<br>'); }
@@ -495,6 +680,7 @@
}
else
{
+ if ($this->debug_wrapper_dcom_calls > 0) {
$this->dbug->out('mail_msg(wrappers).get_msgball_list: ('.__LINE__.') <font
color="brown">cached had NO DATA for "msgball_list"</font><br>'); }
// right now only specialized filter searching
requires tp specify a folder
$fake_fldball = array();
$fake_fldball['acctnum'] = $acctnum;
@@ -508,7 +694,7 @@
//{
// $server_msgnum_list =
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->sort($this->get_arg_value('mailsvr_stream',
$acctnum), $this->get_arg_value('sort', $acctnum),
$this->get_arg_value('order', $acctnum));
//}
- if ($this->debug_wrapper_dcom_calls > 0) {
$this->dbug->out('mail_msg(_wrappers): get_msgball_list: ('.__LINE__.') calling
$GLOBALS[phpgw_dcom_'.$acctnum.']->dcom->sort('.$this->get_arg_value('mailsvr_stream',
$acctnum).', '.$this->get_arg_value('sort', $acctnum).',
'.$this->get_arg_value('order', $acctnum).')<br>'); }
+ if ($this->debug_wrapper_dcom_calls > 0) {
$this->dbug->out('mail_msg(_wrappers): get_msgball_list: ('.__LINE__.') <font
color="red">MAILSERVER CALL</font> calling
$GLOBALS[phpgw_dcom_'.$acctnum.']->dcom->sort('.$this->get_arg_value('mailsvr_stream',
$acctnum).', '.$this->get_arg_value('sort', $acctnum).',
'.$this->get_arg_value('order', $acctnum).')<br>'); }
$server_msgnum_list =
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->sort($this->get_arg_value('mailsvr_stream',
$acctnum), $this->get_arg_value('sort', $acctnum),
$this->get_arg_value('order', $acctnum));
// put more information about these particular
messages into the msgball_list[] structure
@@ -566,8 +752,12 @@
$meta_data['msgball_list'] = $msgball_list;
$meta_data['validity'] = array();
$meta_data['validity']['fldball'] =
$fake_fldball;
- $this->save_session_cache_item('msgball_list',
$meta_data, $acctnum);
- if ($this->debug_wrapper_dcom_calls > 0) {
$this->dbug->out('mail_msg(_wrappers): get_msgball_list: ('.__LINE__.')
LEAVING, had to get data from server<br>'); }
+
//$this->save_session_cache_item('msgball_list', $meta_data, $acctnum);
+ // NOW WE USE FOLDER NAME ALSO IN THE DATA KEY
+ // use the folder name that was fed as a param,
since this most likely represents a good key to use
+ // just in case the msgball_list, in the
future, is a virtual one composed of msg from many folders
+ $this->save_session_cache_item('msgball_list',
$meta_data, $acctnum, $folder);
+ if ($this->debug_wrapper_dcom_calls > 0) {
$this->dbug->out('mail_msg(_wrappers): get_msgball_list: ('.__LINE__.')
LEAVING, <font color="red">had to get data from server</font><br>'); }
return $msgball_list;
}
}
@@ -1097,12 +1287,13 @@
@discussion This function handles the traditional fldball
better, a fldball["folder"] is NOT ever supposed to have
a mailsvr_callstr, and IS ALWAYS urlencoded until just before
we call the dcom class, when we urldecode it only
at that point. This function assumes this behavior, so the
typical fldball is supported by this function.
- This will be the future version of this function, code is
migratibg to this version.
+ This will be the future version of this function, code is
migrating to this version.
@author Angles
@access public
*/
function phpgw_createmailbox_ex($target_fldball)
{
+ if ($this->debug_wrapper_dcom_calls > 0) {
$this->dbug->out('phpgw_createmailbox_ex('.__LINE__.'): ENTERING: raw
$target_fldball arg ['.htmlspecialchars($target_fldball).']<br>'); }
if ((isset($target_fldball['acctnum']))
&& ((string)$target_fldball['acctnum'] != ''))
{
@@ -1127,7 +1318,7 @@
// multiple accounts means one stream may be open but
another may not
// "ensure_stream_and_folder" will verify for us,
// tell "ensure_stream_and_folder" that its NOT
NECESSARY to switch TO this folder
- $fake_fldball['no_switch_away'] = True;
+ $target_fldball['no_switch_away'] = True;
$this->ensure_stream_and_folder($target_fldball,
'phpgw_createmailbox_ex LINE ('.__LINE__.')');
// if $folder dies not have the {SERVERNAME} then add
it
//$target_folder_clean =
$this->prep_folder_in($target_fldball['folder']);
@@ -1138,7 +1329,7 @@
$target_folder_clean =
$mailsvr_callstr.$target_folder_clean;
}
$mailsvr_stream =
$this->get_arg_value('mailsvr_stream', $acctnum);
- if ($this->debug_wrapper_dcom_calls > 0) {
$this->dbug->out('phpgw_createmailbox_ex('.__LINE__.'): calling
createmailbox('.$mailsvr_stream.',
'.htmlspecialchars($target_folder_clean).'<br>'); }
+ if ($this->debug_wrapper_dcom_calls > 0) {
$this->dbug->out('phpgw_createmailbox_ex('.__LINE__.'): calling
$GLOBALS[phpgw_dcom_'.$acctnum.']->dcom->createmailbox('.serialize($mailsvr_stream).',
'.htmlspecialchars($target_folder_clean).'<br>'); }
return
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->createmailbox($mailsvr_stream,
$target_folder_clean);
}
@@ -1158,6 +1349,59 @@
}
/*!
+ @function phpgw_deletemailbox_ex
+ @abstract ?
+ @param $target_fldball (array or type "fldball") NOTE: folder
element DOES NOT NEED THE SERVER CALLSTR.
+ @discussion This function handles the traditional fldball
better, a fldball["folder"] is NOT ever supposed to have
+ a mailsvr_callstr, and IS ALWAYS urlencoded until just before
we call the dcom class, when we urldecode it only
+ at that point. This function assumes this behavior, so the
typical fldball is supported by this function.
+ This will be the future version of this function, code is
migrating to this version.
+ @author Angles
+ @access public
+ */
+ function phpgw_deletemailbox_ex($target_fldball)
+ {
+ if ($this->debug_wrapper_dcom_calls > 0) {
$this->dbug->out('phpgw_deletemailbox_ex('.__LINE__.'): ENTERING: raw
$target_fldball arg ['.htmlspecialchars($target_fldball).']<br>'); }
+ if ((isset($target_fldball['acctnum']))
+ && ((string)$target_fldball['acctnum'] != ''))
+ {
+ $target_fldball['acctnum'] =
(int)$target_fldball['acctnum'];
+ }
+ else
+ {
+ $target_fldball['acctnum'] =
$this->get_acctnum();
+ }
+ $acctnum = $target_fldball['acctnum'];
+ // if folder is blank, we *should* assume INBOX because
BUT mailsvr will give an error INBOX already exists
+ if ((isset($target_fldball['folder']))
+ || ((string)$target_fldball['folder'] != ''))
+ {
+ // good folder name, no change needed
+ }
+ else
+ {
+ $target_fldball['folder'] = 'INBOX';
+ }
+ // Make Sure Stream Exists
+ // multiple accounts means one stream may be open but
another may not
+ // "ensure_stream_and_folder" will verify for us,
+ // tell "ensure_stream_and_folder" that its NOT
NECESSARY to switch TO this folder
+ $target_fldball['no_switch_away'] = True;
+ $this->ensure_stream_and_folder($target_fldball,
'phpgw_deletemailbox_ex LINE ('.__LINE__.')');
+ // if $folder dies not have the {SERVERNAME} then add
it
+ //$target_folder_clean =
$this->prep_folder_in($target_fldball['folder']);
+ $target_folder_clean =
urldecode($target_fldball['folder']);
+ if (!strstr($target_folder_clean, '}'))
+ {
+ $mailsvr_callstr =
$this->get_arg_value('mailsvr_callstr', $acctnum);
+ $target_folder_clean =
$mailsvr_callstr.$target_folder_clean;
+ }
+ $mailsvr_stream =
$this->get_arg_value('mailsvr_stream', $acctnum);
+ if ($this->debug_wrapper_dcom_calls > 0) {
$this->dbug->out('phpgw_deletemailbox_ex('.__LINE__.'): calling
$GLOBALS[phpgw_dcom_'.$acctnum.']->dcom->deletemailbox('.serialize($mailsvr_stream).',
'.htmlspecialchars($target_folder_clean).'<br>'); }
+ return
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->deletemailbox($mailsvr_stream,
$target_folder_clean);
+ }
+
+ /*!
@function phpgw_renamemailbox
@abstract ?
@author Angles
@@ -1174,6 +1418,83 @@
}
/*!
+ @function phpgw_renamemailbox_ex
+ @abstract ?
+ @param $target_fldball (array or type "fldball") NOTE: folder
element DOES NOT NEED THE SERVER CALLSTR.
+ @discussion This function handles the traditional fldball
better, a fldball["folder"] is NOT ever supposed to have
+ a mailsvr_callstr, and IS ALWAYS urlencoded until just before
we call the dcom class, when we urldecode it only
+ at that point. This function assumes this behavior, so the
typical fldball is supported by this function.
+ This will be the future version of this function, code is
migrating to this version.
+ @author Angles
+ @access public
+ */
+ function phpgw_renamemailbox_ex($source_fldball,$target_fldball)
+ {
+ if ($this->debug_wrapper_dcom_calls > 0) {
$this->dbug->out('phpgw_renamemailbox_ex('.__LINE__.'): ENTERING<br>'); }
+ if ($this->debug_wrapper_dcom_calls > 1) {
$this->dbug->out('phpgw_renamemailbox_ex('.__LINE__.'): raw $source_fldball arg
['.htmlspecialchars($source_fldball).']; raw $target_fldball arg
['.htmlspecialchars($target_fldball).']<br>'); }
+ if ((isset($target_fldball['acctnum']))
+ && ((string)$target_fldball['acctnum'] != ''))
+ {
+ $target_fldball['acctnum'] =
(int)$target_fldball['acctnum'];
+ }
+ else
+ {
+ $target_fldball['acctnum'] =
$this->get_acctnum();
+ }
+ $acctnum = $target_fldball['acctnum'];
+ // if folder is blank, we *should* assume INBOX because
BUT mailsvr will give an error INBOX already exists
+ if ((isset($target_fldball['folder']))
+ || ((string)$target_fldball['folder'] != ''))
+ {
+ // good folder name, no change needed
+ }
+ else
+ {
+ $target_fldball['folder'] = 'INBOX';
+ }
+ // Make Sure Stream Exists
+ // multiple accounts means one stream may be open but
another may not
+ // "ensure_stream_and_folder" will verify for us,
+ // tell "ensure_stream_and_folder" that its NOT
NECESSARY to switch TO this folder
+ $target_fldball['no_switch_away'] = True;
+ $this->ensure_stream_and_folder($target_fldball,
'phpgw_renamemailbox_ex LINE ('.__LINE__.')');
+ // if $folder dies not have the {SERVERNAME} then add
it
+ //$target_folder_clean =
$this->prep_folder_in($target_fldball['folder']);
+ $target_folder_clean =
urldecode($target_fldball['folder']);
+ if (!strstr($target_folder_clean, '}'))
+ {
+ $mailsvr_callstr =
$this->get_arg_value('mailsvr_callstr', $acctnum);
+ $target_folder_clean =
$mailsvr_callstr.$target_folder_clean;
+ }
+
+ // SOURCE FOLDER NAME
+ //the folder we are renaming MUST BE from the same
account
+ // so we only need to clean up its name
+ if ((isset($source_fldball['folder']))
+ || ((string)$source_fldball['folder'] != ''))
+ {
+ // good folder name, no change needed
+ }
+ else
+ {
+ $source_fldball['folder'] = 'INBOX';
+ }
+ $source_folder_clean =
urldecode($source_fldball['folder']);
+ // if $folder dies not have the {SERVERNAME} then add
it
+ if (!strstr($source_folder_clean, '}'))
+ {
+ $mailsvr_callstr =
$this->get_arg_value('mailsvr_callstr', $acctnum);
+ $source_folder_clean =
$mailsvr_callstr.$source_folder_clean;
+ }
+
+ // OK WE are ready to do it!
+ $mailsvr_stream =
$this->get_arg_value('mailsvr_stream', $acctnum);
+ if ($this->debug_wrapper_dcom_calls > 0) {
$this->dbug->out('phpgw_renamemailbox_ex('.__LINE__.'): calling
$GLOBALS[phpgw_dcom_'.$acctnum.']->dcom->renamemailbox('.serialize($mailsvr_stream).',
'.htmlspecialchars($source_folder_clean).',
'.htmlspecialchars($target_folder_clean).'<br>'); }
+ //return
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->createmailbox($mailsvr_stream,
$target_folder_clean);
+ return
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->renamemailbox($mailsvr_stream,
$source_folder_clean, $target_folder_clean);
+ }
+
+ /*!
@function phpgw_listmailbox
@abstract ?
@author Angles
@@ -2542,7 +2863,7 @@
function is_ball_data($maybe_ball='##NOTHING##',
$expect_ball_type='any', $is_uri_type_string='')
{
if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: is_ball_data('.__LINE__.'): ENTERING<br>'); }
- if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: is_ball_data('.__LINE__.'): param $maybe_fldball
['.htmlspecialchars(serialize($maybe_fldball)).'], param $expect_ball_type
['.$expect_ball_type.'], param $is_uri_type_string
['.htmlspecialchars(serialize($is_uri_type_string)).'] <br>'); }
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: is_ball_data('.__LINE__.'): param $maybe_ball
['.htmlspecialchars(serialize($maybe_ball)).'], param $expect_ball_type
['.$expect_ball_type.'], param $is_uri_type_string
['.htmlspecialchars(serialize($is_uri_type_string)).'] <br>'); }
// sanity check on input data
if ((!isset($maybe_ball))
|| ($maybe_ball == $this->nothing)
@@ -2668,7 +2989,7 @@
// add to this data a "uri" element that is the
$uri_ball_data
//if (isset($return_struct['uri']) == False)
//{
- $return_struct['uri'] = $uri_ball_data;
+ //$return_struct['uri'] = $uri_ball_data;
//}
if ($do_stripslashes == True)
{
@@ -2680,6 +3001,8 @@
}
// we always keep folder data in urlencoded form until
the last second
$return_struct['folder'] =
$this->prep_folder_out($return_struct['folder']);
+ //rebuild the uri string
+ $return_struct['uri'] =
'msgball[msgnum]='.$return_struct['msgnum'].'&msgball[folder]='.$return_struct['folder'].'&msgball[acctnum]='.$return_struct['acctnum'];
if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: ball_data_parse_str('.__LINE__.'): final
$return_struct DUMP:', $return_struct); }
if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: ball_data_parse_str('.__LINE__.'): LEAVING<br>'); }
return $return_struct;
@@ -2729,13 +3052,13 @@
*/
$embeded_data = array();
- if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: decode_fake_uri: ENTERED $uri_type_string
['.$uri_type_string.'] <br>'); }
+ if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: decode_fake_uri('.__LINE__.'): ENTERED
$uri_type_string ['.$uri_type_string.'] <br>'); }
parse_str($uri_type_string, $embeded_data);
- if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: decode_fake_uri: parse_str('.$uri_type_string.',
into $embeded_data DUMP:', $embeded_data); }
+ if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: decode_fake_uri('.__LINE__.'):
parse_str('.$uri_type_string.', into $embeded_data DUMP:', $embeded_data); }
// NOTE PARSE_STR ***WILL ADD SLASHES*** TO ESCAPE
QUOTES
// NO MATTER WHAT YOUR MAGIC SLASHES SETTING IS
- if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: decode_fake_uri ('.__LINE__.'): NOTE PARSE_STR
***WILL ADD SLASHES*** TO ESCAPE QUOTES NO MATTER WHAT YOUR MAGIC SLASHES
SETTING IS **stripping slashes NOW***'); }
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: decode_fake_uri('.__LINE__.'): NOTE PARSE_STR
***WILL ADD SLASHES*** TO ESCAPE QUOTES NO MATTER WHAT YOUR MAGIC SLASHES
SETTING IS **stripping slashes NOW***'); }
if (isset($embeded_data['folder']))
{
$embeded_data['folder'] =
stripslashes($embeded_data['folder']);
@@ -2745,12 +3068,12 @@
$embeded_data['msgball']['folder'] =
stripslashes($embeded_data['msgball']['folder']);
}
- if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: decode_fake_uri: post "stripslashes"
parse_str('.$uri_type_string.', into $embeded_data DUMP:', $embeded_data); }
+ if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: decode_fake_uri('.__LINE__.'): post "stripslashes"
parse_str('.$uri_type_string.', into $embeded_data DUMP:', $embeded_data); }
// some embeded uri-faked data needs to be raised up
one level from sub-elements to top level
if ($raise_up)
{
- if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: decode_fake_uri: attempt to raise up data one level
in the array <br>'); }
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: decode_fake_uri('.__LINE__.'): attempt to raise up
data one level in the array <br>'); }
$count_embeded = count($embeded_data);
if ($count_embeded == 1)
{
@@ -2790,11 +3113,11 @@
*/
// replace result with $new_top_level
$embeded_data = $new_top_level;
- if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: decode_fake_uri: raise embeded up to $new_top_level
DUMP:', $new_top_level); }
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: decode_fake_uri('.__LINE__.'): raise embeded up to
$new_top_level DUMP:', $new_top_level); }
}
else
{
- if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: decode_fake_uri: original result had more than one
element, can not raise <br>'); }
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: decode_fake_uri('.__LINE__.'): original result had
more than one element, can not raise <br>'); }
}
}
// parse_str will "urldecode" the folder string, we
need to re-urlencode it,
@@ -2804,21 +3127,22 @@
if ((strstr($key, 'folder'))
&& ((string)$embeded_data[$key] != ''))
{
- $re_urlencoded_folder =
urlencode($embeded_data[$key]);
- if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: decode_fake_uri: re-urlencode (hopefully) folder
element $embeded_data['.$key.'] from ['.$embeded_data[$key].'] into
['.$re_urlencoded_folder.'] <br>'); }
+ //$re_urlencoded_folder =
urlencode($embeded_data[$key]);
+ $re_urlencoded_folder =
$this->prep_folder_out($embeded_data[$key]);
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: decode_fake_uri('.__LINE__.'): re-urlencode
(hopefully) folder element $embeded_data['.$key.'] from
['.$embeded_data[$key].'] into ['.$re_urlencoded_folder.'] <br>'); }
$embeded_data[$key] =
$re_urlencoded_folder;
}
elseif ((strstr($key, 'acctnum'))
&& ((string)$embeded_data[$key] != ''))
{
$make_int_acctnum =
(int)$embeded_data[$key];
- if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: decode_fake_uri: $make_int_acctnum (hopefully)
acctnum element $embeded_data['.$key.'] from
['.serialize($embeded_data[$key]).'] into ['.serialize($make_int_acctnum).']
<br>'); }
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: decode_fake_uri('.__LINE__.'): $make_int_acctnum
(hopefully) acctnum element $embeded_data['.$key.'] from
['.serialize($embeded_data[$key]).'] into ['.serialize($make_int_acctnum).']
<br>'); }
$embeded_data[$key] = $make_int_acctnum;
}
}
- if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: decode_fake_uri: final $embeded_data (sub parts
made into an associative array) DUMP:', $embeded_data); }
- if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: decode_fake_uri: LEAVING <br>'); }
+ if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: decode_fake_uri('.__LINE__.'): final $embeded_data
(sub parts made into an associative array) DUMP:', $embeded_data); }
+ if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: decode_fake_uri('.__LINE__.'): LEAVING <br>'); }
return $embeded_data;
}
@@ -2854,9 +3178,9 @@
*/
function grab_class_args_gpc()
{
- if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: grab_class_args_gpc: ENTERING<br>'); }
- if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: grab_class_args_gpc: $this->ref_POST DUMP:',
$this->ref_POST); }
- if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: grab_class_args_gpc: $this->ref_GET DUMP:',
$this->ref_GET); }
+ if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: grab_class_args_gpc('.__LINE__.'): ENTERING<br>'); }
+ if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: grab_class_args_gpc('.__LINE__.'): $this->ref_POST
DUMP:', $this->ref_POST); }
+ if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: grab_class_args_gpc('.__LINE__.'): $this->ref_GET
DUMP:', $this->ref_GET); }
// ---- extract any "fake_uri" embedded data from
HTTP_POST_VARS ----
// note: this happens automatically for HTTP_GET_VARS
@@ -2865,10 +3189,10 @@
{
while(list($key,$value) = each($this->ref_POST))
{
- if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: grab_class_args_gpc: looking for "_fake_uri" token
in HTTP_POST_VARS ['.$key.'] = '.$this->ref_POST[$key].'<br>'); }
+ if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: grab_class_args_gpc('.__LINE__.'): looking for
"_fake_uri" token in HTTP_POST_VARS ['.$key.'] =
'.$this->ref_POST[$key].'<br>'); }
if ($key == 'delmov_list')
{
- if
($this->debug_args_input_flow > 1) { $this->dbug->out('mail_msg:
grab_class_args_gpc: FOUND "delmov_list_fake_uri" needs decoding
HTTP_POST_VARS['.$key.'] = ['.$this->ref_POST[$key].'] <br>'); }
+ if
($this->debug_args_input_flow > 1) { $this->dbug->out('mail_msg:
grab_class_args_gpc('.__LINE__.'): FOUND "delmov_list_fake_uri" needs decoding
HTTP_POST_VARS['.$key.'] = ['.$this->ref_POST[$key].'] <br>'); }
// apache2 on test RH8.0 box
submits "delmov_list" array with duplicate items in it, track this
$seen_delmov_list_items=array();
$sub_loops =
count($this->ref_POST[$key]);
@@ -2884,7 +3208,7 @@
// bug1: apache2: do
duplicate test on the "delmov_list" array items
if
(in_array($this->ref_POST[$key][$i], $seen_delmov_list_items) == True)
{
- if
($this->debug_args_input_flow > 1) { $this->dbug->out('mail_msg:
grab_class_args_gpc: <u>unsetting</u> and *skipping* duplicate (buggy apache2)
"delmov_list" array item ['.$this->ref_POST[$key][$i].'] <br>'); }
+ if
($this->debug_args_input_flow > 1) { $this->dbug->out('mail_msg:
grab_class_args_gpc('.__LINE__.'): <u>unsetting</u> and *skipping* duplicate
(buggy apache2) "delmov_list" array item ['.$this->ref_POST[$key][$i].']
<br>'); }
$this->ref_POST[$key][$i] = '';
// can I UNSET
this and have the next $i index item actually be the next one
// YES, a)
array count calculated before loop, and b) does not squash array to unset an
item
@@ -2897,7 +3221,7 @@
else
{
// track seen
items for duplicate test
- if
($this->debug_args_input_flow > 1) { $this->dbug->out('mail_msg:
grab_class_args_gpc: good (not duplicate, not buggy apache2) "delmov_list"
array item ['.$this->ref_POST[$key][$i].'] <br>'); }
+ if
($this->debug_args_input_flow > 1) { $this->dbug->out('mail_msg:
grab_class_args_gpc('.__LINE__.'): good (not duplicate, not buggy apache2)
"delmov_list" array item ['.$this->ref_POST[$key][$i].'] <br>'); }
$tmp_next_idx =
count($seen_delmov_list_items);
$seen_delmov_list_items[$tmp_next_idx] = $this->ref_POST[$key][$i];
}
@@ -2908,19 +3232,19 @@
$this->ref_POST[$key][$i] = $sub_embedded_data;
}
// increment our shadow
iteation count
- if
($this->debug_args_input_flow > 2) { $this->dbug->out('mail_msg:
grab_class_args_gpc: decoded ARRAY "_fake_uri" data: HTTP_POST_VARS['.$key.']
data DUMP:', $this->ref_POST[$key]); }
+ if
($this->debug_args_input_flow > 2) { $this->dbug->out('mail_msg:
grab_class_args_gpc('.__LINE__.'): decoded ARRAY "_fake_uri" data:
HTTP_POST_VARS['.$key.'] data DUMP:', $this->ref_POST[$key]); }
}
elseif (strstr($key, '_fake_uri'))
{
- if
($this->debug_args_input_flow > 1) { $this->dbug->out('mail_msg:
grab_class_args_gpc: FOUND "_fake_uri" token in HTTP_POST_VARS['.$key.'] =
['.$this->ref_POST[$key].'] <br>'); }
+ if
($this->debug_args_input_flow > 1) { $this->dbug->out('mail_msg:
grab_class_args_gpc('.__LINE__.'): FOUND "_fake_uri" token in
HTTP_POST_VARS['.$key.'] = ['.$this->ref_POST[$key].'] <br>'); }
$embedded_data = array();
$embedded_data =
$this->decode_fake_uri($this->ref_POST[$key]);
// Strip "_fake_uri" from $key
and insert the associative array into HTTP_POST_VARS
$new_key =
str_replace('_fake_uri', '', $key);
- if
($this->debug_args_input_flow > 1) { $this->dbug->out('mail_msg:
grab_class_args_gpc: embedded "_fake_uri" data will be inserted into POST VARS
with key name: ['.$new_key.'] = ['.$this->ref_POST[$key].'] <br>'); }
+ if
($this->debug_args_input_flow > 1) { $this->dbug->out('mail_msg:
grab_class_args_gpc('.__LINE__.'): embedded "_fake_uri" data will be inserted
into POST VARS with key name: ['.$new_key.'] = ['.$this->ref_POST[$key].']
<br>'); }
$this->ref_POST[$new_key] =
array();
$this->ref_POST[$new_key] =
$embedded_data;
- if
($this->debug_args_input_flow > 2) { $this->dbug->out('mail_msg:
grab_class_args_gpc: decoded "_fake_uri" data: HTTP_POST_VARS['.$new_key.']
data DUMP:', $this->ref_POST[$new_key]); }
+ if
($this->debug_args_input_flow > 2) { $this->dbug->out('mail_msg:
grab_class_args_gpc('.__LINE__.'): decoded "_fake_uri" data:
HTTP_POST_VARS['.$new_key.'] data DUMP:', $this->ref_POST[$new_key]); }
}
/*
elseif ($key == 'delmov_list')
@@ -2941,7 +3265,7 @@
$got_args = array();
// insert *known* external args we find into
$got_args[], then return that data
- if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: grab_class_args_gpc: about to loop thru
$this->known_external_args<br>'); }
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: grab_class_args_gpc('.__LINE__.'): about to loop
thru $this->known_external_args<br>'); }
$loops = count($this->known_external_args);
for($i=0;$i<$loops;$i++)
{
@@ -2949,39 +3273,55 @@
//if ($this->debug_args_input_flow > 2) {
$this->dbug->out(' * * (grab pref - external) $this_arg_name:
['.$this_arg_name.']<br>'); }
if (isset($this->ref_POST[$this_arg_name]))
{
- if ($this->debug_args_input_flow> 2) {
$this->dbug->out(' * * (grab pref - external)
$this->ref_POST['.$this_arg_name.'] IS set to
['.$this->ref_POST[$this_arg_name].']<br>'); }
+ if ($this->debug_args_input_flow> 2) {
$this->dbug->out(' * * (grab pref - external)('.__LINE__.')
$this->ref_POST['.$this_arg_name.'] IS set to
['.$this->ref_POST[$this_arg_name].']<br>'); }
$got_args[$this_arg_name] =
$this->ref_POST[$this_arg_name];
}
elseif (isset($this->ref_GET[$this_arg_name]))
{
- if ($this->debug_args_input_flow > 2) {
$this->dbug->out(' * * (grab pref - external)
$this->ref_GET['.$this_arg_name.'] IS set to
['.$this->ref_GET[$this_arg_name].']<br>'); }
+ if ($this->debug_args_input_flow > 2) {
$this->dbug->out(' * * (grab pref - external)('.__LINE__.')
$this->ref_GET['.$this_arg_name.'] IS set to
['.serialize($this->ref_GET[$this_arg_name]).']<br>'); }
$got_args[$this_arg_name] =
$this->ref_GET[$this_arg_name];
+ // STRIPSLASHES IF NEEDED
+ if (($this_arg_name == 'msgball')
+ || ($this_arg_name == 'fldball'))
+ {
+ // php will automayically
urldecode the folder, we don't like this
+ // AND PHP MIGHT ADD GPC
SLASHES WE DO NOT WANT!!!!! depending on your ini settings
+ // use custom
"stripslashes_gpc" function here because the slashes at this point would have
been added ONLY by php itself
+ // i.e. we have not yet used
"parse_str" yet, that always addes slashes, but not using it yet means any
slashes are GPC slashes
+
$not_urlencoded_but_stripslashed_folder =
$this->stripslashes_gpc($got_args[$this_arg_name]['folder']);
+ // now we have no unwanted
slashes, so put this back in the input args
+ if
($this->debug_args_input_flow > 2) { $this->dbug->out(' * * (grab pref -
external)('.__LINE__.'): msgball[folder] STRIPSLASH watch:
$got_args[$this_arg_name]["folder"]:
['.htmlspecialchars($got_args[$this_arg_name]['folder']).'];
$not_urlencoded_but_stripslashed_folder:
['.htmlspecialchars($not_urlencoded_but_stripslashed_folder).']<br>'); }
+
$got_args[$this_arg_name]['folder'] = $not_urlencoded_but_stripslashed_folder;
+
$not_urlencoded_but_stripslashed_folder = '';
+
unset($not_urlencoded_but_stripslashed_folder);
+ }
// ADD "uri" element to incoming
"msgball" arg
// so forms may pass this "msgball" on
to the next page view
if ($this_arg_name == 'msgball')
{
// php will automayically
urldecode the folder, we don't like this
+ // we want the folder value to
be URLENCODED, so we need to re-urlencode it
$re_urlencoded_folder =
$this->prep_folder_out($got_args[$this_arg_name]['folder']);
$got_args[$this_arg_name]['folder'] = $re_urlencoded_folder;
$got_args[$this_arg_name]['uri'] =
'msgball[msgnum]='.$got_args[$this_arg_name]['msgnum']
.'&msgball[folder]='.$got_args[$this_arg_name]['folder']
.'&msgball[acctnum]='.$got_args[$this_arg_name]['acctnum'];
- if
($this->debug_args_input_flow > 2) { $this->dbug->out(' * * (grab pref -
external) made msgball URI, added it to msgball[]: DUMP:',
$got_args[$this_arg_name]); }
+ if
($this->debug_args_input_flow > 2) { $this->dbug->out(' * * (grab pref -
external)('.__LINE__.') made msgball URI, added it to msgball[]: DUMP:',
$got_args[$this_arg_name]); }
}
}
else
{
- if ($this->debug_args_input_flow > 2) {
$this->dbug->out(' * (grab pref - external) neither POST nor GET vars have this
item set ['.$this_arg_name.'] <br>'); }
+ if ($this->debug_args_input_flow > 2) {
$this->dbug->out(' * (grab pref - external)('.__LINE__.') neither POST nor GET
vars have this item set ['.$this_arg_name.'] <br>'); }
}
}
- if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: grab_class_args_gpc: post-loop (external args)
$got_args[] DUMP:', $got_args); }
+ if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: grab_class_args_gpc('.__LINE__.'): post-loop
(external args) $got_args[] DUMP:', $got_args); }
// in order to know wgat account's arg array to insert
$got_args[] into, we need to determine what account
// we are dealing with before we can call
$this->set_arg_array or "->get_isset_arg" or "->get_arg_value", etc...
// so whoever called this function should obtain that
before calling $this->set_arg_array() with the data we return here
- if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: grab_class_args_gpc: LEAVING, returning
$got_args<br>'); }
+ if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: grab_class_args_gpc('.__LINE__.'): LEAVING,
returning $got_args<br>'); }
return $got_args;
}
@@ -3043,7 +3383,7 @@
*/
function get_best_acctnum($args_array='', $got_args='',
$force_feed_acctnum='')
{
- if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: get_best_acctnum('.__LINE__.'): ENTERING, param
$force_feed_acctnum ['.$force_feed_acctnum.']'); }
+ if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: get_best_acctnum('.__LINE__.'): ENTERING, param
$force_feed_acctnum ['.$force_feed_acctnum.']<br>'); }
if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: get_best_acctnum('.__LINE__.'): parm $args_array[]
DUMP:', $args_array); }
if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: get_best_acctnum('.__LINE__.'): parm $got_args[]
DUMP:', $got_args); }
@@ -3350,6 +3690,8 @@
if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: get_best_folder_arg: ENTERING <br>'); }
if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: get_best_folder_arg: param $acctnum ['.$acctnum.']
; parm $args_array[] DUMP:', $args_array); }
if ($this->debug_args_input_flow > 2) {
$this->dbug->out('mail_msg: get_best_folder_arg: param $acctnum ['.$acctnum.']
; parm $got_args[] DUMP:', $got_args); }
+ // initialize
+ $processed_folder_arg = '';
// we SHOULD have already obtained a valid acctnum
before calling this function
if (!(isset($acctnum))
|| ((string)$acctnum == ''))
@@ -3359,8 +3701,6 @@
// ---- Get Folder Value ----
// ORDER OF PREFERENCE for pre-processed "folder" input
arg
// (1) $args_array, IF FILLED, overrides any previous
data or any other data source, look for these:
- // $args_array['msgball']['folder']
- // $args_array['fldball']['folder']
// $args_array['folder']
// (2) GPC ['msgball']['folder']
// (3) GPC ['fldball']['folder']
@@ -3379,11 +3719,37 @@
{
$input_folder_arg =
$this->get_arg_value('["msgball"]["folder"]');
if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: get_best_folder_arg: $input_folder_arg chooses
$this->get_arg_value(["msgball"]["folder"]): ['.$input_folder_arg.']<br>'); }
+ //VERIFY
+ $processed_folder_arg =
$this->prep_folder_in($input_folder_arg,
$this->get_arg_value('["msgball"]["acctnum"]'));
+ // when putting back into the ball data we need
to urlencode it because folder element in ball data stays urlencoded until the
last monent
+ $processed_folder_arg =
urlencode($processed_folder_arg);
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: get_best_folder_arg('.__LINE__.'): after
"prep_folder_in", $processed_folder_arg : ['.$processed_folder_arg.']<br>'); }
+ // both these should be urlencoded so this is
apples to apples comparison
+ if ($processed_folder_arg != $input_folder_arg)
+ {
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: get_best_folder_arg('.__LINE__.'):
$processed_folder_arg != $input_folder_arg so about to call
$this->set_arg_value(["msgball"]["folder"], $processed_folder_arg) <br>'); }
+
$this->set_arg_value('["msgball"]["folder"]', $processed_folder_arg);
+ }
+ // now that is done, urldecode because a legacy
quirk requires a urldecded return from this function
+ $processed_folder_arg =
urldecode($processed_folder_arg);
}
elseif ($this->get_isset_arg('["fldball"]["folder"]'))
{
$input_folder_arg =
$this->get_arg_value('["fldball"]["folder"]');
if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: get_best_folder_arg: $input_folder_arg chooses
$this->get_arg_value(["fldball"]["folder"]): ['.$input_folder_arg.']<br>'); }
+ //VERIFY
+ $processed_folder_arg =
$this->prep_folder_in($input_folder_arg,
$this->get_arg_value('["fldball"]["acctnum"]'));
+ // when putting back into the ball data we need
to urlencode it because folder element in ball data stays urlencoded until the
last monent
+ $processed_folder_arg =
urlencode($processed_folder_arg);
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: get_best_folder_arg('.__LINE__.'): after
"prep_folder_in", $processed_folder_arg : ['.$processed_folder_arg.']<br>'); }
+ // both these should be urlencoded so this is
apples to apples comparison
+ if ($processed_folder_arg != $input_folder_arg)
+ {
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: get_best_folder_arg('.__LINE__.'):
$processed_folder_arg != $input_folder_arg so about to call
$this->set_arg_value(["fldball"]["folder"], $processed_folder_arg) <br>'); }
+
$this->set_arg_value('["fldball"]["folder"]', $processed_folder_arg);
+ }
+ // now that is done, urldecode because a legacy
quirk requires a urldecded return from this function
+ $processed_folder_arg =
urldecode($processed_folder_arg);
}
elseif ($this->get_isset_arg('delmov_list'))
{
@@ -3416,9 +3782,17 @@
}
// ---- Prep the Folder Name (remove encodings, verify
it's long name (with namespace)
// folder prepping does a lookup which requires a
folder list which *usually* (unless caching) requires a login
- if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: get_best_folder_arg: about to issue
$processed_folder_arg = $this->prep_folder_in('.$input_folder_arg.')<br>'); }
- $processed_folder_arg =
$this->prep_folder_in($input_folder_arg);
- if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: get_best_folder_arg: LEAVING, returning
$processed_folder_arg value: ['.$processed_folder_arg.']<br>'); }
+ if ($processed_folder_arg != '')
+ {
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: get_best_folder_arg: we already obtained above a
$processed_folder_arg ['.$processed_folder_arg.']<br>'); }
+ }
+ else
+ {
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: get_best_folder_arg: about to issue
$processed_folder_arg = $this->prep_folder_in('.$input_folder_arg.')<br>'); }
+ $processed_folder_arg =
$this->prep_folder_in($input_folder_arg);
+ }
+ if ($this->debug_args_input_flow > 1) {
$this->dbug->out('mail_msg: get_best_folder_arg: remember legacy quirk says
return value from here should be urdecoded, eventhough msgball and fldball keep
folder element urlencoded usually<br>'); }
+ if ($this->debug_args_input_flow > 0) {
$this->dbug->out('mail_msg: get_best_folder_arg: LEAVING, returning
$processed_folder_arg value: ['.$processed_folder_arg.'] remember legacy quirk
says return value from here should be urdecoded, eventhough msgball and fldball
keep folder element urlencoded usually<br>'); }
return $processed_folder_arg;
}
@@ -3540,6 +3914,10 @@
// data['validity']['folder_status_info']
// then you have provided EVERYTHING we need
+ // NOTE 5: NOW we also use folder as a data
key, so each folder has its own msgball_list
+ // so later we will use this folder data for
what is called $extra_keys, but it is just the folder name here
+ // update to make it easier to understand I
call this $folder_name now
+
// easy way is "note 1", at this point
providing the other stuff is not needed for normal operation
// perhaps if you already have the other stuff
and you know it has not changed ("folder_status_info" still good)
// then *maybe* it might save some time passing
"folder_status_info" you already have
@@ -3642,29 +4020,38 @@
// RECAST DATA ready for saving in appsession
//$data = serialize($data);
- if (($this->debug_session_caching > 2) &&
($this->debug_allow_magball_list_dumps)) { $this->dbug->out('mail_msg:
save_session_cache_item('.__LINE__.'):
[email][dat]['.$acctnum.']['.$data_name.'] DUMP:', $data); }
+ // NOW WE USE FOLDER INFO TOO SO EVERY FOLDER
GETS ITS OWN MSGBALL_LIST
+ $folder_name =
$data['validity']['fldball']['folder'];
+ if (($this->debug_session_caching > 2) &&
($this->debug_allow_magball_list_dumps)) { $this->dbug->out('mail_msg:
save_session_cache_item('.__LINE__.'):
[email][dat]['.$acctnum.']['.$data_name.']['.$folder_name.'] DUMP:', $data); }
// SET DATA
-
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name]
= $data;
+
//$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name]
= $data;
+ // SET DATA USING FOLDER ALSO
+
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$folder_name]
= $data;
// for DB sessions_db ONLY
if
(($GLOBALS['phpgw_info']['server']['sessions_type'] == 'db')
|| ($this->use_private_table == True))
{
- $my_location =
(string)$acctnum.';'.$data_name;
- if ($this->debug_session_caching > 1) {
$this->dbug->out('mail_msg: save_session_cache_item('.__LINE__.'):
sessions_type is ['.$GLOBALS['phpgw_info']['server']['sessions_type'].'] SO we
have this additional step to put data into phpgw_app_sessions table,
$my_location ['.$my_location.']<br>'); }
+ //$my_location =
(string)$acctnum.';'.$data_name;
+ // SET DATA USING FOLDER ALSO
+ $my_location =
(string)$acctnum.';'.$data_name.';'.$folder_name;
+ if ($this->debug_session_caching > 1) {
$this->dbug->out('mail_msg: save_session_cache_item('.__LINE__.'):
sessions_type is ['.$GLOBALS['phpgw_info']['server']['sessions_type'].'] SO we
have this additional step to put data into database anglemail table,
$my_location ['.$my_location.']<br>'); }
if ($this->use_private_table == True)
{
-
$this->so->so_set_data($my_location, $data);
+
//$this->so->so_set_data($my_location, $data);
+ // TRY USING COMPRESSION
+
$this->so->so_set_data($my_location, $data, True);
}
else
{
+ // NOTE compression not
available for appsession table
$GLOBALS['phpgw']->session->appsession($my_location, 'email', $data);
}
}
$data = array();
unset($data);
- if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: save_session_cache_item('.__LINE__.'): LEAVING, did
SET data for location: [email][dat][$acctnum][$data_name][$extra_keys] ::
[email][dat]['.$acctnum.']['.$data_name.'] <br>'); }
+ if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: save_session_cache_item('.__LINE__.'): LEAVING, did
SET data for location: [email][dat][$acctnum][$data_name][$extra_keys] ::
[email][dat]['.$acctnum.']['.$data_name.']['.$folder_name.'] <br>'); }
return True;
}
// DEFANG special handler for data that might b0rk a
database, stuff like ' " / \ and maybe some others, only "mailsvr_callstr"
needs this right now
@@ -3824,6 +4211,8 @@
// we will not waste time making a sub array,
instead we add the "extra_keys" to the "location"
// that way we can directly access this
individual datUM without the hastle of a sub array
+ // "flat_pgw_struct" also known as "part_nice"
+
/*!
@capability msg_structure and phpgw_header
unique handling
@abstract The theory is correct and still
applied, but the sub-array style is OLD OLD OLD
@@ -3906,6 +4295,69 @@
if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: save_session_cache_item('.__LINE__.'): LEAVING, did
SET data for
[email][dat]['.$acctnum.']['.$data_name.']['.$ex_folder.']['.$ex_msgnum.']
<br>'); }
return True;
}
+ elseif ($data_name == 'phpgw_fetchbody')
+ {
+ if ($this->debug_session_caching > 1) {
$this->dbug->out('mail_msg: save_session_cache_item('.__LINE__.'):
(extreme-mode) data exists for "'.$data_name.'" AND has a handler<br>'); }
+ if ($this->debug_session_caching > 2) {
$this->dbug->out('mail_msg: save_session_cache_item('.__LINE__.'):
"'.$data_name.'" ARRIVING param $data as it is passed into this function
DUMP:', $data); }
+
+ //(1) Data Param ARRIVES to this function like
this
+ //msg_structure $data param arrives into this
function like this:
+ // $data['msgball'] = $msgball;
+ // $data['phpgw_fetchbody'] = $data;
+ //
+ //(2) Data Param $data['msgball'] SHOULD HAVE
ELEMENT "part_no" !!!!
+ // $data['msgball']['acctnum']
+ // $data['msgball']['folder']
+ // $data['msgball']['msgnum']
+ // $data['msgball']['part_no']
+
+ if ((!isset($data['msgball']['part_no']))
+ || (!$data['msgball']['part_no']))
+ {
+ // LEAVING
+ if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: save_session_cache_item('.__LINE__.'): LEAVING with
ERROR, returning FALSE, insufficient data for ['.$data_name.'] because NOT
GIVEN $data[msgball][part_no]; $data[msgball] was
['.serialize($data['msgball']).'] <br>'); }
+ return False;
+ }
+ $strlen_phpgw_fetchbody =
strlen($data['phpgw_fetchbody']);
+ if ($strlen_phpgw_fetchbody > 60000)
+ {
+ // LEAVING
+ if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: save_session_cache_item('.__LINE__.'): LEAVING with
ERROR, returning FALSE, data TOO LARGE for ['.$data_name.'];
$strlen_phpgw_fetchbody; $data[msgball] was ['.$strlen_phpgw_fetchbody.']
<br>'); }
+ return False;
+ }
+
+ $ex_folder = $data['msgball']['folder'];
+ $ex_msgnum = $data['msgball']['msgnum'];
+ $ex_part_no = $data['msgball']['part_no'];
+ // we know what to do here, so this data "has a
handler"
+ $has_handler = True;
+
+ // RECAST DATA ready for saving in appsession
+ //$data = serialize($data[$data_name]);
+ $data = $data[$data_name];
+ if ($this->debug_session_caching > 2) {
$this->dbug->out('mail_msg: save_session_cache_item('.__LINE__.'):
[email][dat]['.$acctnum.']['.$data_name.']['.$ex_folder.']['.$ex_msgnum.']['.$ex_part_no.']
DUMP:', $data); }
+ // SET DATA
+
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder][$ex_msgnum][$ex_part_no]
= $data;
+ // for DB sessions_db ONLY
+ if
(($GLOBALS['phpgw_info']['server']['sessions_type'] == 'db')
+ || ($this->use_private_table == True))
+ {
+ $my_location =
(string)$acctnum.';'.$data_name.';'.$ex_folder.';'.$ex_msgnum.';'.$ex_part_no;
+ if ($this->debug_session_caching > 1) {
$this->dbug->out('mail_msg: save_session_cache_item('.__LINE__.'): AM Table in
use or sessions_type is ['.$GLOBALS['phpgw_info']['server']['sessions_type'].']
SO we have this additional step to put data into a table table, $my_location
['.$my_location.'], this is always needed for AM table<br>'); }
+ if ($this->use_private_table == True)
+ {
+
$this->so->so_set_data($my_location, $data);
+ }
+ else
+ {
+
$GLOBALS['phpgw']->session->appsession($my_location, 'email', $data);
+ }
+ }
+ $data = array();
+ unset($data);
+ if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: save_session_cache_item('.__LINE__.'): LEAVING, did
SET data for
[email][dat]['.$acctnum.']['.$data_name.']['.$ex_folder.']['.$ex_msgnum.']['.$ex_part_no.']
<br>'); }
+ return True;
+ }
else
{
// this data_name has no specific handler
@@ -3975,10 +4427,10 @@
NOTE: ALL INFO SUBJECT TO CHANGE.
@access private
*/
- function read_session_cache_item($data_name='misc',
$acctnum='', $ex_folder='', $ex_msgnum='')
+ function read_session_cache_item($data_name='misc',
$acctnum='', $ex_folder='', $ex_msgnum='', $ex_part_no='')
{
- if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'): ENTERED,
$data_name: ['.$data_name.']; optional: $acctnum: ['.$acctnum.'], $ex_folder:
['.$ex_folder.'], $ex_msgnum: ['.$ex_msgnum.'] '.''); }
- if ($this->debug_session_caching > 1) {
$this->dbug->out('AND
$this->session_cache_enabled='.serialize($this->session_cache_enabled).';
$this->session_cache_extreme='.serialize($this->session_cache_extreme).''); }
+ if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'): ENTERED,
$data_name: ['.$data_name.']; optional: $acctnum: ['.$acctnum.'], $ex_folder:
['.$ex_folder.'], $ex_msgnum: ['.$ex_msgnum.'], $ex_part_no: ['.$ex_part_no.']
'.'<br>'); }
+ if ($this->debug_session_caching > 1) {
$this->dbug->out('AND
$this->session_cache_enabled='.serialize($this->session_cache_enabled).';
$this->session_cache_extreme='.serialize($this->session_cache_extreme).'<br>');
}
if ($this->debug_session_caching > 0) {
$this->dbug->out('<br>'); }
$font_start = '<font color="purple">';
$font_end = '</font>';
@@ -4116,31 +4568,70 @@
$validity_test['mailsvr_account_username'] =
$this->get_arg_value('mailsvr_account_username', $acctnum);
@author Angles
*/
+
+ // NEW: NOW WE NEED A FOLDER NAME TO COMPLETE
THE KEY
+ // if one is not provided as a param,
+ // (a) WE MUST GET ONE, and
+ // (b) it must be URLENCODED, or preped_out
+ if ($ex_folder != '')
+ {
+ if ($this->debug_session_caching > 1) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'): handling
['.$data_name.'] we DID get passed param $ex_folder ['.$ex_folder.']<br>'); }
+ }
+ else
+ {
+ $ex_folder =
$this->prep_folder_out($this->get_arg_value('folder', $acctnum));
+ if ($this->debug_session_caching > 1) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'): handling
['.$data_name.'] we did NOT get param $ex_folder so we just obtained and set it
to this: ['.$ex_folder.']<br>'); }
+ }
+
// GET DATA
// for DB sessions_db ONLY
if
(($GLOBALS['phpgw_info']['server']['sessions_type'] == 'db')
|| ($this->use_private_table == True))
{
- $my_location =
(string)$acctnum.';'.$data_name;
- if ($this->debug_session_caching > 1) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'):
sessions_type is ['.$GLOBALS['phpgw_info']['server']['sessions_type'].'] SO we
have this additional step to read data from phpgw_app_sessions table,
$my_location ['.$my_location.']<br>'); }
+ //$my_location =
(string)$acctnum.';'.$data_name;
+ // WE N OW USE FOLDER DATA TOO
+ $my_location =
(string)$acctnum.';'.$data_name.';'.$ex_folder;
+ if ($this->debug_session_caching > 1) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'):
sessions_type is ['.$GLOBALS['phpgw_info']['server']['sessions_type'].'] SO we
have this additional step to read data from a database table, $my_location
['.$my_location.']<br>'); }
if ($this->use_private_table == True)
{
-
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name]
- =
$this->so->so_get_data($my_location);
+ //$got_data = array();
+ //$got_data =
$this->so->so_get_data($my_location);
+
//$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name]
+ // = $got_data;
+
+
//$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name]
+ // =
$this->so->so_get_data($my_location);
+
+ // TRY USING COMPRESSION
+
//$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name]
+ // =
$this->so->so_get_data($my_location, True);
+
+ // TRY USING COMPRESSION
+ $got_data = array();
+ $got_data =
$this->so->so_get_data($my_location, True);
+
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder]
+ = $got_data;
}
else
{
-
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name]
- =
$GLOBALS['phpgw']->session->appsession($my_location, 'email');
+ // NOTE: no compression
available for appsession
+ $got_data = array();
+ $got_data =
$GLOBALS['phpgw']->session->appsession($my_location, 'email');
+
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder]
+ = $got_data;
+
+ // NOTE: no compression
available for appsession
+
//$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder]
+ // =
$GLOBALS['phpgw']->session->appsession($my_location, 'email');
}
- if ($this->debug_session_caching > 2) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'):
[email][dat]['.$acctnum.']['.$data_name.'] DUMP:',
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name]);
}
+ if ($this->debug_session_caching > 2) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'):
[email][dat]['.$acctnum.']['.$data_name.'] DUMP:',
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder]);
}
}
- $got_data =
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name];
+ //$got_data =
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name];
if (($this->debug_session_caching > 2) &&
($this->debug_allow_magball_list_dumps)) { $this->dbug->out('mail_msg:
read_session_cache_item: $data_name ['.$data_name.'] verified NOT Stale,
restored data DUMP:', $got_data); }
if (!$got_data)
{
- if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'): LEAVING,
returning False, $data_name ['.$data_name.'] had NO data stored, $acctnum:
['.$acctnum.']<br>'); }
+ if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'): LEAVING,
returning False, <font color="red">$data_name ['.$data_name.'] had NO data
stored</font>, $acctnum: ['.$acctnum.'], $ex_folder ['.$ex_folder.']<br>'); }
return False;
}
else
@@ -4193,17 +4684,19 @@
&&
($got_data['validity']['mailsvr_account_username'] ==
$this->get_arg_value('mailsvr_account_username', $acctnum)))
{
if
(($this->debug_session_caching > 2) && ($this->debug_allow_magball_list_dumps))
{ $this->dbug->out('mail_msg: read_session_cache_item: $data_name
['.$data_name.'] verified NOT Stale, restored data DUMP:', $got_data); }
- if
($this->debug_session_caching > 0) { $this->dbug->out('mail_msg:
read_session_cache_item('.__LINE__.'): LEAVING, '.$font_start.'successfully
restored ['.$data_name.']'.$font_end.' VALID and NOT Stale session data,
$acctnum: ['.$acctnum.']<br>'); }
+ if
($this->debug_session_caching > 0) { $this->dbug->out('mail_msg:
read_session_cache_item('.__LINE__.'): LEAVING, '.$font_start.'successfully
restored ['.$data_name.']'.$font_end.' VALID and NOT Stale session data,
$acctnum: ['.$acctnum.'] param (or obtained) $ex_folder ['.$ex_folder.']<br>');
}
return
$got_data['msgball_list'];
}
else
{
- if
($this->debug_session_caching > 1) { $this->dbug->out('mail_msg:
read_session_cache_item('.__LINE__.'): EXPIRE STALE ['.$data_name.'] session
data for $acctnum: ['.$acctnum.']<br>'); }
+ if
($this->debug_session_caching > 1) { $this->dbug->out('mail_msg:
read_session_cache_item('.__LINE__.'): EXPIRE STALE ['.$data_name.'] session
data for $acctnum: ['.$acctnum.'], $ex_folder ['.$ex_folder.']<br>'); }
//$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name]
= array();
//unset($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name]);
// this is better to use
-
$this->expire_session_cache_item($data_name, $acctnum);
- if
($this->debug_session_caching > 0) { $this->dbug->out('mail_msg:
read_session_cache_item('.__LINE__.'): LEAVING, returning False, $data_name
['.$data_name.'] session was STALE, $acctnum: ['.$acctnum.']<br>'); }
+
//$this->expire_session_cache_item($data_name, $acctnum);
+ // NOW WE USE FOLDER IN DATA
KEY ALSO
+
$this->expire_session_cache_item($data_name, $acctnum, $ex_folder);
+ if
($this->debug_session_caching > 0) { $this->dbug->out('mail_msg:
read_session_cache_item('.__LINE__.'): LEAVING, returning False, $data_name
['.$data_name.'] session was STALE, $acctnum: ['.$acctnum.'], $ex_folder
['.$ex_folder.']<br>'); }
return False;
}
}
@@ -4322,6 +4815,41 @@
return $got_data;
}
+ }
+ elseif (($this->session_cache_extreme == True)
+ && ($data_name == 'phpgw_fetchbody'))
+ {
+ // THIS DATA IS NEVER CACHED IF
$this->session_cache_extreme IS FALSE
+ if ($this->debug_session_caching > 1) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'): handler
exists for $data_name ['.$data_name.']<br>'); }
+
+ // GET DATA
+ // for DB sessions_db ONLY
+ if
(($GLOBALS['phpgw_info']['server']['sessions_type'] == 'db')
+ || ($this->use_private_table == True))
+ {
+ $my_location =
(string)$acctnum.';'.$data_name.';'.$ex_folder.';'.$ex_msgnum.';'.$ex_part_no;
+ if ($this->debug_session_caching > 1) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'): AM table in
use or sessions_type is ['.$GLOBALS['phpgw_info']['server']['sessions_type'].']
SO we have this additional step to read data from a table table, $my_location
['.$my_location.']<br>'); }
+ if ($this->use_private_table == True)
+ {
+
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder][$ex_msgnum][$ex_part_no]
+ =
$this->so->so_get_data($my_location);
+ }
+ else
+ {
+
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder][$ex_msgnum][$ex_part_no]
+ =
$GLOBALS['phpgw']->session->appsession($my_location, 'email');
+ }
+ //if ($this->debug_session_caching > 2)
{ echo 'mail_msg: read_session_cache_item('.__LINE__.'):
[email][dat]['.$acctnum.']['.$data_name.']['.$ex_folder.']
['.$ex_msgnum.']DUMP:<pre>';
print_r($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder][$ex_msgnum][$ex_part_no]);
echo '</pre>'; }
+ }
+ $got_data =
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder][$ex_msgnum][$ex_part_no];
+
+ if ($got_data)
+ {
+ if ($this->debug_session_caching > 2) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'): found an
existing array of items for $data_name ['.$data_name.'] data DUMP:',
$got_data); }
+ if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'): LEAVING,
'.$font_start.'successfully restored ['.$data_name.']'.$font_end.' session data
for
[email][dat]['.$acctnum.']['.$data_name.']['.$ex_folder.']['.$ex_msgnum.']['.$ex_part_no.']<br>');
}
+ return $got_data;
+
+ }
else
{
if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: read_session_cache_item('.__LINE__.'): LEAVING,
returning False, $data_name ['.$data_name.'] had NO data stored, $acctnum:
['.$acctnum.'], $extra_keys: ['.$extra_keys.']<br>'); }
@@ -4338,11 +4866,13 @@
@abstract ?
@discussion used with appsession TEMPORARY DATA CACHING
server-side caching of limited,
ephermal data, such as a list of messages from an imap search,
via appsession
+ NOTE we get the old data, if any, to see whether it was an
array or string, HOWEVER using get_arg_value
+ for "folder_list" WILL ATTEMPT A LOGIN so to avoid that we use
"_direct_access_arg_value" instead.
@author Angles
@access private
*/
// ---- session-only data cached to appsession ----
- function
expire_session_cache_item($data_name='misc',$acctnum='', $ex_folder='',
$ex_msgnum='')
+ function
expire_session_cache_item($data_name='misc',$acctnum='', $ex_folder='',
$ex_msgnum='', $ex_part_no='')
{
if ((!isset($acctnum))
|| ((string)$acctnum == ''))
@@ -4379,7 +4909,9 @@
&& (strstr($data_name, 'folder_status_info') == False))
{
// NOTE L1 cached "folder_status_info" was (a)
expired above for non-extreme mode and (b) never uses L1 cached in extreme mode
- $old_content = $this->get_arg_value($data_name,
$acctnum);
+ //$old_content =
$this->get_arg_value($data_name, $acctnum);
+ if ($this->debug_session_caching > 1) {
$this->dbug->out('mail_msg: expire_session_cache_item('.__LINE__.'): does L1
cache/class for ['.$data_name.'], to find out we call
"_direct_access_arg_value" <b>THUS FOLDER_LIST WILL NOT CAUSE A LOGIN</b> using
"get_arg_value" for folder_list WILL ATTEMPT A LOGIN!<br>'); }
+ $old_content =
$this->_direct_access_arg_value($data_name, $acctnum);
if ($this->debug_session_caching > 2) {
$this->dbug->out('mail_msg: expire_session_cache_item('.__LINE__.'): found and
clearing L1 cache/class for ['.$data_name.'] OLD value DUMP:', $old_content); }
if (gettype($old_content) == 'array')
{
@@ -4404,13 +4936,20 @@
if (($GLOBALS['phpgw_info']['server']['sessions_type']
== 'db')
|| ($this->use_private_table == True))
{
+ // generic fallback value
$my_location = (string)$acctnum.';'.$data_name;
- if (($ex_folder)
- && ($ex_msgnum))
+ if (((string)$ex_folder != '')
+ && ((string)$ex_msgnum != '')
+ && ((string)$ex_part_no != ''))
+ {
+ $my_location =
(string)$acctnum.';'.$data_name.';'.$ex_folder.';'.$ex_msgnum.';'.$ex_part_no;
+ }
+ elseif (((string)$ex_folder != '')
+ && ((string)$ex_msgnum != ''))
{
$my_location =
(string)$acctnum.';'.$data_name.';'.$ex_folder.';'.$ex_msgnum;
}
- elseif ($ex_folder)
+ elseif ((string)$ex_folder != '')
{
$my_location =
(string)$acctnum.';'.$data_name.';'.$ex_folder;
}
@@ -4427,8 +4966,10 @@
}
}
- if ((!$ex_folder)
- && (!$ex_msgnum)
+ //if ((!$ex_folder)
+ //&& (!$ex_msgnum)
+ if (((string)$ex_folder == '')
+ && ((string)$ex_msgnum == '')
&&
(isset($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name])))
{
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name]
= '';
@@ -4436,8 +4977,10 @@
if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: expire_session_cache_item('.__LINE__.'): LEAVING
return True, did expire existing data for
[email][dat]['.$acctnum.']['.$data_name.']<br>'); }
return True;
}
- elseif (($ex_folder)
- && (!$ex_msgnum)
+ //elseif (($ex_folder)
+ //&& (!$ex_msgnum)
+ elseif (((string)$ex_folder != '')
+ && ((string)$ex_msgnum == '')
&&
(isset($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder])))
{
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder]
= '';
@@ -4445,8 +4988,10 @@
if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: expire_session_cache_item('.__LINE__.'): LEAVING
return True, did expire existing data for
[email][dat]['.$acctnum.']['.$data_name.']['.$ex_folder.']<br>'); }
return True;
}
- elseif (($ex_folder)
- && ($ex_msgnum)
+ //elseif (($ex_folder)
+ //&& ($ex_msgnum)
+ elseif (((string)$ex_folder != '')
+ && ((string)$ex_msgnum != '')
&&
(isset($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder][$ex_msgnum])))
{
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder][$ex_msgnum]
= '';
@@ -4454,14 +4999,23 @@
if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: expire_session_cache_item('.__LINE__.'): LEAVING
return True, did expire existing data for
[email][dat]['.$acctnum.']['.$data_name.']['.$ex_folder.']['.$ex_msgnum.']<br>');
}
return True;
}
- if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: expire_session_cache_item('.__LINE__.'): LEAVING,
return False, data did not exist for
[email][dat]['.$acctnum.']['.$data_name.']['.serialize($ex_folder).']['.serialize($ex_msgnum).']<br>');
}
+ elseif (((string)$ex_folder != '')
+ && ((string)$ex_msgnum != '')
+ && ((string)$ex_part_no != '')
+ &&
(isset($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder][$ex_msgnum][$ex_part_no])))
+ {
+
$this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder][$ex_msgnum][$ex_part_no]
= '';
+
unset($this->ref_SESSION['phpgw_session']['phpgw_app_sessions']['email']['dat'][$acctnum][$data_name][$ex_folder][$ex_msgnum][$ex_part_no]);
+ if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: expire_session_cache_item('.__LINE__.'): LEAVING
return True, did expire existing data for
[email][dat]['.$acctnum.']['.$data_name.']['.$ex_folder.']['.$ex_msgnum.']['.$ex_part_no.']<br>');
}
+ return True;
+ }
+ if ($this->debug_session_caching > 0) {
$this->dbug->out('mail_msg: expire_session_cache_item('.__LINE__.'): LEAVING,
return False, data did not exist for
[email][dat]['.$acctnum.']['.$data_name.']['.serialize($ex_folder).']['.serialize($ex_msgnum).']['.serialize($ex_part_no).']<br>');
}
return False;
}
/**************************************************************************\
- * END **DEPRECIATED *** UNUSED ***
*
- * SEMI-PERMENANT CACHING HANDLERS
*
+ * END CACHING HANDLERS
*
* - - - - - - - - - - - - - - - - - - - - - - - - -
*
* BEGIN PARAM / ARGS / PREFS ACCESS FUNCTIONS
*
\**************************************************************************/
@@ -4732,7 +5286,7 @@
/*!
@function set_pref_array
@abstract set the entire preference data array FOR ONE ACCOUNT
- @param $pref_array_data (array) either (a) correctly formed
emai pref array data, or (b) an empty array
+ @param $pref_array_data (array) either (a) correctly formed
email pref array data, or (b) an empty array
@param $acctnum (int) OPTIONAL
@result boolean True is successfully sets $pref_array_data,
False to indicate all we did was clear the args, no data was fed
@author Angles
====================================================
====================================================
====================================================
====================================================
Index: email/inc/class.spell.inc.php
diff -u email/inc/class.spell.inc.php:1.2 email/inc/class.spell.inc.php:1.3
--- email/inc/class.spell.inc.php:1.2 Fri Mar 14 04:01:08 2003
+++ email/inc/class.spell.inc.php Thu Dec 30 23:13:50 2004
@@ -130,16 +130,21 @@
// FIXME : what if we want to preserve other stuff ?
Get rid of this array and use for each loop to iterate thru whatever the user
wants to preserve
$this->preserve_tokens = array(
0 => 'action',
- 1 => 'from',
- 2 => 'sender',
- 3 => 'to',
- 4 => 'cc',
- 5 => 'bcc',
- 6 => 'msgtype',
- 7 => 'attach_sig',
- 8 => 'req_notify'
+ // why is this different, "orig_action" can
have the value "new" meaning new mail
+ // whereas plain old "action" can not tell us
of a new mail situation, not right now anyway
+ // darn, I'm not sure this is needed here, is
not this value kept in the URI or does that not matter here
+ 1 => 'orig_action',
+ 2 => 'from',
+ 3 => 'sender',
+ 4 => 'to',
+ 5 => 'cc',
+ 6 => 'bcc',
+ 7 => 'msgtype',
+ 8 => 'attach_sig',
+ 9 => 'req_notify'
);
$this->preserve_vars['action'] = '';
+ $this->preserve_vars['orig_action'] = '';
$this->preserve_vars['from'] = '';
$this->preserve_vars['sender'] = '';
$this->preserve_vars['to'] ='';
@@ -155,7 +160,7 @@
$this->body_display = '';
- $this->my_validator =
CreateObject("phpgwapi.validator");
+ //$this->my_validator =
CreateObject("phpgwapi.validator");
$this->widgets = CreateObject("email.html_widgets");
$this->user_lang =
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
if ($this->user_lang == '')
@@ -488,16 +493,19 @@
$this->reject_reason = "don't spellcheck email
addresses";
return False;
}
- elseif ($this->my_validator->is_url($str) == True)
+ //elseif ($this->my_validator->is_url($str) == True)
+ elseif (preg_match('/[a-zA-Z0-9
\-\.]+\.([a-zA-Z]{2,4})/', $str))
{
- $this->reject_reason = "don't spellcheck a URL";
+ $this->reject_reason = "don't spellcheck a URL
or hostname";
return False;
}
+ /*
elseif ($this->my_validator->is_hostname($str) == True)
{
$this->reject_reason = "don't spellcheck
internet hostnames";
return False;
}
+ */
elseif (preg_match('/^<.*>$/', $str))
{
$this->reject_reason = "don't spellcheck
bracked markup tags";
====================================================
Index: email/inc/class.so_mail_msg.inc.php
diff -u email/inc/class.so_mail_msg.inc.php:1.1
email/inc/class.so_mail_msg.inc.php:1.2
--- email/inc/class.so_mail_msg.inc.php:1.1 Thu Mar 13 20:03:17 2003
+++ email/inc/class.so_mail_msg.inc.php Thu Dec 30 23:13:50 2004
@@ -34,7 +34,29 @@
*/
class so_mail_msg
{
-
+ var $use_group_data=True;
+ //var $use_group_data=False;
+ var $data_group_array=array();
+ var $data_group_done_filled=0;
+ // when something with a folder triggers gathering of group data
+ // store that something here so we know what triggered
gathering group data
+ // because if "folder_status_info" is the trigger, it may not
contain the
+ // folder that is actually what we need later on, because "show
number new
+ // in combobox" will cache that for ALL folders, so a request
for that
+ // status info may to fill the combobox and have nothing to do
with the
+ // folder in which we are later going to need the group data.
+ var $data_group_last_trigger = '';
+
+ /*!
+ @function so_mail_msg
+ @abstract Constructor
+ */
+ function so_mail_msg()
+ {
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: ('.__LINE__.'):
*constructor*<br>'); }
+ return;
+ }
+
/*!
@cabability appsession TEMPORARY DATA CACHING - data we generate
@abstract Caching via the the api appsession cache occurs in 2
basic forms.
@@ -216,9 +238,9 @@
@access Private
@author Angles
*/
- function expire_db_session_bulk_data($called_by='not_specified')
+ function
expire_db_session_bulk_data($called_by='not_specified',
$wipe_absolutely_everything=False)
{
-
+ $this->so_clear_data_group();
// for DB sessions_db, OR used for anglemail table
if (($GLOBALS['phpgw_info']['server']['sessions_type']
== 'db')
|| ($GLOBALS['phpgw']->msg->use_private_table == True))
@@ -260,43 +282,46 @@
$GLOBALS['phpgw']->db->query($query);
}
- // RE-INSERT IMPORTANT DATA
- for ($i=0; $i <
count($GLOBALS['phpgw']->msg->extra_and_default_acounts); $i++)
+ if ($wipe_absolutely_everything == False)
{
- if
($GLOBALS['phpgw']->msg->extra_and_default_acounts[$i]['status'] == 'enabled')
+ // RE-INSERT IMPORTANT DATA
+ for ($i=0; $i <
count($GLOBALS['phpgw']->msg->extra_and_default_acounts); $i++)
{
- $this_acctnum =
$GLOBALS['phpgw']->msg->extra_and_default_acounts[$i]['acctnum'];
- if
($retained_data[$this_acctnum]['mailsvr_callstr'])
+ if
($GLOBALS['phpgw']->msg->extra_and_default_acounts[$i]['status'] == 'enabled')
{
- if
($GLOBALS['phpgw']->msg->use_private_table == True)
- {
-
$this->so_set_data((string)$this_acctnum.';mailsvr_callstr',
$retained_data[$this_acctnum]['mailsvr_callstr']);
- }
- else
+ $this_acctnum =
$GLOBALS['phpgw']->msg->extra_and_default_acounts[$i]['acctnum'];
+ if
($retained_data[$this_acctnum]['mailsvr_callstr'])
{
-
$GLOBALS['phpgw']->session->appsession((string)$this_acctnum.';mailsvr_callstr',
'email', $retained_data[$this_acctnum]['mailsvr_callstr']);
+ if
($GLOBALS['phpgw']->msg->use_private_table == True)
+ {
+
$this->so_set_data((string)$this_acctnum.';mailsvr_callstr',
$retained_data[$this_acctnum]['mailsvr_callstr']);
+ }
+ else
+ {
+
$GLOBALS['phpgw']->session->appsession((string)$this_acctnum.';mailsvr_callstr',
'email', $retained_data[$this_acctnum]['mailsvr_callstr']);
+ }
}
- }
- if
($retained_data[$this_acctnum]['folder_list'])
- {
- if
($GLOBALS['phpgw']->msg->use_private_table == True)
+ if
($retained_data[$this_acctnum]['folder_list'])
{
-
$this->so_set_data((string)$this_acctnum.';folder_list',
$retained_data[$this_acctnum]['folder_list']);
+ if
($GLOBALS['phpgw']->msg->use_private_table == True)
+ {
+
$this->so_set_data((string)$this_acctnum.';folder_list',
$retained_data[$this_acctnum]['folder_list']);
+ }
+ else
+ {
+
$GLOBALS['phpgw']->session->appsession((string)$this_acctnum.';folder_list',
'email', $retained_data[$this_acctnum]['folder_list']);
+ }
}
- else
+ if
($retained_data[$this_acctnum]['mailsvr_namespace'])
{
-
$GLOBALS['phpgw']->session->appsession((string)$this_acctnum.';folder_list',
'email', $retained_data[$this_acctnum]['folder_list']);
- }
- }
- if
($retained_data[$this_acctnum]['mailsvr_namespace'])
- {
- if
($GLOBALS['phpgw']->msg->use_private_table == True)
- {
-
$this->so_set_data((string)$this_acctnum.';mailsvr_namespace',
$retained_data[$this_acctnum]['mailsvr_namespace']);
- }
- else
- {
-
$GLOBALS['phpgw']->session->appsession((string)$this_acctnum.';mailsvr_namespace',
'email', $retained_data[$this_acctnum]['mailsvr_namespace']);
+ if
($GLOBALS['phpgw']->msg->use_private_table == True)
+ {
+
$this->so_set_data((string)$this_acctnum.';mailsvr_namespace',
$retained_data[$this_acctnum]['mailsvr_namespace']);
+ }
+ else
+ {
+
$GLOBALS['phpgw']->session->appsession((string)$this_acctnum.';mailsvr_namespace',
'email', $retained_data[$this_acctnum]['mailsvr_namespace']);
+ }
}
}
}
@@ -314,15 +339,37 @@
function so_am_table_exists()
{
$look_for_me = 'phpgw_anglemail';
+
+ // have we cached this in SESSION cache - NOT the AM
table itself!
+ $appsession_key = $look_for_me.'_exists';
+ $affirmative_value = 'yes';
+ $negative_value = 'no';
+ $appsession_returns =
$this->so_appsession_passthru($appsession_key);
+ if ($appsession_returns == $affirmative_value)
+ {
+ //echo 'so_am_table_exists: result: Actual
APPSESSION reports stored info saying table ['.$look_for_me.'] DOES exist<br>';
+ return True;
+ }
+ elseif ($appsession_returns == $negative_value)
+ {
+ //echo 'so_am_table_exists: result: Actual
APPSESSION reports stored info saying table ['.$look_for_me.'] does NOT
exist<br>';
+ return False;
+ }
+
+ // NO APPSESSION data, continue ...
$table_names = $GLOBALS['phpgw']->db->table_names();
$table_names_serialized = serialize($table_names);
if (strstr($table_names_serialized, $look_for_me))
{
+ // STORE THE POSITIVE ANSWER
+ $this->so_appsession_passthru($appsession_key,
$affirmative_value);
//echo 'so_am_table_exists: result: table
['.$look_for_me.'] DOES exist<br>';
return True;
}
else
{
+ // STORE THE NEGATIVE ANSWER
+ $this->so_appsession_passthru($appsession_key,
$negative_value);
//echo 'so_am_table_exists: result: table
['.$look_for_me.'] does NOT exist<br>';
return False;
}
@@ -336,12 +383,45 @@
@function so_set_data
@abstract ?
*/
- function so_set_data($data_key, $content)
+ function so_set_data($data_key, $content, $compression=False)
{
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_set_data('.__LINE__.'):
ENTERING, $data_key ['.$data_key.'], $compression
['.serialize($compression).']<br>'); }
$account_id =
get_account_id($accountid,$GLOBALS['phpgw']->session->account_id);
$data_key =
$GLOBALS['phpgw']->db->db_addslashes($data_key);
- $content = serialize($content);
- $content =
$GLOBALS['phpgw']->db->db_addslashes($content);
+ // for compression, first choice is BZ2, second choice
is GZ
+ //if (($compression)
+ //&& (function_exists('bzcompress')))
+ //{
+ // $content_preped =
base64_encode(bzcompress(serialize($content)));
+ // $content = '';
+ // unset($content);
+ // if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{ $GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_set_data('.__LINE__.'):
$compression is ['.serialize($compression).'] AND we did serialize and <font
color="green">did BZ2 compress</font>, no addslashes for compressed
content<br>'); }
+ //}
+ //else
+ if (($compression)
+ && (function_exists('gzcompress')))
+ {
+ $content_preped =
base64_encode(gzcompress(serialize($content)));
+ $content = '';
+ unset($content);
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{ $GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_set_data('.__LINE__.'):
$compression is ['.serialize($compression).'] AND we did serialize and <font
color="green">did GZ compress</font>, no addslashes for compressed
content<br>'); }
+ }
+ else
+ {
+ // addslashes only if NOT compressing data
+ // serialize only is NOT a string
+ if (is_string($content))
+ {
+ $content_preped =
$GLOBALS['phpgw']->db->db_addslashes($content);
+ }
+ else
+ {
+ $content_preped =
$GLOBALS['phpgw']->db->db_addslashes(serialize($content));
+ }
+ $content = '';
+ unset($content);
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{ $GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_set_data('.__LINE__.'):
$compress is ['.serialize($compress).'] AND we did serialize with NO
compression<br>'); }
+ }
$GLOBALS['phpgw']->db->query("SELECT content FROM
phpgw_anglemail WHERE "
. "account_id = '".$account_id."' AND data_key
= '".$data_key."'",__LINE__,__FILE__);
@@ -349,42 +429,224 @@
if ($GLOBALS['phpgw']->db->num_rows()==0)
{
$GLOBALS['phpgw']->db->query("INSERT INTO
phpgw_anglemail (account_id,data_key,content) "
- . "VALUES ('" . $account_id . "','" .
$data_key . "','" . $content . "')",__LINE__,__FILE__);
+ . "VALUES ('" . $account_id . "','" .
$data_key . "','" . $content_preped . "')",__LINE__,__FILE__);
}
else
{
- $GLOBALS['phpgw']->db->query("UPDATE
phpgw_anglemail set content='" . $content
+ $GLOBALS['phpgw']->db->query("UPDATE
phpgw_anglemail set content='" . $content_preped
. "' WHERE account_id='" . $account_id
. "' AND data_key='" . $data_key . "'",__LINE__,__FILE__);
}
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_set_data('.__LINE__.'):
LEAVING <br>'); }
}
/*!
@function so_get_data
@abstract ?
*/
- function so_get_data($data_key)
+ function so_get_data($data_key, $compression=False)
{
- $account_id =
get_account_id($accountid,$GLOBALS['phpgw']->session->account_id);
- $data_key =
$GLOBALS['phpgw']->db->db_addslashes($data_key);
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
ENTERING, $data_key ['.$data_key.'], $compression
['.serialize($compression).']<br>'); }
- $GLOBALS['phpgw']->db->query("SELECT content FROM
phpgw_anglemail WHERE "
- . "account_id = '".$account_id."' AND data_key
= '".$data_key."'",__LINE__,__FILE__);
+ // initialize vars to blank
+ $my_content = '';
+ $my_content_preped = '';
- if ($GLOBALS['phpgw']->db->num_rows()==0)
+ if (($this->use_group_data == True)
+ && ($this->so_have_data_group() == False)
+ && ($this->data_group_done_filled < 3))
{
- return False;
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{ $GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
requesting to fill group data<br>'); }
+ // TRUE = make this into a generic LIKE match
string
+ $func_returns =
$this->so_fill_data_group($data_key, True);
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{ $GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
fill group data function returns $func_returns
['.serialize($func_returns).']<br>'); }
+ }
+ elseif (
+ ($this->use_group_data == True)
+ && ($this->so_have_data_group() == True)
+ && ($this->data_group_done_filled < 3)
+ && (strstr($this->data_group_last_trigger,
'folder_status_info'))
+ && (!strstr($data_key, 'folder_status_info'))
+ )
+ {
+ // the folder_status_info retry allowed,
+ // if folder_status_info was the thing that
triggered getting group data,
+ // i.e. the first thing to come in here with a
folder element in it,
+ // then we are allowed one more try for the
next item that is requested
+ // after that that is NOT folder_status_info
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{ $GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
folder_ststus_info retry block, first trigger was folder_status_info, so now
wipe existing group data and retry<br>'); }
+ $this->so_clear_data_group();
+ // TRUE = make this into a generic LIKE match
string
+ $func_returns =
$this->so_fill_data_group($data_key, True);
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{ $GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
retry of fill group data function returns $func_returns
['.serialize($func_returns).']<br>'); }
+ }
+
+ if (($this->use_group_data == False)
+ || ($this->so_have_data_group() == False))
+ {
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{ $GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
group data either disabled or nothing returned, requesting individual data
record<br>'); }
+ $account_id =
get_account_id($accountid,$GLOBALS['phpgw']->session->account_id);
+ $data_key =
$GLOBALS['phpgw']->db->db_addslashes($data_key);
+
+ $GLOBALS['phpgw']->db->query("SELECT content
FROM phpgw_anglemail WHERE "
+ . "account_id = '".$account_id."' AND
data_key = '".$data_key."'",__LINE__,__FILE__);
+
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{ $GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
$GLOBALS[phpgw]->db->num_rows() = ['.$GLOBALS['phpgw']->db->num_rows().']
<br>'); }
+
+ if ($GLOBALS['phpgw']->db->num_rows()==0)
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
LEAVING, returning False<br>'); }
+ return False;
+ }
+ }
+
+ if (($compression)
+ //&& ((function_exists('bzdecompress')) ||
(function_exists('gzuncompress')) )
+ && (function_exists('gzuncompress')))
+ {
+ if (($this->use_group_data == True)
+ && ($this->so_have_data_group() == True))
+ {
+ // no stripslashes for compressed data
(False)
+ $my_content =
$this->so_lookup_data_group($data_key, False);
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
using SO_LOOKUP_DATA_GROUP <br>'); }
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 2) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
so_lookup_data_group $my_content DUMP:', $my_content); }
+ }
+ else
+ {
+ $GLOBALS['phpgw']->db->next_record();
+ // no stripslashes for compressed data
+ $my_content =
$GLOBALS['phpgw']->db->f('content');
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
query for individual record, NOT using group data<br>'); }
+ }
+ $comp_desc = array();
+ $comp_desc['before_decomp'] = 'NA';
+ $comp_desc['after_decomp'] = 'NA';
+ $comp_desc['ratio_txt'] = 'NA';
+ $comp_desc['ratio_math'] = 'NA';
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{ $comp_desc['before_decomp'] = strlen($my_content); }
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{ $GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
strlen($my_content) is ['.$comp_desc['before_decomp'].'], BEFORE decompress,
$compression is ['.serialize($compression).']<br>'); }
+ //if ($GLOBALS['phpgw']->msg->debug_so_class >
2) { $GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
$GLOBALS[phpgw]->db->next_record() yields $my_content DUMP:', $my_content); }
+ if (!$my_content)
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
LEAVING, returning False<br>'); }
+ return False;
+ }
+ // for compression, first choice is BZ2, second
choice is GZ
+ // NEW: BZ2 is SLOWER than zlib
+ //if (function_exists('bzdecompress'))
+ //{
+ // $my_content_preped =
unserialize(bzdecompress(base64_decode($my_content)));
+ // if
($GLOBALS['phpgw']->msg->debug_so_class > 1) { $comp_desc['after_decomp'] =
strlen(serialize($my_content_preped)); $comp_desc['ratio_math'] =
(string)(round(($comp_desc['after_decomp']/$comp_desc['before_decomp']), 1) *
1).'X'; $comp_desc['ratio_txt'] = 'pre/post is ['.$comp_desc['before_decomp'].'
to '.$comp_desc['after_decomp']; }
+ // if
($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
$compression: ['.serialize($compression).'] using <font color="brown">BZ2
decompress</font> pre/post is ['.$comp_desc['ratio_txt'].']; ratio:
['.$comp_desc['ratio_math'].'] <br>'); }
+ //}
+ //else
+ if (function_exists('gzuncompress'))
+ {
+ $my_content_preped =
unserialize(gzuncompress(base64_decode($my_content)));
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 1) { $comp_desc['after_decomp'] =
strlen(serialize($my_content_preped)); $comp_desc['ratio_math'] =
(string)(round(($comp_desc['after_decomp']/$comp_desc['before_decomp']), 1) *
1).'X'; $comp_desc['ratio_txt'] = 'pre/post is ['.$comp_desc['before_decomp'].'
to '.$comp_desc['after_decomp']; }
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
$compression: ['.serialize($compression).'] using <font color="brown">GZ
uncompress</font> pre/post is ['.$comp_desc['ratio_txt'].']; ratio:
['.$comp_desc['ratio_math'].'] <br>'); }
+ }
+ else
+ {
+ $my_content_preped = '';
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
ERROR: $compression: ['.serialize($compression).'] <font
color="brown">decompression ERROR</font> neither "bzdecompress" (first choice)
nor "gzuncompress" (second choice) is available<br>'); }
+ }
+ $my_content = '';
+ unset($my_content);
+ if (!$my_content_preped)
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 2) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
AFTER DECOMPRESS and UNserialization $my_content_preped is GONE!'); }
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
LEAVING, returning False, <font color="red">content did not unserialize,
compression was in use </font> <br>'); }
+ return False;
+ }
+ else
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 2) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
AFTER DECOMPRESS and UNserialization $my_content_preped DUMP:',
$my_content_preped); }
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
LEAVING, got content, <font color="brown"> did decompress </font> , returning
that content<br>'); }
+ return $my_content_preped;
+ }
}
else
{
- $GLOBALS['phpgw']->db->next_record();
- //return
unserialize($GLOBALS['phpgw']->db->f('content', 'stripslashes'));
- $my_content =
$GLOBALS['phpgw']->db->f('content', 'stripslashes');
+ if (($this->use_group_data == True)
+ && ($this->so_have_data_group() == True))
+ {
+ // not using compression so we will
stripslashes
+ $my_content =
$this->so_lookup_data_group($data_key, True);
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
using SO_LOOKUP_DATA_GROUP <br>'); }
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 2) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
so_lookup_data_group $my_content DUMP:', $my_content); }
+ }
+ else
+ {
+ $GLOBALS['phpgw']->db->next_record();
+ // NOTE: we only stripslashes when NOT
using compression
+ $my_content =
$GLOBALS['phpgw']->db->f('content', 'stripslashes');
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
query for individual record, NOT using group data<br>'); }
+ }
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{ $GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
strlen($my_content) is ['.strlen($my_content).']<br>'); }
+ //if ($GLOBALS['phpgw']->msg->debug_so_class >
2) { $GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
$GLOBALS[phpgw]->db->next_record() yields $my_content DUMP:', $my_content); }
if (!$my_content)
{
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
LEAVING, returning False<br>'); }
return False;
}
- $my_content = unserialize($my_content);
- return $my_content;
+ // we serialize only NON-strings,
+ // so unserialize only if content is already
serialized
+ //if
($GLOBALS['phpgw']->msg->is_serialized_str($my_content) == True)
+ if
($GLOBALS['phpgw']->msg->is_serialized_smarter($my_content) == True)
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'): we
need to unserialize this <br>'); }
+ $my_content_preped =
unserialize($my_content);
+ // DID IT WORK
+ //$try_recover = True;
+ $try_recover = False;
+ if (!$my_content_preped)
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'): <b>
<font color="red">ERROR unserializing </font> </b> , probably a slashes
problem<br>'); }
+ if ($try_recover == True)
+ {
+ // try some recovery
methods
+ $my_content_recover =
$my_content;
+ $my_content_recover =
str_replace(':"',':_LEGITQUOTE_',$my_content_recover);
+ $my_content_recover =
str_replace('":','_LEGITQUOTE_:',$my_content_recover);
+ $my_content_recover =
str_replace('";','_LEGITQUOTE_;',$my_content_recover);
+ //$my_content_recover =
str_replace('\/','_ESCAPEDSLASH_',$my_content_recover);
+ //$my_content_recover =
str_replace('/','\/',$my_content_recover);
+ $my_content_recover =
str_replace('\\','\\\\',$my_content_recover);
+ // HACK
+ //$my_content_recover =
str_replace('/','//',$my_content_recover);
+ //$my_content_recover =
str_replace('"','/"',$my_content_recover);
+ $my_content_recover =
str_replace('\"','\_LEGITQUOTE_',$my_content_recover);
+ $my_content_recover =
str_replace('"','\"',$my_content_recover);
+ $my_content_recover =
str_replace('_LEGITQUOTE_','"',$my_content_recover);
+ //$my_content_recover =
str_replace('_ESCAPEDSLASH_','\/',$my_content_recover);
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 2) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
so_lookup_data_group $my_content_recover DUMP:', $my_content_recover); }
+ $my_content_preped =
unserialize($my_content_recover);
+ if (!$my_content_preped)
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'): <b>
<font color="red">2nd ERROR unserializing </font> </b> , recovery did not work,
probably a slashes problem<br>'); }
+ }
+ }
+ }
+ }
+ else
+ {
+ $my_content_preped = $my_content;
+ }
+ $my_content = '';
+ unset($my_content);
+ if (!$my_content_preped)
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 2) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
AFTER UNserialization $my_content_preped is GONE!'); }
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
LEAVING, returning False, <font color="red">content did not unserialize </font>
<br>'); }
+ return False;
+ }
+ else
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 2) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
AFTER UNserialization $my_content_preped DUMP:', $my_content_preped); }
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg: so_get_data('.__LINE__.'):
LEAVING, got content, returning that content<br>'); }
+ return $my_content_preped;
+ }
}
}
@@ -398,6 +660,7 @@
$data_key =
$GLOBALS['phpgw']->db->db_addslashes($data_key);
$GLOBALS['phpgw']->db->query("DELETE FROM
phpgw_anglemail "
. " WHERE account_id='" . $account_id . "' AND
data_key='" . $data_key . "'",__LINE__,__FILE__);
+ $this->so_clear_data_group($data_key);
}
/*!
@@ -409,7 +672,387 @@
$account_id =
get_account_id($accountid,$GLOBALS['phpgw']->session->account_id);
$GLOBALS['phpgw']->db->query("DELETE FROM
phpgw_anglemail "
. " WHERE account_id='" . $account_id .
"'",__LINE__,__FILE__);
+ $this->so_clear_data_group();
}
+ /*!
+ @function so_prop_use_group_data
+ @abstract Delphi style property function for "use_group_data"
+ @discussion This Delphi style property function replaces the
typical "get" and
+ "set" function. No arg passed will return the current value.
Passing False
+ or an empty string sets "use_group_data" to False,
+ passing anything else as an arg sets "use_group_data" to true.
+ @author Angles
+ */
+ function so_prop_use_group_data($feed_value='##NOTHING##')
+ {
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_prop_use_group_data('.__LINE__.'):
ENTERING, current $this->use_group_data
['.serialize($this->use_group_data).'], $feed_value
['.serialize($feed_value).']<br>'); }
+ if ((string)$feed_value == '##NOTHING##')
+ {
+ // do nothing skip down to the return statement
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_prop_use_group_data('.__LINE__.'):
do nothing, $feed_value ['.serialize($feed_value).'] == "##NOTHING##" means
only return current property<br>'); }
+ //return $this->use_group_data;
+ }
+ elseif ($feed_value)
+ {
+ if ($this->use_group_data != True)
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_prop_use_group_data('.__LINE__.'):
toggle $this->use_group_data to True, and thus call "so_clear_data_group" and
set "data_group_done_filled" to 0 and then set to True<br>'); }
+ // maybe we should clear any stored
data, huh?
+ $this->so_clear_data_group();
+ // and maybe we should reset this
excess query counter too, huh?
+ $this->data_group_done_filled = 0;
+ $this->use_group_data = True;
+ }
+ else
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_prop_use_group_data('.__LINE__.'):
do nothing, use_group_data is already TRUE<br>'); }
+ }
+ }
+ elseif (!$feed_value)
+ {
+ if ($this->use_group_data != False)
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_prop_use_group_data('.__LINE__.'):
toggle $this->use_group_data to False, and thus call "so_clear_data_group" and
then set to False<br>'); }
+ // maybe we should clear any stored
data, huh?
+ $this->so_clear_data_group();
+ $this->use_group_data = False;
+ }
+ else
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_prop_use_group_data('.__LINE__.'):
do nothing, use_group_data is already FALSE<br>'); }
+ }
+ }
+ else
+ {
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_prop_use_group_data('.__LINE__.'):
ERROR why am I here?<br>'); }
+ }
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_prop_use_group_data('.__LINE__.'):
LEAVING, returning $this->use_group_data
['.serialize($this->use_group_data).']<br>'); }
+ return $this->use_group_data;
+ }
+
+ /*!
+ @function so_fill_data_group
+ @abstract ?
+ */
+ function so_fill_data_group($data_key_partial='',
$make_like=True)
+ {
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_fill_data_group('.__LINE__.'):
ENTERING, $data_key_partial ['.$data_key_partial.'] $make_like
['.serialize($make_like).']<br>'); }
+ if ($this->use_group_data == False)
+ {
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0)
{
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_fill_data_group('.__LINE__.'):
LEAVING returning False<br>'); }
+ return False;
+ }
+
+ $this->data_group_array = array();
+ if (!$data_key_partial)
+ {
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0)
{
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_fill_data_group('.__LINE__.'):
LEAVING returning False<br>'); }
+ return False;
+ }
+
+ if ($make_like)
+ {
+ $orig_data_key_partial = $data_key_partial;
+ $data_key_exploded = array();
+ $data_key_exploded =
explode(';',$orig_data_key_partial);
+ //SQL pattern matching allows you to use `_' to
match any single character
+ //and `%' to match an arbitrary number of
characters (including zero characters)
+ // make acctnum;ANY THING;folder for our LIKE
querey
+ if ((isset($data_key_exploded[0]))
+ && (isset($data_key_exploded[2])))
+ {
+ // fill this class var, what triggered
the gathering of group data?
+ // because if it was
"folder_status_info" then later we are allowed to try again
+ // since cached folder stats may be
simply to fill the combobox and not related
+ // to the folder we really need the
group data for
+ $this->data_group_last_trigger =
$data_key_partial;
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_fill_data_group('.__LINE__.'):
setting $this->data_group_last_trigger
['.$this->data_group_last_trigger.']<br>'); }
+ // prep for group data query
+ $data_key =
$data_key_exploded[0].';%;'.$data_key_exploded[2].';%';
+ //$data_key =
$data_key_exploded[0].'\;%\;'.$data_key_exploded[2].'\;%';
+ //$data_key =
(string)$data_key_exploded[0].'%'.$data_key_exploded[2].'%';
+ // HOWEVER 2 things also are kept in
the DB that do NOT HAVE A ";" after the folder name
+ $data_key_msgball =
(string)$data_key_exploded[0].';msgball_list;'.$data_key_exploded[2];
+ //$data_key_folder_status_info =
(string)$data_key_exploded[0].';folder_status_info;'.$data_key_exploded[2];
+ // so below we use the LIKE and then OR
= for those 2 additional things, all in one query
+ // without the ";" after the folder
name, the wildcard "%" could match INBOX[anything]
+ // that is bad because if inbox is the
namespace, we get the ENITRE database instead if just INBOX with "INBOX%"
+ // so we use "INBOX;%" to avoid that
madness,
+ // but add those other 2 items so we do
not EXCLUSE them because of the lack of trailing ";" as their data_key
+
+ // DAMN get the folder status info for
EVERY FOLDER in case we need it for the combo box
+ $data_key_folder_status_info =
(string)$data_key_exploded[0].';folder_status_info;%';
+
+ // OK there are some other things we
should get too
+ // these are data that are associated
with the account in general, no folder value is used
+ // NOTE IT IS RARE these are actually
needed one we do fill the group data
+ // because the first data_key with a
folder in it will trigger the filling of group data
+ // this means these things probably
were requested earlier on in the page view anyway
+ $data_key_folder_list =
(string)$data_key_exploded[0].';folder_list';
+ $data_key_mailsvr_callstr =
(string)$data_key_exploded[0].';mailsvr_callstr';
+ $data_key_mailsvr_namespace =
(string)$data_key_exploded[0].';mailsvr_namespace';
+ }
+ //elseif (isset($data_key_exploded[0]))
+ //{
+ // // NO FOLDER means the way we get mass
group data will not work
+ // $data_key =
+ // // NO FOLDER so we can not get these 2
things we would also look for
+ // $data_key_msgball = '';
+ // $data_key_folder_status_info = '';
+ // // HOWEVER ...
+ // // OK there are some other things we
can still get
+ // // these are data that are associated
with the account in general, no folder value is used
+ // $data_key_folder_list =
(string)$data_key_exploded[0].';folder_list';
+ // $data_key_mailsvr_callstr =
(string)$data_key_exploded[0].';mailsvr_callstr';
+ // $data_key_mailsvr_namespace =
(string)$data_key_exploded[0].';mailsvr_namespace';
+ //}
+ else
+ {
+ // Data Key does NOT have a folder name
+ // means the way we get mass group data
will not be worth it
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_fill_data_group('.__LINE__.'):
LEAVING returning False<br>'); }
+ return False;
+ }
+ }
+ else
+ {
+ $data_key = $data_key_partial;
+ $data_key_msgball = '';
+ $data_key_folder_status_info = '';
+ $data_key_folder_list = '';
+ $data_key_mailsvr_callstr = '';
+ $data_key_mailsvr_namespace = '';
+ }
+
+ $account_id =
get_account_id($accountid,$GLOBALS['phpgw']->session->account_id);
+ //if (($data_key)
+ //&& ($data_key_msgball)
+ //&& ($data_key_folder_status_info))
+ //{
+ // $data_key =
$GLOBALS['phpgw']->db->db_addslashes($data_key);
+ // $data_key_msgball =
$GLOBALS['phpgw']->db->db_addslashes($data_key_msgball);
+ // $data_key_folder_status_info =
$GLOBALS['phpgw']->db->db_addslashes($data_key_folder_status_info);
+ // $GLOBALS['phpgw']->db->query("SELECT * FROM
phpgw_anglemail WHERE "
+ // . "account_id = '".$account_id
+ // ."' AND (data_key LIKE '".$data_key
+ // ."' OR data_key = '".$data_key_msgball
+ // ."' OR data_key LIKE
'".$data_key_folder_status_info
+ // ."')"
+ // ,__LINE__,__FILE__);
+ //}
+ if (($data_key)
+ && ($data_key_msgball)
+ && ($data_key_folder_status_info)
+ && ($data_key_folder_list)
+ && ($data_key_mailsvr_callstr)
+ && ($data_key_mailsvr_namespace))
+ {
+ $data_key =
$GLOBALS['phpgw']->db->db_addslashes($data_key);
+ $data_key_msgball =
$GLOBALS['phpgw']->db->db_addslashes($data_key_msgball);
+ $data_key_folder_status_info =
$GLOBALS['phpgw']->db->db_addslashes($data_key_folder_status_info);
+ $data_key_folder_list =
$GLOBALS['phpgw']->db->db_addslashes($data_key_folder_list);
+ $data_key_mailsvr_callstr =
$GLOBALS['phpgw']->db->db_addslashes($data_key_mailsvr_callstr);
+ $data_key_mailsvr_namespace =
$GLOBALS['phpgw']->db->db_addslashes($data_key_mailsvr_namespace);
+ $GLOBALS['phpgw']->db->query("SELECT * FROM
phpgw_anglemail WHERE "
+ . "account_id = '".$account_id
+ ."' AND (data_key LIKE '".$data_key
+ ."' OR data_key = '".$data_key_msgball
+ ."' OR data_key LIKE
'".$data_key_folder_status_info
+ ."' OR data_key =
'".$data_key_folder_list
+ ."' OR data_key =
'".$data_key_mailsvr_callstr
+ ."' OR data_key =
'".$data_key_mailsvr_namespace
+ ."')"
+ ,__LINE__,__FILE__);
+ }
+ //elseif (($data_key_folder_list)
+ //&& ($data_key_mailsvr_callstr)
+ //&& ($data_key_mailsvr_namespace))
+ //{
+ // $data_key =
$GLOBALS['phpgw']->db->db_addslashes($data_key);
+ // $data_key_msgball =
$GLOBALS['phpgw']->db->db_addslashes($data_key_msgball);
+ // $data_key_folder_status_info =
$GLOBALS['phpgw']->db->db_addslashes($data_key_folder_status_info);
+ // $GLOBALS['phpgw']->db->query("SELECT * FROM
phpgw_anglemail WHERE "
+ // . "account_id = '".$account_id
+ // ."' AND (data_key =
'".$data_key_folder_list
+ // ."' OR data_key =
'".$data_key_mailsvr_callstr
+ // ."' OR data_key =
'".$data_key_mailsvr_namespace
+ // ."')"
+ // ,__LINE__,__FILE__);
+ //}
+ else
+ {
+ $data_key =
$GLOBALS['phpgw']->db->db_addslashes($data_key);
+ $GLOBALS['phpgw']->db->query("SELECT * FROM
phpgw_anglemail WHERE "
+ . "account_id = '".$account_id."' AND
data_key LIKE '".$data_key."'",__LINE__,__FILE__);
+ }
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg:
so_fill_data_group('.__LINE__.'): $data_key ['.htmlspecialchars($data_key).']
$data_key_msgball ['.htmlspecialchars($data_key_msgball).']
$data_key_folder_status_info
['.htmlspecialchars($data_key_folder_status_info).']<br>'); }
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg:
so_fill_data_group('.__LINE__.'): $data_key_folder_list
['.htmlspecialchars($data_key_folder_list).'] $data_key_mailsvr_callstr
['.htmlspecialchars($data_key_mailsvr_callstr).'] $data_key_mailsvr_namespace
['.htmlspecialchars($data_key_mailsvr_namespace).']<br>'); }
+ $num_rows = $GLOBALS['phpgw']->db->num_rows();
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg:
so_fill_data_group('.__LINE__.'): $num_rows ['.$num_rows.']<br>'); }
+ if ($num_rows == 0)
+ {
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0)
{
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_fill_data_group('.__LINE__.'):
LEAVING returning False<br>'); }
+ return False;
+ }
+ // increment counter how many times we have filled
group data
+ // maybe some day we use to tell us when this is not
appropriate if overused for some transactions
+ $this->data_group_done_filled++;
+
+ for ($i = 0; $i < $num_rows; $i++)
+ {
+ $GLOBALS['phpgw']->db->next_record();
+ $my_data_key =
$GLOBALS['phpgw']->db->f('data_key', 'stripslashes');
+ // NOTE: we only stripslashes when NOT using
compression
+ // so we will stripslashes later if we need to
+ $my_content =
$GLOBALS['phpgw']->db->f('content');
+ $this->data_group_array[$my_data_key] =
$my_content;
+ }
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 2) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg:
so_fill_data_group('.__LINE__.'): $this->data_group_array DUMP:',
$this->data_group_array); }
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_fill_data_group('.__LINE__.'):
LEAVING returning TRUE, did fill group data<br>'); }
+ return True;
+ }
+
+ /*!
+ @function so_have_data_group
+ @abstract ?
+ */
+ function so_have_data_group()
+ {
+ if (!$this->data_group_array)
+ {
+ return False;
+ }
+ else
+ {
+ return True;
+ }
+ }
+
+ /*!
+ @function so_clear_data_group
+ @abstract ?
+ */
+ function so_clear_data_group($data_key='')
+ {
+ if (!$this->data_group_array)
+ {
+ return False;
+ }
+
+ if (!$data_key)
+ {
+ // wipe everything
+ $this->data_group_array = array();
+ return True;
+ }
+ elseif (isset($this->data_group_array[$data_key]))
+ {
+ // erease only one element
+ $this->data_group_array[$data_key] = '';
+ unset($this->data_group_array[$data_key]);
+ return True;
+ }
+ else
+ {
+ // supposed to erease a single element but it
is not set
+ return False;
+ }
+ }
+
+ /*!
+ @function so_lookup_data_group
+ @abstract ?
+ */
+ function so_lookup_data_group($data_key, $do_stripslashes='')
+ {
+ if ($this->use_group_data == False)
+ {
+ return False;
+ }
+ if (!$this->data_group_array)
+ {
+ return False;
+ }
+ if (!isset($this->data_group_array[$data_key]))
+ {
+ return False;
+ }
+
+ if ($do_stripslashes)
+ {
+ return
stripslashes($this->data_group_array[$data_key]);
+ }
+ else
+ {
+ return $this->data_group_array[$data_key];
+ }
+ }
+
+
+ /*!
+ @function so_appsession_passthru
+ @abstract this will ONLY use the ACTUAL REAL APPSESSION of
phpgwapi
+ @param $location (string) in phpgwapi session speak this is the
"name" of the information aka the
+ key in a key value pair
+ @param $location (string) OPTIONAL the value in the key value
pair. Empty will erase I THINK the
+ apsession data stored for the "name" aka the "location".
+ @discussion This is a SIMPLE PASSTHRU for the real phpgwapi
session call. This function will
+ never use the anglemail table, it is intended for stuff we
REALLY want to last only for one session.
+ @author Angles
+ */
+ function
so_appsession_passthru($location='',$data='##NOTHING##', $compression=False)
+ {
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_appsession_passthru('.__LINE__.'):
ENTERING: $location ['.$location.'], $compression
['.serialize($compression).']<br>'); }
+ if ($GLOBALS['phpgw']->msg->session_cache_enabled ==
False)
+ {
+ // flag means we do not use any session caching
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0)
{
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_appsession_passthru('.__LINE__.'):
LEAVING, msg->session_cache_enabled False, so disabled session caching,
returning False<br>'); }
+ return False;
+ }
+ // ok we are allowed to do session caching ...
+ // since $data may be boolean, boolean True will == any
filled string
+ // so for accuracy here we need to case $data as a
string to do a real == statement
+ if ((string)$data == '##NOTHING##')
+ {
+ // means we are GETTING data from appsession
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_appsession_passthru('.__LINE__.'):
request to get data<br>'); }
+ if (($compression)
+ && (function_exists('gzuncompress')))
+ {
+ $content =
$GLOBALS['phpgw']->session->appsession($location, 'email');
+ $content_preped =
base64_encode(gzuncompress(serialize($content)));
+ $content = '';
+ unset($content);
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_appsession_passthru('.__LINE__.'):
LEAVING, returning passthru data hopefully<br>'); }
+ return $content_preped;
+ }
+ else
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_appsession_passthru('.__LINE__.'):
LEAVING, returning passthru data<br>'); }
+ return
$GLOBALS['phpgw']->session->appsession($location, 'email');
+ }
+ }
+ else
+ {
+ // means we are SETTING data to appsession
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 1)
{
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_appsession_passthru('.__LINE__.'):
request to SET data<br>'); }
+ if (($compression)
+ && (function_exists('gzcompress')))
+ {
+ $content_preped =
base64_encode(gzcompress(serialize($data)));
+ $data = '';
+ unset($data);
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_appsession_passthru('.__LINE__.'):
LEAVING, returning passthru value<br>'); }
+ return
$GLOBALS['phpgw']->session->appsession($location, 'email', $content_preped);
+ }
+ else
+ {
+ if
($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_appsession_passthru('.__LINE__.'):
LEAVING, returning passthru value<br>'); }
+ return
$GLOBALS['phpgw']->session->appsession($location, 'email', $data);
+ }
+ }
+ if ($GLOBALS['phpgw']->msg->debug_so_class > 0) {
$GLOBALS['phpgw']->msg->dbug->out('so_mail_msg.so_appsession_passthru('.__LINE__.'):
ERROR: we should have returned by now<br>'); }
+ }
}
?>
====================================================
Index: email/inc/class.mail_send.inc.php
diff -u email/inc/class.mail_send.inc.php:1.11
email/inc/class.mail_send.inc.php:1.12
--- email/inc/class.mail_send.inc.php:1.11 Fri Mar 14 04:01:08 2003
+++ email/inc/class.mail_send.inc.php Thu Dec 30 23:13:50 2004
@@ -202,12 +202,42 @@
$mymachine = $mail_out['mta_elho_mymachine'];
$fromuser = $mail_out['mta_from'];
// START SMTP SESSION - now we can send our message.
1st we identify ourselves and the sender
- $cmds = array (
- "\$src = \$this->msg2socket(\$socket,\"EHLO
\$mymachine\r\n\");",
- "\$rrc = \$this->socket2msg(\$socket);",
- "\$src = \$this->msg2socket(\$socket,\"MAIL
FROM:\$fromuser\r\n\");",
- "\$rrc = \$this->socket2msg(\$socket);"
- );
+// START CHANGES JF
+// lets assume for the purpose of testing that these variables were already
set up somewhere.
+// That still needs to be done properly.
+// angles: this is a temp handler until it gets in the email site setup page
as site option
+$smtp_auth_login_required = False;
+//$smtp_auth_login_required = true;
+$mylogin = "xxxxxx";
+$mypassword = "xxxxxxxxxx";
+
+ if ($smtp_auth_login_required)
+ {
+ $mybase64login=base64_encode($mylogin);
+ $mybase64password=base64_encode($mypassword);
+ $cmds = array (
+ "\$src =
\$this->msg2socket(\$socket,\"EHLO \$mymachine\r\n\");",
+ "\$rrc = \$this->socket2msg(\$socket);",
+ "\$src =
\$this->msg2socket(\$socket,\"AUTH LOGIN\r\n\");",
+ "\$rrc = \$this->socket2msg(\$socket);",
+ "\$src =
\$this->msg2socket(\$socket,\"\$mybase64login\r\n\");",
+ "\$rrc = \$this->socket2msg(\$socket);",
+ "\$src =
\$this->msg2socket(\$socket,\"\$mybase64password\r\n\");",
+ "\$rrc = \$this->socket2msg(\$socket);",
+ "\$src =
\$this->msg2socket(\$socket,\"MAIL FROM:\$fromuser\r\n\");",
+ "\$rrc = \$this->socket2msg(\$socket);"
+ );
+ }
+ else
+ {
+ $cmds = array (
+ "\$src =
\$this->msg2socket(\$socket,\"EHLO \$mymachine\r\n\");",
+ "\$rrc = \$this->socket2msg(\$socket);",
+ "\$src =
\$this->msg2socket(\$socket,\"MAIL FROM:\$fromuser\r\n\");",
+ "\$rrc = \$this->socket2msg(\$socket);"
+ );
+ }
+// END CHANGES JF
if ($this->debug_fake_send)
{
echo '<pre>';
====================================================
Index: email/inc/class.msg_bootstrap.inc.php
diff -u email/inc/class.msg_bootstrap.inc.php:1.2
email/inc/class.msg_bootstrap.inc.php:1.3
--- email/inc/class.msg_bootstrap.inc.php:1.2 Fri Mar 14 04:01:08 2003
+++ email/inc/class.msg_bootstrap.inc.php Thu Dec 30 23:13:50 2004
@@ -48,6 +48,9 @@
//var $do_login = False;
var $do_login_ex = 0;
+ var $debug_level=0;
+ //var $debug_level=3;
+
function msg_bootstrap()
{
if (defined(BS_LOGIN_NEVER) == False)
@@ -122,7 +125,7 @@
*/
function set_do_login($do_login='##NOTHING##',
$called_by='not_provided')
{
- if ($debug_level > 0) { echo 'ENTERING: msg_bootstrap:
set_do_login: (called_by: '.$called_by.') param $do_login:
['.serialize($do_login).']'.'<br>'; }
+ if ($this->debug_level > 0) { echo 'ENTERING:
msg_bootstrap: set_do_login: (called_by: '.$called_by.') param $do_login:
['.serialize($do_login).']'.'<br>'; }
// backward compat, when this was only true or false
if (is_bool($do_login))
{
@@ -137,7 +140,7 @@
$this->do_login_ex = BS_LOGIN_NEVER;
}
// LEAVING HERE
- if ($debug_level > 0) { echo 'LEAVING:
msg_bootstrap: set_do_login: (bool input) (called_by: '.$called_by.')
$this->do_login: ['.$this->do_login.'] $this->do_login_ex:
['.$this->do_login_ex.'] '.'<br>'; }
+ if ($this->debug_level > 0) { echo 'LEAVING:
msg_bootstrap: set_do_login: (bool input) (called_by: '.$called_by.')
$this->do_login: ['.$this->do_login.'] $this->do_login_ex:
['.$this->do_login_ex.'] '.'<br>'; }
return $this->do_login;
}
elseif (is_int($do_login))
@@ -175,7 +178,7 @@
$this->do_login = True;
$this->do_login_ex = BS_LOGIN_ONLY_IF_NEEDED;
}
- if ($debug_level > 0) { echo 'LEAVING: msg_bootstrap:
set_do_login: (not bool input) (called_by: '.$called_by.') $this->do_login:
['.$this->do_login.'] $this->do_login_ex: ['.$this->do_login_ex.'] '.'<br>'; }
+ if ($this->debug_level > 0) { echo 'LEAVING:
msg_bootstrap: set_do_login: (not bool input) (called_by: '.$called_by.')
$this->do_login: ['.$this->do_login.'] $this->do_login_ex:
['.$this->do_login_ex.'] '.'<br>'; }
return $this->do_login_ex;
}
@@ -233,7 +236,11 @@
*/
function ensure_mail_msg_exists($called_by='not_provided',
$debug_level=0)
{
- if ($debug_level > 0) { echo 'ENTERING: msg_bootstrap:
ensure_mail_msg_exists: (called_by: '.$called_by.')'.'<br>'; }
+ if ($debug_level > $this->debug_level)
+ {
+ $this->debug_level = $debug_level;
+ }
+ if ($this->debug_level > 0) { echo 'ENTERING:
msg_bootstrap: ensure_mail_msg_exists: (called_by: '.$called_by.')'.'<br>'; }
// make sure do_login has been set
if ($this->get_do_login_ex() == BS_LOGIN_NOT_SPECIFIED)
@@ -241,37 +248,48 @@
// this gives us a good general default value
$tmp_prev_value = $this->get_do_login();
$this->set_do_login($tmp_prev_value);
- }
+ }
// make sure utility classes (like html widgets) exist
for global access
//$this->ensure_utility_classes($debug_level);
if (is_object($GLOBALS['phpgw']->msg))
+ //if ((isset($GLOBALS['phpgw']->msg))
+ //&& (isset($GLOBALS['phpgw']->msg->been_constructed))
+ //&& ($GLOBALS['phpgw']->msg->been_constructed == True)
+ //)
{
- if ($debug_level > 1) { echo 'msg_bootstrap:
ensure_mail_msg_exists: (called_by: '.$called_by.'): is_object test:
$GLOBALS[phpgw]->msg is already set, do not create again<br>'; }
+ if ($this->debug_level > 1) { echo
'msg_bootstrap: ensure_mail_msg_exists('.__LINE__.'): (called_by:
'.$called_by.'): is_object test: $GLOBALS[phpgw]->msg is already set, do not
create again<br>'; }
}
else
{
- if ($debug_level > 1) { echo 'msg_bootstrap:
ensure_mail_msg_exists: (called_by: '.$called_by.'): $GLOBALS[phpgw]->msg is
NOT set, creating mail_msg object<br>'; }
+ if ($this->debug_level > 1) { echo
'msg_bootstrap: ensure_mail_msg_exists('.__LINE__.'): (called_by:
'.$called_by.'): $GLOBALS[phpgw]->msg is NOT set, creating mail_msg
object<br>'; }
$GLOBALS['phpgw']->msg =
CreateObject("email.mail_msg");
+ //$GLOBALS['phpgw']->msg =&
CreateObject("email.mail_msg");
+
//include_once(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_msg_base.inc.php');
+
//include_once(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_msg_wrappers.inc.php');
+
//include_once(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_msg_display.inc.php');
+ //$GLOBALS['phpgw']->msg =& new mail_msg;
+ if ($this->debug_level > 1) { echo
'msg_bootstrap: ensure_mail_msg_exists('.__LINE__.'): $GLOBALS[phpgw]->msg
created mail_msg object, now calling needed initialization function aka manual
constructor function, "initialize_mail_msg"<br>'; }
+ $GLOBALS['phpgw']->msg->initialize_mail_msg();
}
if
($GLOBALS['phpgw']->msg->get_isset_arg('already_grab_class_args_gpc'))
{
// mail_msg had already run thru
"begin_request", do not call it again
- if ($debug_level > 0) { echo 'msg_bootstrap:
ensure_mail_msg_exists: (called_by: '.$called_by.'): LEAVING , msg object
already initialized<br>'; }
+ if ($this->debug_level > 0) { echo
'msg_bootstrap: ensure_mail_msg_exists('.__LINE__.'): (called_by:
'.$called_by.'): LEAVING , msg object already initialized<br>'; }
return True;
}
$args_array = Array();
// should we log in or not
- if ($debug_level > 1) { echo 'msg_bootstrap:
ensure_mail_msg_exists: (called_by: '.$called_by.'): $this->do_login:
['.serialize($this->do_login).']<br>'; }
+ if ($this->debug_level > 1) { echo 'msg_bootstrap:
ensure_mail_msg_exists: (called_by: '.$called_by.'): $this->do_login:
['.serialize($this->do_login).']<br>'; }
$args_array['do_login'] = $this->do_login;
- if ($debug_level > 1) { echo 'msg_bootstrap:
ensure_mail_msg_exists: (called_by: '.$called_by.'): $this->do_login_ex:
['.serialize($this->do_login_ex).']<br>'; }
+ if ($this->debug_level > 1) { echo 'msg_bootstrap:
ensure_mail_msg_exists: (called_by: '.$called_by.'): $this->do_login_ex:
['.serialize($this->do_login_ex).']<br>'; }
$args_array['do_login_ex'] = $this->do_login_ex;
// "start your engines"
- if ($debug_level > 1) { echo 'msg_bootstrap:
ensure_mail_msg_exists: (called_by: '.$called_by.'): call msg->begin_request
with args array:<pre>'; print_r($args_array); echo '</pre>'; }
+ if ($this->debug_level > 1) { echo 'msg_bootstrap:
ensure_mail_msg_exists: (called_by: '.$called_by.'): call msg->begin_request
with args array:<pre>'; print_r($args_array); echo '</pre>'; }
$some_stream =
$GLOBALS['phpgw']->msg->begin_request($args_array);
// error if login failed
if (($args_array['do_login'] == True)
@@ -281,7 +299,8 @@
}
// login error will halt this script execution
// else all is good to go and script continues...
- if ($debug_level > 0) { echo 'EXIT: msg_bootstrap:
ensure_mail_msg_exists: (called_by: '.$called_by.')'.'<br>'; }
+ if ($this->debug_level > 2) { echo 'msg_bootstrap:
about to leave ensure_mail_msg_exists, $GLOBALS[] DUMP:<pre>';
print_r($GLOBALS); echo '</pre>'; }
+ if ($this->debug_level > 0) { echo 'EXIT:
msg_bootstrap: ensure_mail_msg_exists: (called_by: '.$called_by.')'.'<br>'; }
}
/*!
@@ -300,21 +319,21 @@
// DEBUG - override debug_level param
//$debug_level = 3;
- if ($debug_level > 0) { echo 'ENTERING: msg_bootstrap:
ensure_utility_classes: <br>'; }
+ if ($this->debug_level > 0) { echo 'ENTERING:
msg_bootstrap: ensure_utility_classes: <br>'; }
if (is_object($GLOBALS['phpgw']->widgets))
{
- if ($debug_level > 1) { echo 'msg_bootstrap:
ensure_utility_classes: is_object test: $GLOBALS[phpgw]->widgets is already
set, do not create again<br>'; }
+ if ($this->debug_level > 1) { echo
'msg_bootstrap: ensure_utility_classes: is_object test:
$GLOBALS[phpgw]->widgets is already set, do not create again<br>'; }
}
else
{
- if ($debug_level > 1) { echo 'msg_bootstrap:
ensure_utility_classes: $GLOBALS[phpgw]->widgets is NOT set, creating
html_widgets object<br>'; }
+ if ($this->debug_level > 1) { echo
'msg_bootstrap: ensure_utility_classes: $GLOBALS[phpgw]->widgets is NOT set,
creating html_widgets object<br>'; }
$my_widgets =
CreateObject("email.html_widgets");
$GLOBALS['phpgw']->widgets = $my_widgets;
}
- if ($debug_level > 0) { echo 'EXIT: msg_bootstrap:
ensure_utility_classes: <br>'; }
+ if ($this->debug_level > 0) { echo 'EXIT:
msg_bootstrap: ensure_utility_classes: <br>'; }
}
}
====================================================
Index: email/inc/class.mail_dcom_base.inc.php
diff -u email/inc/class.mail_dcom_base.inc.php:1.9
email/inc/class.mail_dcom_base.inc.php:1.10
--- email/inc/class.mail_dcom_base.inc.php:1.9 Fri Mar 14 04:00:44 2003
+++ email/inc/class.mail_dcom_base.inc.php Thu Dec 30 23:13:50 2004
@@ -140,7 +140,16 @@
// get rid of that 'needle' "}"
$name['folder_before'] =
substr($name['folder_before'], 1);
// translate
- $name['folder_after'] =
imap_utf7_encode($name['folder_before']);
+ if (function_exists('recode_string') == False)
+ {
+ $name['folder_after'] =
imap_utf7_encode($name['folder_before']);
+ }
+ else
+ {
+ // Modif UTF-8 by Sam Przyswa so now
compatible with MS-Outlook and Netscape accentued folder name
+ $name_tmp =
recode_string("ISO-8859-1..UTF-7", $name['folder_before']);
+ $name['folder_after'] =
str_replace("+", "&", $name_tmp);
+ }
// replace old folder name with new folder name
$name['translated'] =
str_replace($name['folder_before'], $name['folder_after'], $data_str);
}
@@ -253,7 +262,16 @@
// get rid of that 'needle' "}"
$name['folder_before'] =
substr($name['folder_before'], 1);
// translate
- $name['folder_after'] =
imap_utf7_decode($name['folder_before']);
+ if (function_exists('recode_string') == False)
+ {
+ $name['folder_after'] =
imap_utf7_decode($name['folder_before']);
+ }
+ else
+ {
+ // Modif UTF-8 by Sam Przyswa so now
compatible with MS-Outlook and Netscape accentued folder name
+ $name_tmp = str_replace("&", "+",
$name['folder_before']);
+ $name['folder_after'] =
recode_string("UTF-7..ISO-8859-1", $name_tmp);
+ }
// "imap_utf7_decode" returns False if no
translation occured (supposed to, can return identical string too)
if ( ($name['folder_after'] == False)
|| ($name['folder_before'] ==
$name['folder_after']) )
@@ -294,6 +312,28 @@
}
/*!
+ @function folder_list_did_change
+ @abstract if folder is created, deleted, or renamed this this
function handles cleanup of stale data in main msg object.
+ @author Angles
+ */
+ function folder_list_did_change()
+ {
+ // NOTE THIS FLAG "folder_list_changed" IS NOW
OBSOLETED SINCE THIS
+ // CALLBACK FUNCTION IS PROVEN TO WORK
+ $this->folder_list_changed = True;
+ if (is_object($GLOBALS['phpgw']->msg))
+ {
+ // call that classes "callback" function
designed to handle cleaning stale folder_list there
+ $sucess =
$GLOBALS['phpgw']->msg->folder_list_change_callback();
+ // if it was handled correctly, then reset the
"folder_list_changed" because we did our job
+ if ($sucess)
+ {
+ $this->folder_list_changed = False;
+ }
+ }
+ }
+
+ /*!
@function get_flag
@abstract ?
*/
====================================================
Index: email/inc/class.mail_dcom.inc.php
diff -u email/inc/class.mail_dcom.inc.php:1.10
email/inc/class.mail_dcom.inc.php:1.11
--- email/inc/class.mail_dcom.inc.php:1.10 Fri Mar 14 04:00:42 2003
+++ email/inc/class.mail_dcom.inc.php Thu Dec 30 23:13:50 2004
@@ -46,9 +46,13 @@
)
{
$mail_server_type = $p1;
+ if ($debug_dcom) { echo 'DCOM DEBUG: found class feed arg $p1
['.serialize($p1).']<br>'; }
+ //{ echo 'DCOM DEBUG: found class feed arg $p1
['.serialize($p1).']<br>'; }
}
else
{
+ if ($debug_dcom) { echo 'DCOM DEBUG: did NOT find class feed
arg $p1 ['.serialize($p1).']<br>'; }
+ //{ echo 'DCOM DEBUG: did NOT find class feed arg $p1
['.serialize($p1).']<br>'; }
$mail_server_type =
$GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type'];
}
====================================================
Index: email/inc/class.boaction.inc.php
diff -u email/inc/class.boaction.inc.php:1.17
email/inc/class.boaction.inc.php:1.18
--- email/inc/class.boaction.inc.php:1.17 Fri Mar 14 04:00:10 2003
+++ email/inc/class.boaction.inc.php Thu Dec 30 23:13:50 2004
@@ -25,6 +25,8 @@
'get_attach' => True,
'view_html' => True
);
+ // class var to hold content to be downloaded
+ var $output_data='';
// if bomessage wants this preserves, we detect that and store
it here
var $no_fmt='';
var $debug = 0;
@@ -32,6 +34,7 @@
//var $debug = 4;
var $debug_new_env = 0;
+ //var $debug_new_env = 3;
//var $debug_new_env = 4;
var $msg_bootstrap;
@@ -58,7 +61,7 @@
function boaction()
{
- return;
+ //return;
}
/*!
@@ -75,11 +78,18 @@
*/
function delmov()
{
- if ($this->debug > 0) { echo 'ENTERING
emai.boaction.delmov'.'<br>'; }
+ //if ($this->debug > 0) { echo 'ENTERING
email.boaction.delmov'.'<br>'; }
+
+ if( $GLOBALS['phpgw']->session->is_repost() ) //stop
double deletion
+ {
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/email/index.php'));
+ exit;
+ }
// make sure we have msg object and a server stream
$this->msg_bootstrap =
CreateObject("email.msg_bootstrap");
-
$this->msg_bootstrap->ensure_mail_msg_exists('emai.boaction.delmov',
$this->debug);
+
$this->msg_bootstrap->ensure_mail_msg_exists('email.boaction.delmov',
$this->debug);
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('ENTERING email.boaction.delmov'.'<br>'); }
// initialize this to an "ignore me" value, we change
it later only if it should have a meaning
// MOVED TO MSG CLASS
@@ -140,7 +150,7 @@
"nextmatches" view, then the code _SHOULD_ page
back to where there are messages to show,
BUT this is not done yet.
*/
- if ($this->debug > 0) { echo
'emai.boaction.delmov: get_arg_value(what) == "move") <br>'; }
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov: get_arg_value(what)
== "move") <br>'); }
/*
$fromacctnum =
(int)$GLOBALS['phpgw']->msg->get_arg_value('acctnum');
@@ -188,7 +198,7 @@
for ($i = 0; $i < count($delmov_list); $i++)
{
- if ($this->debug > 2) { echo
'email.boaction.delmov: in mail move loop ['.(string)($i+1).'] of
['.$tm.']<br>'; }
+ if ($this->debug > 2) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov: in mail move loop
['.(string)($i+1).'] of ['.$tm.']<br>'); }
$mov_msgball = $delmov_list[$i];
// WHY URLDECODE SO SOON?
//$mov_msgball['folder'] =
$GLOBALS['phpgw']->msg->prep_folder_in($mov_msgball['folder']);
@@ -196,7 +206,7 @@
$did_move = False;
//if ($this->debug > 2) { echo
'email.boaction.delmov: calling
$GLOBALS[phpgw]->msg->interacct_mail_move('.serialize($mov_msgball).',
'.serialize($to_fldball).'<br>'; }
//$did_move =
$GLOBALS['phpgw']->msg->interacct_mail_move($mov_msgball, $to_fldball);
- if ($this->debug > 2) { echo
'email.boaction.delmov: calling
$GLOBALS[phpgw]->msg->industrial_interacct_mail_move('.serialize($mov_msgball).',
'.serialize($to_fldball).'<br>'; }
+ if ($this->debug > 2) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov: calling
$GLOBALS[phpgw]->msg->industrial_interacct_mail_move('.serialize($mov_msgball).',
'.serialize($to_fldball).'<br>'); }
// single move, NO NEED to use the move
grouping stuff, NOTE $tm was filled above as count($delmov_list)
// MOVED TO FLUSH MOVES LOGIG
//if ($tm == 1)
@@ -206,19 +216,19 @@
//}
//else
//{
- if ($this->debug > 2) { echo
'email.boaction.delmov: calling
$GLOBALS[phpgw]->msg->industrial_interacct_mail_move('.serialize($mov_msgball).',
'.serialize($to_fldball).'<br>'; }
+ if ($this->debug > 2) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov: calling
$GLOBALS[phpgw]->msg->industrial_interacct_mail_move('.serialize($mov_msgball).',
'.serialize($to_fldball).'<br>'); }
$did_move =
$GLOBALS['phpgw']->msg->industrial_interacct_mail_move($mov_msgball,
$to_fldball);
//}
if ($did_move == False)
{
// error
- if ($this->debug > 0) { echo
'email.boaction.delmov ('.__LINE__.'): ***ERROR****
$GLOBALS[phpgw]->msg->industrial_interacct_mail_move() returns FALSE, ERROR,
break out of loop<br>'
- .' * * Server
reports error: '.$GLOBALS['phpgw']->msg->phpgw_server_last_error().'<br>'; }
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
***ERROR**** $GLOBALS[phpgw]->msg->industrial_interacct_mail_move() returns
FALSE, ERROR, break out of loop<br>'
+ .' * * Server
reports error: '.$GLOBALS['phpgw']->msg->phpgw_server_last_error().'<br>'); }
break;
}
else
{
- if ($this->debug > 1) { echo
'email.boaction.delmov ('.__LINE__.'):
$GLOBALS[phpgw]->msg->industrial_interacct_mail_move() returns True<br>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
$GLOBALS[phpgw]->msg->industrial_interacct_mail_move() returns True<br>'); }
//$did_expunge = False;
//$did_expunge =
$GLOBALS['phpgw']->msg->phpgw_expunge($mov_msgball['acctnum'], $mov_msgball);
//if ($this->debug > 2) { echo
'email.boaction.delmov: $GLOBALS[phpgw]->msg->phpgw_expunge() returns
'.serialize($did_expunge).'<br>'; }
@@ -226,10 +236,10 @@
}
// ok, done moving, now expunge,
"industrial_interacct_mail_move" uses ""
- if ($this->debug > 0) { echo
'email.boaction.delmov ('.__LINE__.'): done moving, now call
$GLOBALS[phpgw]->msg->expunge_expungable_folders<br>'; }
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'): done
moving, now call $GLOBALS[phpgw]->msg->expunge_expungable_folders<br>'); }
$did_expunge = False;
$did_expunge =
$GLOBALS['phpgw']->msg->expunge_expungable_folders('email.boaction.delmov LINE
'.__LINE__);
- if ($this->debug > 2) { echo
'email.boaction.delmov ('.__LINE__.'):
$GLOBALS[phpgw]->msg->expunge_expungable_folders() returns
['.serialize($did_expunge).']<br>'; }
+ if ($this->debug > 2) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
$GLOBALS[phpgw]->msg->expunge_expungable_folders() returns
['.serialize($did_expunge).']<br>'); }
if (! $did_move)
{
@@ -238,7 +248,10 @@
//echo 'Server reports error:
'.$GLOBALS['phpgw']->msg->dcom->server_last_error();
}
// report folder messages were moved to
- $tf =
$GLOBALS['phpgw']->msg->prep_folder_out($to_fldball['folder']);
+ //$tf =
$GLOBALS['phpgw']->msg->prep_folder_out($to_fldball['folder']);
+ // folder in this array was never changed from
its "prepped out" state, it is still urlencoded from when we first picked it up
+ $tf = $to_fldball['folder'];
+ //echo 'boaction: $tf ['.$tf.'] <br>';
// folder or message we should go back to
if
(($GLOBALS['phpgw']->msg->get_isset_arg('move_postmove_goto'))
@@ -247,15 +260,18 @@
// THIS MEANS WE WERE CALLED BY
UIMESSAGE
// treat the post-move navigation like
a "delete_single_msg", as per data passed to us from that page
$move_postmove_goto =
$GLOBALS['phpgw']->msg->get_arg_value('move_postmove_goto');
- if ($this->debug > 1) { echo
'emai.boaction.delmov ('.__LINE__.'): move single *called by uimessage*:
$move_postmove_goto: : '.$move_postmove_goto.'<br>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'): move
single *called by uimessage*: $move_postmove_goto: :
'.$move_postmove_goto.'<br>'); }
// ---- "Go To Previous Message"
Handling -----
// these insrustions passed from
uimessage when prev_next_navigation is obtained anyway
$this->redirect_to =
$move_postmove_goto;
- if ($this->debug > 1) { echo
'emai.boaction.delmov: ('.__LINE__.') move single *called by uimessage*:
determination of $this->redirect_to : ['.$this->redirect_to.']<br>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov: ('.__LINE__.') move
single *called by uimessage*: determination of $this->redirect_to :
['.$this->redirect_to.']<br>'); }
}
else
{
- $return_to_fldball['folder'] =
$GLOBALS['phpgw']->msg->prep_folder_out($delmov_list[0]['folder']);
+ //$return_to_fldball['folder'] =
$GLOBALS['phpgw']->msg->prep_folder_out($delmov_list[0]['folder']);
+ // folder in this array was never
changed from its "prepped out" state, it is still urlencoded from when we first
picked it up
+ $return_to_fldball['folder'] =
$delmov_list[0]['folder'];
+ //echo 'boaction:
$return_to_fldball[folder] ['.$return_to_fldball['folder'].'] <br>';
$return_to_fldball['acctnum'] =
$delmov_list[0]['acctnum'];
$this->redirect_to =
$GLOBALS['phpgw']->link(
@@ -269,7 +285,7 @@
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start'));
- if ($this->debug > 1) { echo
'emai.boaction.delmov ('.__LINE__.'): NOT called by uimessage, determination of
$this->redirect_to : ['.$this->redirect_to.']<br>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'): NOT
called by uimessage, determination of $this->redirect_to :
['.$this->redirect_to.']<br>'); }
}
}
// ---- DELETE (MULTIPLE) MESSAGES ----
@@ -284,7 +300,7 @@
using its "folder" and "acctnum" values.
*/
- if ($this->debug > 0) { echo
'emai.boaction.delmov: get_arg_value(what) == "delall") <br>'; }
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov: get_arg_value(what)
== "delall") <br>'); }
// this is called from the index pge after you
check some boxes and click "delete" button
$delmov_list =
$GLOBALS['phpgw']->msg->get_arg_value('delmov_list');
@@ -304,7 +320,7 @@
$loops = count($delmov_list);
for ($i = 0; $i < $loops; $i++)
{
- if ($this->debug > 2) { echo
'email.boaction.delmov: (delete) in mail delete loop ['.(string)($i+1).'] of
['.$loops.']<br>'; }
+ if ($this->debug > 2) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov: (delete) in mail
delete loop ['.(string)($i+1).'] of ['.$loops.']<br>'); }
$this_msgnum =
$delmov_list[$i]['msgnum'];
// was_in_folder is used in Trash
handling in the ->phpgw_delete function
// if a message "was_in_folder" Trash,
it gets deleted for real, no option to move to Trash in that case
@@ -314,13 +330,13 @@
if ($did_delete == False)
{
// error
- if ($this->debug > 0) { echo
'email.boaction.delmov: (delete) ***ERROR****
$GLOBALS[phpgw]->msg->phpgw_delete() returns FALSE, ERROR, break out of
loop<br>'
- .' * * Server
reports error: '.$GLOBALS['phpgw']->msg->phpgw_server_last_error().'<br>'; }
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov: (delete) ***ERROR****
$GLOBALS[phpgw]->msg->phpgw_delete() returns FALSE, ERROR, break out of
loop<br>'
+ .' * * Server
reports error: '.$GLOBALS['phpgw']->msg->phpgw_server_last_error().'<br>'); }
break;
}
else
{
- if ($this->debug > 1) { echo
'email.boaction.delmov: (delete) $GLOBALS[phpgw]->msg->phpgw_delete() returns
True (so it buffered the command, really does not mean anything not that we
buffer commands)<br>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov: (delete)
$GLOBALS[phpgw]->msg->phpgw_delete() returns True (so it buffered the command,
really does not mean anything not that we buffer commands)<br>'); }
//if ($this->debug > 0) { echo
'email.boaction.delmov: (delete) calling
$GLOBALS[phpgw]->msg->phpgw_expunge('.$delmov_list[$i]['acctnum'].',
$delmov_list[$i])<br>'; }
//$did_expunge = False;
@@ -330,10 +346,10 @@
}
// ok, done deleting, now expunge
- if ($this->debug > 1) { echo
'email.boaction.delmov ('.__LINE__.'): done deleting, now call
$GLOBALS[phpgw]->msg->expunge_expungable_folders<br>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'): done
deleting, now call $GLOBALS[phpgw]->msg->expunge_expungable_folders<br>'); }
$did_expunge = False;
$did_expunge =
$GLOBALS['phpgw']->msg->expunge_expungable_folders('email.boaction.delmov LINE
'.__LINE__);
- if ($this->debug > 1) { echo
'email.boaction.delmov ('.__LINE__.'):
$GLOBALS[phpgw]->msg->expunge_expungable_folders() returns
['.serialize($did_expunge).']<br>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
$GLOBALS[phpgw]->msg->expunge_expungable_folders() returns
['.serialize($did_expunge).']<br>'); }
$totaldeleted = $i;
//$GLOBALS['phpgw']->msg->phpgw_expunge();
@@ -419,14 +435,14 @@
{
$this->no_fmt = '&no_fmt=1';
}
- if ($this->debug > 0) { echo
'emai.boaction.delmov ('.__LINE__.'): get_arg_value(what) ==
"delete_single_msg") <br>'; }
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
get_arg_value(what) == "delete_single_msg") <br>'); }
// called by clicking the "X" dutton while
reading an individual message
$msgball =
$GLOBALS['phpgw']->msg->get_arg_value('msgball');
- if ($this->debug > 2) { echo
'emai.boaction.delmov ('.__LINE__.'): delete_single_msg: pre-delete $msgball[]
dump <pre>: '; print_r($msgball); echo '</pre>'; }
+ if ($this->debug > 2) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
delete_single_msg: pre-delete $msgball[] DUMP:', $msgball); }
// BEFORE we delete, if there is no mext
message, then we will go back to index page
$nav_data =
$GLOBALS['phpgw']->msg->prev_next_navigation($folder_info['number_all']);
- if ($this->debug > 2) { echo
'emai.boaction.delmov ('.__LINE__.'): delete_single_msg: pre-delete $nav_data[]
dump <pre>: '; print_r($nav_data); echo '</pre>'; }
+ if ($this->debug > 2) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
delete_single_msg: pre-delete $nav_data[] DUMP:', $nav_data); }
// ---- "Go To Previous Message" Handling
-----
if ($nav_data['prev_msg'] != $not_set)
{
@@ -455,36 +471,36 @@
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start'));
}
- if ($this->debug > 1) { echo
'emai.boaction.delmov ('.__LINE__.'): delete_single_msg: pre-delete
determination of $this->redirect_to : ['.$this->redirect_to.']<br>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
delete_single_msg: pre-delete determination of $this->redirect_to :
['.$this->redirect_to.']<br>'); }
if ($this->debug > 3)
{
- echo 'emai.boaction.delmov:
delete_single_msg ('.__LINE__.'): debug flag = 4 or higher, _SKIP_ the delete
and expunge action<br>';
+
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov: delete_single_msg
('.__LINE__.'): debug flag = 4 or higher, _SKIP_ the delete and expunge
action<br>');
}
else
{
// ok, now do the delete
- if ($this->debug > 1) { echo
'emai.boaction.delmov: delete_single_msg: ('.__LINE__.') : (single delete)
calling $GLOBALS[phpgw]->msg->phpgw_delete('.$msgball['msgnum'].', "
",'.$msgball['folder'].', '.$msgball['acctnum'].', True) '; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov: delete_single_msg:
('.__LINE__.') : (single delete) calling
$GLOBALS[phpgw]->msg->phpgw_delete('.$msgball['msgnum'].', "
",'.$msgball['folder'].', '.$msgball['acctnum'].', True) '); }
// True = just a single delete call,
don't use the buffer commands
// " just a single delete call" logic
MOVED TO BUFFERED COMMANDS function
//$GLOBALS['phpgw']->msg->phpgw_delete($msgball['msgnum'],'',$msgball['folder'],
(int)$msgball['acctnum'], True);
$GLOBALS['phpgw']->msg->phpgw_delete($msgball['msgnum'],'',$msgball['folder'],
(int)$msgball['acctnum']);
// now do the expunge, both IMAP and
POP3 require this, or the message is not really deleted
- //if ($this->debug > 1) { echo
'emai.boaction.delmov: delete_single_msg: ('.__LINE__.') : calling
$GLOBALS[phpgw]->msg->phpgw_expunge('.$msgball['acctnum'].', $msgball) '; }
+ //if ($this->debug > 1) { echo
'email.boaction.delmov: delete_single_msg: ('.__LINE__.') : calling
$GLOBALS[phpgw]->msg->phpgw_expunge('.$msgball['acctnum'].', $msgball) '; }
// MOVED to "expunge_expungable_folders"
//$GLOBALS['phpgw']->msg->phpgw_expunge((int)$msgball['acctnum'], $msgball);
// ok, done deleting, now expunge
- if ($this->debug > 1) { echo
'email.boaction.delmov: delete_single_msg: ('.__LINE__.'): done deleting, now
call $GLOBALS[phpgw]->msg->expunge_expungable_folders<br>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov: delete_single_msg:
('.__LINE__.'): done deleting, now call
$GLOBALS[phpgw]->msg->expunge_expungable_folders<br>'); }
$did_expunge = False;
$did_expunge =
$GLOBALS['phpgw']->msg->expunge_expungable_folders('email.boaction.delmov
(delete_single_msg) LINE '.__LINE__);
- if ($this->debug > 1) { echo
'email.boaction.delmov: delete_single_msg: ('.__LINE__.'):
$GLOBALS[phpgw]->msg->expunge_expungable_folders() returns
['.serialize($did_expunge).']<br>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov: delete_single_msg:
('.__LINE__.'): $GLOBALS[phpgw]->msg->expunge_expungable_folders() returns
['.serialize($did_expunge).']<br>'); }
}
}
else
{
- if ($this->debug > 0) { echo
'emai.boaction.delmov ('.__LINE__.'): get_arg_value(what) ==
unknown_value<br>'; }
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
get_arg_value(what) == unknown_value<br>'); }
$error_str = '<p><center><b>'.lang('UNKNOWN
ACTION')."<br> \r\n"
.'called from
'.$GLOBALS['PHP_SELF'].', delmov()'."<br> \r\n"
.'</b></center></p>'."<br>
\r\n";
@@ -492,7 +508,7 @@
}
// GOTO NECT PAGEVIEW VIA REDIRECT OR OBJECT CALL
- if ($this->debug > 0) { echo 'emai.boaction.delmov
('.__LINE__.'): about to enter logic to display page defined in this URI:
$this->redirect_to ['.$this->redirect_to.']<br>'; }
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'): about
to enter logic to display page defined in this URI: $this->redirect_to
['.$this->redirect_to.']<br>'); }
/*!
@capability use_old_redirect_method
@@ -503,7 +519,7 @@
*/
if ($this->use_old_redirect_method == True)
{
- if ($this->debug > 0) { echo
'emai.boaction.delmov ('.__LINE__.'): EXITING with OLD REDIRECT CODE :
$this->use_old_redirect_method:
['.serialize($this->use_old_redirect_method).']<br>'; }
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
EXITING with OLD REDIRECT CODE : $this->use_old_redirect_method:
['.serialize($this->use_old_redirect_method).']<br>'); }
$GLOBALS['phpgw']->redirect($this->redirect_to);
// kill this script, we re outa here...
if (is_object($GLOBALS['phpgw']->msg))
@@ -533,34 +549,44 @@
//sessionid
//kp3
//domain
- if ($this->debug > 1) { echo 'emai.boaction.delmov
('.__LINE__.'): calling $this->set_expected_args($expected_args) ;
$expected_args DUMP<pre>'; print_r($expected_args); echo '</pre>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
calling $this->set_expected_args($expected_args) ; $expected_args DUMP:',
$expected_args); }
$this->set_expected_args($expected_args);
// the URI of the redirect string contains data needed
for the next page view
- if ($this->debug > 1) { echo 'emai.boaction.delmov
('.__LINE__.'): calling $this->set_new_args_uri($this->redirect_to) ;
$this->redirect_to ['.$this->redirect_to.']<br>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
calling $this->set_new_args_uri($this->redirect_to) ; $this->redirect_to
['.$this->redirect_to.']<br>'); }
$this->set_new_args_uri($this->redirect_to);
// clear existing args, apply the new arg enviornment,
// we get back the menuaction the redirect would have
asked for
- if ($this->debug > 1) { echo 'emai.boaction.delmov
('.__LINE__.'): calling $this->apply_new_args_env()<br>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
calling $this->apply_new_args_env()<br>'); }
$my_menuaction = $this->apply_new_args_env();
- if ($this->debug > 1) { echo 'emai.boaction.delmov
('.__LINE__.'): $my_menuaction is ['.$my_menuaction.'] which was returned from
$this->apply_new_args_env()<br>'; }
+ if ($this->debug > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
$my_menuaction is ['.$my_menuaction.'] which was returned from
$this->apply_new_args_env()<br>'); }
// (c) IF A "BIG MOVE", THEN TURN BACK ON THE SMART
CACHE
// MOVED TO MSG CLASS
//if ((isset($initial_session_cache_extreme))
//&& ($initial_session_cache_extreme != '-1'))
//{
- // if ($this->debug > 1) { echo
'emai.boaction.delmov ('.__LINE__.'): $initial_session_cache_extreme is set and
is NOT "-1", meaning we issued a "big move" cache event,
$initial_session_cache_extreme is
['.serialize($initial_session_cache_extreme).'] <br>'; }
- // if ($this->debug > 1) { echo
'emai.boaction.delmov ('.__LINE__.'): "big move" will turn off
session_cache_extreme if it was TRUE, so we undo that for the next page view
with: $GLOBALS[phpgw]->msg->session_cache_extreme =
$initial_session_cache_extreme<br>'; }
+ // if ($this->debug > 1) { echo
'email.boaction.delmov ('.__LINE__.'): $initial_session_cache_extreme is set
and is NOT "-1", meaning we issued a "big move" cache event,
$initial_session_cache_extreme is
['.serialize($initial_session_cache_extreme).'] <br>'; }
+ // if ($this->debug > 1) { echo
'email.boaction.delmov ('.__LINE__.'): "big move" will turn off
session_cache_extreme if it was TRUE, so we undo that for the next page view
with: $GLOBALS[phpgw]->msg->session_cache_extreme =
$initial_session_cache_extreme<br>'; }
// $GLOBALS['phpgw']->msg->session_cache_extreme =
$initial_session_cache_extreme;
//}
//else
//{
- // if ($this->debug > 1) { echo
'emai.boaction.delmov ('.__LINE__.'): $initial_session_cache_extreme is either
NOT set or is "-1", meaning we did NOT issued a "big move" cache event
earlier<br>'; }
+ // if ($this->debug > 1) { echo
'email.boaction.delmov ('.__LINE__.'): $initial_session_cache_extreme is either
NOT set or is "-1", meaning we did NOT issued a "big move" cache event
earlier<br>'; }
//}
// imitate the next menuaction command with direct
object calls
- if ($this->debug > 0) { echo 'emai.boaction.delmov
('.__LINE__.'): LEAVING by creating "next_obj" and calling its menuaction verb
...<br>'; }
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
LEAVING by creating "next_obj" and calling its menuaction verb ...<br>'); }
if (stristr($my_menuaction, 'uimessage'))
{
+ //// NEW: mail so object group fill may need to
be reset
+ //// we DO NOT use group data capability on the
message view page
+ //// this allows the SO class to query for each
individual thing it needs
+ //// which is OK for a message view, but not
for an index page
+
//$GLOBALS['phpgw']->msg->so->so_prop_use_group_data(False);
+ // NEW: mail so object group fill may need to
be reset
+ //clear existing data, if any, and reset the
query attempt excess counter
+
$GLOBALS['phpgw']->msg->so->so_prop_use_group_data(False);
+ // then make sure group data capability it
turned on
+
$GLOBALS['phpgw']->msg->so->so_prop_use_group_data(True);
// MAKE THE UIMESSAGE PAGE OBJECT
$this->next_obj =
CreateObject('email.uimessage');
// CALL THE FUNCTION THAT DISPLAYS THE PAGE VIEW
@@ -569,6 +595,11 @@
// else just ASSUME uiindex, it is the most forgiving
about missing values, it has fallback defaults to use if needed
else
{
+ // NEW: mail so object group fill may need to
be reset
+ //clear existing data, if any, and reset the
query attempt excess counter
+
$GLOBALS['phpgw']->msg->so->so_prop_use_group_data(False);
+ // then make sure group data capability it
turned on
+
$GLOBALS['phpgw']->msg->so->so_prop_use_group_data(True);
// MAKE THE INDEX PAGE OBJECT
$this->next_obj = CreateObject('email.uiindex');
// CALL THE FUNCTION THAT DISPLAYS THE PAGE VIEW
@@ -577,7 +608,7 @@
// (e) cleanup
if (is_object($GLOBALS['phpgw']->msg))
{
- if ($this->debug > 0) { echo
'emai.boaction.delmov ('.__LINE__.'): oops, not LEFT yet, cleanup and unset
->msg object<br>'; }
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'): oops,
not LEFT yet, cleanup and unset ->msg object<br>'); }
// close down ALL mailserver streams
$GLOBALS['phpgw']->msg->end_request();
// destroy the object
@@ -585,11 +616,11 @@
unset($GLOBALS['phpgw']->msg);
}
// shut down this transaction
- if ($this->debug > 0) { echo 'emai.boaction.delmov
('.__LINE__.'): LEAVING for <b>real</b> with
$GLOBALS[phpgw]->common->phpgw_exit(False)<br>'; }
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.delmov ('.__LINE__.'):
LEAVING for <b>real</b> with $GLOBALS[phpgw]->common->phpgw_exit(False)<br>'); }
$GLOBALS['phpgw']->common->phpgw_exit(False);
}
-
+ /*
// placeholder for previous test code
function just_a_placeholder()
{
@@ -597,7 +628,7 @@
// VIA REDIRECT OR DIRECT OBJECT CALL
if ($this->redirect_to != '')
{
- if ($this->debug > 0) { echo
'emai.boaction.delmov ('.__LINE__.'): next pageview redirect data to use is:
['.$this->redirect_to.']<br>'; }
+ if ($this->debug > 0) { echo
'email.boaction.delmov ('.__LINE__.'): next pageview redirect data to use is:
['.$this->redirect_to.']<br>'; }
// Experimental:
// NO REDIRECT - DIRECTLY MANUFACTURE THE NEXT
PAGE VIEW RIGHT NOW
@@ -605,7 +636,7 @@
$recovered_data = array();
parse_str($this->redirect_to, $recovered_data);
- if ($this->debug > 1) { echo
'emai.boaction.delmov ('.__LINE__.'): redirect_to parsed_str $recovered_data
DUMP:<pre>'; print_r($recovered_data); echo '</pre>'; }
+ if ($this->debug > 1) { echo
'email.boaction.delmov ('.__LINE__.'): redirect_to parsed_str $recovered_data
DUMP:<pre>'; print_r($recovered_data); echo '</pre>'; }
// ALL POSSIBLE VARS WE MIGHT FIND IN THE
REDIRECT URI:
$new_args_env = array(
'/mail/index_php?menuaction' => '-1',
@@ -618,7 +649,7 @@
'order' => '-1',
'start' => '-1'
);
- if ($this->debug > 1) { echo
'emai.boaction.delmov ('.__LINE__.'): known possible recovered_data elements
init $new_args_env DUMP:<pre>'; print_r($new_args_env); echo '</pre>'; }
+ if ($this->debug > 1) { echo
'email.boaction.delmov ('.__LINE__.'): known possible recovered_data elements
init $new_args_env DUMP:<pre>'; print_r($new_args_env); echo '</pre>'; }
// loop thru KNOWN POSSIBLE new_args_env
elements, GATHER the ones that are filled for later use
reset($new_args_env);
while(list($key,$value) = each($new_args_env))
@@ -653,10 +684,10 @@
}
else
{
- echo 'emai.boaction.delmov: LINE
'.__LINE__.': ERROR getting valid acctnum for goto pageview, NO fldball NO
msgball found <br>';
+ echo 'email.boaction.delmov: LINE
'.__LINE__.': ERROR getting valid acctnum for goto pageview, NO fldball NO
msgball found <br>';
}
- if ($this->debug > 1) { echo
'emai.boaction.delmov ('.__LINE__.'): known possible recovered_data elements
<b>Post-Gather</b> $new_args_env DUMP:<pre>'; print_r($new_args_env); echo
'</pre>'; }
- if ($this->debug > 1) { echo
'emai.boaction.delmov ('.__LINE__.'): will use $new_acctnum ['.$new_acctnum.'];
and $new_folder ['.$new_folder.'], BUT FIRST unset selected existing class
args <br>'; }
+ if ($this->debug > 1) { echo
'email.boaction.delmov ('.__LINE__.'): known possible recovered_data elements
<b>Post-Gather</b> $new_args_env DUMP:<pre>'; print_r($new_args_env); echo
'</pre>'; }
+ if ($this->debug > 1) { echo
'email.boaction.delmov ('.__LINE__.'): will use $new_acctnum
['.$new_acctnum.']; and $new_folder ['.$new_folder.'], BUT FIRST unset
selected existing class args <br>'; }
// UNSET ARGS WE USED IN THIS PAGE BUT ARE NO
LONGER NEEDED
$GLOBALS['phpgw']->msg->unset_arg('delmov_list', $new_acctnum);
@@ -676,7 +707,7 @@
$GLOBALS['phpgw']->msg->set_acctnum($new_acctnum);
$GLOBALS['phpgw']->msg->set_arg_value('folder',
$new_folder, $new_acctnum);
- // (b) LOOP thru Gathered Args, setting the
class args to those values
+ // (b) LOOP thru Gathered Args, setting the
class args to those values
reset($new_args_env);
while(list($key,$value) = each($new_args_env))
{
@@ -698,7 +729,7 @@
//}
// (d) make object and issue command
$new_menuaction =
$new_args_env['index_php?menuaction'];
- if ($this->debug > 1 || $this->debug_new_env >
1) { echo 'emai.boaction.delmov ('.__LINE__.'): $new_menuaction
['.$new_menuaction.'] <br>'; }
+ if ($this->debug > 1 || $this->debug_new_env >
1) { echo 'email.boaction.delmov ('.__LINE__.'): $new_menuaction
['.$new_menuaction.'] <br>'; }
if (stristr($new_menuaction, 'uimessage'))
{
// MAKE THE UIMESSAGE PAGE OBJECT
@@ -728,7 +759,7 @@
}
else
{
- if ($this->debug > 0) { echo
'emai.boaction.delmov ('.__LINE__.'): LEAVING, with ERROR, unhandled "where to
go from here" condition<br>'; }
+ if ($this->debug > 0) { echo
'email.boaction.delmov ('.__LINE__.'): LEAVING, with ERROR, unhandled "where to
go from here" condition<br>'; }
echo 'error: no redirect specified in
'.$GLOBALS['PHP_SELF'].', delmov()'."<br> \r\n"
.'error_str: '.$error_str."<br> \r\n";
// close down ALL mailserver streams
@@ -740,7 +771,7 @@
$GLOBALS['phpgw']->common->phpgw_exit(False);
}
}
-
+ */
/*!
@function set_expected_args
@@ -760,11 +791,11 @@
*/
function set_expected_args($comma_set_str='-1')
{
- if ($this->debug_new_env > 0) { echo
'emai.boaction.set_expected_args ('.__LINE__.'): ENTERING<br>'; }
- if ($this->debug_new_env > 1) { echo
'emai.boaction.set_expected_args ('.__LINE__.'): param $comma_set_str:
['.$comma_set_str.'] <br>'; }
+ if ($this->debug_new_env > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.set_expected_args
('.__LINE__.'): ENTERING<br>'); }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.set_expected_args
('.__LINE__.'): param $comma_set_str: ['.$comma_set_str.'] <br>'); }
$exploded_expected_args = array();
$exploded_expected_args = explode(',',$comma_set_str);
- if ($this->debug_new_env > 1) { echo
'emai.boaction.set_expected_args ('.__LINE__.'): $exploded_expected_args
DUMP:<pre>'; print_r($exploded_expected_args); echo '</pre>'; }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.set_expected_args
('.__LINE__.'): $exploded_expected_args DUMP:', $exploded_expected_args); }
//$this->expected_args = array();
$this->expected_args = array();
@@ -774,8 +805,8 @@
$arg_name = $exploded_expected_args[$i];
$this->expected_args[$arg_name] = '-1';
}
- if ($this->debug_new_env > 1) { echo
'emai.boaction.set_expected_args ('.__LINE__.'): $this->expected_args
DUMP:<pre>'; print_r($this->expected_args); echo '</pre>'; }
- if ($this->debug_new_env > 0) { echo
'emai.boaction.set_expected_args ('.__LINE__.'): LEAVING<br>'; }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.set_expected_args
('.__LINE__.'): $this->expected_args DUMP:', $this->expected_args); }
+ if ($this->debug_new_env > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.set_expected_args
('.__LINE__.'): LEAVING<br>'); }
}
/*!
@@ -790,9 +821,9 @@
*/
function set_new_args_uri($new_args_uri='-1')
{
- if ($this->debug_new_env > 0) { echo
'emai.boaction.set_new_args_uri ('.__LINE__.'): ENTERING, $new_args_uri
['.$new_args_uri.']<br>'; }
+ if ($this->debug_new_env > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.set_new_args_uri
('.__LINE__.'): ENTERING, $new_args_uri ['.$new_args_uri.']<br>'); }
$this->new_args_uri = $new_args_uri;
- if ($this->debug_new_env > 0) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): LEAVING<br>'; }
+ if ($this->debug_new_env > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): LEAVING<br>'); }
}
/*!
@@ -821,22 +852,42 @@
*/
function apply_new_args_env()
{
- if ($this->debug_new_env > 0) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): ENTERING<br>'; }
+ if ($this->debug_new_env > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): ENTERING<br>'); }
$recovered_data = array();
- if ($this->debug_new_env > 1) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): source data is
$this->new_args_uri DUMP:<pre>'; print_r($this->new_args_uri); echo '</pre>'; }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): source data is $this->new_args_uri DUMP:',
$this->new_args_uri); }
parse_str($this->new_args_uri, $recovered_data);
- if ($this->debug_new_env > 1) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): used command "parsed_str" on
that to get this $recovered_data DUMP:<pre>'; print_r($recovered_data); echo
'</pre>'; }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): used command "parsed_str" on that to get this $recovered_data
DUMP:', $recovered_data); }
+
+ // NOTE PARSE_STR ***WILL ADD SLASHES*** TO ESCAPE
QUOTES
+ // NO MATTER WHAT YOUR MAGIC SLASHES SETTING IS
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): NOTE PARSE_STR ***WILL ADD SLASHES*** TO ESCAPE QUOTES NO
MATTER WHAT YOUR MAGIC SLASHES SETTING IS **stripping slashes NOW*** from any
folder names'.'<br>'); }
+ if (isset($recovered_data['fldball']['folder']))
+ {
+ $recovered_data['fldball']['folder'] =
stripslashes($recovered_data['fldball']['folder']);
+ $recovered_data['fldball']['folder'] =
$GLOBALS['phpgw']->msg->prep_folder_out($recovered_data['fldball']['folder']);
+ }
+ if (isset($recovered_data['msgball']['folder']))
+ {
+ $recovered_data['msgball']['folder'] =
stripslashes($recovered_data['msgball']['folder']);
+ $recovered_data['msgball']['folder'] =
$GLOBALS['phpgw']->msg->prep_folder_out($recovered_data['msgball']['folder']);
+ }
+ if (isset($recovered_data['tf']))
+ {
+ $recovered_data['tf'] =
stripslashes($recovered_data['tf']);
+ $recovered_data['tf'] =
$GLOBALS['phpgw']->msg->prep_folder_out($recovered_data['tf']);
+ }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): AFTER STRIPSLASH: used command "parsed_str" on that to get this
$recovered_data DUMP:', $recovered_data); }
$new_args_env = array();
$new_args_env = $this->expected_args;
- if ($this->debug_new_env > 1) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): $this->expected_args
DUMP:<pre>'; print_r($new_args_env); echo '</pre>'; }
- if ($this->debug_new_env > 1) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): initial $new_args_env
DUMP:<pre>'; print_r($new_args_env); echo '</pre>'; }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): $this->expected_args DUMP:', $new_args_env); }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): initial $new_args_env DUMP:', $new_args_env); }
// loop thru KNOWN POSSIBLE new_args_env elements,
GATHER the ones that are filled for later use
reset($new_args_env);
while(list($key,$value) = each($new_args_env))
{
- if ($this->debug_new_env > 1) { echo ' *
('.__LINE__.') $key: ['.$key.'] $value: ['.$value.']<br>'; }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out(' * ('.__LINE__.') $key: ['.$key.'] $value:
['.$value.']<br>'); }
$known_arg = $key;
//handle the special URI not match case
if ($key == 'index_php?menuaction')
@@ -845,7 +896,7 @@
reset($recovered_data);
while(list($recovered_key,$recovered_value) = each($recovered_data))
{
- if ($this->debug_new_env > 1) {
echo ' * * ('.__LINE__.') $recovered_key: ['.$recovered_key.']
$recovered_value: ['.$recovered_value.']<br>'; }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out(' * * ('.__LINE__.') $recovered_key:
['.$recovered_key.'] $recovered_value: ['.$recovered_value.']<br>'); }
if (stristr($recovered_key,
'menuaction'))
{
$new_args_env[$key] =
$recovered_data[$recovered_key];
@@ -853,7 +904,7 @@
break;
}
}
- if ($this->debug_new_env > 1) { echo '
** found menuaction ** ('.__LINE__.')
['.$recovered_data[$recovered_key].']<br>'; }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out(' ** found menuaction ** ('.__LINE__.')
['.$recovered_data[$recovered_key].']<br>'); }
}
elseif ((isset($recovered_data[$known_arg]))
&& ((string)$recovered_data[$known_arg] != ''))
@@ -863,10 +914,10 @@
}
}
reset($new_args_env);
- if ($this->debug_new_env > 1) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): FIRST PASS filled available
known possible recovered_data elements <b>Post-Gather</b> $new_args_env
DUMP:<pre>'; print_r($new_args_env); echo '</pre>'; }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): FIRST PASS filled available known possible recovered_data
elements <b>Post-Gather</b> $new_args_env DUMP:', $new_args_env); }
// we are NOT DONE yet, extract some more args that we
derive from what we gathered so far
- if ($this->debug_new_env > 1) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): ADDITIONALLY extract embedded
"*ball" items "acctnum" and "folder" AND if a "msgball", add a "uri" element to
it<br>'; }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): ADDITIONALLY extract embedded "*ball" items "acctnum" and
"folder" AND if a "msgball", add a "uri" element to it<br>'); }
// GET GOOD ACCTNUM FOR THE UNSET COMMANDS BELOW
// and also get other useful info while we are at it
(folder), and if we find a "msgball", make and add to it a "uri" element
if ($new_args_env['fldball'] != '-1')
@@ -881,44 +932,47 @@
// IMITATION: during grab_args_gpc, the code
add an element [uri] to the existing msgball
// NOTE that for this uri element, the "folder"
string shoulf be urlencoded
$new_uri_element =
'msgball[msgnum]='.$new_args_env['msgball']['msgnum']
-
.'&msgball[folder]='.urlencode($new_args_env['msgball']['folder'])
+
//.'&msgball[folder]='.urlencode($new_args_env['msgball']['folder'])
+
//.'&msgball[folder]='.$GLOBALS['phpgw']->msg->prep_folder_out($new_args_env['msgball']['folder'])
+
.'&msgball[folder]='.$new_args_env['msgball']['folder']
.'&msgball[acctnum]='.$new_args_env['msgball']['acctnum'];
$new_args_env['msgball']['uri'] =
$new_uri_element;
}
else
{
- echo 'emai.boaction.apply_new_args_env: LINE
'.__LINE__.': ERROR getting valid acctnum for goto pageview, NO fldball NO
msgball found <br>';
+ echo 'email.boaction.apply_new_args_env: LINE
'.__LINE__.': ERROR getting valid acctnum for goto pageview, NO fldball NO
msgball found <br>';
+
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env: LINE
'.__LINE__.': ERROR getting valid acctnum for goto pageview, NO fldball NO
msgball found <br>');
}
- if ($this->debug_new_env > 1) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): extracted additional data:
will use $new_acctnum ['.$new_acctnum.']; and $new_folder ['.$new_folder.']
<br>'; }
- if ($this->debug_new_env > 1) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): FINAL filled available known
possible recovered_data elements <b>Post-Gather</b> $new_args_env DUMP:<pre>';
print_r($new_args_env); echo '</pre>'; }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): extracted additional data: will use $new_acctnum
['.$new_acctnum.']; and $new_folder ['.$new_folder.'] <br>'); }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): FINAL filled available known possible recovered_data elements
<b>Post-Gather</b> $new_args_env DUMP:', $new_args_env); }
// UNSET ARGS WE USED IN THIS PAGE BUT ARE NO LONGER
NEEDED
// HELL, JUST UNSET ALL EXTERNAL ARGS
- if ($this->debug_new_env > 1) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): unset ALL known external
class args as defined in array $GLOBALS[phpgw]->msg->known_external_args<br>'; }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): unset ALL known external class args as defined in array
$GLOBALS[phpgw]->msg->known_external_args<br>'); }
$loops =
count($GLOBALS['phpgw']->msg->known_external_args);
for ($i = 0; $i < $loops; $i++)
{
$arg_name =
$GLOBALS['phpgw']->msg->known_external_args[$i];
if
($GLOBALS['phpgw']->msg->get_isset_arg($arg_name, $new_acctnum) == True)
{
- if ($this->debug_new_env > 2) { echo '
* emai.boaction.apply_new_args_env ('.__LINE__.'):UNSETTING with
$GLOBALS[phpgw]->msg->unset_arg('.$arg_name.', '.$new_acctnum.') <br>'; }
+ if ($this->debug_new_env > 2) {
$GLOBALS['phpgw']->msg->dbug->out(' * email.boaction.apply_new_args_env
('.__LINE__.'):UNSETTING with $GLOBALS[phpgw]->msg->unset_arg('.$arg_name.',
'.$new_acctnum.') <br>'); }
$GLOBALS['phpgw']->msg->unset_arg($arg_name, $new_acctnum);
}
else
{
- if ($this->debug_new_env > 2) { echo '
* emai.boaction.apply_new_args_env ('.__LINE__.'): <i>was not set $arg_name
['.$arg_name.']; and $new_acctnum ['.$new_acctnum.']</i><br>'; }
+ if ($this->debug_new_env > 2) {
$GLOBALS['phpgw']->msg->dbug->out(' * email.boaction.apply_new_args_env
('.__LINE__.'): <i>was not set $arg_name ['.$arg_name.']; and $new_acctnum
['.$new_acctnum.']</i><br>'); }
}
}
// REFILL ARGS WITH NEW PAGE VIEW VALUES
// (a) set the very important acctnum arg we collected
earlier, and also the folder arg, because these values are _derived_ values
// they are not plainly in the $new_args_env as simple
key and value elements, they were derived from some of them, though
- if ($this->debug_new_env > 1) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): BEGIN setting new arg env by
setting the "new_acctnum" and "new_folder"<br>'; }
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): BEGIN setting new arg env by setting the "new_acctnum" and
"new_folder"<br>'); }
$GLOBALS['phpgw']->msg->set_acctnum($new_acctnum);
$GLOBALS['phpgw']->msg->set_arg_value('folder',
$new_folder, $new_acctnum);
- // (b) LOOP thru Gathered Args, setting the class args
to those values
- if ($this->debug_new_env > 1) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): continue by LOOPING thru
Final Gathered Args, setting the class args to those values that are not still
"-1" (that data was found for)<br>'; }
+ // (b) LOOP thru Gathered Args, setting the class args
to those values
+ if ($this->debug_new_env > 1) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): continue by LOOPING thru Final Gathered Args, setting the class
args to those values that are not still "-1" (that data was found for)<br>'); }
reset($new_args_env);
while(list($key,$value) = each($new_args_env))
{
@@ -928,24 +982,24 @@
if ((!stristr($arg_name,
'index_php?menuaction'))
&& ($arg_value != '-1'))
{
- if ($this->debug_new_env > 2) { echo '
* emai.boaction.apply_new_args_env ('.__LINE__.'): calling
$GLOBALS[phpgw]->msg->set_arg_value('.$arg_name.', '.$arg_value.',
'.$new_acctnum.') <br>'; }
+ if ($this->debug_new_env > 2) {
$GLOBALS['phpgw']->msg->dbug->out(' * email.boaction.apply_new_args_env
('.__LINE__.'): calling $GLOBALS[phpgw]->msg->set_arg_value('.$arg_name.',
'.$arg_value.', '.$new_acctnum.') <br>'); }
$GLOBALS['phpgw']->msg->set_arg_value($arg_name, $arg_value, $new_acctnum);
}
}
//$my_menuaction =
$new_args_env['/mail/index_php?menuaction'];
- if ($this->debug_new_env > 0) { echo
'emai.boaction.apply_new_args_env ('.__LINE__.'): LEAVING, returning next
menuaction command $my_menuaction ['.$my_menuaction.'] <br>'; }
+ if ($this->debug_new_env > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.apply_new_args_env
('.__LINE__.'): LEAVING, returning next menuaction command $my_menuaction
['.$my_menuaction.'] <br>'); }
return $my_menuaction;
}
/*!
@function get_attach
- @abstract browser requests a specific MIME part number, this
function will get it from the mail server
+ @abstract browser requests a specific MIME part number, this
function will get it from the mail server
and send it to the browser.
@author Angles and previous maintainers
- @discussion Uses the phpgw api browser class to generate the
headers which preceed the actual attachment
- data. Note this is tricky because different browsers,
especially the MSIE versions, require different headers
- to be present in order to handle the data effectively at the
clients browser. Incorrect headers can cause things
- like the browser not getting the name of the attachment, or not
starting the associated viewer for the attachment,
+ @discussion Uses the phpgw api browser class to generate the
headers which preceed the actual attachment
+ data. Note this is tricky because different browsers,
especially the MSIE versions, require different headers
+ to be present in order to handle the data effectively at the
clients browser. Incorrect headers can cause things
+ like the browser not getting the name of the attachment, or not
starting the associated viewer for the attachment,
or even several save_or_open dialogs in a row.
*/
function get_attach()
@@ -955,46 +1009,51 @@
$GLOBALS['phpgw_info']['flags']['nofooter'] = True;
$GLOBALS['phpgw_info']['flags']['noappheader'] = True;
$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
-
+
$this->msg_bootstrap =
CreateObject('email.msg_bootstrap');
-
$this->msg_bootstrap->ensure_mail_msg_exists('emai.boaction.get_attach',
$this->debug);
-
- if ($this->debug > 0) { echo 'emai.boaction.get_attach:
creating $this->browser <br>'; }
+
$this->msg_bootstrap->ensure_mail_msg_exists('email.boaction.get_attach',
$this->debug);
+
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.get_attach: creating
$this->browser <br>'); }
$this->browser = CreateObject('phpgwapi.browser');
-
+
$msgball =
$GLOBALS['phpgw']->msg->get_arg_value('msgball');
if (!isset($msgball['part_no']))
{
$part_no =
$GLOBALS['phpgw']->msg->get_arg_value('part_no');
$msgball['part_no'] = $part_no;
}
-
+
// decode rfc2047 encoded attachment name MIME part
headers
// see RFC2047 "Message Header Extensions for Non-ASCII
Text"
- $att_name =
$GLOBALS['phpgw']->msg->decode_rfc_header($GLOBALS['phpgw']->msg->get_arg_value('name'));
- if (($att_name !=
$GLOBALS['phpgw']->msg->get_arg_value('name'))
+
$defanged_name=urldecode($GLOBALS['phpgw']->msg->get_arg_value('name'));
+ $att_name =
$GLOBALS['phpgw']->msg->decode_rfc_header($defanged_name);
+ //Check if the name changed thru the header decoding im
not shure
+ if (($att_name !=
urldecode($GLOBALS['phpgw']->msg->get_arg_value('name')))
&& (trim($att_name) != '')
- && (trim($GLOBALS['phpgw']->msg->get_arg_value('name'))
!= ''))
+ &&
(trim(urldecode($GLOBALS['phpgw']->msg->get_arg_value('name'))) != ''))
{
$GLOBALS['phpgw']->msg->set_arg_value('name',
$att_name);
}
-
+
$mime =
strtolower($GLOBALS['phpgw']->msg->get_arg_value('type')) .'/'
.strtolower($GLOBALS['phpgw']->msg->get_arg_value('subtype'));
-
$this->browser->content_header($GLOBALS['phpgw']->msg->get_arg_value('name'),
$mime);
-
- //echo 'get all args dump<pre>';
print_r($GLOBALS['phpgw']->msg->get_all_args()); echo '</pre>';
- //echo '$mime: ['.$mime.']<br>';
- //echo '$GLOBALS[phpgw]->msg->get_arg_value(encoding):
['.$GLOBALS['phpgw']->msg->get_arg_value('encoding').']<br>';
-
+ // do not do this until we get a length
+
//$this->browser->content_header($GLOBALS['phpgw']->msg->get_arg_value('name'),
$mime);
+
+ ////echo 'get all args dump<pre>';
print_r($GLOBALS['phpgw']->msg->get_all_args()); echo '</pre>';
+ ////echo '$mime: ['.$mime.']<br>';
+ ////echo
'$GLOBALS[phpgw]->msg->get_arg_value(encoding):
['.$GLOBALS['phpgw']->msg->get_arg_value('encoding').']<br>';
+
// ---- 'irregular' "view raw message" functionality
----
if ($msgball['part_no'] == 'raw_message')
{
+ // NOTE no length for this purpose
+
$this->browser->content_header($GLOBALS['phpgw']->msg->get_arg_value('name'),
$mime);
// to dump out the whole raw message, do this:
// 1) output the headers, 2) output the raw
body 3) output a "closing" CRLF
//headers_msgball will be used get the message
headers, by specifying "part_no" = 0
$headers_msgball = $msgball;
$headers_msgball['part_no'] = 0;
- // that can also be used to ge tthe raw message
body because phpgw_body() doesn't care about "part_no"
+ // that can also be used to ge tthe raw message
body because phpgw_body() doesn't care about "part_no"
echo
$GLOBALS['phpgw']->msg->phpgw_fetchbody($headers_msgball);
echo
$GLOBALS['phpgw']->msg->phpgw_body($headers_msgball);
echo "\r\n";
@@ -1002,15 +1061,30 @@
// ---- "regular" attachment handling ----
elseif
($GLOBALS['phpgw']->msg->get_arg_value('encoding') == 'base64')
{
- echo
$GLOBALS['phpgw']->msg->de_base64($GLOBALS['phpgw']->msg->phpgw_fetchbody($msgball));
+ //echo
$GLOBALS['phpgw']->msg->de_base64($GLOBALS['phpgw']->msg->phpgw_fetchbody($msgball));
+ $this->output_data =
$GLOBALS['phpgw']->msg->de_base64($GLOBALS['phpgw']->msg->phpgw_fetchbody($msgball));
+ $size = strlen($this->output_data);
+
$this->browser->content_header($GLOBALS['phpgw']->msg->get_arg_value('name'),
$mime, $size);
+ echo $this->output_data;
+ $this->output_data = '';
}
elseif
($GLOBALS['phpgw']->msg->get_arg_value('encoding') == 'qprint')
{
- echo
$GLOBALS['phpgw']->msg->qprint($GLOBALS['phpgw']->msg->phpgw_fetchbody($msgball));
+ //echo
$GLOBALS['phpgw']->msg->qprint($GLOBALS['phpgw']->msg->phpgw_fetchbody($msgball));
+ $this->output_data =
$GLOBALS['phpgw']->msg->qprint($GLOBALS['phpgw']->msg->phpgw_fetchbody($msgball));
+ $size = strlen($this->output_data);
+
$this->browser->content_header($GLOBALS['phpgw']->msg->get_arg_value('name'),
$mime, $size);
+ echo $this->output_data;
+ $this->output_data = '';
}
else
{
- echo
$GLOBALS['phpgw']->msg->phpgw_fetchbody($msgball);
+ //echo
$GLOBALS['phpgw']->msg->phpgw_fetchbody($msgball);
+ $this->output_data =
$GLOBALS['phpgw']->msg->phpgw_fetchbody($msgball);
+ $size = strlen($this->output_data);
+
$this->browser->content_header($GLOBALS['phpgw']->msg->get_arg_value('name'),
$mime, $size);
+ echo $this->output_data;
+ $this->output_data = '';
}
// you may feed "end_request" a msgball or a fldball
and "end_request" will close the acctnum specified therein
//$GLOBALS['phpgw']->msg->end_request($msgball);
@@ -1023,25 +1097,25 @@
// shut down this transaction
$GLOBALS['phpgw']->common->phpgw_exit(False);
}
-
+
/*!
@function view_html
@abstract special handler to view certain types of html mail
@author Angles
- @discussion Used in special cases when simply giving the client
browser unprocessed html MIME part(s)
- is not a good idea or needs special attention. Not a good idea
means that there is CSS in the html part which would
- totally b0rk the look of the clients browser, or certain
unusual script. Special Handling means a MULTIPART
- RELATED message such as Outkrook stationary or Evolutions
version of the same, where the html has IMG
- tags in it that are not real HREFs but rather a reference to
another MIME part in the same message. To handle
- that this message display code swaps that IMG mime part
reference with an actual URL used by "get_attach" function
- to retrieve that particular MIME part from the email server and
send it to the browser, this the IMG appears in the
- HTML message as intended. In that case the processing is done
before the message is dispayed, and the processed HTML
- part is stored as a form hiddenvar in base64 encoded format.
The user sees a button saying "View HTML", if clicked this
- processed HTML part is submitted to this function which base64
decodes it and sends it to the browser as a simgle
- html page, not a part of a mail like is typical. In either case
the user gets that button and the buttons associated form
- submits data to this function. If the part is not RELATED, i.e.
did not require special IMG tag swapping, then this
- function gets submitted to is a reference to the particular
HTML part of the message and it is sent to the browser
- as a page unto itself. In either case, the part is not
displayed inline with other MIME parts, not displayed in the same
+ @discussion Used in special cases when simply giving the client
browser unprocessed html MIME part(s)
+ is not a good idea or needs special attention. Not a good idea
means that there is CSS in the html part which would
+ totally b0rk the look of the clients browser, or certain
unusual script. Special Handling means a MULTIPART
+ RELATED message such as Outkrook stationary or Evolutions
version of the same, where the html has IMG
+ tags in it that are not real HREFs but rather a reference to
another MIME part in the same message. To handle
+ that this message display code swaps that IMG mime part
reference with an actual URL used by "get_attach" function
+ to retrieve that particular MIME part from the email server and
send it to the browser, this the IMG appears in the
+ HTML message as intended. In that case the processing is done
before the message is dispayed, and the processed HTML
+ part is stored as a form hiddenvar in base64 encoded format.
The user sees a button saying "View HTML", if clicked this
+ processed HTML part is submitted to this function which base64
decodes it and sends it to the browser as a simgle
+ html page, not a part of a mail like is typical. In either case
the user gets that button and the buttons associated form
+ submits data to this function. If the part is not RELATED, i.e.
did not require special IMG tag swapping, then this
+ function gets submitted to is a reference to the particular
HTML part of the message and it is sent to the browser
+ as a page unto itself. In either case, the part is not
displayed inline with other MIME parts, not displayed in the same
browser window as the rest of the groupware template, instead
this part will be viewed in its own page.
*/
function view_html()
@@ -1051,13 +1125,13 @@
$GLOBALS['phpgw_info']['flags']['nofooter'] = True;
$GLOBALS['phpgw_info']['flags']['noappheader'] = True;
$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
-
+
$this->msg_bootstrap =
CreateObject('email.msg_bootstrap');
-
$this->msg_bootstrap->ensure_mail_msg_exists('emai.boaction.get_attach',
$this->debug);
-
- if ($this->debug > 0) { echo 'emai.boaction.view_html:
creating $this->browser <br>'; }
+
$this->msg_bootstrap->ensure_mail_msg_exists('email.boaction.get_attach',
$this->debug);
+
+ if ($this->debug > 0) {
$GLOBALS['phpgw']->msg->dbug->out('email.boaction.view_html: creating
$this->browser <br>'); }
$this->browser = CreateObject('phpgwapi.browser');
-
+
//$this->browser->content_header($name,$mime);
if
((($GLOBALS['phpgw']->msg->get_isset_arg('html_part')))
&& ($GLOBALS['phpgw']->msg->get_arg_value('html_part')
!= ''))
====================================================
Index: email/inc/class.boattach_file.inc.php
diff -u email/inc/class.boattach_file.inc.php:1.4
email/inc/class.boattach_file.inc.php:1.5
--- email/inc/class.boattach_file.inc.php:1.4 Fri Mar 14 04:00:10 2003
+++ email/inc/class.boattach_file.inc.php Thu Dec 30 23:13:50 2004
@@ -146,7 +146,7 @@
@abstract there are 2 vars this script needs to do somethig,
"this->action" and "this->delete", so
we use this function to fill those vars from GPC values here,
but in the future they could be filled
via some external method. In the days before superglobals,
these were simple vars "$action" and
- also "$delete", but such simple days are over.
+ also "$delete", but such simple days are over.
*/
function fill_control_data_gpc()
{
@@ -277,7 +277,7 @@
if (isset($this->var_holder) == False)
{
echo 'emai.boattach_file.attach ('.__LINE__.'):
ERROR: initial $this->var_holder needs to be set by this point in the code
<br>';
- }
+ }
// initialize some variables
$alert_msg = '';
@@ -372,7 +372,7 @@
{
srand((double)microtime()*1000000);
$random_number = rand(100000000,999999999);
- $newfilename =
md5($this->file_data['file_tmp_name'].', '.$this->file_data['file_name'].',
'.$GLOBALS['phpgw_info']['user']['sessionid'].time().getenv('REMOTE_ADDR').$random_number);
+ $newfilename =
md5($this->file_data['file_tmp_name'].', '.$this->file_data['file_name'].',
'.$GLOBALS['phpgw_info']['user']['sessionid'].time().$_SERVER['REMOTE_ADDR'].$random_number);
// Check for uploaded file of 0-length, or no
file (patch from Zone added by Milosch)
//if ($this->file_data['file_tmp_name'] ==
"none" && $this->file_data['file_size'] == 0) This could work also
@@ -382,7 +382,7 @@
}
else
{
- copy($this->file_data['file_tmp_name'],
$this->uploaddir.SEP.$newfilename);
+
move_uploaded_file($this->file_data['file_tmp_name'],
$this->uploaddir.SEP.$newfilename);
}
$ftp = fopen($this->uploaddir.SEP.$newfilename
. '.info','wb');
@@ -395,7 +395,7 @@
$langed_attach_file = lang("Attach File");
$alert_msg = lang('Input Error:').'<br>'
. lang('Please submit a filename to
attach').'<br>'
- . lang('You must click').'
"'.lang('Attach File').'" '.lang('for the file to actually upload').'<br>'
+ . lang('You must click %1 for the file
to actually upload','"'.lang('Attach File').'"').'.<br>'
. '<br>';
}
====================================================
Index: email/inc/class.bocompose.inc.php
diff -u email/inc/class.bocompose.inc.php:1.8
email/inc/class.bocompose.inc.php:1.9
--- email/inc/class.bocompose.inc.php:1.8 Fri Mar 14 04:00:10 2003
+++ email/inc/class.bocompose.inc.php Thu Dec 30 23:13:50 2004
@@ -27,6 +27,12 @@
var $my_validator;
var $msg_bootstrap;
+ // reply messages get this "quoting" prefix to each line
+ // NEW we use the global msg->reply_prefix instead of this one
here
+ //var $reply_prefix = '>';
+ //var $reply_prefix = '> ';
+ //var $reply_prefix = '| ';
+
// CHOOSE YOUR ADDRESSBOOK
var $addybook_choice;
@@ -50,8 +56,57 @@
}
/*!
+ @function recall_desired_action
+ @abstract used to preserve if this originated as a reply,
replyall, forward, or new mail
+ @author Angles
+ @discussion Line lengths will differ for new mail and forwarded
orig body, vs. reply mail that has longer
+ lines. So this preserves this info for later use. Particularly
we like to preserve this thru the spelling pass also.
+ We look for GPC args "action" or "orig_action", as keys, and
their
+ values are limited to "reply", "replyall", "forward", and
"new", with "new" being deduced on the
+ initial compose page call and put into "orig_action" for later
use, while the others possible "action"
+ values simply get stored in "orig_action" no deduction is
required, it is specified.
+ If new future actions are added, adjust this function
accordingly.
+ @access public
+ // MOVED TO MAIL_MSG_BASE BECAUSE WE ALSO NEED THIS IN CLASS
BOSEND
+ function recall_desired_action()
+ {
+ // what action are we dealing with here, reply(all),
forward, or newmail
+ // we care because new and forward get different line
length then reply mail that has ">"
+ $orig_action = 'unknown';
+ if (($GLOBALS['phpgw']->msg->get_isset_arg('action'))
+ && (
+
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'forward')
+ ||
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'reply')
+ ||
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'replyall')
+ )
+ )
+ {
+ $orig_action =
$GLOBALS['phpgw']->msg->get_arg_value('action');
+ }
+ elseif
(($GLOBALS['phpgw']->msg->get_isset_arg('orig_action'))
+ && (
+
($GLOBALS['phpgw']->msg->get_arg_value('orig_action') == 'forward')
+ ||
($GLOBALS['phpgw']->msg->get_arg_value('orig_action') == 'reply')
+ ||
($GLOBALS['phpgw']->msg->get_arg_value('orig_action') == 'replyall')
+ ||
($GLOBALS['phpgw']->msg->get_arg_value('orig_action') == 'new')
+ )
+ )
+ {
+ $orig_action =
$GLOBALS['phpgw']->msg->get_arg_value('orig_action');
+ }
+ else
+ {
+ // if not reply, replyall, nor forward
"action", then we have NEW message
+ // if this is set now then the above
"orig_action" should preserve it
+ $orig_action = 'new';
+ }
+ return $orig_action;
+ }
+ */
+
+ /*!
@function get_compose_form_action_url
- @abstract ?
+ @abstract makes the html action target for the send button on
the compose page
@param $menuaction_target (string)
@author Angles
@discussion Used by this class and also exposes some usefull
functionality, mail.spell uses this function, for example.
@@ -86,6 +141,8 @@
.'&sort='.$GLOBALS['phpgw']->msg->get_arg_value('sort')
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
+ // this is somewhat redundant
in this particular case
+
.'&orig_action='.$GLOBALS['phpgw']->msg->recall_desired_action()
);
if
(($GLOBALS['phpgw']->msg->get_isset_arg('action'))
&&
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'forward')
@@ -118,6 +175,8 @@
.'&sort='.$GLOBALS['phpgw']->msg->get_arg_value('sort')
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
+ // when this hits bosend it is
useful to know if it is a reply or not for linebreak purposes
+
.'&orig_action='.$GLOBALS['phpgw']->msg->recall_desired_action()
);
}
else
@@ -136,10 +195,13 @@
.'&sort='.$GLOBALS['phpgw']->msg->get_arg_value('sort')
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
+ // when this hits bosend it is
useful to know if it is a reply or not for linebreak purposes
+
.'&orig_action='.$GLOBALS['phpgw']->msg->recall_desired_action()
);
}
return $send_btn_action;
}
+
/*!
@function quote_inline_message
@abstract Handle quoting, cleaning up of replied or inline
forwarded messages
@@ -167,6 +229,7 @@
$msgball['part_no'] = '1';
}
+ $bodystring = '';
$bodystring =
$GLOBALS['phpgw']->msg->phpgw_fetchbody($msgball);
// see if we have to un-do qprint (or
other) encoding of the part we are about to quote
if
(($GLOBALS['phpgw']->msg->get_isset_arg('encoding'))
@@ -224,6 +287,8 @@
}
// explode into an array
$body_array = explode("\r\n",
$bodystring);
+ // cleanup, we do not need $bodystring
var anymore
+ $bodystring = '';
// add the ">" quoting char to the
beginning of each line
// note, this *will* loop at least once
assuming the body has one line at least
// therefor the var "body" *will* get
filled
@@ -231,9 +296,13 @@
{
// add the ">" so called
"quoting" char to the original body text
// NOTE: do NOT trim the LEFT
part of the string, use RTRIM instead
- $this_line = '>' .
rtrim($body_array[$bodyidx]) ."\r\n";
+ //$this_line = '>' .
rtrim($body_array[$bodyidx]) ."\r\n";
+ //$this_line =
$this->reply_prefix . rtrim($body_array[$bodyidx]) ."\r\n";
+ $this_line =
$GLOBALS['phpgw']->msg->reply_prefix . rtrim($body_array[$bodyidx]) ."\r\n";
$body .= $this_line;
}
+ // cleanup
+ $body_array = array();
// email needs to be sent with NO
ENCODED HTML ENTITIES
// it's up to the endusers MUA to
handle any htmlspecialchars
@@ -276,6 +345,7 @@
$body =
$GLOBALS['phpgw']->msg->htmlspecialchars_decode($body);
// now we know all (all ?) html specialchars
are decoded, so we will not get that erronious encoding of the ampersand that
is actually itself part of an html specialchar
$body =
$GLOBALS['phpgw']->msg->htmlspecialchars_encode($body);
+ // NOTE this goes back into the textbox with
out changing the line lengths yet, that happens later
// ---- Handle Replying and Forwarding -----
}
@@ -382,11 +452,14 @@
// ---- Begin The Message Body (of
the body we are replying to) -----
$who_wrote =
$GLOBALS['phpgw']->msg->get_who_wrote($msg_headers);
$lang_wrote = lang('wrote');
+ // 2 blank lines (humm, why 3 crlf
then)
$body = "\r\n"
."\r\n"
- ."\r\n".$who_wrote .'
'.$lang_wrote.': '
- ."\r\n".'>'
- ."\r\n";
+ ."\r\n"
+ // the who wrote line
+ .$who_wrote .' '.$lang_wrote.':
'."\r\n"
+ // then one blank quoted line
b4 the quoted body
+
.$GLOBALS['phpgw']->msg->reply_prefix."\r\n";
// ---- Quoted Bodystring of Re:
Message is the "First Presentable" part -----
// as determimed in class.bomessage and
passed in the uri as "msgball[part_no]=X.X"
@@ -405,6 +478,7 @@
$msgball['part_no'] = '1';
}
+ $bodystring = '';
$bodystring =
$GLOBALS['phpgw']->msg->phpgw_fetchbody($msgball);
// see if we have to un-do qprint (or
other) encoding of the part we are about to quote
if
(($GLOBALS['phpgw']->msg->get_isset_arg('encoding'))
@@ -444,34 +518,58 @@
//$bodystring =
preg_replace("/--\s{0,1}\r\n(.{1,}\r\n){1,5}/smx", "", $bodystring);
// sig = "dash dash space CRLF
(anything and CRLF) repeated 1 to 5 times"
//$bodystring =
preg_replace("/--\s{0,1}\r\n.(?!>)(.{1,}\r\n){1,5}/smx", "", $bodystring);
+ // THIS ONE DOES IT - USE THIS ONE
$bodystring =
preg_replace("/\r\n[-]{2}\s{0,1}\r\n\w.{0,}\r\n(.{1,}\r\n){0,4}/", "\r\n",
$bodystring);
// sig = "CRLF dash dash space(0or1)
CRLF anyWordChar anything CRLF (anything and CRLF) repeated 0 to 4 times"
- //now is a good time to trim the body
+ //now is a good time to trim the
retireved bodystring
trim($bodystring);
// ----- Quote The Body You Are
Replying To With ">" ------
$body_array = array();
+ // NOTE compose page html has a
textarea with "cols" set to 84
+ // this means on submit the text
automatically is hardwrapped to 84 chars
+ // NEW - NOT ANY MORE, no more
wrap=hard in the html-textbox tags
+ // I did this so replies to messages
already having "> " added will not wrap to early
+ // because the message lines are
lengthened by 1 or 2 chars already due to the
+ // already existing "> " and there may
be many of them already.
+ // HOWEVER a new message should go out
with standard 78 char line length (see below)
+
// we need *some* line breaks in the
body so we know where to add the ">" quoting char(s)
// some relatively short emails may not
have any CRLF pairs, but may have a few real long lines
//so, add linebreaks to the body if
none are already existing
if (!ereg("\r\n", $bodystring))
{
// aim for a 74-80 char line
length
- $bodystring =
$GLOBALS['phpgw']->msg->body_hard_wrap($bodystring, 74);
+ //$bodystring =
$GLOBALS['phpgw']->msg->body_hard_wrap($bodystring, 74);
+ $bodystring =
$GLOBALS['phpgw']->msg->body_hard_wrap($bodystring, 78);
+ }
+ else
+ {
+ // NEW CHANGE: compose page no
longer wraps hard
+ // this bodystring is the text
we are about to add reply quotes to
+ // it may already have CRLF but
the line lengths could be too darn long
+ // AND so we need to have
somewhat sane line lengths fed to the textbox
+ // AND we need to have sane
line lengths before we add the quote char
+ // since textbox will happily
submit any length line to the send code and look stupid maybe
+ $bodystring =
$GLOBALS['phpgw']->msg->body_hard_wrap($bodystring, 88);
}
- // explode into an array
$body_array = explode("\r\n",
$bodystring);
+ // cleanup, we do not need $bodystring
var anymore
+ $bodystring = '';
// add the ">" quoting char to the
beginning of each line
// note, this *will* loop at least once
assuming the body has one line at least
// therefor the var "body" *will* get
filled
- for ($bodyidx = 0; $bodyidx <
count($body_array); ++$bodyidx)
+ $body_array_count = count($body_array);
+ for ($bodyidx = 0; $bodyidx <
$body_array_count; ++$bodyidx)
{
// add the ">" so called
"quoting" char to the original body text
// NOTE: do NOT trim the LEFT
part of the string, use RTRIM instead
- $this_line = '>' .
rtrim($body_array[$bodyidx]) ."\r\n";
+ $this_line =
$GLOBALS['phpgw']->msg->reply_prefix . rtrim($body_array[$bodyidx]) ."\r\n";
$body .= $this_line;
}
+ // cleanup
+ $body_array = array();
// email needs to be sent with NO
ENCODED HTML ENTITIES
// it's up to the endusers MUA to
handle any htmlspecialchars
@@ -613,9 +711,10 @@
$addylink_lex = $GLOBALS['phpgw']->link(
"/index.php",
array(
-
"menuaction"=>"email.uijsaddressbook.show",
+
"menuaction"=>"phpgwapi.uijsaddressbook.show",
"viewmore" => "1",
- "cat_id" => "-1"
+ "cat_id" => "-1",
+ "update_opener" => "1"
)
);
//echo '$addylink_lex: '.$addylink_lex.'<br>';
@@ -730,7 +829,7 @@
$bccval="<a
href=\"javascript:addybook('&hideto=1&hidecc=1')\">".lang("bcc")."</a>";
//another thing to do is this: if we hit a
compose page this is a new mesage
//the little addressbook should forget all its
cache
-
$jsaddybookui=CreateObject('email.uijsaddressbook');
+
$jsaddybookui=CreateObject('phpgwapi.uijsaddressbook',true);
$jsaddybookui->forget_all(1);
}
else
====================================================
Index: email/inc/class.bofilters.inc.php
diff -u email/inc/class.bofilters.inc.php:1.14
email/inc/class.bofilters.inc.php:1.15
--- email/inc/class.bofilters.inc.php:1.14 Fri Mar 14 04:00:10 2003
+++ email/inc/class.bofilters.inc.php Thu Dec 30 23:13:50 2004
@@ -721,6 +721,11 @@
// now add this filter piece by piece
// we can only set a non-array value, but we can use
array string for the base
// but we can grab structures
+
+ // NEW we need to wipe the cached filters
+ $my_location = '0;cached_prefs';
+ if ($this->debug_set_prefs > 1) { echo
'bofilters.save_all_filters_to_repository('.__LINE__.'): NEW: EXPIRE CACHED
PREFERENCES, calling ->msg->so->so_appsession_passthru('.$my_location.', "
")<br>'; }
+
$GLOBALS['phpgw']->msg->so->so_appsession_passthru($my_location, ' ');
// first we delete any existing data at the desired
prefs location
$pref_struct_str = '["filters"]';
@@ -796,7 +801,7 @@
// $this_filter['actions'][X]['judgement']
known_string
// $this_filter['actions'][X]['folder']
string contains URI style data ex. "&folder=INBOX.Trash&acctnum=0"
// $this_filter['actions'][X]['actiontext']
user_string
- // $this_filter['actions'][X]['stop_filtering']
UNSET | SET string "True"
+ // $this_filter['actions'][X]['stop_filtering']
UNSET | SET string "True"
for ($i=0; $i < count($this_filter['actions']);
$i++)
{
// judgement
@@ -886,27 +891,32 @@
*/
function do_filter()
{
- if ($this->debug > 0) { echo 'bofilters.do_filter:
ENTERING<br>'; }
+ if ($this->debug > 0) { echo
'bofilters.do_filter('.__LINE__.'): ENTERING<br>'; }
if (count($this->all_filters) == 0)
{
- if ($this->debug > 0) { echo
'bofilters.do_filter: LEAVING with ERROR, no filters exist<br>'; }
+ if ($this->debug > 0) { echo
'bofilters.do_filter('.__LINE__.'): LEAVING with ERROR, no filters exist<br>'; }
return False;
}
//if ($this->debug > 0) { echo 'bofilters.do_filter:
LINE '.__LINE__.' call "->msg->event_begin_big_move" to notice event of
impending big batch moves or deletes<br>'; }
+ // CORRECTION: the move function now buffers the
commands and the count of those buffered commands is kept there, where big move
or not is now determined
//$GLOBALS['phpgw']->msg->event_begin_big_move(array(),
'bofilters.do_filter: LINE '.__LINE__);
+ // filtering thousands of messages can require more time
+ if ($this->debug > 0) { echo
'bofilters.do_filter('.__LINE__.'): calling set_time_limit giving value of 120
ie 2 minutes? <br>'; }
+ set_time_limit(120);
+
// "False" means return $this->not_set if no filter
number was found anywhere
$found_filter_num = $this->obtain_filer_num(False);
- if ($this->debug > 1) { echo
'bofilters.obtain_filer_num: $found_filter_num :
[<code>'.serialize($found_filter_num).'</code>]<br>'."\r\n"; }
+ if ($this->debug > 1) { echo
'bofilters.do_filter('.__LINE__.'): $found_filter_num :
[<code>'.serialize($found_filter_num).'</code>]<br>'."\r\n"; }
if ($found_filter_num == $this->not_set)
- {
+ {
// NO filter number was specified, that means
run ALL filters
$this->do_filter_apply_all = True;
for ($filter_idx=0; $filter_idx <
count($this->all_filters); $filter_idx++)
{
- if ($this->debug > 1) { echo
'bofilters.do_filter: run_all_finters_mode: calling
$this->run_single_filter['.$filter_idx.']<br>'; }
+ if ($this->debug > 1) { echo
'bofilters.do_filter('.__LINE__.'): run_all_finters_mode: calling
$this->run_single_filter['.$filter_idx.']<br>'; }
$this->run_single_filter((int)$filter_idx);
if ($this->just_testing())
{
@@ -919,7 +929,7 @@
{
// we were given a filter_num, that means run
THAT FILTER ONLY
$this->do_filter_apply_all = False;
- if ($this->debug > 1) { echo
'bofilters.do_filter: run_single_filter mode: calling
$this->run_single_filter['.$found_filter_num.']<br>'; }
+ if ($this->debug > 1) { echo
'bofilters.do_filter('.__LINE__.'): run_single_filter mode: calling
$this->run_single_filter['.$found_filter_num.']<br>'; }
$this->run_single_filter((int)$found_filter_num);
if ($this->just_testing())
{
@@ -955,32 +965,34 @@
$GLOBALS['phpgw_info']['flags']['noappfooter']
= True;
$GLOBALS['phpgw']->common->phpgw_header();
- echo '<h4>Apply Filters Report:</h4>'."\r\n";
+ echo '<h4>'.lang('Apply Filters
Report:').'</h4>'."\r\n";
for ($filter_idx=0; $filter_idx <
count($this->all_filters); $filter_idx++)
{
$this_filter =
$this->all_filters[$filter_idx];
$num_matches =
count($this->each_filter_mball_list[$filter_idx]);
parse_str($this_filter['actions'][0]['folder'], $target_folder);
echo '<p>'."\r\n"
- .'<strong>Filter number
'.(string)$filter_idx.':</strong>'.'<br>'."\r\n"
- .' '.'filter name:
['.$this_filter['filtername'].']<br>'."\r\n"
- .' '.'number of
matches: ['.(string)$num_matches.']'.'<br>'."\r\n"
- .' '.'requested filter
action: ['.$this_filter['actions'][0]['judgement'].'] ; Acctnum
['.(string)$target_folder['acctnum'].'] ; Folder:
['.htmlspecialchars($target_folder['folder']).']<br>'."\r\n"
+ .'<strong>'.lang('Filter number').'
'.(string)$filter_idx.':</strong>'.'<br>'."\r\n"
+ .' '.lang('filter
name:').' ['.$this_filter['filtername'].']<br>'."\r\n"
+ .' '.lang('number of
matches:').' ['.(string)$num_matches.']'.'<br>'."\r\n"
+
+ .' '.lang('requested
filter action:').' ['.$this_filter['actions'][0]['judgement'].'] ; Acctnum
['.(string)$target_folder['acctnum'].'] ; '.lang('Folder').':
['.htmlspecialchars($target_folder['folder']).']<br>'."\r\n"
.'</p>'."\r\n"
.'<p> </p>'."\r\n";
}
}
- if ($this->debug > 1) { echo 'bofilters.do_filter:
calling end_request<br>'; }
+ if ($this->debug > 1) { echo
'bofilters.do_filter('.__LINE__.'): calling end_request<br>'; }
$GLOBALS['phpgw']->msg->end_request();
- if ($this->debug > 0) { echo 'bofilters.do_filter:
LEAVING<br>'; }
+ if ($this->debug > 0) { echo
'bofilters.do_filter('.__LINE__.'): LEAVING<br>'; }
$take_me_to_url = $GLOBALS['phpgw']->link(
'/index.php',
-
'menuaction=email.uifilters.filters_list');
- $take_me_to_href = '<a href="'.$take_me_to_url.'"> Go
Back </a>';
+
//'menuaction=email.uifilters.filters_list');
+
'menuaction=email.uiindex.index');
+ $take_me_to_href = '<a href="'.$take_me_to_url.'">
'.lang('Go Back').' </a>';
//Header('Location: ' . $take_me_to_url);
- echo
'<br><p>'.' '.$take_me_to_href.'</p>';
+ echo
'<br><p>'.' '.$take_me_to_href.'</p><BR>';
- if ($this->debug > 0) { echo 'bofilters.do_filter:
LEAVING<br>'; }
+ if ($this->debug > 0) { echo
'bofilters.do_filter('.__LINE__.'): LEAVING<br>'; }
}
// PRIVATE
@@ -992,24 +1004,24 @@
*/
function run_single_filter($filter_num='')
{
- if ($this->debug > 0) { echo
'bofilters.run_single_filter: ENTERING, feed $filter_num :
[<code>'.serialize($filter_num).'</code>]<br>'; }
+ if ($this->debug > 0) { echo
'bofilters.run_single_filter('.__LINE__.'): ENTERING, feed $filter_num :
[<code>'.serialize($filter_num).'</code>]<br>'; }
if (count($this->all_filters) == 0)
{
- if ($this->debug > 0) { echo
'bofilters.run_single_filter: LEAVING with ERROR, no filters exist<br>'; }
+ if ($this->debug > 0) { echo
'bofilters.run_single_filter('.__LINE__.'): LEAVING with ERROR, no filters
exist<br>'; }
}
$filter_exists = $this->filter_exists($filter_num);
if (!$filter_exists)
{
- if ($this->debug > 0) { echo
'bofilters.run_single_filter: LEAVING with ERROR, filter data for $filter_num
['.$filter_num.'] does not exist, return False<br>'; }
+ if ($this->debug > 0) { echo
'bofilters.run_single_filter('.__LINE__.'): LEAVING with ERROR, filter data for
$filter_num ['.$filter_num.'] does not exist, return False<br>'; }
return False;
}
$this_filter = $this->all_filters[$filter_num];
- if ($this->debug > 2) { echo
'bofilters.run_single_filter: $filter_num ['.$filter_num.'] ; $this_filter
DUMP:<pre>'; print_r($this_filter); echo "</pre>\r\n"; }
+ if ($this->debug > 2) { echo
'bofilters.run_single_filter('.__LINE__.'): $filter_num ['.$filter_num.'] ;
$this_filter DUMP:<pre>'; print_r($this_filter); echo "</pre>\r\n"; }
// WE NEED TO DO THIS FOR EVERY SOURCE ACCOUNT
specified in this filter
for ($src_acct_loop_num=0; $src_acct_loop_num <
count($this_filter['source_accounts']); $src_acct_loop_num++)
{
- if ($this->debug > 1) { echo
'bofilters.run_single_filter: source_accounts loop
['.$src_acct_loop_num.']<br>'; }
+ if ($this->debug > 1) { echo
'bofilters.run_single_filter('.__LINE__.'): source_accounts loop
['.$src_acct_loop_num.']<br>'; }
// ACCOUNT TO SEARCH (always filter source is
INBOX)
$fake_fldball = array();
@@ -1021,12 +1033,12 @@
if
((isset($this->inbox_full_msgball_list[$src_acct_loop_num]))
||
(count($this->inbox_full_msgball_list[$src_acct_loop_num]) > 0))
{
- if ($this->debug > 1) { echo
'bofilters.run_single_filter: already obtained inbox_full_msgball_list, during
a previous filter, for $src_acct_loop_num ['.$src_acct_loop_num.']<br>'; }
- }
+ if ($this->debug > 1) { echo
'bofilters.run_single_filter('.__LINE__.'): already obtained
inbox_full_msgball_list, during a previous filter, for $src_acct_loop_num
['.$src_acct_loop_num.']<br>'; }
+ }
else
{
// get FULL msgball list for this INBOX
(we always filter INBOXs only)
- if ($this->debug > 1) { echo
'bofilters.run_single_filter: get_msgball_list for later XOR ing for
<code>['.serialize($fake_fldball).']</code><br>'; }
+ if ($this->debug > 1) { echo
'bofilters.run_single_filter('.__LINE__.'): get_msgball_list for later XOR ing
for <code>['.serialize($fake_fldball).']</code><br>'; }
//$this->inbox_full_msgball_list[$src_acct_loop_num] =
$GLOBALS['phpgw']->msg->get_msgball_list($fake_fldball['acctnum'],
$fake_fldball['folder']);
// FIXME: FOR BACKWARDS COMPAT WE GET
AN OLD STYLE MSGBALL LIST
$this->inbox_full_msgball_list[$src_acct_loop_num] =
$GLOBALS['phpgw']->msg->get_msgball_list_oldschool($fake_fldball['acctnum'],
$fake_fldball['folder']);
@@ -1035,7 +1047,7 @@
// FOR EACH MSG, GET IT'S RAW HEADERS
// only if we have not got them yet
- if ($this->debug > 1) { echo
'bofilters.run_single_filter: get headers for each msg in $src_acct_loop_num
['.$src_acct_loop_num.']<br>'; }
+ if ($this->debug > 1) { echo
'bofilters.run_single_filter('.__LINE__.'): get headers for each msg in
$src_acct_loop_num ['.$src_acct_loop_num.']<br>'; }
for ($msg_iteration=0; $msg_iteration <
count($this->inbox_full_msgball_list[$src_acct_loop_num]); $msg_iteration++)
{
if
((isset($this->inbox_full_msgball_list[$src_acct_loop_num][$msg_iteration]['headers_text']))
@@ -1043,7 +1055,7 @@
{
// we ALREADY hav the headers
// continue to the next message
- if ($this->debug > 1) { echo
'bofilters.run_single_filter: already obtained headers, during a previous
filter, for $src_acct_loop_num ['.$src_acct_loop_num.']<br>'; }
+ if ($this->debug > 1) { echo
'bofilters.run_single_filter('.__LINE__.'): already obtained headers, during a
previous filter, for $src_acct_loop_num ['.$src_acct_loop_num.']<br>'; }
continue;
}
// we need to get the headers
@@ -1118,20 +1130,20 @@
if
($this->inbox_full_msgball_list[$src_acct_loop_num][$msg_iteration]['msgnum']
== $this->not_set)
{
// this message had already
been filtered AND MOVED OR DELETED, continue to next loop
- if ($this->debug > 1) { echo
'<br>bofilters.run_single_filter: skipping... this message has already been
moved, deleted by a previous filter, $src_acct_loop_num
['.$src_acct_loop_num.'] $msg_iteration ['.$msg_iteration.']<br><br>'; }
+ if ($this->debug > 1) { echo
'<br>bofilters.run_single_filter('.__LINE__.'): skipping... this message has
already been moved, deleted by a previous filter, $src_acct_loop_num
['.$src_acct_loop_num.'] $msg_iteration ['.$msg_iteration.']<br><br>'; }
continue;
}
// we have a message to be filtered...
$headers_text =
$this->inbox_full_msgball_list[$src_acct_loop_num][$msg_iteration]['headers_text'];
// this patiular message has not been
looked at yet, initialize it match keeper value
$this->inbox_full_msgball_list[$src_acct_loop_num][$msg_iteration]['match_keeper']
= 0;
- if ($this->debug > 2) { echo
'bofilters.run_single_filter:
$this->inbox_full_msgball_list['.$src_acct_loop_num.']['.$msg_iteration.'][headers_text]
DUMP:<pre>';
print_r($this->inbox_full_msgball_list[$src_acct_loop_num][$msg_iteration]['headers_text']);
echo "</pre>\r\n"; }
+ if ($this->debug > 2) { echo
'bofilters.run_single_filter('.__LINE__.'):
$this->inbox_full_msgball_list['.$src_acct_loop_num.']['.$msg_iteration.'][headers_text]
DUMP:<pre>';
print_r($this->inbox_full_msgball_list[$src_acct_loop_num][$msg_iteration]['headers_text']);
echo "</pre>\r\n"; }
// every header line gets looked at by
every row of match criteria
// WE NEED TO DO THIS FOR EVERY MATCH
ROW
for ($matches_row=0; $matches_row <
count($this_filter['matches']); $matches_row++)
{
- if ($this->debug > 1) { echo
'bofilters.run_single_filter: source_accounts loop ['.$src_acct_loop_num.'] ;
$msg_iteration ['.$msg_iteration.'] ; $matches_row ['.$matches_row.']<br>'; }
+ if ($this->debug > 1) { echo
'bofilters.run_single_filter('.__LINE__.'): source_accounts loop
['.$src_acct_loop_num.'] ; $msg_iteration ['.$msg_iteration.'] ; $matches_row
['.$matches_row.']<br>'; }
// Note on "RECIPIENT" :
to,cc, bcc "tri-fecta" all three headers must be considered
// this is why we made a faux
header line that contains all three of those in one line
// NOTE: recipient Contains vs.
NotContains
@@ -1153,7 +1165,7 @@
// if this is really the 1st
word of the header string, it will be preceeded by CRLF
$inspect_me =
stristr($headers_text, "\r\n".$search_key_imap);
// inspect_me will be
everything to the right of the "neede" INCLUDING the "needle" itself and the
REST of the headers
- if ($this->debug > 1) { echo
'bofilters.run_single_filter: $search_key_imap ['.$search_key_imap.'] ;
$comparator ['.$comparator.'] ; $search_for ['.$search_for.']<br>'; }
+ if ($this->debug > 1) { echo
'bofilters.run_single_filter('.__LINE__.'): $search_key_imap
['.$search_key_imap.'] ; $comparator ['.$comparator.'] ; $search_for
['.$search_for.']<br>'; }
if ($inspect_me)
{
// get rid of that
"needle" search_key_imap (it's included from the stristr above)
@@ -1164,7 +1176,7 @@
$cut_here =
strpos($inspect_me, "\r\n");
// get everything FROM
beginning of string TO pos $cut_here (the end of the line);
$inspect_me =
substr($inspect_me, 0, $cut_here);
- if ($this->debug > 1) {
echo 'bofilters.run_single_filter: GOT HEADER TO LOOK IN: $inspect_me
['.htmlspecialchars($inspect_me).']<br>'; }
+ if ($this->debug > 1) {
echo 'bofilters.run_single_filter('.__LINE__.'): GOT HEADER TO LOOK IN:
$inspect_me ['.htmlspecialchars($inspect_me).']<br>'; }
// look for EXISTS or
NOT EXISTS our search string
if
(
@@ -1174,7 +1186,7 @@
&&
(stristr($inspect_me, $search_for) == False))
)
{
- if
($this->debug > 1) { echo 'bofilters.run_single_filter: ** GOT ROW CRITERIA
MATCH ** $matches_row '.$matches_row.'<br>'; }
+ if
($this->debug > 1) { echo 'bofilters.run_single_filter('.__LINE__.'): ** GOT
ROW CRITERIA MATCH ** $matches_row '.$matches_row.'<br>'; }
// MATCH: this
row matches the search criteria
// i.e. this
header line does -or- does not have the seach for text, as requested
if
($matches_row == 0)
@@ -1197,7 +1209,7 @@
{
echo
'match keeper error<br>';
$this->inbox_full_msgball_list[$src_acct_loop_num][$msg_iteration]['match_keeper']
= 'ERROR1';
- }
+ }
}
else
@@ -1209,7 +1221,7 @@
{
// header we are
looking for does not exist in this messages headers
// probably lookinf for
an "X-" header, like "X-Mailer:"
- if ($this->debug > 1) {
echo 'bofilters.run_single_filter: requested header $search_key_imap
['.$search_key_imap.'] not in this messages headers<br>'; }
+ if ($this->debug > 1) {
echo 'bofilters.run_single_filter('.__LINE__.'): requested header
$search_key_imap ['.$search_key_imap.'] not in this messages headers<br>'; }
}
// this is the last code that
gets run BEFORE we move on to the next row of match criteria
// this code is INSIDE the
match criteria rows
@@ -1870,7 +1882,7 @@
// skip this
}
else
- {
+ {
// 2nd Line
if ($num_search_criteria == 1)
{
====================================================
Index: email/inc/class.bosend.inc.php
diff -u email/inc/class.bosend.inc.php:1.11 email/inc/class.bosend.inc.php:1.12
--- email/inc/class.bosend.inc.php:1.11 Fri Mar 14 04:00:21 2003
+++ email/inc/class.bosend.inc.php Thu Dec 30 23:13:50 2004
@@ -39,11 +39,16 @@
var $debug_send = 0;
var $debug_struct = 0;
//var $debug_struct = 3;
+ var $company_disclaimer = '';
function bosend()
{
if ($this->debug_constructor > 0) { echo 'email.bosend
*constructor*: ENTERING<br>'; }
+ // May 9, 2003 Ryan Bonham adds company disclaimer code
+ // This Disclaimer will be added to any out going mail
+ //var $company_disclaimer = "\r\n\r\n-- \r\n This
message was sent using Forester GroupWare. Visit the Forest City Regional
website at http://www.forestcityschool.org.\r\nThis message does not
necessarily reflect the views of the Forest City Regional School District, nor
has it been approved or sanctioned by it. \r\n";
+
$this->msg_bootstrap =
CreateObject("email.msg_bootstrap");
$this->msg_bootstrap->ensure_mail_msg_exists('email.bosend.constructor',
$this->debug_send);
@@ -218,6 +223,8 @@
$this->mail_spell = CreateObject("email.spell");
// preserve these vars
$this->mail_spell->set_preserve_var('action',
$GLOBALS['phpgw']->msg->get_arg_value('action'));
+ // experimental, should this go here? is not this
already in the URI or something?
+ //$this->mail_spell->set_preserve_var('orig_action',
$GLOBALS['phpgw']->msg->recall_desired_action());
$this->mail_spell->set_preserve_var('from',
$GLOBALS['phpgw']->msg->get_arg_value('from'));
$this->mail_spell->set_preserve_var('sender',
$GLOBALS['phpgw']->msg->get_arg_value('sender'));
$this->mail_spell->set_preserve_var('to',
$GLOBALS['phpgw']->msg->stripslashes_gpc($GLOBALS['phpgw']->msg->get_arg_value('to')));
@@ -519,8 +526,121 @@
$user_sig =
$GLOBALS['phpgw']->msg->get_pref_value('email_sig');
// html_quotes_decode may be obsoleted someday:
workaround for a preferences database issue (<=pgpgw ver 0.9.13)
$user_sig =
$GLOBALS['phpgw']->msg->html_quotes_decode($user_sig);
- $body = $body ."\r\n"."\r\n".'-- '."\r\n"
.$user_sig ."\r\n";
+ $body = $body."\r\n"
+ ."\r\n"
+ .'-- '."\r\n"
+ .$user_sig ."\r\n";
+ }
+ if ($this->company_disclaimer)
+ {
+ $body = $body .$this->company_disclaimer;
+ }
+
+ // LINE LENGTH for "new" and our text of a forwarded
text are 78 chars,
+ // which is SHORTER than for reply quoted bodies that
have ">" chars
+ // this is only for text WE have written, not any other
part of the body
+ // html textbox no longer adds hard wrap on submit, so
we handle it here now
+ // NOTE reply bodies have already been handled as to
length when we quoted the text
+ //if
(($GLOBALS['phpgw']->msg->get_isset_arg('orig_action'))
+ //&& (
+ //
($GLOBALS['phpgw']->msg->get_arg_value('orig_action') == 'new')
+ // ||
($GLOBALS['phpgw']->msg->get_arg_value('orig_action') == 'forward')
+ // )
+ //)
+ if (($GLOBALS['phpgw']->msg->recall_desired_action()==
'new')
+ || ($GLOBALS['phpgw']->msg->recall_desired_action() ==
'forward'))
+ {
+ // WRAP BODY to lines of 78 chars then CRLF
+ // IS THIS TOO SHORT? what about code snippets
and stuff?or long URLs
+ $body =
$GLOBALS['phpgw']->msg->body_hard_wrap($body, 78);
+ }
+ elseif
(($GLOBALS['phpgw']->msg->recall_desired_action()== 'reply')
+ || ($GLOBALS['phpgw']->msg->recall_desired_action()==
'replyall'))
+ {
+ //echo 'entering recall_desired_action == reply
line length handling'."\r\n";
+ // ok we have already quoted the text of the
message we are replying to
+ // BUT we have yet to standardize line length
for the text WE just typed
+ // in this message, our own text,
+ // BUT we really should skip doing linebreaking
it _again_ for the quoted text, though
+ $body_array = array();
+ $body_array = explode("\r\n", $body);
+ // we do not use this again till we put
$new_body into it, so clear the memory
+ $body = '';
+ // process only our unquoted text
+ $body_array_count = count($body_array);
+ $in_unquoted_block = False;
+ $unquoted_text = '';
+ $new_body = '';
+ for ($bodyidx = 0; $bodyidx <
$body_array_count; ++$bodyidx)
+ {
+ // skip text that starts with the ">"
so called "quoting" char to the original body text
+ // because it has already been line
length normalized in bocompose
+ $this_line = $body_array[$bodyidx];
+ if ((strlen($this_line) > 1)
+ && ($this_line[0] ==
$GLOBALS['phpgw']->msg->reply_prefix[0]))
+ {
+ // ... this line starts with
the quoting char
+ if ($in_unquoted_block == True)
+ {
+ //echo 'line ength
handling: processing MY text block'."\r\n";
+ // TOGGLE - we are
exiting block of our text
+ // process the
preceeding block of unquoted text, if any
+ $unquoted_text =
$GLOBALS['phpgw']->msg->body_hard_wrap($unquoted_text, 78);
+ // now pass it into the
new body var
+ $new_body .=
$unquoted_text;
+ // clear this var
+ $unquoted_text = '';
+ // toggle this flag
+ $in_unquoted_block =
False;
+ // for THIS line, it is
the first in a quoted block, so pass straight to new body var
+ // I _think_ the CRLF
is needed before this line because hard_wrap may not
+ // put one at the end
of the last line of the unquoted text block ?
+ //$new_body .= "\r\n"
. $this_line . "\r\n";
+ $new_body .= $this_line
. "\r\n";
+ }
+ else
+ {
+ // we are in a block of
QUOTED text, simply pass it into the new body var
+ $new_body .= $this_line
. "\r\n";
+ }
+ }
+ elseif (($body_array_count - $bodyidx)
== 1)
+ {
+ // this is the last line, and
it is NOT quoted, so if we were in an unquoted block (of our text) process it
now
+ // even if this is the only
single line of unquoted text in the message, process it now
+ // otherwise we may leave off
the end of the message, if it is our text
+ $unquoted_text .= $this_line;
+ $unquoted_text =
$GLOBALS['phpgw']->msg->body_hard_wrap($unquoted_text, 78);
+ $new_body .= $unquoted_text;
+ $unquoted_text = '';
+ // this really is not needed,
but so it anyway
+ $in_unquoted_block = False;
+ }
+ else
+ {
+ // ... this line does NOT start
with the quoting char, i.e. it is text we typed in
+ // make sure flag is correct
+ if ($in_unquoted_block == False)
+ {
+ // toggle this flag
+ $in_unquoted_block =
True;
+ // there is just no
real special action of a change into this block of our text,
+ // the real action is
when switching out of a block or our (unqouted) text
+ }
+ // compile this block of
unquoted text, our text, in a var for later processing
+ $unquoted_text .= $this_line .
"\r\n";
+ }
+ }
+ // cleanup
+ $body_array = array();
+ // ok we have gone through the whole message,
put it in the bldy var
+ $body = '';
+ $body = $new_body;
+ $new_body = '';
+ $unquoted_text = '';
+ // end reply body line length landling block
}
+
// Step One Addition
// ---- Request Delivery Notification in Headers ----
if
(($GLOBALS['phpgw']->msg->get_isset_arg('req_notify'))
@@ -910,7 +1030,7 @@
while ($datachunk =
fread($fh, 57))
{
if
($this->debug_struct > 2) { echo '$next_pos ['.$next_pos.'] :: string
['.$datachunk.'] :: b64 version ['.base64_encode($datachunk).']<br>'."\r\n"; }
-
$this->mail_out['body'][$body_part_num]['mime_body'][$next_pos] =
base64_encode($datachunk);
+
$this->mail_out['body'][$body_part_num]['mime_body'][$next_pos] =
base64_encode($datachunk);
$next_pos++;
}
$b64_part = '';
====================================================
Index: email/inc/class.html_widgets.inc.php
diff -u email/inc/class.html_widgets.inc.php:1.3
email/inc/class.html_widgets.inc.php:1.4
--- email/inc/class.html_widgets.inc.php:1.3 Fri Mar 14 04:00:42 2003
+++ email/inc/class.html_widgets.inc.php Thu Dec 30 23:13:50 2004
@@ -1,1629 +1,1699 @@
-<?php
-
/**************************************************************************\
- * AngleMail - E-Mail Module for phpGroupWare
*
- * http://www.anglemail.org
*
- * http://www.phpgroupware.org
*
- */
-
/**************************************************************************\
- * AngleMail - HTML Widgets
*
- * This file written by "Angles" Angelo Puglisi <address@hidden> *
- * Email related HTML Widgets and Utility Functions
*
- * Copyright (C) 2002 Angelo Tony Puglisi (Angles)
*
- *
-------------------------------------------------------------------------
*
- * This library is free software; you can redistribute it and/or modify
it *
- * under the terms of the GNU Lesser General Public License as published
by *
- * the Free Software Foundation; either version 2.1 of the License,
*
- * or any later version.
*
- * This library is distributed in the hope that it will be useful, but
*
- * WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
- * See the GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
License *
- * along with this library; if not, write to the Free Software
Foundation, *
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
-
\**************************************************************************/
-
- /* $Id$ */
- /*!
- @class html_option
- @abstract data structure used with class html_widgets
- @param $value (class var) (string) this options value that will be
submitted if selected
- @param $text (class var) (string) the text the user sees, a description
of this option
- @param $selected (class var) (boolean) whether this option should be
pre-selected in a combobox, default False
- @author Angles
- @discussion used in making select text, value items, such as in the
combobox widget.
- @access private
- */
- class html_option
- {
- var $value;
- var $text;
- var $selected;
-
- function html_option()
- {
- $this->value = '';
- $this->text = '';
- $this->selected = False;
- }
- }
-
- /*!
- @class hiddenvar_option
- @abstract data structure used with hidden data in forms
- @discussion ?
- @access private
- */
- class hiddenvar_option
- {
- var $name;
- var $value;
-
- function hiddenvar_option()
- {
- $this->name = '';
- $this->value = '';
- }
- }
-
- /*!
- @class html_widgets
+<?php
+
/**************************************************************************\
+ * AngleMail - E-Mail Module for phpGroupWare
*
+ * http://www.anglemail.org
*
+ * http://www.phpgroupware.org
*
+ */
+
/**************************************************************************\
+ * AngleMail - HTML Widgets
*
+ * This file written by "Angles" Angelo Puglisi <address@hidden> *
+ * Email related HTML Widgets and Utility Functions
*
+ * Copyright (C) 2002 Angelo Tony Puglisi (Angles)
*
+ *
-------------------------------------------------------------------------
*
+ * This library is free software; you can redistribute it and/or modify
it *
+ * under the terms of the GNU Lesser General Public License as published
by *
+ * the Free Software Foundation; either version 2.1 of the License,
*
+ * or any later version.
*
+ * This library is distributed in the hope that it will be useful, but
*
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
+ * See the GNU Lesser General Public License for more details.
*
+ * You should have received a copy of the GNU Lesser General Public
License *
+ * along with this library; if not, write to the Free Software
Foundation, *
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
+
\**************************************************************************/
+
+ /* $Id$ */
+ /*!
+ @class html_option
+ @abstract data structure used with class html_widgets
+ @param $value (class var) (string) this options value that will be
submitted if selected
+ @param $text (class var) (string) the text the user sees, a description
of this option
+ @param $selected (class var) (boolean) whether this option should be
pre-selected in a combobox, default False
+ @author Angles
+ @discussion used in making select text, value items, such as in the
combobox widget.
+ @access private
+ */
+ class html_option
+ {
+ var $value;
+ var $text;
+ var $selected;
+
+ function html_option()
+ {
+ $this->value = '';
+ $this->text = '';
+ $this->selected = False;
+ }
+ }
+
+ /*!
+ @class hiddenvar_option
+ @abstract data structure used with hidden data in forms
+ @discussion ?
+ @access private
+ */
+ class hiddenvar_option
+ {
+ var $name;
+ var $value;
+
+ function hiddenvar_option()
+ {
+ $this->name = '';
+ $this->value = '';
+ }
+ }
+
+ /*!
+ @class html_widgets
@abstract generate HTML widgets for use in web pages.
- @author Angles
- @access public
- @discussion OOP style class for producing common widgets in html pages,
such as a combobox.
- Designed to reduce bain damage to the developer by hiding the details
of the html tags and by
- treating these things as widgets which is what they are, more than just
simple html markup.
- */
- class html_widgets
- {
-
/**************************************************************************\
- * VARS
-
\**************************************************************************/
- //var $debug = 3;
- var $debug_init = 0;
+ @author Angles
+ @access public
+ @discussion OOP style class for producing common widgets in html pages,
such as a combobox.
+ Designed to reduce bain damage to the developer by hiding the details
of the html tags and by
+ treating these things as widgets which is what they are, more than just
simple html markup.
+ */
+ class html_widgets
+ {
+
/**************************************************************************\
+ * VARS
+
\**************************************************************************/
+ var $debug = 0;
+ var $debug_init = 0;
+
+ // if calling from home page it is optional to force currentapp
as a constructor param
+ var $my_currentapp='';
+ // bootstraper for the msg class
+ var $msg_bootstrap;
+ // private template to var names do not collide
+ var $tpl;
+
+ // A HREF OOP properties
+ var $href_link='';
+ var $href_target='';
+ var $href_clickme='not_provided';
+ var $href='';
+
+ // combo box OOP properties
+ var $cbox_name='not_provided';
+ var $cbox_onChange='';
+ var $cbox_items=array();
+ var $combobox='';
+
+ // form OOP properties
+ var $form_name='';
+ var $form_action='';
+ var $form_method='';
+ var $form_hiddenvars=array();
+ var $form='';
+
+ // TOOLBAR
+ var $toolbar_msg='';
+ var $toolbar_row_one='';
+ var $toolbar_row_two='';
+ var $toolbar='';
+
+ // ALL FOLDERS ALL ACCOUNTS MEGA LISTBOX
+ var $F_megalist_form_reference='';
+ var $F_megalist_widget_name='';
+ var $F_megalist_preselected_fldball='';
+ var $F_megalist_skip_fldball='';
+ var $F_megalist_first_item_text = '';
+
+ // RELOAD WIDGET
+ var $refresh_js='';
+
+ // GENERIC ERROR REPORT
+ var $F_mindless_default_txt = 'error text not provided';
+ var $F_error_report_text='';
+ var $F_go_somewhere_link='';
+ var $F_go_home_link='';
+
+
+
/**************************************************************************\
+ * CONSTRUCTOR
+
\**************************************************************************/
+ function html_widgets()
+ {
+ if ($this->debug_init > 0) { echo 'ENTER:
email.html_widgets.CONSTRUCTOR'.'<br>'."\r\n"; }
+ /*!
+ @class requires including spell_struct header file
+ @discussion class html_widgets needs the special
C-Style Include .h like file,
+ class.spell_struct which holds data structure class
correction_info used here for integration
+ with the mail.spell spellchecking class.
+ */
+ $required_class = 'spell_struct';
+
+ // if calling this class from the home page, then the
currentapp will be
+ //set to "home" instead of "email", which messes up the
include statement below,
+ // so set a local var to "email" to force considering
the currentapp to be "email".
+ $this->my_currentapp = 'email';
+
//require_once(PHPGW_INCLUDE_ROOT.'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/inc/class.'.$required_class.'.inc.php');
+
require_once(PHPGW_INCLUDE_ROOT.'/'.$this->my_currentapp.'/inc/class.'.$required_class.'.inc.php');
+
+ if ($this->debug_init > 0) { echo 'EXIT:
email.html_widgets.CONSTRUCTOR'.'<br>'."\r\n"; }
+ return;
+ }
+
+
+
/**************************************************************************\
+ * HREF LINK WIDGET
+
\**************************************************************************/
+
+ /*!
+ @capability HREF LINK WIDGET
+ @discussion generate an a href item, includes link, target,
text. CLEARS ITSELF after each "get_href"
+ @author Angles
+ @example $this->widgets->set_href_link('index.php');
+ $this->widgets->set_href_target('top');
+ $this->widgets->get_href_clickme(lang('click here for more info
in a new window'));
+ $my_href_tag = $this->widgets->get_href();
+ */
+ /*!
+ @function clear_href_vars
+ @abstract after every call to "->get_href" all internal vars
are cleared automatically with this function.
+ @author Angles
+ @discussion href class vars for link, target, text. CLEARS
ITSELF after each "get_href". This utilty
+ function does that. It is RARE that you would ever need to call
this directly.
+ @access private
+ */
+ function clear_href_vars()
+ {
+ $this->set_href_link('');
+ $this->set_href_target('');
+ $this->set_href_clickme('');
+ }
+
+ /*!
+ @function set_href_link
+ @abstract set the URL link of this this HREF widget
+ @param $href_link (string)
+ @author Angles
+ @access public
+ */
+ function set_href_link($href_link='')
+ {
+ $this->href_link = $href_link;
+ }
+ /*!
+ @function get_href_link
+ @abstract used check or verify the value if the "href_link"
property
+ @author Angles
+ @access public
+ */
+ function get_href_link()
+ {
+ return $this->href_link;
+ }
+
+ /*!
+ @function set_href_target
+ @abstract OPTIONAL set the "target", i.e. what browser window
this HREF should apply to,
+ default is not to specify any target in the HREF tag.
+ @param $href_target (string)
+ @author Angles
+ @access public
+ */
+ function set_href_target($href_target='')
+ {
+ $this->href_target = $href_target;
+ }
+ /*!
+ @function get_href_target
+ @abstract used check or verify the value if the "href_target"
property
+ @author Angles
+ @access public
+ */
+ function get_href_target()
+ {
+ return $this->href_target;
+ }
+
+ /*!
+ @function set_href_clickme
+ @abstract what the user needs to click on to activate the HREF
link, can be text or a COMPLETE img tag.
+ @param $href_clickme (string) text or a COMPLETE img tag
+ @author Angles
+ @access public
+ */
+ function set_href_clickme($href_clickme='')
+ {
+ $this->href_clickme = $href_clickme;
+ }
+ /*!
+ @function get_href_clickme
+ @abstract used check or verify the value if the "href_clickme"
property
+ @author Angles
+ @access public
+ */
+ function get_href_clickme()
+ {
+ return $this->href_clickme;
+ }
+
+ /*!
+ @function get_href
+ @abstract generate and return an HREF tag using information you
set in the OOP "set_href_" functions
+ @author Angles
+ @result (string) a complete HREF tag generated from data you
set in the "set_href_" functions,
+ @discussion After you set "href_target", "href_clickme" and
other optional properties ("href_target") this
+ function generates an HREF tag from that data and returns it.
NOTE after generating the HREF tag, and
+ before returning it, this function CLEARS ALL PROPERTIES that
it used to make that href tag, so this
+ "widget" automatically is ready to new usage without having to
explicitly call any "new" or "clear" function.
+ @access public
+ */
+ function get_href()
+ {
+ if ($this->href_target != '')
+ {
+ $target = ' target="'.$this->href_target.'"';
+ }
+ // put the href return value in storage so we can clear
all href internal vars before we exit this function with a return.
+ $href = '<a href="' .$this->href_link .'"'.$target.'>'
.$this->href_clickme .'</a>' ."\r\n";
+ // this widget clears itself automatically after every
call to this function.
+ $this->clear_href_vars();
+ return $href;
+ }
+
+
/**************************************************************************\
+ * QUICK HREF TAG - depreciated
+
\**************************************************************************/
+ /*!
+ @function href_maketag (not related to the HREF widget)
+ @abstract QUICK way to generate a typical A HREF html item in a
single function call. NOT PART OF
+ THE HREF WIDGET, not OOP style, just a quick utilty function.
ALL params must be passed in this function call.
+ @param $href_link (string) URL for this HREF tag
+ @param $href_text (string) what the user clicks on to activate
this HREF tag, can be text OR a COMPLETE IMG tag.
+ @param $target (string) OPTIONAL target for the link, such as
when using frames or opening a new browser window.
+ @author Angles
+ @discussion not really a widget, does not use OOP style, but it
gets the job done quickly. Somewhat Depreciated,
+ use the OOP style href widget instead.
+ @example this->href_maketag("index.jsp", "click here for home
page", "new");
+ @access public
+ */
+ function href_maketag($href_link='',$href_text='default
text',$target='')
+ {
+ if ($target != '')
+ {
+ $target = ' target="'.$target.'"';
+ }
+ return '<a href="' .$href_link .'"'.$target.'>'
.$href_text .'</a>' ."\r\n";
+ }
+
+
/**************************************************************************\
+ * QUICK IMG TAG
+
\**************************************************************************/
+ /*!
+ @function img_maketag
+ @abstract quick and dirty to make an IMG html tag in one
function call.
+ @author Angles
+ @param $location (string int) URL to the image, cal be
releative or fully qualified
+ @param $alt (string) text displayed (a) in place of the image
if not displayed, and (b) as a image tooltip on some browsers
+ @param $height (string int) int passed as a string, OPTIONAL,
not included in img tag if not provided
+ @param $width (string int) int passed as a string OPTIONAL,
not included in img tag if not provided
+ @param $border (string int) int passed as string OPTIONAL , not
included in img tag if not provided ,
+ the size of the border around the image, often set to "0"
+ @discussion not really a widget but it gets the job done. QUICK
way to generate a typical A IMG html item
+ in a single function call. Not OOP style, just a quick utilty
function. ALL params must be passed in this function call.
+ @example $my_img = widgets->img_maketag("poweredby.png",
"powered by RedHat", "", "", "0");
+ @access public
+ */
+ function
img_maketag($location='',$alt='',$height='',$width='',$border='')
+ {
+ $alt_default_txt = 'image';
+ $alt_unknown_txt = 'unknown';
+ if ($location == '')
+ {
+ return '<img src=""
alt="['.$alt_unknown_txt.']">';
+ }
+ if ($alt != '')
+ {
+ $alt_tag = ' alt="['.$alt.']"';
+ $title_tag = ' title="'.$alt.'"';
+ }
+ else
+ {
+ $alt_tag = ' alt="['.$alt_default_txt.']"';
+ $title_tag = '';
+ }
+ if ($height != '')
+ {
+ $height_tag = ' height="' .$height .'"';
+ }
+ else
+ {
+ $height_tag = '';
+ }
+ if ($width != '')
+ {
+ $width_tag = ' width="' .$width .'"';
+ }
+ else
+ {
+ $width_tag = '';
+ }
+ if ($border != '')
+ {
+ $border_tag = ' border="' .$border .'"';
+ }
+ else
+ {
+ $border_tag = '';
+ }
+ $image_html = '<img src="'.$location.'"' .$height_tag
.$width_tag .$border_tag .$title_tag .$alt_tag .'>';
+ return $image_html;
+ }
+
+
/**************************************************************************\
+ * COMBOBOX WIDGET
+
\**************************************************************************/
+
+ /*!
+ @capability COMBOBOX WIDGET
+ @discussion generate a combo box html widget.
+ @author Angles
+ @example
+ $this->widgets->new_combobox();
+ $this->widgets->set_cbox_name("user_choice");
+ $this->widgets->set_cbox_item("yes"', "Customer is Right");
+ $this->widgets->set_cbox_item("no"', "Customer is Wrong");
+ $my_combobox_wirget = $this->widgets->get_combobox();
+ */
+ // combo box OOP access functions
+ /*!
+ @function set_cbox_name
+ @abstract ?
+ */
+ function set_cbox_name($str='')
+ {
+ if ($str == '')
+ {
+ $this->cbox_name = 'not_provided';
+ }
+ else
+ {
+ $this->cbox_name = $str;
+ }
+ }
+ /*!
+ @function get_cbox_name
+ @abstract ?
+ */
+ function get_cbox_name()
+ {
+ return $this->cbox_name;
+ }
+
+ /*!
+ @function set_cbox_onChange
+ @abstract ?
+ */
+ function set_cbox_onChange($str='')
+ {
+ if ($str != '')
+ {
+ $this->cbox_onChange = $str;
+ }
+ }
+ /*!
+ @function get_cbox_onChange
+ @abstract ?
+ */
+ function get_cbox_onChange()
+ {
+ return $this->cbox_onChange;
+ }
+
+ /*!
+ @function set_cbox_item
+ @abstract ?
+ */
+ function set_cbox_item($value='',$text='',$selected=False)
+ {
+ // make sure $selected is boolean
+ if (!is_bool($selected))
+ {
+ // replace param with a default boolean value
of False
+ $selected = False;
+ }
+ // I've actually seen bomboboxes with an item (usually
the first) with no name
+ if (($value != '') || ($text != ''))
+ {
+ $item_idx = count($this->cbox_items);
+ $this->cbox_items[$item_idx] = new html_option;
+ $this->cbox_items[$item_idx]->value = $value;
+ $this->cbox_items[$item_idx]->text = $text;
+ $this->cbox_items[$item_idx]->selected =
$selected;
+ }
+ }
+ /*!
+ @function set_cbox_item_spellcheck
+ @abstract makes a special kind of combobox select item for use
with spellcheck
+ @param $this_bad_word_element (class "correction_info"
structued data from file class.spell_struct)
+ @param $suggestion_num (int OR empty string) see discussion
below.
+ @author Angles
+ @discussion This function makes use of structure
"correction_info" which we expose
+ by including file class.spell_struct in the constructor for
this class. The combobox select item this
+ function makes embeds array data in the items "value" by
setting it to a string that
+ resembles a URL get request, which we then can recover this
array by applying php function
+ parse_str to the value when the user submits the form. The idea
is to provide enough data
+ in the value that the spellcheck replacement code can
accurately find and replace the desired
+ word, or not change the word at all if special suggestion
string "K_E_E_P" is present.
+ The first suggestion should be en empty string with special
value "K_E_E_P"
+ which means no change to the misspelled word, this is indicated
by passing an empty string
+ for param $suggestion_num.
+ The value for the suggestion item is a URL type string that
contains as much informaion
+ as we can preserve from the $this_bad_word_element object
param, but specifying the individual
+ suggestion provieded by the $suggestion_num arg which is the
index to this particular
+ suggestion in the $this_bad_word_element->suggestions[]
numbered array of suggestions.
+ Upon submit, we can apply php function parse_str() to this uri
to recover the desired array structure.
+ Parse_str will even urldecode the items for us.
+ */
+ function set_cbox_item_spellcheck($this_bad_word_element='',
$suggestion_num='')
+ {
+ // we included the spell_struct file above, so this
object knows what
+ // correction_info struct is
+ if (is_object($this_bad_word_element))
+ {
+ if ((string)$suggestion_num != '')
+ {
+ $suggestion_txt =
$this_bad_word_element->suggestions[(int)$suggestion_num];
+ $suggestion_value =
$this_bad_word_element->suggestions[(int)$suggestion_num];
+ }
+ else
+ {
+ // the first suggestion should be en
empty string with special value "K_E_E_P"
+ // which means no change to the
misspelled word
+ // this is indicated by passing an
empty string for $suggestion_num
+ $suggestion_txt = '';
+ $suggestion_value = 'K_E_E_P';
+ }
+ // the value for the suggestion item is a URL
type string that contains as much informaion
+ // as we can preserve from the
$this_bad_word_element object, but specifying the individual
+ // suggection provieded by the $suggestion_num
arg which is the index to this particular
+ // suggestion in the
$this_bad_word_element->suggestions[] numbered array of suggestions
+ // upon submit, we can apply php function
parse_str() to this uri to recover the desired array structure.
+ // parse_str will even urldecode the items for
us.
+ /*
+ $uri_value =
+
'cbox[orig_word]='.urlencode($this_bad_word_element->orig_word)
+
.'&cbox[orig_word_clean]='.urlencode($this_bad_word_element->orig_word_clean)
+
.'&cbox[line_num]='.urlencode($this_bad_word_element->line_num)
+
.'&cbox[word_num]='.urlencode($this_bad_word_element->word_num)
+
.'&cbox[suggestion_value]='.urlencode($suggestion_value);
+ */
+ $uri_value =
+
'orig_word='.urlencode($this_bad_word_element->orig_word)
+
.'&orig_word_clean='.urlencode($this_bad_word_element->orig_word_clean)
+
.'&line_num='.urlencode($this_bad_word_element->line_num)
+
.'&word_num='.urlencode($this_bad_word_element->word_num)
+
.'&suggestion_value='.urlencode($suggestion_value);
+
+ $item_idx = count($this->cbox_items);
+ $this->cbox_items[$item_idx] = new html_option;
+ $this->cbox_items[$item_idx]->value =
$uri_value;
+ $this->cbox_items[$item_idx]->text =
$suggestion_txt;
+ }
+ }
+ /*!
+ @function get_cbox_item
+ @abstract ?
+ */
+ function get_cbox_item($idx='')
+ {
+ if ((string)$idx == '')
+ {
+ return $this->cbox_items;
+ }
+ else
+ {
+ return $this->cbox_items[$idx];
+ }
+ }
+
+ /*!
+ @function new_combobox
+ @abstract ALWAYS start a new combobox widget by calling this
function first. Clears all combobox
+ properties.
+ */
+ function new_combobox()
+ {
+ $this->cbox_name='not_provided';
+ $this->cbox_onChange='';
+ $this->cbox_items=array();
+ $this->combobox='';
+ }
+
+ /*!
+ @function get_combobox
+ @abstract generate and return a HTML select (combobo) widget
using the values you set in
+ the "set_cbox_" functions.
+ @author Angles
+ @discussion this function does not clear its properties, so if
for some reason you want THE SAME
+ comboboxes more then one time, calling "get_combobox" will
return the same combobox until you
+ clear it by calling "new_combobox", which you should ALWAYS do
when starting a new combobox
+ widget. VALUES ARE NOT URLENCODED, except that the special
spellcheck item stuff
+ does it, but before this function, and this does not happen for
the normal set cbox item. It IS
+ html specialchars encoded here.
+ @access public
+ */
+ function get_combobox()
+ {
+ if ($this->cbox_onChange != '')
+ {
+ $onChange_tag = '
onChange="'.$this->cbox_onChange.'"';
+ }
+ else
+ {
+ $onChange_tag = '';
+ }
+ $this->combobox = '<select
name="'.$this->cbox_name.'"'.$onChange_tag.'>';
+ $loops = count($this->cbox_items);
+ if ($loops > 0)
+ {
+ for ($i=0; $i < $loops; $i++)
+ {
+ if ($this->cbox_items[$i]->selected ==
True)
+ {
+ $selected_tag = ' selected';
+ }
+ else
+ {
+ $selected_tag = '';
+ }
+ $this->combobox .=
+ '<option
value="'.$this->cbox_items[$i]->value.'"'.$selected_tag.'>'
+
.htmlspecialchars($this->cbox_items[$i]->text)
+ .'</option>';
+ $this->combobox .= "\r\n";
+ }
+ }
+ $this->combobox .= '</select>';
+ return $this->combobox;
+ }
+ // <select name="filter" onChange="this.form.submit();"><option
value="all">show all</option>
+ // <option value="public">only yours</option>
+ // <option value="private">Private</option>
+ // </select>
+
+
/**************************************************************************\
+ * FORM WIDGET
+
\**************************************************************************/
+
+ /*!
+ @capability FORM WIDGET
+ @discussion generate a opening tag of a form including name,
action, method, and hiddenvars
+ @author Angles
+ @example
+ $this->widgets->new_form();
+ $this->widgets->set_form_name('spell_review');
+ $this->widgets->set_form_method('POST');
+ $this->widgets->set_form_action('index.php?email.targets.move');
+ $this->widgets->set_form_hiddenvar('subject', 'stock');
+ $this->widgets->set_form_hiddenvar('symbol', 'GM');
+ // OPTIONAL if you have set "preserve_vars" you can include
them as hidden vars with this command
+ $this->commit_preserve_vars_to_form();
+ $my_form_tag = $this->widgets->get_form();
+ */
+ function new_form()
+ {
+ $this->form_name='not_provided';
+ $this->form_action='';
+ $this->form_method='POST';
+ $this->form_hiddenvars=array();
+ $this->form = '';
+ }
+
+ /*!
+ @function set_form_name
+ @abstract ?
+ */
+ function set_form_name($str='')
+ {
+ if ($str != '')
+ {
+ $this->form_name = $str;
+ }
+ }
+ /*!
+ @function get_form_name
+ @abstract ?
+ */
+ function get_form_name()
+ {
+ return $this->form_name;
+ }
+
+ /*!
+ @function set_form_action
+ @abstract ?
+ */
+ function set_form_action($str='')
+ {
+ if ($str != '')
+ {
+ $this->form_action = $str;
+ }
+ }
+ /*!
+ @function
+ @abstract ? get_form_action
+ */
+ function get_form_action()
+ {
+ return $this->form_action;
+ }
+
+ /*!
+ @function set_form_method
+ @abstract ?
+ */
+ function set_form_method($str='')
+ {
+ if ($str != '')
+ {
+ $this->form_method = $str;
+ }
+ }
+ /*!
+ @function get_form_method
+ @abstract ?
+ */
+ function get_form_method()
+ {
+ return $this->form_method;
+ }
+
+ /*!
+ @function set_form_hiddenvar
+ @abstract put hidden vars in a form tag.
+ @param $name the "key" in the GPC key - value pair
+ @param $value the "value" in the GPC key - value pair
+ @param $do_urlencode (boolean) OPTIONAL default is True,
whether or not to urlencode the name and value params.
+ @author Angles
+ @access public
+ */
+ function set_form_hiddenvar($name='',$value='',
$do_urlencode=True)
+ {
+ // I've actually seen bomboboxes with an item (usually
the first) with no name
+ if (($name != '') || ($value != ''))
+ {
+ if ($do_urlencode == True)
+ {
+ $name = urlencode($name);
+ $value = urlencode($value);
+ }
+ $item_idx = count($this->form_hiddenvars);
+ $this->form_hiddenvars[$item_idx] = new
hiddenvar_option;
+ $this->form_hiddenvars[$item_idx]->name = $name;
+ $this->form_hiddenvars[$item_idx]->value =
$value;
+ }
+ }
+ /*!
+ @function get_form_hiddenvar
+ @abstract ?
+ */
+ function get_form_hiddenvar($idx='')
+ {
+ if ((string)$idx == '')
+ {
+ return $this->form_hiddenvars;
+ }
+ else
+ {
+ return $this->form_hiddenvars[$idx];
+ }
+ }
+
+ // <form enctype="multipart/form-data" name="spell_review"
action="/mail/index.php?menuaction=email.bosend.sendorspell&fldball[folder]=INBOX&fldball[acctnum]=3&sort=1&order=1&start=0"
method="POST">
+ //<input type="hidden" name="sort" value="1">
+ //<input type="hidden" name="order" value="1">
+ //<input type="hidden" name="start" value="0">
+ //<input type="hidden" name="force_showsize" value="1">
+ /*!
+ @function get_form
+ @abstract generate and return an opening FORM tag using the
data you set in the "set_form_" functions.
+ @author Angles
+ @discussion Any hiddenvars will be urlencoded. NOTE YOU MUST
PUT THE CLOSING </form> somewhere
+ after this form tag. This functions generates the opening tag
of the form, which is where all the complicated stuff
+ is. The ending tag is a normal html markup closing tag you must
supply. NOTE on form enctype, HTML 401 says
+ "multipart/form-data" is very strict to MIME rfc2045-49 and
will add hard wrap CRLF to each line of text
+ in any control. For example, a TEXTAREA input control will hard
wrap at whatever its column length is,
+ because it represents the end of a line of text, eventhough the
user did not explicitly press return, and therefor
+ it should be a soft return, not a CRLF. On the other hand,
"application/x-www-form-urlencoded" is the default
+ value and is assumed if not provided, and is the kind of submit
we are more used to. NOTE "multipart/form-data"
+ is also designed to handle large amounts of text or binary
data, so "multipart/form-data" is used with file upload
+ forms, which means "multipart/form-data" WILL NOT WORK if the
php.ini file does not allow "FILE UPLOADS".
+ This can be a confusing issue because we are not submitting a
file upload, just some text, but the
+ "multipart/form-data" is used for file upload forms, hence the
association. UPDATE testing shows this
+ may not be true eventhough HTML v401 says so. In a TEXTAREA
control, using wrap="hard" yields the
+ CRLF hard wrap regardless of the enctype, and without the
wrap="hard" there is no CRLF line ends to soft
+ wraps, eventhough there should be with "multipart/form-data"
forms.
+ @access prublic
+ */
+ function get_form()
+ {
+ $this->form =
+ // '<form enctype="multipart/form-data" '
+ '<form
enctype="application/x-www-form-urlencoded" '
+ .'name="'.$this->form_name.'" '
+ .'action="'.$this->form_action.'" '
+ .'method="'.$this->form_method.'">'
+ ."\r\n";
+
+ $loops = count($this->form_hiddenvars);
+ if ($loops > 0)
+ {
+ for ($i=0; $i < $loops; $i++)
+ {
+ $this->form .=
+ '<input type="hidden" '
+
.'name="'.$this->form_hiddenvars[$i]->name.'" '
+
.'value="'.$this->form_hiddenvars[$i]->value.'">';
+ // just to be safe, send a line break
after every one of these
+ $this->form .= "\r\n";
+ }
+ }
+ return $this->form;
+ }
+
+ /*!
+ @function form_closetag
+ @abstract SIMPLE - returns the closing tag for a form
</form>
+ @author Angles
+ @discussion This seems dumb at first, but take the folders
combobox as an example,
+ when the user selects a folder from the combbox the OnChange
submits the form associated
+ with that combobox, i.e. the form OnChange and the form name
should be the same name and
+ the form age should surround the combobox, I think, Anyway,
IMAP servers have folders but
+ POP servers do now, so we will not show said folder combobox if
viewing a POP3 mail server.
+ Therefor, in our template we put a non-breaking-space in the
place of the combobox html.
+ BUT what about that those form tage that surround this
combobox, we should leave them out
+ too. In typical templaying this is ease to replace the form
opening tag with a non-breaking-space.
+ BUT the closing tag is such a simple thing we often hard code
it into the template, not a template
+ var. SO we can not leave out the form open tag but have the
form close tag still be in the template.
+ This no-brainer function just makes it easy to remember to
leave out or include, as the case may
+ be, the form closeing tag.
+ @access public
+ */
+ function form_closetag()
+ {
+ return '</form>';
+ }
+
+
/**************************************************************************\
+ * BUTTON WIDGET
+
\**************************************************************************/
+
+ /*!
+ @function make_button
+ @abstract generate a button in a SINGLE FUNCTION CALL, all
params must be passed.
+ @author Angles
+ @param $type (string) usually "SUBMIT"
+ @param $name (string) they GPC "key" in the "key - value" pair
+ @param $value (string) they GPC "value" in the "key - value"
pair AND THE TEXT on the button
+ @param $onClick (string) OPTIONAL usually some javascript for
the onclick event of the button. Default is none
+ @discussion Since a button is generally considered a "widget",
I will call this a widget although it does
+ not use "set_" property functions the other widgets do. All
params must be passed in the function call.
+ @access public
+ @example $my_button = $this->widgets->make_button('submit',
'btn_send', lang('Send'));
+ */
+ //<input type="submit" name="btn_send" value="Send">
+ function make_button($type='', $name='',$value='', $onClick='')
+ {
+ if ($type == '')
+ {
+ $type='submit';
+ }
+ if ($name == '')
+ {
+ $name=$type.'_button';
+ }
+ if ($value == '')
+ {
+ $value=lang('submit');
+ }
+ if ($onClick == '')
+ {
+ $onClick_tag = '';
+ }
+ else
+ {
+ $onClick_tag = ' onClick="'.$onClick.'"';;
+ }
+
+ $button = '<input type="'.$type.'" name="'.$name.'"
value="'.$value.'"'.$onClick_tag.'>';
+ return $button;
+ }
- // if calling from home page it is optional to force currentapp
as a constructor param
- var $my_currentapp='';
- // bootstraper for the msg class
- var $msg_bootstrap;
- // private template to var names do not collide
- var $tpl;
-
- // A HREF OOP properties
- var $href_link='';
- var $href_target='';
- var $href_clickme='not_provided';
- var $href='';
-
- // combo box OOP properties
- var $cbox_name='not_provided';
- var $cbox_onChange='';
- var $cbox_items=array();
- var $combobox='';
-
- // form OOP properties
- var $form_name='';
- var $form_action='';
- var $form_method='';
- var $form_hiddenvars=array();
- var $form='';
-
- // TOOLBAR
- var $toolbar_msg='';
- var $toolbar_row_one='';
- var $toolbar_row_two='';
- var $toolbar='';
-
- // ALL FOLDERS ALL ACCOUNTS MEGA LISTBOX
- var $F_megalist_form_reference='';
- var $F_megalist_widget_name='';
- var $F_megalist_preselected_fldball='';
- var $F_megalist_skip_fldball='';
- var $F_megalist_first_item_text = '';
-
- // RELOAD WIDGET
- var $refresh_js='';
+
/**************************************************************************\
+ * TOOLBAR COMPOUND WIDGET
+
\**************************************************************************/
- // GENERIC ERROR REPORT
- var $F_mindless_default_txt = 'error text not provided';
- var $F_error_report_text='';
- var $F_go_somewhere_link='';
- var $F_go_home_link='';
-
-
-
/**************************************************************************\
- * CONSTRUCTOR
-
\**************************************************************************/
- function html_widgets()
- {
- if ($this->debug_init > 0) { echo 'ENTER:
email.html_widgets.CONSTRUCTOR'.'<br>'."\r\n"; }
- /*!
- @class requires including spell_struct header file
- @discussion class html_widgets needs the special
C-Style Include .h like file,
- class.spell_struct which holds data structure class
correction_info used here for integration
- with the mail.spell spellchecking class.
- */
- $required_class = 'spell_struct';
+ /*!
+ @capability TOOLBAR COMPOUND WIDGET
+ @discussion generate a toolbar for use in email pages NOTE:
usually only one toolbar made per page view
+ so there is no "new_toolbar" function because we should not
need it. set_toolbar_msg is the only value
+ that you might want to check if you make more then one toolbar.
+ @author Angles
+ */
+
+ /*!
+ @function set_toolbar_msg
+ @abstract the toolbar has a 3rd row which can display text to
the user. This function sets that.
+ @param $msg (string)
+ @author Angles
+ @discussion Usually after deleting or moving messages or
creating, renaming, or deleting folders,
+ the mail_msg generates some kind of message to report to the
user what actions were just taken.
+ Note a blank string will clear a msg if needed. Currently only
the uiindex page and the uifolder page
+ might provide a msg.
+ @access public
+ */
+ function set_toolbar_msg($msg='')
+ {
+ $this->toolbar_msg = $msg;
+ }
+ /*!
+ @function get_toolbar_msg
+ @abstract get whatever value the toolbar_msg property has.
+ @author Angles
+ @access public
+ */
+ function get_toolbar_msg()
+ {
+ return $this->toolbar_msg;
+ }
+
+ /*!
+ @function get_toolbar
+ @abstract this function returns a complete html toolbar widget
that is on top of many email pages.
+ @author Angles
+ @discussion generate a toolbar for use in email pages NOTE:
+ WE NEED globals[phpge]->msg OBJECT and A LOGIN in order to make
this toolbar,
+ THEREFOR do not put this toolbar on a page where login may not
be available.Currently,
+ Preferencs pages DO NOT LOGIN, because if you are setting
preferences you do not need
+ a mailserver stream AND you may not even have enough data set
to get a mailserver stream.
+ Note: uses a private template object to assemple the toolbar,
calling function is responsible for
+ putting the result in the global template.
+ @access public
+ */
+ function get_toolbar()
+ {
+ // WE NEED ->msg OBJECT and A LOGIN in order to make
this toolbar
+ $this->msg_bootstrap =
CreateObject("email.msg_bootstrap");
+
$this->msg_bootstrap->ensure_mail_msg_exists('emai.html_widgets.get_toolbar',
0);
- // if calling this class from the home page, then the
currentapp will be
- //set to "home" instead of "email", which messes up the
include statement below,
- // so set a local var to "email" to force considering
the currentapp to be "email".
- $this->my_currentapp = 'email';
-
//require_once(PHPGW_INCLUDE_ROOT.'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/inc/class.'.$required_class.'.inc.php');
-
require_once(PHPGW_INCLUDE_ROOT.'/'.$this->my_currentapp.'/inc/class.'.$required_class.'.inc.php');
+ // we use a PRIVATE template object to produce this
toolbar
+ $this->tpl =
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
- if ($this->debug_init > 0) { echo 'EXIT:
email.html_widgets.CONSTRUCTOR'.'<br>'."\r\n"; }
- return;
- }
-
-
-
/**************************************************************************\
- * HREF LINK WIDGET
-
\**************************************************************************/
-
- /*!
- @capability HREF LINK WIDGET
- @discussion generate an a href item, includes link, target,
text. CLEARS ITSELF after each "get_href"
- @author Angles
- @example $this->widgets->set_href_link('index.php');
- $this->widgets->set_href_target('top');
- $this->widgets->get_href_clickme(lang('click here for more info
in a new window'));
- $my_href_tag = $this->widgets->get_href();
- */
- /*!
- @function clear_href_vars
- @abstract after every call to "->get_href" all internal vars
are cleared automatically with this function.
- @author Angles
- @discussion href class vars for link, target, text. CLEARS
ITSELF after each "get_href". This utilty
- function does that. It is RARE that you would ever need to call
this directly.
- @access private
- */
- function clear_href_vars()
- {
- $this->set_href_link('');
- $this->set_href_target('');
- $this->set_href_clickme('');
- }
-
- /*!
- @function set_href_link
- @abstract set the URL link of this this HREF widget
- @param $href_link (string)
- @author Angles
- @access public
- */
- function set_href_link($href_link='')
- {
- $this->href_link = $href_link;
- }
- /*!
- @function get_href_link
- @abstract used check or verify the value if the "href_link"
property
- @author Angles
- @access public
- */
- function get_href_link()
- {
- return $this->href_link;
- }
-
- /*!
- @function set_href_target
- @abstract OPTIONAL set the "target", i.e. what browser window
this HREF should apply to,
- default is not to specify any target in the HREF tag.
- @param $href_target (string)
- @author Angles
- @access public
- */
- function set_href_target($href_target='')
- {
- $this->href_target = $href_target;
- }
- /*!
- @function get_href_target
- @abstract used check or verify the value if the "href_target"
property
- @author Angles
- @access public
- */
- function get_href_target()
- {
- return $this->href_target;
- }
-
- /*!
- @function set_href_clickme
- @abstract what the user needs to click on to activate the HREF
link, can be text or a COMPLETE img tag.
- @param $href_clickme (string) text or a COMPLETE img tag
- @author Angles
- @access public
- */
- function set_href_clickme($href_clickme='')
- {
- $this->href_clickme = $href_clickme;
- }
- /*!
- @function get_href_clickme
- @abstract used check or verify the value if the "href_clickme"
property
- @author Angles
- @access public
- */
- function get_href_clickme()
- {
- return $this->href_clickme;
- }
-
- /*!
- @function get_href
- @abstract generate and return an HREF tag using information you
set in the OOP "set_href_" functions
- @author Angles
- @result (string) a complete HREF tag generated from data you
set in the "set_href_" functions,
- @discussion After you set "href_target", "href_clickme" and
other optional properties ("href_target") this
- function generates an HREF tag from that data and returns it.
NOTE after generating the HREF tag, and
- before returning it, this function CLEARS ALL PROPERTIES that
it used to make that href tag, so this
- "widget" automatically is ready to new usage without having to
explicitly call any "new" or "clear" function.
- @access public
- */
- function get_href()
- {
- if ($this->href_target != '')
- {
- $target = ' target="'.$this->href_target.'"';
- }
- // put the href return value in storage so we can clear
all href internal vars before we exit this function with a return.
- $href = '<a href="' .$this->href_link .'"'.$target.'>'
.$this->href_clickme .'</a>' ."\r\n";
- // this widget clears itself automatically after every
call to this function.
- $this->clear_href_vars();
- return $href;
- }
-
-
/**************************************************************************\
- * QUICK HREF TAG - depreciated
-
\**************************************************************************/
- /*!
- @function href_maketag (not related to the HREF widget)
- @abstract QUICK way to generate a typical A HREF html item in a
single function call. NOT PART OF
- THE HREF WIDGET, not OOP style, just a quick utilty function.
ALL params must be passed in this function call.
- @param $href_link (string) URL for this HREF tag
- @param $href_text (string) what the user clicks on to activate
this HREF tag, can be text OR a COMPLETE IMG tag.
- @param $target (string) OPTIONAL target for the link, such as
when using frames or opening a new browser window.
- @author Angles
- @discussion not really a widget, does not use OOP style, but it
gets the job done quickly. Somewhat Depreciated,
- use the OOP style href widget instead.
- @example this->href_maketag("index.jsp", "click here for home
page", "new");
- @access public
- */
- function href_maketag($href_link='',$href_text='default
text',$target='')
- {
- if ($target != '')
- {
- $target = ' target="'.$target.'"';
- }
- return '<a href="' .$href_link .'"'.$target.'>'
.$href_text .'</a>' ."\r\n";
- }
-
-
/**************************************************************************\
- * QUICK IMG TAG
-
\**************************************************************************/
- /*!
- @function img_maketag
- @abstract quick and dirty to make an IMG html tag in one
function call.
- @author Angles
- @param $location (string int) URL to the image, cal be
releative or fully qualified
- @param $alt (string) text displayed (a) in place of the image
if not displayed, and (b) as a image tooltip on some browsers
- @param $height (string int) int passed as a string, OPTIONAL,
not included in img tag if not provided
- @param $width (string int) int passed as a string OPTIONAL,
not included in img tag if not provided
- @param $border (string int) int passed as string OPTIONAL , not
included in img tag if not provided ,
- the size of the border around the image, often set to "0"
- @discussion not really a widget but it gets the job done. QUICK
way to generate a typical A IMG html item
- in a single function call. Not OOP style, just a quick utilty
function. ALL params must be passed in this function call.
- @example $my_img = widgets->img_maketag("poweredby.png",
"powered by RedHat", "", "", "0");
- @access public
- */
- function
img_maketag($location='',$alt='',$height='',$width='',$border='')
- {
- $alt_default_txt = 'image';
- $alt_unknown_txt = 'unknown';
- if ($location == '')
- {
- return '<img src=""
alt="['.$alt_unknown_txt.']">';
- }
- if ($alt != '')
- {
- $alt_tag = ' alt="['.$alt.']"';
- }
- else
- {
- $alt_tag = ' alt="['.$alt_default_txt.']"';
- }
- if ($height != '')
- {
- $height_tag = ' height="' .$height .'"';
- }
- else
- {
- $height_tag = '';
- }
- if ($width != '')
- {
- $width_tag = ' width="' .$width .'"';
- }
- else
- {
- $width_tag = '';
- }
- if ($border != '')
- {
- $border_tag = ' border="' .$border .'"';
- }
- else
- {
- $border_tag = '';
- }
- $image_html = '<img src="'.$location.'"' .$height_tag
.$width_tag .$border_tag .$alt_tag .'>';
- return $image_html;
- }
-
-
/**************************************************************************\
- * COMBOBOX WIDGET
-
\**************************************************************************/
-
- /*!
- @capability COMBOBOX WIDGET
- @discussion generate a combo box html widget.
- @author Angles
- @example
- $this->widgets->new_combobox();
- $this->widgets->set_cbox_name("user_choice");
- $this->widgets->set_cbox_item("yes"', "Customer is Right");
- $this->widgets->set_cbox_item("no"', "Customer is Wrong");
- $my_combobox_wirget = $this->widgets->get_combobox();
- */
- // combo box OOP access functions
- /*!
- @function set_cbox_name
- @abstract ?
- */
- function set_cbox_name($str='')
- {
- if ($str == '')
- {
- $this->cbox_name = 'not_provided';
- }
- else
- {
- $this->cbox_name = $str;
- }
- }
- /*!
- @function get_cbox_name
- @abstract ?
- */
- function get_cbox_name()
- {
- return $this->cbox_name;
- }
-
- /*!
- @function set_cbox_onChange
- @abstract ?
- */
- function set_cbox_onChange($str='')
- {
- if ($str != '')
- {
- $this->cbox_onChange = $str;
- }
- }
- /*!
- @function get_cbox_onChange
- @abstract ?
- */
- function get_cbox_onChange()
- {
- return $this->cbox_onChange;
- }
-
- /*!
- @function set_cbox_item
- @abstract ?
- */
- function set_cbox_item($value='',$text='',$selected=False)
- {
- // make sure $selected is boolean
- if (!is_bool($selected))
- {
- // replace param with a default boolean value
of False
- $selected = False;
- }
- // I've actually seen bomboboxes with an item (usually
the first) with no name
- if (($value != '') || ($text != ''))
- {
- $item_idx = count($this->cbox_items);
- $this->cbox_items[$item_idx] = new html_option;
- $this->cbox_items[$item_idx]->value = $value;
- $this->cbox_items[$item_idx]->text = $text;
- $this->cbox_items[$item_idx]->selected =
$selected;
- }
- }
- /*!
- @function set_cbox_item_spellcheck
- @abstract makes a special kind of combobox select item for use
with spellcheck
- @param $this_bad_word_element (class "correction_info"
structued data from file class.spell_struct)
- @param $suggestion_num (int OR empty string) see discussion
below.
- @author Angles
- @discussion This function makes use of structure
"correction_info" which we expose
- by including file class.spell_struct in the constructor for
this class. The combobox select item this
- function makes embeds array data in the items "value" by
setting it to a string that
- resembles a URL get request, which we then can recover this
array by applying php function
- parse_str to the value when the user submits the form. The idea
is to provide enough data
- in the value that the spellcheck replacement code can
accurately find and replace the desired
- word, or not change the word at all if special suggestion
string "K_E_E_P" is present.
- The first suggestion should be en empty string with special
value "K_E_E_P"
- which means no change to the misspelled word, this is indicated
by passing an empty string
- for param $suggestion_num.
- The value for the suggestion item is a URL type string that
contains as much informaion
- as we can preserve from the $this_bad_word_element object
param, but specifying the individual
- suggestion provieded by the $suggestion_num arg which is the
index to this particular
- suggestion in the $this_bad_word_element->suggestions[]
numbered array of suggestions.
- Upon submit, we can apply php function parse_str() to this uri
to recover the desired array structure.
- Parse_str will even urldecode the items for us.
- */
- function set_cbox_item_spellcheck($this_bad_word_element='',
$suggestion_num='')
- {
- // we included the spell_struct file above, so this
object knows what
- // correction_info struct is
- if (is_object($this_bad_word_element))
- {
- if ((string)$suggestion_num != '')
- {
- $suggestion_txt =
$this_bad_word_element->suggestions[(int)$suggestion_num];
- $suggestion_value =
$this_bad_word_element->suggestions[(int)$suggestion_num];
- }
- else
- {
- // the first suggestion should be en
empty string with special value "K_E_E_P"
- // which means no change to the
misspelled word
- // this is indicated by passing an
empty string for $suggestion_num
- $suggestion_txt = '';
- $suggestion_value = 'K_E_E_P';
- }
- // the value for the suggestion item is a URL
type string that contains as much informaion
- // as we can preserve from the
$this_bad_word_element object, but specifying the individual
- // suggection provieded by the $suggestion_num
arg which is the index to this particular
- // suggestion in the
$this_bad_word_element->suggestions[] numbered array of suggestions
- // upon submit, we can apply php function
parse_str() to this uri to recover the desired array structure.
- // parse_str will even urldecode the items for
us.
- /*
- $uri_value =
-
'cbox[orig_word]='.urlencode($this_bad_word_element->orig_word)
-
.'&cbox[orig_word_clean]='.urlencode($this_bad_word_element->orig_word_clean)
-
.'&cbox[line_num]='.urlencode($this_bad_word_element->line_num)
-
.'&cbox[word_num]='.urlencode($this_bad_word_element->word_num)
-
.'&cbox[suggestion_value]='.urlencode($suggestion_value);
- */
- $uri_value =
-
'orig_word='.urlencode($this_bad_word_element->orig_word)
-
.'&orig_word_clean='.urlencode($this_bad_word_element->orig_word_clean)
-
.'&line_num='.urlencode($this_bad_word_element->line_num)
-
.'&word_num='.urlencode($this_bad_word_element->word_num)
-
.'&suggestion_value='.urlencode($suggestion_value);
-
- $item_idx = count($this->cbox_items);
- $this->cbox_items[$item_idx] = new html_option;
- $this->cbox_items[$item_idx]->value =
$uri_value;
- $this->cbox_items[$item_idx]->text =
$suggestion_txt;
- }
- }
- /*!
- @function get_cbox_item
- @abstract ?
- */
- function get_cbox_item($idx='')
- {
- if ((string)$idx == '')
- {
- return $this->cbox_items;
- }
- else
- {
- return $this->cbox_items[$idx];
- }
- }
-
- /*!
- @function new_combobox
- @abstract ALWAYS start a new combobox widget by calling this
function first. Clears all combobox
- properties.
- */
- function new_combobox()
- {
- $this->cbox_name='not_provided';
- $this->cbox_onChange='';
- $this->cbox_items=array();
- $this->combobox='';
- }
-
- /*!
- @function get_combobox
- @abstract generate and return a HTML select (combobo) widget
using the values you set in
- the "set_cbox_" functions.
- @author Angles
- @discussion this function does not clear its properties, so if
for some reason you want THE SAME
- comboboxes more then one time, calling "get_combobox" will
return the same combobox until you
- clear it by calling "new_combobox", which you should ALWAYS do
when starting a new combobox
- widget. VALUES ARE NOT URLENCODED, except that the special
spellcheck item stuff
- does it, but before this function, and this does not happen for
the normal set cbox item. It IS
- html specialchars encoded here.
- @access public
- */
- function get_combobox()
- {
- if ($this->cbox_onChange != '')
- {
- $onChange_tag = '
onChange="'.$this->cbox_onChange.'"';
- }
- else
- {
- $onChange_tag = '';
- }
- $this->combobox = '<select
name="'.$this->cbox_name.'"'.$onChange_tag.'>';
- $loops = count($this->cbox_items);
- if ($loops > 0)
- {
- for ($i=0; $i < $loops; $i++)
- {
- if ($this->cbox_items[$i]->selected ==
True)
- {
- $selected_tag = ' selected';
- }
- else
- {
- $selected_tag = '';
- }
- $this->combobox .=
- '<option
value="'.$this->cbox_items[$i]->value.'"'.$selected_tag.'>'
-
.htmlspecialchars($this->cbox_items[$i]->text)
- .'</option>';
- $this->combobox .= "\r\n";
- }
- }
- $this->combobox .= '</select>';
- return $this->combobox;
- }
- // <select name="filter" onChange="this.form.submit();"><option
value="all">show all</option>
- // <option value="public">only yours</option>
- // <option value="private">Private</option>
- // </select>
-
-
/**************************************************************************\
- * FORM WIDGET
-
\**************************************************************************/
-
- /*!
- @capability FORM WIDGET
- @discussion generate a opening tag of a form including name,
action, method, and hiddenvars
- @author Angles
- @example
- $this->widgets->new_form();
- $this->widgets->set_form_name('spell_review');
- $this->widgets->set_form_method('POST');
- $this->widgets->set_form_action('index.php?email.targets.move');
- $this->widgets->set_form_hiddenvar('subject', 'stock');
- $this->widgets->set_form_hiddenvar('symbol', 'GM');
- // OPTIONAL if you have set "preserve_vars" you can include
them as hidden vars with this command
- $this->commit_preserve_vars_to_form();
- $my_form_tag = $this->widgets->get_form();
- */
- function new_form()
- {
- $this->form_name='not_provided';
- $this->form_action='';
- $this->form_method='POST';
- $this->form_hiddenvars=array();
- $this->form = '';
- }
-
- /*!
- @function set_form_name
- @abstract ?
- */
- function set_form_name($str='')
- {
- if ($str != '')
- {
- $this->form_name = $str;
- }
- }
- /*!
- @function get_form_name
- @abstract ?
- */
- function get_form_name()
- {
- return $this->form_name;
- }
-
- /*!
- @function set_form_action
- @abstract ?
- */
- function set_form_action($str='')
- {
- if ($str != '')
- {
- $this->form_action = $str;
- }
- }
- /*!
- @function
- @abstract ? get_form_action
- */
- function get_form_action()
- {
- return $this->form_action;
- }
-
- /*!
- @function set_form_method
- @abstract ?
- */
- function set_form_method($str='')
- {
- if ($str != '')
- {
- $this->form_method = $str;
- }
- }
- /*!
- @function get_form_method
- @abstract ?
- */
- function get_form_method()
- {
- return $this->form_method;
- }
-
- /*!
- @function set_form_hiddenvar
- @abstract put hidden vars in a form tag.
- @param $name the "key" in the GPC key - value pair
- @param $value the "value" in the GPC key - value pair
- @param $do_urlencode (boolean) OPTIONAL default is True,
whether or not to urlencode the name and value params.
- @author Angles
- @access public
- */
- function set_form_hiddenvar($name='',$value='',
$do_urlencode=True)
- {
- // I've actually seen bomboboxes with an item (usually
the first) with no name
- if (($name != '') || ($value != ''))
- {
- if ($do_urlencode == True)
- {
- $name = urlencode($name);
- $value = urlencode($value);
- }
- $item_idx = count($this->form_hiddenvars);
- $this->form_hiddenvars[$item_idx] = new
hiddenvar_option;
- $this->form_hiddenvars[$item_idx]->name = $name;
- $this->form_hiddenvars[$item_idx]->value =
$value;
- }
- }
- /*!
- @function get_form_hiddenvar
- @abstract ?
- */
- function get_form_hiddenvar($idx='')
- {
- if ((string)$idx == '')
- {
- return $this->form_hiddenvars;
- }
- else
- {
- return $this->form_hiddenvars[$idx];
- }
- }
-
- // <form enctype="multipart/form-data" name="spell_review"
action="/mail/index.php?menuaction=email.bosend.sendorspell&fldball[folder]=INBOX&fldball[acctnum]=3&sort=1&order=1&start=0"
method="POST">
- //<input type="hidden" name="sort" value="1">
- //<input type="hidden" name="order" value="1">
- //<input type="hidden" name="start" value="0">
- //<input type="hidden" name="force_showsize" value="1">
- /*!
- @function get_form
- @abstract generate and return an opening FORM tag using the
data you set in the "set_form_" functions.
- @author Angles
- @discussion Any hiddenvars will be urlencoded. NOTE YOU MUST
PUT THE CLOSING </form> somewhere
- after this form tag. This functions generates the opening tag
of the form, which is where all the complicated stuff
- is. The ending tag is a normal html markup closing tag you must
supply. NOTE on form enctype, HTML 401 says
- "multipart/form-data" is very strict to MIME rfc2045-49 and
will add hard wrap CRLF to each line of text
- in any control. For example, a TEXTAREA input control will hard
wrap at whatever its column length is,
- because it represents the end of a line of text, eventhough the
user did not explicitly press return, and therefor
- it should be a soft return, not a CRLF. On the other hand,
"application/x-www-form-urlencoded" is the default
- value and is assumed if not provided, and is the kind of submit
we are more used to. NOTE "multipart/form-data"
- is also designed to handle large amounts of text or binary
data, so "multipart/form-data" is used with file upload
- forms, which means "multipart/form-data" WILL NOT WORK if the
php.ini file does not allow "FILE UPLOADS".
- This can be a confusing issue because we are not submitting a
file upload, just some text, but the
- "multipart/form-data" is used for file upload forms, hence the
association. UPDATE testing shows this
- may not be true eventhough HTML v401 says so. In a TEXTAREA
control, using wrap="hard" yields the
- CRLF hard wrap regardless of the enctype, and without the
wrap="hard" there is no CRLF line ends to soft
- wraps, eventhough there should be with "multipart/form-data"
forms.
- @access prublic
- */
- function get_form()
- {
- $this->form =
- // '<form enctype="multipart/form-data" '
- '<form
enctype="application/x-www-form-urlencoded" '
- .'name="'.$this->form_name.'" '
- .'action="'.$this->form_action.'" '
- .'method="'.$this->form_method.'">'
- ."\r\n";
-
- $loops = count($this->form_hiddenvars);
- if ($loops > 0)
- {
- for ($i=0; $i < $loops; $i++)
- {
- $this->form .=
- '<input type="hidden" '
-
.'name="'.$this->form_hiddenvars[$i]->name.'" '
-
.'value="'.$this->form_hiddenvars[$i]->value.'">';
- // just to be safe, send a line break
after every one of these
- $this->form .= "\r\n";
- }
- }
- return $this->form;
- }
-
- /*!
- @function form_closetag
- @abstract SIMPLE - returns the closing tag for a form
</form>
- @author Angles
- @discussion This seems dumb at first, but take the folders
combobox as an example,
- when the user selects a folder from the combbox the OnChange
submits the form associated
- with that combobox, i.e. the form OnChange and the form name
should be the same name and
- the form age should surround the combobox, I think, Anyway,
IMAP servers have folders but
- POP servers do now, so we will not show said folder combobox if
viewing a POP3 mail server.
- Therefor, in our template we put a non-breaking-space in the
place of the combobox html.
- BUT what about that those form tage that surround this
combobox, we should leave them out
- too. In typical templaying this is ease to replace the form
opening tag with a non-breaking-space.
- BUT the closing tag is such a simple thing we often hard code
it into the template, not a template
- var. SO we can not leave out the form open tag but have the
form close tag still be in the template.
- This no-brainer function just makes it easy to remember to
leave out or include, as the case may
- be, the form closeing tag.
- @access public
- */
- function form_closetag()
- {
- return '</form>';
- }
-
-
/**************************************************************************\
- * BUTTON WIDGET
-
\**************************************************************************/
-
- /*!
- @function make_button
- @abstract generate a button in a SINGLE FUNCTION CALL, all
params must be passed.
- @author Angles
- @param $type (string) usually "SUBMIT"
- @param $name (string) they GPC "key" in the "key - value" pair
- @param $value (string) they GPC "value" in the "key - value"
pair AND THE TEXT on the button
- @param $onClick (string) OPTIONAL usually some javascript for
the onclick event of the button. Default is none
- @discussion Since a button is generally considered a "widget",
I will call this a widget although it does
- not use "set_" property functions the other widgets do. All
params must be passed in the function call.
- @access public
- @example $my_button = $this->widgets->make_button('submit',
'btn_send', lang('Send'));
- */
- //<input type="submit" name="btn_send" value="Send">
- function make_button($type='', $name='',$value='', $onClick='')
- {
- if ($type == '')
- {
- $type='submit';
- }
- if ($name == '')
- {
- $name=$type.'_button';
- }
- if ($value == '')
- {
- $value=lang('submit');
- }
- if ($onClick == '')
- {
- $onClick_tag = '';
- }
- else
- {
- $onClick_tag = ' onClick="'.$onClick.'"';;
- }
-
- $button = '<input type="'.$type.'" name="'.$name.'"
value="'.$value.'"'.$onClick_tag.'>';
- return $button;
- }
-
-
/**************************************************************************\
- * TOOLBAR COMPOUND WIDGET
-
\**************************************************************************/
-
- /*!
- @capability TOOLBAR COMPOUND WIDGET
- @discussion generate a toolbar for use in email pages NOTE:
usually only one toolbar made per page view
- so there is no "new_toolbar" function because we should not
need it. set_toolbar_msg is the only value
- that you might want to check if you make more then one toolbar.
- @author Angles
- */
-
- /*!
- @function set_toolbar_msg
- @abstract the toolbar has a 3rd row which can display text to
the user. This function sets that.
- @param $msg (string)
- @author Angles
- @discussion Usually after deleting or moving messages or
creating, renaming, or deleting folders,
- the mail_msg generates some kind of message to report to the
user what actions were just taken.
- Note a blank string will clear a msg if needed. Currently only
the uiindex page and the uifolder page
- might provide a msg.
- @access public
- */
- function set_toolbar_msg($msg='')
- {
- $this->toolbar_msg = $msg;
- }
- /*!
- @function get_toolbar_msg
- @abstract get whatever value the toolbar_msg property has.
- @author Angles
- @access public
- */
- function get_toolbar_msg()
- {
- return $this->toolbar_msg;
- }
-
- /*!
- @function get_toolbar
- @abstract this function returns a complete html toolbar widget
that is on top of many email pages.
- @author Angles
- @discussion generate a toolbar for use in email pages NOTE:
- WE NEED globals[phpge]->msg OBJECT and A LOGIN in order to make
this toolbar,
- THEREFOR do not put this toolbar on a page where login may not
be available.Currently,
- Preferencs pages DO NOT LOGIN, because if you are setting
preferences you do not need
- a mailserver stream AND you may not even have enough data set
to get a mailserver stream.
- Note: uses a private template object to assemple the toolbar,
calling function is responsible for
- putting the result in the global template.
- @access public
- */
- function get_toolbar()
- {
- // WE NEED ->msg OBJECT and A LOGIN in order to make
this toolbar
- $this->msg_bootstrap =
CreateObject("email.msg_bootstrap");
-
$this->msg_bootstrap->ensure_mail_msg_exists('emai.html_widgets.get_toolbar',
0);
-
- // we use a PRIVATE template object to produce this
toolbar
- $this->tpl =
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
-
- // if we already made this toolbar, retuen it from L1
cache ????
- //$my_acctnum = $GLOBALS['phpgw']->msg->get_acctnum();
- $this->tpl->set_file(array('T_widget_toolbar' =>
'widget_toolbar.tpl'));
-
$this->tpl->set_block('T_widget_toolbar','B_toolbar_row_one','V_toolbar_row_one');
-
$this->tpl->set_block('T_widget_toolbar','B_toolbar_row_two','V_toolbar_row_two');
-
- // We use these over and over, so figure them out now
+ // if we already made this toolbar, retuen it from L1
cache ????
+ //$my_acctnum = $GLOBALS['phpgw']->msg->get_acctnum();
+ $this->tpl->set_file(array('T_widget_toolbar' =>
'widget_toolbar.tpl'));
+
$this->tpl->set_block('T_widget_toolbar','B_toolbar_row_one','V_toolbar_row_one');
+
$this->tpl->set_block('T_widget_toolbar','B_toolbar_row_two','V_toolbar_row_two');
+
+ // We use these over and over, so figure them out now
// some fonts and font sizes
- $row1_rowcolor_key = 'row_off';
+ $row1_rowcolor_key = 'row_off';
$row2_rowcolor_key = 'row_on';
$this->tpl->set_var('row1_rowcolor_key',$row1_rowcolor_key);
$this->tpl->set_var('row2_rowcolor_key',$row2_rowcolor_key);
-
$this->tpl->set_var('toolbar_row1_bgcolor',$GLOBALS['phpgw_info']['theme'][$row1_rowcolor_key]);
-
$this->tpl->set_var('toolbar_row2_bgcolor',$GLOBALS['phpgw_info']['theme'][$row2_rowcolor_key]);
-
$this->tpl->set_var('toolbar_font',$GLOBALS['phpgw_info']['theme']['font']);
- $this->tpl->set_var('toolbar_font_size','2');
- $this->tpl->set_var('report_this_font_size','1');
-
- $this->tpl->set_var('report_this',
$GLOBALS['phpgw']->msg->report_moved_or_deleted());
-
- $icon_theme =
$GLOBALS['phpgw']->msg->get_pref_value('icon_theme',$acctnum);
- $icon_size =
$GLOBALS['phpgw']->msg->get_pref_value('icon_size',$acctnum);
- $svr_image_dir = PHPGW_IMAGES_DIR;
- $image_dir = PHPGW_IMAGES;
-
- // this is optional
- $this->clear_href_vars();
- // Create Links for all the buttons
- $folders_link =
$GLOBALS['phpgw']->link('/index.php',array(
-
'menuaction' => 'email.uifolder.folder',
- //
going to the folder list page, we only need log into the INBOX folder
-
'fldball[folder]' => 'INBOX',
-
'fldball[acctnum]' => $GLOBALS['phpgw']->msg->get_acctnum()));
- $compose_link =
$GLOBALS['phpgw']->link('/index.php',array(
-
'menuaction' => 'email.uicompose.compose',
- // this
data tells us where to return to after sending a message
-
'fldball[folder]' => $GLOBALS['phpgw']->msg->prep_folder_out(),
-
'fldball[acctnum]' => $GLOBALS['phpgw']->msg->get_acctnum(),
- 'sort'
=> $GLOBALS['phpgw']->msg->get_arg_value('sort'),
- 'order'
=> $GLOBALS['phpgw']->msg->get_arg_value('order'),
- 'start'
=> $GLOBALS['phpgw']->msg->get_arg_value('start')));
- $filters_link =
$GLOBALS['phpgw']->link('/index.php',array(
- 'menuaction' =>
'email.uifilters.filters_list',
- // this data
tells us what folder and account was last active
-
'fldball[folder]' => $GLOBALS['phpgw']->msg->prep_folder_out(),
-
'fldball[acctnum]' => $GLOBALS['phpgw']->msg->get_acctnum()));
- $accounts_link =
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uipreferences.ex_accounts_list');
- $email_prefs_link =
$GLOBALS['phpgw']->link('/index.php',array(
- 'menuaction' =>
'email.uipreferences.preferences',
- 'ex_acctnum' =>
$GLOBALS['phpgw']->msg->get_acctnum()));
- // Check to see if mailserver supports folders.
- $has_folders =
$GLOBALS['phpgw']->msg->get_mailsvr_supports_folders();
- // Create Buttons
- switch
($GLOBALS['phpgw']->msg->get_pref_value('button_type'))
- {
- case 'text':
- //Create Compose Button
- $this->set_href_link($compose_link);
-
$this->set_href_clickme(lang('Compose'));
- $this->tpl->set_var('compose_txt_link',
$this->get_href());
- $this->tpl->set_var('compose_img_link',
' ');
- //Create Filter Button
- $this->set_href_link($filters_link);
-
$this->set_href_clickme(lang('Filters'));
- $this->tpl->set_var('filters_txt_link',
$this->get_href());
- $this->tpl->set_var('filters_img_link',
' ');
- //Create Accounts Button
- $this->set_href_link($accounts_link);
-
$this->set_href_clickme(lang('Accounts'));
-
$this->tpl->set_var('accounts_txt_link', $this->get_href());
-
$this->tpl->set_var('accounts_img_link', ' ');
- //Create Settings Button
- $this->set_href_link($email_prefs_link);
-
$this->set_href_clickme(lang('Settings'));
-
$this->tpl->set_var('settings_txt_link', $this->get_href());
-
$this->tpl->set_var('settings_img_link', ' ');
- //Check for folder support and create
Folder Button
- if ($has_folders == True)
- {
-
//$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-folder-'.$icon_size.'.gif',lang('Folders'),'','','0'));
-
//$this->tpl->set_var('folders_img_link', $this->get_href());
- //Create Folder Text Link
-
$this->set_href_link($folders_link);
-
$this->set_href_clickme(lang('Folders'));
-
$this->tpl->set_var('folders_txt_link', $this->get_href());
-
$this->tpl->set_var('folders_img_link', ' ');
- }
- else
- {
-
$this->tpl->set_var('folders_img_link', ' ');
-
$this->tpl->set_var('folders_txt_link', ' ');
- }
- break;
- case 'image':
- //Create Compose Button
- $this->set_href_link($compose_link);
-
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/compose-message-'.$icon_size,'_on'),lang('Compose'),'','','0'));
- $this->tpl->set_var('compose_img_link',
$this->get_href());
- $this->tpl->set_var('compose_txt_link',
' ');
- //Create Filter Button
- $this->set_href_link($filters_link);
-
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/filters-'.$icon_size,'_on'),lang('Filters'),'','','0'));
- $this->tpl->set_var('filters_img_link',
$this->get_href());
- $this->tpl->set_var('filters_txt_link',
' ');
- //Create Accounts Button
- $this->set_href_link($accounts_link);
-
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/accounts-'.$icon_size,'_on'),lang('Accounts'),'','','0'));
-
$this->tpl->set_var('accounts_img_link', $this->get_href());
-
$this->tpl->set_var('accounts_txt_link', ' ');
- //Create Settings Button
- $this->set_href_link($email_prefs_link);
-
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/customize-'.$icon_size,'_on'),lang('Settings'),'','','0'));
-
$this->tpl->set_var('settings_img_link', $this->get_href());
-
$this->tpl->set_var('settings_txt_link', ' ');
- //Check for folder support and create
Folder Button
- if ($has_folders == True)
- {
- //Create Folder Image Link
-
$this->set_href_link($folders_link);
-
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/folder-'.$icon_size,'_on'),lang('Folders'),'','','0'));
-
$this->tpl->set_var('folders_img_link', $this->get_href());
-
$this->tpl->set_var('folders_txt_link', ' ');
-
- }
- else
- {
-
$this->tpl->set_var('folders_txt_link', ' ');
-
$this->tpl->set_var('folders_txt_link', ' ');
- }
- break;
- case 'both':
- //Create Compose Button
- $this->set_href_link($compose_link);
-
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/compose-message-'.$icon_size,'_on'),lang('Compose'),'','','0'));
- $this->tpl->set_var('compose_img_link',
$this->get_href());
- $this->set_href_link($compose_link);
-
$this->set_href_clickme(lang('Compose'));
- $this->tpl->set_var('compose_txt_link',
$this->get_href());
- //Create Filter Button
- $this->set_href_link($filters_link);
-
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/filters-'.$icon_size,'_on'),lang('Filters'),'','','0'));
- $this->tpl->set_var('filters_img_link',
$this->get_href());
- $this->set_href_link($filters_link);
-
$this->set_href_clickme(lang('Filters'));
- $this->tpl->set_var('filters_txt_link',
$this->get_href());
- //Create Accounts Button
- $this->set_href_link($accounts_link);
-
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/accounts-'.$icon_size,'_on'),lang('Accounts'),'','','0'));
-
$this->tpl->set_var('accounts_img_link', $this->get_href());
- $this->set_href_link($accounts_link);
-
$this->set_href_clickme(lang('Accounts'));
-
$this->tpl->set_var('accounts_txt_link', $this->get_href());
- //Create Settings Button
- $this->set_href_link($email_prefs_link);
-
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/customize-'.$icon_size,'_on'),lang('Settings'),'','','0'));
-
$this->tpl->set_var('settings_img_link', $this->get_href());
- $this->set_href_link($email_prefs_link);
-
$this->set_href_clickme(lang('Settings'));
-
$this->tpl->set_var('settings_txt_link', $this->get_href());
- //Check for folder support and create
Folder Button
- if ($has_folders == True)
- {
- //Create Folder Image Link
-
$this->set_href_link($folders_link);
-
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/folder-'.$icon_size,'_on'),lang('Folders'),'','','0'));
-
$this->tpl->set_var('folders_img_link', $this->get_href());
- //Create Folder Text Link
-
$this->set_href_link($folders_link);
-
$this->set_href_clickme(lang('Folders'));
-
$this->tpl->set_var('folders_txt_link', $this->get_href());
- }
- else
- {
-
$this->tpl->set_var('folders_img_link', ' ');
-
$this->tpl->set_var('folders_txt_link', ' ');
- }
- break;
- }
- // make the 1st row
- $this->toolbar_row_one =
$this->tpl->parse('V_toolbar_row_one','B_toolbar_row_one');
- // END TOOL BAR ROW 1
-
- // BEGIN TOOL BAR ROW2
- // ---- folders switchbox ----
- //<form name="folders_cbox"
action="/mail/index.php?menuaction=email.uiindex.index" method="post">
- if ($has_folders == True)
- {
- $this->new_form();
- $this->set_form_name('folders_cbox');
-
$this->set_form_action($GLOBALS['phpgw']->link('/index.php','menuaction=email.uiindex.index'));
- $this->set_form_method('post');
-
$this->tpl->set_var('form_folders_cbox_opentag', $this->get_form());
- $this->tpl->set_var('folders_combobox',
$this->all_folders_combobox());
-
$this->tpl->set_var('form_folders_cbox_closetag', $this->form_closetag());
- }
- else
- {
-
$this->tpl->set_var('form_folders_cbox_opentag', '');
- $this->tpl->set_var('folders_combobox',
' ');
-
$this->tpl->set_var('form_folders_cbox_closetag', '');
- }
- // associated image is still filled from row one
-
-
- // ---- account switchbox ----
- // <form name="acctbox"
action="/mail/index.php?menuaction=email.uiindex.index" method="post">
- $this->new_form();
- $this->set_form_name('accounts_cbox');
-
$this->set_form_action($GLOBALS['phpgw']->link('/index.php','menuaction=email.uiindex.index'));
- $this->set_form_method('post');
- $this->tpl->set_var('form_acctbox_opentag',
$this->get_form());
- $this->tpl->set_var('acctbox_combobox',
$this->all_accounts_combobox());
- // associated image is still filled from row one
-
- // show he user a message if this property is filled,
if empty then output a nbsp for html sanity
- if (trim($this->get_toolbar_msg()) != '')
- {
- $toolbar_report_msg = $this->get_toolbar_msg();
- }
- else
- {
- $toolbar_report_msg = ' ';
- }
- $this->tpl->set_var('toolbar_report_msg',
$toolbar_report_msg);
-
-
- // make the 2nd row AND the 3rd row
- $this->toolbar_row_two =
$this->tpl->parse('V_toolbar_row_two','B_toolbar_row_two');
-
- return $this->toolbar_row_one . $this->toolbar_row_two;
-
- }
-
-
- /*!
- @function all_folders_combobox
- @abstract high level function, uses functions in mail_msg and
this class html_widgets to make an acct switchbox
- UNDER DEVELOPMENT.
- @param $form_reference (string) this bombobox sets an
"onChange" event, which will submit the form you put here.
- Default value is "document.folders_cbox.submit()" where "" is
the default value for the $form_reference param
- @result string representing an HTML listbox widget
- @author Angles
- @discussion The first item in this folder combo box tells the
user to "pick a folder to change to", and has
- no "value", the value is an empty string, this is more like a
label than a combobox item.
- @access private, maybe made public
- */
- function all_folders_combobox($form_reference='')
- {
- if ($form_reference == '')
- {
- $form_reference = 'folders_cbox';
- }
- $acctnum = $GLOBALS['phpgw']->msg->get_acctnum();
-
- $this->new_combobox();
- $this->set_cbox_name('fldball_fake_uri');
- // default is "document.folders_cbox.submit()"
-
$this->set_cbox_onChange('document.'.$form_reference.'.submit()');
- // set_cbox_item(value, text, selected(optional,
boolean, default false)
- $this->set_cbox_item('', lang('switch current folder
to'));
-
- // get the actual list of folders we are going to put
into the combobox
- //$folder_list =
$GLOBALS['phpgw']->msg->get_folder_list();
- $folder_list =
$GLOBALS['phpgw']->msg->get_arg_value('folder_list', $acctnum);
- //$folder_list =&
$GLOBALS['phpgw']->msg->get_arg_value_ref('folder_list');
-
- $listbox_show_unseen =
$GLOBALS['phpgw']->msg->get_isset_pref('newmsg_combobox', $acctnum);
-
- for ($i=0; $i<count($folder_list);$i++)
- {
- // folder long needs urlencoding ONCE, string
can NOT be plain and can NOT be urlencoded more once.
- $folder_long =
$GLOBALS['phpgw']->msg->ensure_one_urlencoding($folder_list[$i]['folder_long']);
+
$this->tpl->set_var('toolbar_row1_bgcolor',$GLOBALS['phpgw_info']['theme'][$row1_rowcolor_key]);
+
$this->tpl->set_var('toolbar_row2_bgcolor',$GLOBALS['phpgw_info']['theme'][$row2_rowcolor_key]);
+
$this->tpl->set_var('toolbar_font',$GLOBALS['phpgw_info']['theme']['font']);
+ $this->tpl->set_var('toolbar_font_size','2');
+ $this->tpl->set_var('report_this_font_size','1');
+
+ $this->tpl->set_var('report_this',
$GLOBALS['phpgw']->msg->report_moved_or_deleted());
+
+ $icon_theme =
$GLOBALS['phpgw']->msg->get_pref_value('icon_theme',$acctnum);
+ $icon_size =
$GLOBALS['phpgw']->msg->get_pref_value('icon_size',$acctnum);
+ $svr_image_dir = PHPGW_IMAGES_DIR;
+ $image_dir = PHPGW_IMAGES;
+
+ // this is optional
+ $this->clear_href_vars();
+ // Create Links for all the buttons
+ $folders_link =
$GLOBALS['phpgw']->link('/index.php',array(
+
'menuaction' => 'email.uifolder.folder',
+ //
going to the folder list page, we only need log into the INBOX folder
+
'fldball[folder]' => 'INBOX',
+
'fldball[acctnum]' => $GLOBALS['phpgw']->msg->get_acctnum()));
+ $compose_link =
$GLOBALS['phpgw']->link('/index.php',array(
+
'menuaction' => 'email.uicompose.compose',
+ // this
data tells us where to return to after sending a message
+
'fldball[folder]' => $GLOBALS['phpgw']->msg->prep_folder_out(),
+
'fldball[acctnum]' => $GLOBALS['phpgw']->msg->get_acctnum(),
+ 'sort'
=> $GLOBALS['phpgw']->msg->get_arg_value('sort'),
+ 'order'
=> $GLOBALS['phpgw']->msg->get_arg_value('order'),
+ 'start'
=> $GLOBALS['phpgw']->msg->get_arg_value('start')));
+ $search_link = $GLOBALS['phpgw']->link('/index.php',
array(
+
'menuaction' => 'email.uisearch.form',
+ // this
data tells us what account we are operating in
+
'fldball[folder]' => $GLOBALS['phpgw']->msg->prep_folder_out(),
+
'fldball[acctnum]' => $GLOBALS['phpgw']->msg->get_acctnum()
+));
+
+ $filters_link =
$GLOBALS['phpgw']->link('/index.php',array(
+ 'menuaction' =>
'email.uifilters.filters_list',
+ // this data
tells us what folder and account was last active
+
'fldball[folder]' => $GLOBALS['phpgw']->msg->prep_folder_out(),
+
'fldball[acctnum]' => $GLOBALS['phpgw']->msg->get_acctnum()));
+ $accounts_link =
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uipreferences.ex_accounts_list');
+ $email_prefs_link =
$GLOBALS['phpgw']->link('/index.php',array(
+ 'menuaction' =>
'email.uipreferences.preferences',
+ 'ex_acctnum' =>
$GLOBALS['phpgw']->msg->get_acctnum()));
+ // Check to see if mailserver supports folders.
+ $has_folders =
$GLOBALS['phpgw']->msg->get_mailsvr_supports_folders();
+ // Create Buttons
+ switch
($GLOBALS['phpgw']->msg->get_pref_value('button_type'))
+ {
+ case 'text':
+ //Create Compose Button
+ $this->set_href_link($compose_link);
+
$this->set_href_clickme(lang('Compose'));
+ $this->tpl->set_var('compose_txt_link',
$this->get_href());
+ $this->tpl->set_var('compose_img_link',
' ');
+ //Create Search Button
+ $this->set_href_link($search_link);
+ $this->set_href_clickme(lang('Search'));
+ $this->tpl->set_var('search_txt_link',
$this->get_href());
+ $this->tpl->set_var('search_img_link',
' ');
+ //Create Filter Button
+ $this->set_href_link($filters_link);
+
$this->set_href_clickme(lang('Filters'));
+ $this->tpl->set_var('filters_txt_link',
$this->get_href());
+ $this->tpl->set_var('filters_img_link',
' ');
+ //Create Accounts Button
+ $this->set_href_link($accounts_link);
+
$this->set_href_clickme(lang('Accounts'));
+
$this->tpl->set_var('accounts_txt_link', $this->get_href());
+
$this->tpl->set_var('accounts_img_link', ' ');
+ //Create Settings Button
+ $this->set_href_link($email_prefs_link);
+
$this->set_href_clickme(lang('Settings'));
+
$this->tpl->set_var('settings_txt_link', $this->get_href());
+
$this->tpl->set_var('settings_img_link', ' ');
+ //Check for folder support and create
Folder Button
+ if ($has_folders == True)
+ {
+
//$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-folder-'.$icon_size.'.gif',lang('Folders'),'','','0'));
+
//$this->tpl->set_var('folders_img_link', $this->get_href());
+ //Create Folder Text Link
+
$this->set_href_link($folders_link);
+
$this->set_href_clickme(lang('Folders'));
+
$this->tpl->set_var('folders_txt_link', $this->get_href());
+
$this->tpl->set_var('folders_img_link', ' ');
+ }
+ else
+ {
+
$this->tpl->set_var('folders_img_link', ' ');
+
$this->tpl->set_var('folders_txt_link', ' ');
+ }
+ break;
+ case 'image':
+ //Create Compose Button
+ $this->set_href_link($compose_link);
+
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/compose-message-'.$icon_size,'_on'),lang('Compose'),'','','0'));
+ $this->tpl->set_var('compose_img_link',
$this->get_href());
+ $this->tpl->set_var('compose_txt_link',
' ');
+ //Create Search Button
+ $this->set_href_link($search_link);
+
//$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-search-16.gif',lang('Search'),'','','0'));
+ // will fix this later when new images
are made
+
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/search-'.$icon_size,'_on'),lang('Search'),'','','0'));
+ $this->tpl->set_var('search_img_link',
$this->get_href());
+ $this->tpl->set_var('search_txt_link',
' ');
+ //Create Filter Button
+ $this->set_href_link($filters_link);
+
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/filters-'.$icon_size,'_on'),lang('Filters'),'','','0'));
+ $this->tpl->set_var('filters_img_link',
$this->get_href());
+ $this->tpl->set_var('filters_txt_link',
' ');
+ //Create Accounts Button
+ $this->set_href_link($accounts_link);
+
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/accounts-'.$icon_size,'_on'),lang('Accounts'),'','','0'));
+
$this->tpl->set_var('accounts_img_link', $this->get_href());
+
$this->tpl->set_var('accounts_txt_link', ' ');
+ //Create Settings Button
+ $this->set_href_link($email_prefs_link);
+
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/customize-'.$icon_size,'_on'),lang('Settings'),'','','0'));
+
$this->tpl->set_var('settings_img_link', $this->get_href());
+
$this->tpl->set_var('settings_txt_link', ' ');
+ //Check for folder support and create
Folder Button
+ if ($has_folders == True)
+ {
+ //Create Folder Image Link
+
$this->set_href_link($folders_link);
+
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/folder-'.$icon_size,'_on'),lang('Folders'),'','','0'));
+
$this->tpl->set_var('folders_img_link', $this->get_href());
+
$this->tpl->set_var('folders_txt_link', ' ');
+
+ }
+ else
+ {
+
$this->tpl->set_var('folders_txt_link', ' ');
+
$this->tpl->set_var('folders_txt_link', ' ');
+ }
+ break;
+ case 'both':
+ //Create Compose Button
+ $this->set_href_link($compose_link);
+
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/compose-message-'.$icon_size,'_on'),lang('Compose'),'','','0'));
+ $this->tpl->set_var('compose_img_link',
$this->get_href());
+ $this->set_href_link($compose_link);
+
$this->set_href_clickme(lang('Compose'));
+ $this->tpl->set_var('compose_txt_link',
$this->get_href());
+ //Create Search Button
+ $this->set_href_link($search_link);
+
//$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-search-16.gif',lang('Search'),'','','0'));
+ // will fix this later when new images
are made
+
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/search-'.$icon_size,'_on'),lang('Search'),'','','0'));
+ $this->tpl->set_var('search_img_link',
$this->get_href());
+ $this->set_href_link($search_link);
+ $this->set_href_clickme(lang('Search'));
+ $this->tpl->set_var('search_txt_link',
$this->get_href());
+ //Create Filter Button
+ $this->set_href_link($filters_link);
+
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/filters-'.$icon_size,'_on'),lang('Filters'),'','','0'));
+ $this->tpl->set_var('filters_img_link',
$this->get_href());
+ $this->set_href_link($filters_link);
+
$this->set_href_clickme(lang('Filters'));
+ $this->tpl->set_var('filters_txt_link',
$this->get_href());
+ //Create Accounts Button
+ $this->set_href_link($accounts_link);
+
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/accounts-'.$icon_size,'_on'),lang('Accounts'),'','','0'));
+
$this->tpl->set_var('accounts_img_link', $this->get_href());
+ $this->set_href_link($accounts_link);
+
$this->set_href_clickme(lang('Accounts'));
+
$this->tpl->set_var('accounts_txt_link', $this->get_href());
+ //Create Settings Button
+ $this->set_href_link($email_prefs_link);
+
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/customize-'.$icon_size,'_on'),lang('Settings'),'','','0'));
+
$this->tpl->set_var('settings_img_link', $this->get_href());
+ $this->set_href_link($email_prefs_link);
+
$this->set_href_clickme(lang('Settings'));
+
$this->tpl->set_var('settings_txt_link', $this->get_href());
+ //Check for folder support and create
Folder Button
+ if ($has_folders == True)
+ {
+ //Create Folder Image Link
+
$this->set_href_link($folders_link);
+
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/folder-'.$icon_size,'_on'),lang('Folders'),'','','0'));
+
$this->tpl->set_var('folders_img_link', $this->get_href());
+ //Create Folder Text Link
+
$this->set_href_link($folders_link);
+
$this->set_href_clickme(lang('Folders'));
+
$this->tpl->set_var('folders_txt_link', $this->get_href());
+ }
+ else
+ {
+
$this->tpl->set_var('folders_img_link', ' ');
+
$this->tpl->set_var('folders_txt_link', ' ');
+ }
+ break;
+ }
+ // WAIT if this is NOT IMAP then we can NOT search
+ // use the has_folders var from above, it should be a
good enough indicator
+ if ($has_folders == False)
+ {
+ $this->tpl->set_var('search_img_link',
' ');
+ $this->tpl->set_var('search_txt_link',
' ');
+ }
+ // make the 1st row
+ $this->toolbar_row_one =
$this->tpl->parse('V_toolbar_row_one','B_toolbar_row_one');
+ // END TOOL BAR ROW 1
+
+ // BEGIN TOOL BAR ROW2
+ // ---- folders switchbox ----
+ //<form name="folders_cbox"
action="/mail/index.php?menuaction=email.uiindex.index" method="post">
+ if ($has_folders == True)
+ {
+ $this->new_form();
+ $this->set_form_name('folders_cbox');
+
$this->set_form_action($GLOBALS['phpgw']->link('/index.php','menuaction=email.uiindex.index'));
+ $this->set_form_method('post');
+
$this->tpl->set_var('form_folders_cbox_opentag', $this->get_form());
+ $this->tpl->set_var('folders_combobox',
$this->all_folders_combobox());
+
$this->tpl->set_var('form_folders_cbox_closetag', $this->form_closetag());
+ }
+ else
+ {
+
$this->tpl->set_var('form_folders_cbox_opentag', '');
+ $this->tpl->set_var('folders_combobox',
' ');
+
$this->tpl->set_var('form_folders_cbox_closetag', '');
+ }
+ // associated image is still filled from row one
+
+
+ // ---- account switchbox ----
+ // <form name="acctbox"
action="/mail/index.php?menuaction=email.uiindex.index" method="post">
+ $this->new_form();
+ $this->set_form_name('accounts_cbox');
+
$this->set_form_action($GLOBALS['phpgw']->link('/index.php','menuaction=email.uiindex.index'));
+ $this->set_form_method('post');
+ $this->tpl->set_var('form_acctbox_opentag',
$this->get_form());
+ $this->tpl->set_var('acctbox_combobox',
$this->all_accounts_combobox());
+ // associated image is still filled from row one
+
+ // show he user a message if this property is filled,
if empty then output a nbsp for html sanity
+ if (trim($this->get_toolbar_msg()) != '')
+ {
+ $toolbar_report_msg = $this->get_toolbar_msg();
+ }
+ else
+ {
+ $toolbar_report_msg = ' ';
+ }
+ $this->tpl->set_var('toolbar_report_msg',
$toolbar_report_msg);
+
+
+ // make the 2nd row AND the 3rd row
+ $this->toolbar_row_two =
$this->tpl->parse('V_toolbar_row_two','B_toolbar_row_two');
+
+ return $this->toolbar_row_one . $this->toolbar_row_two;
+
+ }
+
+
+ /*!
+ @function all_folders_combobox
+ @abstract high level function, uses functions in mail_msg and
this class html_widgets to make an acct switchbox
+ UNDER DEVELOPMENT.
+ @param $form_reference (string) this bombobox sets an
"onChange" event, which will submit the form you put here.
+ Default value is "document.folders_cbox.submit()" where
"folders_cbox" is the default value
+ for the $form_reference param.
+ @param $is_move_box (boolean) OPTIONAL default is False, use is
making a Move Messages To combo box,
+ which requires a different cbox name and different first line
text.
+ @result string representing an HTML listbox widget
+ @author Angles
+ @discussion The first item in this folder combo box tells the
user to "pick a folder to change to", and has
+ no "value", the value is an empty string, this is more like a
label than a combobox item.
+ @access private, maybe made public
+ */
+ function
all_folders_combobox($form_reference='',$is_move_box=False,$skip_fldball='',$first_line_txt='')
+ {
+ if ($form_reference == '')
+ {
+ $form_reference = 'folders_cbox';
+ }
+ $acctnum = $GLOBALS['phpgw']->msg->get_acctnum();
+
+ $this->new_combobox();
+ if ($is_move_box)
+ {
+ // right now ONLY the "Move Message To" combo
box needs to use this
+ $this->set_cbox_name('to_fldball_fake_uri');
+ $this->set_cbox_onChange('do_action(\'move\')');
+ if ($first_line_txt)
+ {
+ // right now ONLY the Message View page
"Move This Message To" combo box uses this
+ $this->set_cbox_item('',
$first_line_txt);
+ }
+ else
+ {
+ $this->set_cbox_item('', lang('move
selected messages into'));
+ }
+ }
+ else
+ {
+ $this->set_cbox_name('fldball_fake_uri');
+ // default is "document.folders_cbox.submit()"
+
$this->set_cbox_onChange('document.'.$form_reference.'.submit()');
+ // set_cbox_item(value, text,
selected(optional, boolean, default false)
+ $this->set_cbox_item('', lang('switch current
folder to'));
+ }
+
+ // get the actual list of folders we are going to put
into the combobox
+ //$folder_list =
$GLOBALS['phpgw']->msg->get_folder_list();
+ $folder_list =
$GLOBALS['phpgw']->msg->get_arg_value('folder_list', $acctnum);
+ //$folder_list =&
$GLOBALS['phpgw']->msg->get_arg_value_ref('folder_list');
+
+ $listbox_show_unseen =
$GLOBALS['phpgw']->msg->get_isset_pref('newmsg_combobox', $acctnum);
+
+ for ($i=0; $i<count($folder_list);$i++)
+ {
+ // folder long needs urlencoding ONCE, string
can NOT be plain and can NOT be urlencoded more once.
+ //$folder_long =
$GLOBALS['phpgw']->msg->ensure_one_urlencoding($folder_list[$i]['folder_long']);
+ $folder_long =
$GLOBALS['phpgw']->msg->prep_folder_out($folder_list[$i]['folder_long']);
// for display to the user, if this is the
INBOX, then translate that using lang INBOX
if ($folder_list[$i]['folder_short'] == 'INBOX')
{
//$folder_short = lang('INBOX');
// try this for common folder related
lang strings
- //$common_langs =
$GLOBALS['phpgw']->msg->get_common_langs();
- //$folder_short =
$common_langs['lang_inbox'];
- // or try this shortcut, it works too
$folder_short =
$GLOBALS['phpgw']->msg->get_common_langs('lang_inbox');
}
else
{
- // not inINBOX, so use actual folder
name, no translation for the user is done
+ // not inINBOX, so use actual folder
name, no translation for the user is done
$folder_short =
$folder_list[$i]['folder_short'];
- }
- $folder_acctnum = $folder_list[$i]['acctnum'];
-
- if ($listbox_show_unseen == True)
- {
- $tmp_fldball = array();
- $tmp_fldball['folder'] = $folder_long;
- $tmp_fldball['acctnum'] =
$folder_acctnum;
- $folder_status =
$GLOBALS['phpgw']->msg->get_folder_status_info($tmp_fldball);
- $folder_unseen =
number_format($folder_status['number_new']);
- $tmp_fldball = array();
- }
-
- // set_cbox_item(value, text,
selected(optional, boolean, default false)
- if ($listbox_show_unseen == True)
- {
-
$this->set_cbox_item('&folder='.$folder_long.'&acctnum='.$folder_acctnum,
$folder_short . ' (' . $folder_unseen . ')');
- }
- else
- {
-
$this->set_cbox_item('&folder='.$folder_long.'&acctnum='.$folder_acctnum,
$folder_short);
- }
- }
- return $this->get_combobox();
-
- }
-
-
- /*!
- @function all_folders_mega_combobox
- @abstract high level function, uses functions in mail_msg and
this class html_widgets to make a listbox for
- all folders in all accounts. DEPRECIATED.
- @param $form_reference (string) this combobox sets an
"onChange" event, which will submit the form you put here.
+ }
+ $folder_acctnum = $folder_list[$i]['acctnum'];
+ $skip_me = False;
+ if ($skip_fldball)
+ {
+ // move folder lists usually skip the
current folder because you can not move to current folder
+ if (($skip_fldball['folder'] ==
$folder_long)
+ && ($skip_fldball['acctnum'] ==
$acctnum))
+ {
+ $skip_me = True;
+ }
+ }
+ if ($skip_me)
+ {
+ continue;
+ }
+
+ if ($listbox_show_unseen == True)
+ {
+ $tmp_fldball = array();
+ $tmp_fldball['folder'] = $folder_long;
+ $tmp_fldball['acctnum'] =
$folder_acctnum;
+ $folder_status =
$GLOBALS['phpgw']->msg->get_folder_status_info($tmp_fldball);
+ $folder_unseen =
number_format($folder_status['number_new']);
+ $tmp_fldball = array();
+ }
+
+ // set_cbox_item(value, text,
selected(optional, boolean, default false)
+ if ($listbox_show_unseen == True)
+ {
+
$this->set_cbox_item('&folder='.$folder_long.'&acctnum='.$folder_acctnum,
$folder_short . ' (' . $folder_unseen . ')');
+ }
+ else
+ {
+
$this->set_cbox_item('&folder='.$folder_long.'&acctnum='.$folder_acctnum,
$folder_short);
+ }
+ }
+ return $this->get_combobox();
+
+ }
+
+
+ /*!
+ @function all_folders_mega_combobox
+ @abstract high level function, uses functions in mail_msg and
this class html_widgets to make a listbox for
+ all folders in all accounts. DEPRECIATED.
+ @param $form_reference (string) this combobox sets an
"onChange" event, which will submit the form you put here.
Default value is "document.folders_cbox.submit()" where "" is
the default value for the $form_reference param.
- DEPRECIATED in favor of all_folders_megalist.
- @result string representing an HTML listbox widget
- @author Angles
- @discussion ?
- @access private, maybe made public
- */
- function all_folders_mega_combobox_OLD($form_reference='')
- {
- $feed_args = Array(
- 'mailsvr_stream' => '',
- 'pre_select_folder' =>
$pre_select_folder,
- 'pre_select_folder_acctnum' =>
$pre_select_folder_acctnum,
- 'skip_folder' => '',
- 'show_num_new' =>
$listbox_show_unseen,
- 'widget_name' =>
$folder_listbox_name,
- 'folder_key_name' => 'folder',
- 'acctnum_key_name' => 'acctnum',
- 'on_change' => '',
- 'first_line_txt' => lang('if
fileto then select destination folder')
- );
- $folder_listbox =
$GLOBALS['phpgw']->msg->folders_mega_listbox($feed_args);
- }
-
- /*!
- @function new_all_folders_megalist
- @abstract Resets all Properties all_folders_megalist
- @discussion Delphi style OOP property GetSet functions are
used, this resets them all.
- @author Angles
- */
- function new_all_folders_megalist()
- {
- $this->F_megalist_form_reference = '';
- // this is the only think that actually needs a
value
- $this->F_megalist_widget_name = 'not_provided';
- $this->F_megalist_preselected_fldball = '';
- $this->F_megalist_skip_fldball = '';
- // the first item can be used to display
instructional text to the user
- $this->F_megalist_first_item_text = '';
- }
-
- /*!
- @function prop_megalist_form_reference
- @abstract Property function form_reference for
folders_mega_listbox, form_reference is used in onChange JS.
- @discussion Delphi style OOP property GetSet function.
- @author Angles
- */
- function prop_megalist_form_reference($form_reference='')
- {
- if ($form_reference)
- {
- $this->F_megalist_form_reference =
$form_reference;
- }
- return $this->F_megalist_form_reference;
- }
-
- /*!
- @function prop__megalist_widget_name
- @abstract Property function widget name for folders_mega_listbox
- @discussion Delphi style OOP property GetSet function.
- @author Angles
- */
- function prop_megalist_widget_name($widget_name='')
- {
- if ($widget_name)
- {
- $this->F_megalist_widget_name = $widget_name;
- }
- return $this->F_megalist_widget_name;
- }
-
- /*!
- @function prop_megalist_preselected_fldball
- @abstract Property function preselected folder (in fldball
form) for folders_mega_listbox
- @discussion Delphi style OOP property GetSet function.
- @author Angles
- */
- function prop_megalist_preselected_fldball($fldball='')
- {
- if ((isset($fldball))
- && ($fldball['folder'] != '')
- && ((string)$fldball['acctnum'] != ''))
- {
- $this->F_megalist_preselected_fldball =
$fldball;
- }
- return $this->F_megalist_preselected_fldball;
- }
-
- /*!
- @function prop_megalist_skip_fldball
- @abstract Property function folder (in fldball form) to NOT
show in the folders_mega_listbox
- @discussion Delphi style OOP property GetSet function.
- @author Angles
- */
- function prop_megalist_skip_fldball($fldball='')
- {
- if ((isset($fldball))
- && ($fldball['folder'] != '')
- && ((string)$fldball['acctnum'] != ''))
- {
- $this->F_megalist_skip_fldball = $fldball;
- }
- return $this->F_megalist_skip_fldball;
- }
-
- /*!
- @function prop__megalist_widget_name
- @abstract Property function for folders_mega_listbox, the first
item can be used to display instructional text to the user
- @discussion Delphi style OOP property GetSet function.
- @author Angles
- */
- function prop_megalist_first_item_text($first_item_text='')
- {
- if ($first_item_text)
- {
- $this->F_megalist_first_item_text =
$first_item_text;
- }
- return $this->F_megalist_first_item_text;
- }
-
- /*!
- @function all_folders_megalist
- @abstract All accounts All Folders in a html listbox
- @discussion UNDER DEVELOPMENT, right now the leading candidate
to be THE folder list
- function, but now sure yet.
- @author Angles
- */
- function all_folders_megalist()
- {
- $debug_mega_listbox = 0;
- //$debug_mega_listbox = 3;
-
- if ($debug_mega_listbox > 0) { echo
'folders_mega_listbox('.__LINE__.'): ENTERING<br>'; }
-
- $this->new_combobox();
- $this->set_cbox_name($this->F_megalist_widget_name);
-
- // there is NO ON change right now, this is currently
used on the filters page, we do not need action onChange there
- // default is "document.mega_folders_cbox.submit()"
-
//$this->set_cbox_onChange('document.'.$form_reference.'.submit()');
-
- // set_cbox_item(value, text, selected(optional,
boolean, default false)
- if ($this->F_megalist_first_item_text)
- {
- $this->set_cbox_item('',
$this->F_megalist_first_item_text);
- }
-
- // we need the loop to include the default account AS
WELL AS the extra accounts
- for ($x=0; $x <
count($GLOBALS['phpgw']->msg->extra_and_default_acounts); $x++)
- {
- $this_acctnum =
$GLOBALS['phpgw']->msg->extra_and_default_acounts[$x]['acctnum'];
- $this_status =
$GLOBALS['phpgw']->msg->extra_and_default_acounts[$x]['status'];
- // do not enable this yet, maybe later
- //$listbox_show_unseen =
$GLOBALS['phpgw']->msg->get_isset_pref('newmsg_combobox', $acctnum);
- $listbox_show_unseen = False;
- if ($this_status != 'enabled')
- {
- // Do Nothing, This account is not in
use
- if ($debug_mega_listbox > 1) { echo
'folders_mega_listbox('.__LINE__.'): $this_acctnum ['.$this_acctnum.'] is not
in use, so skip folderlist<br>'; }
- }
- else
- {
- $folder_list =
$GLOBALS['phpgw']->msg->get_arg_value('folder_list', $this_acctnum);
- if ($debug_mega_listbox > 1) { echo
'folders_mega_listbox('.__LINE__.'): $this_acctnum ['.$this_acctnum.'] IS
enabled, got folder list<br>'; }
- if ($debug_mega_listbox > 2) { echo
'folders_mega_listbox('.__LINE__.'): $folder_list for $this_acctnum
['.$this_acctnum.'] DUMP<pre>'; print_r($folder_list); echo '</pre>'; }
-
- // iterate thru the folder list for
this acctnum
- for ($i=0; $i<count($folder_list);$i++)
- {
- $folder_long =
$folder_list[$i]['folder_long'];
- $folder_long_preped_out =
$GLOBALS['phpgw']->msg->prep_folder_out($folder_long);
- $folder_short =
$folder_list[$i]['folder_short'];
- // yes we need $folder_acctnum
to help make the "folder ball", yes I know it *should* be the same as
$this_acctnum
- $folder_acctnum =
$folder_list[$i]['acctnum'];
-
- // this logic determines we
should not include a certain folder in the combobox list
- if
(($this->F_megalist_skip_fldball)
- && ($folder_long_preped_out ==
$this->F_megalist_skip_fldball['folder'])
- && ($folder_acctnum ==
$this->F_megalist_skip_fldball['acctnum']))
- {
- // Do Nothing, this
folder should not be included
- if ($debug_mega_listbox
> 1) { echo 'folders_mega_listbox('.__LINE__.'): skipping
$this->F_megalist_skip_fldball
['.htmlspecialchars(serialize($this->F_megalist_skip_fldball)).'] has been
matched<br>'; }
- }
- else
- {
- // this logic
determines if the combobox should be initialized with certain folder already
selected
- // we use "folder
short" as the comparator because that way at least we know we are comparing
syntatic-ally similar items
- if
(($this->F_megalist_preselected_fldball)
- &&
($folder_long_preped_out == $this->F_megalist_preselected_fldball['folder'])
- && ($folder_acctnum ==
$this->F_megalist_preselected_fldball['acctnum']))
- {
- $preselected =
True;
- }
- else
- {
- $preselected =
False;
- }
-
- if
($listbox_show_unseen == True)
- {
- $tmp_fldball =
array();
-
$tmp_fldball['folder'] = $folder_long;
-
$tmp_fldball['acctnum'] = $folder_acctnum;
- $folder_status
= $GLOBALS['phpgw']->msg->get_folder_status_info($tmp_fldball);
- $folder_unseen
= number_format($folder_status['number_new']);
- // complete the
text here so we do not need another if ... then below
- $folder_unseen
= ' ('. $folder_unseen.')';
- $tmp_fldball =
array();
- }
- else
- {
- $folder_unseen
= '';
- }
-
- $option_value =
'&folder='.$folder_long_preped_out.'&acctnum='.$folder_acctnum;
- //$option_value =
'&folder='.$folder_long.'&acctnum='.$folder_acctnum;
- // if $folder_unseen
has anything it gets added to the string here
- $text_blurb =
'['.$folder_acctnum.'] '.$folder_short.$folder_unseen;
-
- // set_cbox_item(value,
text, selected(optional, boolean, default false)
-
$this->set_cbox_item($option_value, $text_blurb, $preselected);
- }
- }
- }
- }
- if ($debug_mega_listbox > 0) { echo
'folders_mega_listbox('.__LINE__.'): LEAVING<br>'; }
- return $this->get_combobox();
- }
-
-
-
- /*!
- @function all_accounts_combobox
- @abstract UNDER DEVELOPMENT
- @author Angles
- @discussion the "values" are in the form of a URI request
string, since a combobox can
- only submit a single string as its value. This way we put alot
of information if the form
- of the URI request and use php function "parse_str" to
"recover" all this data on the submit.
- Accounts have a "status" associated with them, can be
"enabled", "disabled", or "empty".
- In this combobox we show "enabled" and "disabled" accounts, not
"empty" accounts.
- NOTE "disabled" really has no use, and "empty" I am not sure if
that is ever used anywhere at all.
- Also note that a "disabled" account should never be
"pre-selected" in this combobox, which seems logical.
- Almost always there is an email account that can be considered
"active" because the user is viewing its
- data (folders, messages, its preferences) or if the user is
composing a message then the last "active"
- account is considered the account which this mail will be
"from". Therefor, generally all mail activity
- have an account that it applies to. So when this combobox comes
across the account that is currently
- "active", that account will be "pre-selected" in the combobox.
This serves two purposes, ONE, the user
- can not swicth to an account that is currently the "active"
account, the user can only switch do
- a different account, and TWO, this gives the user visual
feedback about which account is currently
- "active", on some pages, such as the compose page, this remines
the user who the mail will be "from",
- i.e. which account sent the mail. In making this thing we
iterate thru the "extra_and_default_acounts list",
- which is an numbered array whose members are structured array
data describing the account.
- */
- function all_accounts_combobox()
- {
- // $GLOBALS['phpgw']->msg->ex_accounts_count
- // $GLOBALS['phpgw']->msg->extra_accounts
-
- //$debug_widget = True;
- $debug_widget = False;
- $acctnum = $GLOBALS['phpgw']->msg->get_acctnum();
-
- $this->new_combobox();
- $this->set_cbox_name('fldball_fake_uri');
-
$this->set_cbox_onChange('document.accounts_cbox.submit()');
-
- for ($i=0; $i <
count($GLOBALS['phpgw']->msg->extra_and_default_acounts); $i++)
- {
- $this_acctnum =
$GLOBALS['phpgw']->msg->extra_and_default_acounts[$i]['acctnum'];
- $this_acct_status =
$GLOBALS['phpgw']->msg->extra_and_default_acounts[$i]['status'];
- $this_acct_fullname =
$GLOBALS['phpgw']->msg->get_pref_value('fullname', $this_acctnum);
-
- if ($this_acct_status == 'disabled')
- {
- // set_cbox_item(value, text,
selected(optional, boolean, default false)
-
$this->set_cbox_item('&folder=INBOX&acctnum=0',
- lang('account').'
['.$this_acctnum.'] '.lang('disabled'));
- }
- elseif ($this_acct_status == 'enabled')
- {
- // set_cbox_item(value, text,
selected(optional, boolean, default false)
- if
($GLOBALS['phpgw']->msg->get_pref_value('account_name', $this_acctnum))
- {
-
$this->set_cbox_item('&folder=INBOX&acctnum='.$this_acctnum,
-
$GLOBALS['phpgw']->msg->get_pref_value('account_name', $this_acctnum),
- ((string)$acctnum ==
(string)$this_acctnum));
-
- } else {
-
$this->set_cbox_item('&folder=INBOX&acctnum='.$this_acctnum,
- lang('account').'
'.$this_acctnum.': '.$this_acct_fullname,
- ((string)$acctnum ==
(string)$this_acctnum));
- }
- }
- }
- return $this->get_combobox();
- }
-
- /*!
- @function auto_refresh
- @example I know of 3 ways to get a page to reload, 2 of those
ways are pretty much the same
- 1. the http header
- Refresh: 5;
- 2. the META http-equiv
- <META HTTP-EQUIV="Refresh" CONTENT="60">>
- both 1 and 2 have the same effect as hitting the "reload"
button, which in *many* browsers will
- force a re-download of all the images on the page, i.e. the
browser will NOT use the cached images
- 3. java script combo of "window.setTimeout" with
"window.location"
-
window.setTimeout('window.location="http://example.com/phpgw/email/index.php";
',1800000);
- method 3 is the only one I know of that will use the images
from the cache.
- also, 3 takes a reload value in miliseconds, so a value of
180000 is really 3 minutes
- ALSO, use if..then code to only auto-refresh certain pages,
such as email/index.php
- @author Angles
- */
- function auto_refresh($reload_me='', $feed_refresh_ms='')
- {
- if
($GLOBALS['phpgw']->msg->get_isset_pref('refresh_ms'))
- {
- $pref_refresh_ms =
$GLOBALS['phpgw']->msg->get_pref_value('refresh_ms');
- }
- else
- {
- $pref_refresh_ms = '';
- }
- // which do we use
- $refresh_ms = '';
- if ($feed_refresh_ms)
- {
- $refresh_ms = $feed_refresh_ms;
- }
- elseif ($pref_refresh_ms)
- {
- $refresh_ms = $pref_refresh_ms;
- }
- else
- {
- // user pref is NOT to refresh AND we were not
given another value to use
- // LEAVING
- return '';
- }
-
- /*
- // if NOT supplied a "reload_me" URI then we must
figure one out
- if ($reload_me == '')
- {
- if ((stristr($GLOBALS['PHP_SELF'],
'/email/index.php'))
- || (
((isset($GLOBALS['phpgw']->msg->ref_GET['menuaction']))
- &&
(stristr($GLOBALS['phpgw']->msg->ref_GET['menuaction'], 'email.uiindex.index')))
- )
- )
- {
- if
((isset($GLOBALS['phpgw_info']['flags']['email_refresh_uri']))
- &&
($GLOBALS['phpgw_info']['flags']['email_refresh_uri'] != ''))
- {
- $reload_me =
$GLOBALS['phpgw']->link('/index.php',$GLOBALS['phpgw_info']['flags']['email_refresh_uri']);
- }
- else
- {
- $reload_me =
$GLOBALS['phpgw']->link('/email/index.php');
- }
- }
- elseif
(eregi("^.*\/home\.php.*$",$GLOBALS['PHP_SELF']))
- {
- $reload_me =
$GLOBALS['phpgw']->link('/home.php');
- }
- }
- */
-
- // reality check
- $int_refresh_ms = (int)$refresh_ms;
- if ($int_refresh_ms < 60000)
- {
- // less than 1 minute us BS, use a fallback
value of 4 minutes
- $refresh_ms = 240000;
- }
-
- // make the $refresh_ms into a string
- $refresh_ms = (string)$refresh_ms;
- // now if we have a reload_me URI, then
- // make the JS command string if necessary
- if (($reload_me != '')
- && ($refresh_ms != ''))
- {
- $reload_me_full =
$GLOBALS['phpgw']->link('/index.php',$reload_me);
- // set refresh time in miliseconds (1000 = 1
sec) (180000 = 180 sec = 3 minutes)
- // ( 240000 = 240 sec = 4 min) (300000 = 5
min) (600000 = 10 min)
- //$refresh_ms = '240000';
- $reload_js =
- '<script language="javascript">'."\r\n"
-
.'window.setTimeout('."'".'window.location="'
- .$reload_me_full.'";
'."'".','.$refresh_ms.');'."\r\n"
- .'</script>'."\r\n";
- }
- else
- {
- // we have no URI to reload
- $reload_js = '';
- }
- // returning $reload_js which may be '' if we did not
have enough info
- return $reload_js;
- }
+ DEPRECIATED in favor of all_folders_megalist.
+ @result string representing an HTML listbox widget
+ @author Angles
+ @discussion ?
+ @access private, maybe made public
+ */
+ function all_folders_mega_combobox_OLD($form_reference='')
+ {
+ $feed_args = Array(
+ 'mailsvr_stream' => '',
+ 'pre_select_folder' =>
$pre_select_folder,
+ 'pre_select_folder_acctnum' =>
$pre_select_folder_acctnum,
+ 'skip_folder' => '',
+ 'show_num_new' =>
$listbox_show_unseen,
+ 'widget_name' =>
$folder_listbox_name,
+ 'folder_key_name' => 'folder',
+ 'acctnum_key_name' => 'acctnum',
+ 'on_change' => '',
+ 'first_line_txt' => lang('if
fileto then select destination folder')
+ );
+ $folder_listbox =
$GLOBALS['phpgw']->msg->folders_mega_listbox($feed_args);
+ }
+
+ /*!
+ @function new_all_folders_megalist
+ @abstract Resets all Properties all_folders_megalist
+ @discussion Delphi style OOP property GetSet functions are
used, this resets them all.
+ @author Angles
+ */
+ function new_all_folders_megalist()
+ {
+ $this->F_megalist_form_reference = '';
+ // this is the only think that actually needs a
value
+ $this->F_megalist_widget_name = 'not_provided';
+ $this->F_megalist_preselected_fldball = '';
+ $this->F_megalist_skip_fldball = '';
+ // the first item can be used to display
instructional text to the user
+ $this->F_megalist_first_item_text = '';
+ }
+
+ /*!
+ @function prop_megalist_form_reference
+ @abstract Property function form_reference for
folders_mega_listbox, form_reference is used in onChange JS.
+ @discussion Delphi style OOP property GetSet function.
+ @author Angles
+ */
+ function prop_megalist_form_reference($form_reference='')
+ {
+ if ($form_reference)
+ {
+ $this->F_megalist_form_reference =
$form_reference;
+ }
+ return $this->F_megalist_form_reference;
+ }
+
+ /*!
+ @function prop__megalist_widget_name
+ @abstract Property function widget name for folders_mega_listbox
+ @discussion Delphi style OOP property GetSet function.
+ @author Angles
+ */
+ function prop_megalist_widget_name($widget_name='')
+ {
+ if ($widget_name)
+ {
+ $this->F_megalist_widget_name = $widget_name;
+ }
+ return $this->F_megalist_widget_name;
+ }
+
+ /*!
+ @function prop_megalist_preselected_fldball
+ @abstract Property function preselected folder (in fldball
form) for folders_mega_listbox
+ @discussion Delphi style OOP property GetSet function.
+ @author Angles
+ */
+ function prop_megalist_preselected_fldball($fldball='')
+ {
+ if ((isset($fldball))
+ && ($fldball['folder'] != '')
+ && ((string)$fldball['acctnum'] != ''))
+ {
+ $this->F_megalist_preselected_fldball =
$fldball;
+ }
+ return $this->F_megalist_preselected_fldball;
+ }
+
+ /*!
+ @function prop_megalist_skip_fldball
+ @abstract Property function folder (in fldball form) to NOT
show in the folders_mega_listbox
+ @discussion Delphi style OOP property GetSet function.
+ @author Angles
+ */
+ function prop_megalist_skip_fldball($fldball='')
+ {
+ if ((isset($fldball))
+ && ($fldball['folder'] != '')
+ && ((string)$fldball['acctnum'] != ''))
+ {
+ $this->F_megalist_skip_fldball = $fldball;
+ }
+ return $this->F_megalist_skip_fldball;
+ }
+
+ /*!
+ @function prop__megalist_widget_name
+ @abstract Property function for folders_mega_listbox, the first
item can be used to display instructional text to the user
+ @discussion Delphi style OOP property GetSet function.
+ @author Angles
+ */
+ function prop_megalist_first_item_text($first_item_text='')
+ {
+ if ($first_item_text)
+ {
+ $this->F_megalist_first_item_text =
$first_item_text;
+ }
+ return $this->F_megalist_first_item_text;
+ }
+
+ /*!
+ @function all_folders_megalist
+ @abstract All accounts All Folders in a html listbox
+ @discussion UNDER DEVELOPMENT, right now the leading candidate
to be THE folder list
+ function, but now sure yet.
+ @author Angles
+ */
+ function all_folders_megalist()
+ {
+ $debug_mega_listbox = 0;
+ //$debug_mega_listbox = 3;
+
+ if ($debug_mega_listbox > 0) { echo
'folders_mega_listbox('.__LINE__.'): ENTERING<br>'; }
+
+ $this->new_combobox();
+ $this->set_cbox_name($this->F_megalist_widget_name);
+
+ // there is NO ON change right now, this is currently
used on the filters page, we do not need action onChange there
+ // default is "document.mega_folders_cbox.submit()"
+
//$this->set_cbox_onChange('document.'.$form_reference.'.submit()');
+
+ // set_cbox_item(value, text, selected(optional,
boolean, default false)
+ if ($this->F_megalist_first_item_text)
+ {
+ $this->set_cbox_item('',
$this->F_megalist_first_item_text);
+ }
+
+ // we need the loop to include the default account AS
WELL AS the extra accounts
+ for ($x=0; $x <
count($GLOBALS['phpgw']->msg->extra_and_default_acounts); $x++)
+ {
+ $this_acctnum =
$GLOBALS['phpgw']->msg->extra_and_default_acounts[$x]['acctnum'];
+ $this_status =
$GLOBALS['phpgw']->msg->extra_and_default_acounts[$x]['status'];
+ // do not enable this yet, maybe later
+ //$listbox_show_unseen =
$GLOBALS['phpgw']->msg->get_isset_pref('newmsg_combobox', $acctnum);
+ $listbox_show_unseen = False;
+ if ($this_status != 'enabled')
+ {
+ // Do Nothing, This account is not in
use
+ if ($debug_mega_listbox > 1) { echo
'folders_mega_listbox('.__LINE__.'): $this_acctnum ['.$this_acctnum.'] is not
in use, so skip folderlist<br>'; }
+ }
+ else
+ {
+ $folder_list =
$GLOBALS['phpgw']->msg->get_arg_value('folder_list', $this_acctnum);
+ if ($debug_mega_listbox > 1) { echo
'folders_mega_listbox('.__LINE__.'): $this_acctnum ['.$this_acctnum.'] IS
enabled, got folder list<br>'; }
+ if ($debug_mega_listbox > 2) { echo
'folders_mega_listbox('.__LINE__.'): $folder_list for $this_acctnum
['.$this_acctnum.'] DUMP<pre>'; print_r($folder_list); echo '</pre>'; }
+
+ // iterate thru the folder list for
this acctnum
+ for ($i=0; $i<count($folder_list);$i++)
+ {
+ $folder_long =
$folder_list[$i]['folder_long'];
+ $folder_long_preped_out =
$GLOBALS['phpgw']->msg->prep_folder_out($folder_long);
+ $folder_short =
$folder_list[$i]['folder_short'];
+ // yes we need $folder_acctnum
to help make the "folder ball", yes I know it *should* be the same as
$this_acctnum
+ $folder_acctnum =
$folder_list[$i]['acctnum'];
+
+ // this logic determines we
should not include a certain folder in the combobox list
+ if
(($this->F_megalist_skip_fldball)
+ && ($folder_long_preped_out ==
$this->F_megalist_skip_fldball['folder'])
+ && ($folder_acctnum ==
$this->F_megalist_skip_fldball['acctnum']))
+ {
+ // Do Nothing, this
folder should not be included
+ if ($debug_mega_listbox
> 1) { echo 'folders_mega_listbox('.__LINE__.'): skipping
$this->F_megalist_skip_fldball
['.htmlspecialchars(serialize($this->F_megalist_skip_fldball)).'] has been
matched<br>'; }
+ }
+ else
+ {
+ // this logic
determines if the combobox should be initialized with certain folder already
selected
+ // we use "folder
short" as the comparator because that way at least we know we are comparing
syntatic-ally similar items
+ if
(($this->F_megalist_preselected_fldball)
+ &&
($folder_long_preped_out == $this->F_megalist_preselected_fldball['folder'])
+ && ($folder_acctnum ==
$this->F_megalist_preselected_fldball['acctnum']))
+ {
+ $preselected =
True;
+ }
+ else
+ {
+ $preselected =
False;
+ }
+
+ if
($listbox_show_unseen == True)
+ {
+ $tmp_fldball =
array();
+
$tmp_fldball['folder'] = $folder_long;
+
$tmp_fldball['acctnum'] = $folder_acctnum;
+ $folder_status
= $GLOBALS['phpgw']->msg->get_folder_status_info($tmp_fldball);
+ $folder_unseen
= number_format($folder_status['number_new']);
+ // complete the
text here so we do not need another if ... then below
+ $folder_unseen
= ' ('. $folder_unseen.')';
+ $tmp_fldball =
array();
+ }
+ else
+ {
+ $folder_unseen
= '';
+ }
+
+ $option_value =
'&folder='.$folder_long_preped_out.'&acctnum='.$folder_acctnum;
+ //$option_value =
'&folder='.$folder_long.'&acctnum='.$folder_acctnum;
+ // if $folder_unseen
has anything it gets added to the string here
+ $text_blurb =
'['.$folder_acctnum.'] '.$folder_short.$folder_unseen;
+
+ // set_cbox_item(value,
text, selected(optional, boolean, default false)
+
$this->set_cbox_item($option_value, $text_blurb, $preselected);
+ }
+ }
+ }
+ }
+ if ($debug_mega_listbox > 0) { echo
'folders_mega_listbox('.__LINE__.'): LEAVING<br>'; }
+ return $this->get_combobox();
+ }
+
+
+
+ /*!
+ @function all_accounts_combobox
+ @abstract UNDER DEVELOPMENT
+ @author Angles
+ @discussion the "values" are in the form of a URI request
string, since a combobox can
+ only submit a single string as its value. This way we put alot
of information if the form
+ of the URI request and use php function "parse_str" to
"recover" all this data on the submit.
+ Accounts have a "status" associated with them, can be
"enabled", "disabled", or "empty".
+ In this combobox we show "enabled" and "disabled" accounts, not
"empty" accounts.
+ NOTE "disabled" really has no use, and "empty" I am not sure if
that is ever used anywhere at all.
+ Also note that a "disabled" account should never be
"pre-selected" in this combobox, which seems logical.
+ Almost always there is an email account that can be considered
"active" because the user is viewing its
+ data (folders, messages, its preferences) or if the user is
composing a message then the last "active"
+ account is considered the account which this mail will be
"from". Therefor, generally all mail activity
+ have an account that it applies to. So when this combobox comes
across the account that is currently
+ "active", that account will be "pre-selected" in the combobox.
This serves two purposes, ONE, the user
+ can not swicth to an account that is currently the "active"
account, the user can only switch do
+ a different account, and TWO, this gives the user visual
feedback about which account is currently
+ "active", on some pages, such as the compose page, this remines
the user who the mail will be "from",
+ i.e. which account sent the mail. In making this thing we
iterate thru the "extra_and_default_acounts list",
+ which is an numbered array whose members are structured array
data describing the account.
+ */
+ function all_accounts_combobox()
+ {
+ // $GLOBALS['phpgw']->msg->ex_accounts_count
+ // $GLOBALS['phpgw']->msg->extra_accounts
+
+ //$debug_widget = True;
+ $debug_widget = False;
+ $acctnum = $GLOBALS['phpgw']->msg->get_acctnum();
+
+ $this->new_combobox();
+ $this->set_cbox_name('fldball_fake_uri');
+
$this->set_cbox_onChange('document.accounts_cbox.submit()');
+
+ for ($i=0; $i <
count($GLOBALS['phpgw']->msg->extra_and_default_acounts); $i++)
+ {
+ $this_acctnum =
$GLOBALS['phpgw']->msg->extra_and_default_acounts[$i]['acctnum'];
+ $this_acct_status =
$GLOBALS['phpgw']->msg->extra_and_default_acounts[$i]['status'];
+ $this_acct_fullname =
$GLOBALS['phpgw']->msg->get_pref_value('fullname', $this_acctnum);
+
+ if ($this_acct_status == 'disabled')
+ {
+ // set_cbox_item(value, text,
selected(optional, boolean, default false)
+
$this->set_cbox_item('&folder=INBOX&acctnum=0',
+ lang('account').'
['.$this_acctnum.'] '.lang('disabled'));
+ }
+ elseif ($this_acct_status == 'enabled')
+ {
+ // set_cbox_item(value, text,
selected(optional, boolean, default false)
+ if
($GLOBALS['phpgw']->msg->get_pref_value('account_name', $this_acctnum))
+ {
+
$this->set_cbox_item('&folder=INBOX&acctnum='.$this_acctnum,
+
$GLOBALS['phpgw']->msg->get_pref_value('account_name', $this_acctnum),
+ ((string)$acctnum ==
(string)$this_acctnum));
+
+ } else {
+
$this->set_cbox_item('&folder=INBOX&acctnum='.$this_acctnum,
+ lang('account').'
'.$this_acctnum.': '.$this_acct_fullname,
+ ((string)$acctnum ==
(string)$this_acctnum));
+ }
+ }
+ }
+ return $this->get_combobox();
+ }
+
+ /*!
+ @function auto_refresh
+ @example I know of 3 ways to get a page to reload, 2 of those
ways are pretty much the same
+ 1. the http header
+ Refresh: 5;
+ 2. the META http-equiv
+ <META HTTP-EQUIV="Refresh" CONTENT="60">>
+ both 1 and 2 have the same effect as hitting the "reload"
button, which in *many* browsers will
+ force a re-download of all the images on the page, i.e. the
browser will NOT use the cached images
+ 3. java script combo of "window.setTimeout" with
"window.location"
+
window.setTimeout('window.location="http://example.com/phpgw/email/index.php";
',1800000);
+ method 3 is the only one I know of that will use the images
from the cache.
+ also, 3 takes a reload value in miliseconds, so a value of
180000 is really 3 minutes
+ ALSO, use if..then code to only auto-refresh certain pages,
such as email/index.php
+ @author Angles
+ */
+ function auto_refresh($reload_me='', $feed_refresh_ms='')
+ {
+ if
($GLOBALS['phpgw']->msg->get_isset_pref('refresh_ms'))
+ {
+ $pref_refresh_ms =
$GLOBALS['phpgw']->msg->get_pref_value('refresh_ms');
+ }
+ else
+ {
+ $pref_refresh_ms = '';
+ }
+ // which do we use
+ $refresh_ms = '';
+ if ($feed_refresh_ms)
+ {
+ $refresh_ms = $feed_refresh_ms;
+ }
+ elseif ($pref_refresh_ms)
+ {
+ $refresh_ms = $pref_refresh_ms;
+ }
+ else
+ {
+ // user pref is NOT to refresh AND we were not
given another value to use
+ // LEAVING
+ return '';
+ }
+
+ /*
+ // if NOT supplied a "reload_me" URI then we must
figure one out
+ if ($reload_me == '')
+ {
+ if ((stristr($GLOBALS['PHP_SELF'],
'/email/index.php'))
+ || (
((isset($GLOBALS['phpgw']->msg->ref_GET['menuaction']))
+ &&
(stristr($GLOBALS['phpgw']->msg->ref_GET['menuaction'], 'email.uiindex.index')))
+ )
+ )
+ {
+ if
((isset($GLOBALS['phpgw_info']['flags']['email_refresh_uri']))
+ &&
($GLOBALS['phpgw_info']['flags']['email_refresh_uri'] != ''))
+ {
+ $reload_me =
$GLOBALS['phpgw']->link('/index.php',$GLOBALS['phpgw_info']['flags']['email_refresh_uri']);
+ }
+ else
+ {
+ $reload_me =
$GLOBALS['phpgw']->link('/email/index.php');
+ }
+ }
+ elseif
(eregi("^.*\/home\.php.*$",$GLOBALS['PHP_SELF']))
+ {
+ $reload_me =
$GLOBALS['phpgw']->link('/home.php');
+ }
+ }
+ */
+
+ // reality check
+ $int_refresh_ms = (int)$refresh_ms;
+ if ($int_refresh_ms < 60000)
+ {
+ // less than 1 minute us BS, use a fallback
value of 4 minutes
+ $refresh_ms = 240000;
+ }
+
+ // make the $refresh_ms into a string
+ $refresh_ms = (string)$refresh_ms;
+ // now if we have a reload_me URI, then
+ // make the JS command string if necessary
+ if (($reload_me != '')
+ && ($refresh_ms != ''))
+ {
+ $reload_me_full =
$GLOBALS['phpgw']->link('/index.php',$reload_me);
+ // set refresh time in miliseconds (1000 = 1
sec) (180000 = 180 sec = 3 minutes)
+ // ( 240000 = 240 sec = 4 min) (300000 = 5
min) (600000 = 10 min)
+ //$refresh_ms = '240000';
+ $reload_js =
+ '<script language="javascript">'."\r\n"
+
.'window.setTimeout('."'".'window.location="'
+ .$reload_me_full.'";
'."'".','.$refresh_ms.');'."\r\n"
+ .'</script>'."\r\n";
+ }
+ else
+ {
+ // we have no URI to reload
+ $reload_js = '';
+ }
+ // returning $reload_js which may be '' if we did not
have enough info
+ return $reload_js;
+ }
/**************************************************************************\
* GENERIC ERROR REPORT
@@ -1749,5 +1819,99 @@
}
}
- }
-?>
+ /*!
+ @function get_geek_bar
+ @abstract TESTING goes on bottom of index page
+ @author Angles
+ */
+ function get_geek_bar()
+ {
+ $row_on = $GLOBALS['phpgw_info']['theme']['row_on'];
+ $this_server_type =
$GLOBALS['phpgw']->msg->get_pref_value('mail_server_type');
+ if (extension_loaded('imap') &&
function_exists('imap_open'))
+ {
+ $library_usage = 'builtin';
+ }
+ else
+ {
+ $library_usage = 'AM sockets';
+ }
+ $anglemail_table_exists = 'installed';
+ if ($GLOBALS['phpgw']->msg->so->so_am_table_exists() ==
False)
+ {
+ $anglemail_table_exists = 'NOT
'.$anglemail_table_exists;
+ }
+ $compression = 'NOT available';
+ //if (function_exists('bzcompress'))
+ //{
+ // $compression = 'bz2';
+ //}
+ //else
+ if (function_exists('gzcompress'))
+ {
+ $compression = 'gzip';
+ }
+ $spell_available = 'available';
+ if (function_exists('pspell_check') == False)
+ {
+ $spell_available = 'NOT '.$spell_available;
+ }
+ if ($GLOBALS['phpgw']->msg->phpgw_before_xslt == True)
+ {
+ $using_xslt = 'no';
+ }
+ else
+ {
+ $using_xslt = 'yes';
+ }
+
+ // did we connect
+ $accts_connected = '';
+ // put together a list of all enabled accounts so we
will check them for an open stream
+ for ($i=0; $i <
count($GLOBALS['phpgw']->msg->extra_and_default_acounts); $i++)
+ {
+ if
($GLOBALS['phpgw']->msg->extra_and_default_acounts[$i]['status'] == 'enabled')
+ {
+ $this_acctnum =
(int)$GLOBALS['phpgw']->msg->extra_and_default_acounts[$i]['acctnum'];
+ if
(($GLOBALS['phpgw']->msg->get_isset_arg('mailsvr_stream', $this_acctnum) ==
True)
+ &&
((string)$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_stream', $this_acctnum)
!= ''))
+ {
+ $accts_connected .=
(string)$this_acctnum.',';
+ }
+ }
+ }
+ // get rid of trailing , if it exists
+ if (stristr($accts_connected, ','))
+ {
+ $accts_connected =
substr($accts_connected,0,-1);
+ $did_connect = 'yes ('.$accts_connected.')';
+
+ }
+ else
+ {
+ $did_connect = 'no';
+ }
+
+ $geek_bar =
+ '<br>
+ <table border="0" cellpadding="4" cellspacing="0"
width="100%" align="center">
+ <tr bgcolor="'.$row_on.'" class="row_on">
+ <td width="100%" align="left">'."\r\n"
+ //.'<small style="font-size: 10pt;">'
+ .'<small style="font-size: xx-small;">'
+ .'<font color="brown">GeekBar:</font> '
+ .'Server Type: ['.$this_server_type.']
-- '
+ .'IMAP library: ['.$library_usage.'] --
'
+ .'AngleMail Table:
['.$anglemail_table_exists.'] -- '
+ .'compression: ['.$compression.'] -- '
+ .'spelling: ['.$spell_available.'] -- '
+ .'using XSLT: ['.$using_xslt.'] -- '
+ .'did connect: ['.$did_connect.'] '
+ .'</small>'
+ ."\r\n"
+ .' </td>
+ </table>';
+ return $geek_bar;
+ }
+ }
+?>
====================================================
Index: email/inc/class.bopreferences.inc.php
diff -u email/inc/class.bopreferences.inc.php:1.23
email/inc/class.bopreferences.inc.php:1.24
--- email/inc/class.bopreferences.inc.php:1.23 Fri Mar 14 04:00:15 2003
+++ email/inc/class.bopreferences.inc.php Thu Dec 30 23:13:50 2004
@@ -32,6 +32,8 @@
'ex_accounts_delete' => True
);
var $msg_bootstrap;
+ // convience reference to the msg object
+ var $msg='##NOTHING##';
var $not_set='-1';
var $std_prefs=array();
var $cust_prefs=array();
@@ -50,6 +52,7 @@
var $args=array();
var $debug_set_prefs = 0;
//var $debug_set_prefs = 3;
+ //var $debug_set_prefs = 4;
function bopreferences()
@@ -71,9 +74,13 @@
$this->msg_bootstrap->set_do_login(BS_LOGIN_NEVER);
if ($this->debug_set_prefs > 1) { echo
'email.bopreferences. *constructor*: call
this->msg_bootstrap->ensure_mail_msg_exists, msg_bootstrap->get_do_login():
'.serialize($this->msg_bootstrap->get_do_login()).'<br>'; }
$this->msg_bootstrap->ensure_mail_msg_exists('email.bopreferences.
*constructor*', $this->debug_set_prefs);
-
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences. *constructor*: LEAVING<br>'; }
- return;
+ // make the convience reference
+ if ($this->msg == '##NOTHING##')
+ {
+ $this->msg =& $GLOBALS['phpgw']->msg;
+ }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences. *constructor*: LEAVING<br>'); }
+ //return;
}
/*!
@@ -100,7 +107,7 @@
*/
function init_available_prefs()
{
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.init_available_prefs: ENTERING, use debug level 4 for a
data dump on leaving<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.init_available_prefs: ENTERING, use
debug level 4 for a data dump on leaving<br>'); }
$this->std_prefs = Array();
$i = 0;
@@ -113,15 +120,7 @@
'lang_blurb' => lang('enable this email
account'),
'init_default' => 'set_or_not,not_set',
'values' => array(),
- 'long_desc' =>
- 'THIS PREF CURRENTLY DOES NOTHING
- Users may have more than one email
account. In the future
- it is anticipated that automatic
actions may be performed
- on these accounts, such as automatic
new mail checks,
- auto filtering, etc... Perhaps the user
may want to disable
- an account so that these automatic
actions do not occur for
- that account. This is one possible use.
- Also, an admin may want to disable
accounts from time to time.'
+ 'long_desc' => lang('THIS PREF CURRENTLY DOES
NOTHING Users may have more than one email account. In the future it is
anticipated that automatic actions may be performed on these accounts, such as
automatic new mail checks,auto filtering, etc... Perhaps the user may want to
disable an account so that these automatic actions do not occur for that
account. This is one possible use. Also, an admin may want to disable accounts
from time to time.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -134,15 +133,7 @@
// note that after the comma there is NO space,
this means default is no value
'init_default' => 'string,',
'values' => array(),
- 'long_desc' =>
- 'This is the name that appears in the
account combobox. If for
- leave this blank, your accounts will be
given a standard name like
- Account[1]: Jane Doe, where Jane Doe is
the name you give below as
- '.lang('Your full name').'. If you want
to give an account a special name
- you can fill this in. No matter what,
this is for your use,
- your emails will still use '.lang('Your
full name').' as
- your FROM name for email messages. Note
that '.lang('Your full name').' for your
- email account 0 is the name you gave in
the phpgroupware setup.'
+ 'long_desc' => lang('This is the name that
appears in the account combobox. If for leave this blank, your accounts will be
given a standard name like Account[1]: Jane Doe, where Jane Doe is the name you
give below as Your full name. If you want to give an account a special name you
can fill this in. No matter what, this is for your use, your emails will still
use Your full name as your FROM name for email messages. Note that Your full
name for your email account 0 is the name you gave in the phpgroupware setup.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -154,12 +145,7 @@
'lang_blurb' => lang('Your full name'),
'init_default' =>
'varEVAL,$GLOBALS["phpgw_info"]["user"]["fullname"];',
'values' => array(),
- 'long_desc' =>
- 'This is the name that appears in the
users FROM address.
- The default mail account gets this
value automatically from
- the phpgwapi. Additional accounts are
created with the phpgwapi
- supplied fullname you can specify a
different fullname for each
- extra email account.'
+ 'long_desc' => lang('This is the name that
appears in the users FROM address. The default mail account gets this value
automatically from the phpgwapi. Additional accounts are created with the
phpgwapi supplied fullname you can specify a different fullname for each extra
email account.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -171,13 +157,7 @@
'lang_blurb' => lang('email signature'),
'init_default' => 'string, ',
'values' => array(),
- 'long_desc' =>
- 'This text will be appended to the
bottom of the users emails for
- this email account. Currently, html
tags are not supported. Also,
- forwarded email will NOT get this email
sig appended to it for reasons
- such as it clutters the email, the
forwarded part probably has its own
- email sig from the original author,
which is really the information
- that matters the most.'
+ 'long_desc' => lang('This text will be appended
to the bottom of the users emails for this email account. Currently, html tags
are not supported. Also, forwarded email will NOT get this email sig appended
to it for reasons such as it clutters the email, the forwarded part probably
has its own email sig from the original author, which is really the information
that matters the most.')
);
$lang_oldest = lang('oldest');
$lang_newest = lang('newest');
@@ -194,13 +174,7 @@
'old_new' => $lang_oldest.' ->
'.$lang_newest,
'new_old' => $lang_newest.' ->
'.$lang_oldest
),
- 'long_desc' =>
- 'In the email index page, the page
which lists all the mails in a
- folder, mail may be sorted by date,
author, size, or subject,
- HOWEVER all of these need to be ordered
from first to last, this
- options controlls what is first and
last. For example,
- if sorting by date, the newest to
oldest displays the most recent
- emails first, in decending order down
to the oldest emails last. '
+ 'long_desc' => lang('In the email index page,
the page which lists all the mails in a folder, mail may be sorted by date,
author, size, or subject, HOWEVER all of these need to be ordered from first to
last, this options controlls what is first and last. For example, if sorting by
date, the newest to oldest displays the most recent emails first, in decending
order down to the oldest emails last. ')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -215,11 +189,7 @@
'1' => lang('Layout 1'),
'2' => lang('Layout 2')
),
- 'long_desc' =>
- 'The email application offers 2
different layouts for the index page,
- that is the page that lists the emails
in a folder. This page may be
- the page the user looks at the most and
so different layouts, or looks,
- are offered.'
+ 'long_desc' => lang('The email application
offers 2 different layouts for the index page, that is the page that lists the
emails in a folder. This page may be the page the user looks at the most and so
different layouts, or looks, are offered.')
);
$i++;
@@ -275,14 +245,10 @@
'values' => array(
'evo' => lang('Evolution Style'),
'moz' => lang('Mozilla Modern Style'),
- 'noia' => lang('Noia @ Carlitus
Style')
+ 'noia' => lang('Noia @ Carlitus
Style'),
+ 'AquaFusion' => lang('Aqua Fusion')
),
- 'long_desc' =>
- 'The email application offers different
icon image themes, groups of
- images of a similar style which are
used in this email application.
- Currently the available themes are
images based on Evolution by Ximian
- and the Netscape6 / Mozilla browser
buttons. Additional themes are
- anticipated and welcome.'
+ 'long_desc' => lang('The email application
offers different icon image themes, groups of images of a similar style which
are used in this email application. Currently the available themes are images
based on Evolution by Ximian and the Netscape7, Mozilla browser buttons.
Additional themes are anticipated and welcome.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -297,9 +263,7 @@
'16' => lang('Small'),
'24' => lang('Big')
),
- 'long_desc' =>
- 'The email application offers different
icon image themes, these
- icons can be big or small.'
+ 'long_desc' => lang('The email application
offers different icon image themes, these icons can be big or small.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -315,9 +279,7 @@
'image' => lang('Image'),
'both' => lang('Both')
),
- 'long_desc' =>
- 'The email application offers different
button displays, these
- buttons can be text, images, or both.'
+ 'long_desc' => lang('The email application
offers different button displays, these buttons can be text, images, or both.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -333,19 +295,7 @@
'From' => lang('From'),
'ReplyTo' => lang('ReplyTo')
),
- 'long_desc' =>
- 'This confusing and often misunderstood
option is left over from
- this email apps origins as Aeromail by
Mark Cushman. When viewing
- a list of emails in a folder, the FROM
column may show you
- a) the senders name only, if a name was
provided,
- b) the senders From email address, in
addition to the senders name, or
- c) the senders reply to address if it
is different from the senders
- from address, in addition to the
senders name if it was provided.
- Typically users set this to none, which
will show only the senders
- name. If no name was supplied by the
sender, then the senders FROM
- email address will be shown, whether a
seperate reply to address is
- provided has no effect on this, the
FROM address is always used if the
- senders name is not provided.'
+ 'long_desc' => lang('This confusing and often
misunderstood option is left over from this email apps origins as Aeromail by
Mark Cushman. When viewing a list of emails in a folder, the FROM column may
show you a) the senders name only, if a name was provided, b) the senders From
email address, in addition to the senders name, or c) the senders reply to
address if it is different from the senders from address, in addition to the
senders name if it was provided. Typically users set this to none, which will
show only the senders name. If no name was supplied by the sender, then the
senders FROM email address will be shown, whether a seperate reply to address
is provided has no effect on this, the FROM address is always used if the
senders name is not provided.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -357,11 +307,7 @@
'lang_blurb' => lang('show new messages on
main screen'),
'init_default' => 'set_or_not,not_set',
'values' => array(),
- 'long_desc' =>
- 'Each user has a summary page which can
display a variety
- of information. This option will show a
small list of email
- messages in the INBOX of the users
default email account on
- the users summary home page.'
+ 'long_desc' => lang('Each user has a summary
page which can display a variety of information. This option will show a small
list of email messages in the INBOX of the users default email account on the
users summary home page.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -375,11 +321,7 @@
'lang_blurb' => lang('Deleted messages go to
Trash'),
'init_default' => 'set_or_not,not_set',
'values' => array(),
- 'long_desc' =>
- 'If checked, Deleted message will be
sent to the "Trash"
- folder name which you specify in the
box for "'
- .lang('Deleted messages (Trash)
folder').'".
- Only works with IMAP servers, POP
servers do not have folders.'
+ 'long_desc' => lang('If checked, Deleted
message will be sent to the "Trash" folder name which you specify in
the box for " Deleted messages (Trash) folder ". Only works with IMAP
servers, POP servers do not have folders.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -392,14 +334,7 @@
'lang_blurb' => lang('Deleted messages
(Trash) folder'),
'init_default' => 'string,Trash',
'values' => array(),
- 'long_desc' =>
- 'If "'.lang('Deleted messages go
to Trash').'" is checked,
- Deleted message will be sent to the
folder name you type in
- this box. If this folder does not
exist, it will be created
- for you automatically. Default name is
"Trash".
- This will be your "Trash"
folder, but it does not have to
- actually be called "Trash",
you can name it anything.
- Only works with IMAP servers, POP
servers do not have folders.'
+ 'long_desc' => lang('If " Deleted messages
go to Trash " is checked, Deleted message will be sent to the folder name
you type in this box. If this folder does not exist, it will be created for you
automatically. Default name is "Trash". This will be your
"Trash" folder, but it does not have to actually be called
"Trash", you can name it anything. Only works with IMAP servers, POP
servers do not have folders.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -413,11 +348,7 @@
'lang_blurb' => lang('Sent messages saved in
"Sent" folder'),
'init_default' => 'set_or_not,not_set',
'values' => array(),
- 'long_desc' =>
- 'If checked, a copy of your sent mail
will be stored in
- the "Sent" folder name which
you specify in the box
- for "'.lang('Sent messages
folder').'".
- Only works with IMAP servers, POP
servers do not have folders.'
+ 'long_desc' => lang('If checked, a copy of your
sent mail will be stored in the "Sent" folder name which you specify
in the box for "Sent messages folder ". Only works with IMAP servers,
POP servers do not have folders.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -430,14 +361,7 @@
'lang_blurb' => lang('Sent messages folder'),
'init_default' => 'string,Sent',
'values' => array(),
- 'long_desc' =>
- 'If "'.lang('Sent messages
folder').'" is checked,
- a copy of your sent mail will be stored
in the folder
- name you type in this box. If this
folder does not exist,
- it will be created for you
automatically. Default name is "Sent".
- This will be your "Sent"
folder, but it does not have to
- actually be called "Sent",
you can name it anything.
- Only works with IMAP servers, POP
servers do not have folders.'
+ 'long_desc' => lang('If " Sent messages
folder " is checked, a copy of your sent mail will be stored in the folder
name you type in this box. If this folder does not exist, it will be created
for you automatically. Default name is "Sent". This will be your
"Sent" folder, but it does not have to actually be called
"Sent", you can name it anything. Only works with IMAP servers, POP
servers do not have folders.')
);
/*
$i++;
@@ -497,13 +421,7 @@
'lang_blurb' => lang('enable UTF-7 encoded
folder names'),
'init_default' => 'set_or_not,not_set',
'values' => array(),
- 'long_desc' =>
- 'Most US and European users do not need
to enable this.
- If this option is checked then your
email server can handle
- folder names with non US-ASCII
charactors in them/ Default
- is disabled, not checked. Only use if
you are really sure
- you need it.
- Only works with IMAP servers, POP
servers do not have folders.'
+ 'long_desc' => lang('Most US and European
users do not need to enable this. If this option is checked then your email
server can handle folder names with non US-ASCII charactors in them/ Default is
disabled, not checked. Only use if you are really sure you need it. Only works
with IMAP servers, POP servers do not have folders.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -515,10 +433,7 @@
'lang_blurb' => lang('Send forwarded mail as
quoted attachment'),
'init_default' => 'set_or_not,not_set',
'values' => array(),
- 'long_desc' =>
- 'Select this box if you want the text
body of the message you are forwarding to appear
- inline in the body of your sent message
- '
+ 'long_desc' => lang('Select this box if you
want the text body of the message you are forwarding to appear inline in the
body of your sent message')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -530,9 +445,7 @@
'init_default' => 'string,simple',
'values' => array('orig'=>'Simple',
'lex' => 'Javascript'),
- 'long_desc' =>
- 'We have recently added this new
addressbook so that users can choose to have a more complex addressbook that
features a) Easy, point and click searching, b) Best suited for organizations
with large central addressbooks with many categories. You can choose here which
addressbook do you prefer.
- '
+ 'long_desc' => lang('We have recently added
this new addressbook so that users can choose to have a more complex
addressbook that features a) Easy, point and click searching, b) Best suited
for organizations with large central addressbooks with many categories. You can
choose here which addressbook do you prefer.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -545,11 +458,7 @@
'values' => array('900'=>'1200x1600',
'800' => '1024x768',
'700' => '800x600'),
- 'long_desc' =>
- 'We have three sizes that tell us how
to better render the addressbook for you: 800x600 (addressbook
- will popout in a 700 pixel wide box),
1024x768 (it will be a 800 box), 1200x1600 (will be a 900 box).
- The fonts for all html stuff will be,
respectively set to xx-small, x-small and normal (no font setting).
- '
+ 'long_desc' => lang('We have three sizes that
tell us how to better render the addressbook for you: 800x600 (addressbook will
popout in a 700 pixel wide box), 1024x768 (it will be a 800 box), 1200x1600
(will be a 900 box). The fonts for all html stuff will be, respectively set to
xx-small, x-small and normal (no font setting).')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -561,8 +470,7 @@
'lang_blurb' => lang('Show New Messages in
ComboBox'),
'init_default' => 'set_or_not,not_set',
'values' => array(),
- 'long_desc' =>
- 'This specifies whether or not to show
the number of new message in the folders combo box on the index screen.'
+ 'long_desc' => lang('This specifies whether or
not to show the number of new message in the folders combo box on the index
screen.')
);
$i++;
$this->std_prefs[$i] = Array(
@@ -574,8 +482,7 @@
'lang_blurb' => lang('Show total folder
size by default'),
'init_default' => 'set_or_not,not_set',
'values' => array(),
- 'long_desc' =>
- 'This specifies whether or not to show
the total size of folders by default. If this is not checked, you will be
presented with a button allowing you to display folder size..'
+ 'long_desc' => lang('This specifies whether or
not to show the total size of folders by default. If this is not checked, you
will be presented with a button allowing you to display folder size..')
);
// Custom Settings
$this->cust_prefs = Array();
@@ -591,22 +498,7 @@
'lang_blurb' => lang('Use custom settings'),
'init_default' => 'set_or_not,not_set',
'values' => array(),
- 'long_desc' =>
- 'Your server administrator will set the
default values for the
- following options. You may never need
to change any of them.
- If you do need to use settings that are
different from
- the defaults for the options below
here, then check this
- box. Default is disabled, not checked.
If you fill in some
- of the options, but later decide to go
back to the default
- values, unchecking this box will erase
your custom values
- and put back the default values. All of
the following options
- start out with the default value, so
you may see some
- settings below even if you have never
filled them in.
- This checkbox only shows up for the
default email account.
- If you are setting up additional email
accounts, you will
- be required to fill in the following
options and this
- checkbox will not be displayed, it will
be checked for
- all extra email accounts.'
+ 'long_desc' => lang('Your server administrator
will set the default values for the following options. You may never need to
change any of them. If you do need to use settings that are different from the
defaults for the options below here, then check this box. Default is disabled,
not checked. If you fill in some of the options, but later decide to go back to
the default values, unchecking this box will erase your custom values and put
back the default values. All of the following options start out with the
default value, so you may see some settings below even if you have never filled
them in. This checkbox only shows up for the default email account. If you are
setting up additional email accounts, you will be required to fill in the
following options and this checkbox will not be displayed, it will be checked
for all extra email accounts.')
);
$i++;
$this->cust_prefs[$i] = Array(
@@ -619,18 +511,7 @@
'lang_blurb' => lang('Email Account Name'),
'init_default' =>
'function,sub_default_userid',
'values' => array(),
- 'long_desc' =>
- 'The login name to use when checking
mail for this email
- account. This may be the same as your
phpGroupWare login
- name, or the server administrator may
have set it for you.
- If your have multiple email accounts
set up, you will need
- to fill this in. If you have only one
email account set
- up, then you can probably leave this
alone. If you clear this
- box, then it goes back to the default
value. If you only need
- some custom settings but want this one
to be the default value,
- then leave this box blank, the default
value will be used, and
- you will see that default value in this
box the next time you
- come to this preferences page.'
+ 'long_desc' => lang('The login name to use when
checking mail for this email account. This may be the same as your phpGroupWare
login name, or the server administrator may have set it for you. If your have
multiple email accounts set up, you will need to fill this in. If you have only
one email account set up, then you can probably leave this alone. If you clear
this box, then it goes back to the default value. If you only need some custom
settings but want this one to be the default value, then leave this box blank,
the default value will be used, and you will see that default value in this box
the next time you come to this preferences page.')
);
$i++;
$this->cust_prefs[$i] = Array(
@@ -643,20 +524,7 @@
'lang_blurb' => lang('Email Password'),
'init_default' => 'init_no_fill',
'values' => array(),
- 'long_desc' =>
- 'The login name to use when checking
mail for this email
- account. This may be the same as your
phpGroupWare login
- name, or the server administrator may
have set it for you.
- If your have multiple email accounts
set up, you will need
- to fill this in. If you have only one
email account set
- up, then you can probably leave this
alone. If you do set
- a custom password, this box will be
blank the next time you
- come to this settings page. This is a
security feature because
- your custom email password is not sent
to your browser after
- you set it. To change your custom
password, simply enter a new
- password in the box. Exra email
accounts require you to set this.
- For your default email account, you can
clear your custom password
- by unchecking the "Use Custom
Settings" option.'
+ 'long_desc' => lang('The password to use when
checking mail for this email account. This may be the same as your phpGroupWare
password, or the server administrator may have set it for you. If your have
multiple email accounts set up, you will need to fill this in. If you have only
one email account set up, then you can probably leave this alone. If you do set
a custom password, this box will be blank the next time you come to this
settings page. This is a security feature because your custom email password is
not sent to your browser after you set it. To change your custom password,
simply enter a new password in the box. Extra email accounts require you to set
this. For your default email account, you can clear your custom password by
unchecking the "Use Custom Settings" option.')
);
$i++;
$this->cust_prefs[$i] = Array(
@@ -670,13 +538,7 @@
// 'init_default' =>
'function,$this->sub_default_address($account_id);',
'init_default' =>
'function,sub_default_address',
'values' => array(),
- 'long_desc' =>
- 'Mail you send will use this address as
the "From" address.
- This may be the same as your
phpGroupWare login name,
- or the server administrator may have
set it for you.
- When the recipient clicks reply, this
address will
- be used. You can leave this box blank
and the default value
- will be used.'
+ 'long_desc' => lang('Mail you send will use
this address as the "From" address. This may be the same as your
phpGroupWare login name, or the server administrator may have set it for you.
When the recipient clicks reply, this address will be used. You can leave this
box blank and the default value will be used.')
);
$i++;
$this->cust_prefs[$i] = Array(
@@ -689,10 +551,7 @@
'lang_blurb' => lang('Mail Server'),
'init_default' =>
'varEVAL,$GLOBALS["phpgw_info"]["server"]["mail_server"];',
'values' => array(),
- 'long_desc' =>
- 'Name of the mail server you want to
access. Should be a
- name like "mail.example.com".
If you leave this box
- blank then the default value will be
used.'
+ 'long_desc' => lang('Name of the mail server
you want to access. Should be a name like "mail.example.com". If you
leave this box blank then the default value will be used.')
);
$i++;
$this->cust_prefs[$i] = Array(
@@ -709,13 +568,7 @@
'imaps' => 'IMAPS',
'pop3s' => 'POP-3S'
),
- 'long_desc' =>
- 'The type of mail server you want to
access. IMAP mail
- servers have folders, such as the Sent
and Trash folders.
- POP servers do not have folders. POP,
POP-3, and POP3 are the same thing.
- You can have the server connection
encrypted by using IMAPS or POPS,
- only if the mailserver supports it and
if your phpGroupWare installation
- has a "SSL" capabable version
of PHP.'
+ 'long_desc' => lang('The type of mail server
you want to access. IMAP mail servers have folders, such as the Sent and Trash
folders. POP servers do not have folders. POP, POP-3, and POP3 are the same
thing. You can have the server connection encrypted by using IMAPS or POPS,
only if the mailserver supports it and if your phpGroupWare installation has a
"SSL" capabable version of PHP.')
);
$i++;
$this->cust_prefs[$i] = Array(
@@ -731,19 +584,7 @@
'UWash' => 'UWash',
'UW-Maildir' => 'UW-Maildir'
),
- 'long_desc' =>
- 'If using an IMAP server, what kind is
it, most often
- this option can safely be set to
- "Cyrus '.lang('or').'
Courier". Technically, this
- means the server uses a dot between the
different parts of the
- folder names, such as
"INBOX.Sent". The other major kind
- of IMAP server is the University of
Washington "UWash" IMAP server.
- It uses slashes instead of the dots the
other servers use, and
- although it has a folder called
"INBOX", it is not
- considered the "Namespace"
for the other folder names.
- The "UW-Maildir" is a rare
combination of the two above
- types. This is the least used kind of
IMAP server. If you are unsure,
- ask your IT administrator. Only applies
to IMAP servers.'
+ 'long_desc' => lang('If using an IMAP server,
what kind is it, most often this option can safely be set to "Cyrus or
Courier". Technically, this means the server uses a dot between the
different parts of the folder names, such as "INBOX.Sent". The other
major kind of IMAP server is the University of Washington "UWash"
IMAP server. It uses slashes instead of the dots the other servers use, and
although it has a folder called "INBOX", it is not considered the
"Namespace" for the other folder names. The "UW-Maildir" is
a rare combination of the two above types. This is the least used kind of IMAP
server. If you are unsure, ask your IT administrator. Only applies to IMAP
servers.')
);
$i++;
$this->cust_prefs[$i] = Array(
@@ -756,21 +597,10 @@
'lang_blurb' => lang('U-Wash Mail Folder').'
- ' .lang('If Applicable'),
'init_default' =>
'varEVAL,$GLOBALS["phpgw_info"]["server"]["mail_folder"];',
'values' => array(),
- 'long_desc' =>
- 'Only needed with the University of
Washington "UWash" IMAP server.
- The default value is "mail"
which means your mail folders, other
- then INBOX, are located in a directory
called "mail" directly
- under your "HOME" directory.
This box may be left empty, which
- means your mail folders are located in
your "HOME" directory, not
- a subdirectory. If your mail folders
are located in a subdirectory of
- "HOME" then put the name of
that subdirectory here. Generally,
- it is not necessary to use any special
slashes or tildes, "HOME"
- is always considered the base
directory, and the slash bewteen "HOME"
- and the subdirectory will be added for
you automatically, do not put the slash
- in this box.'
+ 'long_desc' => lang('Only needed with the
University of Washington "UWash" IMAP server. The default value is
"mail" which means your mail folders, other then INBOX, are located
in a directory called "mail" directly under your "HOME"
directory. This box may be left empty, which means your mail folders are
located in your "HOME" directory, not a subdirectory. If your mail
folders are located in a subdirectory of "HOME" then put the name of
that subdirectory here. Generally, it is not necessary to use any special
slashes or tildes, "HOME" is always considered the base directory,
and the slash bewteen "HOME" and the subdirectory will be added for
you automatically, do not put the slash in this box.')
);
- if ($this->debug_set_prefs > 3) { echo
'email.bopreferences.init_available_prefs: data dump: calling
debug_dump_prefs<pre>'; $this->debug_dump_prefs(); }
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.init_available_prefs: LEAVING<br>'; }
+ if ($this->debug_set_prefs > 3) {
$this->msg->dbug->out('email.bopreferences.init_available_prefs: data dump:
calling debug_dump_prefs<br>'); $this->debug_dump_prefs(); }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.init_available_prefs: LEAVING<br>');
}
}
@@ -778,9 +608,9 @@
function debug_dump_prefs()
{
// DEBUG begin
- echo '<br><br>';
- echo '<b>std_prefs var dump:</b><pre>';
print_r($this->std_prefs); echo '</pre>';
- echo '<b>cust_prefs var dump:</b><pre>';
print_r($this->cust_prefs); echo '</pre>';
+ //$this->msg->dbug->out('<br><br>');
+
$this->msg->dbug->out('email.bopreferences.debug_dump_prefs: std_prefs var
DUMP:', $this->std_prefs);
+
$this->msg->dbug->out('email.bopreferences.debug_dump_prefs: cust_prefs var
DUMP:', $this->cust_prefs);
//Header('Location: ' .
$GLOBALS['phpgw']->link('/preferences/index.php'));
//return;
// DEBUG end
@@ -793,7 +623,9 @@
@discussion EXPIRE ANY CACHED ITEM THAT WAS DERIVED FROM A
CHANGED PREF ITEM.
We should be precise and only expire if necessary, but for now
just expire any cached item that could
be effected by a change in preferences. NOTE: we locate this
after we have obtained a reliable
- acctnum which these prefs apply to.
+ acctnum which these prefs apply to. Currently expires these
things, mailsvr_callstr, mailsvr_namespace,
+ mailsvr_delimiter, and folder_list. Note that "folder_list"
requires expiration here because the elements that
+ make up all the folder long, or fully qualified, folder name
probably have changed too.
@author Angles
*/
function expire_related_cached_items($acctnum='')
@@ -803,10 +635,15 @@
{
$acctnum = $this->acctnum;
}
-
+
$GLOBALS['phpgw']->msg->expire_session_cache_item('mailsvr_callstr', $acctnum);
$GLOBALS['phpgw']->msg->expire_session_cache_item('mailsvr_namespace',
$acctnum);
$GLOBALS['phpgw']->msg->expire_session_cache_item('mailsvr_delimiter',
$acctnum);
+ // DAAA! the folder list probably also changes if the
components that make up the Fully Qualified folder name have changed
+
$GLOBALS['phpgw']->msg->expire_session_cache_item('folder_list', $acctnum);
+ // NEW: now we cache all the prefs in bulk cache in the
appsession
+ $my_location = '0;cached_prefs';
+
$GLOBALS['phpgw']->msg->so->so_appsession_passthru($my_location, ' ');
}
/*!
@@ -820,7 +657,7 @@
*/
function grab_set_prefs()
{
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences: call to grab_set_prefs<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences: call to grab_set_prefs<br>'); }
// better make sure we have created the available prefs
schema
$this->init_available_prefs();
@@ -834,7 +671,7 @@
}
else
{
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences: call to grab_set_prefs CALLER UNKNOWN<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences: call to grab_set_prefs CALLER
UNKNOWN<br>'); }
$this->pref_errors .= 'email: bopreferences:
grab_set_prefs: unsupported "caller" variable<br>';
}
}
@@ -860,7 +697,7 @@
*/
function grab_set_prefs_args_gpc()
{
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences: call to grab_set_prefs_args_gpc<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences: call to
grab_set_prefs_args_gpc<br>'); }
// ---- HANDLE GRABBING PREFERENCE GPC HTTP_POST_VARS
ARGS -------
// for abstraction from phpgw UI and from PHP's GPC
data, put the submitted GPC data
// into a class var $this->args[] array. This array is
then used to represent the submitted
@@ -870,7 +707,7 @@
// ---- DEFAULT EMAIL ACCOUNT ----
if
(isset($GLOBALS['phpgw']->msg->ref_POST[$this->submit_token]))
{
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences: INSIDE grab_set_prefs_args_gpc for Default Email Account
data<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences: INSIDE grab_set_prefs_args_gpc for
Default Email Account data<br>'); }
// EXPIRE stuff that may get stale by changing
prefs
$this->expire_related_cached_items(0);
@@ -886,14 +723,14 @@
// existence of $this->submit_token
indicates this data is intended for the default email account
if
(!stristr($this->std_prefs[$i]['accts_usage'], 'default'))
{
- if ($this->debug_set_prefs > 1)
{ echo ' * * (std pref) _SKIP_ this item ['.$this->std_prefs[$i]['id'].'], it
does not apply to the default email account<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out(' * * (std pref) _SKIP_ this item
['.$this->std_prefs[$i]['id'].'], it does not apply to the default email
account<br>'); }
}
else
{
// ok, we have a pref item that
applies to the default email account
$this_pref_name =
$this->std_prefs[$i]['id'];
- if ($this->debug_set_prefs > 1)
{ echo ' * * (std pref) $this_pref_name: '.$this_pref_name.'<br>'; }
- if ($this->debug_set_prefs > 1)
{ echo ' * * (std pref) $GLOBALS[HTTP_POST_VARS][$this_pref_name]:
'.$GLOBALS['phpgw']->msg->ref_POST[$this_pref_name].'<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out(' * * (std pref) $this_pref_name:
'.$this_pref_name.'<br>'); }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out(' * * (std pref)
$GLOBALS[HTTP_POST_VARS][$this_pref_name]:
'.$GLOBALS['phpgw']->msg->ref_POST[$this_pref_name].'<br>'); }
if
(isset($GLOBALS['phpgw']->msg->ref_POST[$this_pref_name]))
{
$this->args[$this_pref_name] =
$GLOBALS['phpgw']->msg->ref_POST[$this_pref_name];
@@ -909,14 +746,14 @@
// existence of $this->submit_token
indicates this data is intended for the default email account
if
(!stristr($this->cust_prefs[$i]['accts_usage'], 'default'))
{
- if ($this->debug_set_prefs > 1)
{ echo ' * * (cust pref) _SKIP_ this item ['.$this->cust_prefs[$i]['id'].'], it
does not apply to the default email account<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out(' * * (cust pref) _SKIP_ this item
['.$this->cust_prefs[$i]['id'].'], it does not apply to the default email
account<br>'); }
}
else
{
// ok, we have a pref item that
applies to the default email account
$this_pref_name =
$this->cust_prefs[$i]['id'];
- if ($this->debug_set_prefs > 1)
{ echo ' * * (cust pref) $this_pref_name: '.$this_pref_name.'<br>'; }
- if ($this->debug_set_prefs > 1)
{ echo ' * * (cust pref) $GLOBALS[HTTP_POST_VARS][$this_pref_name]:
'.$GLOBALS['phpgw']->msg->ref_POST[$this_pref_name].'<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out(' * * (cust pref) $this_pref_name:
'.$this_pref_name.'<br>'); }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out(' * * (cust pref)
$GLOBALS[HTTP_POST_VARS][$this_pref_name]:
'.$GLOBALS['phpgw']->msg->ref_POST[$this_pref_name].'<br>'); }
if
(isset($GLOBALS['phpgw']->msg->ref_POST[$this_pref_name]))
{
$this->args[$this_pref_name] =
$GLOBALS['phpgw']->msg->ref_POST[$this_pref_name];
@@ -927,7 +764,7 @@
// ---- EXTRA EMAIL ACCOUNTS ----
elseif
(isset($GLOBALS['phpgw']->msg->ref_POST[$this->submit_token_extra_accounts]))
{
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences: INSIDE grab_set_prefs_args_gpc for EXTRA EMAIL ACCOUNTS
data<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences: INSIDE grab_set_prefs_args_gpc for
EXTRA EMAIL ACCOUNTS data<br>'); }
//$this->args['submit_prefs'] =
$GLOBALS['phpgw']->msg->ref_POST['submit_prefs'];
$this->args[$this->submit_token_extra_accounts]
= $GLOBALS['phpgw']->msg->ref_POST[$this->submit_token_extra_accounts];
@@ -952,14 +789,14 @@
// extra email accounts
if
(!stristr($this->std_prefs[$i]['accts_usage'], 'extra_accounts'))
{
- if ($this->debug_set_prefs > 1)
{ echo ' * * (std pref) _SKIP_ this item ['.$this->std_prefs[$i]['id'].'], it
does not apply to extra email accounts<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out(' * * (std pref) _SKIP_ this item
['.$this->std_prefs[$i]['id'].'], it does not apply to extra email
accounts<br>'); }
}
else
{
// ok, we have a pref item that
applies to the default email account
$this_pref_name =
$this->std_prefs[$i]['id'];
- if ($this->debug_set_prefs > 1)
{ echo ' * * (std pref) $this_pref_name: '.$this_pref_name.'<br>'; }
- if ($this->debug_set_prefs > 1)
{ echo ' * * (std pref)
$GLOBALS[HTTP_POST_VARS][$this->acctnum('.$this->acctnum.')][$this_pref_name('.$this_pref_name.')]:
['.$GLOBALS['phpgw']->msg->ref_POST[$this->acctnum][$this_pref_name].']<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out(' * * (std pref) $this_pref_name:
'.$this_pref_name.'<br>'); }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out(' * * (std pref)
$GLOBALS[HTTP_POST_VARS][$this->acctnum('.$this->acctnum.')][$this_pref_name('.$this_pref_name.')]:
['.$GLOBALS['phpgw']->msg->ref_POST[$this->acctnum][$this_pref_name].']<br>');
}
if
(isset($GLOBALS['phpgw']->msg->ref_POST[$this->acctnum][$this_pref_name]))
{
$this->args[$this->acctnum][$this_pref_name] =
$GLOBALS['phpgw']->msg->ref_POST[$this->acctnum][$this_pref_name];
@@ -976,14 +813,14 @@
// extra email accounts
if
(!stristr($this->cust_prefs[$i]['accts_usage'], 'extra_accounts'))
{
- if ($this->debug_set_prefs > 1)
{ echo ' * * (cust pref) _SKIP_ this item ['.$this->cust_prefs[$i]['id'].'], it
does not apply to extra email accounts<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out(' * * (cust pref) _SKIP_ this item
['.$this->cust_prefs[$i]['id'].'], it does not apply to extra email
accounts<br>'); }
}
else
{
// ok, we have a pref item that
applies to extra email accounts
$this_pref_name =
$this->cust_prefs[$i]['id'];
- if ($this->debug_set_prefs > 1)
{ echo ' * * (cust pref) $this_pref_name: '.$this_pref_name.'<br>'; }
- if ($this->debug_set_prefs > 1)
{ echo ' * * (cust pref)
$GLOBALS[HTTP_POST_VARS][$this->acctnum('.$this->acctnum.')][$this_pref_name('.$this_pref_name.')]:
['.$GLOBALS['phpgw']->msg->ref_POST[$this->acctnum][$this_pref_name].']<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out(' * * (cust pref) $this_pref_name:
'.$this_pref_name.'<br>'); }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out(' * * (cust pref)
$GLOBALS[HTTP_POST_VARS][$this->acctnum('.$this->acctnum.')][$this_pref_name('.$this_pref_name.')]:
['.$GLOBALS['phpgw']->msg->ref_POST[$this->acctnum][$this_pref_name].']<br>');
}
if
(isset($GLOBALS['phpgw']->msg->ref_POST[$this->acctnum][$this_pref_name]))
{
$this->args[$this->acctnum][$this_pref_name] =
$GLOBALS['phpgw']->msg->ref_POST[$this->acctnum][$this_pref_name];
@@ -1008,7 +845,7 @@
function grab_set_prefs_args_xmlrpc()
{
// STUB, for future use
- echo 'email boprefs: call to un-implemented function
grab_set_prefs_args_xmlrpc';
+ $this->msg->dbug->out('email boprefs: call to
un-implemented function grab_set_prefs_args_xmlrpc<br>');
}
/*!
@@ -1031,13 +868,13 @@
$c_prefs = count($prefs_set);
if ($c_prefs == 0)
{
- if ($this->debug_set_prefs > 1) { echo 'email:
bopreferences: process_submitted_prefs: empty array, no prefs set supplied,
exiting<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences: process_submitted_prefs: empty
array, no prefs set supplied, exiting<br>'); }
return False;
}
for($i=0;$i<$c_prefs;$i++)
{
- if ($this->debug_set_prefs > 1) { echo 'email:
bopreferences: process_submitted_prefs: inside preferences loop ['.$i.']<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences: process_submitted_prefs: inside
preferences loop ['.$i.']<br>'); }
$this_pref = $prefs_set[$i];
@@ -1049,7 +886,7 @@
// we are not supposed to show this
item for the default account, skip this pref item
// continue is used within looping
structures to skip the rest of the current loop
// iteration and continue execution at
the beginning of the next iteration
- if ($this->debug_set_prefs > 1) { echo
'email: bopreferences: process_submitted_prefs: _SKIP_ this item
["'.$this_pref['id'].'"], it does not apply to the default email account<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences: process_submitted_prefs: _SKIP_
this item ["'.$this_pref['id'].'"], it does not apply to the default email
account<br>'); }
continue;
}
@@ -1061,7 +898,7 @@
// ---- OR an empty string was
submitted for this pref item ----
// so how do we handle this, for this
pref...
- if ($this->debug_set_prefs > 1) { echo
'email: bopreferences: process_submitted_prefs: submitted_pref for
["'.$this_pref['id'].'"] not set or empty string<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences: process_submitted_prefs:
submitted_pref for ["'.$this_pref['id'].'"] not set or empty string<br>'); }
if (stristr($this_pref['write_props'],
'empty_no_delete'))
{
// DO NOT DELETE
@@ -1069,7 +906,7 @@
// note there may or may not
actually be an existing value in the prefs table
// but it does not matter here,
because we do not touch this items value at all.
// Typical Usage: passwords
- if ($this->debug_set_prefs > 1)
{ echo 'email: bopreferences: no change to repository for empty or blank
["'.$this_pref['id'].'"] because of "empty_no_delete"<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out('email: bopreferences: no change to repository for
empty or blank ["'.$this_pref['id'].'"] because of "empty_no_delete"<br>'); }
}
elseif
(stristr($this_pref['write_props'], 'empty_string_ok'))
{
@@ -1077,7 +914,7 @@
// i.e. this pref can take an
empty string as a valid value
// whereas most other prefs are
simply deleted from the repository if value is empty
// Typical Usage: email sig,
UWash Mail Folder
- if ($this->debug_set_prefs > 1)
{ echo 'email: bopreferences: save empty string to repository for
["'.$this_pref['id'].'"] because of "empty_string_ok"<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out('email: bopreferences: save empty string to repository
for ["'.$this_pref['id'].'"] because of "empty_string_ok"<br>'); }
// a) as always, delete the
pref before we assign a value
$GLOBALS['phpgw']->preferences->delete('email',$this_pref['id']);
// b) now assign a blank string
value
@@ -1086,7 +923,7 @@
else
{
// just delete it from the
preferences repository
- if ($this->debug_set_prefs > 1)
{ echo 'email: bopreferences: deleting empty or blank pref
["'.$this_pref['id'].'"] from the repository<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out('email: bopreferences: deleting empty or blank pref
["'.$this_pref['id'].'"] from the repository<br>'); }
$GLOBALS['phpgw']->preferences->delete('email',$this_pref['id']);
}
}
@@ -1098,7 +935,7 @@
$submitted_pref =
$this->args[$this_pref['id']];
// init a var to hold the processed
submitted_pref
$processed_pref = '';
- if ($this->debug_set_prefs > 1) { echo
'* * ** email: bopreferences: process_submitted_prefs: submitted_pref:
['.$submitted_pref.']<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('* * ** email: bopreferences: process_submitted_prefs:
submitted_pref: ['.$submitted_pref.']<br>'); }
// most "user_string"s need special
processing before they can go into the repository
if ($this_pref['type'] == 'user_string')
@@ -1149,7 +986,7 @@
// all other data needs no
special processing before going into the repository
$processed_pref =
$submitted_pref;
}
- if ($this->debug_set_prefs > 1) { echo
'email: bopreferences: process_submitted_prefs: about to assign pref
["'.$this_pref['id'].'"] this value, post processing (if any):
<pre>'.$GLOBALS['phpgw']->strip_html($processed_pref).'</pre><br>'."\r\n"; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences: process_submitted_prefs: about to
assign pref ["'.$this_pref['id'].'"] this value, post processing (if any):',
$GLOBALS['phpgw']->strip_html($processed_pref)); }
// a) as always, delete the pref before
we assign a value
$GLOBALS['phpgw']->preferences->delete('email',$this_pref['id']);
@@ -1170,13 +1007,13 @@
*/
function preferences()
{
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.preferences(): ENTERING<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.preferences(): ENTERING<br>'); }
// establish all available prefs for email
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.preferences(): about to call
$this->init_available_prefs()<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.preferences(): about to call
$this->init_available_prefs()<br>'); }
$this->init_available_prefs();
// this will fill $this->args[] array with any
submitted prefs args
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.preferences(): about to call $this->grab_set_prefs()<br>';
}
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.preferences(): about to call
$this->grab_set_prefs()<br>'); }
$this->grab_set_prefs();
// ---- HANDLE SETING PREFERENCE -------
@@ -1188,25 +1025,25 @@
// constructor will initialize
$GLOBALS['phpgw']->msg
// --- Process Standard Prefs ---
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.preferences: about to process Standard Prefs<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.preferences: about to process
Standard Prefs<br>'); }
$this->process_submitted_prefs($this->std_prefs);
// --- Process Custom Prefs ---
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.preferences: about to process Custom Prefs<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.preferences: about to process Custom
Prefs<br>'); }
if (isset($this->args['use_custom_settings']))
{
// custom settings are in use, process
them
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.preferences: custom prefs are in use, calling
$this->process_submitted_prefs($this->cust_prefs)<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.preferences: custom prefs are in
use, calling $this->process_submitted_prefs($this->cust_prefs)<br>'); }
$this->process_submitted_prefs($this->cust_prefs);
}
else
{
// custom settings are NOT being used,
DELETE them from the repository
$c_prefs = count($this->cust_prefs);
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.preferences: custom prefs NOT in use, deleting them<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.preferences: custom prefs NOT in
use, deleting them<br>'); }
for($i=0;$i<$c_prefs;$i++)
{
- if ($this->debug_set_prefs > 2)
{ echo ' *(loop)* email.bopreferences: preferences: deleting custom pref
$this->cust_prefs['.$i.'][id] : ['.$this->cust_prefs[$i]['id'].']<br>'; }
+ if ($this->debug_set_prefs > 2)
{ $this->msg->dbug->out(' *(loop)* email.bopreferences: preferences: deleting
custom pref $this->cust_prefs['.$i.'][id] :
['.$this->cust_prefs[$i]['id'].']<br>'); }
$GLOBALS['phpgw']->preferences->delete('email',$this->cust_prefs[$i]['id']);
}
}
@@ -1214,11 +1051,11 @@
// DONE processing prefs, SAVE to the Repository
if ($this->debug_set_prefs > 1)
{
- echo
'email.bopreferences.preferences(): *debug* at ['.$this->debug_set_prefs.'] so
skipping save_repository<br>';
+
$this->msg->dbug->out('email.bopreferences.preferences(): *debug* at
['.$this->debug_set_prefs.'] so skipping save_repository<br>');
}
else
{
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.preferences(): SAVING REPOSITORY<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.preferences(): SAVING
REPOSITORY<br>'); }
$GLOBALS['phpgw']->preferences->save_repository();
}
// end the email session
@@ -1228,14 +1065,14 @@
$take_me_to_url = $GLOBALS['phpgw']->link(
'/preferences/index.php');
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.preferences(): almost LEAVING, about to issue a redirect
to:<br>'.$take_me_to_url.'<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.preferences(): almost LEAVING, about
to issue a redirect to:<br>'.$take_me_to_url.'<br>'); }
if ($this->debug_set_prefs > 1)
{
- echo
'email.bopreferences.preferences(): LEAVING, *debug* at
['.$this->debug_set_prefs.'] so skipping Header redirection to:
['.$take_me_to_url.']<br>';
+
$this->msg->dbug->out('email.bopreferences.preferences(): LEAVING, *debug* at
['.$this->debug_set_prefs.'] so skipping Header redirection to:
['.$take_me_to_url.']<br>');
}
else
{
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.preferences: LEAVING with redirect to:
<br>'.$take_me_to_url.'<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.preferences: LEAVING with redirect
to: <br>'.$take_me_to_url.'<br>'); }
Header('Location: ' . $take_me_to_url);
}
}
@@ -1403,7 +1240,7 @@
*/
function process_ex_accounts_submitted_prefs($prefs_set='')
{
- if ($this->debug_set_prefs > 0) { echo 'email:
bopreferences: process_ex_accounts_submitted_prefs: ENTERING<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email: bopreferences:
process_ex_accounts_submitted_prefs: ENTERING<br>'); }
// basicly, copy and paste the real
"process_submitted_prefs" and tweak for extra_accounts applicablility
if(!$prefs_set)
{
@@ -1412,25 +1249,25 @@
$c_prefs = count($prefs_set);
if ($c_prefs == 0)
{
- if ($this->debug_set_prefs > 0) { echo 'email:
bopreferences: process_ex_accounts_submitted_prefs: LEAVING, empty array, no
prefs set supplied<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email: bopreferences:
process_ex_accounts_submitted_prefs: LEAVING, empty array, no prefs set
supplied<br>'); }
return False;
}
// ==== ACCTNUM ====
- if ($this->debug_set_prefs > 1) { echo 'email:
bopreferences: process_ex_accounts_submitted_prefs: pre discovery
$this->acctnum : ['.serialize($this->acctnum).']<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences:
process_ex_accounts_submitted_prefs: pre discovery $this->acctnum :
['.serialize($this->acctnum).']<br>'); }
if ((!isset($this->acctnum))
|| ((string)$this->acctnum == ''))
{
$this->acctnum = $this->obtain_ex_acctnum();
}
- if ($this->debug_set_prefs > 1) { echo 'email:
bopreferences: process_ex_accounts_submitted_prefs: post discovery
$this->acctnum : ['.serialize($this->acctnum).']<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences:
process_ex_accounts_submitted_prefs: post discovery $this->acctnum :
['.serialize($this->acctnum).']<br>'); }
for($i=0;$i<$c_prefs;$i++)
{
- if ($this->debug_set_prefs > 1) { echo ' <b>*
(next loop) *</b> email: bopreferences: process_ex_accounts_submitted_prefs:
inside preferences loop ['.$i.']<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out(' <b>* (next loop) *</b> email: bopreferences:
process_ex_accounts_submitted_prefs: inside preferences loop ['.$i.']<br>'); }
$this_pref = $prefs_set[$i];
- if ($this->debug_set_prefs > 1) { echo 'email:
bopreferences: process_ex_accounts_submitted_prefs: $this_pref =
$prefs_set['.$i.'] : $this_pref DUMP:<pre>'; print_r($prefs_set[$i]); echo
'</pre>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences:
process_ex_accounts_submitted_prefs: $this_pref = $prefs_set['.$i.'] :
$this_pref DUMP:', $prefs_set[$i]); }
// ---- skip this item logic ----
// we are ONLY concerned with items that apply
to the extra email accounts
@@ -1439,7 +1276,7 @@
// we are not supposed to handle this
item for the extra email accounts, skip this pref item
// continue is used within looping
structures to skip the rest of the current loop
// iteration and continue execution at
the beginning of the next iteration
- if ($this->debug_set_prefs > 1) { echo
'email: bopreferences: process_ex_accounts_submitted_prefs: _SKIP_ this item
["'.$this_pref['id'].'"], it does not apply to Extra Email Accounts <br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences:
process_ex_accounts_submitted_prefs: _SKIP_ this item ["'.$this_pref['id'].'"],
it does not apply to Extra Email Accounts <br>'); }
continue;
}
@@ -1449,7 +1286,7 @@
{
// nothing submitted for this
preference item
// OR an empty string was submitted for
this pref item
- if ($this->debug_set_prefs > 1) { echo
'email: bopreferences: process_ex_accounts_submitted_prefs: submitted_pref for
["'.$this_pref['id'].'"] not set or empty string<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences:
process_ex_accounts_submitted_prefs: submitted_pref for
["'.$this_pref['id'].'"] not set or empty string<br>'); }
if (stristr($this_pref['write_props'],
'empty_no_delete'))
{
// DO NOT DELETE
@@ -1457,7 +1294,7 @@
// note there may or may not
actually be an existing value in the prefs table
// but it does not matter here,
because we do not touch this items value at all.
// Typical Usage: passwords
- if ($this->debug_set_prefs > 1)
{ echo 'email: bopreferences: process_ex_accounts_submitted_prefs: no change to
repository for empty or blank ["'.$this_pref['id'].'"] because of
"empty_no_delete"<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out('email: bopreferences:
process_ex_accounts_submitted_prefs: no change to repository for empty or blank
["'.$this_pref['id'].'"] because of "empty_no_delete"<br>'); }
}
elseif
(stristr($this_pref['write_props'], 'empty_string_ok'))
{
@@ -1465,21 +1302,21 @@
// i.e. this pref can take an
empty string as a valid value
// whereas most other prefs are
simply deleted from the repository if value is empty
// Typical Usage: email sig,
UWash Mail Folder
- if ($this->debug_set_prefs > 1)
{ echo 'email: bopreferences process_ex_accounts_submitted_prefs: save empty
string to repository for ["'.$this_pref['id'].'"] because of
"empty_string_ok"<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out('email: bopreferences
process_ex_accounts_submitted_prefs: save empty string to repository for
["'.$this_pref['id'].'"] because of "empty_string_ok"<br>'); }
// a) as always, delete the
pref before we assign a value
$pref_struct_str =
'["ex_accounts"]['.$this->acctnum.']["'.$this_pref['id'].'"]';
- if ($this->debug_set_prefs > 1)
{ echo 'email: bopreferences process_ex_accounts_submitted_prefs: using
preferences->delete_struct("email", $pref_struct_str) which will eval
$pref_struct_str='.$pref_struct_str.'<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out('email: bopreferences
process_ex_accounts_submitted_prefs: using preferences->delete_struct("email",
$pref_struct_str) which will eval $pref_struct_str='.$pref_struct_str.'<br>'); }
$GLOBALS['phpgw']->preferences->delete_struct('email',$pref_struct_str);
// b) now assign a blank string
value
- if ($this->debug_set_prefs > 1)
{ echo 'email: bopreferences: process_ex_accounts_submitted_prefs: using
preferences->add_struct("email", $pref_struct_str, \'\') which will eval
$pref_struct_str='.$pref_struct_str.'<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out('email: bopreferences:
process_ex_accounts_submitted_prefs: using preferences->add_struct("email",
$pref_struct_str, \'\') which will eval
$pref_struct_str='.$pref_struct_str.'<br>'); }
$GLOBALS['phpgw']->preferences->add_struct('email',$pref_struct_str,'');
}
else
{
// just delete it from the
preferences repository
- if ($this->debug_set_prefs > 1)
{ echo 'email: bopreferences: process_ex_accounts_submitted_prefs deleting
empty or blank pref ["'.$this_pref['id'].'"] from the repository<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out('email: bopreferences:
process_ex_accounts_submitted_prefs deleting empty or blank pref
["'.$this_pref['id'].'"] from the repository<br>'); }
$pref_struct_str =
'["ex_accounts"]['.$this->acctnum.']["'.$this_pref['id'].'"]';
- if ($this->debug_set_prefs > 1)
{ echo 'email: bopreferences: process_ex_accounts_submitted_prefs: using
preferences->delete_struct("email", $pref_struct_str) which will eval
$pref_struct_str='.$pref_struct_str.'<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out('email: bopreferences:
process_ex_accounts_submitted_prefs: using preferences->delete_struct("email",
$pref_struct_str) which will eval $pref_struct_str='.$pref_struct_str.'<br>'); }
$GLOBALS['phpgw']->preferences->delete_struct('email',$pref_struct_str);
}
}
@@ -1489,7 +1326,7 @@
$submitted_pref =
$this->args[$this->acctnum][$this_pref['id']];
// init a var to hold the processed
submitted_pref
$processed_pref = '';
- if ($this->debug_set_prefs > 1) { echo
'* * email: bopreferences: process_ex_accounts_submitted_prefs:
submitted_pref: ['.$submitted_pref.']<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('* * email: bopreferences:
process_ex_accounts_submitted_prefs: submitted_pref:
['.$submitted_pref.']<br>'); }
// most "user_string"s need special
processing before they can go into the repository
if ($this_pref['type'] == 'user_string')
@@ -1529,14 +1366,14 @@
// all other data needs no
special processing before going into the repository
$processed_pref =
$submitted_pref;
}
- if ($this->debug_set_prefs > 1) { echo
'email: bopreferences: process_ex_accounts_submitted_prefs: about to assign
pref ["'.$this_pref['id'].'"] this value, post processing (if any):
<pre>'.$GLOBALS['phpgw']->strip_html($processed_pref).'</pre><br>'."\r\n"; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences:
process_ex_accounts_submitted_prefs: about to assign pref
["'.$this_pref['id'].'"] this value, post processing (if any):',
$GLOBALS['phpgw']->strip_html($processed_pref)); }
// a) as always, delete the pref before
we assign a value
$pref_struct_str =
'["ex_accounts"]['.$this->acctnum.']["'.$this_pref['id'].'"]';
- if ($this->debug_set_prefs > 1) { echo
'email: bopreferences process_ex_accounts_submitted_prefs: using
preferences->delete_struct("email", $pref_struct_str) which will eval
$pref_struct_str='.$pref_struct_str.'<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences
process_ex_accounts_submitted_prefs: using preferences->delete_struct("email",
$pref_struct_str) which will eval $pref_struct_str='.$pref_struct_str.'<br>'); }
$GLOBALS['phpgw']->preferences->delete_struct('email',$pref_struct_str);
// b) now assign that processed data to
this pref item in the repository
- if ($this->debug_set_prefs > 1) { echo
'email: bopreferences: process_ex_accounts_submitted_prefs: using
preferences->add_struct("email", $pref_struct_str, $processed_pref) which will
eval $pref_struct_str='.$pref_struct_str.'<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences:
process_ex_accounts_submitted_prefs: using preferences->add_struct("email",
$pref_struct_str, $processed_pref) which will eval
$pref_struct_str='.$pref_struct_str.'<br>'); }
$GLOBALS['phpgw']->preferences->add_struct('email', $pref_struct_str,
$processed_pref);
// SORT THAT ARRAY by key, so the
integer array heys go from lowest to hightest
ksort($GLOBALS['phpgw']->preferences->data['email']['ex_accounts']);
@@ -1556,9 +1393,9 @@
*/
function ex_accounts_delete($acctnum='')
{
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.ex_accounts_delete ENTERING feed acctnum:
['.serialize($acctnum).']<br>'; }
- if ($this->debug_set_prefs > 2) { echo 'email:
bopreferences.ex_accounts_delete: $GLOBALS[HTTP_POST_VARS] dump<pre>';
print_r($GLOBALS['phpgw']->msg->ref_POST); echo '</pre>'; }
- if ($this->debug_set_prefs > 2) { echo 'email:
bopreferences.ex_accounts_delete: $GLOBALS[HTTP_GET_VARS] dump<pre>';
print_r($GLOBALS['phpgw']->msg->ref_GET); echo '</pre>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_delete ENTERING feed
acctnum: ['.serialize($acctnum).']<br>'); }
+ if ($this->debug_set_prefs > 2) {
$this->msg->dbug->out('email: bopreferences.ex_accounts_delete:
$GLOBALS[HTTP_POST_VARS] DUMP:', $GLOBALS['phpgw']->msg->ref_POST); }
+ if ($this->debug_set_prefs > 2) {
$this->msg->dbug->out('email: bopreferences.ex_accounts_delete:
$GLOBALS[HTTP_GET_VARS] DUMP:', $GLOBALS['phpgw']->msg->ref_GET); }
$this->account_group = 'extra_accounts';
@@ -1576,19 +1413,19 @@
}
$actually_did_something = False;
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.ex_accounts_delete obtained acctnum
['.$this->acctnum.']<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_delete obtained acctnum
['.$this->acctnum.']<br>'); }
if ((isset($this->acctnum))
&& ((string)$this->acctnum != ''))
{
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.ex_accounts_delete obtained VALID acctnum
['.$this->acctnum.'], proceed...<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_delete obtained VALID
acctnum ['.$this->acctnum.'], proceed...<br>'); }
// delete the extra account pref item
$pref_struct_str =
'["ex_accounts"]['.$this->acctnum.']';
- if ($this->debug_set_prefs > 1) { echo 'email:
bopreferences.ex_accounts_delete: using preferences->delete_struct("email",
$pref_struct_str) which will eval $pref_struct_str='.$pref_struct_str.'<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences.ex_accounts_delete: using
preferences->delete_struct("email", $pref_struct_str) which will eval
$pref_struct_str='.$pref_struct_str.'<br>'); }
$GLOBALS['phpgw']->preferences->delete_struct('email',$pref_struct_str);
- if ($this->debug_set_prefs > 1) { echo 'email:
bopreferences.ex_accounts_delete: $GLOBALS[phpgw]->preferences->data
dump<pre>'; print_r($GLOBALS['phpgw']->preferences->data); echo '</pre>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences.ex_accounts_delete:
$GLOBALS[phpgw]->preferences->data DUMP:',
$GLOBALS['phpgw']->preferences->data); }
// let the code below this block know we
actually did something that requires saving the repository
$actually_did_something = True;
}
@@ -1597,12 +1434,12 @@
if (!$actually_did_something)
{
// nothing happened above that requires saving
the repository
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.ex_accounts_delete: nothing happened that requires
save_repository,
$actually_did_something='.serialize($actually_did_something).'<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_delete: nothing happened
that requires save_repository,
$actually_did_something='.serialize($actually_did_something).'<br>'); }
}
elseif ($this->debug_set_prefs > 2)
{
// we actually did something that requires
saving repository, but are we in debug mode
- echo 'email.bopreferences.ex_accounts_delete:
*debug* skipping save_repository<br>';
+
$this->msg->dbug->out('email.bopreferences.ex_accounts_delete: *debug* skipping
save_repository<br>');
}
else
{
@@ -1617,7 +1454,7 @@
// redirect user back to main preferences page
if ($this->debug_set_prefs > 2)
{
- echo 'email.bopreferences.ex_accounts_delete:
*debug* skipping Header redirection<br>';
+
$this->msg->dbug->out('email.bopreferences.ex_accounts_delete: *debug* skipping
Header redirection<br>');
}
else
{
@@ -1625,7 +1462,7 @@
'/index.php',
'menuaction=email.uipreferences.ex_accounts_list');
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.ex_accounts_delete: LEAVING with redirect to:
['.$take_me_to_url.']<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_delete: LEAVING with
redirect to: ['.$take_me_to_url.']<br>'); }
Header('Location: ' . $take_me_to_url);
}
}
@@ -1639,9 +1476,9 @@
*/
function ex_accounts_edit($acctnum='')
{
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.ex_accounts_edit ENTERING <br>'; }
- if ($this->debug_set_prefs > 2) { echo 'email:
bopreferences.ex_accounts_edit: $GLOBALS[HTTP_POST_VARS] dump<pre>';
print_r($GLOBALS['phpgw']->msg->ref_POST); echo '</pre>'; }
- if ($this->debug_set_prefs > 2) { echo 'email:
bopreferences.ex_accounts_edit: $GLOBALS[HTTP_GET_VARS] dump<pre>';
print_r($GLOBALS['phpgw']->msg->ref_GET); echo '</pre>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_edit ENTERING <br>'); }
+ if ($this->debug_set_prefs > 2) {
$this->msg->dbug->out('email: bopreferences.ex_accounts_edit:
$GLOBALS[HTTP_POST_VARS] DUMP:', $GLOBALS['phpgw']->msg->ref_POST); }
+ if ($this->debug_set_prefs > 2) {
$this->msg->dbug->out('email: bopreferences.ex_accounts_edit:
$GLOBALS[HTTP_GET_VARS] DUMP:', $GLOBALS['phpgw']->msg->ref_GET); }
// ==== ACCTNUM ====
// this tells people that we are dealing with the extra
email accounts
@@ -1667,7 +1504,7 @@
// this will fill $this->args[] array with any
submitted prefs args
$this->grab_set_prefs();
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.ex_accounts_edit(): just passed this->grab_set_prefs<br>';
}
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_edit(): just passed
this->grab_set_prefs<br>'); }
// ---- HANDLE SETING PREFERENCE -------
if
(isset($this->args[$this->submit_token_extra_accounts]))
@@ -1681,18 +1518,18 @@
// constructor will (has taken care of)
initialize $GLOBALS['phpgw']->msg
// --- Process Standard Prefs ---
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.ex_accounts_edit(): about to
process_ex_accounts_submitted_prefs Standard Prefs<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_edit(): about to
process_ex_accounts_submitted_prefs Standard Prefs<br>'); }
$this->process_ex_accounts_submitted_prefs($this->std_prefs);
// --- Process Custom Prefs ---
// CUSTOM PREFS ARE MANDATORY! FOR EXTRA
ACCOUNTS
// first, delete whatever value was there for
"use custom settings" (during pre-release, at times this actually was an
option, make sure it's gone grom the db)
$pref_struct_str =
'["ex_accounts"]['.$this->acctnum.']["'.$this->cust_prefs[0]['id'].'"]';
- if ($this->debug_set_prefs > 1) { echo 'email:
bopreferences.ex_accounts_edit(): "use_custom_settings" pref, delete it,
reference it by
["ex_accounts"][$this->acctnum]["$this->cust_prefs[0][id]"]<br>'; }
- if ($this->debug_set_prefs > 1) { echo 'email:
bopreferences.ex_accounts_edit(): using preferences->delete_struct("email",
$pref_struct_str) which will eval $pref_struct_str='.$pref_struct_str.'<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences.ex_accounts_edit():
"use_custom_settings" pref, delete it, reference it by
["ex_accounts"][$this->acctnum]["$this->cust_prefs[0][id]"]<br>'); }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences.ex_accounts_edit(): using
preferences->delete_struct("email", $pref_struct_str) which will eval
$pref_struct_str='.$pref_struct_str.'<br>'); }
$GLOBALS['phpgw']->preferences->delete_struct('email',$pref_struct_str);
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.ex_accounts_edit(): about to
process_ex_accounts_submitted_prefs Custom Prefs, which are MANDATORY for extra
email accounts<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_edit(): about to
process_ex_accounts_submitted_prefs Custom Prefs, which are MANDATORY for extra
email accounts<br>'); }
$this->process_ex_accounts_submitted_prefs($this->cust_prefs);
/*
@@ -1719,24 +1556,24 @@
}
*/
- if ($this->debug_set_prefs > 1) { echo 'email:
bopreferences.ex_accounts_edit: $GLOBALS[phpgw]->preferences->data dump<pre>';
print_r($GLOBALS['phpgw']->preferences->data); echo '</pre>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email: bopreferences.ex_accounts_edit:
$GLOBALS[phpgw]->preferences->data DUMP:',
$GLOBALS['phpgw']->preferences->data); }
}
// DONE processing prefs, SAVE to the Repository
if (!$actually_did_something)
{
// nothing happened above that requires saving
the repository
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.ex_accounts_edit(): nothing happened that requires
save_repository,
$actually_did_something='.serialize($actually_did_something).'<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_edit(): nothing happened
that requires save_repository,
$actually_did_something='.serialize($actually_did_something).'<br>'); }
}
elseif ($this->debug_set_prefs > 1)
{
// we actually did something that requires
saving repository, but are we in debug mode
- echo 'email.bopreferences.ex_accounts_edit():
*debug* at ['.$this->debug_set_prefs.'] so skipping save_repository<br>';
+
$this->msg->dbug->out('email.bopreferences.ex_accounts_edit(): *debug* at
['.$this->debug_set_prefs.'] so skipping save_repository<br>');
}
else
{
// we actually did something that requires
saving repository, and we have the go-ahead
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.ex_accounts_edit(): SAVING REPOSITORY<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_edit(): SAVING
REPOSITORY<br>'); }
$GLOBALS['phpgw']->preferences->save_repository();
}
@@ -1751,14 +1588,14 @@
'/index.php',
'menuaction=email.uipreferences.ex_accounts_list');
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.ex_accounts_edit(): almost LEAVING, about to issue a
redirect to:<br>'.$take_me_to_url.'<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_edit(): almost LEAVING,
about to issue a redirect to:<br>'.$take_me_to_url.'<br>'); }
if ($this->debug_set_prefs > 1)
{
- echo 'email.bopreferences.ex_accounts_edit():
LEAVING, *debug* at ['.$this->debug_set_prefs.'] so skipping Header redirection
to: ['.$take_me_to_url.']<br>';
+
$this->msg->dbug->out('email.bopreferences.ex_accounts_edit(): LEAVING, *debug*
at ['.$this->debug_set_prefs.'] so skipping Header redirection to:
['.$take_me_to_url.']<br>');
}
else
{
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.ex_accounts_edit: LEAVING with redirect to:
<br>'.$take_me_to_url.'<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_edit: LEAVING with
redirect to: <br>'.$take_me_to_url.'<br>'); }
Header('Location: ' . $take_me_to_url);
}
}
@@ -1771,7 +1608,7 @@
*/
function ex_accounts_list()
{
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.ex_accounts_list: ENTERING<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_list: ENTERING<br>'); }
// list accounts, except "empty" ones (show "enabled"
and "disabled"
$return_list = array();
@@ -1781,14 +1618,14 @@
$this_acctnum =
$GLOBALS['phpgw']->msg->extra_accounts[$i]['acctnum'];
$this_status =
$GLOBALS['phpgw']->msg->extra_accounts[$i]['status'];
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.ex_accounts_list:
$GLOBALS[phpgw]->msg->extra_accounts['.$i.'][acctnum]=['.$this_acctnum.'] ;
[status]=['.$this->extra_accounts[$i]['status'].'] <br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_list:
$GLOBALS[phpgw]->msg->extra_accounts['.$i.'][acctnum]=['.$this_acctnum.'] ;
[status]=['.$this->extra_accounts[$i]['status'].'] <br>'); }
if ($this_status == 'empty')
{
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.ex_accounts_list:
$GLOBALS[phpgw]->msg->extra_accounts['.$i.'][status] == empty <br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_list:
$GLOBALS[phpgw]->msg->extra_accounts['.$i.'][status] == empty <br>'); }
}
else
{
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.ex_accounts_list:
$GLOBALS[phpgw]->msg->extra_accounts['.$i.'][status] != empty <br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_list:
$GLOBALS[phpgw]->msg->extra_accounts['.$i.'][status] != empty <br>'); }
$next_pos = count($return_list);
//$next_pos = $this_acctnum - 1;
$return_list[$next_pos]['acctnum'] =
$this_acctnum;
@@ -1857,11 +1694,11 @@
}
// NEXT: html encode the acctname string
// html encode entities on the fullname
so it's safe to display in the browser, and prefix with the acctnum
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.ex_accounts_list: fullname raw:
<code>'.serialize($accountname).'</code><br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_list: fullname raw:
<code>'.serialize($accountname).'</code><br>'); }
$accountname =
$GLOBALS['phpgw']->msg->htmlspecialchars_decode($accountname);
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.ex_accounts_list: fullname B:
<code>'.serialize($accountname).'</code><br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_list: fullname B:
<code>'.serialize($accountname).'</code><br>'); }
$accountname =
$GLOBALS['phpgw']->msg->htmlspecialchars_encode($accountname);
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.ex_accounts_list: fullname C:
<code>'.serialize($accountname).'</code><br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_list: fullname C:
<code>'.serialize($accountname).'</code><br>'); }
// FINALLY we have a string we are
going to display to the user that is the name of the account
$return_list[$next_pos]['display_string'] = '['.$this_acctnum.'] '.$accountname;
@@ -1878,8 +1715,8 @@
$return_list[$next_pos]['delete_href']
= '<a href="'.$return_list[$next_pos]['delete_url'].'">'.lang('Delete').'</a>';
}
}
- if ($this->debug_set_prefs > 2) { echo
'email.bopreferences.ex_accounts_list: returning $return_list[] : <pre>';
print_r($return_list); echo '</pre>'; }
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.ex_accounts_list: LEAVING, returning $return_list <br>'; }
+ if ($this->debug_set_prefs > 2) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_list: returning
$return_list[] DUMP:', $return_list); }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.ex_accounts_list: LEAVING, returning
$return_list <br>'); }
return $return_list;
}
@@ -1891,12 +1728,12 @@
*/
function get_first_empty_ex_acctnum()
{
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.get_first_empty_ex_acctnum: ENTERING<br>'; }
- if ($this->debug_set_prefs > 2) { echo 'email:
bopreferences.get_first_empty_ex_acctnum: $GLOBALS[phpgw]->msg->extra_accounts
dump<pre>'; print_r($GLOBALS['phpgw']->msg->extra_accounts); echo '</pre>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.get_first_empty_ex_acctnum:
ENTERING<br>'); }
+ if ($this->debug_set_prefs > 2) {
$this->msg->dbug->out('email: bopreferences.get_first_empty_ex_acctnum:
$GLOBALS[phpgw]->msg->extra_accounts DUMP:',
$GLOBALS['phpgw']->msg->extra_accounts); }
$loops = count($GLOBALS['phpgw']->msg->extra_accounts);
if ($loops == 0)
{
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.get_first_empty_ex_acctnum:
count($GLOBALS[phpgw]->msg->extra_accounts
=['.serialize(count($GLOBALS['phpgw']->msg->extra_accounts)).']<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.get_first_empty_ex_acctnum:
count($GLOBALS[phpgw]->msg->extra_accounts
=['.serialize(count($GLOBALS['phpgw']->msg->extra_accounts)).']<br>'); }
$first_empty_ex_acctnum = 1;
}
else
@@ -1907,10 +1744,10 @@
$this_acctnum =
$GLOBALS['phpgw']->msg->extra_accounts[$i]['acctnum'];
$this_status =
$GLOBALS['phpgw']->msg->extra_accounts[$i]['status'];
// loop =0 *would* = acctnum 1 *if*
acctnum slots are filled in order, they'd always be 1 apart
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.get_first_empty_ex_acctnum: in loop ['.$i.'] : status:
['.$this_status.'] ; acctnum: ['.$this_acctnum.']<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.get_first_empty_ex_acctnum: in loop
['.$i.'] : status: ['.$this_status.'] ; acctnum: ['.$this_acctnum.']<br>'); }
if ($this_status == 'empty')
{
- if ($this->debug_set_prefs > 1)
{ echo 'email.bopreferences.get_first_empty_ex_acctnum: [status] == empty for
acctnum ['.$this_acctnum.']<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out('email.bopreferences.get_first_empty_ex_acctnum:
[status] == empty for acctnum ['.$this_acctnum.']<br>'); }
$first_empty_ex_acctnum =
(int)$this_acctnum;
$did_get_acctnum = True;
break;
@@ -1918,7 +1755,7 @@
elseif ((int)($i+1) !=
(int)$this_acctnum)
{
$first_empty_ex_acctnum =
(int)($i+1);
- if ($this->debug_set_prefs > 1)
{ echo 'email.bopreferences.get_first_empty_ex_acctnum: slots have an empty
spot, unused $acctnum is ['.$first_empty_ex_acctnum.']<br>'; }
+ if ($this->debug_set_prefs > 1)
{ $this->msg->dbug->out('email.bopreferences.get_first_empty_ex_acctnum: slots
have an empty spot, unused $acctnum is ['.$first_empty_ex_acctnum.']<br>'); }
$did_get_acctnum = True;
break;
}
@@ -1929,10 +1766,10 @@
$first_empty_ex_acctnum =
count($GLOBALS['phpgw']->msg->extra_accounts);
// since extra accounts are not zero
based, add one to that count to get real next available
$first_empty_ex_acctnum++;
- if ($this->debug_set_prefs > 1) { echo
'email.bopreferences.get_first_empty_ex_acctnum: no empty spaces
extra_accounts[], advance to next int: $first_empty_ex_acctnum
['.$first_empty_ex_acctnum.']<br>'; }
+ if ($this->debug_set_prefs > 1) {
$this->msg->dbug->out('email.bopreferences.get_first_empty_ex_acctnum: no empty
spaces extra_accounts[], advance to next int: $first_empty_ex_acctnum
['.$first_empty_ex_acctnum.']<br>'); }
}
}
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.get_first_empty_ex_acctnum: LEAVING, returning
$first_empty_ex_acctnum ['.serialize($first_empty_ex_acctnum).']<br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.get_first_empty_ex_acctnum: LEAVING,
returning $first_empty_ex_acctnum
['.serialize($first_empty_ex_acctnum).']<br>'); }
return $first_empty_ex_acctnum;
}
@@ -1944,9 +1781,9 @@
*/
function obtain_ex_acctnum()
{
- if ($this->debug_set_prefs > 0) { echo 'email:
bopreferences.obtain_ex_acctnum: ENTERING<br>'; }
- if ($this->debug_set_prefs > 2) { echo 'email:
bopreferences.obtain_ex_acctnum: $GLOBALS[HTTP_POST_VARS] dump<pre>';
print_r($GLOBALS['phpgw']->msg->ref_POST); echo '</pre>'; }
- if ($this->debug_set_prefs > 2) { echo 'email:
bopreferences.obtain_ex_acctnum: $GLOBALS[HTTP_GET_VARS] dump<pre>';
print_r($GLOBALS['phpgw']->msg->ref_GET); echo '</pre>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email: bopreferences.obtain_ex_acctnum: ENTERING<br>'); }
+ if ($this->debug_set_prefs > 2) {
$this->msg->dbug->out('email: bopreferences.obtain_ex_acctnum:
$GLOBALS[HTTP_POST_VARS] DUMP:', $GLOBALS['phpgw']->msg->ref_POST); }
+ if ($this->debug_set_prefs > 2) {
$this->msg->dbug->out('email: bopreferences.obtain_ex_acctnum:
$GLOBALS[HTTP_GET_VARS] DUMP:', $GLOBALS['phpgw']->msg->ref_GET); }
// get fromPOST or GET
$prelim_acctnum = '##NOTHING##';
if
((isset($GLOBALS['phpgw']->msg->ref_POST['ex_acctnum'])
@@ -1975,7 +1812,7 @@
{
$final_acctnum = $prelim_acctnum;
}
- if ($this->debug_set_prefs > 0) { echo
'email.bopreferences.obtain_ex_acctnum: LEAVING, returning $final_acctnum:
['.serialize($final_acctnum).'] <br>'; }
+ if ($this->debug_set_prefs > 0) {
$this->msg->dbug->out('email.bopreferences.obtain_ex_acctnum: LEAVING,
returning $final_acctnum: ['.serialize($final_acctnum).'] <br>'); }
return $final_acctnum;
}
====================================================
Index: email/inc/class.bomessage.inc.php
diff -u email/inc/class.bomessage.inc.php:1.14
email/inc/class.bomessage.inc.php:1.15
--- email/inc/class.bomessage.inc.php:1.14 Fri Mar 14 04:00:10 2003
+++ email/inc/class.bomessage.inc.php Thu Dec 30 23:13:50 2004
@@ -26,14 +26,30 @@
var $public_functions = array(
'message_data' => True
);
+ // Convience var REFERENCE to globals[phpgw]->msg
+ var $msg='##NOTHING##';
+
var $preserve_no_fmt = True;
//var $preserve_no_fmt = False;
var $no_fmt='';
+ // maximum number of TO and CC addresses to show, too many will
error message display
+ var $max_to_loops = 15;
+ var $max_cc_loops = 15;
+
+ // do we show both plain and enhanced (html, apple "enriched")
parts of an alternative set
+ // or do we hide the simpler plain part of the pair
+ var $hide_alt_hide = True;
+ //var $hide_alt_hide = False;
+
var $debug = 0;
//var $debug = 2;
//var $debug = 3;
+ // Special Debug data assembled about the message
+ var $show_debug_parts_summary=0;
+ //var $show_debug_parts_summary=1;
+
var $debug_nav = 0;
// prefs should fill this in with users preference
@@ -53,7 +69,7 @@
@function bomessage
@abtract *constructor*
@discussion fills the "langs" vars including the "lang_warn"
langs which are use to notify user
- of some common "bad" message attachments or other bad content.
+ of some common "bad" message attachments or other bad content.
*/
function bomessage()
{
@@ -135,12 +151,21 @@
so that the lang files have something directly to match
up to.
@author Angles
*/
- $this->xi['lang_warn_has_iframe_maybe_klez'] =
lang('warn_has_iframe_maybe_klez');
- $this->xi['lang_warn_script_tags'] =
lang('warn_script_tags');
- $this->xi['lang_warn_b64_encoded_displayable'] =
lang('warn_b64_encoded_displayable');
- $this->xi['lang_warn_attachment_only_mail'] =
lang('warn_attachment_only_mail');
- $this->xi['lang_warn_attachment_name_dangerous'] =
lang('warn_attachment_name_DANGEROUS');
- $this->xi['lang_warn_style_sheet'] =
lang('warn_style_sheet');
+ //$this->xi['lang_warn_has_iframe_maybe_klez'] =
lang('warn_has_iframe_maybe_klez');
+ //$this->xi['lang_warn_script_tags'] =
lang('warn_script_tags');
+ //$this->xi['lang_warn_b64_encoded_displayable'] =
lang('warn_b64_encoded_displayable');
+ //$this->xi['lang_warn_attachment_only_mail'] =
lang('warn_attachment_only_mail');
+ //$this->xi['lang_warn_attachment_name_dangerous'] =
lang('warn_attachment_name_DANGEROUS');
+ //$this->xi['lang_warn_style_sheet'] =
lang('warn_style_sheet');
+ // Reiner Jung recommends putting the whole phrase
right here instead of the lang file
+ // it seems to make it easier for the translator to see
the these as an example to translate
+ $this->xi['lang_warn_has_iframe_maybe_klez'] =
lang('html messages with the IFRAME tag may be KLEZ or other worm emails.');
+ $this->xi['lang_warn_script_tags'] = lang(' a scrips
tag block of code, javascript or otherwise, is in an inline html message. Not
necessarily bad, but user may want to know. This is SCRIPT ... code ... SCRIPT
blocks, not the "OnMouseOver" stuff.');
+ $this->xi['lang_warn_b64_encoded_displayable'] =
lang('It is not RFC standard to base64 encode a part of a message that is NOT
an attachment. NOTE this check is currently done after the message is already
being viewed, it should probably stop the message from being automatically
displayed, i.e. give a "show this" button instead.');
+ $this->xi['lang_warn_attachment_only_mail'] =
lang('There is no text or other part of the email to display to the user, all
part(s) are attachments.');
+ $this->xi['lang_warn_attachment_name_dangerous'] =
lang('Message has an attachment that is some kind of script or exe file that
Windows users should be warned not to click on it. These are filenames like
attachments the end with the usual "bad stuff", such as bat, inf, pif, com,
exe, reg, vbs, and scr');
+ $this->xi['lang_warn_style_sheet'] = lang('This is
really a visual template conflict issue. The phpGW template already has it own
CSS, and style sheets are cascading, subsequent CSS can be inherited by the
page and TOTALLY B0RK the look of the template theme. Or maybe not, only
certain CSS tags are really capable of this such as the css BODY property, or
the A (href) properties.');
+
if ($this->debug > 2) { echo
'class.bomessage.*constructor* ('.__LINE__.'): langs put in $this->xi
DUMP:<pre>'; print_r($this->xi); echo '</pre>'; }
@@ -158,12 +183,19 @@
ui and bomessage classes is located here.
*/
function message_data()
- {
- if ($this->debug > 0) { echo 'ENTERING:
email.bomessage.message_data'.'<br>'; }
-
+ {
// make sure we have msg object and a server stream
- $this->msg_bootstrap =
CreateObject("email.msg_bootstrap");
-
$this->msg_bootstrap->ensure_mail_msg_exists('email.bomessage.message_data',
$this->debug);
+ $this->msg_bootstrap =
CreateObject('email.msg_bootstrap');
+
//$this->msg_bootstrap->ensure_mail_msg_exists('email.bomessage.message_data('.__LINE__.')',
$this->debug);
+
$this->msg_bootstrap->ensure_mail_msg_exists('email.bomessage.message_data('.__LINE__.')');
+ // we know we have msg object, now make convience
reference
+ if ($this->msg == '##NOTHING##')
+ {
+ $this->msg =& $GLOBALS['phpgw']->msg;
+ }
+ // now we can use msg object debug calls
+ if ($this->debug > 0) {
$this->msg->dbug->out('ENTERING:
email.bomessage.message_data('.__LINE__.')'.'<br>'); }
+
// ---- BEGIN BOMESSAGE ----
@@ -246,6 +278,7 @@
$this->xi['mailsvr_supports_folders'] =
$GLOBALS['phpgw']->msg->get_mailsvr_supports_folders();
if ($this->xi['mailsvr_supports_folders'])
{
+ /*
$feed_args = Array();
$feed_args = Array(
'mailsvr_stream' => '',
@@ -259,6 +292,13 @@
'first_line_txt' =>
$this->xi['lang_move_this_message_into']
);
$this->xi['delmov_listbox'] =
$GLOBALS['phpgw']->msg->all_folders_listbox($feed_args);
+ */
+ // UPDATE use the newer widgets high level
function
+ $my_cbox_widgets =
CreateObject('email.html_widgets');
+ $skip_fldball = array();
+ $skip_fldball['acctnum'] =
$GLOBALS['phpgw']->msg->get_acctnum();
+ $skip_fldball['folder'] =
$GLOBALS['phpgw']->msg->prep_folder_out($GLOBALS['phpgw']->msg->get_arg_value('folder'));
+ $this->xi['delmov_listbox'] =
$my_cbox_widgets->all_folders_combobox('delmov', True, $skip_fldball,
$this->xi['lang_move_this_message_into']);
}
else
{
@@ -275,10 +315,14 @@
// ---- General Information about The Message -----
$msgball =
$GLOBALS['phpgw']->msg->get_arg_value('msgball');
- if ($this->debug > 2) { echo
'email.bomessage.message_data: get_arg_value("msgball") dump: <pre>';
print_r($msgball); echo '</pre>'; }
+
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): processed
msgball DUMP:', $msgball); }
$msg_struct =
$GLOBALS['phpgw']->msg->phpgw_fetchstructure($msgball);
$msg_headers =
$GLOBALS['phpgw']->msg->phpgw_header($msgball);
+ if ($this->debug > 2) {
$this->msg->dbug->out('class.bomessage.message_data('.__LINE__.'): $msg_struct
DUMP:', $msg_struct); }
+ if ($this->debug > 2) {
$this->msg->dbug->out('class.bomessage.message_data('.__LINE__.'): $msg_headers
DUMP:', $msg_headers); }
+
/*
// MOVED TO EVENT, TRIGGERED BY GETTING A BODY OR BODY
PART
// CACHE NOTE: FLAGS: if this message we are about to
read has flags saying it is UNREAD
@@ -296,10 +340,63 @@
$folder_info = array();
$folder_info =
$GLOBALS['phpgw']->msg->get_folder_status_info();
- if ($this->debug > 2) { echo
'email.bomessage.message_data: get_folder_status_info() dump: <pre>';
print_r($folder_info); echo '</pre>'; }
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'):
get_folder_status_info() DUMP:', $folder_info); }
$totalmessages = $folder_info['number_all'];
$subject =
$GLOBALS['phpgw']->msg->get_subject($msg_headers,'');
+
+ /*
+# begin GMT handling by "acros"
+#le quitamos el offset a los mensajes de correo electrnico.
+######
+$msg_date2=$msg_headers->date;
+$comma = strpos($msg_date2,',');
+
+ if($comma)
+ {
+ $msg_date2 = substr($msg_date2,$comma + 2);
+ }
+ //echo 'Msg Date : '.$msg_date."<br>\n";
+ $dta = array();
+ $ta = array();
+
+ $dta = explode(' ',$msg_date2);
+ $ta = explode(':',$dta[3]);
+
+ if(substr($dta[4],0,3) <> 'GMT')
+ {
+ $tzoffset = substr($dta[4],0,1);
+ (int)$tzhours = substr($dta[4],1,2);
+ (int)$tzmins = substr($dta[4],3,2);
+#echo"$ta[0] y $tzoffset";
+ switch ($tzoffset)
+ {
+ case '+':
+ (int)$ta[0] -= (int)$tzhours;
+ (int)$ta[1] -= (int)$tzmins;
+#echo"$ta[0]";
+ break;
+ case '-':
+ (int)$ta[0] += (int)$tzhours;
+ (int)$ta[1] += (int)$tzmins;
+ break;
+ }
+ }
+
+ $new_time =
mktime($ta[0],$ta[1],$ta[2],$GLOBALS['month_array'][strtolower($dta[1])],$dta[0],$dta[2])
- ((60 * 60) *
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tzoffset']));
+
+
+$new_time2=gmdate("D, d M Y H:m:s",$new_time)." GMT";
+$msg_headers->date = $new_time2;
+$msg_headers->udate = $new_time;
+#echo("<br>Hora cojonuda: $new_time2");
+#echo"udate $msg_headers->udate<br>";
+#echo"date $msg_headers->date<br>";
+#echo"$new_time<br>";
+#echo("estamos en bomessage 589<br>");
+# end GMT handling by "acros"
+ */
+
$message_date =
$GLOBALS['phpgw']->common->show_date($msg_headers->udate);
// addressbook needs to know what to return to, give it
ALL VARS we can possibly want preserved
@@ -313,13 +410,21 @@
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
.$this->no_fmt);
- if ($this->debug > 2) { echo
'class.bomessage.message_data: $msg_struct DUMP:<pre>'; print_r($msg_struct);
echo '</pre>'; }
address@hidden(0);
// ---- Special X-phpGW-Type Message Flag -----
// this is used at least by the calendar for the
notifications
$this->xi['application'] = '';
- $msgtype =
$GLOBALS['phpgw']->msg->phpgw_get_flag('X-phpGW-Type');
+ // THIS IS NOT CACHED DATA, only call this is
session_cache_extreme is FALSE
+ // or else we will connect even if we ALREADY HAVE THE
BODY IN CACHE!!!
+ if ($GLOBALS['phpgw']->msg->session_cache_extreme ==
True)
+ {
+ $msgtype = '';
+ }
+ else
+ {
+ $msgtype =
$GLOBALS['phpgw']->msg->phpgw_get_flag('X-phpGW-Type');
+ }
$this->xi['msgtype'] = $msgtype;
if (!empty($msgtype))
@@ -351,7 +456,8 @@
}
// ---- What Folder To Return To -----
- $lnk_goback_folder =
$GLOBALS['phpgw']->msg->href_maketag(
+ //$lnk_goback_folder =
$GLOBALS['phpgw']->msg->href_maketag(
+ $lnk_goback_folder =
$GLOBALS['phpgw']->msg->href_maketag_class(
$GLOBALS['phpgw']->link(
'/index.php',
'menuaction=email.uiindex.index'
@@ -361,7 +467,9 @@
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')),
//$GLOBALS['phpgw']->msg->get_folder_short($msgball['folder']));
- $nice_folder_name);
+ $nice_folder_name,
+ // his class name is reference to a css on the
page itself, for the A item
+ 'c_backto');
// NOTE: msgnum int 0 is NOT to be confused with
"empty" nor "boolean False"
@@ -369,7 +477,7 @@
// NOTE: the one arg for this function is only there to
support the old, broken method
// in the event that the "get_msgball_list()" returns
bogus data or is not available
$nav_data =
$GLOBALS['phpgw']->msg->prev_next_navigation($folder_info['number_all']);
- if ($this->debug_nav > 2) { echo
'email.bomessage.message_data: $nav_data[] dump <pre>: '; print_r($nav_data);
echo '</pre>'; }
+ if ($this->debug_nav > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): $nav_data[]
DUMP:', $nav_data); }
// ---- "Go To Previous Message" Handling -----
if ($nav_data['prev_msg'] != $not_set)
@@ -383,11 +491,13 @@
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
.$this->no_fmt);
$prev_msg_img =
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/arrow-left-24','_on'),$this->xi['lang_previous_message'],'','','0');
-
+ $href_prev_msg =
$GLOBALS['phpgw']->msg->href_maketag_class($prev_msg_link,'[<
'.$this->xi['lang_previous_message'].']', 'c_replybar');
$ilnk_prev_msg =
$GLOBALS['phpgw']->msg->href_maketag($prev_msg_link,$prev_msg_img);
}
else
{
+ // not a clickable link, just text saying "no
prev message"
+ $href_prev_msg =
'['.$this->xi['lang_no_previous_message'].']';
$ilnk_prev_msg =
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/arrow-left-no-24','_on'),$this->xi['lang_no_previous_message'],'','','0');
}
@@ -407,15 +517,22 @@
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
.$this->no_fmt);
$next_msg_img =
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/arrow-right-24','_on'),$this->xi['lang_next_message'],'','','0');
+ $href_next_msg =
$GLOBALS['phpgw']->msg->href_maketag_class($next_msg_link,'['.$this->xi['lang_next_message'].'
>]', 'c_replybar');
$ilnk_next_msg =
$GLOBALS['phpgw']->msg->href_maketag($next_msg_link,$next_msg_img);
}
else
{
+ // not a clickable link, just text saying "no
next message"
+ $href_next_msg =
'['.$this->xi['lang__no_next_message'].']';
$ilnk_next_msg =
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/arrow-right-no-24','_on'),$this->xi['lang__no_next_message'],'','','0');
}
//if ($this->debug > 0) { echo 'messages.php step4
$nav_data[] $ilnk_next_msg: '.$ilnk_next_msg.'<br>'; }
+ // these are HREF clickable text for prev and next text
navigation
+ $this->xi['href_prev_msg'] = $href_prev_msg;
+ $this->xi['href_next_msg'] = $href_next_msg;
+ // these are the clickable images for prev and next
message navigation
$this->xi['ilnk_prev_msg'] = $ilnk_prev_msg;
$this->xi['ilnk_next_msg'] = $ilnk_next_msg;
@@ -481,6 +598,8 @@
{
$from_personal =
$GLOBALS['phpgw']->msg->decode_header_string($from->personal);
}
+ // escape certain undesirable chars before HTML
display
+ $from_personal =
$GLOBALS['phpgw']->msg->htmlspecialchars_encode($from_personal);
// display "From" according to user preferences
if
(($GLOBALS['phpgw']->msg->get_isset_pref('show_addresses'))
&&
($GLOBALS['phpgw']->msg->get_pref_value('show_addresses') != 'none')
@@ -488,6 +607,8 @@
{
// user wants to see "personal" info
AND the plain address, and we have both available to us
$from_extra_info = ' ('.$from_plain.')
';
+ // escape certain undesirable chars
before HTML display
+ $from_extra_info =
$GLOBALS['phpgw']->msg->htmlspecialchars_encode($from_extra_info);
}
else
{
@@ -541,7 +662,13 @@
}
else
{
- for ($i = 0; $i < count($msg_headers->to); $i++)
+ $to_loops = count($msg_headers->to);
+ // begin test of Maz Num of To loop limitation
+ if ($to_loops > $this->max_to_loops)
+ {
+ $to_loops = $this->max_to_loops;
+ }
+ for ($i = 0; $i < $to_loops; $i++)
{
$topeople = $msg_headers->to[$i];
$to_plain =
$topeople->mailbox.'@'.$topeople->host;
@@ -553,10 +680,14 @@
{
$to_personal =
$GLOBALS['phpgw']->msg->decode_header_string($topeople->personal);
}
+ // escape certain undesirable chars
before HTML display
+ $to_personal =
$GLOBALS['phpgw']->msg->htmlspecialchars_encode($to_personal);
if
(($GLOBALS['phpgw']->msg->get_pref_value('show_addresses') != 'none')
&& ($to_personal != $to_plain))
{
$to_extra_info = '
('.$to_plain.') ';
+ // escape certain undesirable
chars before HTML display
+ $to_extra_info =
$GLOBALS['phpgw']->msg->htmlspecialchars_encode($to_extra_info);
}
else
{
@@ -603,7 +734,13 @@
$this->xi['cc_data_final'] = '';
if (isset($msg_headers->cc) && count($msg_headers->cc)
> 0)
{
- for ($i = 0; $i < count($msg_headers->cc); $i++)
+ $cc_loops = count($msg_headers->cc);
+ // begin test of Maz Num of CC loop limitation
+ if ($cc_loops > $this->max_cc_loops)
+ {
+ $cc_loops = $this->max_cc_loops;
+ }
+ for ($i = 0; $i < $cc_loops; $i++)
{
$ccpeople = $msg_headers->cc[$i];
$cc_plain =
@$ccpeople->mailbox.'@'address@hidden>host;
@@ -615,11 +752,15 @@
{
$cc_personal =
$GLOBALS['phpgw']->msg->decode_header_string($ccpeople->personal);
}
+ // escape certain undesirable chars
before HTML display
+ $cc_personal =
$GLOBALS['phpgw']->msg->htmlspecialchars_encode($cc_personal);
//if
(($GLOBALS['phpgw_info']['user']['preferences']['email']['show_addresses'] !=
'none')
if
(($GLOBALS['phpgw']->msg->get_pref_value('show_addresses') != 'none')
&& ($cc_personal != $cc_plain))
{
$cc_extra_info = '
('.$cc_plain.') ';
+ // escape certain undesirable
chars before HTML display
+ $cc_extra_info =
$GLOBALS['phpgw']->msg->htmlspecialchars_encode($cc_extra_info);
}
else
{
@@ -671,8 +812,9 @@
// ---- Generate phpgw CUSTOM FLATTENED FETCHSTRUCTURE
ARRAY -----
$this->part_nice = Array();
+ // NO NEED TO CACHE THIS DATA, NO CONTACT WITH
MAILSERVER IS NEEDED FOR THIS DATA
$this->part_nice =
$GLOBALS['phpgw']->msg->get_flat_pgw_struct($msg_struct);
- if ($this->debug > 2) { echo
'email.bomessage.message_data: $this->part_nice dump <pre>: ';
print_r($this->part_nice); echo '</pre>'; }
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'):
$this->part_nice DUMP:', $this->part_nice); }
// ---- Attachments List Creation -----
@@ -761,6 +903,7 @@
.'&sort='.$GLOBALS['phpgw']->msg->get_arg_value('sort')
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start'));
+ $href_reply =
$GLOBALS['phpgw']->msg->href_maketag_class($reply_url, $this->xi['lang_reply'],
'c_replybar');
$ilnk_reply =
$GLOBALS['phpgw']->msg->href_maketag($reply_url, $reply_img);
$replyall_img =
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/reply-all','_on'),$this->xi['lang_reply_all'],'','','0');
@@ -774,6 +917,7 @@
.'&sort='.$GLOBALS['phpgw']->msg->get_arg_value('sort')
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start'));
+ $href_replyall =
$GLOBALS['phpgw']->msg->href_maketag_class($replyall_url,
$this->xi['lang_reply_all'], 'c_replybar');
$ilnk_replyall =
$GLOBALS['phpgw']->msg->href_maketag($replyall_url, $replyall_img);
$forward_img =
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/forward','_on'),$this->xi['lang_forward'],'','','0');
@@ -788,6 +932,7 @@
.'&sort='.$GLOBALS['phpgw']->msg->get_arg_value('sort')
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start'));
+ $href_forward =
$GLOBALS['phpgw']->msg->href_maketag_class($forward_url,
$this->xi['lang_forward'], 'c_replybar');
$ilnk_forward =
$GLOBALS['phpgw']->msg->href_maketag($forward_url, $forward_img);
$delete_img =
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/delete-message','_on'),$this->xi['lang_delete'],'','','0');
@@ -801,6 +946,7 @@
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
.$this->no_fmt);
+ $href_delete=
$GLOBALS['phpgw']->msg->href_maketag_class($delete_url,
$this->xi['lang_delete'], 'c_replybar');
$ilnk_delete =
$GLOBALS['phpgw']->msg->href_maketag($delete_url, $delete_img);
$this->xi['theme_font'] =
$GLOBALS['phpgw_info']['theme']['font'];
@@ -808,17 +954,17 @@
$this->xi['reply_btns_text'] =
$GLOBALS['phpgw_info']['theme']['em_folder_text'];
$this->xi['lnk_goback_folder'] = $lnk_goback_folder;
$this->xi['go_back_to'] = $this->xi['lang_go_back_to'];
+ $this->xi['href_reply'] = $href_reply;
+ $this->xi['href_replyall'] = $href_replyall;
+ $this->xi['href_forward'] = $href_forward;
+ $this->xi['href_delete'] = $href_delete;
$this->xi['ilnk_reply'] = $ilnk_reply;
$this->xi['ilnk_replyall'] = $ilnk_replyall;
$this->xi['ilnk_forward'] = $ilnk_forward;
$this->xi['ilnk_delete'] = $ilnk_delete;
// ---- DEBUG: Show Information About Each Part -----
- // --- UPDATE THIS debug output (gotta be a better way)
and move it somewhere else ---
- $show_debug_parts = False;
- //$show_debug_parts = True;
-
- if ($this->debug > 3)
+ if ($this->show_debug_parts_summary > 0)
{
// what's the count in the array?
$max_parts = count($this->part_nice);
@@ -831,15 +977,26 @@
$msg_raw_headers =
$GLOBALS['phpgw']->msg->htmlspecialchars_encode($msg_raw_headers);
$crlf = "\r\n";
- $msg_body_info = '<pre>' .$crlf;
+ //$msg_body_info = '<pre>' .$crlf;
$msg_body_info .= 'Top Level Headers:' .$crlf;
$msg_body_info .= $msg_raw_headers .$crlf;
$msg_body_info .= $crlf;
+ // what is the deepest level debth
+ $deepest_level = 0;
+ for ($i = 0; $i < count($this->part_nice); $i++)
+ {
+ if
($this->part_nice[$i]['ex_level_debth'] > $deepest_level)
+ {
+ $deepest_level =
$this->part_nice[$i]['ex_level_debth'];
+ }
+ }
+
$msg_body_info .= 'This message has
'.$max_parts.' part(s)' .$crlf;
$msg_body_info .= 'deepest_level:
'.$deepest_level .$crlf;
$msg_body_info .= 'Array Keys:
'.$GLOBALS['phpgw']->msg->array_keys_str($this->part_nice) .$crlf;
$msg_body_info .= $crlf;
+
for ($i = 0; $i < count($this->part_nice); $i++)
{
//$msg_body_info .= 'Information for
primary part number '.$i .$crlf;
@@ -930,9 +1087,11 @@
$msg_body_info .= $crlf;
}
- $msg_body_info .= '</pre>' .$crlf;
- $this->xi['msg_body_info'] = $msg_body_info;
-
//$GLOBALS['phpgw']->template->parse('V_debug_parts','B_debug_parts');
+ //$msg_body_info .= '</pre>' .$crlf;
+ //$this->xi['msg_body_info'] = $msg_body_info;
+ $this->xi['msg_body_info'] = '';
+
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): assembled
debug data $msg_body_info DUMP:', $msg_body_info);
+
}
else
{
@@ -940,6 +1099,7 @@
$this->xi['msg_body_info'] = '';
}
+
// ----- Message_Display Template Handles it from here
-------
$this->xi['theme_font'] =
$GLOBALS['phpgw_info']['theme']['font'];
$this->xi['theme_th_bg'] =
$GLOBALS['phpgw_info']['theme']['th_bg'];
@@ -1015,7 +1175,8 @@
// Force Echo Out Unformatted Text for email with 1
part which is a large text messages (in bytes) , such as a system report from
cron
// php (4.0.4pl1 last tested) and some imap servers
(courier and uw-imap are confirmed) will time out retrieving this type of
message
- $force_echo_size = 20000;
+ //$force_echo_size = 20000;
+ $force_echo_size = 60000;
@@ -1058,8 +1219,8 @@
$count_part_nice = count($this->part_nice);
for ($i = 0; $i < $count_part_nice; $i++)
{
- if ($this->debug > 2) { echo
'email.bomessage.message_data: disp loop: '.($i+1).' of
'.$count_part_nice.'<br>'; }
- if ($this->debug > 3) { echo
'email.bomessage.message_data: d_loop: $this->part_nice[$i] DUMP<pre>';
print_r($this->part_nice[$i]); echo '</pre>'; }
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): disp loop:
'.($i+1).' of '.$count_part_nice.'<br>'); }
+ if ($this->debug > 3) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): d_loop:
$this->part_nice[$i] DUMP:', $this->part_nice[$i]); }
// Do We Break out of this Loop Block
if ($done_processing)
{
@@ -1080,7 +1241,7 @@
&& (($this->part_nice[$i]['m_description'] ==
'container')
|| ($this->part_nice[$i]['m_description'] ==
'packagelist')) )
{
- if ($this->debug > 2) { echo
'email.bomessage.message_data: d_loop: "Mime-Ignorant Email Server", Num Parts
is 1 AND part is a container OR packagelist <br>'; }
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): d_loop:
"Mime-Ignorant Email Server", Num Parts is 1 AND part is a container OR
packagelist <br>'); }
// ==== MIME IGNORANT SERVER ====
$title_text = ' Mime-Ignorant
Email Server: ';
@@ -1142,7 +1303,7 @@
&& (($this->part_nice[$i]['m_part_num_mime'] ==
1) || ((string)$this->part_nice[$i]['m_part_num_mime'] == '1.1'))
&& ((int)$this->part_nice[$i]['bytes'] >
$force_echo_size))
{
- if ($this->debug > 2) { echo
'email.bomessage.message_data: d_loop: ECHO OUT: part meets five criteria
<br>'; }
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): d_loop: ECHO
OUT: part meets five criteria <br>'); }
$title_text =
' '.$this->xi['lang_message'].': ';
$display_str =
$this->xi['lang_keywords'].': '.$this->part_nice[$i]['m_keywords'].' -
'.$GLOBALS['phpgw']->msg->format_byte_size($this->part_nice[$i]['bytes'])
@@ -1191,8 +1352,10 @@
}
elseif (($this->part_nice[$i]['m_description']
== 'presentable')
&& (stristr($this->part_nice[$i]['m_keywords'],
'HTML')))
+ // enriched = part of APPLE MAIL multipart /
alternative subpart where the html part usually is
+ // HOWEVER enriched is not complete html so it
will not render anything special in a browser so we can NOT treat enriched like
html
{
- if ($this->debug > 2) { echo
'email.bomessage.message_data: d_loop: part is HTML, presentable <br>'; }
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): d_loop: part
is HTML, presentable <br>'); }
// get the body
$this_msgball = $msgball;
@@ -1231,17 +1394,21 @@
// ---- HTML Related Parts Handling
----
$parent_idx =
$this->part_nice[$i]['ex_parent_flat_idx'];
- $msg_raw_headers =
$GLOBALS['phpgw']->msg->phpgw_fetchheader($msgball);
// NEEDS UPDATING !!!!!
- $ms_related_str = 'X-MimeOLE: Produced
By Microsoft MimeOLE';
+ //$msg_raw_headers =
$GLOBALS['phpgw']->msg->phpgw_fetchheader($msgball);
+ //$ms_related_str = 'X-MimeOLE:
Produced By Microsoft MimeOLE';
+ // NEW: use $msg_struct object to check
for top level "RELATED" subtype
// ---- Replace "Related" part's ID
with a mime reference link
// this for the less-standard
multipart/RELATED subtype ex. Outl00k's Stationary email
// update: now common in Ximian
if
(($this->part_nice[$parent_idx]['m_html_related_kids'])
- || (stristr($msg_raw_headers,
$ms_related_str)))
+ //|| (stristr($msg_raw_headers,
$ms_related_str)))
+ //|| (stristr($msg_struct->subtype,
'RELATED'))
+ //||
(stristr($this->part_nice[$parent_idx]['subtype'], 'RELATED')))
+ )
{
- if ($this->debug > 2) { echo
'email.bomessage.message_data: d_loop: * part is RELATED, HTML, presentable
<br>'; }
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): d_loop: *
part is RELATED, HTML, presentable <br>'); }
// typically it's the NEXT mime
part that should be inserted into this one
for ($rel = $i+1; $rel <
count($this->part_nice)+1; $rel++)
{
@@ -1284,7 +1451,7 @@
if
(preg_match("/<iframe.*>.*<\/iframe>/ismx", $dsp))
{
- if ($this->debug > 2) {
echo 'email.bomessage.message_data: d_loop: part ** HAS IFRAME <br>'; }
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): d_loop: part
** HAS IFRAME <br>'); }
//$this->part_nice[$i]['d_threat_level'] .= 'warn_HAS_IFRAME_maybe_KLEZ ';
$this->part_nice[$i]['d_threat_level'] .=
$this->xi['lang_warn_has_iframe_maybe_klez'].' ';
}
@@ -1308,7 +1475,10 @@
// if we replaced id(s) with
href'(s) above (RELATED) then
// stuff the modified html in a
hidden var, submit it then echo it back
if
(($this->part_nice[$parent_idx]['m_html_related_kids'])
- || (stristr($msg_raw_headers,
$ms_related_str)))
+ //|| (stristr($msg_raw_headers,
$ms_related_str)))
+ //||
(stristr($msg_struct->subtype, 'RELATED'))
+ //||
(stristr($this->part_nice[$parent_idx]['subtype'], 'RELATED')))
+ )
{
// -- View As HTML
Button With Special HTML RELATED handling
@@ -1407,9 +1577,23 @@
$this->part_nice[$i]['message_body'] =
"$dsp";
//$GLOBALS['phpgw']->template->parse('V_display_part','B_display_part', True);
}
+ elseif (($this->part_nice[$i]['m_description']
== 'presentable')
+ && (stristr($this->part_nice[$i]['m_keywords'],
'alt_hide'))
+ && ($this->hide_alt_hide == True))
+ {
+ // is this a multipart alternative set,
and this is the plain part, and do not want to show it
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): d_loop: part
is presentable BUT it is alt_hide so we do NOT want to show it <br>'); }
+
+ // ---- DISPLAY INSTRUCTIONS ----
+ $this->part_nice[$i]['d_instructions']
= 'skip';
+ // is this necessary here?
+ $this->part_nice[$i]['d_processed_as']
= 'empty_part';
+ // LOOP CONTROL
+ $done_processing = False;
+ }
elseif ($this->part_nice[$i]['m_description']
== 'presentable')
{
- if ($this->debug > 2) { echo
'email.bomessage.message_data: d_loop: part is presentable (non-html) <br>'; }
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): d_loop: part
is presentable (non-html) <br>'); }
// ----- get the part from the server
$this_msgball = $msgball;
@@ -1555,9 +1739,23 @@
$done_processing = False;
}
}
+ elseif (($this->part_nice[$i]['m_description']
== 'presentable/image')
+ && (stristr($this->part_nice[$i]['m_keywords'],
'alt_hide'))
+ && ($this->hide_alt_hide == True))
+ {
+ // is this a multipart alternative set,
and this is the plain part, and do not want to show it
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): d_loop: part
is presentable IMAGE BUT it is alt_hide because it is html related to a parent
so we do NOT want to show it again<br>'); }
+
+ // ---- DISPLAY INSTRUCTIONS ----
+ $this->part_nice[$i]['d_instructions']
= 'skip';
+ // is this necessary here?
+ $this->part_nice[$i]['d_processed_as']
= 'empty_part';
+ // LOOP CONTROL
+ $done_processing = False;
+ }
elseif ($this->part_nice[$i]['m_description']
== 'presentable/image')
{
- if ($this->debug > 2) { echo
'email.bomessage.message_data: d_loop: part is presentable image <br>'; }
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): d_loop: part
is presentable image <br>'); }
$title_text =
$this->xi['lang_section'].': '.$this->part_nice[$i]['m_part_num_mime'];
$display_str =
$GLOBALS['phpgw']->msg->decode_header_string($this->part_nice[$i]['ex_part_name'])
@@ -1579,12 +1777,12 @@
}
elseif ($this->part_nice[$i]['m_description']
== 'attachment')
{
- if ($this->debug > 2) { echo
'email.bomessage.message_data: d_loop: part is attachment <br>'; }
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): d_loop: part
is attachment <br>'); }
// if this is a 1 part message with
only this attachment, WARN
if (count($this->part_nice) == 1)
{
- if ($this->debug > 2) { echo
'email.bomessage.message_data: d_loop: * WARN message has only 1 part and it is
an attachment <br>'; }
+ if ($this->debug > 2) {
$this->msg->dbug->out('email.bomessage.message_data('.__LINE__.'): d_loop: *
WARN message has only 1 part and it is an attachment <br>'); }
//$this->part_nice[$i]['d_threat_level'] .= 'warn_attachment_only_mail ';
$this->part_nice[$i]['d_threat_level'] .=
$this->xi['lang_warn_attachment