mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-05 13:39:23 +01:00
removed some depricated and as far as I know nowhere used methods and make many functions static
This commit is contained in:
parent
46325b070c
commit
a8b924696f
@ -53,7 +53,7 @@
|
|||||||
* @param $str1
|
* @param $str1
|
||||||
* @param $str2
|
* @param $str2
|
||||||
*/
|
*/
|
||||||
function cmp_version($str1,$str2,$debug=False)
|
static function cmp_version($str1,$str2,$debug=False)
|
||||||
{
|
{
|
||||||
ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)",$str1,$regs);
|
ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)",$str1,$regs);
|
||||||
ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)",$str2,$regs2);
|
ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)",$str2,$regs2);
|
||||||
@ -84,7 +84,7 @@
|
|||||||
* @param $str1
|
* @param $str1
|
||||||
* @param $str2
|
* @param $str2
|
||||||
*/
|
*/
|
||||||
function cmp_version_long($str1,$str2,$debug=False)
|
static function cmp_version_long($str1,$str2,$debug=False)
|
||||||
{
|
{
|
||||||
ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)\.([0-9]*)",$str1,$regs);
|
ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)\.([0-9]*)",$str1,$regs);
|
||||||
ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)\.([0-9]*)",$str2,$regs2);
|
ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)\.([0-9]*)",$str2,$regs2);
|
||||||
@ -113,34 +113,6 @@
|
|||||||
if($debug) { echo ' - all equal.'; }
|
if($debug) { echo ' - all equal.'; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert an array into the format needed for the access column
|
|
||||||
*
|
|
||||||
* @param $access
|
|
||||||
* @param $array
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate a unique id, which can be used for syncronisation
|
* generate a unique id, which can be used for syncronisation
|
||||||
*
|
*
|
||||||
@ -148,7 +120,7 @@
|
|||||||
* @param string $_eventID the id of the content
|
* @param string $_eventID the id of the content
|
||||||
* @return string the unique id
|
* @return string the unique id
|
||||||
*/
|
*/
|
||||||
function generate_uid($_appName, $_eventID)
|
static function generate_uid($_appName, $_eventID)
|
||||||
{
|
{
|
||||||
if(empty($_appName) || empty($_eventID)) return false;
|
if(empty($_appName) || empty($_eventID)) return false;
|
||||||
|
|
||||||
@ -164,7 +136,7 @@
|
|||||||
* @param sting $_globalUid the global UID
|
* @param sting $_globalUid the global UID
|
||||||
* @return int local egw content id
|
* @return int local egw content id
|
||||||
*/
|
*/
|
||||||
function get_egwId($_globalUid)
|
static function get_egwId($_globalUid)
|
||||||
{
|
{
|
||||||
if(empty($_globalUid)) return false;
|
if(empty($_globalUid)) return false;
|
||||||
|
|
||||||
@ -175,38 +147,12 @@
|
|||||||
return implode('-',$globalUidParts); // return the rest, allowing to have dashs in the id, can happen with LDAP!
|
return implode('-',$globalUidParts); // return the rest, allowing to have dashs in the id, can happen with LDAP!
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is used for searching the access fields
|
|
||||||
/**
|
|
||||||
* this function is used for searching the access fields
|
|
||||||
*
|
|
||||||
* @param $table
|
|
||||||
* @param $owner
|
|
||||||
*/
|
|
||||||
function sql_search($table,$owner=0)
|
|
||||||
{
|
|
||||||
$this->debug_info[] = 'sql_search() is a deprecated function - use ACL instead';
|
|
||||||
$s = '';
|
|
||||||
if (!$owner)
|
|
||||||
{
|
|
||||||
$owner = $GLOBALS['egw_info']['user']['account_id'];
|
|
||||||
}
|
|
||||||
$groups = $GLOBALS['egw']->accounts->membership((int)$owner);
|
|
||||||
if(@is_array($groups))
|
|
||||||
{
|
|
||||||
while ($group = each($groups))
|
|
||||||
{
|
|
||||||
$s .= " OR $table LIKE '%," . $group[2] . ",%'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return an array of installed languages
|
* return an array of installed languages
|
||||||
*
|
*
|
||||||
* @return $installedLanguages; an array containing the installed languages
|
* @return $installedLanguages; an array containing the installed languages
|
||||||
*/
|
*/
|
||||||
function getInstalledLanguages()
|
static function getInstalledLanguages()
|
||||||
{
|
{
|
||||||
$GLOBALS['egw']->db->query('SELECT DISTINCT lang FROM egw_lang');
|
$GLOBALS['egw']->db->query('SELECT DISTINCT lang FROM egw_lang');
|
||||||
while (@$GLOBALS['egw']->db->next_record())
|
while (@$GLOBALS['egw']->db->next_record())
|
||||||
@ -218,16 +164,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return the preferred langugae of the users
|
* get preferred language of the users
|
||||||
*
|
*
|
||||||
* it uses HTTP_ACCEPT_LANGUAGE (from the users browser) <br>
|
* Uses HTTP_ACCEPT_LANGUAGE (from the browser) and getInstalledLanguages to find out which languages are installed
|
||||||
* and .... to find out which languages are installed
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getPreferredLanguage()
|
static function getPreferredLanguage()
|
||||||
{
|
{
|
||||||
// create a array of languages the user is accepting
|
// create a array of languages the user is accepting
|
||||||
$userLanguages = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
$userLanguages = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||||
$supportedLanguages = $this->getInstalledLanguages();
|
$supportedLanguages = self::getInstalledLanguages();
|
||||||
|
|
||||||
// find usersupported language
|
// find usersupported language
|
||||||
foreach($userLanguages as $key => $value)
|
foreach($userLanguages as $key => $value)
|
||||||
@ -264,7 +211,7 @@
|
|||||||
* @param $string either a string to be escaped, or an array of values to be escaped
|
* @param $string either a string to be escaped, or an array of values to be escaped
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function ldap_addslashes($string='')
|
static function ldap_addslashes($string='')
|
||||||
{
|
{
|
||||||
return ldap::quote($string);
|
return ldap::quote($string);
|
||||||
}
|
}
|
||||||
@ -278,7 +225,7 @@
|
|||||||
* @param $passwd ldap_root_pw
|
* @param $passwd ldap_root_pw
|
||||||
* @return resource
|
* @return resource
|
||||||
*/
|
*/
|
||||||
function ldapConnect($host='', $dn='', $passwd='')
|
static function ldapConnect($host='', $dn='', $passwd='')
|
||||||
{
|
{
|
||||||
// use Lars new ldap class
|
// use Lars new ldap class
|
||||||
return $GLOBALS['egw']->ldap->ldapConnect($host,$dn,$passwd);
|
return $GLOBALS['egw']->ldap->ldapConnect($host,$dn,$passwd);
|
||||||
|
Loading…
Reference in New Issue
Block a user