本文整理汇总了PHP中cachedEcho函数的典型用法代码示例。如果您正苦于以下问题:PHP cachedEcho函数的具体用法?PHP cachedEcho怎么用?PHP cachedEcho使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cachedEcho函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rRetrackers
<?php
require_once 'retrackers.php';
$trks = new rRetrackers();
$trks->set();
cachedEcho($trks->get(), "application/javascript");
示例2: file_get_contents
$theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
}
if ($plugin["js"]) {
$js = file_get_contents($plugin["js"]);
if ($theSettings->isPluginRegistered($plugin["name"])) {
$jResult .= $js;
} else {
if (strpos($js, "plugin.loadLang()") !== false) {
$jResult .= "plugin.loadLang();";
}
}
$jResult .= "\n";
}
$jResult .= $jEnd;
$jResult .= "\n})();";
}
foreach ($disabled as $name => $pInfo) {
$jResult .= "(function () { var plugin = new rPlugin( '" . $name . "'," . $pInfo["plugin.version"] . ",'" . $pInfo["plugin.author"] . "','" . $pInfo["plugin.description"] . "'," . $pInfo["perms"] . ",'" . $pInfo["plugin.help"] . "' );\n";
$jResult .= "plugin.disable(); ";
if ($pInfo["perms"] & $disabledByUser) {
$jResult .= "plugin.unlaunch(); ";
}
$jResult .= "\n})();";
}
$jResult .= testRemoteRequests($remoteRequests);
$theSettings->store();
}
closedir($handle);
}
cachedEcho($jResult, "application/javascript", true);
示例3: closedir
if (is_dir($path) && is_readable($path) && strpos(addslash($path), $topDirectory) === 0 && ($theSettings->uid < 0 || isUserHavePermission($theSettings->uid, $theSettings->gid, $path, 0x7))) {
$files[] = $file;
}
}
closedir($dh);
sort($files, SORT_STRING);
$output["basedir"] = fullpath($dir);
$output["dirlist"] = $files;
}
}
if (in_array("channels", $modes) && $theSettings->isPluginRegistered('throttle')) {
require_once '../throttle/throttle.php';
$trt = rThrottle::load();
$tnames = array();
foreach ($trt->thr as $thr) {
$tnames[] = $thr["name"];
}
$output["channels"] = $tnames;
}
if (in_array("ratios", $modes) && $theSettings->isPluginRegistered('ratio')) {
require_once '../ratio/ratio.php';
$rat = rRatio::load();
$rnames = array();
foreach ($rat->rat as $r) {
$rnames[] = $r["name"];
}
$output["ratios"] = $rnames;
}
}
cachedEcho(json_encode($output), "application/json");
示例4: ignore_user_abort
<?php
require_once 'unpack.php';
ignore_user_abort(true);
set_time_limit(0);
$ret = array();
if (isset($_REQUEST['cmd'])) {
$cmd = $_REQUEST['cmd'];
switch ($cmd) {
case "set":
$up = rUnpack::load();
$up->set();
cachedEcho($up->get(), "application/javascript");
break;
case "unpack":
$up = rUnpack::load();
$ret = $up->startTask($_REQUEST['hash'], $_REQUEST['dir'], $_REQUEST['mode'], $_REQUEST['no']);
break;
}
}
cachedEcho(json_encode($ret), "application/json");
示例5: dirname
<?php
require_once dirname(__FILE__) . "/../../php/settings.php";
require_once dirname(__FILE__) . "/../../php/Snoopy.class.inc";
$ret = 0;
$port = rTorrentSettings::get()->port;
$client = new Snoopy();
$client->read_timeout = 15;
$client->use_gzip = HTTP_USE_GZIP;
@$client->fetch("http://www.canyouseeme.org", "POST", "application/x-www-form-urlencoded", "port=" . $port . "&submit=Check+Your+Port");
if ($client->status == 200) {
if (strpos($client->results, ">Error:<") !== false) {
$ret = 1;
} else {
if (strpos($client->results, ">Success:<") !== false) {
$ret = 2;
}
}
}
cachedEcho('{ "port": ' . $port . ', "status": ' . $ret . ' }', "application/json");
示例6: unset
}
}
if (isset($torrent->{'rtorrent'})) {
unset($torrent->{'rtorrent'});
}
if (count($req->val) > 9) {
$throttle = getCmd("d.set_throttle_name=") . $req->val[9];
}
$eReq = new rXMLRPCRequest(new rXMLRPCCommand("d.erase", $hash));
if ($eReq->run() && !$eReq->fault) {
$label = rawurldecode($req->val[5]);
if (!rTorrent::sendTorrent($torrent, $isStart, false, $req->val[6], $label, false, $req->val[8] == 1, false, array(getCmd("d.set_custom3") . "=1", getCmd("d.set_connection_seed=") . $req->val[7], $throttle))) {
$errors[] = array('desc' => "theUILang.errorAddTorrent", 'prm' => $fname);
}
} else {
$errors[] = array('desc' => "theUILang.badLinkTorTorrent", 'prm' => '');
}
} else {
$errors[] = array('desc' => "theUILang.errorReadTorrent", 'prm' => $fname);
}
} else {
$errors[] = array('desc' => "theUILang.cantFindTorrent", 'prm' => '');
}
} else {
$errors[] = array('desc' => "theUILang.badLinkTorTorrent", 'prm' => '');
}
}
}
}
cachedEcho(json_encode(array("errors" => $errors, "hash" => $hashes)), "application/json");
示例7: elseif
$settings["popup"] = $_REQUEST["popup"] ? 1 : 0;
$settings["pm"] = $_REQUEST["pm"] ? 1 : 0;
$settings["aInterval"] = $aInterval;
$settings["iInterval"] = $iInterval;
$settings["smileys"] = $_REQUEST["smileys"] ? 1 : 0;
$settings["smileySet"] = $smileySet;
$settings["format"] = $_REQUEST["format"];
$settings["lastLine"] = $lastLine;
if ($settings["pm"] && file_exists(getSettingsPath() . "/chat/nopm")) {
if (!unlink(getSettingsPath() . "/chat/nopm")) {
$ret = "{ \"error\": theUILang.chatPMError }";
}
} elseif (!$settings["pm"]) {
if (!touch(getSettingsPath() . "/chat/nopm")) {
$ret = "{ \"error\": theUILang.chatPMError }";
}
}
$chat = new rChat();
if (!$chat->set($settings)) {
$ret = "{ \"error\": theUILang.chatSettingsSave }";
} else {
$ret = json_encode($chat->get());
}
break;
}
}
if (empty($ret)) {
$ret = "{ \"error\": theUILang.chatInvalidReq }";
}
cachedEcho($ret, "application/json");
示例8: set_time_limit
<?php
require_once 'Snoopy.class.inc';
require_once 'rtorrent.php';
set_time_limit(0);
if (isset($_REQUEST['result'])) {
if (isset($_REQUEST['json'])) {
cachedEcho('{ "result" : "' . $_REQUEST['result'][0] . '" }', "application/json");
} else {
$js = '';
foreach ($_REQUEST['result'] as $ndx => $result) {
$js .= 'noty("' . (isset($_REQUEST['name'][$ndx]) ? addslashes(rawurldecode($_REQUEST['name'][$ndx])) . ' - ' : '') . '"+theUILang.addTorrent' . $_REQUEST['result'][$ndx] . ',"' . ($_REQUEST['result'][$ndx] == 'Success' ? 'success' : 'error') . '");';
}
cachedEcho($js, "text/html");
}
} else {
$uploaded_files = array();
$label = null;
if (isset($_REQUEST['label'])) {
$label = trim($_REQUEST['label']);
}
$dir_edit = null;
if (isset($_REQUEST['dir_edit'])) {
$dir_edit = trim($_REQUEST['dir_edit']);
if (strlen($dir_edit) > 0 && !rTorrentSettings::get()->correctDirectory($dir_edit)) {
$uploaded_files = array(array('status' => "FailedDirectory"));
}
}
if (empty($uploaded_files)) {
if (isset($_FILES['torrent_file'])) {
if (is_array($_FILES['torrent_file']['name'])) {
示例9: rStat
if ($_REQUEST['tracker'] != "global") {
$storage = "trackers/" . $_REQUEST['tracker'] . ".csv";
}
}
}
if (isset($_REQUEST['mode'])) {
$mode = $_REQUEST['mode'];
if ($mode == 'clear') {
if (!$disableClearButton) {
@unlink(getSettingsPath() . '/trafic/' . $storage);
}
if ($_REQUEST['tracker'] != "none") {
$mode = 'day';
$storage = "global.csv";
}
}
$st = new rStat($storage);
if ($mode == 'day') {
$val = $st->getDay();
} else {
if ($mode == 'month') {
$val = $st->getMonth();
} else {
if ($mode == 'year') {
$val = $st->getYear();
}
}
}
}
cachedEcho($val, "application/json");
示例10: eval
<?php
require_once '../../php/util.php';
eval(getPluginConf('geoip'));
require_once 'ip_db.php';
$db = new ipDB();
$db->add($_REQUEST["ip"], $_REQUEST["comment"]);
cachedEcho(json_encode(array("ip" => $_REQUEST["ip"], "comment" => $_REQUEST["comment"])), "application/json");
示例11: rXMLRPCRequest
case "getchunks":
$req = new rXMLRPCRequest(array(new rXMLRPCCommand("d.get_bitfield", $hash[0]), new rXMLRPCCommand("d.get_chunk_size", $hash[0]), new rXMLRPCCommand("d.get_size_chunks", $hash[0])));
if (rTorrentSettings::get()->apiVersion >= 4) {
$req->addCommand(new rXMLRPCCommand("d.chunks_seen", $hash[0]));
}
if ($req->success(false)) {
$result = array("chunks" => $req->val[0], "size" => $req->val[1], "tsize" => $req->val[2]);
if (rTorrentSettings::get()->apiVersion >= 4) {
$result["seen"] = $req->val[3];
}
}
break;
default:
if (isset($HTTP_RAW_POST_DATA)) {
$result = rXMLRPCRequest::send($HTTP_RAW_POST_DATA, false);
if (!empty($result)) {
$pos = strpos($result, "\r\n\r\n");
if ($pos !== false) {
$result = substr($result, $pos + 4);
}
cachedEcho($result, "text/xml");
}
}
break;
}
if (is_null($result)) {
header("HTTP/1.0 500 Server Error");
cachedEcho(isset($req) && $req->fault ? "Warning: XMLRPC call is failed." : "Link to XMLRPC failed. May be, rTorrent is down?", "text/html");
} else {
cachedEcho(safe_json_encode($result), "application/json");
}
示例12: formatItemDescription
$item["description"] = formatItemDescription($torrent);
}
$items[] = $item;
}
usort($items, create_function('$a,$b', 'return( (intval($a["pubDate"]) > intval($b["pubDate"])) ? -1 : ((intval($a["pubDate"]) < intval($b["pubDate"])) ? 1 : strcmp($a["title"],$b["title"])) );'));
foreach ($items as $item) {
$ret .= "\r\n<item>";
foreach ($item as $key => $val) {
if ($key == "guid") {
$ret .= "\r\n\t<guid isPermaLink=\"false\">" . $val . '</guid>';
} else {
if ($key == "pubDate") {
if (empty($val)) {
continue;
}
$ret .= "\r\n\t<pubDate>" . gmstrftime('%a, %d %b %Y %T %Z', $val) . '</pubDate>';
} else {
if ($key == "description") {
$ret .= "\r\n\t<description><![CDATA[" . $val . ']]></description>';
} else {
$ret .= "\r\n\t<" . $key . '>' . htmlspecialchars($val, ENT_COMPAT, "UTF-8") . '</' . $key . '>';
}
}
}
}
$ret .= "\r\n</item>";
}
}
ob_clean();
cachedEcho($ret . "</channel></rss>", "application/rss+xml", true);
示例13: send
/** Send torrent file to client
* @param null|string name of the file (optional)
* @return void script exit
*/
public function send($filename = null)
{
if (is_null($filename)) {
$filename = $this->info['name'] . '.torrent';
}
if (isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
$filename = rawurlencode($filename);
}
header('Content-Disposition: attachment; filename="' . $filename . '"');
cachedEcho($this->__toString(), 'application/x-bittorrent', true);
}
示例14: file_get_contents
<?php
require_once '../../php/util.php';
$quotafile = file_get_contents($topDirectory . "/.quotaspace");
$usedfile = file_get_contents($topDirectory . "/.useddiskspace");
$quota = (int) $quotafile * 1000 * 1000;
$used = (int) $usedfile * 1000 * 1000;
$free = $quota - $used;
cachedEcho('{ "total": ' . $quota . ', "free": ' . $free . ' }', "application/json");
示例15: switch
<?php
require_once 'cookies.php';
$cmd = '';
if (isset($_REQUEST['mode'])) {
$cmd = $_REQUEST['mode'];
}
switch ($cmd) {
case 'info':
$cookies = rCookies::load();
if (isset($_REQUEST['host'])) {
cachedEcho(safe_json_encode($cookies->getCookiesForHost($_REQUEST['host'])), "application/json");
} else {
cachedEcho(safe_json_encode($cookies->getInfo()), "application/json");
}
case 'add':
$cookies = rCookies::load();
if (isset($_REQUEST['host'])) {
$cookies->add($_REQUEST['host'], rawurldecode($_REQUEST['cookies']));
}
cachedEcho(safe_json_encode($cookies->getInfo()), "application/json");
default:
$cookies = new rCookies();
$cookies->set();
cachedEcho($cookies->get(), "application/javascript");
}