function hive_check($hive_host,$hive_port,$hive_send_timeout,$hive_recv_timeout) { $shell_ret=0; try{ $transport = new TSocket($hive_host,$hive_port); $transport->setSendTimeout($hive_send_timeout); $transport->setRecvTimeout($hive_recv_timeout); $protocol = new TBinaryProtocol($transport); $client = new ThriftHiveClient($protocol); $transport->open(); $client->execute('show databases'); //var_dump($client->fetchAll()); }catch(Exception $e){ $shell_ret=1; } $transport->close(); return $shell_ret; }
while (FALSE !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $arr[$i] = $file; $i++; } } closedir($handle); } $transport = new TSocket($ip, 30050); $protocol = new TBinaryProtocol($transport); #$client = new EasyHadoopClient($protocol); $transport->open(); $install->MakeDir($protocol); foreach ($arr as $key => $value) { $filename = "/home/hadoop/" . $value; $fp = fopen("./hadoop/" . $value, "rb"); while (!feof($fp)) { $content .= fread($fp, 1024); } fclose($fp); $str = $install->PushFile($filename, $content, $protocol); unset($content); sleep(1); } $transport->close(); echo "<script>alert('" . $lang['pushComplete'] . "'); this.location='InstallManager.php?action=Install&ip=" . $ip . "';</script>"; } } else { die($lang['unknownCommand']); } include_once "templates/footer.html";
public function download($link, $logLink = null, $logFilename = "", Serie $Serie = null) { if (strpos($link, "linksafe.")) { $newLocation = get_headers($link, 1); $links = $newLocation["Location"]; $link = null; if (is_array($links)) { foreach ($links as $k => $l) { if (stripos($l, "https") === 0) { $link = $links[$k]; } } if ($link == null) { $link = $links[0]; } } else { $link = $links; } } if (strpos($link, "safeurl.")) { $newLocation = get_headers($link, 1); if (isset($newLocation["Location"])) { $link = $newLocation["Location"][0]; } else { $contentWithLink = file_get_contents($link); preg_match_all("/(https:\\/\\/rapidshare[a-zA-Z0-9\\.\\-\\/_#+\\|!]*)/", $contentWithLink, $links); $links = array_unique($links[1]); $link = $links[0]; $ex = explode("|", $link); $ex[0] = str_replace("/#!download", "/files/", $ex[0]); $link = $ex[0] . $ex[2] . "/" . $ex[3]; } } if (strpos($link, "canhaz.")) { $newLocation = get_headers($link, 1); $link = $newLocation["Location"]; $contentWithLink = file_get_contents($link); preg_match_all("/(http:\\/\\/rapidshare[a-zA-Z0-9\\.\\-\\/_#+]*)/", $contentWithLink, $links); $links = array_unique($links[1]); $link = $links[0]; } $linkOld = $link; if ($this->A("JDLinkParser") != "") { $C = $this->A("JDLinkParser"); $C = new $C(); $link = $C->parse($link, $this->A("JDLinkParserUser"), $this->A("JDLinkParserPassword")); } if ($this->A("JDDLType") == "4") { if ($logFilename == "") { $info = get_headers($link, 1); if ($info !== false) { preg_match("/filename=\"(.*)\"/ismU", $info["Content-Disposition"], $matches); if (isset($matches[1])) { $logFilename = $matches[1]; } } } if ($logFilename == "") { $logFilename = basename($link); } $DL = anyC::getFirst("Incoming", "IncomingUseForDownloads", "1"); $size = $this->filesize($link); if ($size < 10 * 1024 * 1024) { throw new Exception("File size too small"); } $id = $this->logDownload($logLink, $linkOld, $logFilename, $size, $Serie, true); file_put_contents($this->A("JDWgetFilesDir") . "/{$id}.temp", "-o wgetDL_" . str_pad($id, 5, "0", STR_PAD_LEFT) . ".log -O " . rtrim($DL->A("IncomingDir"), "/") . "/" . str_replace(" ", ".", basename($logFilename)) . "." . Util::ext($link) . " {$link}"); rename($this->A("JDWgetFilesDir") . "/{$id}.temp", $this->A("JDWgetFilesDir") . "/{$id}.dl"); chmod($this->A("JDWgetFilesDir") . "/{$id}.dl", 0666); return true; } if ($this->A("JDDLType") == "0") { Util::PostToHost($this->A("JDHost"), $this->A("JDPort"), "/link_adder.tmpl", "none", "do=Add&addlinks=" . urlencode($link), $this->A("JDUser"), $this->A("JDPassword")); } if ($this->A("JDDLType") == "1") { $xml = Util::PostToHost($this->A("JDHost"), $this->A("JDPort"), "/cgi-bin/Qdownload/DS_Login.cgi", "none", "user="******"JDUser") . "&pwd=" . urlencode(base64_encode($this->A("JDPassword"))) . "&admin=1"); $xml = new SimpleXMLElement(substr($xml, strpos($xml, "<?xml "))); $data = Util::PostToHost($this->A("JDHost"), $this->A("JDPort"), "/cgi-bin/Qdownload/DS_Task_Option.cgi", "none", "url=" . urlencode($link) . "&todo=add_rs&type=http_ftp&acc_id=1&user=&pwd=&sid=" . $xml->authSid . "&ver=2.0"); $xml = new SimpleXMLElement(substr($data, strpos($data, "<?xml "))); if ($xml->Result . "" == "success") { $this->logDownload($logLink, $link, $logFilename, 0, $Serie); } } if ($this->A("JDDLType") == "2") { $content = file_get_contents("http://" . $this->A("JDHost") . ":" . $this->A("JDPort") . "/action/add/links/grabber0/start1/{$link}"); if (strpos($content, "Link(s) added. (\"{$link}\"") !== false and $logLink != null) { $this->logDownload($logLink, $link, $logFilename, 0, $Serie); } } if ($this->A("JDDLType") == "3") { $GLOBALS['THRIFT_ROOT'] = Util::getRootPath() . "ubiquitous/Thrift"; require_once $GLOBALS['THRIFT_ROOT'] . '/Thrift.php'; require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TTransport.php'; require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TSocket.php'; require_once $GLOBALS['THRIFT_ROOT'] . '/protocol/TBinaryProtocol.php'; require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TFramedTransport.php'; require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TBufferedTransport.php'; require_once $GLOBALS['THRIFT_ROOT'] . '/packages/pyload/Pyload.php'; require_once $GLOBALS['THRIFT_ROOT'] . '/packages/pyload/pyload_types.php'; $transport = new TSocket($this->A("JDHost"), $this->A("JDPort") * 1); $transport->open(); $protocol = new TBinaryProtocol($transport); $client = new PyloadClient($protocol); $client->login($this->A("JDUser"), $this->A("JDPassword")); #echo $client->getServerVersion(); #echo "<br />"; $client->addPackage("trinityDB", array($link), 1); #Print 'result = ' . $result; $transport->close(); } }