Esempio n. 1
0
 public function __construct($name = '')
 {
     $this->dir = getSettingsPath() . $name;
     if (!is_dir($this->dir)) {
         makeDirectory($this->dir);
     }
 }
Esempio n. 2
0
 public function __construct()
 {
     $this->dir = getSettingsPath() . "/httprpc";
     if (!is_dir($this->dir)) {
         makeDirectory($this->dir);
     }
 }
Esempio n. 3
0
 public function rCache($name = '')
 {
     $this->dir = getSettingsPath() . $name;
     if (!is_dir($this->dir)) {
         mkdir($this->dir, 0777);
     }
 }
Esempio n. 4
0
 public function rpcCache()
 {
     $this->dir = getSettingsPath() . "/httprpc";
     if (!is_dir($this->dir)) {
         makeDirectory($this->dir);
     }
 }
 public function __construct()
 {
     global $topDirectory;
     $this->datafile = addslash(getSettingsPath()) . 'fileshare.dat';
     $this->check_post($this->postlist);
     $this->load();
     $this->userdir = addslash($topDirectory);
 }
Esempio n. 6
0
 public function __construct()
 {
     $pathToDatabase = getSettingsPath() . '/peers.dat';
     @makeDirectory(dirname($pathToDatabase));
     $needCreate = !is_readable($pathToDatabase);
     if ($this->handle = sqlite_open($pathToDatabase, 0666, $this->error)) {
         if ($needCreate) {
             sqlite_exec($this->handle, 'create table comments( ' . 'id integer primary key,' . 'ip text unique,' . 'comment text)', $this->error);
             @chmod($pathToDatabase, 0666);
         }
     }
 }
 public function __construct()
 {
     global $topDirectory;
     eval(getPluginConf('fileupload'));
     $this->services = $services;
     $this->datafile = addslash(getSettingsPath()) . 'fileuploads.dat';
     $this->check_post($this->postlist);
     $this->load();
     $this->userdir = addslash($topDirectory);
     $this->shout = false;
     $this->xmlrpc = new rxmlrpcfix();
     $this->settings = array('tempdir' => '/tmp');
 }
Esempio n. 8
0
function findRemoteEXE($exe, $err, &$remoteRequests)
{
    $st = getSettingsPath() . '/' . rand();
    if (!array_key_exists($exe, $remoteRequests)) {
        $path = realpath(dirname('.'));
        global $pathToExternals;
        $cmd = array("sh", addslash($path) . "test.sh", $exe, $st);
        if (isset($pathToExternals[$exe]) && !empty($pathToExternals[$exe])) {
            $cmd[] = $pathToExternals[$exe];
        }
        $req = new rXMLRPCRequest(new rXMLRPCCommand("execute", $cmd));
        $req->run();
        $remoteRequests[$exe] = array("path" => $st, "err" => array());
    }
    $remoteRequests[$exe]["err"][] = $err;
}
Esempio n. 9
0
        exit;
    }
    $name = dirname(__FILE__) . "/labels/" . $label . ".png";
    if (is_readable($name)) {
        sendFile($name, "image/png");
        exit;
    }
}
if (isset($_REQUEST["tracker"])) {
    $tracker = rawurldecode($_REQUEST["tracker"]);
    $name = dirname(__FILE__) . "/trackers/" . $tracker . ".png";
    if (is_readable($name)) {
        sendFile($name, "image/png");
        exit;
    }
    $name = getSettingsPath() . '/trackers';
    if (!is_dir($name)) {
        makeDirectory($name);
    }
    $name .= '/';
    if (strlen($tracker)) {
        $name .= $tracker;
        $name .= '.ico';
        if (!is_readable($name)) {
            $url = Snoopy::linkencode("http://" . $tracker . "/favicon.ico");
            $client = new Snoopy();
            @$client->fetchComplex($url);
            if ($client->status == 200) {
                file_put_contents($name, $client->results);
            }
        }
 public function videoScreenshots($file, $output)
 {
     $fs = Fs::get();
     $video_file = $this->getUserDir($file);
     $screens_file = $this->getUserDir($output);
     if (!$fs->isFile($video_file)) {
         throw new Exception("Error Processing Request", 6);
     } else {
         if ($fs->isFile($screens_file)) {
             throw new Exception("dest is file", 16);
         }
     }
     $defaults = array('scrows' => '12', 'sccols' => 4, 'scwidth' => 300);
     $uisettings = json_decode(file_get_contents(getSettingsPath() . '/uisettings.json'), true);
     $settings = array();
     foreach ($defaults as $k => $value) {
         $settings[$k] = isset($uisettings['webui.fManager.' . $k]) && $uisettings['webui.fManager.' . $k] > 1 ? $uisettings['webui.fManager.' . $k] : $value;
     }
     $vinfo = $this->video_info($video_file);
     $frame_step = floor($vinfo['total_frames'] / ($settings['scrows'] * $settings['sccols']));
     $settings['frame_step'] = $frame_step;
     $temp = Helper::getTempDir();
     $args = array('action' => 'makeScreensheet', 'params' => array('imgfile' => $screens_file, 'file' => $video_file, 'options' => $settings, 'binary' => getExternal('ffmpeg')), 'temp' => $temp);
     $task = $temp['dir'] . 'task';
     file_put_contents($task, json_encode($args));
     $task_opts = array('requester' => 'filemanager', 'name' => 'screensheet');
     $rtask = new \rTask($task_opts);
     $commands = array(Helper::getTaskCmd() . " " . escapeshellarg($task));
     $ret = $rtask->start($commands, 0);
     //   var_dump($ret);
     return $temp;
 }
<?php

require_once 'util.php';
$filename = getSettingsPath() . "/uisettings.json";
if ($w = @fopen($filename, "wb")) {
    if (isset($_REQUEST['v'])) {
        fputs($w, $_REQUEST['v']);
    }
    fclose($w);
}
Esempio n. 12
0
<?php

require_once "chat.php";
eval(getPluginConf("chat"));
$chatDir = getSettingsPath() . "/chat";
if (!file_exists($chatDir) || !is_dir($chatDir)) {
    mkdir($chatDir);
}
$chat = rChat::load();
$chatSettings = $chat->get();
$chatList = array();
$chatList["main_chat"] = array();
$chatList["main_chat"]["newChat"] = file_exists($chatDir . "/main_chat.log.new");
$chatList["main_chat"]["disabled"] = false;
if ($chatSettings["pm"]) {
    $me = getUser();
    $users = scandir($rootPath . "/share/users/");
    if ($users && count($users) > 0) {
        foreach ($users as $user) {
            if ($user[0] == "." || $user == $me) {
                continue;
            }
            $chatList[$user] = array();
            $chatList[$user]["newChat"] = file_exists($chatDir . "/" . $user . ".log.new");
            $chatList[$user]["disabled"] = file_exists($rootPath . "/share/users/" . $user . "/settings/chat/nopm");
        }
    }
}
$jResult .= "plugin.chatList = " . json_encode($chatList) . ";";
$jResult .= "plugin.settings = " . json_encode($chatSettings) . ";";
$jResult .= "plugin.listInterval = " . $defaultListInterval * 1000 . ";";
Esempio n. 13
0
    } else {
        if ($_REQUEST['tracker'] != "global") {
            $storages = array("trackers/" . $_REQUEST['tracker'] . ".csv");
        }
    }
}
function sum($e1, $e2)
{
    return $e1 + $e2;
}
if (isset($_REQUEST['mode'])) {
    $mode = $_REQUEST['mode'];
    if ($mode == 'clear') {
        if (!$disableClearButton) {
            foreach ($storages as $storage) {
                @unlink(getSettingsPath() . '/trafic/' . $storage);
            }
        }
        if ($_REQUEST['tracker'] != "none") {
            $mode = 'day';
            $storages = array("global.csv");
        }
    }
    $ret = array();
    foreach ($storages as $storage) {
        $st = new rStat($storage);
        if ($mode == 'day') {
            $val = $st->getDay();
        } else {
            if ($mode == 'month') {
                $val = $st->getMonth();
Esempio n. 14
0
function getChatList()
{
    global $rootPath;
    $chatDir = getSettingsPath() . "/chat";
    $chatList = array();
    $chatList["main_chat"] = array();
    $chatList["main_chat"]["newChat"] = file_exists($chatDir . "/main_chat.log.new");
    $chatList["main_chat"]["disabled"] = false;
    $me = getUser();
    $users = scandir($rootPath . "/share/users/");
    if ($users && count($users) > 0) {
        foreach ($users as $user) {
            if ($user[0] == "." || $user == $me) {
                continue;
            }
            $chatList[$user] = array();
            $chatList[$user]["newChat"] = file_exists($chatDir . "/" . $user . ".log.new");
            $chatList[$user]["disabled"] = file_exists($rootPath . "/share/users/" . $user . "/settings/chat/nopm");
        }
    }
    return $chatList;
}
Esempio n. 15
0
<?php

eval(getPluginConf($plugin["name"]));
require_once '../plugins/trafic/ratios.php';
$st = getSettingsPath();
makeDirectory(array($st . '/trafic', $st . '/trafic/trackers', $st . '/trafic/torrents'));
$req = new rXMLRPCRequest($theSettings->getScheduleCommand("trafic", $updateInterval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg($rootPath . '/plugins/trafic/update.php') . ' ' . escapeshellarg(getUser()) . ' & exit 0}'));
if ($req->run() && !$req->fault) {
    $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
} else {
    $jResult .= "plugin.disable(); noty('trafic: '+theUILang.pluginCantStart,'error');";
}
$jResult .= "plugin.collectStatForTorrents = " . ($collectStatForTorrents ? "true;" : "false;");
$jResult .= "plugin.updateInterval = " . $updateInterval . ";";
$jResult .= "plugin.disableClearButton = " . ($disableClearButton ? "true" : "false") . ";";
Esempio n. 16
0
 protected static function getTrackers()
 {
     $files = array();
     $dir = getSettingsPath() . '/trafic/trackers';
     $dh = @opendir($dir);
     if ($dh) {
         while (false !== ($file = readdir($dh))) {
             $path = $dir . '/' . $file;
             if ($file != ".." && $file != "." && is_file($path)) {
                 $files[] = basename($path, ".csv");
             }
         }
     }
     sort($files, SORT_STRING);
     $files = array_map('quoteAndDeslashEachItem', $files);
     return implode(",", $files) . "]}";
 }
<?php

require_once 'util.php';
$s = @file_get_contents(getSettingsPath() . "/uisettings.json");
if ($s == false) {
    $s = '{}';
}
if (!ini_get("zlib.output_compression")) {
    header("Content-Length: " . strlen($s));
}
header("Content-Type: application/json; charset=UTF-8");
echo $s;
Esempio n. 18
0
 public static function remove($list)
 {
     $tasks = array();
     $dir = getSettingsPath() . '/tasks/';
     if ($handle = @opendir($dir)) {
         while (false !== ($file = readdir($handle))) {
             if ($file != "." && $file != ".." && is_dir($dir . $file) && in_array($file, $list)) {
                 $tasks[] = $file;
             }
         }
         closedir($handle);
         foreach ($tasks as $id) {
             rTask::kill($id);
         }
         $tasks = self::obtain();
     }
     return $tasks;
 }
Esempio n. 19
0
 protected static function getTrackers()
 {
     $files = array();
     $dir = getSettingsPath() . '/trafic/trackers';
     $dh = @opendir($dir);
     if ($dh) {
         while (false !== ($file = readdir($dh))) {
             $path = $dir . '/' . $file;
             if ($file != ".." && $file != "." && is_file($path)) {
                 $files[] = basename($path, ".csv");
             }
         }
     }
     sort($files, SORT_STRING);
     return $files;
 }
function testRemoteRequests($remoteRequests)
{
    $jResult = "";
    $st = getSettingsPath() . '/';
    foreach ($remoteRequests as $exe => $errs) {
        $file = $st . $exe . ".founded";
        if (!is_file($file)) {
            foreach ($errs as $err) {
                $jResult .= $err;
            }
        } else {
            @unlink($file);
        }
    }
    return $jResult;
}
Esempio n. 21
0
<?php

$path = dirname(realpath($argv[0]));
if (chdir($path)) {
    if (count($argv) > 1) {
        $_SERVER['REMOTE_USER'] = $argv[1];
    }
    require_once dirname(__FILE__) . '/../../php/xmlrpc.php';
    require_once 'stat.php';
    eval(getPluginConf('trafic'));
    $req = new rXMLRPCRequest(array(new rXMLRPCCommand("get_up_total"), new rXMLRPCCommand("get_down_total"), new rXMLRPCCommand("d.multicall", array("main", getCmd("d.get_hash="), getCmd("d.get_up_total="), getCmd("d.get_down_total=")))));
    $req->setParseByTypes();
    if ($req->run() && !$req->fault) {
        $dir = getSettingsPath() . '/trafic/';
        $was = array(0, 0, 0);
        $wasTorrents = array();
        if ($file = @fopen($dir . 'last.csv', "r")) {
            $was = fgetcsv($file, 100);
            while (($data = fgetcsv($file, 1000)) !== false) {
                $wasTorrents[$data[0]] = array_slice($data, 1);
            }
            fclose($file);
        }
        $tm = time();
        $needUpdate = $was[2] + 3600 >= $tm;
        $now = array_slice($req->i8s, 0, 2);
        $now[2] = $tm;
        $nowTorrents = array();
        for ($i = 0; $i < count($req->strings); $i++) {
            $nowTorrents[$req->strings[$i]] = array_slice($req->i8s, ($i + 1) * 2, 2);
        }
Esempio n. 22
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');";
}
Esempio n. 23
0
 protected function __construct($name, $maxLockTime)
 {
     $this->lockTime = $maxLockTime;
     $this->file = getSettingsPath() . '/' . $name . ".lock";
 }