/** * process a request * * @return mixed */ function instance_processRequest() { global $cfg; // action-switch switch ($this->_action) { /* netstat */ case "netstat": return $this->_netstat(); /* transfers */ /* transfers */ case "transfers": return $this->_transfers(); /* start */ /* start */ case "start": if (empty($this->_args[0])) { array_push($this->_argErrors, "missing argument: name of transfer. (extra-arg 1)"); break; } else { return $this->_transferStart($this->_args[0], isset($this->_args[1]) ? $this->_args[1] : "", $this->_argc > 2 ? array_slice($this->_args, 2) : array()); } /* stop */ /* stop */ case "stop": if (empty($this->_args[0])) { array_push($this->_argErrors, "missing argument: name of transfer. (extra-arg 1)"); break; } else { return $this->_transferStop($this->_args[0]); } /* enqueue */ /* enqueue */ case "enqueue": if (empty($this->_args[0])) { array_push($this->_argErrors, "missing argument: name of transfer. (extra-arg 1)"); break; } else { return $this->_transferEnqueue($this->_args[0]); } /* dequeue */ /* dequeue */ case "dequeue": if (empty($this->_args[0])) { array_push($this->_argErrors, "missing argument: name of transfer. (extra-arg 1)"); break; } else { return $this->_transferDequeue($this->_args[0]); } /* reset */ /* reset */ case "reset": if (empty($this->_args[0])) { array_push($this->_argErrors, "missing argument: name of transfer. (extra-arg 1)"); break; } else { return $this->_transferReset($this->_args[0]); } /* delete */ /* delete */ case "delete": if (empty($this->_args[0])) { array_push($this->_argErrors, "missing argument: name of transfer. (extra-arg 1)"); break; } else { return $this->_transferDelete($this->_args[0]); } /* wipe */ /* wipe */ case "wipe": if (empty($this->_args[0])) { array_push($this->_argErrors, "missing argument: name of transfer. (extra-arg 1)"); break; } else { return $this->_transferWipe($this->_args[0]); } /* start-all */ /* start-all */ case "start-all": return $this->_transfersStart(isset($this->_args[0]) ? $this->_args[0] : "", $this->_argc > 1 ? array_slice($this->_args, 1) : array()); /* resume-all */ /* resume-all */ case "resume-all": return $this->_transfersResume(isset($this->_args[0]) ? $this->_args[0] : "", $this->_argc > 1 ? array_slice($this->_args, 1) : array()); /* stop-all */ /* stop-all */ case "stop-all": return $this->_transfersStop(); /* tset */ /* tset */ case "tset": if ($this->_argc < 3) { array_push($this->_argErrors, "missing argument(s) for tset."); break; } else { return $this->_tset($this->_args[0], $this->_args[1], $this->_args[2], isset($this->_args[3]) ? $this->_args[3] : "s"); } /* inject */ /* inject */ case "inject": if ($this->_argc < 2) { array_push($this->_argErrors, "missing argument(s) for inject."); break; } else { return $this->_inject($this->_args[0], $this->_args[1], isset($this->_args[2]) ? $this->_args[2] : "", $this->_argc > 3 ? array_slice($this->_args, 3) : array()); } /* watch */ /* watch */ case "watch": if ($this->_argc < 2) { array_push($this->_argErrors, "missing argument(s) for watch."); break; } else { return $this->_watch($this->_args[0], $this->_args[1], isset($this->_args[2]) ? $this->_args[2] : "ds", $this->_argc > 3 ? array_slice($this->_args, 3) : array()); } /* rss */ /* rss */ case "rss": if ($this->_argc < 4) { array_push($this->_argErrors, "missing argument(s) for rss."); break; } else { return $this->_rss($this->_args[0], $this->_args[1], $this->_args[2], $this->_args[3], isset($this->_args[4]) ? $this->_args[4] : ""); } /* xfer */ /* xfer */ case "xfer": if (empty($this->_args[0])) { array_push($this->_argErrors, "missing argument: time-delta of xfer to use : (all/total/month/week/day) (extra-arg 1)"); break; } else { return $this->_xfer($this->_args[0]); } /* repair */ /* repair */ case "repair": return $this->_repair(); /* maintenance */ /* maintenance */ case "maintenance": return $this->_maintenance(isset($this->_args[0]) && strtolower($this->_args[0]) == "true" ? true : false); /* dump */ /* dump */ case "dump": if (empty($this->_args[0])) { array_push($this->_argErrors, "missing argument: type. (settings/users) (extra-arg 1)"); break; } else { return $this->_dump($this->_args[0]); } /* filelist */ /* filelist */ case "filelist": printFileList(empty($this->_args[0]) ? $cfg['docroot'] : $this->_args[0], 1, 1); return true; /* checksums */ /* checksums */ case "checksums": printFileList(empty($this->_args[0]) ? $cfg['docroot'] : $this->_args[0], 2, 1); return true; /* version */ /* version */ case "version": case "-version": case "--version": case "-v": return $this->_printVersion(); /* help */ /* help */ case "help": case "-help": case "--help": case "-h": default: return $this->_printUsage(); } // help return $this->_printUsage(); }
/** * misc * * @param $action */ function sa_misc($action = "") { global $cfg, $error, $statusImage, $statusMessage, $htmlTitle, $htmlTop, $htmlMain; if ($action == "") { return; } buildPage("y"); switch ($action) { case "0": // misc-main $htmlTitle = "Miscellaneous Admin Tasks"; $htmlMain .= '<br>Select the task you wish to perform from below:<p>'; $htmlMain .= '<a href="' . _FILE_THIS . '?y=1"><img src="themes/' . $cfg["theme"] . '/images/arrow.gif" width="9" height="9" title="List files installed" border="0"> Lists</a> - view a list of currently installed torrentflux-b4rt files'; $htmlMain .= '<p>'; $htmlMain .= '<a href="' . _FILE_THIS . '?y=3"><img src="themes/' . $cfg["theme"] . '/images/arrow.gif" width="9" height="9" title="Checksum Validation" border="0"> Checksum Validation</a> - check the integrity of installed torrentflux-b4rt files'; $htmlMain .= '<p>'; $htmlMain .= '<a href="' . _FILE_THIS . '?y=5"><img src="themes/' . $cfg["theme"] . '/images/arrow.gif" width="9" height="9" title="Check Requirements" border="0"> Check Requirements</a> - check your server meets the requirements to run torrentflux-b4rt'; $htmlMain .= '<br><br>'; break; case "1": // misc - Lists $htmlTitle = "Misc - File Lists"; $htmlMain .= '<br>Select an option from below:<p>'; $htmlMain .= '<img src="themes/' . $cfg["theme"] . '/images/arrow.gif" width="9" height="9" title="Files" border="0"> Files ('; $htmlMain .= '<a href="' . _FILE_THIS . '?y=11" target="_blank">html</a>'; $htmlMain .= ' / '; $htmlMain .= '<a href="' . _FILE_THIS . '?y=12" target="_blank">text</a>'; $htmlMain .= ') - list files currently installed'; $htmlMain .= '<p>'; $htmlMain .= '<img src="themes/' . $cfg["theme"] . '/images/arrow.gif" width="9" height="9" title="Checksums" border="0"> Checksums ('; $htmlMain .= '<a href="' . _FILE_THIS . '?y=13" target="_blank">html</a>'; $htmlMain .= ' / '; $htmlMain .= '<a href="' . _FILE_THIS . '?y=14" target="_blank">text</a>'; $htmlMain .= ') - list checksums of files currently installed'; $htmlMain .= '<br><br>'; break; case "11": // Misc - File-List - html printFileList($cfg['docroot'], 1, 2); exit; case "12": // Misc - File-List - text @header("Content-Type: text/plain"); printFileList($cfg['docroot'], 1, 1); exit; case "13": // Misc - Checksums-List - html printFileList($cfg['docroot'], 2, 2); exit; case "14": // Misc - Checksums-List - text @header("Content-Type: text/plain"); printFileList($cfg['docroot'], 2, 1); exit; case "3": // Misc - Checksums $htmlTitle = "Misc - Checksum Validation"; $htmlMain .= '<p>'; $htmlMain .= '<a href="' . _FILE_THIS . '?y=35" target="_blank"><img src="themes/' . $cfg["theme"] . '/images/arrow.gif" width="9" height="9" title="Checksums of ' . _VERSION . '" border="0"> Checksums of ' . _VERSION . '</a>'; $htmlMain .= '<p>'; $htmlMain .= '<a href="' . _FILE_THIS . '?y=36" target="_blank"><img src="themes/' . $cfg["theme"] . '/images/arrow.gif" width="9" height="9" title="Validate local files" border="0"> Validate local files</a>'; $htmlMain .= '<br><br>'; break; case "35": // Misc - Checksums - Latest @header("Content-Type: text/plain"); echo getDataFromUrl(_SUPERADMIN_URLBASE . _FILE_CHECKSUMS_PRE . _VERSION . _FILE_CHECKSUMS_SUF); exit; case "36": // Misc - Checksums - Validate validateLocalFiles(); exit; case "5": // misc - Check $htmlTitle = "Misc - Check Requirements"; $htmlMain .= '<br>Select the requirements you wish to check from below:<p>'; $htmlMain .= "<strong>PHP Web</strong><br>Check your PHP web installation meets the requirements for web based activities in torrentflux-b4rt:<br>"; $htmlMain .= '<a href="' . _FILE_THIS . '?y=51"><img src="themes/' . $cfg["theme"] . '/images/arrow.gif" width="9" height="9" title="php-web" border="0"> Check PHP Web Requirements</a><br><br>'; $htmlMain .= "<strong>PHP CLI</strong><br>Check your PHP commandline binary installation meets the requirements for commandline based activities in torrentflux-b4rt:<br>"; $htmlMain .= '<a href="' . _FILE_THIS . '?y=52"><img src="themes/' . $cfg["theme"] . '/images/arrow.gif" width="9" height="9" title="php-cli" border="0"> Check PHP CLI Binary Requirements</a><br><br>'; $htmlMain .= "<strong>Perl</strong><br>Check your Perl installation meets the requirements for perl based activities in torrentflux-b4rt:<br>"; $htmlMain .= '<a href="' . _FILE_THIS . '?y=53"><img src="themes/' . $cfg["theme"] . '/images/arrow.gif" width="9" height="9" title="Perl" border="0"> Check Perl Requirements</a>'; $htmlMain .= '<br><br>'; break; case "51": // misc - Check - php-web $htmlTitle = "Misc - Check Requirements - PHP Web Installation"; $htmlMain .= '<div align="left" id="BodyLayer" name="BodyLayer" style="border: thin solid ' . $cfg['main_bgcolor'] . '; position:relative; width:740; height:498; padding-left: 5px; padding-right: 5px; z-index:1; overflow: scroll; visibility: visible">'; $htmlMain .= phpCheckWeb(); $htmlMain .= '</div>'; break; case "52": // misc - Check - php-cli $htmlTitle = "Misc - Check Requirements - PHP CLI Binary Installation"; $htmlMain .= '<div align="left" id="BodyLayer" name="BodyLayer" style="border: thin solid ' . $cfg['main_bgcolor'] . '; position:relative; width:740; height:498; padding-left: 5px; padding-right: 5px; z-index:1; overflow: scroll; visibility: visible">'; $htmlMain .= '<pre>'; $htmlMain .= tfb_htmlencode(safePhpCli($cfg["bin_php"], tfb_shellencode($cfg["docroot"] . "bin/check/check-cli.php"))); $htmlMain .= '</pre>'; $htmlMain .= '</div>'; break; case "53": // misc - Check - Perl $htmlTitle = "Misc - Check Requirements - Perl"; $htmlMain .= '<div align="left" id="BodyLayer" name="BodyLayer" style="border: thin solid ' . $cfg['main_bgcolor'] . '; position:relative; width:740; height:498; padding-left: 5px; padding-right: 5px; z-index:1; overflow: scroll; visibility: visible">'; $htmlMain .= '<pre>'; $htmlMain .= tfb_htmlencode(shell_exec($cfg["perlCmd"] . " " . tfb_shellencode($cfg["docroot"] . "bin/check/check.pl") . " all")); $htmlMain .= '</pre>'; $htmlMain .= '</div>'; break; case "531": // misc - Check - Perl - nzbperl $htmlTitle = "Misc - Check Requirements - Nzbperl"; $htmlMain .= '<div align="left" id="BodyLayer" name="BodyLayer" style="border: thin solid ' . $cfg['main_bgcolor'] . '; position:relative; width:740; height:498; padding-left: 5px; padding-right: 5px; z-index:1; overflow: scroll; visibility: visible">'; $htmlMain .= '<pre>'; $htmlMain .= tfb_htmlencode(shell_exec($cfg["perlCmd"] . " " . tfb_shellencode($cfg["docroot"] . "bin/check/check.pl") . " nzbperl")); $htmlMain .= '</pre>'; $htmlMain .= '</div>'; break; } printPage(); exit; }
} else { $list = readDirList($path, $setting->Exclude_Patterns, $map); if ($list === null) { print "[ERROR] Can not open directory for URI: {$uri}!"; } else { if ($uri != '/') { $fileStat = new FileStat(''); $fileStat->mtime = filemtime($path); $fileStat->img = $map->parent_img; $fileStat->size = -1; $base = substr($uri, 0, strlen($uri) - 1); $off = strrpos($base, '/'); if ($off !== FALSE) { $base = substr($base, 0, $off + 1); printOneEntry($base, "Parent Directory", $fileStat, $setting); } } $cmpFunc = "cmp{$sortOrder}"; usort($list, $cmpFunc); printFileList($list, $uri, $setting); } } if (isset($_SERVER['LS_FI_OFF']) && $_SERVER['LS_FI_OFF']) { echo "</ul>\n"; } else { echo "</pre><hr>"; } if (isset($setting->ReadmeName)) { printIncludes($path, $setting->ReadmeName); } echo "<address>Proudly Served by LiteSpeed Web Server at " . $_SERVER['SERVER_NAME'] . " Port " . $_SERVER['SERVER_PORT'] . "</address>\n</body>\n</html>";
GNU General Public License for more details. To read the license please visit http://www.gnu.org/copyleft/gpl.html *******************************************************************************/ // prevent invocation from web if (empty($argv[0])) { die; } if (isset($_REQUEST['argv'])) { die; } /******************************************************************************/ // change to docroot if needed if (!is_file(realpath(getcwd() . '/inc/functions/functions.tools.php'))) { chdir(realpath(dirname(__FILE__) . "/../..")); } // check for home if (!is_file('inc/functions/functions.tools.php')) { exit("Error: this script can only be used in its default-path (DOCROOT/bin/tools/)\n"); } // tools-functions require_once 'inc/functions/functions.tools.php'; // action if (isset($argv[1])) { printFileList($argv[1], 2, 1); } else { echo "missing param : dir\n"; } // exit exit;
GNU General Public License for more details. To read the license please visit http://www.gnu.org/copyleft/gpl.html *******************************************************************************/ // prevent invocation from web if (empty($argv[0])) { die; } if (isset($_REQUEST['argv'])) { die; } /******************************************************************************/ // change to docroot if needed if (!is_file(realpath(getcwd() . '/inc/functions/functions.tools.php'))) { chdir(realpath(dirname(__FILE__) . "/../..")); } // check for home if (!is_file('inc/functions/functions.tools.php')) { exit("Error: this script can only be used in its default-path (DOCROOT/bin/tools/)\n"); } // tools-functions require_once 'inc/functions/functions.tools.php'; // action if (isset($argv[1])) { printFileList($argv[1], 1, 1); } else { echo "missing param : dir\n"; } // exit exit;