<?php include 'conf.php'; $username = getUser(); if (strtolower($service1) == "rtorrent") { $svc1 = processExists($service1, $username); } else { $svc1 = processExists($service1, $service_name1); } $svc2 = processExists($service2, $service_name2); $svc3 = processExists($service3, $service_name3); if (strtolower($media) == "emby") { $svc4 = processExists("Emby", $service_name4); $medname = "Emby"; } elseif (strtolower($media) == "plex") { $svc4 = processExists("Plex", $service_name4); $medName = "Plex"; }
<?php if ($username == "{$master}") { echo "<li class=\"tooltips\" data-toggle=\"tooltip\" title=\"ruTorrent Plugins Menu\" data-placement=\"bottom\"><a data-toggle=\"tab\" data-target=\"#plugins\"><i class=\"tooltips fa fa-puzzle-piece\"></i></a></li>"; } ?> <li class="tooltips" data-toggle="tooltip" title="Help Commands & More" data-placement="bottom"><a data-toggle="tab" data-target="#help"><i class="tooltips fa fa-question-circle"></i></a></li> </ul> <div class="tab-content"> <!-- ################# MAIN MENU ################### --> <div class="tab-pane active" id="mainmenu"> <h5 class="sidebar-title">Main Menu</h5> <ul class="nav nav-pills nav-stacked nav-quirk"> <li class="active"><a href="index.php"><i class="fa fa-home"></i> <span>Dashboard</span></a></li> <li><a href="/rutorrent" target="_blank"><i class="fa fa-share"></i> <span>ruTorrent</span></a></li> <?php if (processExists("btsync", $username)) { echo "<li><a href=\"{$btsyncURL}\" target=\"_blank\"><i class=\"fa fa-retweet\"></i> <span>BTSync</span></a></li>"; } ?> <?php if (file_exists('.plex')) { echo "<li><a href=\"{$plexURL}\" target=\"_blank\"><i class=\"fa fa-play\"></i> <span>Plex</span></a></li>"; } ?> <li class="nav-parent"> <a href=""><i class="fa fa-download"></i> <span>Downloads</span></a> <ul class="children"> <li><a href="/<?php echo "{$username}"; ?> .downloads" target="_blank">ruTorrent</a></a></li>
} session_start_timeout(5); $MSGFILE = session_id(); function processExists($processName, $username) { $exists = false; exec("ps axo user:20,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,comm|grep {$username} | grep -iE {$processName} | grep -v grep", $pids); if (count($pids) > 0) { $exists = true; } return $exists; } $rtorrent = processExists("\"main|rtorrent\"", $username); $irssi = processExists("irssi", $username); $btsync = processExists("btsync", $username); $plex = processExists("Plex", $username); function isEnabled($search, $username) { $string = file_get_contents('/home/' . $username . '/.startup'); $service = $search; if (preg_match("/\\b" . $search . "\\b/", $string)) { return " <div class=\"toggle-wrapper pull-right\"><div class=\"toggle-en toggle-light primary\" onclick=\"location.href='?id=77&serviceend={$service}'\"></div></div>"; } else { return " <div class=\"toggle-wrapper pull-right\"><div class=\"toggle-dis toggle-light primary\" onclick=\"location.href='?id=66&servicestart={$service}'\"></div></div>"; } } function writeMsg($message) { $file = $GLOBALS['MSGFILE']; $Handle = fopen("/tmp/" . $file, 'w'); fwrite($Handle, $message);
<?php include '/srv/rutorrent/php/util.php'; include 'class.php'; $username = getUser(); function processExists($processName, $username) { $exists = false; exec("ps axo user:20,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,comm|grep {$username} | grep -iE {$processName} | grep -v grep", $pids); if (count($pids) > 0) { $exists = true; } return $exists; } $rtorrent = processExists("\"main|rtorrent\"", $username); $location = "/home"; $si_prefix = array('B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB'); $torrents = shell_exec("ls /home/" . $username . "/.sessions/*.torrent|wc -l"); $php_self = $_SERVER['PHP_SELF']; $web_path = substr($php_self, 0, strrpos($php_self, '/') + 1); $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $start = $time; if (file_exists('/usr/sbin/repquota')) { $dftotal = shell_exec("sudo /usr/sbin/repquota /|/bin/grep ^" . $username . "|/usr/bin/awk '{printf \$4/1024/1024}'"); $dffree = shell_exec("sudo /usr/sbin/repquota /|/bin/grep ^" . $username . "|/usr/bin/awk '{printf (\$4-\$3)/1024/1024}'"); $dfused = shell_exec("sudo /usr/sbin/repquota /|/bin/grep ^" . $username . "|/usr/bin/awk '{printf \$3/1024/1024}'"); $perused = sprintf('%1.0f', $dfused / $dftotal * 100); } else { $bytesfree = disk_free_space('/home');