示例#1
0
function RefreshIndex()
{
    $unix = new unix();
    $nice = EXEC_NICE();
    $sock = new sockets();
    $users = new usersMenus();
    $nohup = $unix->find_program("nohup");
    $php = $unix->LOCATE_PHP5_BIN();
    $wget = $unix->find_program("wget");
    $SYSTEMID = $unix->GetUniqueID();
    if ($SYSTEMID == null) {
        build_progress("System ID is Null !!!", 5);
        return;
    }
    build_progress("Register server...", 10);
    shell_exec("{$nohup} {$nice} {$php} /usr/share/artica-postfix/exec.web-community-filter.php --register-lic >/dev/null 2>&1 &");
    if ($SYSTEMID == null) {
        build_progress("No system ID, force", 15);
        shell_exec("{$nice} /usr/share/artica-postfix/bin/artica-update -refresh-index --force >/dev/null 2>&1");
        return;
    }
    $xMEM_TOTAL_INSTALLEE = $users->MEM_TOTAL_INSTALLEE;
    $CPU_NUMBER = $users->CPU_NUMBER;
    $LinuxDistributionFullName = $users->LinuxDistriFullName;
    if ($LinuxDistributionFullName == null) {
        $LinuxDistributionFullName = "Linux Default";
    }
    $ARTICA_VERSION = GetCurrentVersion();
    $hostname = $unix->hostname_g();
    $CheckUserCount = CheckUserCount();
    $dmidecode = @file_get_contents("/etc/artica-postfix/dmidecode.cache.url");
    $uriplus = "{$SYSTEMID};{$xMEM_TOTAL_INSTALLEE};{$CPU_NUMBER};{$LinuxDistributionFullName};{$ARTICA_VERSION};{$hostname};{$CheckUserCount};{$dmidecode}";
    $uriplus = urlencode($uriplus);
    @unlink($GLOBALS["MasterIndexFile"]);
    $tarballs_file = "/usr/share/artica-postfix/ressources/logs/web/tarballs.cache";
    echo "Starting......: " . date("H:i:s") . " CPU NUMBER: {$CPU_NUMBER}\n";
    echo "Starting......: " . date("H:i:s") . " Hostname..: {$hostname}\n";
    echo "Starting......: " . date("H:i:s") . " Artica ver: {$ARTICA_VERSION}\n";
    echo "Starting......: " . date("H:i:s") . " Users.....: {$CheckUserCount}\n";
    build_progress("Configuration done", 15);
    $ini = new iniFrameWork();
    $ini->loadFile('/etc/artica-postfix/artica-update.conf');
    if (trim($ini->_params["AUTOUPDATE"]["uri"]) == null) {
        $ini->_params["AUTOUPDATE"]["uri"] = "http://www.articatech.net/auto.update.php";
    }
    if (!isset($ini->_params["AUTOUPDATE"]["enabled"])) {
        $ini->_params["AUTOUPDATE"]["enabled"] = "yes";
    }
    if ($ini->_params["AUTOUPDATE"]["enabled"] == null) {
        $ini->_params["AUTOUPDATE"]["enabled"] = "yes";
    }
    if (!is_numeric(trim($ini->_params["AUTOUPDATE"]["CheckEveryMinutes"]))) {
        $ini->_params["AUTOUPDATE"]["CheckEveryMinutes"] = 60;
    }
    $uri = $ini->_params["AUTOUPDATE"]["uri"];
    $arrayURI = parse_url($uri);
    build_progress("Check repositories", 20);
    $MAIN_URI = $unix->MAIN_URI();
    echo "Starting......: " . date("H:i:s") . " Main URI..: {$MAIN_URI}\n";
    $md5string = @md5_file($GLOBALS["MasterIndexFile"]);
    build_progress("Get TarBalls...", 25);
    echo "Starting......: " . date("H:i:s") . " Update tarballs..\n";
    $curl = new ccurl("{$MAIN_URI}/tarballs.php?time=" . time());
    @unlink($tarballs_file);
    $curl->NoHTTP_POST = true;
    if (!$curl->GetFile($tarballs_file)) {
        build_progress("Get TarBalls !! FAILED !!", 30);
        _artica_update_event(0, "Unable to download tarballs file with error {$curl->error_num}, {$curl->error}", null, __FILE__, __LINE__);
        @unlink($tarballs_file);
    }
    build_progress("Ping repositories...", 35);
    @chmod($tarballs_file, 0755);
    echo "Starting......: " . date("H:i:s") . " dmidecode = " . strlen($dmidecode) . " bytes\n";
    echo "Starting......: " . date("H:i:s") . " Updating repository information..\n";
    $curl = new ccurl("{$MAIN_URI}/routers.inject.php?time=" . time());
    $curl->NoHTTP_POST = true;
    $curl->get();
    build_progress("Retreive index from repository", 40);
    $curl = new ccurl("{$uri}?time=" . time() . "&datas={$uriplus}");
    $curl->NoHTTP_POST = true;
    $curl->forceCache = true;
    echo "Starting......: " . date("H:i:s") . " Downloading collection using Interface: `{$curl->interface}`\n";
    echo "Starting......: " . date("H:i:s") . " Using \"{$GLOBALS["MasterIndexFile"]}\"\n";
    echo "Starting......: " . date("H:i:s") . " Timeout set to \"{$curl->Timeout}s\"\n";
    if (!$curl->GetFile($GLOBALS["MasterIndexFile"])) {
        build_progress("Retreive index from repository !! FAILED !!", 100);
        if (!$GLOBALS["NOT_FORCE_PROXY"]) {
            echo "Starting......: " . date("H:i:s") . " FATAL: Unable to download index file, try in direct mode\n";
            $GLOBALS["NOT_FORCE_PROXY"] = true;
            return RefreshIndex();
        }
        echo "Starting......: " . date("H:i:s") . " FATAL: {$GLOBALS["MasterIndexFile"]} " . @filesize($GLOBALS["MasterIndexFile"]) . " bytes\n";
        echo "Starting......: " . date("H:i:s") . " FATAL: Unable to download index file with error {$curl->error_num}, {$curl->error}\n";
        _artica_update_event(0, "Unable to download index file with error {$curl->error_num}, {$curl->error}", null, __FILE__, __LINE__);
        exec("{$nice} /usr/share/artica-postfix/bin/artica-update -refresh-index 2>&1", $results);
        while (list($num, $ligne) = each($dirs)) {
            echo "Starting......: " . date("H:i:s") . " {$ligne}\n";
        }
        return;
    }
    build_progress("Retreive index from repository !! Success !!", 100);
    $md5string2 = md5_file($GLOBALS["MasterIndexFile"]);
    echo "Starting......: " . date("H:i:s") . " source: `{$md5string}` new: `{$md5string2}`\n";
    echo "Starting......: " . date("H:i:s") . " Success...\n";
    return true;
}
示例#2
0
function GetMyIp()
{
    $sock = new sockets();
    $unix = new unix();
    $EnableArticaMetaClient = intval($sock->GET_INFO("EnableArticaMetaClient"));
    if ($EnableArticaMetaClient == 1) {
        return;
    }
    if ($sock->GET_INFO("DoNotResolvInternetIP") == 1) {
        $ip = $sock->GET_INFO("PublicIPAddress");
        if ($ip != null) {
            return $ip;
        }
    }
    if (!$GLOBALS["FORCE"]) {
        $time = $unix->file_time_min("/usr/share/artica-postfix/ressources/logs/web/myIP.conf");
        if ($time < 60) {
            return trim(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/myIP.conf"));
        }
    }
    Checks();
    $URIBASE = $unix->MAIN_URI();
    @unlink("/usr/share/artica-postfix/ressources/logs/web/myIP.conf");
    $curl = new ccurl("{$URIBASE}/my-ip.php");
    $curl->NoHTTP_POST = true;
    if (!$curl->get()) {
        system_admin_events("Curl error {$curl->error}", __FUNCTION__, __FILE__, __LINE__, "system");
        return;
    }
    $datas = explode("\n", $curl->data);
    $myip = null;
    writelogs("http://www.articatech.net/my-ip.php -> ({$datas})", __FUNCTION__, __FILE__, __LINE__);
    while (list($num, $val) = each($datas)) {
        if (preg_match("#^(.*?):#", $val, $re)) {
            continue;
        }
        if (preg_match("#([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+)#", $val, $re)) {
            $myip = "{$re[1]}.{$re[2]}.{$re[3]}.{$re[4]}";
            break;
        }
    }
    if ($myip == null) {
        system_admin_events("!!! Unable to preg_match datas....", __FUNCTION__, __FILE__, __LINE__, "system");
        return;
    }
    writelogs("FOUND \"{$myip}\" -> {$URIBASE}/my-ip.php -> {$code} (" . count($datas) . " lines)", __FUNCTION__, __FILE__, __LINE__);
    @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/myIP.conf", $myip);
    @chmod("/usr/share/artica-postfix/ressources/logs/web/myIP.conf", 775);
    system_admin_events("Public IP Address: {$myip}", __FUNCTION__, __FILE__, __LINE__, "system");
    $sock->SET_INFO("PublicIPAddress", $myip);
}
function categorize_delete()
{
    $unix = new unix();
    $URIBASE = $unix->MAIN_URI();
    $tmpdir = $unix->TEMP_DIR();
    if (!is_file("{$tmpdir}/categorize_delete.sql")) {
        $curl = new ccurl("{$URIBASE}/blacklist/categorize_delete.gz");
        if (!$curl->GetFile("{$tmpdir}/categorize_delete.gz")) {
            // ufdbguard_admin_events("Fatal: unable to download categorize_delete.gz file $curl->error",__FUNCTION__,__FILE__,__LINE__,"ufbd-artica");
            return;
        }
        if (!extractGZ("{$tmpdir}/categorize_delete.gz", "{$tmpdir}/categorize_delete.sql")) {
            // ufdbguard_admin_events("Fatal: unable to extract $tmpdir/categorize_delete.gz",__FUNCTION__,__FILE__,__LINE__,"ufbd-artica");
            return;
        }
    }
    $q = new mysql_squid_builder();
    $datas = explode("\n", @file_get_contents("{$tmpdir}/categorize_delete.sql"));
    while (list($index, $row) = each($datas)) {
        if (trim($row) == null) {
            continue;
        }
        $ligne = unserialize($row);
        $category = $ligne["category"];
        $pattern = $ligne["sitename"];
        $tablename = "category_" . $q->category_transform_name($category);
        if (!$q->TABLE_EXISTS($tablename)) {
            $q->CreateCategoryTable($category);
        }
        $q->QUERY_SQL("UPDATE {$tablename} SET enabled=0 WHERE `pattern`='{$pattern}'");
        if (!$q->ok) {
            echo $q->mysql_error . "\n";
        }
    }
    // ufdbguard_admin_events("Success updating deleted ". count($datas)." websites from categories",__FUNCTION__,__FILE__,__LINE__,"ufbd-artica");
    @unlink("{$tmpdir}/categorize_delete.sql");
}
示例#4
0
function RefreshIndex()
{
    $unix = new unix();
    $nice = EXEC_NICE();
    $sock = new sockets();
    $users = new usersMenus();
    $nohup = $unix->find_program("nohup");
    $php = $unix->LOCATE_PHP5_BIN();
    $wget = $unix->find_program("wget");
    $SYSTEMID = $unix->GetUniqueID();
    if ($SYSTEMID == null) {
        build_progress("System ID is Null !!!", 5);
        return;
    }
    build_progress_index("Register server...", 10);
    build_progress("Register server...", 10);
    shell_exec("{$nohup} {$nice} {$php} /usr/share/artica-postfix/exec.web-community-filter.php --register-lic >/dev/null 2>&1 &");
    if ($SYSTEMID == null) {
        build_progress_index("No system ID, force...", 15);
        build_progress("No system ID, force", 15);
        shell_exec("{$nice} /usr/share/artica-postfix/bin/artica-update -refresh-index --force >/dev/null 2>&1");
        return;
    }
    $xMEM_TOTAL_INSTALLEE = $users->MEM_TOTAL_INSTALLEE;
    $CPU_NUMBER = $users->CPU_NUMBER;
    $LinuxDistributionFullName = $users->LinuxDistriFullName;
    if ($LinuxDistributionFullName == null) {
        $LinuxDistributionFullName = "Linux Default";
    }
    $ARTICA_VERSION = GetCurrentVersion();
    $hostname = $unix->hostname_g();
    $CheckUserCount = CheckUserCount();
    $RebootAfterArticaUpgrade = $sock->GET_INFO("RebootAfterArticaUpgrade");
    if (!is_numeric($RebootAfterArticaUpgrade)) {
        $RebootAfterArticaUpgrade = 0;
    }
    $EnableScheduleUpdates = $sock->GET_INFO("EnableScheduleUpdates");
    $ArticaUpdateIntervalAllways = intval($sock->GET_INFO("EnableScheduleUpdates"));
    if (!is_numeric($EnableScheduleUpdates)) {
        $EnableScheduleUpdates = 0;
    }
    $ArticaAutoUpateOfficial = $sock->GET_INFO("ArticaAutoUpateOfficial");
    $ArticaAutoUpateNightly = intval($sock->GET_INFO("ArticaAutoUpateNightly"));
    $ArticaUpdateIntervalAllways = intval($sock->GET_INFO("ArticaUpdateIntervalAllways"));
    $OfficialArticaUri = $sock->GET_INFO("OfficialArticaUri");
    if (!is_numeric($ArticaAutoUpateOfficial)) {
        $ArticaAutoUpateOfficial = 1;
    }
    if ($OfficialArticaUri == null) {
        $OfficialArticaUri = "http://articatech.net/artica.update.php";
    }
    $uri = $OfficialArticaUri;
    $dmidecode = @file_get_contents("/etc/artica-postfix/dmidecode.cache.url");
    @unlink($GLOBALS["MasterIndexFile"]);
    $tarballs_file = "/usr/share/artica-postfix/ressources/logs/web/tarballs.cache";
    echo "Starting......: " . date("H:i:s") . " CPU NUMBER: {$CPU_NUMBER}\n";
    echo "Starting......: " . date("H:i:s") . " Hostname..: {$hostname}\n";
    echo "Starting......: " . date("H:i:s") . " Artica ver: {$ARTICA_VERSION}\n";
    echo "Starting......: " . date("H:i:s") . " Users.....: {$CheckUserCount}\n";
    build_progress_index("Configuration done...", 15);
    build_progress("Configuration done", 15);
    $DATA["UUID"] = $SYSTEMID;
    $DATA["MEM"] = $xMEM_TOTAL_INSTALLEE;
    $DATA["CPU"] = $CPU_NUMBER;
    $DATA["LINUX"] = $LinuxDistributionFullName;
    $DATA["VERSION"] = $ARTICA_VERSION;
    $DATA["HOSTNAME"] = $hostname;
    $DATA["USERS"] = $CheckUserCount;
    $DATA["DMICODE"] = $dmidecode;
    build_progress_index("Check repositories...", 20);
    build_progress("Check repositories", 20);
    $MAIN_URI = $unix->MAIN_URI();
    echo "Starting......: " . date("H:i:s") . " Main URI..: {$MAIN_URI}\n";
    $md5string = @md5_file($GLOBALS["MasterIndexFile"]);
    build_progress_index("Get Index...", 25);
    build_progress("Get Index...", 25);
    echo "Starting......: " . date("H:i:s") . " Update index file..\n";
    $curl = new ccurl($OfficialArticaUri);
    $curl->parms["datas"] = base64_encode(serialize($DATA));
    if (!$curl->get()) {
        echo "Last detected error: {$curl->error}\n";
        build_progress_index("Get Index...{failed}", 110);
        build_progress("Get Index file !! FAILED !!", 110);
        _artica_update_event(0, "Unable to download index file with error {$curl->error_num}, {$curl->error}", null, __FILE__, __LINE__);
        return false;
    }
    @unlink("/etc/artica-postfix/settings/Daemons/ArticaUpdateRepos");
    build_progress_index("Parse Index from repository", 40);
    build_progress("Parse Index from repository", 40);
    if (preg_match("#<ERROR>(.+?)</ERROR>#is", $curl->data, $re)) {
        echo "{$re[1]} !! FAILED !!\n";
        build_progress_index("Corrupted index from repository !! FAILED !!", 110);
        build_progress("Corrupted index from repository !! FAILED !!", 110);
        return;
    }
    if (!preg_match("#<CONTENT>(.+?)</CONTENT>#is", $curl->data, $re)) {
        echo "Corrupted index from repository !! FAILED !!\n";
        build_progress_index("Corrupted index from repository !! FAILED !!", 110);
        build_progress("Corrupted index from repository !! FAILED !!", 110);
        return;
    }
    $MAIN = unserialize(base64_decode($re[1]));
    if (!is_array($MAIN)) {
        echo "It is not an array...\n";
        build_progress_index("Corrupted index from repository !! FAILED !!", 110);
        build_progress("Corrupted index from repository !! FAILED !!", 110);
    }
    build_progress_index("Retreive index from repository success", 100);
    @file_put_contents("/etc/artica-postfix/settings/Daemons/ArticaUpdateRepos", serialize($MAIN));
    return true;
}
function downgrade($file)
{
    $unix = new unix();
    $pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $unix = new unix();
    $pid = $unix->get_pid_from_file($pidFile);
    if ($unix->process_exists($pid)) {
        Events("??%: A process already exists PID {$pid}");
        return;
    }
    @file_put_contents($pidFile, getmypid());
    $workdir = "/home/squid/downgrade";
    $gzf = "/home/squid/downgrade/{$file}";
    @mkdir("/home/squid/downgrade", 0755, true);
    Events("0%: Ask to update package name {$file}");
    Events("1%: downloading {$file}");
    if (!is_dir($workdir)) {
        Events("100%: Failed,  {$workdir} Permission denied");
        die;
    }
    if (is_file($gzf)) {
        @unlink($gzf);
    }
    $unix = new unix();
    $URIBASE = $unix->MAIN_URI();
    Events("5%: PLEASE WAIT,PLEASE WAIT,PLEASE WAIT.....downloading {$file}");
    $curl = new ccurl("{$URIBASE}/download/old-squid/{$file}");
    $curl->NoHTTP_POST = true;
    $curl->ProgressFunction = "downgrade_prg";
    $curl->WriteProgress = true;
    if (!$curl->GetFile($gzf)) {
        Events("100%: Failed to download {$curl->error}");
        die;
    }
    if (!is_file($gzf)) {
        Events("100%: Failed to download permission denied on disk");
        die;
    }
    $size = @filesize($gzf);
    $size = $size / 1024;
    $size = $size / 1024;
    Events("10%: " . basename($gzf) . " " . round($size, 2) . " MB");
    Events("10%: Testing {$gzf}");
    if ($GLOBALS["VERBOSE"]) {
        echo "Open TAR...\n";
    }
    $tar = new tar();
    if (!$tar->openTar($gzf)) {
        Events("100%: Failed archive seems corrupted..");
        die;
    }
    Events("10%: Testing {$gzf} success");
    Events("15%: Start upgrade procedure...");
    Events("16%: Stopping Squid-Cache...");
    shell_exec("/etc/init.d/squid stop");
    $squidbin = $unix->LOCATE_SQUID_BIN();
    $rm = $unix->find_program("rm");
    $tar = $unix->find_program("tar");
    $php5 = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    Events("17%: Removing {$squidbin}...");
    @unlink($squidbin);
    $f[] = "/lib/squid3";
    $f[] = "/usr/share/squid-langpack";
    $f[] = "/usr/share/squid3";
    while (list($num, $dir) = each($f)) {
        Events("20%: Removing {$dir} directory...");
        shell_exec("{$rm} -rf {$dir} >/dev/null 2>&1");
    }
    Events("50%: Installing...");
    shell_exec("{$tar} xf {$gzf} -C / >/dev/null");
    $squidbin = $unix->LOCATE_SQUID_BIN();
    if (!is_file($squidbin)) {
        Events("100%: Failed archive seems corrupted, please restart again or contact or support team...");
        die;
    }
    $ver = $unix->squid_version();
    Events("60%: New Squid-cache version {$ver}");
    Events("65%: Reconfiguring parameters");
    shell_exec("{$php5} /usr/share/artica-postfix/exec.squid.php --build --force >/dev/null");
    Events("70%: Starting Squid-Cache");
    shell_exec("/etc/init.d/squid start");
    Events("80%: Refresh Artica with the new version...");
    shell_exec("/etc/init.d/artica-process1 start");
    Events("90%: Restarting watchdogs...");
    system("/etc/init.d/cache-tail restart");
    system("{$nohup} /etc/init.d/artica-status reload >/dev/null 2>&1 &");
    shell_exec("{$nohup} /etc/init.d/monit restart  >/dev/null 2>&1 &");
    Events("100%: Done...");
    Events("-------------------------------------------------------------");
    Events("----------------     Squid Cache V.{$ver}    ------------------");
    Events("-------------------------------------------------------------");
}
function import()
{
    include_once "HTTP/Request.php";
    $ArticaProxyServerEnabled = "no";
    $sock = new sockets();
    $ArticaMetaEnabled = $sock->GET_INFO("ArticaMetaEnabled");
    $datas = $sock->GET_INFO("ArticaProxySettings");
    if ($ArticaMetaEnabled == null) {
        $ArticaMetaEnabled = 0;
    }
    if (strlen($datas) > 5) {
        $ini = new Bs_IniHandler();
        $ini->loadString($datas);
        $ArticaProxyServerEnabled = $ini->_params["PROXY"]["ArticaProxyServerEnabled"];
        $ArticaProxyServerName = $ini->_params["PROXY"]["ArticaProxyServerName"];
        $ArticaProxyServerPort = $ini->_params["PROXY"]["ArticaProxyServerPort"];
        $ArticaProxyServerUsername = $ini->_params["PROXY"]["ArticaProxyServerUsername"];
        $ArticaProxyServerUserPassword = $ini->_params["PROXY"]["ArticaProxyServerUserPassword"];
    }
    $unix = new unix();
    $URIBASE = $unix->MAIN_URI();
    $req = new HTTP_Request("{$URIBASE}/smtphack-import.php?export=yes");
    $req->setURL("{$URIBASE}/smtphack-import.php?export=yes");
    $req->setMethod(HTTP_REQUEST_METHOD_GET);
    if ($ArticaProxyServerEnabled == "yes") {
        $req->setProxy($ArticaProxyServerName, $ArticaProxyServerPort, $ArticaProxyServerUsername, $ArticaProxyServerUserPassword);
    }
    $req->sendRequest();
    $code = $req->getResponseCode();
    $datas = trim($req->getResponseBody());
    $array = unserialize(base64_decode($datas));
    if (!is_array($array)) {
        return;
    }
    $sock = new sockets();
    $q = new mysql();
    $count_before = $q->COUNT_ROWS("iptables", "artica_backup");
    if ($GLOBALS["DEBUG"]) {
        echo "import:: before: {$count_before} array of " . count($array) . " rows";
    }
    while (list($num, $sql) = each($array)) {
        $q = new mysql();
        $q->QUERY_SQL($sql, "artica_backup");
        if ($GLOBALS["DEBUG"]) {
            echo "import:: SQL:: {$sql}\n";
        }
        if (!$q->ok) {
            if ($GLOBALS["DEBUG"]) {
                echo "import:: ERROR:: {$q->mysql_error}\n";
            }
        }
    }
    $q = new mysql();
    $count_after = $q->COUNT_ROWS("iptables", "artica_backup");
    if ($GLOBALS["DEBUG"]) {
        echo "import:: after: {$count_after} array of " . count($array) . " rows\n";
    }
    if ($count_after != $count_before) {
        $added = $count_after - $count_before;
        if ($GLOBALS["DEBUG"]) {
            echo "import:: Send email notification for {$added} rows\n";
        }
        if ($GLOBALS["DEBUG"]) {
            echo "import:: SMTP HACK: {$added} iptables rules from Artica repository\n";
        }
        send_email_events("SMTP HACK: {$added} iptables rules from Artica repository", "Check SMTP Hack panel to see new rules added", "update");
        if ($GLOBALS["DEBUG"]) {
            $add_verb = " --verbose";
        }
        shell_exec(LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.postfix.iptables.php --compile{$add_verb}");
        if ($ArticaMetaEnabled == 1) {
            shell_exec(LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --iptables");
        }
    }
}
$GLOBALS["CATS"][] = "searchengines";
$GLOBALS["CATS"][] = "sect";
$GLOBALS["CATS"][] = "sex/lingerie";
$GLOBALS["CATS"][] = "sexual_education";
$GLOBALS["CATS"][] = "shopping";
$GLOBALS["CATS"][] = "socialnet";
$GLOBALS["CATS"][] = "spyware";
$GLOBALS["CATS"][] = "sslsites";
$GLOBALS["CATS"][] = "strong_redirector";
$GLOBALS["CATS"][] = "tracker";
$GLOBALS["CATS"][] = "translators";
$GLOBALS["CATS"][] = "updatesites";
$GLOBALS["CATS"][] = "violence";
$GLOBALS["CATS"][] = "warez";
$GLOBALS["CATS"][] = "weapons";
$GLOBALS["CATS"][] = "webmail";
$GLOBALS["CATS"][] = "webphone";
$GLOBALS["CATS"][] = "webplugins";
$GLOBALS["CATS"][] = "webradio";
$GLOBALS["CATS"][] = "webtv";
$GLOBALS["CATS"][] = "celebrity";
$GLOBALS["CATS"][] = "books";
$GLOBALS["CATS"][] = "maps";
$unix = new unix();
$URIBASE = $unix->MAIN_URI();
while (list($index, $category) = each($GLOBALS["CATS"])) {
    echo "echo sending Extracting {$category}\n";
    shell_exec("/usr/bin/wget {$URIBASE}/compile-www.php?ExportCategory={$index} -O /tmp/tmp.txt");
    echo "echo sending Extracting {$category} done\n";
}
shell_exec("/usr/bin/wget {$URIBASE}/compile-www.php?compress-categories=yes -O /tmp/tmp.txt");
function pushit()
{
    $unix = new unix();
    $URIBASE = $unix->MAIN_URI();
    $URIBASE = str_replace("articatech.net", "artica.fr", $URIBASE);
    $curl = new ccurl("{$URIBASE}/shalla-orders.php", false);
    $curl->parms["ORDER_EXPORT"] = "yes";
    $curl->get();
    if (preg_match("#<ANSWER>OK</ANSWER>#is", $curl->data)) {
        WriteMyLogs("success", __FUNCTION__, __FILE__, __LINE__);
    } else {
        WriteMyLogs("failed\n{$curl->data}", __FUNCTION__, __FILE__, __LINE__);
    }
}