/** * Runs a Sphinx command. This suppresses various lines of output from the * Sphinx binaries. * * @param string $cmd The command to run. * @param boolean $stdout If ``true`` (default), print to stdout. * @return array An array of lines returned from the popen process. */ public function runCmd($cmd, $stdout = true) { $output = []; $handle = popen($cmd, "r"); while ($line = fgets($handle)) { if (\newznab\utility\Utility::startsWith($line, "Sphinx") || \newznab\utility\Utility::startsWith($line, "Copyright") || \newznab\utility\Utility::startsWith($line, "\n") || startsWith($line, "using config")) { continue; } $output[] = $line; if ($stdout) { printf("%s", $line); } } return $output; }
if (!Utility::endsWith($pdo->getSetting('sabvdir'), "/")) { $pdo->getSetting('sabvdir'); } $basepath = $pdo->getSetting('sabcompletedir'); $webpath = $pdo->getSetting('sabvdir'); $subpath = ""; if (isset($_REQUEST["sp"])) { $subpath = urldecode($_REQUEST["sp"]); } $listmode = true; if (isset($_REQUEST["lm"])) { $listmode = $_REQUEST["lm"] == "1"; } $path = $basepath . $subpath; $webpath .= $subpath; if (!Utility::startsWith(realpath($path), realpath($basepath))) { $page->show403(); } $files = glob(preg_replace('/(\\*|\\?|\\[)/', '[$1]', $path) . "/*"); $items = array(); $dirs = array(); foreach ($files as $f) { $i = array(); $i["name"] = basename($f); $i["isdir"] = is_dir($f) ? 1 : 0; $i["fullname"] = $f; $i["webpath"] = $webpath . "/" . $i["name"] . ($i["isdir"] == 1 ? "/" : ""); $i["mtime"] = filemtime($f); $i["pathinfo"] = pathinfo($f); if ($i["isdir"] == 1) { $i["pathinfo"]["extension"] = "";