/** * Get Raw html of webpage * * @param bool $usepost * * @return bool */ private function getUrl($usepost = false) { if (isset($this->_trailUrl)) { $ch = curl_init(self::POPURL . $this->_trailUrl); } else { $ch = curl_init(self::IF18); } if ($usepost === true) { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $this->_postParams); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_USERAGENT, "Firefox/2.0.0.1"); curl_setopt($ch, CURLOPT_FAILONERROR, 1); if (isset($this->cookie)) { curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookie); curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookie); } curl_setopt_array($ch, newznab\utility\Utility::curlSslContextOptions()); $this->_response = curl_exec($ch); if (!$this->_response) { curl_close($ch); return false; } curl_close($ch); $this->_html->load($this->_response); return true; }
foreach ($check as $type) { switch ($type) { case R: readable($folder); break; case W: writable($folder); break; case E: executable($folder); break; } } } echo 'Your permissions seem right for this user. Note, this script does not verify all paths, only the most important ones.' . PHP_EOL; if (!newznab\utility\Utility::isWin()) { $user = posix_getpwuid(posix_geteuid()); if ($user['name'] !== 'www-data') { echo 'If you have not already done so, please rerun this script using the www-data user: sudo -u www-data php verify_permissions.php yes' . PHP_EOL; } } function readable($folder) { if (!is_readable($folder)) { exit('Error: This path is not readable: (' . $folder . ') resolve this and rerun the script.' . PHP_EOL); } } function writable($folder) { if (!is_writable($folder)) { exit('Error: This path is not writable: (' . $folder . ') resolve this and rerun the script.' . PHP_EOL);
define('NN_LOGQUERIES', false); define('NN_LOGAUTOLOADER', false); define('NN_QUERY_STRIP_WHITESPACE', false); define('NN_RENAME_PAR2', true); define('NN_RENAME_MUSIC_MEDIAINFO', true); define('NN_CACHE_EXPIRY_SHORT', 300); define('NN_CACHE_EXPIRY_MEDIUM', 600); define('NN_CACHE_EXPIRY_LONG', 900); define('NN_PREINFO_OPEN', false); define('NN_FLOOD_CHECK', false); define('NN_FLOOD_WAIT_TIME', 5); define('NN_FLOOD_MAX_REQUESTS_PER_SECOND', 5); define('NN_USE_SQL_TRANSACTIONS', true); define('NN_RELEASE_SEARCH_TYPE', 0); define('NN_MAX_PAGER_RESULTS', '125000'); } unset($settings_file); require_once NN_CORE . 'autoloader.php'; require_once NN_LIBS . 'autoloader.php'; define('HAS_WHICH', newznab\utility\Utility::hasWhich() ? true : false); if (file_exists(__DIR__ . DS . 'config.php')) { require_once __DIR__ . DS . 'config.php'; } // Check if they updated config.php for the openssl changes. Only check 1 to save speed. if (!defined('NN_SSL_VERIFY_PEER')) { define('NN_SSL_CAFILE', ''); define('NN_SSL_CAPATH', ''); define('NN_SSL_VERIFY_PEER', '0'); define('NN_SSL_VERIFY_HOST', '0'); define('NN_SSL_ALLOW_SELF_SIGNED', '1'); }
private static function check_bin($binPath = '') { $binPath = $binPath ?: '/usr/bin/git'; $resource = proc_open('which git', [1 => ['pipe', 'w']], $pipes); $stdout = stream_get_contents($pipes[1]); foreach ($pipes as $pipe) { fclose($pipe); } $status = trim(proc_close($resource)); if (!$status) { $binPath = trim($stdout); } if (strpos($binPath, ' ') !== false) { $binPath = newznab\utility\Utility::isWin() ? '"' . $binPath . '"' : str_replace(' ', '\\ ', $binPath); } self::set_bin($binPath); return $binPath; }