[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc/class.common.inc.php, 1.123.2.9.2.28.2.2
From: |
nomail |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc/class.common.inc.php, 1.123.2.9.2.28.2.2 |
Date: |
Thu, 30 Dec 2004 03:23:29 +0100 |
Update of /phpgwapi/inc
Modified Files:
Branch: proposed-0_9_18-branch
class.common.inc.php
date: 2004/12/30 02:23:29; author: skwashd; state: Exp; lines: +52 -337
Log Message:
new layout and crud removal
=====================================================================
Index: phpgwapi/inc/class.common.inc.php
diff -u phpgwapi/inc/class.common.inc.php:1.123.2.9.2.28.2.1
phpgwapi/inc/class.common.inc.php:1.123.2.9.2.28.2.2
--- phpgwapi/inc/class.common.inc.php:1.123.2.9.2.28.2.1 Sun Oct 31
12:55:10 2004
+++ phpgwapi/inc/class.common.inc.php Thu Dec 30 02:23:29 2004
@@ -107,57 +107,29 @@
}
/**
- * Convert an array into the format needed for the access column
- *
- * @param string $access Could be 'group', 'public', 'none'
- * @param array $array Access information
- * @return Comma separated list
- * @deprecated Use ACL instead
- */
- function array_to_string($access,$array)
- {
- $this->debug_info[] = 'array_to_string() is a
depreciated function - use ACL instead';
- $s = '';
- if ($access == 'group' || $access == 'public' ||
$access == 'none')
- {
- if (count($array))
- {
- while ($t = each($array)) {
- $s .= ',' . $t[1];
- }
- $s .= ',';
- }
- if (! count($array) && $access == 'none')
- {
- $s = '';
- }
- }
- return $s;
- }
-
- /**
* This function is used for searching the access fields
*
* @param string $table Table name
* @param integer $owner User ID
* @return string SQL where clause
- * @deprecated Use ACL instead
+ * @deprecated Use ACL class instead
*/
- function sql_search($table,$owner=0)
+ function sql_search($table, $owner=0 )
{
- $this->debug_info[] = 'sql_search() is a deprecated
function - use ACL instead';
- $s = '';
+ echo 'common::sql_search() is a deprecated function -
use ACL class instead';
if (!$owner)
{
$owner =
$GLOBALS['phpgw_info']['user']['account_id'];
}
$groups =
$GLOBALS['phpgw']->accounts->membership(intval($owner));
- if (gettype($groups) == 'array')
+ if( is_array($groups) )
{
- while ($group = each($groups))
+ $s = " OR $table IN (0";
+ foreach($groups as $group)
{
- $s .= " or $table like '%," . $group[2]
. ",%'";
+ $s .= ", {$group[2]}";
}
+ $s .= ')';
}
return $s;
}
@@ -191,7 +163,7 @@
$supportedLanguages = $this->getInstalledLanguages();
// find usersupported language
- while (list($key,$value) = each($userLanguages))
+ foreach($userLanguages as $key => $value)
{
// remove everything behind '-' example: de-de
$value = trim($value);
@@ -389,7 +361,7 @@
*/
function check_owner($record,$link,$label,$extravars = '')
{
- $this->debug_info[] = 'check_owner() is a depreciated
function - use ACL instead';
+ echo 'check_owner() is a depreciated function - use ACL
class instead <br />';
/*
$s = '<a href="' .
$GLOBALS['phpgw']->link($link,$extravars) . '"> ' . lang($label) . ' </a>';
if (ereg('^[0-9]+$',$record))
@@ -531,7 +503,11 @@
}
$i = 1;
- while ($tab = each($tabs))
+ if( !is_array($tabs) )
+ {
+ $tabs = array();
+ }
+ foreach($tabs as $tabs)
{
if ($tab[0] == $selected)
{
@@ -710,7 +686,8 @@
while ($entry=$d->read())
{
if ($entry != 'CVS' && $entry != '.' && $entry
!= '..'
- && $entry != 'phpgw_website'
+ && $entry != 'phpgw_website' && $entry
!= 'default'
+ && $entry != 'base'
&& is_dir(PHPGW_SERVER_ROOT .
'/phpgwapi/templates/' . $entry))
{
$list[$entry]['name'] = $entry;
@@ -768,13 +745,13 @@
elseif
(@$GLOBALS['phpgw_info']['server']['template_set'] == 'user_choice' ||
!isset($GLOBALS['phpgw_info']['server']['template_set']))
{
-
$GLOBALS['phpgw_info']['server']['template_set'] = 'default';
+
$GLOBALS['phpgw_info']['server']['template_set'] = 'simple';
}
$tpldir = PHPGW_SERVER_ROOT . '/' . $appname .
'/templates/' . $GLOBALS['phpgw_info']['server']['template_set'];
- $tpldir_default = PHPGW_SERVER_ROOT . '/' . $appname .
'/templates/default';
+ $tpldir_default = PHPGW_SERVER_ROOT . '/' . $appname .
'/templates/simple';
- if ($layout == 'default')
+ if ($layout == 'simple')
{
$tpldir = $tpldir_default;
}
@@ -811,7 +788,7 @@
while ($f = readdir($d))
{
$ext = strtolower(strrchr($f,'.'));
- if (($ext == '.gif' || $ext == '.png')
&& strstr($f,'navbar') === False)
+ if ( $ext == '.png' &&
strstr($f,'navbar') === False)
{
return True;
}
@@ -834,12 +811,12 @@
}
if
(empty($GLOBALS['phpgw_info']['server']['template_set']))
{
-
$GLOBALS['phpgw_info']['server']['template_set'] = 'default';
+
$GLOBALS['phpgw_info']['server']['template_set'] = 'simple';
}
$imagedir = PHPGW_SERVER_ROOT . '/' .
$appname . '/templates/'
.
$GLOBALS['phpgw_info']['server']['template_set'] . '/images';
- $imagedir_default = PHPGW_SERVER_ROOT . '/' .
$appname . '/templates/default/images';
+ $imagedir_default = PHPGW_SERVER_ROOT . '/' .
$appname . '/templates/base/images';
$imagedir_olddefault = PHPGW_SERVER_ROOT . '/' .
$appname . '/images';
if ($this->is_image_dir ($imagedir))
@@ -875,11 +852,11 @@
if
(empty($GLOBALS['phpgw_info']['server']['template_set']))
{
-
$GLOBALS['phpgw_info']['server']['template_set'] = 'default';
+
$GLOBALS['phpgw_info']['server']['template_set'] = 'simple';
}
$imagedir = PHPGW_SERVER_ROOT .
'/'.$appname.'/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/images';
- $imagedir_default = PHPGW_SERVER_ROOT .
'/'.$appname.'/templates/default/images';
+ $imagedir_default = PHPGW_SERVER_ROOT .
'/'.$appname.'/templates/base/images';
$imagedir_olddefault = PHPGW_SERVER_ROOT .
'/'.$appname.'/images';
if ($this->is_image_dir ($imagedir))
@@ -888,7 +865,7 @@
}
elseif ($this->is_image_dir ($imagedir_default))
{
- return
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$appname.'/templates/default/images';
+ return
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$appname.'/templates/base/images';
}
elseif ($this->is_image_dir ($imagedir_olddefault))
{
@@ -905,7 +882,7 @@
if (address@hidden($this->found_files[$appname]))
{
$imagedir_olddefault = '/'.$appname.'/images';
- $imagedir_default =
'/'.$appname.'/templates/default/images';
+ $imagedir_default =
'/'.$appname.'/templates/base/images';
$imagedir =
'/'.$appname.'/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/images';
if
(@is_dir(PHPGW_INCLUDE_ROOT.$imagedir_olddefault))
@@ -956,10 +933,6 @@
{
$imgfile =
$GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files[$appname][$image.'.jpg'].'/'.$image.'.jpg';
}
-
elseif(isset($this->found_files[$appname][$image.'.gif']))
- {
- $imgfile =
$GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files[$appname][$image.'.gif'].'/'.$image.'.gif';
- }
elseif(isset($this->found_files[$appname][$image]))
{
$imgfile =
$GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files[$appname][$image].'/'.$image;
@@ -972,10 +945,6 @@
{
$imgfile =
$GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files['phpgwapi'][$image.'.jpg'].'/'.$image.'.jpg';
}
-
elseif(isset($this->found_files['phpgwapi'][$image.'.gif']))
- {
- $imgfile =
$GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files['phpgwapi'][$image.'.gif'].'/'.$image.'.gif';
- }
elseif(isset($this->found_files['phpgwapi'][$image]))
{
$imgfile =
$GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files['phpgwapi'][$image].'/'.$image;
@@ -999,14 +968,18 @@
}
if ($use_lang)
{
- while (list(,$img) = each($image))
+ foreach($image as $img)
{
$lang_images[] = $img . '_' .
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
$lang_images[] = $img;
}
$image = $lang_images;
}
- while (!$image_found && (list(,$img) = each($image)))
+ if($image_found)
+ {
+ return $image_found;
+ }
+ foreach($image as $img)
{
if(isset($this->found_files[$appname][$img.$ext]))
{
@@ -1169,7 +1142,7 @@
* the selected user theme colors. Next we load up the app CSS.
This is
* all merged into the selected theme's css.tpl file.
*
- * @author Dave Hall (*based* on verdilak? css inclusion code)
+ * @author Dave Hall skwashd at phpgroupware.org
* @return string Template including CSS definitions
*/
function get_css()
@@ -1197,16 +1170,25 @@
}
/**
+ * Backwards compatibility method
+ * @see get_javascript
+ */
+ function get_java_script()
+ {
+ return $this->get_javascript();
+ }
+
+ /**
* Include JavaScript in template header
*
* The method is included here to make it easier to change the
js support
* in phpgw. One change then all templates will support it (as
long as they
* include a call to this method).
*
- * @author Dave Hall (*vaguely based* on verdilak? css inclusion
code)
+ * @author Dave Hall skwashd at phpgroupware.org
* @return string The JavaScript code to include
*/
- function get_java_script()
+ function get_javascript()
{
$java_script = '';
if(@is_object($GLOBALS['phpgw']->js))
@@ -1234,7 +1216,7 @@
/**
* Get on(un)load attributes from javascript class
*
- * @author Dave Hall <address@hidden>
+ * @author Dave Hall skwashd at phpgroupware.org
* @return string Body attributes or empty
*/
function get_body_attribs()
@@ -1363,50 +1345,6 @@
}
/**
- * Wrapper to new hooks class
- *
- * @param string $location Location name
- * @param string $appname Application name
- * @param boolean $no_permission_check Do not use permission
check when set to true
- * @return mixed Result from $GLOBALS['phpgw']->hooks->process()
- * @deprecated
- */
- function hook($location, $appname = '', $no_permission_check =
False)
- {
- echo '$'."GLOBALS['phpgw']common->hook()".' has been
replaced. Please change to the new $'."GLOBALS['phpgw']hooks->process()".'. For
now this will act as a wrapper<br>';
- return $GLOBALS['phpgw']->hooks->process($location,
$order, $no_permission_check);
- }
-
- /**
- * Wrapper to new hooks class
- *
- * @param string $location Location name
- * @param string $appname Application name
- * @param boolean $no_permission_check Do not use permission
check when set to true
- * @return mixed Result from $GLOBALS['phpgw']->hooks->single()
- * @deprecated
- * @internal $no_permission_check should *ONLY* be used when it
*HAS* to be. (jengo)
- */
- function hook_single($location, $appname = '',
$no_permission_check = False)
- {
- echo '$'."GLOBALS['phpgw']common->hook_single()".' has
been replaced. Please change to the new $'."GLOBALS['phpgw']hooks->single()".'.
For now this will act as a wrapper<br>';
- return $GLOBALS['phpgw']->hooks->single($location,
$order, $no_permission_check);
- }
-
- /**
- * Wrapper to new hooks class
- *
- * @param string $location Location name
- * @return mixed Result from $GLOBALS['phpgw']->hooks->count()
- * @deprecated
- */
- function hook_count($location)
- {
- echo '$'."GLOBALS['phpgw']common->hook_count()".' has
been replaced. Please change to the new $'."GLOBALS['phpgw']hooks->count()".'.
For now this will act as a wrapper<br>';
- return $GLOBALS['phpgw']->hooks->count($location);
- }
-
- /**
* Wrapper to the session->appsession()
*
* @param string $data Data
@@ -1415,8 +1353,8 @@
*/
function appsession($data = '##NOTHING##')
{
- $this->debug_info[] = '$phpgw->common->appsession() is
a depreciated function'
- . ' - use $phpgw->session->appsession()
instead';
+ echo 'common::appsession() is a depreciated function'
+ . ' - use session::appsession() instead';
return
$GLOBALS['phpgw']->session->appsession('default','',$data);
}
@@ -1534,45 +1472,6 @@
}
/**
- * Uses code in class email.msg to obtain the appropriate
password for email
- *
- * @return string EMail password
- * @deprecated
- * @internal This is not the best place for it, but it needs to
be shared bewteen Aeromail and SM
- */
- /*
- function get_email_passwd_ex()
- {
- // ---- Create the email Message Class if needed
-----
- if (is_object($GLOBALS['phpgw']->msg))
- {
- $do_free_me = False;
- }
- else
- {
- $GLOBALS['phpgw']->msg =
CreateObject('email.mail_msg');
- $do_free_me = True;
- }
- // use the Msg class to obtain the appropriate password
- $tmp_prefs = $GLOBALS['phpgw']->preferences->read();
- if (!isset($tmp_prefs['email']['passwd']))
- {
- $email_passwd =
$GLOBALS['phpgw_info']['user']['passwd'];
- }
- else
- {
- $email_passwd =
$GLOBALS['phpgw']->msg->decrypt_email_passwd($tmp_prefs['email']['passwd']);
- }
- // cleanup and return
- if ($do_free_me)
- {
- unset ($GLOBALS['phpgw']->msg);
- }
- return $email_passwd;
- }
- */
-
- /**
* Create email preferences
*
* @param mixed $prefs Unused
@@ -1603,90 +1502,6 @@
}
}
- /*
- function create_emailpreferences($prefs,$accountid='')
- {
- $account_id = get_account_id($accountid);
-
- // NEW EMAIL PASSWD METHOD (shared between SM and
aeromail)
- $prefs['email']['passwd'] =
$this->get_email_passwd_ex();
-
- // Add default preferences info
- if (!isset($prefs['email']['userid']))
- {
- if
($GLOBALS['phpgw_info']['server']['mail_login_type'] == 'vmailmgr')
- {
- $prefs['email']['userid'] =
$GLOBALS['phpgw']->accounts->id2name($account_id)
- . '@' .
$GLOBALS['phpgw_info']['server']['mail_suffix'];
- }
- else
- {
- $prefs['email']['userid'] =
$GLOBALS['phpgw']->accounts->id2name($account_id);
- }
- }
- // Set Server Mail Type if not defined
- if
(empty($GLOBALS['phpgw_info']['server']['mail_server_type']))
- {
-
$GLOBALS['phpgw_info']['server']['mail_server_type'] = 'imap';
- }
-
- // OLD EMAIL PASSWD METHOD
- if (!isset($prefs['email']['passwd']))
- {
- $prefs['email']['passwd'] =
$GLOBALS['phpgw_info']['user']['passwd'];
- }
- else
- {
- $prefs['email']['passwd'] =
$this->decrypt($prefs['email']['passwd']);
- }
- // NEW EMAIL PASSWD METHOD Located at the begining of
this function
-
- if (!isset($prefs['email']['address']))
- {
- $prefs['email']['address'] =
$GLOBALS['phpgw']->accounts->id2name($account_id)
- . '@' .
$GLOBALS['phpgw_info']['server']['mail_suffix'];
- }
- if (!isset($prefs['email']['mail_server']))
- {
- $prefs['email']['mail_server'] =
$GLOBALS['phpgw_info']['server']['mail_server'];
- }
- if (!isset($prefs['email']['mail_server_type']))
- {
- $prefs['email']['mail_server_type'] =
$GLOBALS['phpgw_info']['server']['mail_server_type'];
- }
- if (!isset($prefs['email']['imap_server_type']))
- {
- $prefs['email']['imap_server_type'] =
$GLOBALS['phpgw_info']['server']['imap_server_type'];
- }
- // These sets the mail_port server variable
- if ($prefs['email']['mail_server_type']=='imap')
- {
- $prefs['email']['mail_port'] = '143';
- }
- elseif ($prefs['email']['mail_server_type']=='pop3')
- {
- $prefs['email']['mail_port'] = '110';
- }
- elseif ($prefs['email']['mail_server_type']=='imaps')
- {
- $prefs['email']['mail_port'] = '993';
- }
- elseif ($prefs['email']['mail_server_type']=='pop3s')
- {
- $prefs['email']['mail_port'] = '995';
- }
- // This is going to be used to switch to the nntp class
- if (isset($phpgw_info['flags']['newsmode']) &&
- $GLOBALS['phpgw_info']['flags']['newsmode'])
- {
- $prefs['email']['mail_server_type'] = 'nntp';
- }
- // DEBUG
- //echo "<br>prefs['email']['passwd']: "
.$prefs['email']['passwd'] .'<br>';
- return $prefs;
- }
- */
-
/**
* Convert application code to HTML text message
*
@@ -1804,109 +1619,13 @@
}
/**
- * Create $phpgw_info[] code from an array
- *
- * @param array $array Array with 1-4 key/value pairs for
$phpgw_info[]
- * @return string String with generated $phpgw_info[] code
- */
- function create_phpcode_from_array($array)
- {
- while (list($key, $val) = each($array))
- {
- if (is_array($val))
- {
- while (list($key2, $val2) = each($val))
- {
- if (is_array($val2))
- {
- while (list($key3,
$val3) = each ($val2))
- {
- if
(is_array($val3))
- {
- while
(list($key4, $val4) = each ($val3))
- {
-
$s .= '$phpgw_info["' . $key . '"]["' . $key2 . '"]["' . $key3 . '"]["' .$key4
. '"]="' . $val4 . '";';
-
$s .= "\n";
- }
- }
- else
- {
- $s .=
'$phpgw_info["' . $key . '"]["' . $key2 . '"]["' . $key3 . '"]="' . $val3 .
'";';
- $s .=
"\n";
- }
- }
- }
- else
- {
- $s .= '$phpgw_info["' .
$key .'"]["' . $key2 . '"]="' . $val2 . '";';
- $s .= "\n";
- }
- }
- }
- else
- {
- $s .= '$phpgw_info["' . $key . '"]="' .
$val . '";';
- $s .= "\n";
- }
- }
- return $s;
- }
-
- /**
- * Display the full phpgw_info array for debugging
- *
- * @param array $array phpgw_info[]
- */
- function debug_list_array_contents($array)
- {
- while (list($key, $val) = each($array))
- {
- if (is_array($val))
- {
- while (list($key2, $val2) = each($val))
- {
- if (is_array($val2))
- {
- while (list($key3,
$val3) = each ($val2))
- {
- if
(is_array($val3))
- {
- while
(list($key4, $val4) = each ($val3))
- {
-
echo $$array . "[$key][$key2][$key3][$key4]=$val4<br />";
- }
- }
- else
- {
- echo
$$array . "[$key][$key2][$key3]=$val3<br />";
- }
- }
- }
- else
- {
- echo $$array .
"[$key][$key2]=$val2<br />";
- }
- }
- }
- else
- {
- echo $$array . "[$key]=$val<br />";
- }
- }
- }
-
- /**
* Display a list of core functions in the API
*
* @internal Works on systems with grep only
*/
function debug_list_core_functions()
{
- echo '<br /><strong>core functions</strong><br />';
- echo '<pre>';
- chdir(PHPGW_INCLUDE_ROOT . '/phpgwapi');
- system("grep -r '^[ \t]*function' *");
- echo '</pre>';
+ echo 'common::debug_list_core_functions() is deprecated
- no output generated!<br />';
}
/**
@@ -2055,9 +1774,7 @@
if (is_array($text))
{
- reset($text);
-
- while (list($key,$value) = each($text))
+ foreach($text as $key => $value)
{
if ($value == True)
{
@@ -2112,7 +1829,5 @@
return $data;
}
}
-
-
-
}
+?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc/class.common.inc.php, 1.123.2.9.2.28.2.2,
nomail <=