当前位置: 首页>>代码示例>>PHP>>正文


PHP ccurl类代码示例

本文整理汇总了PHP中ccurl的典型用法代码示例。如果您正苦于以下问题:PHP ccurl类的具体用法?PHP ccurl怎么用?PHP ccurl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ccurl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: xstart

function xstart()
{
    $unix = new unix();
    $php = $unix->LOCATE_PHP5_BIN();
    $tar = $unix->find_program("tar");
    build_progress("{downloading} roundcubeemail-1.1.2.tar.gz", 20);
    $tmpfile = $unix->FILE_TEMP();
    $curl = new ccurl("http://articatech.net/download/postfix-debian7/roundcubeemail-1.1.2.tar.gz");
    if (!$curl->GetFile($tmpfile)) {
        echo "Failed: " . $curl->error . "\n";
        @unlink($tmpfile);
        build_progress("{failed} roundcubeemail-1.1.2.tar.gz", 110);
        return;
    }
    build_progress("{uncompressing} roundcubeemail-1.1.2.tar.gz", 50);
    system("{$tar} xf {$tmpfile} -C /");
    @unlink($tmpfile);
    if (!is_file("/usr/share/roundcube/index.php")) {
        build_progress("{uncompressing} roundcubeemail-1.1.2.tar.gz {failed}", 110);
        return;
    }
    build_progress("{verify_database}", 60);
    system("{$php} /usr/share/artica-postfix/exec.roundcube.php --database");
    build_progress("{restarting_service}", 70);
    system("{$php} /usr/share/artica-postfix/exec.roundcube.php --restart");
    system("/etc/init.d/artica-status restart");
    build_progress("{installing} roundcubeemail-1.1.2.tar.gz {success}", 100);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:28,代码来源:exec.roundcube.install.php

示例2: Import

function Import()
{
    $curl = new ccurl("http://www.privacyonline.org.uk/downloads/privacyonline-btl.tpl");
    $curl->NoHTTP_POST = true;
    $curl->GetFile("/tmp/privacyonline-btl.tpl");
    $f = file("/tmp/privacyonline-btl.tpl");
    @unlink("/tmp/privacyonline-btl.tpl");
    while (list($indx, $line) = each($f)) {
        $line = trim($line);
        $line = str_replace("\n", "", $line);
        $line = str_replace("\r", "", $line);
        if (!preg_match("#^\\-d\\s+(.+)#", $line, $re)) {
            if ($GLOBALS["VERBOSE"]) {
                echo "SKIP \"{$line}\"\n";
            }
            continue;
        }
        $line = $re[1];
        if (strpos($line, " ") > 0) {
            if ($GLOBALS["VERBOSE"]) {
                echo "SKIP \"{$line}\"\n";
            }
            continue;
        }
        if (strpos($line, "/") > 0) {
            if ($GLOBALS["VERBOSE"]) {
                echo "SKIP \"{$line}\"\n";
            }
            continue;
        }
        $domain[$line] = $line;
    }
    return $domain;
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:34,代码来源:exec.squid.import.adblock.php

示例3: Connect

function Connect($server, $port, $user, $pass)
{
    writelogs("synchronize {$server}:{$port}", __FUNCTION__, __FILE__, __LINE__);
    $sync = new articaSMTPSync();
    $ldap = new clladp();
    $http = new httpd();
    $array = $sync->GetUsers();
    $field = base64_encode(serialize($array));
    $cred["user"] = $user;
    $cred["pass"] = $pass;
    $curl = new ccurl("https://{$server}:{$port}/exec.smtp.export.users.php");
    $curl->parms["credentials"] = base64_encode(serialize($cred));
    $curl->parms["users"] = $field;
    $curl->parms["local_port"] = $http->https_port;
    $curl->parms["mycred"] = base64_encode(serialize(array($ldap->ldap_admin, $ldap->ldap_password)));
    if (!$curl->get()) {
        writelogs("synchronize {$server}:{$port} failed", __FUNCTION__, __FILE__, __LINE__);
    }
    if (preg_match("#<datas>(.+?)</datas>#is", $curl->data, $re)) {
        $array = unserialize(base64_decode($re[1]));
        $sync->import($array, "{$server}:{$port}");
        $sock = new sockets();
        $sock->getFrameWork("cmd.php?postfix-transport-maps=yes");
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:25,代码来源:exec.smtp.export.users.php

示例4: iprulesDNS

function iprulesDNS()
{
    $unix = new unix();
    $IPCHAIN = "dnsfilter";
    $pidfile = "/etc/artica-postfix/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    if ($unix->process_exists(@file_get_contents($pidfile), basename(__FILE__))) {
        echo "Starting......: " . date("H:i:s") . " iptables configurator already executed PID " . @file_get_contents($pidfile) . "\n";
        die;
    }
    $pid = getmypid();
    file_put_contents($pidfile, $pid);
    $sock = new sockets();
    $EnableIptablesDNS = $sock->GET_INFO("EnableIptablesDNS");
    if (!is_numeric($EnableIptablesDNS)) {
        $EnableIptablesDNS = 1;
    }
    if ($EnableIptablesDNS == 0) {
        $ip = new iptables_exec();
        if ($ip->is_chain_exists($IPCHAIN)) {
            shell_exec("{$GLOBALS["iptables"]} -F {$IPCHAIN}");
            shell_exec("{$GLOBALS["iptables"]} -X {$IPCHAIN}");
        }
        return;
    }
    $tmpfile = $unix->FILE_TEMP();
    $curl = new ccurl("https://raw.github.com/smurfmonitor/dns-iptables-rules/master/domain-blacklist.txt");
    $curl->NoHTTP_POST = true;
    if ($curl->GetFile($tmpfile)) {
        $size = @filesize($tmpfile);
        if ($size < 100) {
            $tmpfile = "/usr/share/artica-postfix/bin/install/iptables_defaults.txt";
        }
    }
    $ip = new iptables_exec();
    if (!$ip->is_chain_exists($IPCHAIN)) {
        echo "Adding chain {$IPCHAIN}\n";
        shell_exec("{$GLOBALS["iptables"]} -N {$IPCHAIN}");
        shell_exec("{$GLOBALS["iptables"]} -I INPUT -p udp --dport 53 -j {$IPCHAIN}");
    } else {
        echo "chain {$IPCHAIN} exists...\n";
    }
    shell_exec("{$GLOBALS["iptables"]} -F {$IPCHAIN}");
    shell_exec("{$GLOBALS["iptables"]} -A {$IPCHAIN} -j RETURN");
    $f = explode("\n", @file_get_contents($tmpfile));
    while (list($num, $ligne) = each($f)) {
        $ligne = trim($ligne);
        if ($ligne == null) {
            continue;
        }
        $ligne = str_replace("INPUT", $IPCHAIN, $ligne);
        $ligne = str_replace("iptables", $GLOBALS["iptables"], $ligne);
        $results = array();
        exec($ligne, $results);
        echo "{$ligne}\n";
        while (list($a, $b) = each($results)) {
            echo "{$b}\n";
        }
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:59,代码来源:exec.iptables.php

示例5: GetDomains

function GetDomains($i)
{
    $unix = new unix();
    $tmpfile = $unix->FILE_TEMP();
    $curl = new ccurl("http://0675.com.cn/newwebsite_20120101_list._page0.html");
    $curl->NoHTTP_POST = true;
    echo "Get page {$i}\n";
    if (!$curl->GetFile($tmpfile)) {
        echo "http://0675.com.cn/newwebsite_20120101_list._page{$i}.html -> error: \n" . $curl->error . "\n";
        return;
    }
    $datas = @file($tmpfile);
    $size = strlen(@implode("", $datas)) / 1024;
    echo "Page[{$i}]:: {$tmpfile} Size: {$size} Ko\n";
    while (list($num, $ligne) = each($datas)) {
        if (preg_match("#<div class=.*?newdomain.*?>(.*)#", $ligne)) {
            echo "Sure line {$num}";
            $newdata = str_replace("</li>", "", $ligne);
            $newdata = str_replace("</div>", "", $newdata);
            $f = explode("<li>", $newdata);
        }
    }
    $q = new mysql_squid_builder();
    while (list($num, $www) = each($f)) {
        if (preg_match("#^\\.(.+)#", $www, $re)) {
            $www = $re[1];
        }
        if (strpos($www, ",") > 0) {
            continue;
        }
        if (strpos($www, " ") > 0) {
            continue;
        }
        if (strpos($www, ":") > 0) {
            continue;
        }
        if (strpos($www, "%") > 0) {
            continue;
        }
        if (strpos($www, ">") > 0) {
            continue;
        }
        if (strpos($www, "<") > 0) {
            continue;
        }
        if (preg_match("#^www\\.(.+)#", $www, $re)) {
            $www = $re[1];
        }
        $articacats = trim($q->GET_CATEGORIES($www, true, false));
        if ($articacats != null) {
            echo "\"{$www}\" SUCCESS - {$articacats} -\n";
            continue;
        }
        echo "\"{$www}\" FAILED\n";
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:56,代码来源:exec.scan.0675-com.php

示例6: download

function download()
{
    $unix = new unix();
    build_progress("{downloading}", 10);
    $URI = "http://wordpress.org/latest.tar.gz";
    $TMP_FILE = $unix->FILE_TEMP() . ".gz";
    $TMP_DIR = $unix->TEMP_DIR();
    echo "Downloading {$URI}\n";
    $curl = new ccurl($URI);
    $curl->WriteProgress = true;
    $curl->ProgressFunction = "download_progress";
    if (!$curl->GetFile($TMP_FILE)) {
        build_progress("{downloading} {failed}", 110);
        echo $curl->error;
        return;
    }
    echo "Extracting {$TMP_FILE} in {$TMP_DIR}\n";
    $tar = $unix->find_program("tar");
    $cmd = "{$tar} xf {$TMP_FILE} -C {$TMP_DIR}/";
    build_progress("{uncompress}", 50);
    shell_exec("{$tar} xf {$TMP_FILE} -C {$TMP_DIR}/");
    @unlink($TMP_FILE);
    $dirs = $unix->dirdir($TMP_DIR);
    $WDP_DIR = null;
    while (list($num, $ligne) = each($dirs)) {
        if (!is_file("{$ligne}/wp-admin/install.php")) {
            continue;
        }
        $WDP_DIR = $ligne;
        break;
        echo "Find Directory {$ligne}\n";
    }
    if (!is_dir($WDP_DIR)) {
        build_progress("Find directory failed", 110);
        echo "Find directory failed\n";
        return;
    }
    build_progress("{installing}", 80);
    @mkdir("/usr/share/wordpress-src", 0755, true);
    $cp = $unix->find_program("cp");
    $rm = $unix->find_program("rm");
    shell_exec("cp -rfv {$WDP_DIR}/* /usr/share/wordpress-src/");
    if (is_dir($WDP_DIR)) {
        echo "Removing {$WDP_DIR}\n";
        shell_exec("{$rm} -rf {$WDP_DIR}");
    }
    $sock = new sockets();
    $sock->SET_INFO("EnableFreeWeb", 1);
    @file_put_contents("/etc/artica-postfix/settings/Daemons/WordPressInstalled", 1);
    system("/etc/init.d/artica-status restart --force");
    build_progress("{success}", 100);
    $nohup = $unix->find_program("nohup");
    $sock = new sockets();
    shell_exec("{$nohup} /usr/share/artica-postfix/bin/process1 --verbose 654646 >/dev/null 2>&1 &");
}
开发者ID:articatech,项目名称:artica,代码行数:55,代码来源:exec.wordpress.download.php

示例7: subdomains

function subdomains()
{
    $subdomains = "https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt";
    $MAIN = unserialize(@file_get_contents("/root/ransomwaretracker.db"));
    $curl = new ccurl($subdomains);
    if ($curl->GetFile("/root/RW_DOMBL.txt")) {
        $f = explode("\n", @file_get_contents("/root/RW_DOMBL.txt"));
        while (list($index, $line) = each($f)) {
            $line = trim($line);
            if (substr($line, 0, 1) == "#") {
                continue;
            }
            $MAIN["DOMAINS"][$line] = true;
        }
    } else {
        echo "{$subdomains} failed\n";
    }
    $ips = "https://ransomwaretracker.abuse.ch/downloads/RW_IPBL.txt";
    $curl = new ccurl($ips);
    if ($curl->GetFile("/root/RW_IPBL.txt")) {
        $f = explode("\n", @file_get_contents("/root/RW_IPBL.txt"));
        while (list($index, $line) = each($f)) {
            $line = trim($line);
            if (substr($line, 0, 1) == "#") {
                continue;
            }
            $MAIN["IPS"][$line] = true;
        }
    } else {
        echo "{$ips} failed\n";
    }
    $uris = "https://ransomwaretracker.abuse.ch/downloads/RW_URLBL.txt";
    $curl = new ccurl($uris);
    if ($curl->GetFile("/root/RW_URLBL.txt")) {
        $f = explode("\n", @file_get_contents("/root/RW_URLBL.txt"));
        while (list($index, $line) = each($f)) {
            $line = trim($line);
            if (substr($line, 0, 1) == "#") {
                continue;
            }
            $MAIN["URIS"][$line] = true;
        }
    } else {
        echo "{$uris} failed\n";
    }
    $MAIN2["TIME"] = time();
    $MAIN2["MD5"] = md5(serialize($MAIN));
    @file_put_contents("/root/ransomwaretracker.db", serialize($MAIN));
    @file_put_contents("/root/ransomwaretracker.txt", serialize($MAIN2));
    $unix = new unix();
    $unix->compress("/root/ransomwaretracker.db", "/root/ransomwaretracker.gz");
    PushToRepo("/root/ransomwaretracker.txt");
    PushToRepo("/root/ransomwaretracker.gz");
}
开发者ID:articatech,项目名称:artica,代码行数:54,代码来源:exec.abuse-ch.could.php

示例8: update

function update()
{
    if (system_is_overloaded()) {
        return;
    }
    $unix = new unix();
    $sock = new sockets();
    $pidfile = "/etc/artica-postfix/pids/exec.ipblock.php.update.pid";
    $pidtime = "/etc/artica-postfix/pids/exec.ipblock.php.update.time";
    $pid = @file_get_contents($pidfile);
    if (!$GLOBALS["FORCE"]) {
        if ($unix->process_exists($pid)) {
            echo "Already running pid {$pid}\n";
            return;
        }
    }
    include_once dirname(__FILE__) . '/ressources/class.ccurl.inc';
    if (!is_file($pidtime)) {
        @file_put_contents($pidtime, time());
    }
    if (!$GLOBALS["FORCE"]) {
        if ($unix->file_time_min($pidtime) > 720) {
            @unlink($pidtime);
            @file_put_contents($pidtime, time());
            return;
        }
    }
    @file_put_contents($pidfile, getmypid());
    $EnableIpBlocks = intval($sock->GET_INFO("EnableIpBlocks"));
    if ($EnableIpBlocks == 0) {
        return;
    }
    $DIR_TEMP = $unix->TEMP_DIR();
    $curl = new ccurl("http://www.ipdeny.com/ipblocks/data/countries/all-zones.tar.gz");
    if (!$curl->GetFile("{$DIR_TEMP}/all-zones.tar.gz")) {
        system_admin_events(0, "Fatal, Unable to download all-zones.tar.gz from ipdeny.com", __FILE__, __LINE__);
        return;
    }
    $OldMd5 = $sock->GET_INFO("IpBlocksMD5");
    $md5File = md5_file("{$DIR_TEMP}/all-zones.tar.gz");
    if ($md5File == $OldMd5) {
        ipblocks();
        return;
    }
    $tar = $unix->find_program("tar");
    @mkdir("/home/artica/ipblocks", 0755, true);
    shell_exec("{$tar} xf {$DIR_TEMP}/all-zones.tar.gz -C  /home/artica/ipblocks/");
    if (ipblocks()) {
        $sock->SET_INFO("IpBlocksMD5", "{$md5File}");
        system_admin_events(0, "Restarting Firewall in order to refresh countries blocking");
    }
}
开发者ID:articatech,项目名称:artica,代码行数:52,代码来源:exec.ipblock.php

示例9: download_install

function download_install($key)
{
    $GLOBALS["PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/squid.install.progress";
    $GLOBALS["LOG_FILE"] = "/usr/share/artica-postfix/ressources/logs/web/squid.install.progress.txt";
    $sock = new sockets();
    $ArticaTechNetSquidRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetSquidRepo")));
    $array = $ArticaTechNetSquidRepo[$key];
    $URL = $array["URL"];
    $VERSION = $array["VERSION"];
    $FILESIZE = $array["FILESIZE"];
    $FILENAME = $array["FILENAME"];
    $MD5 = $array["MD5"];
    $tarballs_file = "/usr/share/artica-postfix/ressources/conf/upload/{$FILENAME}";
    echo "Url......................: {$URL}\n";
    echo "Version..................: {$VERSION}\n";
    echo "File size................: {$FILESIZE}\n";
    echo "Filename.................: {$FILENAME}\n";
    echo "MD5......................: {$MD5}\n";
    if ($URL == null) {
        build_progress("{downloading} {$FILENAME} {failed}...", 110);
        die;
    }
    build_progress("{downloading} {$FILENAME} {please_wait}...", 5);
    $curl = new ccurl($URL);
    $curl->WriteProgress = true;
    $curl->ProgressFunction = "download_progress";
    if (!$curl->GetFile($tarballs_file)) {
        build_progress("{downloading} {$FILENAME} {failed}...", 110);
        @unlink($tarballs_file);
        echo $curl->error;
        die;
    }
    build_progress("{checking} {$FILENAME} {please_wait}...", 9);
    $filesize = @filesize($tarballs_file);
    $md5file = md5_file($tarballs_file);
    echo "File size................: {$filesize}\n";
    echo "MD5......................: {$md5file}\n";
    if ($filesize < 50) {
        print_r($curl->CURL_ALL_INFOS);
        echo @file_get_contents($tarballs_file);
    }
    if ($md5file != $MD5) {
        @unlink($tarballs_file);
        echo "Md5 failed, corrupted file...\n";
        build_progress("{checking} {$FILENAME} {failed}...", 110);
        die;
    }
    install($FILENAME);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:49,代码来源:exec.squid.uncompress.php

示例10: GetCategory

function GetCategory($source, $dest)
{
    for ($i = 1; $i < 13; $i++) {
        echo "Checking page number {$i}\n";
        $curl = new ccurl("http://cacaweb.com/category/{$source}/page/{$i}");
        $curl->NoHTTP_POST = true;
        $curl->UserAgent = "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0";
        $curl->FollowLocation = true;
        if (!$curl->get()) {
            echo $curl->error . "\n";
            return;
        }
        CheckWebsites($curl->data, $dest);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:15,代码来源:exec.cacaweb.com.php

示例11: xinstall

function xinstall()
{
    $unix = new unix();
    $curl = new ccurl();
    $tmpfile = $unix->FILE_TEMP();
    $tmpdir = $unix->TEMP_DIR();
    build_progress("{downloading} v3.1.0-25", 15);
    $curl = new ccurl("http://articatech.net/download/UpdateUtility/updateutility-3.1.0-25.tar.gz");
    if (!$curl->GetFile($tmpfile)) {
        @unlink($tmpfile);
        build_progress("{downloading} {failed}", 110);
        return;
    }
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    @mkdir("{$tmpdir}/updateutility", 0755);
    build_progress("{uncompress}", 20);
    shell_exec("{$tar} -xf {$tmpfile} -C {$tmpdir}/updateutility/");
    build_progress("{find_source_directory}", 25);
    $dirs = $unix->dirdir("{$tmpdir}/updateutility");
    $SOURCE_DIRECTORY = null;
    while (list($num, $ligne) = each($dirs)) {
        build_progress("{scanning} {$ligne}", 25);
        if (is_file("{$ligne}/UpdateUtility-Console")) {
            $SOURCE_DIRECTORY = $ligne;
            break;
        }
    }
    if ($SOURCE_DIRECTORY == null) {
        echo "Unable to find source directory\n";
        build_progress("{installing} {failed}", 110);
        shell_exec("{$rm} -rf {$tmpdir}/updateutility");
        return;
    }
    echo "Using directory {$SOURCE_DIRECTORY}\n";
    build_progress("{installing}...", 80);
    $cp = $unix->find_program("cp");
    @mkdir("/etc/UpdateUtility", 0755, true);
    shell_exec("{$cp} -rfv {$SOURCE_DIRECTORY}/* /etc/UpdateUtility/");
    shell_exec("{$rm} -rf {$tmpdir}/updateutility");
    if (!is_file("/etc/UpdateUtility/UpdateUtility-Console")) {
        echo "/etc/UpdateUtility/UpdateUtility-Console no such binary\n";
        build_progress("{installing} {failed}", 110);
    }
    build_progress("{installing} {success}", 100);
}
开发者ID:articatech,项目名称:artica,代码行数:46,代码来源:exec.updateutility.install.php

示例12: ping

function ping($hostid)
{
    $mefile = basename(__FILE__);
    $GLOBALS["CLASS_UNIX"] = new unix();
    $GLOBALS["CLASS_UNIX"]->events("{$mefile}:: blackboxes({$hostid})", "/var/log/stats-appliance.log");
    $black = new blackboxes($hostid);
    $ssluri = $black->ssluri . "/nodes.listener.php";
    $nossluri = $black->sslnouri . "/nodes.listener.php";
    if ($GLOBALS["VERBOSE"]) {
        echo "Try {$ssluri}\n";
    }
    $GLOBALS["CLASS_UNIX"]->events("{$mefile}:: {$ssluri}", "/var/log/stats-appliance.log");
    $curl = new ccurl($ssluri);
    $curl->parms["PING-ORDERS"] = true;
    if ($GLOBALS["VERBOSE"]) {
        $curl->parms["VERBOSE"] = true;
    }
    $curl->noproxyload = true;
    if ($GLOBALS["VERBOSE"]) {
        echo "Sending PING-ORDERS\n";
    }
    if (!$curl->get()) {
        $ssluri = $nossluri;
        $GLOBALS["CLASS_UNIX"]->events("{$mefile}:: {$ssluri}", "/var/log/stats-appliance.log");
        if ($GLOBALS["VERBOSE"]) {
            echo "error `{$ssluri}` {$curl->error}, trying http\n";
        }
        $curl = new ccurl($nossluri);
        $curl->noproxyload = true;
        $curl->parms["PING-ORDERS"] = true;
        if (!$curl->get()) {
            ufdbguard_admin_events("{$mefile}:: Failed to send ping to {$black->hostname} with Error:`{$curl->error}`", __FUNCTION__, __FILE__, __LINE__, "communicate");
            return;
        }
    }
    if ($GLOBALS["VERBOSE"]) {
        echo $curl->data;
    }
    if (preg_match("#SUCCESS<#s", $curl->data)) {
        $GLOBALS["CLASS_UNIX"]->events("Success to send ping to {$black->hostname}", "/var/log/stats-appliance.log");
        ufdbguard_admin_events("{$mefile}:: Success to send ping to {$black->hostname}", __FUNCTION__, __FILE__, __LINE__, "communicate");
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:43,代码来源:exec.blackbox.php

示例13: ImportNets

function ImportNets()
{
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $ini->loadString($sock->GET_INFO("ComputersImportArtica"));
    if (!is_array($ini->_params)) {
        writelogs("No artica masters defined", __FUNCTION__, __FILE__, __LINE__);
        die;
    }
    if (count($ini->_params) == 0) {
        writelogs("No artica masters defined", __FUNCTION__, __FILE__, __LINE__);
        die;
    }
    while (list($ip, $array) = each($ini->_params)) {
        if (trim($ip) == null) {
            continue;
        }
        $curl = new ccurl("https://{$ip}:{$array["port"]}/exec.import-networks.php");
        while (list($key, $value) = each($array)) {
            $curl->parms[$key] = $value;
        }
        $curl->get();
        $datas = $curl->data;
        if (trim($datas) == null) {
            continue;
        }
        $md5 = md5($datas);
        import_vpn_remotes_sites($datas);
        if (!$GLOBALS["FORCE"]) {
            if ($array["md5"] != $md5) {
                ImportDatas($datas);
            }
        } else {
            ImportDatas($datas);
        }
        $ini->_params[$ip]["md5"] = $md5;
    }
    reset($ini->_params);
    $ini->saveFile("/etc/artica-postfix/settings/Daemons/ComputersImportArtica");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:40,代码来源:exec.import-networks.php

示例14: Save

function Save()
{
    include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
    $sock = new sockets();
    $tpl = new templates();
    $curl = new ccurl();
    $proto = "http";
    $StatsServervame = $_POST["StatsServervame"];
    $StatsServerPort = $_POST["StatsServerPort"];
    $StatsServerSSL = $_POST["StatsServerSSL"];
    if ($StatsServerSSL == 1) {
        $proto = "https";
    }
    $EnableRemoteSyslogStatsAppliance = $_POST["EnableRemoteSyslogStatsAppliance"];
    $uri = "{$proto}://{$StatsServervame}:{$StatsServerPort}/nodes.listener.php";
    if ($EnableRemoteSyslogStatsAppliance == 1) {
        writelogs("{$uri}", __FUNCTION__, __FILE__, __LINE__);
        $curl = new ccurl($uri);
        $curl->parms["OPENSYSLOG"] = 1;
        if (!$curl->get()) {
            echo "Error " . $tpl->_ENGINE_parse_body($curl->error);
            return;
        }
        if (strpos($curl->data, "<RESULTS>OK</RESULTS>") == 0) {
            echo "Error Protocol error or bad version on remote server\n";
            return;
        }
    }
    $sock->SET_INFO("EnableRemoteSyslogStatsAppliance", $EnableRemoteSyslogStatsAppliance);
    $RemoteSyslogAppliance["SSL"] = $_POST["StatsServerSSL"];
    $RemoteSyslogAppliance["PORT"] = $_POST["StatsServerPort"];
    $RemoteSyslogAppliance["SERVER"] = $_POST["StatsServervame"];
    $sock->SaveConfigFile(base64_encode(serialize($RemoteSyslogAppliance)), "RemoteSyslogAppliance");
    $sock->getFrameWork("cmd.php?syslog-client-mode=yes");
    $sock->getFrameWork("squid.php?compile-schedules-reste=yes");
    $sock->getFrameWork("squid.php?squid-reconfigure=yes");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:37,代码来源:squid.remotestats.php

示例15: compile_ufdbcat

function compile_ufdbcat()
{
    $unix = new unix();
    $uri = "http://www.articatech.net/download/ufdbGuard-1.31.tar.gz";
    $curl = new ccurl("http://www.articatech.net/download/ufdbGuard-1.31.tar.gz");
    echo "Downloading {$uri}\n";
    $tempdir = $unix->TEMP_DIR() . "/ufdb";
    $tempfile = "{$tempdir}/ufdbGuard-1.31.tar.gz";
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    $cp = $unix->find_program("cp");
    if (is_dir($tempdir)) {
        shell_exec("{$rm} -rf {$tempdir}");
    }
    @mkdir($tempdir, 0755, true);
    if (is_file($tempfile)) {
        @unlink($tempfile);
    }
    if (!$curl->GetFile($tempfile)) {
        echo "Fatal, unable to download {$uri}\n";
        meta_admin_mysql(0, "Fatal, unable to download {$uri}", @implode("\n", $curl->errors), __FILE__, __LINE__);
        return;
    }
    if (is_dir("{$tempdir}/ufdbcompile")) {
        shell_exec("{$rm} -rf {$tempdir}/ufdbcompile");
    }
    echo "Uncompressing {$tempdir}/ufdbGuard-1.31.tar.gz to {$tempdir}/\n";
    shell_exec("{$tar} -xf {$tempdir}/ufdbGuard-1.31.tar.gz -C {$tempdir}/");
    $dirs = $unix->dirdir($tempdir);
    while (list($directory, $value) = each($dirs)) {
        echo "Found directory {$directory}\n";
        if (is_file("{$directory}/src/mtserver/ufdbguardd.c")) {
            $WORKDIR = "{$directory}";
            break;
        }
    }
    if (!is_dir($WORKDIR)) {
        echo "Fatal, unable to download {$uri}\n";
        meta_admin_mysql(0, "Fatal, unable to locate working directory", __FILE__, __LINE__);
        if (is_dir($tempdir)) {
            shell_exec("{$rm} -rf {$tempdir}");
        }
        return;
    }
    echo "Patching mtserver/ufdbguardd.c\n";
    $C = explode("\n", @file_get_contents("{$directory}/src/mtserver/ufdbguardd.c"));
    while (list($index, $line) = each($C)) {
        if (strpos($line, "/tmp/ufdbguardd-") > 0) {
            echo "Patching mtserver/ufdbguardd.c line {$index}\n";
            $C[$index] = str_replace("/tmp/ufdbguardd-", "/var/run/ufdbcat-", $line);
        }
    }
    @file_put_contents("{$directory}/src/mtserver/ufdbguardd.c", @implode("\n", $C));
    chdir($WORKDIR);
    if (is_dir("/opt/ufdbcat")) {
        shell_exec("{$rm} -rf /opt/ufdbcat");
    }
    echo "Configure\n";
    $f[] = "./configure";
    $f[] = "--prefix=/opt/ufdbcat";
    $f[] = "--includedir=\"\\\${prefix}/include\"";
    $f[] = "--mandir=\"\\\${prefix}/share/man\"";
    $f[] = "--infodir=\"\\\${prefix}/share/info\"";
    $f[] = "--sysconfdir=/etc/ufdbcat";
    $f[] = "--localstatedir=/opt/ufdbcat";
    $f[] = "--with-ufdb-logdir=/var/log/ufdbcat";
    $f[] = "--with-ufdb-dbhome=/home/ufdbcat";
    $f[] = "--with-ufdb-user=root";
    $f[] = "--with-ufdb-config=/etc/ufdbcat";
    $f[] = "--with-ufdb-logdir=/var/log/ufdbcat";
    $f[] = "--with-ufdb-config=/etc/ufdbcat";
    $f[] = "--with-ufdb-piddir=/var/run/ufdbcat";
    $cmd = @implode(" ", $f);
    system($cmd);
    echo "Make\n";
    system("make");
    echo "Install\n";
    system("make install");
    if (!is_file("/opt/ufdbcat/bin/ufdbguardd")) {
        echo "Fatal, unable to compile ufdbcat\n";
        meta_admin_mysql(0, "Fatal, unable to compile ufdbcat", __FILE__, __LINE__);
        if (is_dir($tempdir)) {
            shell_exec("{$rm} -rf {$tempdir}");
        }
        return;
    }
    @copy("/opt/ufdbcat/bin/ufdbguardd", "/opt/ufdbcat/bin/ufdbcatdd");
    @unlink("/opt/ufdbcat/bin/ufdbguardd");
    @chmod("/opt/ufdbcat/bin/ufdbcatdd", 0755);
    $ufdbcatVersion = ufdbcatVersion();
    $Architecture = Architecture();
    $DebianVersion = DebianVersion();
    $base = "/root/ufdbcat-compile";
    if (is_dir($base)) {
        shell_exec("{$rm} -rf {$base}");
    }
    @mkdir("{$base}/opt/ufdbcat", 0755, true);
    shell_exec("{$cp} -rfp /opt/ufdbcat/* {$base}/opt/ufdbcat/");
    $filename = "ufdbcat-debian{$DebianVersion}-{$Architecture}-{$ufdbcatVersion}.tar.gz";
    chdir($base);
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:compile-squid34.php


注:本文中的ccurl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。