[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.preferences.inc.php
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.preferences.inc.php |
Date: |
Thu, 31 Aug 2006 02:39:56 +0000 |
CVSROOT: /cvsroot/phpgwapi
Module name: phpgwapi
Changes by: Dave Hall <skwashd> 06/08/31 02:39:56
Modified files:
inc : class.preferences.inc.php
Log message:
more notices
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.preferences.inc.php?cvsroot=phpgwapi&r1=1.60&r2=1.61
Patches:
Index: class.preferences.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.preferences.inc.php,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- class.preferences.inc.php 6 Aug 2006 04:51:25 -0000 1.60
+++ class.preferences.inc.php 31 Aug 2006 02:39:56 -0000 1.61
@@ -7,7 +7,7 @@
* @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General
Public License
* @package phpgwapi
* @subpackage application
- * @version $Id: class.preferences.inc.php,v 1.60 2006/08/06 04:51:25
skwashd Exp $
+ * @version $Id: class.preferences.inc.php,v 1.61 2006/08/31 02:39:56
skwashd Exp $
*/
/**
@@ -23,11 +23,17 @@
*/
class preferences
{
- /*! @var account_id */
+ /**
+ * @var account_id
+ */
var $account_id;
- /*! @var account_type */
+ /**
+ * @var account_type
+ */
var $account_type;
- /*! @var data effectiv user prefs, used by all apps */
+ /**
+ * @var data effectiv user prefs, used by all apps
+ */
var $data = array();
/**
@@ -35,46 +41,51 @@
*/
var $debug = false;
- /*! @var user set user prefs for saveing (no defaults/forced
prefs merged) */
+ /**
+ * @var user set user prefs for saveing (no defaults/forced
prefs merged)
+ */
var $user = array();
- /*! @var default default prefs */
+ /**
+ * @var default default prefs
+ */
var $default = array();
- /*! @var forced forced prefs */
+ /**
+ * @var forced forced prefs
+ */
var $forced = array();
- /*! @var db */
+ /**
+ * @var db
+ */
var $db;
var $values,$vars; // standard notify substitues, will be
set by standard_substitues()
-
/**************************************************************************\
- * Standard constructor for setting $this->account_id
*
-
\**************************************************************************/
- /*!
- @function preferences
- @abstract Standard constructor for setting $this->account_id
- @discussion Author:
+ /**
+ * Standard constructor for setting $this->account_id
+ *
+ * @constructor
+ * @param int $account_id the user id for which preferences are
sought - 0 == current user
*/
- function preferences($account_id = '')
+ function preferences($account_id = 0)
{
- $this->db = $GLOBALS['phpgw']->db;
+ $this->db =& $GLOBALS['phpgw']->db;
$this->account_id = get_account_id($account_id);
}
-
/**************************************************************************\
- * These are the standard $this->account_id specific functions
*
-
\**************************************************************************/
+ /*
+ * These are the standard $this->account_id specific functions
+ */
- /*!
- @function parse_notify
- @abstract parses a notify and replaces the substitutes
- @syntax parse_notify($msg,$values='',$use_standard_values=True)
- @param $msg message to parse / substitute
- @param $values extra vars to replace in addition to
$this->values, vars are in an array with \
- $key => $value pairs, $key does not include the $'s and
is the *untranslated* name
- @param $use_standard_values should the standard values are used
- @returns the parsed notify-msg
+ /**
+ * parses a notify and replaces the substitutes
+ *
+ * @param $msg message to parse / substitute
+ * @param $values extra vars to replace in addition to
$this->values, vars are in an array with \
+ * $key => $value pairs, $key does not include the $'s and
is the *untranslated* name
+ * @param $use_standard_values should the standard values are
used
+ * @return the parsed notify-msg
*/
- function parse_notify($msg,$values='',$use_standard_values=True)
+ function parse_notify($msg, $values = '', $use_standard_values
= true)
{
$vals = $values ? $values : array();
@@ -90,15 +101,14 @@
return str_replace($replace,$with,$msg);
}
- /*!
- @function lang_notify
- @abstract replaces the english key's with translated ones, or
if $un_lang the opposite
- @syntax lang_notify($msg,$values='',$un_lang=False)
- @param $msg message to translate
- @param $values extra vars to replace in addition to
$this->values, vars are in an array with \
- $key => $value pairs, $key does not include the $'s and
is the *untranslated* name
- @param $un_lang if true translate back
- @returns the result
+ /**
+ * replaces the english key's with translated ones, or if
$un_lang the opposite
+ *
+ * @param $msg message to translate
+ * @param $values extra vars to replace in addition to
$this->values, vars are in an array with \
+ * $key => $value pairs, $key does not include the $'s and
is the *untranslated* name
+ * @param $un_lang if true translate back
+ * @return the result
*/
function lang_notify($msg,$vals=array(),$un_lang=False)
{
@@ -117,9 +127,9 @@
return $this->parse_notify($msg,$langs,False);
}
- /*!
- @function standard_substitues
- @abstract define some standard substitues-values and use them
on the prefs, if needed
+ /**
+ * define some standard substitues-values and use them on the
prefs, if needed
+ *
*/
function standard_substitutes()
{
@@ -181,10 +191,10 @@
}
}
- /*!
- @function unquote
- @abstract unquote (stripslashes) recursivly the whole array
- @param $arr array to unquote (var-param!)
+ /**
+ * unquote (stripslashes) recursivly the whole array
+ *
+ * @param $arr array to unquote (var-param!)
*/
function unquote(&$arr)
{
@@ -206,11 +216,11 @@
}
}
- /*!
- @function read_repository
- @abstract private - read preferences from the repository
- @note the function ready all 3 prefs user/default/forced and
merges them to the effective ones
- @discussion private function should only be called from within
this class
+ /**
+ * private - read preferences from the repository
+ *
+ * the function ready all 3 prefs user/default/forced and
merges them to the effective ones
+ * private function should only be called from within this class
*/
function read_repository()
{
@@ -311,12 +321,12 @@
return $this->data;
}
- /*!
- @function read
- @abstract public - read preferences from repository and stores
in an array
- @discussion Syntax array read(); <>
- Example1: preferences->read();
- @result $data array containing user preferences
+ /**
+ * public - read preferences from repository and stores in an
array
+ *
+ * Syntax array read(); <>
+ * Example1: preferences->read();
+ * @return $data array containing user preferences
*/
function read()
{
@@ -328,16 +338,16 @@
return $this->data;
}
- /*!
- @function add
- @abstract add preference to $app_name a particular app
- @discussion
- @param $app_name name of the app
- @param $var name of preference to be stored
- @param $value value of the preference
- @param $type of preference to set: forced, default, user
- @note the effective prefs ($this->data) are updated to reflect
the change
- @returns the new effective prefs (even when forced or default
prefs are set !)
+ /**
+ * add preference to $app_name a particular app
+ *
+ * @discussion
+ * @param $app_name name of the app
+ * @param $var name of preference to be stored
+ * @param $value value of the preference
+ * @param $type of preference to set: forced, default, user
+ * the effective prefs ($this->data) are updated to reflect the
change
+ * @return the new effective prefs (even when forced or default
prefs are set !)
*/
function add($app_name,$var,$value = '##undef##',$type='user')
{
@@ -376,15 +386,15 @@
return $this->data;
}
- /*!
- @function delete
- @abstract delete preference from $app_name
- @discussion
- @param $app_name name of app
- @param $var variable to be deleted
- @param $type of preference to set: forced, default, user
- @note the effektive prefs ($this->data) are updated to reflect
the change
- @returns the new effective prefs (even when forced or default
prefs are deleted!)
+ /**
+ * delete preference from $app_name
+ *
+ * @discussion
+ * @param $app_name name of app
+ * @param $var variable to be deleted
+ * @param $type of preference to set: forced, default, user
+ * the effektive prefs ($this->data) are updated to reflect the
change
+ * @return the new effective prefs (even when forced or default
prefs are deleted!)
*/
function delete($app_name, $var = False,$type = 'user')
{
@@ -433,14 +443,14 @@
return $this->data;
}
- /*!
- @function add_struct
- @abstract add complex array data preference to $app_name a
particular app
- @discussion Use for sublevels of prefs, such as email app's
extra accounts preferences
- @param $app_name name of the app
- @param $var array keys separated by '/', eg. 'ex_accounts/1'
- @param $value value of the preference
- @note the function works on user and data, to be able to save
the pref and to have imediate effect
+ /**
+ * add complex array data preference to $app_name a particular
app
+ *
+ * Use for sublevels of prefs, such as email app's extra
accounts preferences
+ * @param $app_name name of the app
+ * @param $var array keys separated by '/', eg. 'ex_accounts/1'
+ * @param $value value of the preference
+ * the function works on user and data, to be able to save the
pref and to have imediate effect
*/
function add_struct($app_name,$var,$value = '')
{
@@ -463,13 +473,13 @@
return $this->data;
}
- /*!
- @function delete_struct
- @abstract delete complex array data preference from $app_name
- @discussion Use for sublevels of prefs, such as email app's
extra accounts preferences
- @param $app_name name of app
- @param $var array keys separated by '/', eg. 'ex_accounts/1'
- @note the function works on user and data, to be able to save
the pref and to have imediate effect
+ /**
+ * delete complex array data preference from $app_name
+ *
+ * Use for sublevels of prefs, such as email app's extra
accounts preferences
+ * @param $app_name name of app
+ * @param $var array keys separated by '/', eg. 'ex_accounts/1'
+ * the function works on user and data, to be able to save the
pref and to have imediate effect
*/
function delete_struct($app_name, $var = '')
{
@@ -497,10 +507,10 @@
return $this->data;
}
- /*!
- @function quote
- @abstract quote (addslashes) recursivly the whole array
- @param $arr array to unquote (var-param!)
+ /**
+ * quote (addslashes) recursivly the whole array
+ *
+ * @param $arr array to unquote (var-param!)
*/
function quote(&$arr)
{
@@ -522,13 +532,12 @@
}
}
- /*!
- @function save_repository
- @abstract save the the preferences to the repository
- @syntax save_repository($update_session_info = False,$type='')
- @param $update_session_info old param, seems not to be used
- @param $type which prefs to update: user/default/forced
- @note the user prefs for saveing are in $this->user not in
$this->data, which are the effectiv prefs only
+ /**
+ * save the the preferences to the repository
+ *
+ * @param $update_session_info old param, seems not to be used
+ * @param $type which prefs to update: user/default/forced
+ * the user prefs for saveing are in $this->user not in
$this->data, which are the effectiv prefs only
*/
function save_repository($update_session_info =
False,$type='user')
{
@@ -596,11 +605,11 @@
return $this->data;
}
- /*!
- @function create_defaults
- @abstract insert a copy of the default preferences for use by
real account_id
- @discussion
- @param $account_id numerical id of account for which to create
the prefs
+ /**
+ * insert a copy of the default preferences for use by real
account_id
+ *
+ * @discussion
+ * @param $account_id numerical id of account for which to
create the prefs
*/
function create_defaults($account_id)
{
@@ -621,11 +630,11 @@
}
- /*!
- @function update_data
- @abstract update the preferences array
- @discussion
- @param $data array of preferences
+ /**
+ * update the preferences array
+ *
+ *
+ * @param $data array of preferences
*/
function update_data($data)
{
@@ -657,10 +666,10 @@
* These are the non-standard $this->account_id specific
functions *
\**************************************************************************/
- /*!
- @function verify_basic_settings
- @abstract verify basic settings
- @discussion
+ /**
+ * verify basic settings
+ *
+ * @discussion
*/
function verify_basic_settings()
{
@@ -719,24 +728,25 @@
* Email Preferences and Private Support Functions *
\****************************************************/
- /*!
- @function sub_get_mailsvr_port
- @abstract Helper function for create_email_preferences, gets
mail server port number.
- @discussion This will generate the appropriate port number to
access a
- mail server of type pop3, pop3s, imap, imaps users value from
- $phpgw_info['user']['preferences']['email']['mail_port'].
- if that value is not set, it generates a default port for the
given $server_type.
- Someday, this *MAY* be
- (a) a se4rver wide admin setting, or
- (b)user custom preference
- Until then, simply set the port number based on the
mail_server_type, thereof
- ONLY call this function AFTER ['email']['mail_server_type'] has
been set.
- @param $prefs - user preferences array based on element
['email'][]
- @author Angles
- @access Private
+ /**
+ * Helper function for create_email_preferences, gets mail
server port number.
+ *
+ * This will generate the appropriate port number to access a
+ * mail server of type pop3, pop3s, imap, imaps users value from
+ *
$GLOBALS['phpgw_info']['user']['preferences']['email']['mail_port'].
+ * if that value is not set, it generates a default port for
the given $server_type.
+ * Someday, this *MAY* be
+ * (a) a se4rver wide admin setting, or
+ * (b)user custom preference
+ * Until then, simply set the port number based on the
mail_server_type, thereof
+ * ONLY call this function AFTER ['email']['mail_server_type']
has been set.
+ * @param $prefs - user preferences array based on element
['email'][]
+ * @author Angles
+ * @access Private
*/
function sub_get_mailsvr_port($prefs, $acctnum=0)
{
+ $port_number = 0;
// first we try the port number supplied in preferences
if (
(isset($prefs['email']['accounts'][$acctnum]['mail_port']))
&& ($prefs['email']['accounts'][$acctnum]['mail_port']
!= '') )
@@ -744,7 +754,7 @@
$port_number =
$prefs['email']['accounts'][$acctnum]['mail_port'];
}
// preferences does not have a port number, generate a
default value
- else
+ else if ( isset($prefs['email']['accounts']) &&
is_array($prefs['email']['accounts']) )
{
if
(!isset($prefs['email']['accounts'][$acctnum]['mail_server_type']))
{
@@ -783,13 +793,13 @@
return $port_number;
}
- /*!
- @function sub_default_userid
- @abstract Helper function for create_email_preferences, gets
default userid for email
- @discussion This will generate the appropriate userid for
accessing an email server.
- In the absence of a custom ['email']['userid'], this function
should be used to set it.
- @param $accountid - as determined in and/or passed to
"create_email_preferences"
- @access Private
+ /**
+ * Helper function for create_email_preferences, gets default
userid for email
+ *
+ * This will generate the appropriate userid for accessing an
email server.
+ * In the absence of a custom ['email']['userid'], this
function should be used to set it.
+ * @param $accountid - as determined in and/or passed to
"create_email_preferences"
+ * @access Private
*/
function sub_default_userid($account_id='')
{
@@ -810,15 +820,15 @@
return $prefs_email_userid;
}
- /*!
- @function email_address
- @abstract returns the custom email-address (if set) or
generates a default one
- @discussion This will generate the appropriate email address
used as the "From:"
- email address when the user sends email, the address@hidden
part. The "personal"
+ /**
+ * returns the custom email-address (if set) or generates a
default one
+ *
+ * This will generate the appropriate email address used as the
"From:"
+ email address when the user sends email, the localpert * part.
The "personal"
part is generated elsewhere.
In the absence of a custom ['email']['address'], this function
should be used to set it.
- @param $accountid - as determined in and/or passed to
"create_email_preferences"
- @access Public now
+ * @param $accountid - as determined in and/or passed to
"create_email_preferences"
+ * @access Public now
*/
function email_address($account_id='')
{
@@ -839,26 +849,26 @@
return $this->email_address($account_id);
}
- /*!
- @function create_email_preferences
- @abstract create email preferences
- @param $account_id -optional defaults to : get_account_id()
- @discussion fills a local copy of ['email'][] prefs array which
is then returned to the calling
- function, which the calling function generally tacks onto the
$GLOBALS['phpgw_info'] array as such:
- $GLOBALS['phpgw_info']['user']['preferences'] =
$GLOBALS['phpgw']->preferences->create_email_preferences();
- which fills an array based at:
-
$GLOBALS['phpgw_info']['user']['preferences']['email'][prefs_are_elements_here]
- Reading the raw preference DB data and comparing to the email
preference schema defined in
- /email/class.bopreferences.inc.php (see discussion there and
below) to create default preference values
- for the in the ['email'][] pref data array in cases where the
user has not supplied
- a preference value for any particular preference item available
to the user.
- @access Public
+ /**
+ * create email preferences
+ *
+ * @param $account_id -optional defaults to : get_account_id()
+ * fills a local copy of ['email'][] prefs array which is then
returned to the calling
+ * function, which the calling function generally tacks onto
the $GLOBALS['phpgw_info'] array as such:
+ * $GLOBALS['phpgw_info']['user']['preferences'] =
$GLOBALS['phpgw']->preferences->create_email_preferences();
+ * which fills an array based at:
+ *
$GLOBALS['phpgw_info']['user']['preferences']['email'][prefs_are_elements_here]
+ * Reading the raw preference DB data and comparing to the
email preference schema defined in
+ * /email/class.bopreferences.inc.php (see discussion there and
below) to create default preference values
+ * for the in the ['email'][] pref data array in cases where
the user has not supplied
+ * a preference value for any particular preference item
available to the user.
+ * @access Public
*/
function create_email_preferences($accountid='', $acctnum=0)
{
print_debug('class.preferences:
create_email_preferences: ENTERING<br>', 'messageonly','api');
// we may need function "html_quotes_decode" from the
mail_msg class
- $email_base = CreateObject("email.mail_msg");
+ $email_base = createObject("email.mail_msg");
$account_id = get_account_id($accountid);
// If the current user is not the request user, grab
the preferences
@@ -950,7 +960,7 @@
// by function "init_available_prefs", see the
discussion there.
// --- create the objectified
/email/class.bopreferences.inc.php ---
- $bo_mail_prefs = CreateObject('email.bopreferences');
+ $bo_mail_prefs = createObject('email.bopreferences');
// --- bo_mail_prefs->init_available_prefs() ---
// this fills object_email_bopreferences->std_prefs and
->cust_prefs
@@ -1008,8 +1018,9 @@
for($i=0;$i<$c_prefs;$i++)
{
$this_avail_pref = $avail_pref_array[$i];
- print_debug('class.preferences:
create_email_preferences: value from DB for
$prefs[email]['.$this_avail_pref['id'].'] =
['.$prefs['email'][$this_avail_pref['id']].']', 'messageonly','api');
- print_debug('class.preferences:
create_email_preferences: std/cust_prefs $this_avail_pref['.$i.'] dump:',
$this_avail_pref,'api');
+ //@ is used here as it is needed for this
crappy code
+ @print_debug('class.preferences:
create_email_preferences: value from DB for
$prefs[email]['.$this_avail_pref['id'].'] =
['.$prefs['email'][$this_avail_pref['id']].']', 'messageonly','api');
+ @print_debug('class.preferences:
create_email_preferences: std/cust_prefs $this_avail_pref['.$i.'] dump:',
$this_avail_pref,'api');
// --- is there a value in the DB for this
preference item ---
// if the prefs DB has no value for this
defined available preference, we must make one.
@@ -1091,7 +1102,7 @@
$evaled = '';
$code = '$evaled =
'.$set_proc[1];
print_debug(' * $code:',
$code,'api');
- eval($code);
+ @eval($code); //@ to supress
errors created during eval - ugly hack i know
print_debug('* $evaled:',
$evaled,'api');
$prefs['email'][$this_avail_pref['id']] = $evaled;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc class.preferences.inc.php,
Dave Hall <=