Esempio n. 1
0
            $show_pdf = la_tag('iframe src="' . $url . '" width="600px" height="800px"');
            $show_pdf .= la_tag('iframe', true);
            $inputs = la_CheckInput('custom_agreement', __('I have read text above and agree with terms of use'), FALSE, FALSE);
            $inputs .= la_delimiter();
            $inputs .= la_Submit(__('Order'));
            $show_pdf .= la_Form("", "POST", $inputs);
            show_window(__("You must accept license agreement"), $show_pdf);
        }
        if (isset($_POST['custom_agreement'])) {
            $date = GetFullApplyDate();
            $action = 'tagadd';
            $param = vf($_GET['service'], 3);
            $param = preg_replace('/\\0/s', '', $param);
            $param = strip_tags($param);
            $param = mysql_real_escape_string($param);
            $note = 'Order from userstats';
            if (checkTask($user_login, $action, $param)) {
                createTask($date, $user_login, $action, $param, $note);
            }
            rcms_redirect('?module=adservice&action=add&wait=true');
        }
    }
    if (!isset($_GET['accept'])) {
        show_window(__('Aditional services'), __('You can order aditional services. Available services - listed below.'));
        show_window(__('Aditional services cost'), AdServicesList($serviceCost, $us_config['currency']));
        show_window(__('Order aditional service'), AdServicesSelector($availableServices, $user_login));
        show_window(__('Activated services'), ShowAllOrderedServices($availableServices, $user_login));
    }
} else {
    show_window(__('Sorry'), __('This module is disabled'));
}
Esempio n. 2
0
    ini_set('error_append_string', null);
}
if ($argv[1] == "--backup-md5") {
    backup_md5($argv[2]);
    die;
}
if ($argv[1] == "--accounts") {
    accounts();
    die;
}
if ($argv[1] == "--member") {
    member($argv[2]);
    die;
}
if ($argv[1] == "--check") {
    checkTask($argv[2]);
    die;
}
if ($argv[1] == "--folders") {
    mailboxes_folders($argv[2]);
    die;
}
if ($argv[1] == "--schedules") {
    mailboxes_schedules();
    die;
}
function backup_md5($md5)
{
    $sock = new sockets();
    $unix = new unix();
    $q = new mysql();
function member($ID)
{
    $sql = "SELECT * FROM mbx_migr_users WHERE zmd5='{$ID}'";
    if ($GLOBALS["VERBOSE"]) {
        echo "ID:{$ID}\n";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "{$sql}\n";
    }
    $q = new mysql();
    $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
    $pid = $ligne["PID"];
    $TASKID = $ligne["mbx_migr_id"];
    $unix = new unix();
    $t1 = time();
    $NICE = EXEC_NICE();
    if ($pid != null) {
        if ($unix->process_exists($pid)) {
            system_admin_events("{$ID}:: {$pid} already executed", __FUNCTION__, __FILE__, __LINE__, "mbximport");
            die;
        }
    }
    $pid = getmypid();
    $offlineimap = $unix->find_program("offlineimap");
    $verbosed = $ligne["verbosed"];
    $debug = null;
    if (!is_numeric($verbosed)) {
        $verbosed = 0;
    }
    $sql = "UPDATE mbx_migr_users SET `PID`='{$pid}',`events`='' WHERE zmd5='{$ID}'";
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        system_admin_events("{$ID}:: {$q->mysql_error} \"{$sql}\"", __FUNCTION__, __FILE__, __LINE__, "mbximport");
        return;
    }
    mailboxes_folders($ID);
    $imap_server = $ligne["imap_server"];
    $cert_fingerprint = $ligne["cert_fingerprint"];
    $uid = $ligne["uid"];
    $usessl = $ligne["usessl"];
    $remote_username = $ligne["username"];
    $ct = new user($uid);
    $tolog[] = "{$ligne["username"]}@{$imap_server} SSL:{$usessl} Port:993/143 fingerprint:{$cert_fingerprint} Using {$offlineimap}";
    $tolog = mailbox_settings($ID, $tolog);
    exec("{$offlineimap} --version 2>&1", $tolog);
    $t = time();
    if (is_file($offlineimap)) {
        if ($verbosed == 1) {
            $debug = " -d ALL";
        }
        $cmd = "{$NICE}{$offlineimap} -u basic -l /etc/artica-postfix/offline-imap/{$ID}.log -c /etc/artica-postfix/offline-imap/{$ID}.cfg{$debug} 2>&1";
        $tolog[] = $cmd;
        if (is_file("/etc/artica-postfix/offline-imap/{$ID}.log")) {
            @unlink("/etc/artica-postfix/offline-imap/{$ID}.log");
        }
        shell_exec("{$cmd}");
        $t2 = time();
        $messages_count = 0;
        if (!is_file("/etc/artica-postfix/offline-imap/{$ID}.log")) {
            $tolog[] = "{$ID}.log no such file";
        }
        $f = file("/etc/artica-postfix/offline-imap/{$ID}.log");
        while (list($num, $pp) = each($f)) {
            $tolog[] = $pp;
            if (preg_match("#Copy message#", $pp)) {
                $messages_count++;
            }
        }
        $tolog[] = "Messages replicated.: {$messages_count}";
        $tolog[] = "Execution time......: " . distanceOfTimeInWords($t1, $t2);
    } else {
        $tolog[] = "UNABLE TO STAT OFFLINEIMAP TOOL !!!";
    }
    $took = $unix->distanceOfTimeInWords($t, time(), true);
    system_admin_events("{$uid} from {$imap_server} done took\n" . @implode("\n", $tolog) . "\n", __FUNCTION__, __FILE__, __LINE__, "mbximport");
    $sql = "UPDATE mbx_migr_users SET events='" . addslashes(@implode("\n", $tolog)) . "',\n\timported=1\n\tWHERE zmd5='{$ID}'";
    if ($GLOBALS["VERBOSE"]) {
        echo "{$sql}\n";
    }
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        writelogs("{$ID}:: {$q->mysql_error} \"{$sql}\"", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    checkTask($TASKID);
}
Esempio n. 4
0
function member($ID)
{
    $sql = "SELECT * FROM mbx_migr_users WHERE zmd5='{$ID}'";
    if ($GLOBALS["VERBOSE"]) {
        echo "ID:{$ID}\n";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "{$sql}\n";
    }
    $q = new mysql();
    $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
    $pid = $ligne["PID"];
    $TASKID = $ligne["mbx_migr_id"];
    $unix = new unix();
    if ($pid != null) {
        if ($unix->process_exists($pid)) {
            writelogs("{$ID}:: {$pid} already executed", __FUNCTION__, __FILE__, __LINE__);
            die;
        }
    }
    $pid = getmypid();
    $sql = "UPDATE mbx_migr_users SET PID='{$pid}' WHERE zmd5='{$ID}'";
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        writelogs("{$ID}:: {$q->mysql_error} \"{$sql}\"", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    $imap_server = $ligne["imap_server"];
    $uid = $ligne["uid"];
    $usessl = $ligne["usessl"];
    $remote_username = $ligne["username"];
    $ct = new user($uid);
    $offlineImapConf[] = "[general]";
    $offlineImapConf[] = "accounts = {$remote_username}";
    $offlineImapConf[] = "maxsyncaccounts = 1";
    $offlineImapConf[] = "ui =Noninteractive.Basic, Noninteractive.Quiet";
    $offlineImapConf[] = "ignore-readonly = no";
    $offlineImapConf[] = "socktimeout = 60";
    $offlineImapConf[] = "fsync = true";
    $offlineImapConf[] = "";
    $offlineImapConf[] = "";
    $offlineImapConf[] = "[ui.Curses.Blinkenlights]";
    $offlineImapConf[] = "statuschar = .";
    $offlineImapConf[] = "";
    $offlineImapConf[] = "[Account {$remote_username}]";
    $offlineImapConf[] = "localrepository = TargetServer";
    $offlineImapConf[] = "remoterepository = SourceServer";
    $offlineImapConf[] = "";
    $offlineImapConf[] = "[Repository TargetServer]";
    $offlineImapConf[] = "type = IMAP";
    $offlineImapConf[] = "remotehost = 127.0.0.1";
    $offlineImapConf[] = "ssl = 0";
    $offlineImapConf[] = "remoteport = 143";
    $offlineImapConf[] = "remoteuser = {$uid}";
    $offlineImapConf[] = "remotepass = {$ct->password}";
    $offlineImapConf[] = "maxconnections = 1";
    $offlineImapConf[] = "holdconnectionopen = no";
    $offlineImapConf[] = "expunge = no";
    $offlineImapConf[] = "subscribedonly = no";
    $offlineImapConf[] = "";
    $offlineImapConf[] = "";
    $offlineImapConf[] = "[Repository SourceServer]";
    $offlineImapConf[] = "type = IMAP";
    $offlineImapConf[] = "remotehost = {$imap_server}";
    if ($usessl == 1) {
        $offlineImapConf[] = "ssl = 1";
        $offlineImapConf[] = "remoteport = 993";
    } else {
        $offlineImapConf[] = "ssl = 0";
        $offlineImapConf[] = "remoteport = 143";
    }
    $offlineImapConf[] = "remoteuser = {$ligne["username"]}";
    $offlineImapConf[] = "remotepass = {$ligne["password"]}";
    $offlineImapConf[] = "maxconnections = 1";
    $offlineImapConf[] = "holdconnectionopen = no";
    $offlineImapConf[] = "expunge = no";
    $offlineImapConf[] = "subscribedonly = no";
    @mkdir("/etc/artica-postfix/offline-imap", 666, true);
    @file_put_contents("/etc/artica-postfix/offline-imap/{$ID}.cfg", @implode("\n", $offlineImapConf));
    $unix = new unix();
    $t1 = time();
    $NICE = EXEC_NICE();
    $offlineimap = $unix->find_program("offlineimap");
    if (is_file("{$offlineimap}")) {
        exec("{$NICE}{$offlineimap} -c /etc/artica-postfix/offline-imap/{$ID}.cfg 2>&1", $results);
        $t2 = time();
        $messages_count = 0;
        while (list($num, $pp) = each($results)) {
            if (preg_match("#WARNING:#", $pp)) {
                $tolog[] = $pp;
            }
            if (preg_match("#Syncing#", $pp)) {
                $tolog[] = $pp;
            }
            if (preg_match("#Copy message#", $pp)) {
                $messages_count++;
            }
        }
        $tolog[] = "Messages replicated.: {$messages_count}";
        $tolog[] = "Execution time......: " . distanceOfTimeInWords($t1, $t2);
    } else {
        $tolog[] = "UNABLE TO STAT OFFLINEIMAP TOOL !!!";
    }
    $sql = "UPDATE mbx_migr_users SET events='" . addslashes(@implode("\n", $tolog)) . "',\n\timported=1\n\tWHERE zmd5='{$ID}'";
    if ($GLOBALS["VERBOSE"]) {
        echo "{$sql}\n";
    }
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        writelogs("{$ID}:: {$q->mysql_error} \"{$sql}\"", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    checkTask($TASKID);
}
Esempio n. 5
0
}
# read sqlite DB
try {
    $con = 'sqlite:db.sqlite';
    $pdo = new PDO($con, 'admin', 'admin');
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    $msg = 'ERREUR PDO dans ' . $e->getFile() . ' L.' . $e->getLine() . ' : ' . $e->getMessage();
    die($msg);
}
$query = 'SELECT * FROM projects';
$kan_projects = $pdo->query($query);
while ($kan_project = $kan_projects->fetch()) {
    $project_name = $kan_project['name'];
    print "checking project " . $project_name . "\n";
    $project = checkproject($project_name);
    $project_id = $project->getPHID();
    # add tasks
    $query = 'SELECT * FROM tasks
                WHERE project_id = ' . $kan_project['id'];
    $kan_tasks = $pdo->query($query);
    while ($kan_task = $kan_tasks->fetch()) {
        print "\tchecking task " . $kan_task['title'] . "\n";
        $task = checkTask($kan_task, $project_id);
    }
    # $columns = id(new PhabricatorProjectColumnQuery())
    #     ->setViewer($user)
    #     ->withProjectPHIDs(array($project->getPHID()))
    #     ->execute();
    # var_dump($columns);
}