예제 #1
0
 if (!function_exists('preg_match_all')) {
     $jResult .= "noty(theUILang.PCRENotFound,'error');";
     $jResult .= "theWebUI.systemInfo.rTorrent = { started: false, iVersion : 0, version : '?', libVersion : '?' };\n";
 } else {
     $remoteRequests = array();
     $theSettings = rTorrentSettings::get(true);
     if (!$theSettings->linkExist) {
         $jResult .= "noty(theUILang.badLinkTorTorrent,'error');";
         $jResult .= "theWebUI.systemInfo.rTorrent = { started: false, iVersion : 0, version : '?', libVersion : '?', apiVersion : 0 };\n";
     } else {
         if ($theSettings->idNotFound) {
             $jResult .= "noty(theUILang.idNotFound,'error');";
         }
         $jResult .= "theWebUI.systemInfo.rTorrent = { started: true, iVersion : " . $theSettings->iVersion . ", version : '" . $theSettings->version . "', libVersion : '" . $theSettings->libVersion . "', apiVersion : " . $theSettings->apiVersion . " };\n";
         if ($do_diagnostic) {
             $up = getUploadsPath();
             $st = getSettingsPath();
             @chmod($up, $profileMask);
             @chmod($st, $profileMask);
             @chmod('./test.sh', $profileMask & 0755);
             if (PHP_USE_GZIP && findEXE('gzip') === false) {
                 @define('PHP_USE_GZIP', false);
                 $jResult .= "noty(theUILang.gzipNotFound,'error');";
             }
             if (PHP_INT_SIZE <= 4) {
                 if (findEXE('stat') === false) {
                     $jResult .= "noty(theUILang.statNotFoundW,'error');";
                 }
                 findRemoteEXE('stat', "noty(theUILang.statNotFound,'error');", $remoteRequests);
             }
             if (!@file_exists($up . '/.') || !is_readable($up) || !is_writable($up)) {
예제 #2
0
<section class="grid_12">
	<div class="box">
		<div class="title"><?php 
echo at('Media Manager');
?>
</div>
		<div class='inside'>
			<div class="in">
				<div class="grid_12">
					<div id="elfinder"></div>
				</div>
				<div class="clear"></div>
			</div>
		</div>
	</div>		
</section>

<?php 
$this->widget('application.widgets.elfinder.FinderWidget', array('path' => getUploadsPath(), 'url' => getUploadsUrl(), 'action' => $this->createUrl('/admin/media/elfinder.connector')));
        $pos = strpos($url, ':COOKIE:');
        if ($pos !== false) {
            $tmp = explode(";", substr($url, $pos + 8));
            foreach ($tmp as $item) {
                list($name, $val) = explode("=", $item);
                $cli->cookies[$name] = $val;
            }
            $url = substr($url, 0, $pos);
        }
        set_time_limit(0);
        if (@$cli->fetch($url) && $cli->status >= 200 && $cli->status < 300) {
            $name = $cli->get_filename();
            if ($name === false) {
                $name = md5($url) . ".torrent";
            }
            $uploaded_file = getUploadsPath() . "/" . $name;
            $f = @fopen($uploaded_file, "w");
            if ($f !== false) {
                @fwrite($f, $cli->results, strlen($cli->results));
                fclose($f);
                $success = true;
            }
        }
    }
}
if ($success) {
    @chmod($uploaded_file, 0666);
    $uploaded_file = realpath($uploaded_file);
    $label = null;
    if (isset($_REQUEST['label'])) {
        $label = trim($_REQUEST['label']);
예제 #4
0
function getUniqueUploadedFilename($fname)
{
    global $overwriteUploadedTorrents;
    $fname = getUploadsPath() . "/" . $fname;
    return $overwriteUploadedTorrents ? $fname : getUniqueFilename($fname);
}
예제 #5
0
            break;
        case "kill":
            if (isset($_REQUEST['no'])) {
                $taskNo = $_REQUEST['no'];
                $dir = getTempDirectory() . getUser() . $taskNo;
                if (is_file($dir . '/pid') && is_readable($dir . '/pid')) {
                    $pid = trim(file_get_contents($dir . '/pid'));
                    $req = new rXMLRPCRequest(new rXMLRPCCommand("execute", array("sh", "-c", "kill -9 `" . getExternal("pgrep") . " -P " . $pid . "`")));
                    if ($req->success()) {
                        $ret = array("no" => $taskNo);
                    }
                    $req = new rXMLRPCRequest(new rXMLRPCCommand("execute", array("rm", "-fr", $dir)));
                    $req->run();
                    @unlink(getTempDirectory() . "rutorrent-" . getUser() . $taskNo . ".prm");
                }
            }
            break;
        case "get":
            if (isset($_REQUEST['tname'])) {
                $torrent = new Torrent(getUploadsPath() . "/" . $_REQUEST['tname']);
                if (!$torrent->errors()) {
                    $torrent->send();
                }
            }
            exit("Can't send torrent file.");
    }
}
if (empty($ret)) {
    $ret = array("no" => 0, "errors" => array($error), "status" => -1, "out" => "");
}
cachedEcho(json_encode($ret), "application/json");