Example #1
0
function crawler()
{
    global $nid;
    $proxyObj = new proxy();
    $mysqli = new mysqli('localhost', 'admin', 'txg19831210', 'crawler');
    $mysqli->query('SET NAMES gbk');
    //for (;;) {
    $hour = date('G');
    $current = time();
    //echo "Id {$id}\n";
    $sql = "SELECT * FROM keyword WHERE id = " . $nid;
    $result = $mysqli->query($sql);
    $data = array();
    if ($result) {
        while ($obj = $result->fetch_object()) {
            $data[] = $obj;
        }
    }
    if (!$data) {
        echo "zz\n";
        //$mysqli->rollback();
        //sleep(60);
        continue;
    }
    foreach ($data as $obj) {
        $kwd = urlencode($obj->kwd);
        $nid = $obj->nid;
        $date = date('Ymd');
        $sleep_time = $obj->sleep_time;
        //$crawler = new crawler($kwd, $nid);
        //$proxy = $crawler->proxy;
        //$ua = $crawler->userAgent;
        //echo $proxy . "\n";
        $ua = 'aa';
        $proxy = $proxyObj->getProxy();
        //echo $proxy . "\n";
        if ($obj->path1_page <= $obj->path2_page) {
            $search_url = 'http://s.taobao.com/search?&initiative_id=tbindexz_' . $date . '&spm=1.7274553.1997520841.1&sourceId=tb.index&search_type=item&ssid=s5-e&commend=all&q=' . $kwd . '&suggest=0_2';
            $search_selector = ".item[nid='" . $nid . "'] h3 a";
            $next_selector = ".page-next";
            $cmd = "/usr/bin/casperjs --output-encoding=gbk --script-encoding=gbk --proxy=" . $proxy . " /var/html/casperjs/pcntl/process_single.js \"" . $search_url . "\" " . " \"" . $search_selector . "\" " . "\"" . $next_selector . "\" " . $sleep_time . " \"" . $ua . "\"";
        } else {
            $search_url = 'http://s.taobao.com/search?spm=a230r.1.0.0.9nMSJu&initiative_id=tbindexz_' . $date . '&tab=mall&q=' . $kwd . '&suggest=0_2';
            $search_selector = ".item[nid='" . $nid . "'] h3 a";
            $next_selector = ".page-next";
            $cmd = "/usr/bin/casperjs --output-encoding=gbk --script-encoding=gbk --proxy=" . $proxy . " /var/html/casperjs/pcntl/process_single.js \"" . $search_url . "\" " . " \"" . $search_selector . "\" " . "\"" . $next_selector . "\" " . $sleep_time . " \"" . $ua . "\"";
        }
        //echo $cmd . "\n";
        system($cmd);
        $sql = "UPDATE keyword SET clicked_times = clicked_times + 1, last_click_time = " . time() . ", run_status = 'free' WHERE id = " . $obj->id;
        $mysqli->query($sql);
    }
    //}
}
Example #2
0
function crawler()
{
    $proxyObj = new proxy();
    $mysqli = new mysqli('10.168.45.191', 'admin', 'txg19831210', 'crawler');
    $mysqli->query('SET NAMES gbk');
    //for (;;) {
    $hour = date('G');
    $current = time();
    //$sql = "SELECT * FROM keyword WHERE status = 'active' AND clicked_times < times AND ((last_click_time + click_interval) < {$current}) AND ((path1_page < 5 AND path1_page > 0) OR (path2_page < 5 AND path2_page > 0)) ORDER BY last_click_time ASC LIMIT 1";
    $sql = "SELECT * FROM keyword WHERE id = 16";
    $result = $mysqli->query($sql);
    $data = array();
    if ($result) {
        $obj = $result->fetch_object();
        $result->close();
    }
    if (!$obj->id) {
        echo "zz\n";
        sleep(1);
        continue;
    } else {
        //$sql = "UPDATE keyword SET last_click_time = {$current} WHERE id = {$obj->id}";
        //$mysqli->query($sql);
    }
    $kwd = urlencode($obj->kwd);
    $nid = $obj->nid;
    $date = date('Ymd');
    $sleep_time = $obj->sleep_time;
    $path1 = (int) $obj->path1;
    $path2 = $path1 + (int) $obj->path2;
    if ($obj->path1_page > 5) {
        $path1 = 0;
        $path2 = 100;
    }
    $ua = 'aa';
    $proxy = $proxyObj->getProxy(true);
    $rand = rand(1, 100);
    //}
}
Example #3
0
<?php

session_start();
require_once "class_get.php";
$get_proxy = new proxy();
header("content-Type: text/html; charset=utf-8");
$link_get = $_POST['link_get'];
$get = $_POST['get'];
$picasa = $_GET['picasa'];
if ($_SESSION['link_film'] && $picasa == 'yes') {
    $count_ep = $_SESSION['total_ep'];
    echo '<textarea rows="20" cols="100">';
    for ($i = 1; $i <= $count_ep; $i++) {
        echo $_SESSION["ep_{$i}"]['ep_name'] . '#' . $_SESSION["ep_{$i}"]['proxy_link'] . '
';
    }
    echo '</textarea>';
    echo '<textarea rows="20" cols="100">';
    for ($i = 1; $i <= $count_ep; $i++) {
        echo $_SESSION["ep_{$i}"]['proxy_link'] . '
';
    }
    echo '</textarea><br/>';
    echo '<a href="index.php">Quay Lại</a>';
    //session_destroy();
} elseif (!$link_get & !$get) {
    ?>
V1VN.Com => http://v1vn.com/xem-phim-online/hanh-thich-nguy-vuong-400517.html <br/>
P/S: Tools Chỉ Lấy Link Picasaweb
<form method="post">
	Lấy Từ Tập: <input type="text" name="stt" value="1" size="1">
Example #4
0
<?php

require_once dirname(__FILE__) . '/class.proxy.php';
$proxy = new proxy();
$proxy->publishProxy(true);
Example #5
0
function detector()
{
    $mysqli = new mysqli('localhost', 'admin', 'txg19831210', 'crawler');
    $mysqli->query('SET NAMES gbk');
    $proxyObj = new proxy();
    $hour = date('G');
    $current = time();
    $sql = "SELECT * FROM keyword WHERE is_detected = 0";
    $result = $mysqli->query($sql);
    $data = array();
    if ($result) {
        while ($obj = $result->fetch_object()) {
            $data[] = $obj;
        }
    }
    if (!$data) {
        echo "zz\n";
        exit("Done\n");
    }
    foreach ($data as $obj) {
        echo $obj->kwd . "\n";
        $kwd = urlencode($obj->kwd);
        $nid = $obj->nid;
        $date = date('Ymd');
        $path1 = (int) $obj->path1;
        $path2 = $path1 + (int) $obj->path2;
        $path3 = $path2 + (int) $obj->path3;
        $sleep_time = $obj->sleep_time;
        $proxy = $proxyObj->getProxy();
        $httpsProxy = $proxyObj->getProxy(true);
        $ua = 'aa';
        //taobao search
        $search_url = 'http://s.taobao.com/search?&initiative_id=tbindexz_' . $date . '&spm=1.7274553.1997520841.1&sourceId=tb.index&search_type=item&ssid=s5-e&commend=all&q=' . $kwd . '&suggest=0_2';
        $search_selector = ".item[nid='" . $nid . "'] h3 a";
        $next_selector = ".page-next";
        $cmd = "/usr/bin/casperjs --output-encoding=gbk --script-encoding=gbk --proxy=" . $proxy . " /var/html/casperjs/detector.js \"" . $search_url . "\" " . " \"" . $search_selector . "\" " . "\"" . $next_selector . "\" " . $sleep_time . " \"" . $ua . "\"";
        $path1_page = system($cmd);
        echo $path1_page . "\n";
        if (!preg_match('/^[0-9]/', $path1_page)) {
            echo "error\n";
        } else {
            $depth = (int) $path1_page + 1;
            $sql = "UPDATE keyword SET path1_page ={$depth} WHERE id = " . $obj->id . " AND (path1_page > {$depth} OR path1_page = -1)";
            $mysqli->query($sql);
        }
        //taobao search tmall tab
        $search_url = 'http://s.taobao.com/search?spm=a230r.1.0.0.9nMSJu&initiative_id=tbindexz_' . $date . '&tab=mall&q=' . $kwd . '&suggest=0_2';
        $search_selector = ".item[nid='" . $nid . "'] h3 a";
        $next_selector = ".page-next";
        $cmd = "/usr/bin/casperjs --output-encoding=gbk --script-encoding=gbk --proxy=" . $proxy . " /var/html/casperjs/detector.js \"" . $search_url . "\" " . " \"" . $search_selector . "\" " . "\"" . $next_selector . "\" " . $sleep_time . " \"" . $ua . "\"";
        $path2_page = system($cmd);
        echo $path2_page . "\n";
        if (!preg_match('/^[0-9]/', $path2_page)) {
            echo "error\n";
        } else {
            $depth = (int) $path2_page + 1;
            $sql = "UPDATE keyword SET path2_page ={$depth} WHERE id = " . $obj->id . " AND (path2_page > {$depth} OR path2_page = -1)";
            $mysqli->query($sql);
        }
        //tmall search
        $search_url = 'http://list.tmall.com/search_product.htm?q=' . $kwd . '&type=p&vmarket=&spm=3.7396704.a2227oh.d100&from=mallfp..pc_1_searchbutton';
        $search_selector = ".product[data-id=' " . $nid . "'] div .productTitle a";
        $next_selector = "a.ui-page-s-next";
        $cmd = "/usr/bin/casperjs /var/html/casperjs/detector.js --ignore-ssl-errors=true --proxy=" . $httpsProxy . " --output-encoding=gbk --script-encoding=gbk \"" . $search_url . "\" " . " \"" . $search_selector . "\" " . "\"" . $next_selector . "\" " . $sleep_time . " \"" . $ua . "\"";
        $path3_page = system($cmd);
        echo $path3_page . "\n";
        if (!preg_match('/^[0-9]/', $path3_page)) {
            echo "error\n";
        } else {
            $depth = (int) $path3_page + 1;
            $sql = "UPDATE keyword SET path3_page ={$depth} WHERE id = " . $obj->id . " AND (path3_page > {$depth} OR path3_page = -1)";
            $mysqli->query($sql);
        }
        $sql = "UPDATE keyword SET is_detected = 1 WHERE id = " . $obj->id;
        $mysqli->query($sql);
    }
}
Example #6
0
function crawler()
{
    $proxyObj = new proxy();
    $mysqli = new mysqli('10.168.45.191', 'admin', 'txg19831210', 'crawler');
    $mysqli->query('SET NAMES gbk');
    //for (;;) {
    $hour = date('G');
    $current = time();
    //$sql = "SELECT * FROM keyword WHERE status = 'active' AND clicked_times < times AND ((last_click_time + click_interval) < {$current}) AND ((path1_page < 5 AND path1_page > 0) OR (path2_page < 5 AND path2_page > 0) OR (path3_page < 5 AND path3_page > 0)) ORDER BY last_click_time ASC LIMIT 1";
    $sql = "SELECT * FROM keyword WHERE id = 13 LIMIT 1";
    $result = $mysqli->query($sql);
    $data = array();
    if ($result) {
        $obj = $result->fetch_object();
        $result->close();
    }
    if (!$obj || !$obj->id) {
        echo "zz\n";
        sleep(1);
        continue;
    } else {
        $kwd = urlencode($obj->kwd);
        $nid = $obj->nid;
        $date = date('Ymd');
        $sleep_time = $obj->sleep_time;
        $path1 = (int) $obj->path1;
        $path2 = $path1 + (int) $obj->path2;
        $path3 = $path2 + (int) $obj->path3;
        $ua = 'aa';
        $keyword = new keyword();
        $rand = rand(1, 100);
        $rand = 5;
        if ($rand <= $path1) {
            //taobao search
            $data = array('path' => 'taobao', 'kwd' => $kwd, 'date' => $date, 'region' => $obj->path1_region, 'price_from' => $obj->path1_price_from, 'price_to' => $obj->path1_price_to);
            $search_url = $keyword->buildSearchUrl($data);
            echo $search_url . "\n";
            exit;
            if ($obj->path1_page >= 5) {
                continue;
            }
            //$proxy = $proxyObj->getProxy();
            //$search_url = 'http://s.taobao.com/search?&initiative_id=tbindexz_'.$date.'&spm=1.7274553.1997520841.1&sourceId=tb.index&search_type=item&ssid=s5-e&commend=all&q='.$kwd.'&suggest=0_2';
            $search_selector = ".item[nid='" . $nid . "'] h3 a";
            $next_selector = ".page-next";
            $cmd = "/usr/bin/casperjs --output-encoding=gbk --script-encoding=gbk --proxy=" . $proxy . " /var/html/casperjs/pcntl/process.js \"" . $search_url . "\" " . " \"" . $search_selector . "\" " . "\"" . $next_selector . "\" " . $sleep_time . " \"" . $ua . "\"";
        } elseif ($rand <= $path2) {
            //taobao search tmall tab
            if ($obj->path2_page >= 5) {
                continue;
            }
            $proxy = $proxyObj->getProxy();
            $search_url = 'http://s.taobao.com/search?spm=a230r.1.0.0.9nMSJu&initiative_id=tbindexz_' . $date . '&tab=mall&q=' . $kwd . '&suggest=0_2';
            $search_selector = ".item[nid='" . $nid . "'] h3 a";
            $next_selector = ".page-next";
            $cmd = "/usr/bin/casperjs --output-encoding=gbk --script-encoding=gbk --proxy=" . $proxy . " /var/html/casperjs/pcntl/process.js \"" . $search_url . "\" " . " \"" . $search_selector . "\" " . "\"" . $next_selector . "\" " . $sleep_time . " \"" . $ua . "\"";
        } else {
            //tmall search
            if ($obj->path3_page >= 5) {
                continue;
            }
            $proxy = $proxyObj->getProxy(true);
            $search_url = 'http://list.tmall.com/search_product.htm?q=' . $kwd . '&type=p&vmarket=&spm=3.7396704.a2227oh.d100&from=mallfp..pc_1_searchbutton';
            $search_selector = ".product[data-id=' " . $nid . "'] div .productTitle a";
            $next_selector = "a.ui-page-s-next";
            $cmd = "/usr/bin/casperjs /var/html/casperjs/pcntl/process.js --ignore-ssl-errors=true --proxy=" . $proxy . " --output-encoding=gbk --script-encoding=gbk \"" . $search_url . "\" " . " \"" . $search_selector . "\" " . "\"" . $next_selector . "\" " . $sleep_time . " \"" . $ua . "\"";
        }
        $sql = "UPDATE keyword SET last_click_time = {$current} WHERE id = {$obj->id}";
        $mysqli->query($sql);
    }
    echo $cmd . "\n";
    system($cmd);
    $sql = "UPDATE keyword SET clicked_times = clicked_times + 1 WHERE id = " . $obj->id;
    $mysqli->query($sql);
    //}
}
Example #7
0
function search($request)
{
    global $useragent;
    $q = str_replace("//", "/", $request["q"]);
    if (!isset($request["action"]) || $request["action"] == "") {
        $request["action"] = "hot";
    }
    $sub = "";
    if (isset($request["action"])) {
        switch ($request["action"]) {
            case "new":
                $sub = "/new";
                break;
            case "rising":
                $sub = "/rising";
                break;
            case "controversial":
                $sub = "/controversial";
                break;
            case "top":
                $sub = "/top";
                break;
            case "gilded":
                $sub = "/gilded";
                break;
            case "promoted":
                $sub = "/promoted";
                break;
            case "wiki":
                $sub = "/wiki";
                break;
            default:
                $sub = "/hot";
                break;
        }
    }
    $page = isset($request["page"]) && $request["page"] > 0 ? $request["page"] : 1;
    $pages = array();
    $count = 0;
    $chapter = $_SESSION["chapter"];
    $anchor = "";
    $_SESSION["page"] = $page;
    $back = $page > 1 ? true : false;
    $curchapter = ($page - 1 - ($page - 1) % 10) / 10 + 1;
    if ($curchapter > $chapter && !isset($_SESSION["chapterbuffer"][$curchapter])) {
        $count = $curchapter * 100;
        $anchor = "&after=" . $_SESSION["after"];
    }
    if (isset($_SESSION["chapterbuffer"][$curchapter])) {
        $_SESSION["chapterdata"] = $_SESSION["chapterbuffer"][$curchapter][0];
        $_SESSION["before"] = $_SESSION["chapterbuffer"][$curchapter][1];
        $_SESSION["after"] = $_SESSION["chapterbuffer"][$curchapter][2];
    }
    //LOAD CURRENT CHAPTER
    if (!isset($_SESSION["chapterbuffer"][$curchapter]) || $q == "/r/random" || $q != $_SESSION["query"] || $request["action"] != $_SESSION["action"]) {
        $_SESSION["chapterbuffer"] = array();
        $_SESSION["action"] = $request["action"];
        $urls = array("www.reddit.com/" . trim($q, "/") . $sub . ".json?limit=100&count=" . $count . $anchor, "www.reddit.com/search.json?q=" . urlencode($q) . "&limit=100&count=" . $count . $anchor);
        $data = HTMLrequest($urls);
        if ($q == "/r/random") {
            $q = "/r/" . $data->data->children[0]->data->subreddit;
        }
        $_SESSION["query"] = $q;
        @($_SESSION["chapterdata"] = $data->data->children);
        @($_SESSION["before"] = $data->data->before);
        @($_SESSION["after"] = $data->data->after);
        $_SESSION["chapter"] = $curchapter;
        $_SESSION["chapterbuffer"][$curchapter] = array($_SESSION["chapterdata"], $_SESSION["before"], $_SESSION["after"]);
    }
    //LOAD NEXT CHAPTER
    if ($_SESSION["after"] != "" && !isset($_SESSION["chapterbuffer"][$curchapter + 1])) {
        $count = $curchapter * 100;
        $anchor = "&after=" . $_SESSION["after"];
        $urls = array("www.reddit.com/" . $q . $sub . ".json?limit=100&count=" . $count . $anchor, "www.reddit.com/search.json?q=" . urlencode($q) . "&limit=100&count=" . $count . $anchor);
        $data = HTMLrequest($urls);
        $_SESSION["chapterbuffer"][$curchapter + 1] = array($data->data->children, $data->data->before, $data->data->after);
    }
    $results = array();
    $start = ($page - 1) % 10 * 10;
    for ($i = $start; $i < $start + 10; $i++) {
        if (isset($_SESSION["chapterdata"][$i])) {
            $entry = $_SESSION["chapterdata"][$i];
        } else {
            break;
        }
        $result = array();
        $result["strTitel"] = isset($entry->data->title) ? $entry->data->title : $entry->data->link_title;
        $result["strTitel"] = substr($result["strTitel"], 0, 130);
        if (!isset($entry->data->is_self) || $entry->data->is_self == 1) {
            if (isset($entry->data->link_id)) {
                $buffer = $entry->data->link_id;
                $buff = explode("_", $buffer);
                if (count($buff) == 2) {
                    $buffer = $buff[1];
                }
            } else {
                $buffer = $entry->data->id;
            }
            $result["strLink"] = "index.php?action=groups&comment=" . $buffer;
        } else {
            require_once "proxy.inc.php";
            $whitelist = array("imgur.com", "reddit.com", "puu.sh", "gfycat.com");
            $proxy = new proxy();
            $parse = $proxy->parseUrl($entry->data->url, $whitelist);
            $parse = in_array($parse[2], $whitelist);
            if ($parse !== false && isset($request["enableproxy"]) && $request["enableproxy"] == "true") {
                $result["strLink"] = "http://proxy.cluffle.com/index.php?url=" . $entry->data->url;
            } else {
                $result["strLink"] = $entry->data->url;
            }
        }
        if (isset($entry->data->num_comments) && $entry->data->num_comments != "") {
            $result["numComments"] = $entry->data->num_comments;
        } else {
            $result["numComments"] = "[unknown]";
        }
        $result["strComment"] = $entry->data->id;
        $result["strDomain"] = "/r/" . $entry->data->subreddit;
        if (isset($entry->data->selftext_html) && $entry->data->selftext_html != "") {
            $buffer = $entry->data->selftext_html;
        } else {
            if (isset($entry->data->body_html) && $entry->data->body_html != "") {
                $buffer = $entry->data->body_html;
            } else {
                if (isset($entry->data->selftext) && $entry->data->selftext != "") {
                    $buffer = $entry->data->selftext;
                } else {
                    if (isset($entry->data->body) && $entry->data->body != "") {
                        $buffer = $entry->data->body;
                    } else {
                        $buffer = "";
                    }
                }
            }
        }
        $result["nsfw"] = isset($entry->data->over_18) && (bool) $entry->data->over_18;
        $result["strBeschreibung"] = strip_tags(htmlspecialchars_decode($buffer), '<a>');
        if ($result["strBeschreibung"] == "") {
            $result["strCreated"] = time_passed($entry->data->created_utc);
        } else {
            $result["strCreated"] = time_passed($entry->data->created_utc) . " - ";
        }
        $results[] = $result;
    }
    $maxchap = count($_SESSION["chapterbuffer"]);
    $maxpage = ceil(count($_SESSION["chapterbuffer"][$maxchap][0]) / 10);
    $maxpage = ($maxchap - 1) * 10 + $maxpage;
    $pagelinks = array();
    $start = $page - 6 <= 0 ? 1 : $page - 5;
    $pagenumbers = "";
    for ($i = $page - 6 <= 0 ? 1 : $page - 5; $i < $page; $i++) {
        $curpage = array();
        $curpage["link"] = 'index.php?q=' . $q . '&page=' . $i;
        $curpage["number"] = $i;
        $curpage["current"] = 0;
        $pagelinks[] = $curpage;
    }
    $curpage = array();
    $curpage["link"] = '#';
    $curpage["number"] = $i;
    $curpage["current"] = 1;
    $pagelinks[] = $curpage;
    $forward = false;
    for ($i++; $i <= ($start + 9 <= $maxpage ? $start + 9 : $maxpage); $i++) {
        $curpage["link"] = 'index.php?q=' . $q . '&page=' . $i;
        $curpage["number"] = $i;
        $curpage["current"] = 0;
        $pagelinks[] = $curpage;
        $forward = true;
    }
    $shownav = $maxpage > 1;
    $backlink = 'index.php?q=' . $q . '&page=' . ($page - 1);
    $forwardlink = 'index.php?q=' . $q . '&page=' . ($page + 1);
    $resultstats = "About 2,630,000,000 results (0.26 seconds)";
    if (empty($results)) {
        $resultstats = "These aren't the results you are looking for. 404.";
    }
    $resultcount = count($results);
    $buffer = $request;
    if (!isset($request["enableproxy"]) || $request["enableproxy"] != "true") {
        $request["enableproxy"] = "";
        $buffer["enableproxy"] = "true";
        $buffertext = "Enable Proxy";
    } else {
        $buffer["enableproxy"] = "";
        $buffertext = "Disable Proxy";
    }
    $buffer = array_filter($buffer);
    $query = '<a href="index.php?' . http_build_query($buffer) . '">' . $buffertext . '</a>';
    $display = array();
    $display["results"] = $results;
    $display["resultstats"] = $resultstats;
    $display["resultcount"] = count($results);
    $display["query"] = $q;
    $display["back"] = $back;
    $display["forward"] = $forward;
    $display["backlink"] = $backlink;
    $display["forwardlink"] = $forwardlink;
    $display["pagelinks"] = $pagelinks;
    $display["sub"] = $sub;
    $display["showNav"] = $shownav;
    $display["proxyquery"] = $query;
    $display["request"] = $request;
    searchpage($display);
}
Example #8
0
 protected function proceed_proxy($argv, $argc)
 {
     if ($argc < 3) {
         $this->usage();
     }
     switch ($argv[2]) {
         case 'start':
             proxy::start();
             break;
         case 'stop':
             proxy::stop();
             break;
         case 'restart':
             proxy::restart();
             break;
         case 'status':
             proxy::status();
             break;
         default:
             $this->usage();
             break;
     }
 }
Example #9
0
    {
        echo $msg;
    }
}
class proxy extends source
{
    private $instance;
    public function __construct()
    {
        $this->instance = new parent();
    }
    public function showMsg($msg)
    {
        self::before();
        $this->instance->showMsg($msg);
        self::after();
    }
    public function before()
    {
        echo "<pre>";
    }
    public function after()
    {
        echo "</pre>";
    }
}
//------------------------------
//测试
//-----------------------------
$px = new proxy();
$px->showMsg("test");
Example #10
0
                $buffer .= ' */' . PHP_EOL . PHP_EOL;
                // dump the asset
                $buffer .= $asset->dump($defaultFilters);
                $cachedAsset = new StringAsset($buffer, [], $asset->getSourceRoot(), $asset->getSourcePath());
                $cachedAsset->setTargetPath($asset->getTargetPath());
                $cachedAsset->setLastModified($asset->getLastModified());
                $cachedAsset->load();
                $session->cache = $cachedAsset;
                $_SESSION['THEME_PLUS_ASSETS'][$id] = serialize($session);
                // update advanced asset cache meta
                if (!$GLOBALS['TL_CONFIG']['theme_plus_disabled_advanced_asset_caching']) {
                    /** @var Cache $cache */
                    $cache = $GLOBALS['container']['theme-plus-assets-cache'];
                    $latestTimestamp = $cache->fetch(ThemePlus::CACHE_LATEST_ASSET_TIMESTAMP);
                    if (!$latestTimestamp || $latestTimestamp < $asset->getLastModified()) {
                        $cache->save(ThemePlus::CACHE_LATEST_ASSET_TIMESTAMP, $asset->getLastModified());
                    }
                }
                echo $buffer;
                ob_flush();
                return;
            }
        }
        header('HTTP/1.1 403 Forbidden');
        header('Status: 403 Forbidden');
        header('Content-Type: text/plain; charset=UTF-8');
        echo '403 Forbidden';
    }
}
$proxy = new proxy();
$proxy->run();
Example #11
0
}
session_name(SESSION_KEY);
session_set_cookie_params(0, "/", "." . $_CONFIG["proxy_basename"]);
session_start();
unset($_COOKIE[SESSION_KEY]);
/* Bootstrap
 */
$bootstrap = new bootstrap($_CONFIG);
$result = $bootstrap->execute();
if ($result == 0) {
    /* Start proxy
     */
    if ($_SERVER["HTTPS"] == "on") {
        $proxy = new proxys($_CONFIG, $bootstrap->hostname, $_SERVER["SERVER_PORT"]);
    } else {
        $proxy = new proxy($_CONFIG, $bootstrap->hostname, $_SERVER["SERVER_PORT"]);
    }
    /* Other proxy
     */
    if ($_CONFIG["forwarding_proxy"] != null) {
        list($protocol, $hostname, $port) = explode(":", $_CONFIG["forwarding_proxy"], 3);
        $hostname = trim($hostname, "/");
        $port = trim($port, "/");
        if ($hostname != "" && $port != "") {
            switch ($protocol) {
                case "http":
                    $proxy->via_http_proxy($hostname, $port);
                    break;
                case "https":
                    $proxy->via_http_proxy($hostname, $port, true);
                    break;
Example #12
0
<?php

require_once dirname(__FILE__) . '/class.proxy.php';
$proxy = new proxy();
$proxy->publishProxy();