diff --git a/lib/copy_this/newznab/controllers/Film.php b/lib/copy_this/newznab/controllers/Film.php index c23f96034..756bf8e78 100644 --- a/lib/copy_this/newznab/controllers/Film.php +++ b/lib/copy_this/newznab/controllers/Film.php @@ -419,6 +419,9 @@ class Film $newArr = []; $i = 0; foreach ($tmpArr as $ta) { + if (trim($ta) == '') { + continue; + } if ($i > 5) { break; } //only use first 6 diff --git a/lib/copy_this/newznab/controllers/Games.php b/lib/copy_this/newznab/controllers/Games.php index a1a38851c..29a233ed3 100644 --- a/lib/copy_this/newznab/controllers/Games.php +++ b/lib/copy_this/newznab/controllers/Games.php @@ -321,6 +321,9 @@ class Games $newArr = array(); $i = 0; foreach ($tmpArr as $ta) { + if (trim($ta) == '') { + continue; + } // Only use first 6. if ($i > 5) { break; diff --git a/lib/copy_this/newznab/controllers/Konsole.php b/lib/copy_this/newznab/controllers/Konsole.php index e173f86fb..290954a5f 100644 --- a/lib/copy_this/newznab/controllers/Konsole.php +++ b/lib/copy_this/newznab/controllers/Konsole.php @@ -278,6 +278,9 @@ class Konsole $newArr = array(); $i = 0; foreach ($tmpArr as $ta) { + if (trim($ta) == '') { + continue; + } // Only use first 6. if ($i > 5) { break; diff --git a/lib/copy_this/newznab/controllers/Movie.php b/lib/copy_this/newznab/controllers/Movie.php index ce01edef1..90d4029ea 100644 --- a/lib/copy_this/newznab/controllers/Movie.php +++ b/lib/copy_this/newznab/controllers/Movie.php @@ -54,7 +54,7 @@ class Movie $this->apikey = $site->tmdbkey; $this->lookuplanguage = $site->lookuplanguage; $this->pdo = new DB(); - $this->imgSavePath = WWW_DIR.'covers/movies/'; + $this->imgSavePath = NN_COVERS . 'movies' . DS; } /** @@ -378,6 +378,9 @@ class Movie $newArr = array(); $i = 0; foreach($tmpArr as $ta) { + if (trim($ta) == '') { + continue; + } if ($i > 5) { break; } //only use first 6 $newArr[] = ''.$ta.''; $i++; diff --git a/lib/copy_this/newznab/controllers/Musik.php b/lib/copy_this/newznab/controllers/Musik.php index 1c8628b99..4f92bcf6c 100644 --- a/lib/copy_this/newznab/controllers/Musik.php +++ b/lib/copy_this/newznab/controllers/Musik.php @@ -334,6 +334,9 @@ class Musik $newArr = array(); $i = 0; foreach ($tmpArr as $ta) { + if (trim($ta) == '') { + continue; + } if ($i > 5) { break; } //only use first 6 diff --git a/lib/copy_this/newznab/controllers/XXX.php b/lib/copy_this/newznab/controllers/XXX.php index c9c44665e..62080aa7a 100644 --- a/lib/copy_this/newznab/controllers/XXX.php +++ b/lib/copy_this/newznab/controllers/XXX.php @@ -297,6 +297,9 @@ class XXX $newArr = array(); $i = 0; foreach ($tmpArr as $ta) { + if (trim($ta) == '') { + continue; + } if ($field == "genre" ) { $ta = $this->getGenres(true,$ta); $ta = $ta["title"]; diff --git a/lib/copy_this/newznab/utility/Utility.php b/lib/copy_this/newznab/utility/Utility.php index ec807486d..c00f75df4 100644 --- a/lib/copy_this/newznab/utility/Utility.php +++ b/lib/copy_this/newznab/utility/Utility.php @@ -2,9 +2,10 @@ namespace newznab\utility; -/* - * General util functions. +/** * Class Utility + * + * @package newznab\utility */ class Utility { @@ -13,6 +14,29 @@ class Utility */ const PATH_REGEX = '(?P[A-Za-z]:|)(?P[/\w.-]+|)'; + /** + * Checks all levels of the supplied path are readable and executable by current user. + * + * @todo Make this recursive with a switch to only check end point. + * @param $path *nix path to directory or file + * + * @return bool|string True is successful, otherwise the part of the path that failed testing. + */ + static public function canExecuteRead($path) + { + $paths = preg_split('#/#', $path); + $fullPath = DS; + foreach ($paths as $path) { + if ($path !== '') { + $fullPath .= $path . DS; + if (!is_readable($fullPath) || !is_executable($fullPath)) { + return "The '$fullPath' directory must be readable and executable by all ." .PHP_EOL; + } + } + } + return true; + } + static public function clearScreen() { if (self::isCLI()) { diff --git a/lib/copy_this/www/automated.config.php b/lib/copy_this/www/automated.config.php index 2372b41b7..49e0e4f3b 100644 --- a/lib/copy_this/www/automated.config.php +++ b/lib/copy_this/www/automated.config.php @@ -73,11 +73,17 @@ define('WWW_TOP', $www_top); define('NN_VERSIONS', NN_LIB . 'build' . DS . 'newznab.xml'); -if (is_file(__DIR__ . DS . 'settings.php')) { - require_once(__DIR__ . DS . 'settings.php'); - // Remove this in the future, here for those not updating settings.php - if (!defined('NN_MAX_PAGER_RESULTS')) { - define('NN_MAX_PAGER_RESULTS', '125000'); +$settings_file = __DIR__ . DS . 'settings.php'; +if (is_file($settings_file)) { + require_once($settings_file); + if (php_sapi_name() == 'cli') { + $current_settings_file_version = 1; // Update this when updating settings.php.example + if (!defined('NN_SETTINGS_FILE_VERSION') || NN_SETTINGS_FILE_VERSION != $current_settings_file_version) { + echo ("\033[0;31mNotice: Your $settings_file file is either out of date or you have not updated" . + " NN_SETTINGS_FILE_VERSION to $current_settings_file_version in that file.\033[0m" . PHP_EOL + ); + } + unset($current_settings_file_version); } } else { define('ITEMS_PER_PAGE', '50'); @@ -106,6 +112,7 @@ if (is_file(__DIR__ . DS . 'settings.php')) { 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'; require_once SMARTY_DIR . 'autoloader.php'; diff --git a/lib/copy_this/www/settings.php.example b/lib/copy_this/www/settings.php.example index bfccdfe40..d0784cde0 100644 --- a/lib/copy_this/www/settings.php.example +++ b/lib/copy_this/www/settings.php.example @@ -3,6 +3,21 @@ //////////////////////////// Copy this file to settings.php and edit the options. ////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /**********************************************************************************************************************/ + +/**********************************************************************************************************************/ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////// MISC ////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * When we update settings.php.example, we will raise this version, you will get a message saying your settings.php + * is out of date, you will need to update it and change the version number. + * + * @note Developers: When updating settings.php.example, up this version + * and $current_settings_file_version in automated.config.php + * @version 1 + */ +define('NN_SETTINGS_FILE_VERSION', 1); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////// Web Settings ////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -513,4 +528,15 @@ define('PHPMAILER_SMTP_USER',''); * * @default '' */ -define('PHPMAILER_SMTP_PASSWORD', ''); \ No newline at end of file +define('PHPMAILER_SMTP_PASSWORD', ''); + +/*********************************************************************************************************************** +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////// Change log //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +2015-05-05 v1 Track settings.php.example changes. + Add support for quick and low_priority on MySQL DELETE queries. + Search for @version 1 in this file to quickly find these additions. + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ \ No newline at end of file