diff --git a/README.md b/README.md index df7eef820..407d16432 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ Open Source billing software Requirements ================================================================================ -* PHP 5.6 | Does not support PHP 7.x +* PHP 7.2 * Linux Operating System (64-bit) | Does not support Windows Operating Systems. * PHP extensions: - * mcrypt + * openssl * curl * zlib * PDO @@ -20,10 +20,10 @@ Requirements Recommended ================================================================================ -* PHP 5.6 +* PHP 7.2 * CentOS 64-bit Operating System * PHP Extensions - * mcrypt + * openssl * curl * zlib * PDO diff --git a/src/bb-di.php b/src/bb-di.php index 7f921430b..1ab3b20ce 100644 --- a/src/bb-di.php +++ b/src/bb-di.php @@ -139,18 +139,20 @@ $di['twig'] = function () use ($di) { $config = $di['config']; $options = $config['twig']; - $loader = new Twig_Loader_String(); - $twig = new Twig_Environment($loader, $options); + $loader = new Twig\Loader\ArrayLoader(); + $twig = new Twig\Environment($loader, $options); $box_extensions = new Box_TwigExtensions(); $box_extensions->setDi($di); - $twig->addExtension(new Twig_Extension_Optimizer()); - $twig->addExtension(new Twig_Extensions_Extension_I18n()); - $twig->addExtension(new Twig_Extensions_Extension_Debug()); + //$twig->addExtension(new Twig\Extension\OptimizerExtension()); + $twig->addExtension(new \Twig\Extension\StringLoaderExtension()); + $twig->addExtension(new Twig\Extension\DebugExtension()); + $twig->addExtension(new Twig\Extensions\I18nExtension()); $twig->addExtension($box_extensions); - $twig->getExtension('core')->setDateFormat($config['locale_date_format']); - $twig->getExtension('core')->setTimezone($config['timezone']); + $twig->getExtension(Twig\Extension\CoreExtension::class)->setDateFormat($config['locale_date_format']); + $twig->getExtension(Twig\Extension\CoreExtension::class)->setTimezone($config['timezone']); + // add globals if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { @@ -165,6 +167,8 @@ $di['twig'] = function () use ($di) { $di['is_client_logged'] = function() use($di) { if(!$di['auth']->isClientLoggedIn()) { + $url = $di['url']->link('login'); + header("Location: $url"); throw new Exception('Client is not logged in'); } return true; @@ -183,7 +187,7 @@ $di['loggedin_client'] = function() use ($di) { return $di['db']->getExistingModelById('Client', $client_id); }; $di['loggedin_admin'] = function() use ($di) { - if(php_sapi_name() == 'cli') { + if(php_sapi_name() == 'cli' || substr(php_sapi_name(), 0, 3) == 'cgi') { return $di['mod_service']('staff')->getCronAdmin(); } @@ -338,6 +342,6 @@ $di['translate'] = $di->protect(function($textDomain = '') use ($di) { return $tr; }); $di['array_get'] = $di->protect(function (array $array, $key, $default = null) use ($di) { - return isset ($array[$key]) ? $array[$key] : $default; + return array_key_exists($key, $array) ? $array[$key] : $default; }); -return $di; +return $di; \ No newline at end of file diff --git a/src/bb-library/Box/AppAdmin.php b/src/bb-library/Box/AppAdmin.php index 38994ef90..92bb8f6fa 100644 --- a/src/bb-library/Box/AppAdmin.php +++ b/src/bb-library/Box/AppAdmin.php @@ -22,7 +22,7 @@ class Box_AppAdmin extends Box_App public function render($fileName, $variableArray = array()) { - $template = $this->getTwig()->loadTemplate($fileName.'.phtml'); + $template = $this->getTwig()->load($fileName.'.phtml'); return $template->render($variableArray); } @@ -56,4 +56,4 @@ class Box_AppAdmin extends Box_App return $twig; } -} +} \ No newline at end of file diff --git a/src/bb-library/Box/AppClient.php b/src/bb-library/Box/AppClient.php index 1af78965c..44b3e9eb7 100644 --- a/src/bb-library/Box/AppClient.php +++ b/src/bb-library/Box/AppClient.php @@ -57,7 +57,12 @@ class Box_AppClient extends Box_App } catch(Exception $e) { if(BB_DEBUG) error_log($e); } - throw new \Box_Exception('Page :url not found', array(':url'=>$page), 404); + // throw new \Box_Exception('Page :url not found', array(':url'=>$page), 404); + $e = new \Box_Exception('Page :url not found', array(':url'=>$this->url), 404); + + error_log($e->getMessage()); + header("HTTP/1.0 404 Not Found"); + return $this->render('404', array('exception'=>$e)); } /** @@ -66,8 +71,8 @@ class Box_AppClient extends Box_App public function render($fileName, $variableArray = array(), $ext = 'phtml') { try { - $template = $this->getTwig()->loadTemplate($fileName.'.'.$ext); - } catch (\Twig_Error_Loader $e) { + $template = $this->getTwig()->load($fileName.'.'.$ext); + } catch (Twig\Error\LoaderError $e) { error_log($e->getMessage()); throw new \Box_Exception('Page not found', null, 404); } diff --git a/src/bb-library/Box/BeanHelper.php b/src/bb-library/Box/BeanHelper.php index e392cb5a5..856857ac7 100644 --- a/src/bb-library/Box/BeanHelper.php +++ b/src/bb-library/Box/BeanHelper.php @@ -57,7 +57,7 @@ class Box_BeanHelper extends \RedBeanPHP\BeanHelper\SimpleFacadeBeanHelper imple { $string[0] = strtoupper($string[0]); } - $func = create_function('$c', 'return strtoupper($c[1]);'); + $func = function($c){ return strtoupper($c[1]); }; return preg_replace_callback('/_([a-z])/', $func, $string); } } \ No newline at end of file diff --git a/src/bb-library/Box/Crypt.php b/src/bb-library/Box/Crypt.php index 048190771..51890a47a 100644 --- a/src/bb-library/Box/Crypt.php +++ b/src/bb-library/Box/Crypt.php @@ -15,10 +15,12 @@ class Box_Crypt implements \Box\InjectionAwareInterface { protected $di = NULL; + const METHOD = 'aes-256-cbc'; + public function __construct() { - if (!extension_loaded('mcrypt')) { - throw new Box_Exception('php mcrypt extension must be enabled on your server'); + if (!extension_loaded('openssl')) { + throw new Box_Exception('php openssl extension must be enabled on your server'); } } @@ -35,11 +37,19 @@ class Box_Crypt implements \Box\InjectionAwareInterface public function encrypt($text, $pass = null) { $key = $this->_getSalt($pass); - $mode = MCRYPT_MODE_CBC; - $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, $mode); - $iv = mcrypt_create_iv($iv_size, MCRYPT_DEV_URANDOM); - $enc = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, $mode, $iv); - return base64_encode($iv . $enc); + + $ivsize = openssl_cipher_iv_length(self::METHOD); + $iv = openssl_random_pseudo_bytes($ivsize); + + $ciphertext = openssl_encrypt( + $text, + self::METHOD, + $key, + OPENSSL_RAW_DATA, + $iv + ); + + return base64_encode($iv . $ciphertext); } public function decrypt($text, $pass = null) @@ -48,17 +58,24 @@ class Box_Crypt implements \Box\InjectionAwareInterface return false; } $key = $this->_getSalt($pass); - $mode = MCRYPT_MODE_CBC; - $ciphertext_dec = base64_decode($text); - $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, $mode); - # retrieves the IV, iv_size should be created using mcrypt_get_iv_size() - $iv = substr($ciphertext_dec, 0, $iv_size); - # retrieves the cipher text (everything except the $iv_size in the front) - $ciphertext_dec = substr($ciphertext_dec, $iv_size); + $text = base64_decode($text); - # may remove 00h valued characters from end of plain text - return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $ciphertext_dec, $mode, $iv)); + $ivsize = openssl_cipher_iv_length(self::METHOD); + $iv = mb_substr($text, 0, $ivsize, '8bit'); + $ciphertext = mb_substr($text, $ivsize, null, '8bit'); + + $result = openssl_decrypt( + $ciphertext, + self::METHOD, + $key, + OPENSSL_RAW_DATA, + $iv + ); + + $result = trim($result); + + return $result; } private function _getSalt($pass = null) diff --git a/src/bb-library/Box/Requirements.php b/src/bb-library/Box/Requirements.php index 2a0642f44..149470a6a 100644 --- a/src/bb-library/Box/Requirements.php +++ b/src/bb-library/Box/Requirements.php @@ -38,10 +38,10 @@ class Box_Requirements implements \Box\InjectionAwareInterface 'curl', 'zlib', 'gettext', - 'mcrypt', + 'openssl', ), 'version' => PHP_VERSION, - 'min_version' => '5.3', + 'min_version' => '7.2', 'safe_mode' => ini_get('safe_mode'), ), 'writable_folders' => array( @@ -93,7 +93,7 @@ class Box_Requirements implements \Box\InjectionAwareInterface 'pdo_mysql' => extension_loaded('pdo_mysql'), 'zlib' => extension_loaded('zlib'), 'mbstring' => extension_loaded('mbstring'), - 'mcrypt' => extension_loaded('mcrypt'), + 'openssl' => extension_loaded('openssl'), 'gettext' => extension_loaded('gettext'), ); @@ -200,4 +200,4 @@ class Box_Requirements implements \Box\InjectionAwareInterface return ($configmod == $perm); } -} +} \ No newline at end of file diff --git a/src/bb-library/Box/Tools.php b/src/bb-library/Box/Tools.php index dec448d90..8f447739c 100644 --- a/src/bb-library/Box/Tools.php +++ b/src/bb-library/Box/Tools.php @@ -246,14 +246,14 @@ class Box_Tools public function autoLinkText($text) { $pattern = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#'; - $callback = create_function('$matches', ' + $callback = function($matches){ $url = array_shift($matches); $url_parts = parse_url($url); if(!isset($url_parts["scheme"])) { $url = "http://".$url; } - return sprintf(\'%s\', $url, $url); - '); + return sprintf('%s', $url, $url); + }; return preg_replace_callback($pattern, $callback, $text); } @@ -362,13 +362,13 @@ class Box_Tools if($capitalise_first_char) { $str[0] = strtoupper($str[0]); } - $func = create_function('$c', 'return strtoupper($c[1]);'); + $func = function($c){ return strtoupper($c[1]); }; return preg_replace_callback('/-([a-z])/', $func, $str); } public function from_camel_case($str) { $str[0] = strtolower($str[0]); - $func = create_function('$c', 'return "-" . strtolower($c[1]);'); + $func = function($c){ return "-" . strtolower($c[1]); }; return preg_replace_callback('/([A-Z])/', $func, $str); } diff --git a/src/bb-library/Box/TwigExtensions.php b/src/bb-library/Box/TwigExtensions.php index 806bdef40..c7c32230c 100644 --- a/src/bb-library/Box/TwigExtensions.php +++ b/src/bb-library/Box/TwigExtensions.php @@ -11,7 +11,7 @@ */ -class Box_TwigExtensions extends Twig_Extension implements \Box\InjectionAwareInterface +class Box_TwigExtensions extends Twig\Extension\AbstractExtension implements \Box\InjectionAwareInterface { protected $di; @@ -39,34 +39,34 @@ class Box_TwigExtensions extends Twig_Extension implements \Box\InjectionAwareIn public function getFilters() { return array( - 'alink' => new Twig_Filter_Function(array($this, 'twig_bb_admin_link_filter'), array('is_safe' => array('html'))), - 'link' => new Twig_Filter_Function(array($this, 'twig_bb_client_link_filter'), array('is_safe' => array('html'))), - 'gravatar' => new Twig_Filter_Function('twig_gravatar_filter'), - 'markdown' => new Twig_Filter_Function('twig_markdown_filter', array('needs_environment' => true, 'is_safe' => array('html'))), - 'truncate' => new Twig_Filter_Function('twig_truncate_filter', array('needs_environment' => true)), - 'timeago' => new Twig_Filter_Function('twig_timeago_filter'), - 'daysleft' => new Twig_Filter_Function('twig_daysleft_filter'), - 'size' => new Twig_Filter_Function('twig_size_filter'), - 'ipcountryname' => new Twig_Filter_Function(array($this, 'twig_ipcountryname_filter')), - 'number' => new Twig_Filter_Function('twig_number_filter'), - 'period_title' => new Twig_Filter_Function('twig_period_title', array('needs_environment' => true, 'is_safe' => array('html'))), - 'autolink' => new Twig_Filter_Function('twig_autolink_filter'), - 'bbmd' => new Twig_Filter_Function('twig_bbmd_filter', array('needs_environment' => true, 'is_safe' => array('html'))), + 'alink' => new Twig\TwigFilter('alink', array($this, 'twig_bb_admin_link_filter'), array('is_safe' => array('html'))), + 'link' => new Twig\TwigFilter('link', array($this, 'twig_bb_client_link_filter'), array('is_safe' => array('html'))), + 'gravatar' => new Twig\TwigFilter('gravatar','twig_gravatar_filter'), + 'markdown' => new Twig\TwigFilter('markdown','twig_markdown_filter', array('needs_environment' => true, 'is_safe' => array('html'))), + 'truncate' => new Twig\TwigFilter('truncate','twig_truncate_filter', array('needs_environment' => true)), + 'timeago' => new Twig\TwigFilter('timeago','twig_timeago_filter'), + 'daysleft' => new Twig\TwigFilter('daysleft','twig_daysleft_filter'), + 'size' => new Twig\TwigFilter('size', 'twig_size_filter'), + 'ipcountryname' => new Twig\TwigFilter('ipcountryname', array($this, 'twig_ipcountryname_filter')), + 'number' => new Twig\TwigFilter('number', 'twig_number_filter'), + 'period_title' => new Twig\TwigFilter('period_title', 'twig_period_title', array('needs_environment' => true, 'is_safe' => array('html'))), + 'autolink' => new Twig\TwigFilter('autolink', 'twig_autolink_filter'), + 'bbmd' => new Twig\TwigFilter('bbmd', 'twig_bbmd_filter', array('needs_environment' => true, 'is_safe' => array('html'))), - 'bb_date' => new Twig_Filter_Function(array($this, 'twig_bb_date')), - 'bb_datetime' => new Twig_Filter_Function(array($this, 'twig_bb_datetime')), + 'bb_date' => new Twig\TwigFilter('bb_date', array($this, 'twig_bb_date')), + 'bb_datetime' => new Twig\TwigFilter('bb_datetime', array($this, 'twig_bb_datetime')), - 'img_tag' => new Twig_Filter_Function('twig_img_tag', array('needs_environment' => false, 'is_safe' => array('html'))), - 'script_tag' => new Twig_Filter_Function('twig_script_tag', array('needs_environment' => false, 'is_safe' => array('html'))), - 'stylesheet_tag' => new Twig_Filter_Function('twig_stylesheet_tag', array('needs_environment' => false, 'is_safe' => array('html'))), + 'img_tag' => new Twig\TwigFilter('img_tag', 'twig_img_tag', array('needs_environment' => false, 'is_safe' => array('html'))), + 'script_tag' => new Twig\TwigFilter('script_tag', 'twig_script_tag', array('needs_environment' => false, 'is_safe' => array('html'))), + 'stylesheet_tag' => new Twig\TwigFilter('stylesheet_tag', 'twig_stylesheet_tag', array('needs_environment' => false, 'is_safe' => array('html'))), - 'mod_asset_url' => new Twig_Filter_Function('twig_mod_asset_url'), - 'asset_url' => new Twig_Filter_Function('twig_asset_url', array('needs_environment' => true, 'is_safe' => array('html'))), + 'mod_asset_url' => new Twig\TwigFilter('mod_asset_url', 'twig_mod_asset_url'), + 'asset_url' => new Twig\TwigFilter('asset_url', 'twig_asset_url', array('needs_environment' => true, 'is_safe' => array('html'))), - 'money' => new Twig_Filter_Function('twig_money', array('needs_environment' => true, 'is_safe' => array('html'))), - 'money_without_currency' => new Twig_Filter_Function('twig_money_without_currency', array('needs_environment' => true, 'is_safe' => array('html'))), - 'money_convert' => new Twig_Filter_Function('twig_money_convert', array('needs_environment' => true, 'is_safe' => array('html'))), - 'money_convert_without_currency' => new Twig_Filter_Function('money_convert_without_currency', array('needs_environment' => true, 'is_safe' => array('html'))), + 'money' => new Twig\TwigFilter('money', 'twig_money', array('needs_environment' => true, 'is_safe' => array('html'))), + 'money_without_currency' => new Twig\TwigFilter('money_without_currency','twig_money_without_currency', array('needs_environment' => true, 'is_safe' => array('html'))), + 'money_convert' => new Twig\TwigFilter('money_convert', 'twig_money_convert', array('needs_environment' => true, 'is_safe' => array('html'))), + 'money_convert_without_currency' => new Twig\TwigFilter('money_convert_without_currency', array('needs_environment' => true, 'is_safe' => array('html'))), ); } @@ -107,6 +107,9 @@ class Box_TwigExtensions extends Twig_Extension implements \Box\InjectionAwareIn function twig_bb_client_link_filter($link, $params = null) { + if($this->di['url'] === null) { + return null; + } return $this->di['url']->link($link, $params); } @@ -117,14 +120,14 @@ class Box_TwigExtensions extends Twig_Extension implements \Box\InjectionAwareIn } -function twig_period_title(Twig_Environment $env, $period) +function twig_period_title(Twig\Environment $env, $period) { $globals = $env->getGlobals(); $api_guest = $globals['guest']; return $api_guest->system_period_title(array('code'=>$period)); } -function twig_money_convert(Twig_Environment $env, $price, $currency = null) +function twig_money_convert(Twig\Environment $env, $price, $currency = null) { $globals = $env->getGlobals(); $api_guest = $globals['guest']; @@ -135,7 +138,7 @@ function twig_money_convert(Twig_Environment $env, $price, $currency = null) return $api_guest->currency_format(array("price" => $price, 'code'=>$currency, 'convert'=>true)); } -function money_convert_without_currency(Twig_Environment $env, $price, $currency = null, $without_currency = false) +function money_convert_without_currency(Twig\Environment $env, $price, $currency = null, $without_currency = false) { $globals = $env->getGlobals(); $api_guest = $globals['guest']; @@ -146,14 +149,14 @@ function money_convert_without_currency(Twig_Environment $env, $price, $currency return $api_guest->currency_format(array("price" => $price, 'code'=>$currency, 'convert'=>true, 'without_currency'=>true)); } -function twig_money(Twig_Environment $env, $price, $currency = null) +function twig_money(Twig\Environment $env, $price, $currency = null) { $globals = $env->getGlobals(); $api_guest = $globals['guest']; return $api_guest->currency_format(array("price" => $price, 'code'=>$currency, 'convert'=>false)); } -function twig_money_without_currency(Twig_Environment $env, $price, $currency = null) +function twig_money_without_currency(Twig\Environment $env, $price, $currency = null) { $globals = $env->getGlobals(); $api_guest = $globals['guest']; @@ -165,7 +168,7 @@ function twig_mod_asset_url($asset, $mod) return BB_URL . 'bb-modules/'.ucfirst($mod).'/assets/'.$asset; } -function twig_asset_url(Twig_Environment $env, $asset) +function twig_asset_url(Twig\Environment $env, $asset) { $globals = $env->getGlobals(); return BB_URL . 'bb-themes/'.$globals['current_theme'].'/assets/'.$asset; @@ -201,14 +204,18 @@ function twig_gravatar_filter($email, $size = null) function twig_autolink_filter($text) { $pattern = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#'; - $callback = create_function('$matches', ' + + $callback = function($matches) + { $url = array_shift($matches); $url_parts = parse_url($url); if(!isset($url_parts["scheme"])) { - $url = "http://".$url; + $url = 'http://' . $url; } - return sprintf(\'%s\', $url, $url); - '); + + return sprintf('%s', $url, $url); + }; + return preg_replace_callback($pattern, $callback, $text); } @@ -251,7 +258,9 @@ function twig_size_filter($value) function twig_markdown_filter(Twig_Environment $env, $value) { $markdownParser = new \Michelf\MarkdownExtra; - return $markdownParser->transform(htmlspecialchars($value, ENT_NOQUOTES)); + // Michelf Markdown version 1.7.0 and up + $markdownParser->hard_wrap = true; + return $markdownParser->transform($value); //htmlspecialchars($value, ENT_NOQUOTES) } function twig_truncate_filter(Twig_Environment $env, $value, $length = 30, $preserve = false, $separator = '...') diff --git a/src/bb-library/Box/TwigLoader.php b/src/bb-library/Box/TwigLoader.php index 932958df2..4a0a5bb8d 100644 --- a/src/bb-library/Box/TwigLoader.php +++ b/src/bb-library/Box/TwigLoader.php @@ -11,7 +11,7 @@ */ -class Box_TwigLoader extends Twig_Loader_Filesystem +class Box_TwigLoader extends Twig\Loader\FilesystemLoader { protected $options = array(); @@ -40,7 +40,7 @@ class Box_TwigLoader extends Twig_Loader_Filesystem } - protected function findTemplate($name) + protected function findTemplate($name, $throw = true) { // normalize name $name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/')); @@ -63,6 +63,6 @@ class Box_TwigLoader extends Twig_Loader_Filesystem } } - throw new Twig_Error_Loader(sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $paths))); + throw new \Twig\Error\LoaderError(sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $paths))); } } \ No newline at end of file diff --git a/src/bb-library/Model/ProductDomainTable.php b/src/bb-library/Model/ProductDomainTable.php index dceae81d9..8db838efb 100644 --- a/src/bb-library/Model/ProductDomainTable.php +++ b/src/bb-library/Model/ProductDomainTable.php @@ -89,7 +89,6 @@ class Model_ProductDomainTable extends Model_ProductTable { return isset($item['config']['free_transfer']) && $item['config']['free_transfer']; } - public function getPricingArray(Model_Product $product) { @@ -125,7 +124,7 @@ class Model_ProductDomainTable extends Model_ProductTable return $pricing; } - public function getProductPrice(Model_Product $product, array $config = array()) + public function getProductPrice(Model_Product $product, array $config = null) { $rtable = $this->di['mod_service']('servicedomain', 'Tld'); $tld = ''; @@ -162,7 +161,7 @@ class Model_ProductDomainTable extends Model_ProductTable return 0; } - public function getProductSetupPrice(Model_Product $product, array $config = array()) + public function getProductSetupPrice(Model_Product $product, array $config = null) { return 0; } @@ -171,4 +170,4 @@ class Model_ProductDomainTable extends Model_ProductTable { throw new \Box_Exception('Domain product can not be removed.'); } -} \ No newline at end of file +} diff --git a/src/bb-load.php b/src/bb-load.php index a577b8cb5..10a31ad6e 100644 --- a/src/bb-load.php +++ b/src/bb-load.php @@ -30,7 +30,8 @@ function handler_error($number, $message, $file, $line) return false; } -function handler_exception(Exception $e) +// Removed Exception type. Some errors are thrown as exceptions causing fatal errors. +function handler_exception($e) { if(APPLICATION_ENV == 'testing') { print $e->getMessage() . PHP_EOL; @@ -140,6 +141,8 @@ ini_set('error_log', BB_PATH_LOG . '/php_error.log'); if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { // Create lamba style unescaping function (for portability) $quotes_sybase = strtolower(ini_get('magic_quotes_sybase')); + + /* create_function deprecated in PHP 7.2 $unescape_function = (empty($quotes_sybase) || $quotes_sybase === 'off') ? 'stripslashes($value)' : 'str_replace("\'\'","\'",$value)'; $stripslashes_deep = create_function('&$value, $fn', ' if (is_string($value)) { @@ -147,7 +150,16 @@ if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { } else if (is_array($value)) { foreach ($value as &$v) $fn($v, $fn); } - '); + '); */ + + $stripslashes_deep = function(&$value, $fn){ + if (is_string($value)) { + $value = (empty($quotes_sybase) || $quotes_sybase === 'off') ? stripslashes($value) : str_replace("\'\'","\'",$value); + } else if (is_array($value)) { + foreach ($value as &$v) $fn($v, $fn); + } + }; + // Unescape data $stripslashes_deep($_POST, $stripslashes_deep); diff --git a/src/bb-modules/Client/Service.php b/src/bb-modules/Client/Service.php index 34bca119c..8c6ece390 100644 --- a/src/bb-modules/Client/Service.php +++ b/src/bb-modules/Client/Service.php @@ -265,7 +265,7 @@ class Service implements InjectionAwareInterface public function getExpiredPasswordReminders() { $expire_after_hours = 2; - $expired = $this->di['db']->find('ClientPasswordReset', 'UNIX_TIMESTAMP() - ? > created_at', array($expire_after_hours * 60 * 60)); + $expired = $this->di['db']->find('ClientPasswordReset', 'UNIX_TIMESTAMP() - ? > UNIX_TIMESTAMP(created_at)', array($expire_after_hours * 60 * 60)); return $expired; } diff --git a/src/bb-modules/Client/html_email/mod_client_confirm.phtml b/src/bb-modules/Client/html_email/mod_client_confirm.phtml index b159f98c8..4b3aacd44 100644 --- a/src/bb-modules/Client/html_email/mod_client_confirm.phtml +++ b/src/bb-modules/Client/html_email/mod_client_confirm.phtml @@ -1,6 +1,6 @@ {% block subject %}[{{ guest.system_company.name }}] Please confirm your email address {% endblock %} {% block content %} -{% filter markdown %} +{% apply markdown %} Hello {{ c.first_name }} {{ c.last_name }}, Please verify your email by clicking on the link below: @@ -12,5 +12,5 @@ Edit your profile at {{'client/me'|link}} {{ guest.system_company.signature }} -{% endfilter %} +{% endapply %} {% endblock %} \ No newline at end of file diff --git a/src/bb-modules/Client/html_email/mod_client_password_reset_approve.phtml b/src/bb-modules/Client/html_email/mod_client_password_reset_approve.phtml index 8c6f7ed2a..666c42a16 100644 --- a/src/bb-modules/Client/html_email/mod_client_password_reset_approve.phtml +++ b/src/bb-modules/Client/html_email/mod_client_password_reset_approve.phtml @@ -1,6 +1,6 @@ {% block subject %}[{{ guest.system_company.name }}] Password Changed{% endblock %} {% block content %} -{% filter markdown %} +{% apply markdown %} Hello {{ c.first_name }} {{ c.last_name }}, @@ -18,5 +18,5 @@ Edit your profile at {{ 'client/me'|link }} {{ guest.system_company.signature }} -{% endfilter %} +{% endapply %} {% endblock %} diff --git a/src/bb-modules/Client/html_email/mod_client_password_reset_request.phtml b/src/bb-modules/Client/html_email/mod_client_password_reset_request.phtml index 366ef4d73..df2688b9a 100644 --- a/src/bb-modules/Client/html_email/mod_client_password_reset_request.phtml +++ b/src/bb-modules/Client/html_email/mod_client_password_reset_request.phtml @@ -1,6 +1,6 @@ {% block subject %}[{{ guest.system_company.name }}] Confirm Password Reset{% endblock %} {% block content %} -{% filter markdown %} +{% apply markdown %} Hello {{ c.first_name }} {{ c.last_name }}, @@ -19,5 +19,5 @@ Edit your profile at {{'client/me'|link}} {{ guest.system_company.signature }} -{% endfilter %} +{% endapply %} {% endblock %} diff --git a/src/bb-modules/Client/html_email/mod_client_signup.phtml b/src/bb-modules/Client/html_email/mod_client_signup.phtml index 704aa5c8e..dc88928b1 100644 --- a/src/bb-modules/Client/html_email/mod_client_signup.phtml +++ b/src/bb-modules/Client/html_email/mod_client_signup.phtml @@ -1,6 +1,6 @@ {% block subject %}[{{ guest.system_company.name }}] Welcome {{ c.first_name }}{% endblock %} {% block content %} -{% filter markdown %} +{% apply markdown %} Hello {{ c.first_name }} {{ c.last_name }}, Thank you for signing up with us. Your new account has been setup and you can now login to our client area using the details below. @@ -22,5 +22,5 @@ Edit your profile at {{'client/me'|link}} {{ guest.system_company.signature }} -{% endfilter %} +{% endapply %} {% endblock %} \ No newline at end of file diff --git a/src/bb-modules/Currency/Service.php b/src/bb-modules/Currency/Service.php index 7fd48deb2..17fd6f97e 100644 --- a/src/bb-modules/Currency/Service.php +++ b/src/bb-modules/Currency/Service.php @@ -107,7 +107,7 @@ class Service implements InjectionAwareInterface $db = $this->di['db']; $default = $db->findOne('Currency', 'is_default = 1'); - if (count($default) == 0) { + if (is_array($default) && count($default) == 0) { $default = $db->load('Currency', '1'); } diff --git a/src/bb-modules/Currency/html_admin/mod_currency_manage.phtml b/src/bb-modules/Currency/html_admin/mod_currency_manage.phtml index e8a0f8400..fc39c50e1 100644 --- a/src/bb-modules/Currency/html_admin/mod_currency_manage.phtml +++ b/src/bb-modules/Currency/html_admin/mod_currency_manage.phtml @@ -39,7 +39,7 @@