forked from poppyred/1.6.x
/
exec.zarafa.autocomplete.php
executable file
·48 lines (38 loc) · 2.02 KB
/
exec.zarafa.autocomplete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);
include_once(dirname(__FILE__) . '/ressources/class.ldap.inc');
include_once(dirname(__FILE__) . '/ressources/class.users.menus.inc');
include_once(dirname(__FILE__) . '/ressources/class.mysql.inc');
include_once(dirname(__FILE__) . '/ressources/class.user.inc');
include_once(dirname(__FILE__) . '/ressources/class.ini.inc');
include_once(dirname(__FILE__) . '/ressources/class.mysql.inc');
include_once(dirname(__FILE__) . '/framework/class.unix.inc');
include_once(dirname(__FILE__) . '/framework/frame.class.inc');
include_once(dirname(__FILE__) . '/framework/class.settings.inc');
include_once(dirname(__FILE__) . '/ressources/class.freeweb.inc');
include_once(dirname(__FILE__) . '/ressources/class.system.network.inc');
if($GLOBALS["VERBOSE"]){ echo "starting include functions done..\n";}
@mkdir("/root/properties",0755,true);
$ldap=new clladp();
$q=new mysql();
$suffix=$ldap->suffix;
$arr=array("uid");
$sr = @ldap_search($ldap->ldap_connection,"dc=organizations,$suffix",'(objectclass=userAccount)',$arr);
if ($sr) {
$hash=ldap_get_entries($ldap->ldap_connection,$sr);
for($i=0;$i<$hash["count"];$i++){
$user=$hash[$i]["uid"][0];
$sql="select val_string from properties where properties.tag=0x6771 and hierarchyid=(select hierarchy_id from stores where user_name='$user');";
$ligne=mysql_fetch_array($q->QUERY_SQL($sql,"zarafa"));
$val_string=x_mysql_escape_string2($ligne["val_string"]);
$cmd="update properties set val_string='$val_string' where properties.tag=0x6771 and hierarchyid=(select hierarchy_id from stores where user_name='$user');";
@file_put_contents("/root/properties/$user.sql", $cmd);
$f[]=$cmd;
}
}
@file_put_contents("/root/properties/ALL.sql",@implode("\n", $f));
function x_mysql_escape_string2($line){
$search=array("\\","\0","\n","\r","\x1a","'",'"');
$replace=array("\\\\","\\0","\\n","\\r","\Z","\'",'\"');
return str_replace($search,$replace,$line);
}