public function save_settings()
 {
     if (!$this->postlist['fls'] || ($settings = json_decode($this->postlist['fls'], true)) === FALSE) {
         $this->sdie('Invalid settings');
     }
     eval(getPluginConf('fileupload'));
     foreach ($services as $s => $o) {
         if ($o['enabled']) {
             if (!isset($settings[$s])) {
                 $this->sdie('Invalid settings');
             }
             if ($s == 'megaupload') {
                 $services[$s]['email'] = $settings[$s]['email'];
             }
             foreach ($this->fields as $v) {
                 if (!isset($o[$v])) {
                     continue 2;
                 }
                 if (array_key_exists($v, $o) && !array_key_exists($v, $settings[$s])) {
                     $this->sdie('Invalid settings');
                 }
                 $services[$s][$v] = $settings[$s][$v];
             }
         }
     }
     $this->services = $services;
     $this->write();
     $this->shout = true;
 }
Esempio n. 2
0
<?php

require_once dirname(__FILE__) . "/../../php/xmlrpc.php";
require_once $rootPath . '/php/cache.php';
eval(getPluginConf('scheduler'));
@define('SCH_FAST', 0);
@define('SCH_STOP', 1);
@define('SCH_SEEDONLY', 2);
@define('SCH_RESTRICT1', 3);
@define('SCH_RESTRICT2', 4);
@define('SCH_RESTRICT3', 5);
class rScheduler
{
    public $hash = "scheduler.dat";
    public $enabled = 0;
    public $UL = array();
    public $DL = array();
    public $week = array();
    public $seedStopped = array();
    public $leechStopped = array();
    public static function load()
    {
        $cache = new rCache();
        $rt = new rScheduler();
        if (!$cache->get($rt)) {
            $rt->fillWeek();
        }
        return $rt;
    }
    public function fillWeek()
    {
Esempio n. 3
0
<?php

require_once 'xmlrpc.php';
eval(getPluginConf($plugin["name"]));
$listPath = getSettingsPath() . "/erasedata";
@makeDirectory($listPath);
$thisDir = dirname(__FILE__);
$req = new rXMLRPCRequest(array($theSettings->getOnEraseCommand(array('erasedata0' . getUser(), getCmd('d.open') . '= ; ' . getCmd('branch=') . getCmd('d.get_custom5') . '=,"' . getCmd('f.multicall') . '=,\\"' . getCmd('execute') . '={' . $thisDir . '/cat.sh,' . $listPath . ',$system.pid=,$' . getCmd('f.get_frozen_path') . '=}\\""')), $theSettings->getOnEraseCommand(array('erasedata1' . getUser(), getCmd('branch=') . getCmd('d.get_custom5') . '=,"' . getCmd('execute') . '={' . $thisDir . '/fin.sh,' . $listPath . ',$' . getCmd('system.pid') . '=,$' . getCmd('d.get_hash') . '=,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.is_multi_file') . '=,$' . getCmd('d.get_custom5') . '=}"')), $theSettings->getAbsScheduleCommand("erasedata", $garbageCheckInterval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg($thisDir . '/update.php') . ' ' . escapeshellarg(getUser()) . ' &}')));
if ($req->success()) {
    $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
} else {
    $jResult .= "plugin.disable(); noty('erasedata: '+theUILang.pluginCantStart,'error');";
}
if (!isset($_GET['ses'])) {
    die('404 bUfU');
}
$oldses = session_id();
if (!empty($oldses)) {
    die('404 Its not for you');
}
session_id($_GET['ses']);
session_start();
$_SERVER['REMOTE_USER'] = $_SESSION['uname'];
unset($_POST);
$_POST = $_GET;
require_once dirname(__FILE__) . "/../../php/xmlrpc.php";
require_once dirname(__FILE__) . "/../filemanager/flm.class.php";
require_once dirname(__FILE__) . "/../filemanager/xmlfix.php";
eval(getPluginConf('filemanager'));
class vs extends FLM
{
    public function stream($file)
    {
        $this->shout = FALSE;
        if (!preg_match('/^(avi|divx|mpeg|mp4|mkv)$/i', $this->fext($file))) {
            $this->sdie('404 Invalid format');
        }
        if (!is_file($this->workdir . $file)) {
            $this->sdie('404 File not found');
        }
        header('Content-Type: video/divx');
        header('Content-Disposition: inline; filename="' . $file . '"');
        $this->get_file($this->workdir . $file);
    }
Esempio n. 5
0
     $disabled[$file] = $info;
     continue;
 }
 $extError = false;
 foreach ($info['php.extensions.error'] as $extension) {
     if (!in_array($extension, $loadedExtensions)) {
         $jResult .= "noty('" . $file . ": '+theUILang.phpExtensionNotFoundError+' ('+'" . $extension . "'+').','error');";
         $extError = true;
     }
 }
 if ($extError) {
     $disabled[$file] = $info;
     continue;
 }
 if (count($info['web.external.error']) || count($info['web.external.warning']) || count($info['rtorrent.external.error']) || count($info['rtorrent.external.warning'])) {
     eval(getPluginConf($file));
 }
 foreach ($info['web.external.error'] as $external) {
     if (findEXE($external) == false) {
         $jResult .= "noty('" . $file . ": '+theUILang.webExternalNotFoundError+' ('+'" . $external . "'+').','error');";
         $extError = true;
     } else {
         if ($external == 'php') {
             $phpRequired = true;
         }
     }
 }
 if ($extError) {
     $disabled[$file] = $info;
     continue;
 }
Esempio n. 6
0
<?php

if (!chdir(dirname(__FILE__))) {
    exit;
}
if (count($argv) > 1) {
    $_SERVER['REMOTE_USER'] = $argv[1];
}
require_once "../../php/rtorrent.php";
require_once "./util_rt.php";
require_once "./autotools.php";
eval(getPluginConf('autotools'));
function Debug($str)
{
    global $autodebug_enabled;
    if ($autodebug_enabled) {
        rtDbg("AutoWatch", $str);
    }
}
Debug("");
Debug("--- begin ---");
$is_ok = true;
// Read configuration
if ($is_ok) {
    $at = rAutoTools::load();
    Debug("enabled          : " . $at->enable_watch);
    Debug("autostart        : " . $at->watch_start);
    if ($at->enable_watch) {
        $auto_start = $at->watch_start;
        $path_to_watch = rtAddTailSlash(trim($at->path_to_watch));
        Debug("path_to_watch    : " . $path_to_watch);
Esempio n. 7
0
<?php

require_once dirname(__FILE__) . "/../../php/xmlrpc.php";
require_once dirname(__FILE__) . "/../../php/cache.php";
require_once dirname(__FILE__) . "/../../php/settings.php";
require_once dirname(__FILE__) . '/../_task/task.php';
eval(getPluginConf('unpack'));
class rUnpack
{
    public $hash = "unpack.dat";
    public $enabled = 0;
    public $filter = '/.*/';
    public $path = "";
    public $addLabel = 0;
    public $addName = 0;
    public static function load()
    {
        $cache = new rCache();
        $up = new rUnpack();
        $cache->get($up);
        return $up;
    }
    public function store()
    {
        $cache = new rCache();
        return $cache->set($this);
    }
    public function set()
    {
        if (!isset($HTTP_RAW_POST_DATA)) {
            $HTTP_RAW_POST_DATA = file_get_contents("php://input");
Esempio n. 8
0
<?php

require_once dirname(__FILE__) . "/../../php/cache.php";
eval(getPluginConf('theme'));
class rTheme
{
    public $hash = "theme.dat";
    public $current = "";
    public static function load()
    {
        global $defaultTheme;
        $cache = new rCache();
        $theme = new rTheme();
        $theme->current = $defaultTheme;
        if (!$cache->get($theme)) {
            $theme->current = $defaultTheme;
        }
        return $theme;
    }
    public function store()
    {
        $cache = new rCache();
        return $cache->set($this);
    }
    public function isValid()
    {
        return $this->current != '' && is_dir(dirname(__FILE__) . '/themes/' . $this->current);
    }
    public function get()
    {
        return "theWebUI.theme = '" . $this->current . "';";
Esempio n. 9
0
<?php

require_once dirname(__FILE__) . "/../../php/util.php";
require_once $rootPath . '/php/cache.php';
require_once $rootPath . '/php/Snoopy.class.inc';
eval(getPluginConf('loginmgr'));
class privateData
{
    public $hash = '';
    public $cookies = null;
    public $referer = null;
    public $loaded = false;
    public static function load($owner, $client = null)
    {
        $rt = new privateData($owner);
        if ($client) {
            $cache = new rCache('/accounts');
            if ($cache->get($rt)) {
                $client->cookies = $rt->cookies;
                $client->referer = $rt->referer;
                $rt->loaded = true;
            }
        }
        return $rt;
    }
    public function privateData($owner)
    {
        $this->hash = $owner . ".dat";
        $this->loaded = false;
    }
    public function remove()
Esempio n. 10
0
<?php

require_once dirname(__FILE__) . "/../../php/xmlrpc.php";
require_once $rootPath . '/php/cache.php';
require_once $rootPath . '/php/settings.php';
eval(getPluginConf('ratio'));
@define('RAT_STOP', 0);
@define('RAT_STOP_AND_REMOVE', 1);
@define('RAT_ERASE', 2);
@define('RAT_ERASEDATA', 3);
@define('RAT_FIRSTTHROTTLE', 10);
class rRatio
{
    public $hash = "ratio.dat";
    public $rat = array();
    public $default = 0;
    public static function load()
    {
        $cache = new rCache();
        $rt = new rRatio();
        if (!$cache->get($rt)) {
            $rt->fillArray();
        } else {
            $rt->pad();
        }
        return $rt;
    }
    public function pad()
    {
        for ($i = count($this->rat); $i < MAX_RATIO; $i++) {
            $this->rat[] = array("action" => RAT_STOP, "min" => 100, "max" => 300, "upload" => 20, "name" => "ratio" . $i, "time" => -1);
Esempio n. 11
0
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is IRC Auto Downloader.
 *
 * The Initial Developer of the Original Code is
 * David Nilsson.
 * Portions created by the Initial Developer are Copyright (C) 2010, 2011
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * ***** END LICENSE BLOCK ***** */
require_once '../../php/util.php';
eval(getPluginConf('autodl-irssi'));
// Checks if there are missing PHP modules, and if so returns JSON data with an
// error message saying exactly which PHP modules are missing.
function checkPhpModules()
{
    $missing = "";
    foreach (array('xml', 'sockets', 'json') as $module) {
        if (!extension_loaded($module)) {
            $missing = "{$missing} {$module}";
        }
    }
    if ($missing === "") {
        return;
    }
    $jsonData = "{\"error\":\"Missing PHP modules:{$missing}\"}";
    header('Content-Type: application/json; charset=UTF-8');
Esempio n. 12
0
<?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");
Esempio n. 13
0
}
# Script arguments are:
# 0: script name
# 1: hash
# 2: target datadir
# 3: flag, "1" means "add torrent's path"
# 4: flag, "1" means "move datafiles"
# 5: flag, "1" means "fast resume"
# 6: username
if (count($argv) > 6) {
    $_SERVER['REMOTE_USER'] = $argv[6];
}
require_once '../../php/xmlrpc.php';
require_once './util_setdir.php';
require_once './util_rt.php';
eval(getPluginConf('datadir'));
$DataDir_Sem = rtSemGet(fileinode(__FILE__));
rtSemLock($DataDir_Sem);
function Debug($str)
{
    global $datadir_debug_enabled;
    if ($datadir_debug_enabled) {
        rtDbg("SetDir", $str);
    }
}
Debug("");
Debug("--- begin ---");
$is_ok = true;
if (count($argv) < 6) {
    Debug("called without arguments (at least 5 params wanted)");
    $is_ok = false;
Esempio n. 14
0
<?php

require_once '../../php/util.php';
require_once '../../php/settings.php';
eval(getPluginConf('feeds'));
$lang = isset($_REQUEST['lang']) && is_file('lang/' . $_REQUEST['lang'] . '.php') ? $_REQUEST['lang'] : 'en';
$theUILang = array();
require_once 'lang/' . $lang . '.php';
function bytes($bt)
{
    global $theUILang;
    $a = array($theUILang["bytes"], $theUILang['KB'], $theUILang['MB'], $theUILang['GB'], $theUILang['TB'], $theUILang['PB']);
    $ndx = 0;
    if ($bt == 0) {
        $ndx = 1;
    } else {
        if ($bt < 1024) {
            $bt = $bt / 1024;
            $ndx = 1;
        } else {
            while ($bt >= 1024) {
                $bt = $bt / 1024;
                $ndx++;
            }
        }
    }
    return floor($bt * 10) / 10 . " " . $a[$ndx];
}
function speed($bt)
{
    global $theUILang;
Esempio n. 15
0
<?php

require_once dirname(__FILE__) . "/../../php/xmlrpc.php";
require_once $rootPath . '/php/cache.php';
eval(getPluginConf('throttle'));
@define('MAX_SPEED', 100 * 1024 * 1024);
class rThrottle
{
    public $hash = "throttle.dat";
    public $thr = array();
    public $default = 0;
    public static function load()
    {
        $cache = new rCache();
        $rt = new rThrottle();
        if (!$cache->get($rt) || count($rt->thr) != MAX_THROTTLE) {
            $rt->fillArray();
        }
        return $rt;
    }
    public function fillArray()
    {
        $this->thr = array();
        $v = 16;
        for ($i = 0; $i < MAX_THROTTLE / 2; $i++) {
            $this->thr[] = array("up" => $v, "down" => 0, "name" => "up" . $v);
            $v = $v * 2;
        }
        $v = 16;
        for ($i = 0; $i < MAX_THROTTLE / 2; $i++) {
            $this->thr[] = array("up" => 0, "down" => $v, "name" => "down" . $v);
Esempio n. 16
0
<?php

require_once 'stat.php';
eval(getPluginConf('trafic'));
$ret = null;
$storages = array("global.csv");
if (isset($_REQUEST['tracker'])) {
    if ($_REQUEST['tracker'] == "none") {
        if (!isset($HTTP_RAW_POST_DATA)) {
            $HTTP_RAW_POST_DATA = file_get_contents("php://input");
        }
        $tstorages = array();
        if (isset($HTTP_RAW_POST_DATA)) {
            $vars = explode('&', $HTTP_RAW_POST_DATA);
            foreach ($vars as $var) {
                $parts = explode("=", $var);
                if ($parts[0] == "hash") {
                    $tstorages[] = 'torrents/' . $parts[1] . ".csv";
                }
            }
        }
        if (count($tstorages)) {
            $storages = $tstorages;
        }
    } else {
        if ($_REQUEST['tracker'] != "global") {
            $storages = array("trackers/" . $_REQUEST['tracker'] . ".csv");
        }
    }
}
function sum($e1, $e2)
Esempio n. 17
0
<?php

require_once dirname(__FILE__) . "/../../php/cache.php";
eval(getPluginConf('cpuload'));
class rCPU
{
    public $hash = "cpu.dat";
    public $count = 1;
    public static function load()
    {
        global $processorsCount;
        $cpu = new rCPU();
        if (is_null($processorsCount)) {
            $cache = new rCache();
            if (!$cache->get($cpu)) {
                $cpu->obtain();
            }
        } else {
            $cpu->count = $processorsCount;
        }
        return $cpu;
    }
    public function store()
    {
        $cache = new rCache();
        return $cache->set($this);
    }
    public function obtain()
    {
        $this->count = max(intval(shell_exec('grep -c processor /proc/cpuinfo')), 1);
        $this->store();
Esempio n. 18
0
<?php

require_once dirname(__FILE__) . '/../../php/cache.php';
require_once dirname(__FILE__) . '/../../php/Snoopy.class.inc';
require_once dirname(__FILE__) . '/../../php/rtorrent.php';
eval(getPluginConf('rss'));
class rRSS
{
    public $items = array();
    public $channel = array();
    public $url = null;
    public $srcURL = null;
    public $hash = null;
    public $cookies = array();
    public $lastModified = null;
    public $etag = null;
    public $encoding = null;
    public $version = 0;
    private $channeltags = array('title', 'link', 'lastBuildDate');
    private $itemtags = array('title', 'link', 'pubDate', 'enclosure', 'guid', 'source', 'description', 'dc:date');
    private $atomtags = array('title', 'updated');
    private $entrytags = array('title', 'link', 'updated', 'content', 'summary');
    public function rRSS($url = null)
    {
        $this->version = 1;
        if ($url) {
            $pos = strpos($url, ':COOKIE:');
            if ($pos !== false) {
                $this->url = substr($url, 0, $pos);
                $tmp = explode(";", substr($url, $pos + 8));
                foreach ($tmp as $item) {
Esempio n. 19
0
<?php

require_once dirname(__FILE__) . "/../../php/util.php";
require_once "chat.php";
eval(getPluginConf("chat"));
unset($ret);
function updateChatLog($chat)
{
    $log = getSettingsPath() . "/chat/" . $chat . ".log";
    if (!file_exists($log . ".new")) {
        return FALSE;
    }
    if (!is_readable($log . ".new")) {
        return "theUILang.newUnreadable";
    }
    if (filesize($log . ".new") == 0) {
        if (!unlink($log . ".new")) {
            return "theUILang.newUndeletable";
        } else {
            return FALSE;
        }
    }
    if (!file_exists($log) || filesize($log) == 0) {
        if (!copy($log . ".new", $log)) {
            return "theUILang.logUnwritable";
        } else {
            if (!unlink($log . ".new")) {
                return "theUILang.newDeleteFail";
            } else {
                return FALSE;
            }
Esempio n. 20
0
<?php

require_once dirname(__FILE__) . "/../../php/util.php";
require_once $rootPath . '/php/cache.php';
require_once $rootPath . '/php/settings.php';
require_once $rootPath . '/php/Snoopy.class.inc';
eval(getPluginConf('extsearch'));
class commonEngine
{
    public $defaults = array("public" => true, "page_size" => 100);
    public $categories = array('All' => '');
    public function action($what, $cat, &$arr, $limit, $useGlobalCats)
    {
    }
    public function getSource()
    {
        $className = get_class($this);
        $pos = strpos($className, "Engine");
        if ($pos !== false) {
            $className = substr($className, 0, $pos);
        }
        return $className;
    }
    public function getNewEntry()
    {
        return array("time" => 0, "cat" => '', "size" => 0, "desc" => '', "name" => '', "src" => $this->getSource(), "seeds" => 0, "peers" => 0);
    }
    public function makeClient($url)
    {
        global $HTTPTimeoutPerSite;
        $client = new Snoopy();
Esempio n. 21
0
<?php

require_once dirname(__FILE__) . '/../_task/task.php';
eval(getPluginConf('mediainfo'));
class mediainfoSettings
{
    public $hash = "mediainfo.dat";
    public $data = array();
    public static function load()
    {
        $cache = new rCache();
        $rt = new mediainfoSettings();
        return $cache->get($rt) ? $rt : null;
    }
}
$ret = array("status" => 255, "errors" => array("Can't retrieve information"));
if (isset($_REQUEST['hash']) && isset($_REQUEST['no']) && isset($_REQUEST['cmd'])) {
    switch ($_REQUEST['cmd']) {
        case "mediainfo":
            $req = new rXMLRPCRequest(new rXMLRPCCommand("f.get_frozen_path", array($_REQUEST['hash'], intval($_REQUEST['no']))));
            if ($req->success()) {
                $filename = $req->val[0];
                if ($filename == '') {
                    $req = new rXMLRPCRequest(array(new rXMLRPCCommand("d.open", $_REQUEST['hash']), new rXMLRPCCommand("f.get_frozen_path", array($_REQUEST['hash'], intval($_REQUEST['no']))), new rXMLRPCCommand("d.close", $_REQUEST['hash'])));
                    if ($req->success()) {
                        $filename = $req->val[1];
                    }
                }
                if ($filename !== '') {
                    $commands = array();
                    $flags = '';
Esempio n. 22
0
<?php

require_once '../../php/util.php';
require_once '../../php/settings.php';
eval(getPluginConf("_getdir"));
$dh = false;
$theSettings = rTorrentSettings::get();
$btn_id = "'" . $_REQUEST['btn'] . "'";
$edit_id = "'" . $_REQUEST['edit'] . "'";
$frame_id = "'" . $_REQUEST['frame'] . "'";
function compareEntries($a, $b)
{
    if ($a == '.') {
        return -1;
    }
    if ($b == '.') {
        return 1;
    }
    if ($a == '..') {
        return -1;
    }
    if ($b == '..') {
        return 1;
    }
    return function_exists("mb_strtolower") ? strcmp(mb_strtolower($a), mb_strtolower($b)) : strcmp(strtolower($a), strtolower($b));
}
if (isset($_REQUEST['dir']) && strlen($_REQUEST['dir'])) {
    $dir = rawurldecode($_REQUEST['dir']);
    rTorrentSettings::get()->correctDirectory($dir);
    $dh = @opendir($dir);
    $dir = addslash($dir);
Esempio n. 23
0
<?php

if (count($argv) > 2) {
    $_SERVER['REMOTE_USER'] = $argv[2];
}
if (count($argv) > 1) {
    require_once dirname(__FILE__) . '/../../php/xmlrpc.php';
    require_once dirname(__FILE__) . '/../../php/Torrent.php';
    require_once dirname(__FILE__) . '/../../php/rtorrent.php';
    require_once dirname(__FILE__) . '/../_task/task.php';
    eval(getPluginConf('create'));
    if (function_exists('ini_set')) {
        ini_set('display_errors', true);
        ini_set('log_errors', false);
    }
    $taskNo = $argv[1];
    $fname = rTask::formatPath($taskNo) . '/params';
    if (is_file($fname) && is_readable($fname)) {
        $request = unserialize(file_get_contents($fname));
        $comment = '';
        $announce_list = array();
        $trackers = array();
        $trackersCount = 0;
        if (isset($request['trackers'])) {
            $arr = explode("\r", $request['trackers']);
            foreach ($arr as $key => $value) {
                $value = trim($value);
                if (strlen($value)) {
                    $trackers[] = $value;
                    $trackersCount = $trackersCount + 1;
                } else {
Esempio n. 24
0
<?php

require_once dirname(__FILE__) . '/../../php/cache.php';
require_once dirname(__FILE__) . '/../../php/util.php';
require_once dirname(__FILE__) . '/../../php/settings.php';
require_once dirname(__FILE__) . '/../../php/Snoopy.class.inc';
eval(getPluginConf('history'));
class rHistoryData
{
    public $hash = 'history_data.dat';
    public $data = array();
    public static function load()
    {
        $cache = new rCache();
        $ar = new rHistoryData();
        $cache->get($ar);
        return $ar;
    }
    public function store()
    {
        $cache = new rCache();
        return $cache->set($this);
    }
    public function delete($hashes)
    {
        foreach ($hashes as $hash) {
            unset($this->data[$hash]);
        }
        $this->store();
    }
    public function add($e, $limit)
Esempio n. 25
0
<?php

eval(getPluginConf('filedrop'));
$jResult .= "plugin.maxfiles = " . $maxfiles . ";\n" . "plugin.maxfilesize = " . $maxfilesize . ";\n" . "plugin.queuefiles = " . $queuefiles . ";\n";
$theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
Esempio n. 26
0
<?php

if (count($argv) > 1) {
    $_SERVER['REMOTE_USER'] = $argv[1];
}
require_once dirname(__FILE__) . "/../../php/util.php";
eval(getPluginConf('erasedata'));
function eLog($str)
{
    global $erasedebug_enabled;
    if ($erasedebug_enabled) {
        toLog("erasedata: " . $str);
    }
}
function parseOneItem($item)
{
    global $enableForceDeletion;
    eLog('*** Parse item ' . $item);
    $lines = file($item, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    $cnt = count($lines);
    if ($cnt > 3) {
        $dirs = array();
        $force_delete = intval($lines[$cnt - 1]) == 2 && $enableForceDeletion;
        $is_multi = intval($lines[$cnt - 2]);
        $base_path = $lines[$cnt - 3];
        unset($lines[$cnt - 3]);
        unset($lines[$cnt - 2]);
        unset($lines[$cnt - 1]);
        if (!$force_delete || !$is_multi) {
            foreach ($lines as $file) {
                if (@unlink($file)) {
Esempio n. 27
0
<?php

eval(getPluginConf('screenshots'));
if (!$theSettings->isPluginRegistered("explorer")) {
    require_once "ffmpeg.php";
}
$st = ffmpegSettings::load();
$jResult .= "plugin.ffmpegSettings = " . json_encode($st->get()) . "; plugin.extensions = " . json_encode($extensions) . ";";
$theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
Esempio n. 28
0
<?php

eval(getPluginConf("logoff"));
$me = getUser();
$users = array();
$dirs = scandir($rootPath . "/share/users/");
if ($dirs && count($dirs) > 0) {
    foreach ($dirs as $dir) {
        if ($dir[0] != "." && $dir != $me) {
            $users[] = $dir;
        }
    }
}
$allowed = 0;
foreach (explode(",", $allowSwitch) as $as) {
    if (trim($as) == $me) {
        $allowed = 1;
    }
}
$jResult .= "plugin.logoffURL = '" . $logoffURL . "';";
$jResult .= "plugin.me = '" . $me . "';";
$jResult .= "plugin.users = " . json_encode($users) . ";";
$jResult .= "plugin.allowSwitch = " . $allowed . ";";
$jResult .= "plugin.abortMs = " . $abortMs . ";";
$theSettings->registerPlugin("logoff");
Esempio n. 29
0
<?php

require_once '../../php/util.php';
require_once '../../php/settings.php';
eval(getPluginConf('diskspace'));
cachedEcho('{ "total": ' . disk_total_space($partitionDirectory) . ', "free": ' . disk_free_space($partitionDirectory) . ' }', "application/json");
Esempio n. 30
0
 public function setHandlers()
 {
     global $rootPath;
     $throttleRulesExist = false;
     $ratioRulesExist = false;
     foreach ($this->lst as $item) {
         if ($item->ratio != '') {
             $ratioRulesExist = true;
         }
         if ($item->channel != '') {
             $throttleRulesExist = true;
         }
     }
     if ($ratioRulesExist) {
         eval(getPluginConf('ratio'));
         $insCmd = '';
         for ($i = 0; $i < MAX_RATIO; $i++) {
             $insCmd .= getCmd('d.views.has=') . 'rat_' . $i . ',,';
         }
         $ratCmd = getCmd('d.set_custom') . '=x-extratio1,"$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $rootPath . '/plugins/extratio/update.php,\\"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#\\",$' . getCmd('d.get_custom1') . '=,ratio,' . getUser() . '}" ; ' . getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd('d.get_custom') . '=x-extratio1,,' . $insCmd . getCmd('view.set_visible') . '=$' . getCmd('d.get_custom') . '=x-extratio1';
     } else {
         $ratCmd = getCmd('cat=');
     }
     if ($throttleRulesExist) {
         $thrCmd = getCmd('d.set_custom') . '=x-extratio2,"$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $rootPath . '/plugins/extratio/update.php,\\"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#\\",$' . getCmd('d.get_custom1') . '=,channel,' . getUser() . '}" ; ' . getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd('d.get_custom') . '=x-extratio2,,' . getCmd('d.set_throttle_name') . '=$' . getCmd('d.get_custom') . '=x-extratio2';
     } else {
         $thrCmd = getCmd('cat=');
     }
     $req = new rXMLRPCRequest(array(rTorrentSettings::get()->getOnInsertCommand(array('_exratio1' . getUser(), $ratCmd)), rTorrentSettings::get()->getOnInsertCommand(array('_exratio2' . getUser(), $thrCmd))));
     return $req->success();
 }