• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ccurl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: config

function config($servername)
{
    $GLOBALS["SERVICE_NAME"] = "Wordpress {$servername}";
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".{$servername}.pid";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        build_progress("{$servername} Already executed", 110);
        die;
    }
    @file_put_contents($pidfile, getmypid());
    $q = new mysql();
    $cp = $unix->find_program("cp");
    $sock = new sockets();
    $Salts = null;
    $DB_HOST = $q->mysql_server;
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: MySQL host: {$DB_HOST}\n";
    }
    if ($q->mysql_server == "127.0.0.1" or $q->mysql_server == "localhost" or $q->mysql_server == "localhost:") {
        if ($q->SocketPath == null) {
            $q->SocketPath = "/var/run/mysqld/mysqld.sock";
        }
        $DB_HOST = "localhost:{$q->SocketPath}";
    }
    if (!is_file("/usr/share/artica-postfix/bin/wp-cli.phar")) {
        build_progress("wp-cli.phar: no such binary", 110);
        return;
    }
    @chmod("/usr/share/artica-postfix/bin/wp-cli.phar", 0755);
    build_progress("{$servername}: {testing_configuration}", 40);
    $free = new freeweb($servername);
    $WORKING_DIRECTORY = $free->www_dir;
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: Directory: {$WORKING_DIRECTORY}\n";
    }
    @unlink("{$WORKING_DIRECTORY}/wp-config.php");
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: Duplicate: {$free->groupware_duplicate}\n";
    }
    if ($free->groupware_duplicate != null) {
        build_progress("{$servername}: {duplicate} {from} {$free->groupware_duplicate}", 40);
        if (!duplicate_wordpress($servername)) {
            build_progress("{$servername}: {installing} {failed}...", 110);
            apache_admin_mysql(0, "Failed to duplicate {$servername} from {$free->groupware_duplicate}", null, __FILE__, __LINE__);
            return;
        }
        apache_admin_mysql(2, "Success duplicate {$servername} from {$free->groupware_duplicate}", null, __FILE__, __LINE__);
        $free = new freeweb($servername);
    } else {
        if (!scan($WORKING_DIRECTORY)) {
            build_progress("{$servername}: {installing}...", 42);
            @mkdir($WORKING_DIRECTORY);
            shell_exec("{$cp} -rf /usr/share/wordpress-src/* {$WORKING_DIRECTORY}/");
            if (!scan($WORKING_DIRECTORY)) {
                apache_admin_mysql(0, "Failed to install {$servername} from /usr/share/wordpress-src", null, __FILE__, __LINE__);
                build_progress("{$servername}: {installing} {failed}...", 110);
                return;
            }
            apache_admin_mysql(2, "Success to install {$servername} from /usr/share/wordpress-src", null, __FILE__, __LINE__);
        }
    }
    $wordpressDB = $free->mysql_database;
    if ($wordpressDB == null) {
        $wordpressDB = $free->CreateDatabaseName();
        $free->mysql_database = $wordpressDB;
        $free->CreateSite(true);
    }
    $WordPressDBPass = $free->mysql_password;
    $DB_USER = $free->mysql_username;
    if ($DB_USER == "wordpress") {
        $DB_USER = null;
    }
    if ($DB_USER == null) {
        $DB_USER = "WP" . time();
        $free->mysql_username = $DB_USER;
        $free->CreateSite(true);
    }
    if ($WordPressDBPass == null) {
        $WordPressDBPass = md5(time());
        $free->mysql_password = $WordPressDBPass;
        $free->CreateSite(true);
    }
    $DB_PASSWORD = $WordPressDBPass;
    if (is_file("{$WORKING_DIRECTORY}/salts.php")) {
        $Salts = @file_get_contents("{$WORKING_DIRECTORY}/salts.php");
    }
    if ($Salts == null) {
        $TMP = $unix->FILE_TEMP();
        build_progress("{$servername}: Acquiring Salts...", 44);
        $curl = new ccurl("https://api.wordpress.org/secret-key/1.1/salt/");
        if (!$curl->GetFile("{$TMP}")) {
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: Unable to download salts !!\n";
            }
            build_progress("{$servername}: Acquiring Salts {failed}...", 110);
            return;
        }
        $ASASLT = false;
        $fa = explode("\n", @file_get_contents($TMP));
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:exec.wordpress.php


示例17: update

function update()
{
    $unix = new unix();
    $sock = new sockets();
    $filetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    if ($GLOBALS["VERBOSE"]) {
        echo "filetime = {$filetime}\n";
        echo "pidfile = {$pidfile}\n";
    }
    $EnableSpamhausDROPList = $sock->GET_INFO("EnableSpamhausDROPList");
    if (!is_numeric($EnableSpamhausDROPList)) {
        $EnableSpamhausDROPList = 0;
    }
    if (!$GLOBALS["FORCE"]) {
        if (!$GLOBALS["VERBOSE"]) {
            $pid = $unix->get_pid_from_file($pidfile);
            if ($unix->process_exists($pid)) {
                if ($GLOBALS["VERBOSE"]) {
                    echo "{$pid} already running !!!\n";
                }
                return;
            }
        }
    }
    @file_put_contents($pidfile, getmypid());
    if (!$GLOBALS["FORCE"]) {
        $time = $unix->file_time_min($filetime);
        if ($time < 1440) {
            if ($GLOBALS["VERBOSE"]) {
                echo "{$time}Mn !!!\n";
            }
            return;
        }
        @unlink($filetime);
        @file_put_contents($filetime, time());
    }
    $iptables = new iptables_chains();
    $curl = new ccurl("http://www.spamhaus.org/drop/drop.lasso");
    $curl->NoHTTP_POST = true;
    $tmpdir = $unix->TEMP_DIR();
    $destination = "{$tmpdir}/drop.lasso";
    if (!$curl->get()) {
        system_admin_events("Spamhaus DROP List failed {$curl->error}");
        return;
    }
    $drop = explode("\n", $curl->data);
    foreach ($drop as $line) {
        $line = trim($line);
        if (!empty($line) && substr($line, 0, 1) !== ';') {
            list($cidr, $sbl) = explode(" ; ", $line);
            $cidr = trim($cidr);
            $sbl = trim($sbl);
            //echo "iptables -A input -s $cidr -d 0/0 -j REJECT\n";
            //echo "iptables -A output -s 0/0 -d $cidr -j REJECT\n";
            $array[$cidr] = $sbl;
        }
    }
    $q = new mysql();
    $prefix = "INSERT IGNORE INTO iptables(\n\tservice,\n\tservername,\n\tserverip,\n\tlocal_port,\n\tdisable,\n\tevents_number,\n\trule_string,\n\trulemd5,\n\tflux,\n\tevents_block,\n\tdate_created,\n\tmultiples_ports,allow ) VALUES ";
    $date = date("Y-m-d H:i:s");
    while (list($cidr, $sbl) = each($array)) {
        $rulemd5 = md5("{$cidr}{$sbl}");
        $f[] = "('SpamHaus',\n\t\t'{$cidr}',\n\t\t'{$cidr}',\n\t\t'0',\n\t\t'0',\n\t\t'0',\n\t\t'iptables -A input -s {$cidr} -d 0/0 -j REJECT',\n\t\t'{$rulemd5}','INPUT',\n\t\t'Spamhaus DROP List',\n\t\t'{$date}',\n\t\t'0',0)";
    }
    if (count($f) > 0) {
        echo count($f) . " rules added";
        $q->QUERY_SQL("DELETE FROM iptables WHERE `service`='SpamHaus' AND `allow`=0", "artica_backup");
        $q->QUERY_SQL($prefix . @implode($f, ","), "artica_backup");
    }
    $php = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    $cmd = "{$nohup} {$php} /usr/share/artica-postfix/exec.postfix.iptables.php --spamhaus >/dev/null 2>&1 &";
    echo $cmd . "\n";
    shell_exec($cmd);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:76,代码来源:exec.spamhausdrop.php


示例18: notify_remote_proxys

function notify_remote_proxys()
{
    include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
    $q = new mysql_squid_builder();
    $sql = "SELECT * FROM squidservers";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $server = $ligne["ipaddr"];
        $port = $ligne["port"];
        if (!is_numeric($port)) {
            continue;
        }
        $refix = "https";
        $uri = "{$refix}://{$server}:{$port}/squid.stats.listener.php";
        writelogs($uri, __FUNCTION__, __FILE__, __LINE__);
        $curl = new ccurl($ur 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP check类代码示例发布时间:2022-05-23
下一篇:
PHP cc_validation类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap