2001-01-11 10:52:33 +01:00
|
|
|
<?php
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
2016-03-05 16:32:49 +01:00
|
|
|
* EGroupware API: Commononly used (static) functions
|
2009-03-16 13:49:31 +01:00
|
|
|
*
|
|
|
|
* This file written by Dan Kuykendall <seek3r@phpgroupware.org>
|
|
|
|
* and Joseph Engo <jengo@phpgroupware.org>
|
|
|
|
* and Mark Peters <skeeter@phpgroupware.org>
|
|
|
|
* and Lars Kneschke <lkneschke@linux-at-work.de>
|
|
|
|
* Functions commonly used by eGroupWare developers
|
|
|
|
* Copyright (C) 2000, 2001 Dan Kuykendall
|
|
|
|
* Copyright (C) 2003 Lars Kneschke
|
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @package api
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
|
|
|
|
2016-03-05 16:32:49 +01:00
|
|
|
use EGroupware\Api;
|
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
2016-03-05 16:32:49 +01:00
|
|
|
* Commononly used (static) functions
|
|
|
|
*
|
|
|
|
* @deprecated use Api\* alternatives mentioned in individual methods
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
class common
|
|
|
|
{
|
|
|
|
static $debug_info; // An array with debugging info from the API
|
|
|
|
static $found_files;
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-04-03 14:26:32 +02:00
|
|
|
/**
|
|
|
|
* Try to guess and set a locale supported by the server, with fallback to 'en_EN' and 'C'
|
|
|
|
*
|
|
|
|
* This method uses the language and nationalty set in the users common prefs.
|
|
|
|
*
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param $category =LC_ALL category to set, see setlocal function
|
|
|
|
* @param $charset =null default system charset
|
2009-04-03 14:26:32 +02:00
|
|
|
* @return string the local (or best estimate) set
|
2016-03-28 20:51:38 +02:00
|
|
|
* @deprecated use Api\Preferences::setlocal($category,$charset)
|
2009-04-03 14:26:32 +02:00
|
|
|
*/
|
2016-03-28 20:51:38 +02:00
|
|
|
static function setlocale($category=LC_ALL, $charset=null)
|
2009-04-03 14:26:32 +02:00
|
|
|
{
|
2016-03-28 20:51:38 +02:00
|
|
|
return Api\Preferences::setlocale($category, $charset);
|
2009-04-03 14:26:32 +02:00
|
|
|
}
|
|
|
|
|
2005-11-02 12:45:52 +01:00
|
|
|
/**
|
2009-03-16 13:49:31 +01:00
|
|
|
* Compares two Version strings and return 1 if str2 is newest (bigger version number) than str1
|
2005-11-02 12:45:52 +01:00
|
|
|
*
|
2009-03-16 13:49:31 +01:00
|
|
|
* This function checks for major version only.
|
|
|
|
* @param $str1
|
|
|
|
* @param $str2
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated not used anymore
|
2005-11-02 12:45:52 +01:00
|
|
|
*/
|
2009-03-16 13:49:31 +01:00
|
|
|
static function cmp_version($str1,$str2,$debug=False)
|
2001-03-18 06:16:00 +01:00
|
|
|
{
|
2014-07-05 09:58:48 +02:00
|
|
|
$regs = $regs2 = null;
|
2010-11-27 10:41:16 +01:00
|
|
|
preg_match("/([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)/",$str1,$regs);
|
|
|
|
preg_match("/([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)/",$str2,$regs2);
|
2009-03-16 13:49:31 +01:00
|
|
|
if($debug) { echo "<br>$regs[0] - $regs2[0]"; }
|
|
|
|
|
|
|
|
for($i=1;$i<5;$i++)
|
|
|
|
{
|
|
|
|
if($debug) { echo "<br>$i: $regs[$i] - $regs2[$i]"; }
|
|
|
|
if($regs2[$i] == $regs[$i])
|
2001-09-08 18:02:59 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if($regs2[$i] > $regs[$i])
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
elseif($regs2[$i] < $regs[$i])
|
|
|
|
{
|
|
|
|
return 0;
|
2001-09-08 18:02:59 +02:00
|
|
|
}
|
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2001-09-08 18:02:59 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* Compares two Version strings and return 1 if str2 is newest (bigger version number) than str1
|
|
|
|
*
|
|
|
|
* This function checks all fields. cmp_version() checks release version only.
|
|
|
|
* @param $str1
|
|
|
|
* @param $str2
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated not used anymore
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function cmp_version_long($str1,$str2,$debug=False)
|
|
|
|
{
|
2014-07-05 09:58:48 +02:00
|
|
|
$regs = $regs2 = null;
|
2010-11-27 10:41:16 +01:00
|
|
|
preg_match("/([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)\.([0-9]*)/",$str1,$regs);
|
|
|
|
preg_match("/([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)\.([0-9]*)/",$str2,$regs2);
|
2009-03-16 13:49:31 +01:00
|
|
|
if($debug) { echo "<br>$regs[0] - $regs2[0]"; }
|
|
|
|
|
|
|
|
for($i=1;$i<6;$i++)
|
2001-09-08 18:02:59 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
if($debug) { echo "<br>$i: $regs[$i] - $regs2[$i]"; }
|
2002-01-04 05:44:09 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
if($regs2[$i] == $regs[$i])
|
2001-09-08 18:02:59 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
if($debug) { echo ' are equal...'; }
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if($regs2[$i] > $regs[$i])
|
|
|
|
{
|
|
|
|
if($debug) { echo ', and a > b'; }
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
elseif($regs2[$i] < $regs[$i])
|
|
|
|
{
|
|
|
|
if($debug) { echo ', and a < b'; }
|
|
|
|
return 0;
|
2001-03-23 06:56:15 +01:00
|
|
|
}
|
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
if($debug) { echo ' - all equal.'; }
|
|
|
|
}
|
2001-01-11 10:52:33 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
2016-04-02 12:44:17 +02:00
|
|
|
* generate a unique id, which can be used for syncronisation
|
|
|
|
*
|
|
|
|
* @param string $_appName the appname
|
|
|
|
* @param string $_eventID the id of the content
|
|
|
|
* @deprecated use Api\CalDAV::generate_uid($_appName, $_eventID)
|
|
|
|
* @return string the unique id
|
|
|
|
*/
|
2009-03-16 13:49:31 +01:00
|
|
|
static function generate_uid($_appName, $_eventID)
|
|
|
|
{
|
2016-04-02 12:44:17 +02:00
|
|
|
return Api\CalDAV::generate_uid($_appName, $_eventID);
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2008-04-25 20:52:33 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
2016-04-02 12:44:17 +02:00
|
|
|
* get the local content id from a global UID
|
|
|
|
*
|
|
|
|
* @param sting $_globalUid the global UID
|
|
|
|
* @deprecated dont use, as only EGroupware interal uids are reversable
|
|
|
|
* @return int local egw content id
|
|
|
|
*/
|
2009-03-16 13:49:31 +01:00
|
|
|
static function get_egwId($_globalUid)
|
|
|
|
{
|
|
|
|
if(empty($_globalUid)) return false;
|
|
|
|
|
|
|
|
$globalUidParts = explode('-',$_globalUid);
|
|
|
|
array_shift($globalUidParts); // remove the app name
|
|
|
|
array_pop($globalUidParts); // remove the install_id
|
2008-04-25 20:52:33 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
return implode('-',$globalUidParts); // return the rest, allowing to have dashs in the id, can happen with LDAP!
|
|
|
|
}
|
2001-02-05 17:37:38 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* return an array of installed languages
|
|
|
|
*
|
|
|
|
* @return $installedLanguages; an array containing the installed languages
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated not used anymore
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function getInstalledLanguages()
|
|
|
|
{
|
|
|
|
$GLOBALS['egw']->db->query('SELECT DISTINCT lang FROM egw_lang');
|
|
|
|
while (@$GLOBALS['egw']->db->next_record())
|
|
|
|
{
|
|
|
|
$installedLanguages[$GLOBALS['egw']->db->f('lang')] = $GLOBALS['egw']->db->f('lang');
|
2001-03-18 06:16:00 +01:00
|
|
|
}
|
2001-02-05 17:37:38 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
return $installedLanguages;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get preferred language of the users
|
|
|
|
*
|
|
|
|
* Uses HTTP_ACCEPT_LANGUAGE (from the browser) and getInstalledLanguages to find out which languages are installed
|
|
|
|
*
|
|
|
|
* @return string
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated not used anymore
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function getPreferredLanguage()
|
|
|
|
{
|
|
|
|
// create a array of languages the user is accepting
|
|
|
|
$userLanguages = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
|
$supportedLanguages = self::getInstalledLanguages();
|
|
|
|
|
|
|
|
// find usersupported language
|
2014-07-05 09:58:48 +02:00
|
|
|
foreach($userLanguages as $lang)
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
// remove everything behind '-' example: de-de
|
2014-07-05 09:58:48 +02:00
|
|
|
$pieces = explode('-', trim($lang));
|
2009-03-16 13:49:31 +01:00
|
|
|
$value = $pieces[0];
|
|
|
|
# print 'current lang $value<br>';
|
|
|
|
if ($supportedLanguages[$value])
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$retValue=$value;
|
|
|
|
break;
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
// no usersupported language found -> return english
|
|
|
|
if (empty($retValue))
|
|
|
|
{
|
|
|
|
$retValue='en';
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
2001-01-11 10:52:33 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
return $retValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* escapes a string for use in searchfilters meant for ldap_search.
|
|
|
|
*
|
|
|
|
* Escaped Characters are: '*', '(', ')', ' ', '\', NUL
|
|
|
|
* It's actually a PHP-Bug, that we have to escape space.
|
|
|
|
* For all other Characters, refer to RFC2254.
|
|
|
|
*
|
2016-03-06 16:54:07 +01:00
|
|
|
* @deprecated use Api\Ldap::quote()
|
2009-03-16 13:49:31 +01:00
|
|
|
* @param $string either a string to be escaped, or an array of values to be escaped
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
static function ldap_addslashes($string='')
|
|
|
|
{
|
2016-03-06 16:54:07 +01:00
|
|
|
return Api\Ldap::quote($string);
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* connect to the ldap server and return a handle
|
|
|
|
*
|
2016-03-06 21:47:10 +01:00
|
|
|
* @deprecated use Api\Ldap::factory(true, $host, $dn, $passwd)
|
|
|
|
* @param string $host ='' ldap host
|
|
|
|
* @param string $dn ='' ldap_root_dn
|
|
|
|
* @param string $passwd ='' ldap_root_pw
|
2009-03-16 13:49:31 +01:00
|
|
|
* @return resource
|
|
|
|
*/
|
|
|
|
static function ldapConnect($host='', $dn='', $passwd='')
|
|
|
|
{
|
|
|
|
// use Lars new ldap class
|
2016-03-06 21:47:10 +01:00
|
|
|
return Api\Ldap::factory(true, $host, $dn, $passwd);
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* function to stop running an app
|
|
|
|
*
|
|
|
|
* @param $call_footer boolean value to if true then call footer else exit
|
2016-03-20 17:30:01 +01:00
|
|
|
* @deprecated use $GLOBALS['egw']->framework->footer(), if necessary, and exit
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function egw_exit($call_footer = False)
|
|
|
|
{
|
|
|
|
if (!defined('EGW_EXIT'))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
define('EGW_EXIT',True);
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
if ($call_footer)
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
self::egw_footer();
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
|
|
|
exit;
|
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* return a random string of size $size
|
|
|
|
*
|
|
|
|
* @param $size int-size of random string to return
|
2016-03-06 21:47:10 +01:00
|
|
|
* @deprecated use Api\Auth::randomstring($size)
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function randomstring($size)
|
|
|
|
{
|
2016-03-06 21:47:10 +01:00
|
|
|
return Api\Auth::randomstring($size);
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2016-03-05 16:32:49 +01:00
|
|
|
/**
|
|
|
|
* @deprecated just use forward slashes supported by PHP on all OS
|
|
|
|
*/
|
2009-03-16 13:49:31 +01:00
|
|
|
static function filesystem_separator()
|
|
|
|
{
|
|
|
|
return filesystem_separator();
|
|
|
|
}
|
2003-08-28 16:31:11 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* This is used for reporting errors in a nice format.
|
|
|
|
*
|
|
|
|
* @param $error - array of errors
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated not used anymore
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function error_list($errors,$text='Error')
|
|
|
|
{
|
|
|
|
if (!is_array($errors))
|
|
|
|
{
|
|
|
|
return False;
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
2001-01-11 10:52:33 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
$html_error = '<table border="0" width="100%"><tr><td align="right"><b>' . lang($text)
|
|
|
|
. '</b>: </td><td align="left">' . $errors[0] . '</td></tr>';
|
|
|
|
for ($i=1; $i<count($errors); $i++)
|
2001-04-04 09:14:31 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$html_error .= '<tr><td> </td><td align="left">' . $errors[$i] . '</td></tr>';
|
2001-04-04 09:14:31 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
return $html_error . '</table>';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* return the fullname of a user
|
|
|
|
*
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param $lid ='' account loginid
|
|
|
|
* @param $firstname ='' firstname
|
|
|
|
* @param $lastname ='' lastname
|
|
|
|
* @param $accountid =0 id, to check if it's a user or group, otherwise the lid will be used
|
2016-03-06 16:54:07 +01:00
|
|
|
* @deprecated use Api\Accounts::format_username()
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function display_fullname($lid = '', $firstname = '', $lastname = '',$accountid=0)
|
|
|
|
{
|
2016-03-06 16:54:07 +01:00
|
|
|
return Api\Accounts::format_username($lid, $firstname, $lastname, $accountid);
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2008-04-25 20:52:33 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
2016-03-06 16:54:07 +01:00
|
|
|
* Return formatted username for a given account_id
|
2009-03-16 13:49:31 +01:00
|
|
|
*
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param string $accountid =null account id
|
2011-06-24 12:28:08 +02:00
|
|
|
* @return string full name of user or "#$accountid" if user not found
|
2016-03-06 16:54:07 +01:00
|
|
|
* @deprecated use Api\Accounts::username($accountid)
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
2016-03-05 16:32:49 +01:00
|
|
|
static function grab_owner_name($accountid=null)
|
2009-03-16 13:49:31 +01:00
|
|
|
{
|
2016-03-06 16:54:07 +01:00
|
|
|
return Api\Accounts::username($accountid);
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2008-04-25 20:52:33 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* create tabs
|
|
|
|
*
|
|
|
|
* @param array $tabs an array repersenting the tabs you wish to display, each element
|
|
|
|
* * * in the array is an array of 3 elements, 'label' which is the
|
|
|
|
* * * text displaed on the tab (you should pass translated string,
|
|
|
|
* * * create_tabs will not do <code>lang()</code> for you), 'link'
|
|
|
|
* * * which is the uri, 'target', the frame name or '_blank' to show
|
|
|
|
* * * page in a new browser window.
|
|
|
|
* @param mixed $selected the tab whos key is $selected will be displayed as current tab
|
|
|
|
* @param $fontsize optional
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated not used anymore
|
2009-03-16 13:49:31 +01:00
|
|
|
* @return string return html that displays the tabs
|
|
|
|
*/
|
|
|
|
static function create_tabs($tabs, $selected, $fontsize = '')
|
|
|
|
{
|
|
|
|
$output_text = '<table border="0" cellspacing="0" cellpadding="0"><tr>';
|
2001-03-22 14:25:06 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/* This is a php3 workaround */
|
|
|
|
if(EGW_IMAGES_DIR == 'EGW_IMAGES_DIR')
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$ir = ExecMethod('phpgwapi.phpgw.common.get_image_path', 'phpgwapi');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$ir = EGW_IMAGES_DIR;
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
2001-01-11 10:52:33 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
if ($fontsize)
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$fs = '<font size="' . $fontsize . '">';
|
|
|
|
$fse = '</font>';
|
|
|
|
}
|
2001-09-05 05:06:14 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
$i = 1;
|
|
|
|
while ($tab = each($tabs))
|
|
|
|
{
|
|
|
|
if ($tab[0] == $selected)
|
2001-09-05 05:06:14 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
if ($i == 1)
|
|
|
|
{
|
|
|
|
$output_text .= '<td align="right"><img src="' . $ir . '/tabs-start1.gif"></td>';
|
|
|
|
}
|
2003-08-28 16:31:11 +02:00
|
|
|
|
2012-12-03 19:36:00 +01:00
|
|
|
$output_text .= '<td align="left" style="background: url(' . $ir . '/tabs-bg1.gif) repeat-x;"> <b><a href="'
|
2009-03-16 13:49:31 +01:00
|
|
|
. $tab[1]['link'] . '" class="tablink" '.$tab[1]['target'].'>' . $fs . $tab[1]['label']
|
|
|
|
. $fse . '</a></b> </td>';
|
|
|
|
if ($i == count($tabs))
|
|
|
|
{
|
|
|
|
$output_text .= '<td align="left"><img src="' . $ir . '/tabs-end1.gif"></td>';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$output_text .= '<td align="left"><img src="' . $ir . '/tabs-sepr.gif"></td>';
|
|
|
|
}
|
2003-08-28 16:31:11 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
else
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
if ($i == 1)
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$output_text .= '<td align="right"><img src="' . $ir . '/tabs-start0.gif"></td>';
|
|
|
|
}
|
2012-12-03 19:36:00 +01:00
|
|
|
$output_text .= '<td align="left" style="background: url(' . $ir . '/tabs-bg0.gif) repeat-x;"> <b><a href="'
|
2009-03-16 13:49:31 +01:00
|
|
|
. $tab[1]['link'] . '" class="tablink" '.$tab[1]['target'].'>' . $fs . $tab[1]['label'] . $fse
|
|
|
|
. '</a></b> </td>';
|
|
|
|
if (($i + 1) == $selected)
|
|
|
|
{
|
|
|
|
$output_text .= '<td align="left"><img src="' . $ir . '/tabs-sepl.gif"></td>';
|
|
|
|
}
|
|
|
|
elseif ($i == $selected || $i != count($tabs))
|
|
|
|
{
|
|
|
|
$output_text .= '<td align="left"><img src="' . $ir . '/tabs-sepm.gif"></td>';
|
|
|
|
}
|
|
|
|
elseif ($i == count($tabs))
|
|
|
|
{
|
|
|
|
if ($i == $selected)
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2003-08-28 16:31:11 +02:00
|
|
|
$output_text .= '<td align="left"><img src="' . $ir . '/tabs-end1.gif"></td>';
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$output_text .= '<td align="left"><img src="' . $ir . '/tabs-end0.gif"></td>';
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
if ($i != count($tabs))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$output_text .= '<td align="left"><img src="' . $ir . '/tabs-sepr.gif"></td>';
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
$i++;
|
|
|
|
$output_text .= "\n";
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
$output_text .= "</table>\n";
|
|
|
|
return $output_text;
|
|
|
|
}
|
2002-01-04 05:06:13 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* get directory of application
|
|
|
|
*
|
|
|
|
* $appname can either be passed or derived from $GLOBALS['egw_info']['flags']['currentapp'];
|
|
|
|
* @param $appname name of application
|
|
|
|
*/
|
|
|
|
static function get_app_dir($appname = '')
|
|
|
|
{
|
|
|
|
if ($appname == '')
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$appname = $GLOBALS['egw_info']['flags']['currentapp'];
|
|
|
|
}
|
|
|
|
if ($appname == 'logout' || $appname == 'login')
|
|
|
|
{
|
|
|
|
$appname = 'phpgwapi';
|
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
$appdir = EGW_INCLUDE_ROOT . '/'.$appname;
|
|
|
|
$appdir_default = EGW_SERVER_ROOT . '/'.$appname;
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
if (@is_dir($appdir))
|
|
|
|
{
|
|
|
|
return $appdir;
|
|
|
|
}
|
|
|
|
elseif (@is_dir($appdir_default))
|
|
|
|
{
|
|
|
|
return $appdir_default;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return False;
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* get inc (include dir) of application
|
|
|
|
*
|
|
|
|
* $appname can either be passed or derived from $GLOBALS['egw_info']['flags']['currentapp'];
|
|
|
|
* @param $appname name of application
|
|
|
|
*/
|
|
|
|
static function get_inc_dir($appname = '')
|
|
|
|
{
|
|
|
|
if (!$appname)
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$appname = $GLOBALS['egw_info']['flags']['currentapp'];
|
|
|
|
}
|
|
|
|
if ($appname == 'logout' || $appname == 'login' || $appname == 'about')
|
|
|
|
{
|
|
|
|
$appname = 'phpgwapi';
|
|
|
|
}
|
2004-01-18 22:12:53 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
$incdir = EGW_INCLUDE_ROOT . '/' . $appname . '/inc';
|
|
|
|
$incdir_default = EGW_SERVER_ROOT . '/' . $appname . '/inc';
|
2004-01-18 22:12:53 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
if (@is_dir ($incdir))
|
|
|
|
{
|
|
|
|
return $incdir;
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
elseif (@is_dir ($incdir_default))
|
|
|
|
{
|
|
|
|
return $incdir_default;
|
|
|
|
}
|
|
|
|
else
|
2002-09-27 19:39:49 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
return False;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get template dir of an application
|
|
|
|
*
|
|
|
|
* @param $appname appication name optional can be derived from $GLOBALS['egw_info']['flags']['currentapp'];
|
2010-06-02 11:20:55 +02:00
|
|
|
* @return string|boolean dir or false if no dir is found
|
2016-04-27 21:11:41 +02:00
|
|
|
* @deprecated use Api\Framework\Template::get_dir($appname)
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function get_tpl_dir($appname = '')
|
|
|
|
{
|
2016-04-27 21:11:41 +02:00
|
|
|
return Api\Framework\Template::get_dir($appname);
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* checks if image_dir exists and has more than just a navbar-icon
|
|
|
|
*
|
|
|
|
* this is just a workaround for idots, better to use find_image, which has a fallback \
|
|
|
|
* on a per image basis to the default dir
|
2011-08-31 00:03:17 +02:00
|
|
|
*
|
|
|
|
* @deprecated
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function is_image_dir($dir)
|
|
|
|
{
|
|
|
|
if (!@is_dir($dir))
|
2003-05-03 12:59:16 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
return False;
|
|
|
|
}
|
2014-07-05 09:58:48 +02:00
|
|
|
if (($d = opendir($dir)))
|
2009-03-16 13:49:31 +01:00
|
|
|
{
|
|
|
|
while ($f = readdir($d))
|
2003-05-03 12:59:16 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$ext = strtolower(strrchr($f,'.'));
|
|
|
|
if (($ext == '.gif' || $ext == '.png') && strpos($f,'navbar') === False)
|
2003-05-03 12:59:16 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
closedir($d);
|
|
|
|
return True;
|
2003-05-03 12:59:16 +02:00
|
|
|
}
|
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
closedir($d);
|
2003-05-03 12:59:16 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
return False;
|
|
|
|
}
|
2003-05-03 12:59:16 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* get image dir of an application
|
|
|
|
*
|
|
|
|
* @param $appname application name optional can be derived from $GLOBALS['egw_info']['flags']['currentapp'];
|
2011-08-31 00:03:17 +02:00
|
|
|
* @deprecated
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function get_image_dir($appname = '')
|
|
|
|
{
|
|
|
|
if ($appname == '')
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$appname = $GLOBALS['egw_info']['flags']['currentapp'];
|
|
|
|
}
|
|
|
|
if (empty($GLOBALS['egw_info']['server']['template_set']))
|
|
|
|
{
|
|
|
|
$GLOBALS['egw_info']['server']['template_set'] = 'idots';
|
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
$imagedir = EGW_SERVER_ROOT . '/' . $appname . '/templates/'
|
|
|
|
. $GLOBALS['egw_info']['server']['template_set'] . '/images';
|
|
|
|
$imagedir_default = EGW_SERVER_ROOT . '/' . $appname . '/templates/idots/images';
|
|
|
|
$imagedir_olddefault = EGW_SERVER_ROOT . '/' . $appname . '/images';
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
if (self::is_image_dir ($imagedir))
|
|
|
|
{
|
|
|
|
return $imagedir;
|
|
|
|
}
|
|
|
|
elseif (self::is_image_dir ($imagedir_default))
|
|
|
|
{
|
|
|
|
return $imagedir_default;
|
|
|
|
}
|
|
|
|
elseif (self::is_image_dir ($imagedir_olddefault))
|
|
|
|
{
|
|
|
|
return $imagedir_olddefault;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return False;
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* get image path of an application
|
|
|
|
*
|
|
|
|
* @param $appname appication name optional can be derived from $GLOBALS['egw_info']['flags']['currentapp'];
|
2011-08-31 00:03:17 +02:00
|
|
|
* @deprecated
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function get_image_path($appname = '')
|
|
|
|
{
|
|
|
|
if ($appname == '')
|
2001-03-08 09:44:57 +01:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$appname = $GLOBALS['egw_info']['flags']['currentapp'];
|
|
|
|
}
|
2001-03-08 09:44:57 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
if (empty($GLOBALS['egw_info']['server']['template_set']))
|
|
|
|
{
|
|
|
|
$GLOBALS['egw_info']['server']['template_set'] = 'idots';
|
|
|
|
}
|
2001-03-08 09:44:57 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
$imagedir = EGW_SERVER_ROOT . '/'.$appname.'/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/images';
|
|
|
|
$imagedir_default = EGW_SERVER_ROOT . '/'.$appname.'/templates/idots/images';
|
|
|
|
$imagedir_olddefault = EGW_SERVER_ROOT . '/'.$appname.'/templates/default/images';
|
2001-03-08 09:44:57 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
if (self::is_image_dir($imagedir))
|
|
|
|
{
|
|
|
|
return $GLOBALS['egw_info']['server']['webserver_url'].'/'.$appname.'/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/images';
|
|
|
|
}
|
|
|
|
elseif (self::is_image_dir($imagedir_default))
|
|
|
|
{
|
|
|
|
return $GLOBALS['egw_info']['server']['webserver_url'].'/'.$appname.'/templates/idots/images';
|
2001-03-08 09:44:57 +01:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
elseif (self::is_image_dir($imagedir_olddefault))
|
|
|
|
{
|
|
|
|
return $GLOBALS['egw_info']['server']['webserver_url'].'/'.$appname.'/templates/default/images';
|
|
|
|
}
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
|
2011-08-31 00:16:31 +02:00
|
|
|
/**
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated use Api\Image::find($app,$image) they are identical now
|
2011-08-31 00:16:31 +02:00
|
|
|
*/
|
|
|
|
static function find_image($app,$image)
|
|
|
|
{
|
2016-03-05 16:32:49 +01:00
|
|
|
return Api\Image::find($app,$image);
|
2011-08-31 00:16:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-08-31 09:52:19 +02:00
|
|
|
* Searches an image of a given type, if not found also without extension
|
|
|
|
*
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param string $app
|
2011-08-31 09:52:19 +02:00
|
|
|
* @param string|array $image one or more image-name in order of precedence
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param string $extension ='' extension to $image, makes sense only with an array
|
|
|
|
* @param boolean $svg =false should svg images be returned or not:
|
2014-02-16 10:12:08 +01:00
|
|
|
* true: always return svg, false: never return svg (current default), null: browser dependent, see svg_usable()
|
2011-08-31 09:52:19 +02:00
|
|
|
* @return string url of image or null if not found
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated not used in newer template
|
2011-08-31 00:16:31 +02:00
|
|
|
*/
|
2014-02-16 10:12:08 +01:00
|
|
|
static function image_on($app,$image,$extension='_on',$svg=false)
|
2011-08-31 00:16:31 +02:00
|
|
|
{
|
2016-03-05 16:32:49 +01:00
|
|
|
return ($img = Api\Image::find($app,$image,$extension,$svg)) ? $img : Api\Image::find($app,$image,'',$svg);
|
2011-08-31 00:16:31 +02:00
|
|
|
}
|
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
2011-08-31 00:03:17 +02:00
|
|
|
* Searches a appname, template and maybe language and type-specific image
|
2009-03-16 13:49:31 +01:00
|
|
|
*
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param string $app
|
2011-08-31 00:03:17 +02:00
|
|
|
* @param string|array $image one or more image-name in order of precedence
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param string $extension ='' extension to $image, makes sense only with an array
|
|
|
|
* @param boolean $_svg =false should svg images be returned or not:
|
2014-02-11 15:41:17 +01:00
|
|
|
* true: always return svg, false: never return svg (current default), null: browser dependent, see svg_usable()
|
2011-08-31 00:03:17 +02:00
|
|
|
* @return string url of image or null if not found
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated use Api\Image::find($app,$image,$extension='',$_svg=false)
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
2016-03-05 16:32:49 +01:00
|
|
|
static function image($app,$image,$extension='',$_svg=false)
|
2009-03-16 13:49:31 +01:00
|
|
|
{
|
2016-03-05 16:32:49 +01:00
|
|
|
return Api\Image::find($app, $image, $extension, $_svg);
|
2011-08-31 00:03:17 +02:00
|
|
|
}
|
2008-04-25 20:52:33 +02:00
|
|
|
|
2014-02-11 15:41:17 +01:00
|
|
|
/**
|
|
|
|
* Does browser support svg
|
|
|
|
*
|
|
|
|
* All non IE and IE 9+
|
|
|
|
*
|
|
|
|
* @return boolean
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated use Api\Image::svg_usable()
|
2014-02-11 15:41:17 +01:00
|
|
|
*/
|
|
|
|
static function svg_usable()
|
|
|
|
{
|
2016-03-05 16:32:49 +01:00
|
|
|
return Api\Image::svg_usable();
|
2014-02-11 15:41:17 +01:00
|
|
|
}
|
|
|
|
|
2011-08-31 00:03:17 +02:00
|
|
|
/**
|
|
|
|
* Scan filesystem for images of all apps
|
|
|
|
*
|
|
|
|
* For each application and image-name (without extension) one full path is returned.
|
2013-12-05 03:04:59 +01:00
|
|
|
* The path takes template-set and image-type-priority (now fixed to: png, jpg, gif, ico) into account.
|
2011-08-31 00:03:17 +02:00
|
|
|
*
|
|
|
|
* VFS image directory is treated like an application named 'vfs'.
|
|
|
|
*
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param string $template_set =null 'default', 'idots', 'jerryr', default is template-set from user prefs
|
|
|
|
* @param boolean $svg =null prefer svg images, default for all browsers but IE<9
|
2011-08-31 00:03:17 +02:00
|
|
|
* @return array of application => image-name => full path
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated use Api\Image::map($template_set=null, $svg=null)
|
2011-08-31 00:03:17 +02:00
|
|
|
*/
|
2014-01-03 19:49:24 +01:00
|
|
|
static function image_map($template_set=null, $svg=null)
|
2011-08-31 00:03:17 +02:00
|
|
|
{
|
2016-03-05 16:32:49 +01:00
|
|
|
return Api\Image::map($template_set, $svg);
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2001-12-29 18:35:13 +01:00
|
|
|
|
2011-08-31 12:16:12 +02:00
|
|
|
/**
|
|
|
|
* Delete image map cache for ALL template sets
|
2009-03-16 13:49:31 +01:00
|
|
|
*
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated use Api\Image::invalidate()
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
2016-03-08 09:13:26 +01:00
|
|
|
public static function delete_image_map()
|
2009-03-16 13:49:31 +01:00
|
|
|
{
|
2016-03-05 16:32:49 +01:00
|
|
|
return Api\Image::invalidate();
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2005-03-03 11:47:28 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* prepare an array with variables used to render the navbar
|
|
|
|
*
|
|
|
|
* @deprecated inherit from egw_framework class in your template and use egw_framework::_navbar_vars()
|
|
|
|
*/
|
|
|
|
static function navbar()
|
|
|
|
{
|
|
|
|
$GLOBALS['egw_info']['navbar'] = $GLOBALS['egw']->framework->_get_navbar_vars();
|
|
|
|
}
|
2002-10-26 22:33:04 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* load header.inc.php for an application
|
|
|
|
*
|
|
|
|
* @deprecated
|
|
|
|
*/
|
|
|
|
static function app_header()
|
|
|
|
{
|
|
|
|
if (file_exists(EGW_APP_INC . '/header.inc.php'))
|
2003-04-21 10:32:53 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
include(EGW_APP_INC . '/header.inc.php');
|
2002-10-26 00:34:04 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2002-10-26 00:34:04 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* load the eGW header
|
|
|
|
*
|
|
|
|
* @deprecated use egw_framework::header(), $GLOBALS['egw']->framework->navbar() or better egw_framework::render($content)
|
|
|
|
*/
|
|
|
|
static function egw_header()
|
|
|
|
{
|
|
|
|
echo $GLOBALS['egw']->framework->header();
|
2003-12-20 19:41:42 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
if (!$GLOBALS['egw_info']['flags']['nonavbar'])
|
2003-08-30 10:44:51 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
echo $GLOBALS['egw']->framework->navbar();
|
2003-08-30 10:44:51 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2003-08-30 10:44:51 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* load the eGW footer
|
|
|
|
*
|
2010-06-15 11:15:00 +02:00
|
|
|
* @deprecated use echo $GLOBALS['egw']->framework->footer() or egw_framework::render($content)
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function egw_footer()
|
|
|
|
{
|
2010-06-15 11:15:00 +02:00
|
|
|
if(is_object($GLOBALS['egw']->framework))
|
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
echo $GLOBALS['egw']->framework->footer();
|
2003-04-20 01:17:40 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2003-08-30 10:44:51 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* Used by template headers for including CSS in the header
|
|
|
|
*
|
2011-01-06 21:47:21 +01:00
|
|
|
* @deprecated use $GLOBALS['egw']->framework->_get_css()
|
2009-03-16 13:49:31 +01:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
static function get_css()
|
|
|
|
{
|
|
|
|
return $GLOBALS['egw']->framework->_get_css();
|
|
|
|
}
|
2001-12-27 16:48:42 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* Used by the template headers for including javascript in the header
|
|
|
|
*
|
2011-01-06 21:47:21 +01:00
|
|
|
* @deprecated use egw_framework::_get_js()
|
2009-03-16 13:49:31 +01:00
|
|
|
* @return string the javascript to be included
|
|
|
|
*/
|
|
|
|
static function get_java_script()
|
|
|
|
{
|
2011-01-06 21:47:21 +01:00
|
|
|
return egw_framework::_get_js();
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2003-08-28 16:31:11 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* Returns on(Un)Load attributes from js class
|
|
|
|
*
|
2011-01-06 21:47:21 +01:00
|
|
|
* @deprecated use egw_framework::_get_js()
|
2009-03-16 13:49:31 +01:00
|
|
|
* @returns string body attributes
|
|
|
|
*/
|
|
|
|
static function get_body_attribs()
|
|
|
|
{
|
2011-01-06 21:47:21 +01:00
|
|
|
return egw_framework::_get_body_attribs();
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2001-12-27 16:48:42 +01:00
|
|
|
|
2016-03-05 16:32:49 +01:00
|
|
|
/**
|
|
|
|
* @deprecated not used anymore
|
|
|
|
*/
|
2009-03-16 13:49:31 +01:00
|
|
|
static function hex2bin($data)
|
|
|
|
{
|
|
|
|
$len = strlen($data);
|
|
|
|
return @pack('H' . $len, $data);
|
|
|
|
}
|
2001-10-21 12:49:29 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* encrypt data passed to the function
|
|
|
|
*
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated not used anymore
|
2009-03-16 13:49:31 +01:00
|
|
|
* @param $data data (string?) to be encrypted
|
|
|
|
*/
|
|
|
|
static function encrypt($data)
|
|
|
|
{
|
|
|
|
return $GLOBALS['egw']->crypto->encrypt($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* decrypt $data
|
|
|
|
*
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated not used anymore
|
2009-03-16 13:49:31 +01:00
|
|
|
* @param $data data to be decrypted
|
|
|
|
*/
|
|
|
|
static function decrypt($data)
|
|
|
|
{
|
|
|
|
return $GLOBALS['egw']->crypto->decrypt($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* legacy wrapper for newer auth class function, encrypt_password
|
|
|
|
*
|
|
|
|
* uses the encryption type set in setup and calls the appropriate encryption functions
|
|
|
|
*
|
|
|
|
* @deprecated use auth::encrypt_password()
|
|
|
|
* @param $password password to encrypt
|
|
|
|
*/
|
|
|
|
static function encrypt_password($password,$sql=False)
|
|
|
|
{
|
|
|
|
return auth::encrypt_password($password,$sql);
|
|
|
|
}
|
2001-10-21 12:49:29 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* find the current position of the app is the users portal_order preference
|
|
|
|
*
|
|
|
|
* @param $app application id to find current position - required
|
|
|
|
* No discussion
|
|
|
|
*/
|
|
|
|
function find_portal_order($app)
|
|
|
|
{
|
|
|
|
if(!is_array($GLOBALS['egw_info']['user']['preferences']['portal_order']))
|
2001-03-14 13:10:01 +01:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
return -1;
|
2001-12-27 16:48:42 +01:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
@reset($GLOBALS['egw_info']['user']['preferences']['portal_order']);
|
|
|
|
while(list($seq,$appid) = each($GLOBALS['egw_info']['user']['preferences']['portal_order']))
|
2001-06-07 03:46:12 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
if($appid == $app)
|
|
|
|
{
|
|
|
|
@reset($GLOBALS['egw_info']['user']['preferences']['portal_order']);
|
|
|
|
return $seq;
|
|
|
|
}
|
2001-06-07 03:46:12 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
@reset($GLOBALS['egw_info']['user']['preferences']['portal_order']);
|
|
|
|
return -1;
|
|
|
|
}
|
2001-01-11 10:52:33 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* return a formatted timestamp or current time
|
|
|
|
*
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param int $t =0 timestamp, default current time
|
|
|
|
* @param string $format ='' timeformat, default '' = read from the user prefernces
|
|
|
|
* @param boolean $adjust_to_usertime =true should datetime::tz_offset be added to $t or not, default true
|
2016-03-28 20:51:38 +02:00
|
|
|
* @deprecated use Api\DateTime::to($time, $format) Api\DateTime::server2user($time, $format)
|
2009-03-16 13:49:31 +01:00
|
|
|
* @return string the formated date/time
|
|
|
|
*/
|
|
|
|
static function show_date($t = 0, $format = '', $adjust_to_usertime=true)
|
|
|
|
{
|
2012-03-14 16:37:25 +01:00
|
|
|
if (!$t) $t = 'now';
|
2001-01-11 10:52:33 +01:00
|
|
|
|
2014-01-28 10:52:19 +01:00
|
|
|
$ret = $adjust_to_usertime ? egw_time::server2user($t, $format) : egw_time::to($t, $format);
|
2012-03-14 16:37:25 +01:00
|
|
|
//error_log(__METHOD__.'('.array2string($t).", '$format', ".array2string($adjust_to_usertime).') returning '.array2string($ret));
|
|
|
|
return $ret;
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2001-12-27 16:48:42 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* Format a date according to the user preferences
|
|
|
|
*
|
|
|
|
* @param string $yearstr year
|
|
|
|
* @param string $monthstr month
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param string $daystr day
|
|
|
|
* @param boolean $add_seperator =false add the separator specifed in the prefs or not, default no
|
|
|
|
* @deprecated use Api\DateTime->format()
|
2009-03-16 13:49:31 +01:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
static function dateformatorder($yearstr,$monthstr,$daystr,$add_seperator = False)
|
|
|
|
{
|
|
|
|
$dateformat = strtolower($GLOBALS['egw_info']['user']['preferences']['common']['dateformat']);
|
|
|
|
$sep = substr($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'],1,1);
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
$dlarr[strpos($dateformat,'y')] = $yearstr;
|
|
|
|
$dlarr[strpos($dateformat,'m')] = $monthstr;
|
|
|
|
$dlarr[strpos($dateformat,'d')] = $daystr;
|
|
|
|
ksort($dlarr);
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
if ($add_seperator)
|
|
|
|
{
|
|
|
|
return implode($sep,$dlarr);
|
2004-01-18 22:12:53 +01:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
return implode(' ',$dlarr);
|
|
|
|
}
|
2001-12-27 16:48:42 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* format the time takes settings from user preferences
|
|
|
|
*
|
|
|
|
* @param int $hour hour
|
|
|
|
* @param int $min minutes
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param int|string $sec ='' defaults to ''
|
|
|
|
* @deprecated use Api\DateTime->format()
|
2009-03-16 13:49:31 +01:00
|
|
|
* @return string formated time
|
|
|
|
*/
|
|
|
|
static function formattime($hour,$min,$sec='')
|
|
|
|
{
|
|
|
|
$h12 = $hour;
|
|
|
|
if ($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12')
|
2001-12-08 16:34:12 +01:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
if ($hour >= 12)
|
2001-12-08 16:34:12 +01:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$ampm = ' pm';
|
2001-12-08 16:34:12 +01:00
|
|
|
}
|
2004-01-18 22:12:53 +01:00
|
|
|
else
|
2001-12-08 16:34:12 +01:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$ampm = ' am';
|
2001-12-08 16:34:12 +01:00
|
|
|
}
|
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
$h12 %= 12;
|
2001-12-08 16:34:12 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
if ($h12 == 0 && $hour)
|
2001-07-02 22:02:15 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$h12 = 12;
|
2001-07-02 22:02:15 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
if ($h12 == 0 && !$hour)
|
2001-08-08 21:37:17 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$h12 = 0;
|
2001-08-08 21:37:17 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$h12 = $hour;
|
|
|
|
}
|
2001-08-08 21:37:17 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
if ($sec !== '')
|
|
|
|
{
|
|
|
|
$sec = ':'.$sec;
|
|
|
|
}
|
2001-08-08 21:37:17 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
return $h12.':'.$min.$sec.$ampm;
|
|
|
|
}
|
|
|
|
|
2014-10-21 10:58:08 +02:00
|
|
|
/**
|
|
|
|
* convert all european special chars to ascii
|
|
|
|
*
|
|
|
|
* @param string $str
|
|
|
|
* @return string
|
2016-03-28 20:51:38 +02:00
|
|
|
* @deprecated use Api\Translation::to_ascii
|
2014-10-21 10:58:08 +02:00
|
|
|
*/
|
|
|
|
public static function transliterate($str)
|
|
|
|
{
|
2016-03-28 20:51:38 +02:00
|
|
|
return Api\Translation::to_ascii($str);
|
2014-10-21 10:58:08 +02:00
|
|
|
}
|
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* Format an email address according to the system standard
|
|
|
|
*
|
|
|
|
* Convert all european special chars to ascii and fallback to the accountname, if nothing left eg. chiniese
|
|
|
|
*
|
|
|
|
* @param string $first firstname
|
|
|
|
* @param string $last lastname
|
|
|
|
* @param string $account account-name (lid)
|
2014-10-21 10:58:08 +02:00
|
|
|
* @param string $domain =null domain-name or null to use eGW's default domain $GLOBALS['egw_info']['server']['mail_suffix]
|
2009-03-16 13:49:31 +01:00
|
|
|
* @return string with email address
|
2016-03-28 20:51:38 +02:00
|
|
|
* @deprecated use Api\Accounts::email($first, $last, $account, $domain)
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function email_address($first,$last,$account,$domain=null)
|
|
|
|
{
|
2016-03-28 20:51:38 +02:00
|
|
|
return Api\Accounts::email($first, $last, $account, $domain);
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2001-08-08 21:37:17 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* ?
|
|
|
|
*
|
|
|
|
* This will be moved into the applications area
|
|
|
|
*/
|
|
|
|
static function check_code($code)
|
|
|
|
{
|
|
|
|
$s = '<br>';
|
|
|
|
switch ($code)
|
|
|
|
{
|
|
|
|
case 13: $s .= lang('Your message has been sent');break;
|
|
|
|
case 14: $s .= lang('New entry added sucessfully');break;
|
|
|
|
case 15: $s .= lang('Entry updated sucessfully'); break;
|
|
|
|
case 16: $s .= lang('Entry has been deleted sucessfully'); break;
|
|
|
|
case 18: $s .= lang('Password has been updated'); break;
|
|
|
|
case 38: $s .= lang('Password could not be changed'); break;
|
|
|
|
case 19: $s .= lang('Session has been killed'); break;
|
|
|
|
case 27: $s .= lang('Account has been updated'); break;
|
|
|
|
case 28: $s .= lang('Account has been created'); break;
|
|
|
|
case 29: $s .= lang('Account has been deleted'); break;
|
|
|
|
case 30: $s .= lang('Your settings have been updated'); break;
|
|
|
|
case 31: $s .= lang('Group has been added'); break;
|
|
|
|
case 32: $s .= lang('Group has been deleted'); break;
|
|
|
|
case 33: $s .= lang('Group has been updated'); break;
|
|
|
|
case 34: $s .= lang('Account has been deleted') . '<p>'
|
|
|
|
. lang('Error deleting %1 %2 directory',lang('users'),' '.lang('private').' ')
|
|
|
|
. ',<br>' . lang('Please %1 by hand',lang('delete')) . '<br><br>'
|
|
|
|
. lang('To correct this error for the future you will need to properly set the')
|
|
|
|
. '<br>' . lang('permissions to the files/users directory')
|
|
|
|
. '<br>' . lang('On *nix systems please type: %1','chmod 770 '
|
|
|
|
. $GLOBALS['egw_info']['server']['files_dir'] . '/users/');
|
|
|
|
break;
|
|
|
|
case 35: $s .= lang('Account has been updated') . '<p>'
|
|
|
|
. lang('Error renaming %1 %2 directory',lang('users'),
|
|
|
|
' '.lang('private').' ')
|
|
|
|
. ',<br>' . lang('Please %1 by hand',
|
|
|
|
lang('rename')) . '<br><br>'
|
|
|
|
. lang('To correct this error for the future you will need to properly set the')
|
|
|
|
. '<br>' . lang('permissions to the files/users directory')
|
|
|
|
. '<br>' . lang('On *nix systems please type: %1','chmod 770 '
|
|
|
|
. $GLOBALS['egw_info']['server']['files_dir'] . '/users/');
|
|
|
|
break;
|
|
|
|
case 36: $s .= lang('Account has been created') . '<p>'
|
|
|
|
. lang('Error creating %1 %2 directory',lang('users'),
|
|
|
|
' '.lang('private').' ')
|
|
|
|
. ',<br>' . lang('Please %1 by hand',
|
|
|
|
lang('create')) . '<br><br>'
|
|
|
|
. lang('To correct this error for the future you will need to properly set the')
|
|
|
|
. '<br>' . lang('permissions to the files/users directory')
|
|
|
|
. '<br>' . lang('On *nix systems please type: %1','chmod 770 '
|
|
|
|
. $GLOBALS['egw_info']['server']['files_dir'] . '/users/');
|
|
|
|
break;
|
|
|
|
case 37: $s .= lang('Group has been added') . '<p>'
|
|
|
|
. lang('Error creating %1 %2 directory',lang('groups'),' ')
|
|
|
|
. ',<br>' . lang('Please %1 by hand',
|
|
|
|
lang('create')) . '<br><br>'
|
|
|
|
. lang('To correct this error for the future you will need to properly set the')
|
|
|
|
. '<br>' . lang('permissions to the files/users directory')
|
|
|
|
. '<br>' . lang('On *nix systems please type: %1','chmod 770 '
|
|
|
|
. $GLOBALS['egw_info']['server']['files_dir'] . '/groups/');
|
|
|
|
break;
|
|
|
|
case 38: $s .= lang('Group has been deleted') . '<p>'
|
|
|
|
. lang('Error deleting %1 %2 directory',lang('groups'),' ')
|
|
|
|
. ',<br>' . lang('Please %1 by hand',
|
|
|
|
lang('delete')) . '<br><br>'
|
|
|
|
. lang('To correct this error for the future you will need to properly set the')
|
|
|
|
. '<br>' . lang('permissions to the files/users directory')
|
|
|
|
. '<br>' . lang('On *nix systems please type: %1','chmod 770 '
|
|
|
|
. $GLOBALS['egw_info']['server']['files_dir'] . '/groups/');
|
|
|
|
break;
|
|
|
|
case 39: $s .= lang('Group has been updated') . '<p>'
|
|
|
|
. lang('Error renaming %1 %2 directory',lang('groups'),' ')
|
|
|
|
. ',<br>' . lang('Please %1 by hand',
|
|
|
|
lang('rename')) . '<br><br>'
|
|
|
|
. lang('To correct this error for the future you will need to properly set the')
|
|
|
|
. '<br>' . lang('permissions to the files/users directory')
|
|
|
|
. '<br>' . lang('On *nix systems please type: %1','chmod 770 '
|
|
|
|
. $GLOBALS['egw_info']['server']['files_dir'] . '/groups/');
|
|
|
|
break;
|
|
|
|
case 40: $s .= lang('You have not entered a title').'.';
|
|
|
|
break;
|
|
|
|
case 41: $s .= lang('You have not entered a valid time of day').'.';
|
|
|
|
break;
|
|
|
|
case 42: $s .= lang('You have not entered a valid date').'.';
|
|
|
|
break;
|
|
|
|
case 43: $s .= lang('You have not entered participants').'.';
|
|
|
|
break;
|
|
|
|
default: return '';
|
|
|
|
}
|
|
|
|
return $s;
|
|
|
|
}
|
2004-01-18 22:12:53 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* process error message
|
|
|
|
*
|
|
|
|
* @param $error error
|
|
|
|
* @param $line line
|
|
|
|
* @param $file file
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated not used anymore
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function phpgw_error($error,$line = '', $file = '')
|
|
|
|
{
|
|
|
|
echo '<p><b>eGroupWare internal error:</b><p>'.$error;
|
|
|
|
if ($line)
|
|
|
|
{
|
|
|
|
echo 'Line: '.$line;
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
if ($file)
|
|
|
|
{
|
|
|
|
echo 'File: '.$file;
|
|
|
|
}
|
|
|
|
echo '<p>Your session has been halted.';
|
|
|
|
exit;
|
|
|
|
}
|
2001-01-11 10:52:33 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* create phpcode from array
|
|
|
|
*
|
|
|
|
* @param $array - array
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated not used anymore
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function create_phpcode_from_array($array)
|
|
|
|
{
|
|
|
|
while (list($key, $val) = each($array))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
if (is_array($val))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
while (list($key2, $val2) = each($val))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
if (is_array($val2))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
while (list($key3, $val3) = each ($val2))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
if (is_array($val3))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
while (list($key4, $val4) = each ($val3))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
$s .= "\$GLOBALS['egw_info']['" . $key . "']['" . $key2 . "']['" . $key3 . "']['" .$key4 . "']='" . $val4 . "';";
|
2001-06-13 23:10:36 +02:00
|
|
|
$s .= "\n";
|
|
|
|
}
|
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$s .= "\$GLOBALS['egw_info']['" . $key . "']['" . $key2 . "']['" . $key3 . "']='" . $val3 . "';";
|
|
|
|
$s .= "\n";
|
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$s .= "\$GLOBALS['egw_info']['" . $key ."']['" . $key2 . "']='" . $val2 . "';";
|
|
|
|
$s .= "\n";
|
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$s .= "\$GLOBALS['egw_info']['" . $key . "']='" . $val . "';";
|
|
|
|
$s .= "\n";
|
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
return $s;
|
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
// This will return the full phpgw_info array, used for debugging
|
|
|
|
/**
|
|
|
|
* return the full phpgw_info array for debugging
|
|
|
|
*
|
|
|
|
* @param array - array
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated not used anymore
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function debug_list_array_contents($array)
|
|
|
|
{
|
|
|
|
while (list($key, $val) = each($array))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
if (is_array($val))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
while (list($key2, $val2) = each($val))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
if (is_array($val2))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
while (list($key3, $val3) = each ($val2))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
if (is_array($val3))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
while (list($key4, $val4) = each ($val3))
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
echo $$array . "[$key][$key2][$key3][$key4]=$val4<br>";
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo $$array . "[$key][$key2][$key3]=$val3<br>";
|
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo $$array . "[$key][$key2]=$val2<br>";
|
|
|
|
}
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
else
|
2001-06-13 23:10:36 +02:00
|
|
|
{
|
2009-03-16 13:49:31 +01:00
|
|
|
echo $$array . "[$key]=$val<br>";
|
2001-06-13 23:10:36 +02:00
|
|
|
}
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
|
|
|
}
|
2005-11-13 11:13:16 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
// This will return a list of functions in the API
|
|
|
|
/**
|
|
|
|
* return a list of functionsin the API
|
|
|
|
*
|
2016-03-05 16:32:49 +01:00
|
|
|
* @deprecated not used anymore
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function debug_list_core_functions()
|
|
|
|
{
|
|
|
|
echo '<br><b>core functions</b><br>';
|
|
|
|
echo '<pre>';
|
|
|
|
chdir(EGW_INCLUDE_ROOT . '/phpgwapi');
|
|
|
|
system("grep -r '^[ \t]*function' *");
|
|
|
|
echo '</pre>';
|
|
|
|
}
|
2001-03-22 09:23:35 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
const NEXTID_TABLE = 'egw_nextid';
|
2001-03-23 05:42:22 +01:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* Return a value for the next id an app/class may need to insert values into LDAP
|
|
|
|
*
|
|
|
|
* @param string $appname app-name
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param int $min =0 if != 0 minimum id
|
|
|
|
* @param int $max =0 if != 0 maximum id allowed, if it would be exceeded we return false
|
2016-04-01 10:07:03 +02:00
|
|
|
* @deprecated use Api\Accounts\Ldap::next_id($appname, $min, $max)
|
|
|
|
* @return int|boolean the next id or false if $max given and exceeded
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function next_id($appname,$min=0,$max=0)
|
|
|
|
{
|
2016-04-01 10:07:03 +02:00
|
|
|
return Api\Accounts\Ldap::next_id($appname, $min, $max);
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2008-04-25 20:52:33 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
|
|
|
* Return a value for the last id entered, which an app may need to check values for LDAP
|
|
|
|
*
|
|
|
|
* @param string $appname app-name
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param int $min =0 if != 0 minimum id
|
|
|
|
* @param int $max =0 if != 0 maximum id allowed, if it would be exceeded we return false
|
2016-04-01 10:07:03 +02:00
|
|
|
* @deprecated use Api\Accounts\Ldap::last_id($appname, $min, $max)
|
|
|
|
* @return int|boolean current id in the next_id table for a particular app/class or -1 for no app and false if $max is exceeded.
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function last_id($appname,$min=0,$max=0)
|
|
|
|
{
|
2016-04-01 10:07:03 +02:00
|
|
|
return Api\Accounts\Ldap::last_id($appname, $min, $max);
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
2008-04-25 20:52:33 +02:00
|
|
|
|
2009-03-16 13:49:31 +01:00
|
|
|
/**
|
2016-05-04 21:07:54 +02:00
|
|
|
* gets an eGW conformant referer from $_SERVER['HTTP_REFERER'], suitable for direct use in the link function
|
2009-03-16 13:49:31 +01:00
|
|
|
*
|
2016-03-05 16:32:49 +01:00
|
|
|
* @param string $default ='' default to use if referer is not set by webserver or not determinable
|
|
|
|
* @param string $referer ='' referer string to use, default ('') use $_SERVER['HTTP_REFERER']
|
2009-03-16 13:49:31 +01:00
|
|
|
* @return string
|
2016-05-04 21:07:54 +02:00
|
|
|
* @deprecated use Api\Header\Referer::get
|
2009-03-16 13:49:31 +01:00
|
|
|
*/
|
|
|
|
static function get_referer($default='',$referer='')
|
|
|
|
{
|
2016-05-04 21:07:54 +02:00
|
|
|
return Api\Header\Referer::get($default, $referer);
|
2009-03-16 13:49:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// some depricated functions for the migration
|
|
|
|
static function phpgw_exit($call_footer = False)
|
|
|
|
{
|
|
|
|
self::egw_exit($call_footer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static function phpgw_final()
|
|
|
|
{
|
|
|
|
self::egw_final();
|
|
|
|
}
|
|
|
|
|
|
|
|
static function phpgw_header()
|
|
|
|
{
|
|
|
|
self::egw_header();
|
|
|
|
}
|
|
|
|
|
|
|
|
static function phpgw_footer()
|
|
|
|
{
|
|
|
|
self::egw_footer();
|
|
|
|
}
|
|
|
|
}
|