Ejemplo n.º 1
0
function main()
{
    $sock = new sockets();
    $unix = new unix();
    $users = new usersMenus();
    if (!$users->HAMACHI_INSTALLED) {
        echo "Starting......: " . date("H:i:s") . " hamachi not installed\n";
        die;
    }
    if (!isset($GLOBALS["hamachi_bin"])) {
        $GLOBALS["hamachi_bin"] = $unix->find_program("hamachi");
    }
    if (!is_file($GLOBALS["hamachi_bin"])) {
        echo "Starting......: " . date("H:i:s") . " hamachi no such binary\n";
        die;
    }
    $EnableHamachi = $sock->GET_INFO("EnableHamachi");
    if (!is_numeric($EnableHamachi)) {
        $EnableHamachi = 1;
    }
    if ($EnableHamachi == 0) {
        echo "Starting......: " . date("H:i:s") . " hamachi disabled\n";
        HasGateway_iptables_delete_rules();
        hamachi_etc_hosts_remove();
        @unlink("/etc/cron.d/HamachiHosts");
        die;
    }
    AdditionalSettings();
    GetNets();
    shell_exec("/etc/init.d/artica-postfix start hamachi");
    $sql = "SELECT * FROM hamachi ORDER BY ID DESC";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    AdditionalSettings();
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $array = unserialize(base64_decode($ligne["pattern"]));
        connect($array);
    }
    DO_SET_NICK();
    FixRoute();
    HasGateway();
    buildinit();
    SetSchedule();
}
Ejemplo n.º 2
0
include_once dirname(__FILE__) . '/framework/frame.class.inc';
$_GET["LOGFILE"] = "/usr/share/artica-postfix/ressources/logs/web/interface-postfix.log";
if (!is_file("/usr/share/artica-postfix/ressources/settings.inc")) {
    shell_exec("/usr/share/artica-postfix/bin/process1 --force --verbose");
}
if (preg_match("#--verbose#", implode(" ", $argv))) {
    $GLOBALS["DEBUG"] = true;
}
if (preg_match("#--reload#", implode(" ", $argv))) {
    $GLOBALS["RELOAD"] = true;
}
if ($argv[1] == "route") {
    FixRoute();
    die;
}
GetNets();
$unix = new unix();
shell_exec("/etc/init.d/artica-postfix start hamachi");
$sql = "SELECT * FROM hamachi ORDER BY ID DESC";
$q = new mysql();
$results = $q->QUERY_SQL($sql, "artica_backup");
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
    $array = unserialize(base64_decode($ligne["pattern"]));
    connect($array);
}
$users = new usersMenus();
exec($unix->find_program("hamachi") . " -c /etc/hamachi set-nick {$users->hostname}", $l);
FixRoute();
function GetNets()
{
    $unix = new unix();