Example #1
0
    $GLOBALS["DEBUG"] = true;
    $GLOBALS["VERBOSE"] = true;
    ini_set('display_errors', 1);
    ini_set('error_reporting', E_ALL);
    ini_set('error_prepend_string', null);
    ini_set('error_append_string', null);
}
if (preg_match("#--nomail#", implode(" ", $argv))) {
    $GLOBALS["NOMAIL"] = true;
}
if ($argv[1] == "--orphans") {
    orphans();
    die;
}
if ($argv[1] == "--emergency") {
    emergency_user($argv[2]);
    die;
}
if ($argv[1] == "--export-hash") {
    export_hash();
    die;
}
if ($argv[1] == "--view-hash") {
    view_hash();
    die;
}
if ($argv[1] == "--config") {
    config();
    die;
}
if ($argv[1] == "--ldap-config") {
<?php
if(posix_getuid()<>0){die("Cannot be used in web server mode\n\n");}
include_once(dirname(__FILE__).'/ressources/class.ldap.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');
if(preg_match("#--verbose#",implode(" ",$argv))){$GLOBALS["DEBUG"]=true;$GLOBALS["VERBOSE"]=true;ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);}

if($argv[1]=="--orphans"){orphans();die();}
if($argv[1]=="--emergency"){emergency_user($argv[2]);die();}
if($argv[1]=="--export-hash"){export_hash();die();}
if($argv[1]=="--view-hash"){view_hash();die();}
if($argv[1]=="--config"){config();die();}
if($argv[1]=="--ldap-config"){ldap_config();die();}



sync_users();
function sync_users(){
$unix=new unix();
$zarafaadmin=$unix->find_program("zarafa-admin");

echo "Synchronize external datas\n";
shell_exec("$zarafaadmin --sync");
shell_exec("$zarafaadmin --list-companies");
shell_exec("$zarafaadmin -s");

exec("$zarafaadmin -l",$array);