示例#1
0
 }
 if (isset($parsedOptions["request-interval"]) && $parsedOptions["request-interval"] > 0) {
     $httpAdapter->setRequestInterval($parsedOptions["request-interval"]);
 }
 if (isset($parsedOptions["log-prepend-date"])) {
     $logger->useLogDate($parsedOptions["log-prepend-date"]);
 }
 //Check if youre bored and you just want to rule the world (?)
 /////////////////////////////////////////////////////////////////
 if (in_array("google", array_keys($parsedOptions))) {
     $google = new GoogleSearch($httpAdapter, $logger);
     $google->setQuery($parsedOptions["google"]);
     isset($parsedOptions["google-language"]) ? $google->setLanguage($parsedOptions["google-language"]) : NULL;
     $offset = isset($parsedOptions["google-offset"]) ? $parsedOptions["google-offset"] : 0;
     $userTotal = isset($parsedOptions["google-max-results"]) ? $parsedOptions["google-max-results"] : 0;
     $sites = googleSearch($google, $offset, $userTotal);
     if (isset($parsedOptions["google-shuffle-sites"])) {
         shuffle($sites);
     }
 }
 if (isset($parsedOptions["omit-sites"])) {
     filterSites($sites, $logger, $parsedOptions["omit-sites"]);
 }
 $logger->setPrepend("");
 //Check if url vars where passed,if not, we crawl the url
 /////////////////////////////////////////////////////////////////
 if (!in_array("urlvars", array_keys($parsedOptions))) {
     $logger->setPrepend("[Crawler]");
     $httpAdapter->setMethod($parsedOptions["http-method"]);
     if (!sizeof($sites)) {
         $logger->log("No sites :(!", 1, "red");
         } else {
             if ($field["Name"]) {
                 $name = $field["Name"];
                 $name .= isset($config["googleaddword"]) ? $config["googleaddword"] : " (Фильм OR Постер OR DVD OR movie OR VHS OR Poster OR Film)";
                 $res = googleSearch($name);
                 foreach ($res as $value) {
                     if ($value["h"] / $value["w"] > 1.3) {
                         $googleresults[] = $value;
                         $sortarray[] = $value['w'] * $value['h'];
                     }
                 }
             }
             if ($field["OriginalName"]) {
                 $name = $field["OriginalName"];
                 $name .= isset($config["googleaddword"]) ? $config["googleaddword"] : " (Фильм OR Постер OR DVD OR movie OR VHS OR Poster OR Film)";
                 $res = googleSearch($name);
                 foreach ($res as $value) {
                     if ($value["h"] / $value["w"] > 1.3) {
                         $googleresults[] = $value;
                         $sortarray[] = $value['w'] * $value['h'];
                     }
                 }
             }
         }
         array_multisort($sortarray, SORT_DESC, $googleresults);
         $_RESULT = $googleresults;
     }
     break;
 case "setimage":
     $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : null;
     $num = isset($_REQUEST['num']) ? addslashes($_REQUEST['num']) : null;