Fix wrong check for yydecoderpath

This commit is contained in:
DariusIII
2017-01-24 13:31:48 +01:00
parent f060534f3f
commit dfcf67f21d
3 changed files with 7 additions and 5 deletions
+2
View File
@@ -1,3 +1,5 @@
2017-01-24 DariusIII
* Fix: Fix wrong check for yydecoderpath
2017-01-18 DariusIII
* Chg: Prevent undefined index output on nzb-import page
* Chg: Add back construct to RequestIDLocal
+2 -2
View File
@@ -41,8 +41,8 @@ if (defined('NN_INSTALLER') && NN_INSTALLER !== false) {
case extension_loaded('simple_php_yenc_decode'):
$adapter = 'SimplePhpYencDecode';
break;
case !empty(Settings::value('..yydecoderpath', true)) &&
(strpos(Settings::value('..yydecoderpath', true), 'simple_php_yenc_decode') === false):
case !empty(Settings::value('apps..yydecoderpath', true)) &&
(strpos(Settings::value('apps..yydecoderpath', true), 'simple_php_yenc_decode') === false):
$adapter = 'Ydecode';
break;
default:
+3 -3
View File
@@ -43,13 +43,13 @@ class Ydecode extends \lithium\core\Object
public static function decode(&$text, $ignore = false)
{
if (!preg_match('/^(=yBegin.*=yEnd[^$]*)$/ims', $text, $input)) {
throw new \Exception('Text does not look like yEnc.');
throw new \UnexpectedValueException('Text does not look like yEnc.');
}
$data = shell_exec(
"echo '{$input[1]}' | '" . self::$pathBin . "' -o - " . ($ignore ? "-b " : " ") . self::$silent
);
if ($data === null) {
throw new \Exception('Error getting data from yydecode.');
throw new \LengthException('Error getting data from yydecode.');
}
return $data;
@@ -79,7 +79,7 @@ class Ydecode extends \lithium\core\Object
{
parent::_init();
$path = Settings::value('..yydecoderpath', true);
$path = Settings::value('apps..yydecoderpath', true);
if (!empty($path) && strpos($path, 'simple_php_yenc_decode') === false) {
if (file_exists($path) && is_executable($path)) {
self::$silent = (Utility::isWin() ? '' : ' > /dev/null 2>&1');