Altered function names to make them possibly collide with other functions
less frequently
Altered code for sorting to hopefully improve speed
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1017
7612ce4b-ef26-0410-bec9-
ea0150e637f0
// Had to move this function outside of the Addressbook Class
// PHP 4.0.4 Seemed to be having problems with inline functions.
// Had to move this function outside of the Addressbook Class
// PHP 4.0.4 Seemed to be having problems with inline functions.
+ function addressbook_cmp($a,$b) {
if($a['backend'] > $b['backend'])
return 1;
else if($a['backend'] < $b['backend'])
if($a['backend'] > $b['backend'])
return 1;
else if($a['backend'] < $b['backend'])
// See each of the backend classes for valid parameters.
function add_backend($backend, $param = '') {
$backend_name = 'abook_' . $backend;
// See each of the backend classes for valid parameters.
function add_backend($backend, $param = '') {
$backend_name = 'abook_' . $backend;
- eval("\$newback = new $backend_name(\$param);");
+ eval('$newback = new ' . $backend_name . '($param);');
if(!empty($newback->error)) {
$this->error = $newback->error;
return false;
if(!empty($newback->error)) {
$this->error = $newback->error;
return false;
$ret = $this->search($expression, $bnum);
if(!is_array($ret))
return $ret;
$ret = $this->search($expression, $bnum);
if(!is_array($ret))
return $ret;
+ usort($ret, 'addressbook_cmp');
$userdata['nickname'] = $userdata['email'];
}
$userdata['nickname'] = $userdata['email'];
}
- if(eregi("[\: \|\#\"\!]", $userdata['nickname'])) {
+ if(eregi('[\\: \\|\\#\"\\!]', $userdata['nickname'])) {
$this->error = _("Nickname contain illegal characters");
return false;
}
$this->error = _("Nickname contain illegal characters");
return false;
}
- if(eregi("[\: \|\#\"\!]", $userdata['nickname'])) {
+ if(eregi('[\\: \\|\\#"\\!]', $userdata['nickname'])) {
$this->error = _("Nickname contain illegal characters");
return false;
}
$this->error = _("Nickname contain illegal characters");
return false;
}
$col = array($col);
}
$GLOBALS['col'] = $col; // Column or Columns as an array
$col = array($col);
}
$GLOBALS['col'] = $col; // Column or Columns as an array
+ if ($dir > 0)
+ $dir = 1;
+ else
+ $dir = -1;
$GLOBALS['dir'] = $dir; // Direction, a positive number for ascending a negative for descending
$GLOBALS['dir'] = $dir; // Direction, a positive number for ascending a negative for descending
+ usort($ary,'array_comp2');
- function comp2($a,$b,$i = 0) {
+ function array_comp2($a,$b,$i = 0) {
global $col;
global $dir;
$c = count($col) -1;
global $col;
global $dir;
$c = count($col) -1;
$r = comp2($a,$b,$i);
}
} elseif($a[$col[$i]] < $b[$col[$i]]){
$r = comp2($a,$b,$i);
}
} elseif($a[$col[$i]] < $b[$col[$i]]){
- $r = -1 * $dir; // Im not sure why you must * dir here, but it wont work just before the return...
- } else {
- $r = 1 * $dir;
- }
- return $r;
+ return (- $dir);
+ }
+ return $dir;
}
function removeElement($array, $element) {
}
function removeElement($array, $element) {