Browse Source

Fixes

master
M@d D3n 5 years ago
parent
commit
934bda4f4b
  1. 45
      class/class.modules.php
  2. 2
      inc/init.php
  3. 6
      lib/Smarty/Config_File.class.php
  4. 4
      lib/Smarty/Smarty.class.php
  5. 16
      lib/Smarty/Smarty_Compiler.class.php
  6. 0
      lib/Smarty/debug.tpl
  7. 0
      lib/Smarty/internals/core.assemble_plugin_filepath.php
  8. 0
      lib/Smarty/internals/core.assign_smarty_interface.php
  9. 0
      lib/Smarty/internals/core.create_dir_structure.php
  10. 0
      lib/Smarty/internals/core.display_debug_console.php
  11. 0
      lib/Smarty/internals/core.get_include_path.php
  12. 0
      lib/Smarty/internals/core.get_microtime.php
  13. 0
      lib/Smarty/internals/core.get_php_resource.php
  14. 0
      lib/Smarty/internals/core.is_secure.php
  15. 0
      lib/Smarty/internals/core.is_trusted.php
  16. 0
      lib/Smarty/internals/core.load_plugins.php
  17. 0
      lib/Smarty/internals/core.load_resource_plugin.php
  18. 0
      lib/Smarty/internals/core.process_cached_inserts.php
  19. 0
      lib/Smarty/internals/core.process_compiled_include.php
  20. 0
      lib/Smarty/internals/core.read_cache_file.php
  21. 0
      lib/Smarty/internals/core.rm_auto.php
  22. 0
      lib/Smarty/internals/core.rmdir.php
  23. 0
      lib/Smarty/internals/core.run_insert_handler.php
  24. 0
      lib/Smarty/internals/core.smarty_include_php.php
  25. 0
      lib/Smarty/internals/core.write_cache_file.php
  26. 0
      lib/Smarty/internals/core.write_compiled_include.php
  27. 0
      lib/Smarty/internals/core.write_compiled_resource.php
  28. 0
      lib/Smarty/internals/core.write_file.php
  29. 0
      lib/Smarty/plugins/block.textformat.php
  30. 0
      lib/Smarty/plugins/compiler.assign.php
  31. 0
      lib/Smarty/plugins/function.assign_debug_info.php
  32. 0
      lib/Smarty/plugins/function.config_load.php
  33. 0
      lib/Smarty/plugins/function.counter.php
  34. 0
      lib/Smarty/plugins/function.cycle.php
  35. 0
      lib/Smarty/plugins/function.debug.php
  36. 0
      lib/Smarty/plugins/function.eval.php
  37. 0
      lib/Smarty/plugins/function.fetch.php
  38. 0
      lib/Smarty/plugins/function.html_checkboxes.php
  39. 0
      lib/Smarty/plugins/function.html_image.php
  40. 0
      lib/Smarty/plugins/function.html_options.php
  41. 0
      lib/Smarty/plugins/function.html_radios.php
  42. 0
      lib/Smarty/plugins/function.html_select_date.php
  43. 0
      lib/Smarty/plugins/function.html_select_time.php
  44. 0
      lib/Smarty/plugins/function.html_table.php
  45. 0
      lib/Smarty/plugins/function.mailto.php
  46. 37
      lib/Smarty/plugins/function.math.php
  47. 0
      lib/Smarty/plugins/function.popup.php
  48. 0
      lib/Smarty/plugins/function.popup_init.php
  49. 0
      lib/Smarty/plugins/modifier.capitalize.php
  50. 0
      lib/Smarty/plugins/modifier.cat.php
  51. 0
      lib/Smarty/plugins/modifier.count_characters.php
  52. 0
      lib/Smarty/plugins/modifier.count_paragraphs.php
  53. 0
      lib/Smarty/plugins/modifier.count_sentences.php
  54. 0
      lib/Smarty/plugins/modifier.count_words.php
  55. 0
      lib/Smarty/plugins/modifier.date_format.php
  56. 0
      lib/Smarty/plugins/modifier.debug_print_var.php
  57. 0
      lib/Smarty/plugins/modifier.default.php
  58. 0
      lib/Smarty/plugins/modifier.escape.php
  59. 0
      lib/Smarty/plugins/modifier.indent.php
  60. 0
      lib/Smarty/plugins/modifier.lower.php
  61. 0
      lib/Smarty/plugins/modifier.nl2br.php
  62. 0
      lib/Smarty/plugins/modifier.regex_replace.php
  63. 0
      lib/Smarty/plugins/modifier.replace.php
  64. 0
      lib/Smarty/plugins/modifier.spacify.php
  65. 0
      lib/Smarty/plugins/modifier.string_format.php
  66. 0
      lib/Smarty/plugins/modifier.strip.php
  67. 0
      lib/Smarty/plugins/modifier.strip_tags.php
  68. 0
      lib/Smarty/plugins/modifier.upper.php
  69. 0
      lib/Smarty/plugins/modifier.wordwrap.php
  70. 0
      lib/Smarty/plugins/outputfilter.trimwhitespace.php
  71. 0
      lib/Smarty/plugins/shared.escape_special_chars.php
  72. 0
      lib/Smarty/plugins/shared.make_timestamp.php

45
class/class.modules.php

@ -14,6 +14,8 @@
{
public $_modules = [];
private static $instance = null;
function __construct ()
{
@ -21,6 +23,15 @@
}
public static function init ()
{
if (is_null(self::$instance))
self::$instance = new AVE_Module;
return self::$instance;
}
/**
* Метод, который обрабатывает все module.php и записывает как свойство класса списки модулей
*/
@ -126,19 +137,21 @@
{
global $AVE_DB, $AVE_Template;
$assign = array(); // Массив для передачи в Smarty
$errors = array(); // Массив с ошибками
$assign = []; // Массив для передачи в Smarty
$errors = []; // Массив с ошибками
// Получаем список всех шаблонов
$sql = $AVE_DB->Query("
$sql = "
SELECT
Id,
template_title
FROM
" . PREFIX . "_templates
");
";
while ($row = $sql->FetchRow())
$query = $AVE_DB->Query($sql);
while ($row = $query->FetchRow())
$assign['all_templates'][$row->Id] = htmlspecialchars($row->template_title, ENT_QUOTES);
// Заголовок: Автор модуля
@ -147,7 +160,7 @@
// Получаем список всех модулей
$modules = $this->_modules;
foreach ($modules as $module)
foreach ($modules AS $module)
{
$module['info'] = $module['ModuleDescription'] . (! $module['ModuleAutor']
? '<br /><br />'
@ -364,7 +377,9 @@
global $AVE_DB, $AVE_Template;
// Подключаем файл с запросами к БД для данного модуля
$module_sql_update = array();
$module_sql_update = [];
$module = [];
$sql_file = BASE_DIR . '/modules/' . MODULE_PATH . '/sql.php';
@ -378,16 +393,16 @@
// Выполняем запросы обновления модуля
// из массива $module_sql_update файла sql.php
foreach ($module_sql_update as $sql)
{
$AVE_DB->Query(str_replace('%%PRFX%%', PREFIX, $sql));
}
}
// Обновляем модуль, если в нем не применяется (отсутствует) файл sql.php
elseif (file_exists($mod_file) && file_exists($sql_file) === false)
{
include_once ($mod_file);
include ($mod_file);
$AVE_DB->Query("
if (isset ($module) && ! empty($module))
{
$sql = "
UPDATE
" . PREFIX . "_module
SET
@ -402,7 +417,11 @@
ModuleStatus = '1'
WHERE
ModuleSysName = '" . MODULE_PATH . "'
");
";
$AVE_DB->Query($sql);
}
}
// Сохраняем системное сообщение в журнал
reportLog ($AVE_Template->get_config_vars('MODULES_ACTION_UPDATE') . ' (' . MODULE_PATH . ')');
@ -514,7 +533,7 @@
foreach ($files as $file)
{
if(substr($file, -1) == '/')
moduleRemove($file);
$this->moduleRemove($file);
else
unlink($file);
}

2
inc/init.php

@ -433,5 +433,5 @@
//-- Класс Модулей
require (BASE_DIR . '/class/class.modules.php');
$AVE_Module = new AVE_Module;
$AVE_Module = AVE_Module::init();
?>

6
lib/Smarty/Config_File.class.php

@ -22,14 +22,14 @@
* smarty-discussion-subscribe@googlegroups.com
*
* @link http://www.smarty.net/
* @version 2.6.26
* @version 2.6.25-dev
* @copyright Copyright: 2001-2005 New Digital Group, Inc.
* @author Andrei Zmievski <andrei@php.net>
* @access public
* @package Smarty
*/
/* $Id: Config_File.class.php 3149 2009-05-23 20:59:25Z monte.ohrt $ */
/* $Id$ */
/**
* Config file reading class
@ -73,7 +73,7 @@ class Config_File {
*
* @param string $config_path (optional) path to the config files
*/
function __construct($config_path = NULL)
public function __construct($config_path = NULL)
{
if (isset($config_path))
$this->set_path($config_path);

4
lib/Smarty/Smarty.class.php

@ -27,7 +27,7 @@
* @author Monte Ohrt <monte at ohrt dot com>
* @author Andrei Zmievski <andrei@php.net>
* @package Smarty
* @version 2.6.30
* @version 2.6.31-dev
*/
/* $Id$ */
@ -465,7 +465,7 @@ class Smarty
*
* @var string
*/
var $_version = '2.6.30';
var $_version = '2.6.31';
/**
* current template inclusion depth

16
lib/Smarty/Smarty_Compiler.class.php

@ -259,14 +259,9 @@ class Smarty_Compiler extends Smarty {
preg_match_all($search, $source_content, $match, PREG_SET_ORDER);
$this->_folded_blocks = $match;
reset($this->_folded_blocks);
/* replace special blocks by "{php}" */
$source_content = preg_replace_callback($search, create_function ('$matches', "return '"
. $this->_quote_replace($this->left_delimiter) . 'php'
. "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'"
. $this->_quote_replace($this->right_delimiter)
. "';")
$source_content = preg_replace_callback($search, array($this,'_preg_callback')
, $source_content);
/* Gather all template tags. */
@ -556,7 +551,7 @@ class Smarty_Compiler extends Smarty {
case 'php':
/* handle folded tags replaced by {php} */
list(, $block) = each($this->_folded_blocks);
$block = array_shift($this->_folded_blocks);
$this->_current_line_no += substr_count($block[0], "\n");
/* the number of matched elements in the regexp in _compile_file()
determins the type of folded tag that was found */
@ -754,7 +749,12 @@ class Smarty_Compiler extends Smarty {
return true;
}
function _preg_callback ($matches) {
return $this->_quote_replace($this->left_delimiter)
. 'php'
. str_repeat("\n", substr_count($matches[1], "\n"))
. $this->_quote_replace($this->right_delimiter);
}
/**
* compile custom function tag
*

0
lib/Smarty/debug.tpl

0
lib/Smarty/internals/core.assemble_plugin_filepath.php

0
lib/Smarty/internals/core.assign_smarty_interface.php

0
lib/Smarty/internals/core.create_dir_structure.php

0
lib/Smarty/internals/core.display_debug_console.php

0
lib/Smarty/internals/core.get_include_path.php

0
lib/Smarty/internals/core.get_microtime.php

0
lib/Smarty/internals/core.get_php_resource.php

0
lib/Smarty/internals/core.is_secure.php

0
lib/Smarty/internals/core.is_trusted.php

0
lib/Smarty/internals/core.load_plugins.php

0
lib/Smarty/internals/core.load_resource_plugin.php

0
lib/Smarty/internals/core.process_cached_inserts.php

0
lib/Smarty/internals/core.process_compiled_include.php

0
lib/Smarty/internals/core.read_cache_file.php

0
lib/Smarty/internals/core.rm_auto.php

0
lib/Smarty/internals/core.rmdir.php

0
lib/Smarty/internals/core.run_insert_handler.php

0
lib/Smarty/internals/core.smarty_include_php.php

0
lib/Smarty/internals/core.write_cache_file.php

0
lib/Smarty/internals/core.write_compiled_include.php

0
lib/Smarty/internals/core.write_compiled_resource.php

0
lib/Smarty/internals/core.write_file.php

0
lib/Smarty/plugins/block.textformat.php

0
lib/Smarty/plugins/compiler.assign.php

0
lib/Smarty/plugins/function.assign_debug_info.php

0
lib/Smarty/plugins/function.config_load.php

0
lib/Smarty/plugins/function.counter.php

0
lib/Smarty/plugins/function.cycle.php

0
lib/Smarty/plugins/function.debug.php

0
lib/Smarty/plugins/function.eval.php

0
lib/Smarty/plugins/function.fetch.php

0
lib/Smarty/plugins/function.html_checkboxes.php

0
lib/Smarty/plugins/function.html_image.php

0
lib/Smarty/plugins/function.html_options.php

0
lib/Smarty/plugins/function.html_radios.php

0
lib/Smarty/plugins/function.html_select_date.php

0
lib/Smarty/plugins/function.html_select_time.php

0
lib/Smarty/plugins/function.html_table.php

0
lib/Smarty/plugins/function.mailto.php

37
lib/Smarty/plugins/function.math.php

@ -18,11 +18,11 @@
* @author Monte Ohrt <monte at ohrt dot com>
*
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
* @param Smarty
*
* @return string|null
*/
function smarty_function_math($params, $template)
function smarty_function_math($params, &$smarty)
{
static $_allowed_funcs =
array('int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true,
@ -58,12 +58,28 @@ function smarty_function_math($params, $template)
return;
}
foreach ($params as $key => $val) {
if ($key != "equation" && $key != "format" && $key != "assign") {
// make sure value is not empty
if (strlen($val) == 0) {
trigger_error("math: parameter '{$key}' is empty", E_USER_WARNING);
return;
}
if (!is_numeric($val)) {
trigger_error("math: parameter '{$key}' is not numeric", E_USER_WARNING);
return;
}
}
}
// match all vars in equation, make sure all are passed
preg_match_all('!(?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)!', $equation, $match);
foreach ($match[ 1 ] as $curr_var) {
if ($curr_var && !isset($params[ $curr_var ]) && !isset($_allowed_funcs[ $curr_var ])) {
trigger_error("math: function call $curr_var not allowed", E_USER_WARNING);
trigger_error("math: function call '{$curr_var}' not allowed, or missing parameter '{$curr_var}'", E_USER_WARNING);
return;
}
@ -71,17 +87,6 @@ function smarty_function_math($params, $template)
foreach ($params as $key => $val) {
if ($key != "equation" && $key != "format" && $key != "assign") {
// make sure value is not empty
if (strlen($val) == 0) {
trigger_error("math: parameter $key is empty", E_USER_WARNING);
return;
}
if (!is_numeric($val)) {
trigger_error("math: parameter $key: is not numeric", E_USER_WARNING);
return;
}
$equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
}
}
@ -92,13 +97,13 @@ function smarty_function_math($params, $template)
if (empty($params[ 'assign' ])) {
return $smarty_math_result;
} else {
$template->assign($params[ 'assign' ], $smarty_math_result);
$smarty->assign($params[ 'assign' ], $smarty_math_result);
}
} else {
if (empty($params[ 'assign' ])) {
printf($params[ 'format' ], $smarty_math_result);
} else {
$template->assign($params[ 'assign' ], sprintf($params[ 'format' ], $smarty_math_result));
$smarty->assign($params[ 'assign' ], sprintf($params[ 'format' ], $smarty_math_result));
}
}
}

0
lib/Smarty/plugins/function.popup.php

0
lib/Smarty/plugins/function.popup_init.php

0
lib/Smarty/plugins/modifier.capitalize.php

0
lib/Smarty/plugins/modifier.cat.php

0
lib/Smarty/plugins/modifier.count_characters.php

0
lib/Smarty/plugins/modifier.count_paragraphs.php

0
lib/Smarty/plugins/modifier.count_sentences.php

0
lib/Smarty/plugins/modifier.count_words.php

0
lib/Smarty/plugins/modifier.date_format.php

0
lib/Smarty/plugins/modifier.debug_print_var.php

0
lib/Smarty/plugins/modifier.default.php

0
lib/Smarty/plugins/modifier.escape.php

0
lib/Smarty/plugins/modifier.indent.php

0
lib/Smarty/plugins/modifier.lower.php

0
lib/Smarty/plugins/modifier.nl2br.php

0
lib/Smarty/plugins/modifier.regex_replace.php

0
lib/Smarty/plugins/modifier.replace.php

0
lib/Smarty/plugins/modifier.spacify.php

0
lib/Smarty/plugins/modifier.string_format.php

0
lib/Smarty/plugins/modifier.strip.php

0
lib/Smarty/plugins/modifier.strip_tags.php

0
lib/Smarty/plugins/modifier.upper.php

0
lib/Smarty/plugins/modifier.wordwrap.php

0
lib/Smarty/plugins/outputfilter.trimwhitespace.php

0
lib/Smarty/plugins/shared.escape_special_chars.php

0
lib/Smarty/plugins/shared.make_timestamp.php

Loading…
Cancel
Save