Browse Source

Fixes

master
M@d D3n 6 years ago
parent
commit
0296ba4ddb
  1. 4
      README.md
  2. 307
      admin/browser.php
  3. 104
      admin/dbsettings.php
  4. 4
      admin/index.php
  5. 38
      admin/templates/css/main.css
  6. 3
      admin/templates/modules/modules.tpl
  7. 6
      admin/templates/request/conditions.tpl
  8. 2
      admin/templates/rubs/change.tpl
  9. 43
      admin/templates/rubs/field_template.tpl
  10. 14
      admin/templates/rubs/fields_list.tpl
  11. 4
      admin/templates/settings/pagination_edit.tpl
  12. 4
      admin/templates/settings/settings_case.tpl
  13. 4
      admin/templates/settings/settings_countries.tpl
  14. 4
      admin/templates/settings/settings_lang.tpl
  15. 4
      admin/templates/settings/settings_main.tpl
  16. 4
      admin/templates/settings/settings_pagination.tpl
  17. 2
      admin/templates/sysblocks/list.tpl
  18. 269
      class/class.core.php
  19. 2047
      class/class.database.php
  20. 958
      class/class.dbdump.php
  21. 127
      class/class.debug.php
  22. 13
      class/class.docs.php
  23. 58
      class/class.modules.php
  24. 1453
      class/class.request.php
  25. 84
      class/class.rubs.php
  26. 3
      class/class.thumbnail.php
  27. 149
      fields/checkbox/field.php
  28. 5
      fields/checkbox/tpl/field-doc.tpl
  29. 5
      fields/checkbox/tpl/field-req.tpl
  30. 2
      fields/checkbox/tpl/field.tpl
  31. 163
      fields/checkbox_multi/field.php
  32. 0
      fields/checkbox_multi/lang/bg.txt
  33. 0
      fields/checkbox_multi/lang/cz.txt
  34. 0
      fields/checkbox_multi/lang/en.txt
  35. 0
      fields/checkbox_multi/lang/pl.txt
  36. 0
      fields/checkbox_multi/lang/ru.txt
  37. 0
      fields/checkbox_multi/lang/ua.txt
  38. 0
      fields/checkbox_multi/tpl/field-doc.tpl
  39. 0
      fields/checkbox_multi/tpl/field-req.tpl
  40. 0
      fields/checkbox_multi/tpl/field.tpl
  41. 146
      fields/code/field.php
  42. 6
      fields/code/tpl/field-doc.tpl
  43. 6
      fields/code/tpl/field-req.tpl
  44. 219
      fields/date/field.php
  45. 288
      fields/doc_from_rub/field.php
  46. 295
      fields/doc_from_rub_check/field.php
  47. 358
      fields/doc_from_rub_search/field.php
  48. 127
      fields/doc_from_rub_search/js/outside.js
  49. 76
      fields/download/field.php
  50. 3
      fields/download/lang/bg.txt
  51. 2
      fields/download/lang/cz.txt
  52. 2
      fields/download/lang/en.txt
  53. 2
      fields/download/lang/pl.txt
  54. 2
      fields/download/lang/ru.txt
  55. 2
      fields/download/lang/ua.txt
  56. 7
      fields/download/tpl/field.tpl
  57. 168
      fields/drop_down/field.php
  58. 122
      fields/drop_down_key/field.php
  59. 79
      fields/flash/field.php
  60. 2
      fields/flash/lang/bg.txt
  61. 2
      fields/flash/lang/cz.txt
  62. 2
      fields/flash/lang/pl.txt
  63. 2
      fields/flash/lang/ru.txt
  64. 2
      fields/flash/lang/ua.txt
  65. 6
      fields/flash/tpl/field.tpl
  66. 25
      fields/image_mega/field.php
  67. 2
      fields/image_mega/js/field.js
  68. 571
      fields/image_multi/field.php
  69. 231
      fields/image_multi/js/outside.js
  70. 300
      fields/image_single/field.php
  71. 194
      fields/link/field.php
  72. 18
      fields/link_multi/css/field.css
  73. 194
      fields/link_multi/field.php
  74. 31
      fields/link_multi/js/field.js
  75. 8
      fields/link_multi/lang/ru.txt
  76. 33
      fields/link_multi/tpl/field-doc-181.tpl
  77. 5
      fields/link_multi/tpl/field-doc.tpl
  78. 5
      fields/link_multi/tpl/field-req.tpl
  79. 29
      fields/link_multi/tpl/field.tpl
  80. 163
      fields/multi_checkbox/field.php
  81. 140
      fields/multi_line/field.php
  82. 135
      fields/multi_line_simple/field.php
  83. 138
      fields/multi_line_slim/field.php
  84. 284
      fields/multi_list/field.php
  85. 260
      fields/multi_list_single/field.php
  86. 75
      fields/multi_list_single/js/outside.js
  87. 291
      fields/multi_list_triple/field.php
  88. 75
      fields/multi_list_triple/js/outside.js
  89. 236
      fields/multi_select/field.php
  90. 222
      fields/single_line/field.php
  91. 4
      fields/single_line/tpl/field-doc.tpl
  92. 4
      fields/single_line/tpl/field-req.tpl
  93. 211
      fields/single_line_numeric/field.php
  94. 134
      fields/single_line_numeric_three/field.php
  95. 26
      fields/single_line_numeric_three/js/field.js
  96. 3
      fields/single_line_numeric_three/lang/bg.txt
  97. 2
      fields/single_line_numeric_three/lang/cz.txt
  98. 2
      fields/single_line_numeric_three/lang/en.txt
  99. 2
      fields/single_line_numeric_three/lang/pl.txt
  100. 2
      fields/single_line_numeric_three/lang/ru.txt
  101. Some files were not shown because too many files have changed in this diff Show More

4
README.md

@ -1,4 +1,4 @@
# AVE.cms v3.2 # AVE.cms v3.24
###### Многофункциональная, система управления сайтом. ###### Многофункциональная, система управления сайтом.
## Оглавление ## Оглавление
@ -75,4 +75,4 @@ Google+: [Google+](https://plus.google.com/106406255345948508717)
--- ---
Copyright © 2007-2017 [Ave-Cms.Ru](https://ave-cms.ru) | [AVE.cms 3.2](https://ave-cms.ru) Copyright © 2007-2018 [Ave-Cms.Ru](https://ave-cms.ru) | [AVE.cms 3.24](https://ave-cms.ru)

307
admin/browser.php

@ -1,192 +1,201 @@
<?php <?php
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
if (!defined('ACP') || !check_permission('mediapool_int')) if (! defined('ACP') || !check_permission('mediapool_int'))
{ {
header('Location:index.php'); header('Location:index.php');
exit; exit;
} }
global $AVE_DB, $AVE_Template; global $AVE_DB, $AVE_Template;
ob_start(); ob_start();
ob_implicit_flush(0); ob_implicit_flush(0);
$_REQUEST['onlycontent'] = 1; $_REQUEST['onlycontent'] = 1;
$max_size = 128; // максимальный размер миниатюры $max_size = 128; // максимальный размер миниатюры
$thumb_size = '-t' . $max_size . 'x' . $max_size; // формат миниатюр $thumb_size = '-t' . $max_size . 'x' . $max_size; // формат миниатюр
$images_ext = array('jpg', 'jpeg', 'png', 'gif', 'JPG', 'JPEG', 'PNG', 'GIF'); $images_ext = array('jpg', 'jpeg', 'png', 'gif', 'JPG', 'JPEG', 'PNG', 'GIF');
$upload_path = BASE_DIR . '/' . UPLOAD_DIR; $upload_path = BASE_DIR . '/' . UPLOAD_DIR;
$lang = empty($_SESSION['admin_language']) ? 'ru' : $_SESSION['admin_language']; $lang = empty($_SESSION['admin_language'])
? 'ru'
: $_SESSION['admin_language'];
$AVE_Template = new AVE_Template(BASE_DIR . '/admin/templates/browser'); $AVE_Template = new AVE_Template(BASE_DIR . '/admin/templates/browser');
$AVE_Template->config_load(BASE_DIR . '/admin/lang/' . $lang . '/main.txt'); $AVE_Template->config_load(BASE_DIR . '/admin/lang/' . $lang . '/main.txt');
$AVE_Template->assign('tpl_dir', 'templates/'); $AVE_Template->assign('tpl_dir', 'templates/');
$AVE_Template->assign('ABS_PATH', '../'); $AVE_Template->assign('ABS_PATH', '../');
if (!isset($_REQUEST['action'])) $_REQUEST['action'] = ''; if (! isset($_REQUEST['action']))
$_REQUEST['action'] = '';
switch ($_REQUEST['action']) switch ($_REQUEST['action'])
{ {
case 'list': case 'list':
$dir = (empty($_REQUEST['dir']) $dir = (empty($_REQUEST['dir'])
|| strpos($_REQUEST['dir'], '..') !== false || strpos($_REQUEST['dir'], '..') !== false
|| strpos($_REQUEST['dir'], '//') !== false) ? '/' : $_REQUEST['dir']; || strpos($_REQUEST['dir'], '//') !== false) ? '/' : $_REQUEST['dir'];
$path = $upload_path . (is_dir($upload_path . $dir) ? $dir : '/'); $path = $upload_path . (is_dir($upload_path . $dir) ? $dir : '/');
$new_dir = $path . (isset($_REQUEST['newdir']) ? $_REQUEST['newdir'] : ''); $new_dir = $path . (isset($_REQUEST['newdir']) ? $_REQUEST['newdir'] : '');
$new_dir_rezult = (!is_dir($new_dir) && !mkdir($new_dir, 0777)); $new_dir_rezult = (!is_dir($new_dir) && !mkdir($new_dir, 0777));
$skip_entry = array(THUMBNAIL_DIR, 'recycled', 'index.php'); $skip_entry = array(THUMBNAIL_DIR, 'recycled', 'index.php');
$dirs = array(); $dirs = array();
$files = array(); $files = array();
$d = @dir($path); $d = @dir($path);
while (false !== ($entry = @$d->read()))
{
if (in_array($entry, $skip_entry) || $entry{0} === '.') continue;
if (is_dir($path . $entry)) while (false !== ($entry = @$d->read()))
{ {
$dirs[$entry] = 'index.php?do=browser&type=' . $_REQUEST['type'] if (in_array($entry, $skip_entry) || $entry{0} === '.')
. '&amp;action=list&amp;dir=' . $dir . $entry . '/'; continue;
}
else
{
$nameParts = explode('.', $entry);
$ext = strtolower(end($nameParts));
$file['icon'] = file_exists("templates/images/mediapool/{$ext}.gif") ? $ext : 'attach';
$file['filesize'] = @round(@filesize($path . $entry)/1024, 2);
$file['moddate'] = date("d.m.y, H:i", @filemtime($path . $entry));
if (in_array($ext, $images_ext)) if (is_dir($path . $entry))
{ {
$nameParts[count($nameParts)-2] .= $thumb_size; $dirs[$entry] = 'index.php?do=browser&type=' . $_REQUEST['type']
$file['bild'] = '/' . UPLOAD_DIR . $dir . THUMBNAIL_DIR . '/' . implode('.', $nameParts); . '&amp;action=list&amp;dir=' . $dir . $entry . '/';
} }
else else
{ {
$file['bild'] = 'templates/images/file.gif'; $nameParts = explode('.', $entry);
$ext = strtolower(end($nameParts));
$file['icon'] = file_exists("templates/images/mediapool/{$ext}.gif") ? $ext : 'attach';
$file['filesize'] = @round(@filesize($path . $entry)/1024, 2);
$file['moddate'] = date("d.m.y, H:i", @filemtime($path . $entry));
if (in_array($ext, $images_ext))
{
$nameParts[count($nameParts)-2] .= $thumb_size;
$file['bild'] = '/' . UPLOAD_DIR . $dir . THUMBNAIL_DIR . '/' . implode('.', $nameParts);
}
else
{
$file['bild'] = 'templates/images/file.gif';
}
$files[$entry] = $file;
} }
}
$d->close();
ksort($dirs);
ksort($files);
$files[$entry] = $file; $AVE_Template->assign('new_dir_rezult', $new_dir_rezult);
$AVE_Template->assign('recycled', strpos($dir, '/recycled/') === 0);
$AVE_Template->assign('dirs', $dirs);
$AVE_Template->assign('files', $files);
$AVE_Template->assign('max_size', $max_size);
$AVE_Template->assign('dir', $dir);
$AVE_Template->assign('dirup', rtrim(dirname($dir), '\\/') . '/');
$AVE_Template->assign('mediapath', UPLOAD_DIR);
$AVE_Template->display('browser.tpl');
break;
case 'upload':
if (check_permission('mediapool_add'))
{
$AVE_Template->display('browser_upload.tpl');
}
else
{
echo '<script type="text/javascript">window.close();</script>';
} }
} break;
$d->close();
case 'upload2':
ksort($dirs); header('Location:index.php?do=browser&type=image&target=' . $_REQUEST['target'] . '&tval=/' . UPLOAD_DIR . $_REQUEST['tval']);
ksort($files); break;
$AVE_Template->assign('new_dir_rezult', $new_dir_rezult); case 'delfile':
$AVE_Template->assign('recycled', strpos($dir, '/recycled/') === 0); if (check_permission('mediapool_del'))
$AVE_Template->assign('dirs', $dirs);
$AVE_Template->assign('files', $files);
$AVE_Template->assign('max_size', $max_size);
$AVE_Template->assign('dir', $dir);
$AVE_Template->assign('dirup', rtrim(dirname($dir), '\\/') . '/');
$AVE_Template->assign('mediapath', UPLOAD_DIR);
$AVE_Template->display('browser.tpl');
break;
case 'upload':
if (check_permission('mediapool_add'))
{
$AVE_Template->display('browser_upload.tpl');
}else{
echo '<script type="text/javascript">window.close();</script>';
}
break;
case 'upload2':
header('Location:index.php?do=browser&type=image&target=' . $_REQUEST['target'] . '&tval=/' . UPLOAD_DIR . $_REQUEST['tval']);
break;
case 'delfile':
if (check_permission('mediapool_del'))
{
if (empty($_REQUEST['file']) || empty($_REQUEST['dir'])) exit(0);
$file_name = basename($_REQUEST['file']);
$del_file = $upload_path . $_REQUEST['dir'] . $file_name;
if (strpos($del_file, '..') !== false || !is_file($del_file)) exit(0);
$recycled_path = $upload_path . '/recycled/';
if (!is_dir($recycled_path) && !mkdir($recycled_path)) exit(0);
do {$nameParts = explode('.', $file_name);
$nameParts[count($nameParts)-2] .= '-' . uniqid(rand());
$recycled_file_name = implode('.', $nameParts);
} while (file_exists($recycled_path . $recycled_file_name));
@copy($del_file, $recycled_path . $recycled_file_name);
if (@unlink($del_file))
{ {
$nameParts = explode('.', $file_name); if (empty($_REQUEST['file']) || empty($_REQUEST['dir']))
$ext = strtolower(end($nameParts)); exit(0);
if (in_array($ext, $images_ext))
$file_name = basename($_REQUEST['file']);
$del_file = $upload_path . $_REQUEST['dir'] . $file_name;
if (strpos($del_file, '..') !== false || !is_file($del_file)) exit(0);
$recycled_path = $upload_path . '/recycled/';
if (!is_dir($recycled_path) && !mkdir($recycled_path)) exit(0);
do {$nameParts = explode('.', $file_name);
$nameParts[count($nameParts)-2] .= '-' . uniqid(rand());
$recycled_file_name = implode('.', $nameParts);
} while (file_exists($recycled_path . $recycled_file_name));
@copy($del_file, $recycled_path . $recycled_file_name);
if (@unlink($del_file))
{ {
$nameParts[count($nameParts)-2] .= $thumb_size; $nameParts = explode('.', $file_name);
@unlink($upload_path . $_REQUEST['dir'] . THUMBNAIL_DIR . '/' . implode('.', $nameParts)); $ext = strtolower(end($nameParts));
if (in_array($ext, $images_ext))
{
$nameParts[count($nameParts)-2] .= $thumb_size;
@unlink($upload_path . $_REQUEST['dir'] . THUMBNAIL_DIR . '/' . implode('.', $nameParts));
}
reportLog($_SESSION['user_name'] . ' - удалил файл ('
. UPLOAD_DIR . $_REQUEST['dir'] . $file_name . ')');
} }
reportLog($_SESSION['user_name'] . ' - удалил файл ('
. UPLOAD_DIR . $_REQUEST['dir'] . $file_name . ')');
} }
}
echo '<script type="text/javascript"> echo '<script type="text/javascript">
parent.frames[\'zf\'].location.href="index.php?do=browser&type=', $_REQUEST['type'], '&action=list&dir=', $_REQUEST['dir'], '"; parent.frames[\'zf\'].location.href="index.php?do=browser&type=', $_REQUEST['type'], '&action=list&dir=', $_REQUEST['dir'], '";
</script>'; </script>';
break; break;
default: default:
@list($target, $target_id) = explode('__', $_REQUEST['target']); @list($target, $target_id) = explode('__', $_REQUEST['target']);
$tval = '/'; $tval = '/';
if (!empty($_REQUEST['tval']) && 0 === strpos($_REQUEST['tval'], '/' . UPLOAD_DIR . '/')) if (!empty($_REQUEST['tval']) && 0 === strpos($_REQUEST['tval'], '/' . UPLOAD_DIR . '/'))
{ {
if (is_dir(BASE_DIR . '/' . $_REQUEST['tval'])) { if (is_dir(BASE_DIR . '/' . $_REQUEST['tval'])) {
$tval = rtrim(substr($_REQUEST['tval'], strlen('/' . UPLOAD_DIR)), '\\/') . '/'; $tval = rtrim(substr($_REQUEST['tval'], strlen('/' . UPLOAD_DIR)), '\\/') . '/';
} }
if (is_file(BASE_DIR . '/' . $_REQUEST['tval'])) { if (is_file(BASE_DIR . '/' . $_REQUEST['tval'])) {
$tval = rtrim(dirname(substr($_REQUEST['tval'], strlen('/' . UPLOAD_DIR))), '\\/') . '/'; $tval = rtrim(dirname(substr($_REQUEST['tval'], strlen('/' . UPLOAD_DIR))), '\\/') . '/';
}
} }
}
$AVE_Template->assign('dir', $tval); $AVE_Template->assign('dir', $tval);
$AVE_Template->assign('target', $target); $AVE_Template->assign('target', $target);
$AVE_Template->assign('target_id', $target_id); $AVE_Template->assign('target_id', $target_id);
$AVE_Template->assign('cppath', substr($_SERVER['PHP_SELF'], 0, -18)); $AVE_Template->assign('cppath', substr($_SERVER['PHP_SELF'], 0, -18));
$AVE_Template->assign('mediapath', UPLOAD_DIR); $AVE_Template->assign('mediapath', UPLOAD_DIR);
$AVE_Template->display('browser_2frames.tpl'); $AVE_Template->display('browser_2frames.tpl');
break; break;
} }
$out = ob_get_clean(); $out = ob_get_clean();
echo $out; echo $out;
?> ?>

104
admin/dbsettings.php

@ -1,70 +1,70 @@
<?php <?php
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
if (!defined('ACP')) if (! defined('ACP'))
{ {
header('Location:index.php'); header('Location:index.php');
exit; exit;
} }
check_permission_acp('db_actions'); check_permission_acp('db_actions');
$AVE_Template->config_load(BASE_DIR . '/admin/lang/' . $_SESSION['admin_language'] . '/dbactions.txt', 'db'); $AVE_Template->config_load(BASE_DIR . '/admin/lang/' . $_SESSION['admin_language'] . '/dbactions.txt', 'db');
require(BASE_DIR . '/class/class.dbdump.php'); require (BASE_DIR . '/class/class.dbdump.php');
$AVE_DB_Service = new AVE_DB_Service;
if (!empty($_REQUEST['action'])) $AVE_DB_Service = new AVE_DB_Service;
{
switch ($_REQUEST['action']) if (!empty($_REQUEST['action']))
{ {
case 'optimize': switch ($_REQUEST['action'])
$AVE_DB_Service->databaseTableOptimize(); {
break; case 'optimize':
$AVE_DB_Service->databaseTableOptimize();
break;
case 'repair': case 'repair':
$AVE_DB_Service->databaseTableRepair(); $AVE_DB_Service->databaseTableRepair();
break; break;
case 'dump_top': case 'dump_top':
$AVE_DB_Service->databaseDumpExport(1); $AVE_DB_Service->databaseDumpExport(1);
exit; exit;
case 'dump': case 'dump':
$AVE_DB_Service->databaseDumpExport(); $AVE_DB_Service->databaseDumpExport();
exit; exit;
case 'restore': case 'restore':
$AVE_DB_Service->databaseDumpImport(BASE_DIR . "/" . ATTACH_DIR . "/"); $AVE_DB_Service->databaseDumpImport(BASE_DIR . "/" . ATTACH_DIR . "/");
break; break;
case 'download': case 'download':
$AVE_DB_Service->databaseDumpFileSave($_REQUEST['file']); $AVE_DB_Service->databaseDumpFileSave($_REQUEST['file']);
break; break;
case 'restorefile': case 'restorefile':
$AVE_DB_Service->databaseDumpFileImport($_REQUEST['file']); $AVE_DB_Service->databaseDumpFileImport($_REQUEST['file']);
break; break;
case 'deletefile': case 'deletefile':
$AVE_DB_Service->databaseDumpFileDelete($_REQUEST['file']); $AVE_DB_Service->databaseDumpFileDelete($_REQUEST['file']);
break; break;
}
} }
}
$AVE_Template->assign('db_size', get_mysql_size());
$AVE_Template->assign('files', $AVE_DB_Service->databaseFilesGet());
$AVE_Template->assign('tables', $AVE_DB_Service->databaseTableGet());
$AVE_Template->assign('content', $AVE_Template->fetch('dbactions/actions.tpl'));
$AVE_Template->assign('db_size', get_mysql_size());
$AVE_Template->assign('files', $AVE_DB_Service->databaseFilesGet());
$AVE_Template->assign('tables', $AVE_DB_Service->databaseTableGet());
$AVE_Template->assign('content', $AVE_Template->fetch('dbactions/actions.tpl'));
?> ?>

4
admin/index.php

@ -133,6 +133,6 @@
$AVE_Template->display($tpl); $AVE_Template->display($tpl);
// Статистика // Статистика
if (defined('PROFILING') && PROFILING) //if (defined('PROFILING') && PROFILING)
echo get_statistic(1, 1, 1, 1); // echo get_statistic(1, 1, 1, 1);
?> ?>

38
admin/templates/css/main.css

@ -152,22 +152,22 @@ select { overflow: auto; }
.userNav { float: right; z-index: 10000; position: relative; font-size: 11px; } .userNav { float: right; z-index: 10000; position: relative; font-size: 11px; }
.userNav .lastNav { width: 2px; height: 30px; position: absolute; top: 0; right: 0; } .userNav .lastNav { width: 2px; height: 30px; position: absolute; top: 0; right: 0; }
.userNav ul { margin-right: 2px; } .userNav > ul { margin-right: 2px; }
.userNav ul li { display: inline; float: left; position: relative; cursor: pointer; border-right: 1px solid #3F3F3F; } .userNav > ul > li { display: inline; float: left; position: relative; cursor: pointer; border-left: 1px solid #3F3F3F; }
.userNav ul li:first-child { border-left: 1px solid #3F3F3F; } .userNav > ul > li:last-child { border-right: 1px solid #3F3F3F; }
.userNav ul li a { color: #eeeeee; text-decoration: none; display: block; float: left; } .userNav > ul > li a { color: #eeeeee; text-decoration: none; display: block; float: left; }
.userNav ul li:hover, .selected { background: #212121; } .userNav > ul > li:hover, .selected { background: #212121; }
.userNav ul li span { display: block; padding: 8px 12px 8px 8px; float: left; } .userNav > ul > li span { display: block; padding: 8px 12px 8px 8px; float: left; }
.userNav ul li img { float: left; display: block; margin: 13px 2px 11px 14px; } .userNav > ul > li img { float: left; display: block; margin: 13px 2px 11px 14px; }
.userNav ul li ul { position: absolute; left: -1px; display: none; top: 35px; margin-top: 0px; background: #2f2f2f; padding: 0 1px 1px 1px; border: 1px solid #1d1d1d; z-index: 100; } .userNav > ul > li > ul { position: absolute; left: -1px; display: none; top: 35px; margin-top: 0px; background: #2f2f2f; padding: 0 1px 1px 1px; border: 1px solid #1d1d1d; z-index: 100; }
.userNav ul li ul li { display: block; float: none; border-top: 1px solid #2f2f2f; background: #212121; border-right: none; } .userNav > ul > li > ul > li { display: block; float: none; border-top: 1px solid #2f2f2f; background: #212121; border-right: none; }
.userNav ul li ul li:first-child { border-left: none!important; } .userNav > ul > li > ul > li:first-child { border-left: none!important; }
.userNav ul li ul li a { width: 162px; padding: 6px 10px 6px 15px; font-size: 11px; text-transform: none; color: #a4a4a4; font-weight: normal; background: none; float: none; } .userNav > ul > li > ul > li a { width: 162px; padding: 6px 10px 6px 15px; font-size: 11px; text-transform: none; color: #a4a4a4; font-weight: normal; background: none; float: none; }
.userNav ul li ul li a:hover { background: none; font-weight: normal; color: #fff; } .userNav > ul > li > ul > li a:hover { background: none; font-weight: normal; color: #fff; }
.userNav ul li ul li:hover { background: url(../images/titleBg.png) repeat-x; background-position: 0 -39px; } .userNav > ul > li > ul > li:hover { background: url(../images/titleBg.png) repeat-x; background-position: 0 -39px; }
.userNav ul li ul li span { display: block; padding: 0; float: none; } .userNav > ul > li > ul > li span { display: block; padding: 0; float: none; }
.userNav ul li ul li a.active {background: url(../images/titleBg.png) repeat-x; background-position: 0 -39px; color: #fff;} .userNav > ul > li > ul > li a.active {background: url(../images/titleBg.png) repeat-x; background-position: 0 -39px; color: #fff;}
#menu {width: 180px;} #menu {width: 180px;}
/* ===== Left navigation ===== */ /* ===== Left navigation ===== */
@ -511,9 +511,9 @@ a.button, span.button { padding: 4px 10px; }
.mainForm input[type=text]:hover, .mainForm input[type=password]:hover, .mainForm textarea:hover { border-color: #DCE7EF; background: #fdfdfd; } .mainForm input[type=text]:hover, .mainForm input[type=password]:hover, .mainForm textarea:hover { border-color: #DCE7EF; background: #fdfdfd; }
.mainForm input[type=text]:focus, .mainForm input[type=password]:focus, .mainForm textarea:focus { border-color: #DCE7EF; background: #fff; -webkit-box-shadow: 0 0 0 2px #F1F4FA; box-shadow: 0 0 0 2px #F1F4FA; -moz-box-shadow: 0 0 0 2px #F1F4FA; } .mainForm input[type=text]:focus, .mainForm input[type=password]:focus, .mainForm textarea:focus { border-color: #DCE7EF; background: #fff; -webkit-box-shadow: 0 0 0 2px #F1F4FA; box-shadow: 0 0 0 2px #F1F4FA; -moz-box-shadow: 0 0 0 2px #F1F4FA; }
.mainForm input[readonly], .mainForm input[disabled], .mainForm textarea[readonly], .mainForm textarea[disabled] { background: #f5f5f5; border: 1px solid #DADADA; color: #aaa; } .mainForm input[readonly], .mainForm input[disabled], .mainForm textarea[readonly], .mainForm textarea[disabled], .mainForm button[disabled] { background: #f5f5f5; border: 1px solid #DADADA; color: #aaa; }
.mainForm input[readonly]:hover, .mainForm input[disabled]:hover, .mainForm textarea[readonly]:hover, .mainForm textarea[disabled]:hover { background: #f5f5f5; border: 1px solid #aaa; color: #aaa; } .mainForm input[readonly]:hover, .mainForm input[disabled]:hover, .mainForm textarea[readonly]:hover, .mainForm textarea[disabled]:hover, .mainForm button[disabled]:hover { background: #f5f5f5; border: 1px solid #aaa; color: #aaa; cursor: not-allowed}
.mainForm input[readonly]:focus, .mainForm input[disabled]:focus, .mainForm textarea[readonly]:focus, .mainForm textarea[disabled]:focus { background: #f5f5f5; border: 1px solid #aaa; color: #aaa; } .mainForm input[readonly]:focus, .mainForm input[disabled]:focus, .mainForm textarea[readonly]:focus, .mainForm textarea[disabled]:focus, .mainForm button[disabled]:focus { background: #f5f5f5; border: 1px solid #aaa; color: #aaa; cursor: not-allowed}
.mainForm input[type=text], .mainForm input[type=password], .mainForm textarea {width: 100%; box-sizing: content-box;} .mainForm input[type=text], .mainForm input[type=password], .mainForm textarea {width: 100%; box-sizing: content-box;}

3
admin/templates/modules/modules.tpl

@ -49,6 +49,9 @@ $(document).ready(function(){ldelim}
</div> </div>
<div class="widget first"> <div class="widget first">
<div class="num">
<a class="basicNum topDir" href="index.php?do=modules&action=aliases&cp={$sess}">Редактирование алиасов</a>
</div>
<ul class="tabs"> <ul class="tabs">
<li class="activeTab"><a href="#tab1">{#MODULES_INSTALLED#}</a></li> <li class="activeTab"><a href="#tab1">{#MODULES_INSTALLED#}</a></li>
<li class=""><a href="#tab2">{#MODULES_NOT_INSTALLED#}</a></li> <li class=""><a href="#tab2">{#MODULES_NOT_INSTALLED#}</a></li>

6
admin/templates/request/conditions.tpl

@ -1,7 +1,5 @@
<script language="Javascript" type="text/javascript"> <script language="Javascript" type="text/javascript">
var sess = '{$sess}';
var sess = '{$sess}';
</script> </script>
<div class="title {if $smarty.request.pop}first{/if}"> <div class="title {if $smarty.request.pop}first{/if}">
@ -420,4 +418,4 @@ $(document).ready(function(){ldelim}
{/if} {/if}
{rdelim}); {rdelim});
</script> </script>

2
admin/templates/rubs/change.tpl

@ -1,5 +1,5 @@
{if $smarty.request.action == 'change'} {if $smarty.request.action == 'change'}
<div id="rub_field_{$rf.rubric_id}_{$rf.Id}"> <div id="rub_field_{$rf.rubric_id}_{$rf.Id}" style="text-align: left;">
<form name="field_save_{$rf.rubric_id}_{$rf.Id}" id="field_save_{$rf.rubric_id}_{$rf.Id}" method="post" action="index.php?do=rubs&action=changesave&field_id={$rf.Id|escape}&rubric_id={$rf.rubric_id|escape}&pop=1&onlycontent=1&cp={$sess}" class="mainForm"> <form name="field_save_{$rf.rubric_id}_{$rf.Id}" id="field_save_{$rf.rubric_id}_{$rf.Id}" method="post" action="index.php?do=rubs&action=changesave&field_id={$rf.Id|escape}&rubric_id={$rf.rubric_id|escape}&pop=1&onlycontent=1&cp={$sess}" class="mainForm">
<select class="mousetrap" name="rubric_field_type" id="rubric_field_type_{$field_id|escape}" style="width: 200px;"> <select class="mousetrap" name="rubric_field_type" id="rubric_field_type_{$field_id|escape}" style="width: 200px;">
{section name=field loop=$fields} {section name=field loop=$fields}

43
admin/templates/rubs/field_template.tpl

@ -17,37 +17,40 @@
<form name="alias_check" id="field_tpl" method="post" action="index.php?do=rubs&action=field_template_save&onlycontent=1&cp={$sess}" class="mainForm"> <form name="alias_check" id="field_tpl" method="post" action="index.php?do=rubs&action=field_template_save&onlycontent=1&cp={$sess}" class="mainForm">
<div class="widget first">
<div class="head"><h5 class="iFrames">{#RUBRIK_FIELD_DEFAULT#}</h5></div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<tbody>
<tr>
<td>
<div class="pr12">
<input class="mousetrap" name="rubric_field_default" type="text" id="rubric_field_default" value="{$rubric_field_default|escape}" style="width:100%;" />
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="widget first"> <div class="widget first">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic"> <table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<col width="50%">
<col> <col>
<thead> <thead>
<tr> <tr>
<td>{#RUBRIK_FIELD_DEFAULT#}</td>
<td>{#RUBRIK_FILED_TEMPLATE_DESCR#}</td> <td>{#RUBRIK_FILED_TEMPLATE_DESCR#}</td>
</tr> </tr>
</thead> </thead>
<tr> <tr>
<td> <td>
<div class="pr12"> <div class="pr12">
<textarea wrap="off" placeholder="" id="rubric_field_description" style="width:100%; height:40px" name="rubric_field_description">{$rubric_field_description|escape}</textarea> <textarea
wrap="off"
placeholder=""
id="rubric_field_default"
style="width:100%; height:40px"
name="rubric_field_default">{$rubric_field_default|escape}</textarea>
</div>
</td>
<td>
<div class="pr12">
<textarea
wrap="off"
placeholder=""
id="rubric_field_description"
style="width:100%; height:40px"
name="rubric_field_description">{$rubric_field_description|escape}</textarea>
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>INT, STRING, JSON</td>
<td> <td>
|&nbsp; |&nbsp;
<a href="javascript:void(0);" onclick="textSelectionrftd('<div>', '</div>');"><strong>DIV</strong></a>&nbsp;|&nbsp; <a href="javascript:void(0);" onclick="textSelectionrftd('<div>', '</div>');"><strong>DIV</strong></a>&nbsp;|&nbsp;
@ -250,6 +253,7 @@ $(document).ready(function(){ldelim}
{rdelim}); {rdelim});
{literal} {literal}
setTimeout(function(){editorrftdf.refresh();}, 20);
setTimeout(function(){editorrft.refresh();}, 20); setTimeout(function(){editorrft.refresh();}, 20);
setTimeout(function(){editorrftr.refresh();}, 20); setTimeout(function(){editorrftr.refresh();}, 20);
setTimeout(function(){editorrftd.refresh();}, 20); setTimeout(function(){editorrftd.refresh();}, 20);
@ -258,6 +262,7 @@ $(document).ready(function(){ldelim}
{rdelim}); {rdelim});
</script> </script>
{include file="$codemirror_editor" conn_id="rftd" textarea_id='rubric_field_description' ctrls='$(".SaveEditFieldTemplate").trigger("click");' height=80} {include file="$codemirror_editor" conn_id="rftd" textarea_id='rubric_field_description' ctrls='$(".SaveEditFieldTemplate").trigger("click");' height=120}
{include file="$codemirror_editor" conn_id="rft" textarea_id='rubric_field_template' ctrls='$(".SaveEditFieldTemplate").trigger("click");' height=130} {include file="$codemirror_editor" conn_id="rftdf" textarea_id='rubric_field_default' ctrls='$(".SaveEditFieldTemplate").trigger("click");' height=120}
{include file="$codemirror_editor" conn_id="rftr" textarea_id='rubric_field_template_request' ctrls='$(".SaveEditFieldTemplate").trigger("click");' height=130} {include file="$codemirror_editor" conn_id="rft" textarea_id='rubric_field_template' ctrls='$(".SaveEditFieldTemplate").trigger("click");' height=180}
{include file="$codemirror_editor" conn_id="rftr" textarea_id='rubric_field_template_request' ctrls='$(".SaveEditFieldTemplate").trigger("click");' height=180}

14
admin/templates/rubs/fields_list.tpl

@ -199,7 +199,7 @@ function openAliasWindow(fieldId, rubId, width, height, target) {ldelim}
</div> </div>
</td> </td>
<td align="center"> <td align="center">
<a data-dialog="rft-{$field.Id}" href="index.php?do=rubs&action=field_template&field_id={$field.Id}&rubric_id={$smarty.request.Id|escape}&cp={$sess}&pop=1&onlycontent=1" data-height="700" data-modal="true" data-title="{#RUBRIK_ALIAS_HEAD#}" class="openDialog icon_sprite ico_template"></a> <a data-dialog="rft-{$field.Id}" href="index.php?do=rubs&action=field_template&field_id={$field.Id}&rubric_id={$smarty.request.Id|escape}&cp={$sess}&pop=1&onlycontent=1" data-height="700" data-modal="true" data-title="{#RUBRIK_FILED_TEMPLATE_H#}" class="openDialog icon_sprite ico_template topleftDir" title="{#RUBRIK_FILED_TEMPLATE_H#}"></a>
</td> </td>
</tr> </tr>
{/foreach} {/foreach}
@ -290,10 +290,9 @@ function openAliasWindow(fieldId, rubId, width, height, target) {ldelim}
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic"> <table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<col width="10"> <col width="10">
<col width="10"> <col width="10">
<col width="350"> <col>
<col width="220"> <col width="220">
<col width="100"> <col width="100">
<col>
<thead> <thead>
<tr> <tr>
<td align="center"><a href="javascript:void(0);" class="topDir link" style="cursor: help;" title="{#RUBRIK_NUMERIC_TIP#}">[?]</a></td> <td align="center"><a href="javascript:void(0);" class="topDir link" style="cursor: help;" title="{#RUBRIK_NUMERIC_TIP#}">[?]</a></td>
@ -301,7 +300,6 @@ function openAliasWindow(fieldId, rubId, width, height, target) {ldelim}
<td>{#RUBRIK_FIELD_NAME#}</td> <td>{#RUBRIK_FIELD_NAME#}</td>
<td>{#RUBRIK_FIELD_TYPE#}</td> <td>{#RUBRIK_FIELD_TYPE#}</td>
<td>{#RUBRIK_FIELD_GROUP#}</td> <td>{#RUBRIK_FIELD_GROUP#}</td>
<td>{#RUBRIK_FIELD_DEFAULT#}</td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -328,11 +326,6 @@ function openAliasWindow(fieldId, rubId, width, height, target) {ldelim}
{/foreach} {/foreach}
</select> </select>
</td> </td>
<td>
<div class="pr12">
<input name="default_value" type="text" id="default_value" value="" style="width:100%;" />
</div>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -631,8 +624,7 @@ $(document).ready(function(){ldelim}
function resetForms(){ldelim} function resetForms(){ldelim}
$('#newfld').find('a.jqTransformCheckbox').removeClass('jqTransformChecked'); $('#newfld').find('a.jqTransformCheckbox').removeClass('jqTransformChecked');
$('#newfld').find('select').prop('selectedIndex',0); $('#newfld').find('input[type="checkbox"]').prop('checked', false).trigger('refresh');
$('#newfld').find('select').trigger('refresh');
$('#newfld input[type=text]').val(''); $('#newfld input[type=text]').val('');
$('#newfld').trigger('refresh'); $('#newfld').trigger('refresh');
{rdelim} {rdelim}

4
admin/templates/settings/pagination_edit.tpl

@ -28,8 +28,8 @@
{if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a>&nbsp;{/if} {if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a>&nbsp;{/if}
{if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a>&nbsp;{/if} {if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a>&nbsp;{/if}
{if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a>&nbsp;{/if} {if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a>&nbsp;{/if}
{if check_permission('gen_settings_robots')}<a data-dialog="robots" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=robots&cp={$sess}">{#SETTINGS_FILE_ROBOTS#}</a>&nbsp;{/if} {if check_permission('gen_settings_robots')}<a data-dialog="robots" data-title="{#SETTINGS_FILE_ROBOTS#}" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=robots&cp={$sess}">{#SETTINGS_FILE_ROBOTS#}</a>&nbsp;{/if}
{if check_permission('gen_settings_fcustom')}<a data-dialog="custom" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=custom&cp={$sess}">{#SETTINGS_FILE_CUSTOM#}</a>{/if} {if check_permission('gen_settings_fcustom')}<a data-dialog="custom" data-title="{#SETTINGS_FILE_CUSTOM#}" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=custom&cp={$sess}">{#SETTINGS_FILE_CUSTOM#}</a>{/if}
</div> </div>
</div> </div>

4
admin/templates/settings/settings_case.tpl

@ -22,8 +22,8 @@
{if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a>&nbsp;{/if} {if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a>&nbsp;{/if}
{if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a>&nbsp;{/if} {if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a>&nbsp;{/if}
{if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a>&nbsp;{/if} {if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a>&nbsp;{/if}
{if check_permission('gen_settings_robots')}<a data-dialog="robots" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=robots&cp={$sess}">{#SETTINGS_FILE_ROBOTS#}</a>&nbsp;{/if} {if check_permission('gen_settings_robots')}<a data-dialog="robots" data-title="{#SETTINGS_FILE_ROBOTS#}" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=robots&cp={$sess}">{#SETTINGS_FILE_ROBOTS#}</a>&nbsp;{/if}
{if check_permission('gen_settings_fcustom')}<a data-dialog="custom" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=custom&cp={$sess}">{#SETTINGS_FILE_CUSTOM#}</a>{/if} {if check_permission('gen_settings_fcustom')}<a data-dialog="custom" data-title="{#SETTINGS_FILE_CUSTOM#}" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=custom&cp={$sess}">{#SETTINGS_FILE_CUSTOM#}</a>{/if}
</div> </div>
</div> </div>

4
admin/templates/settings/settings_countries.tpl

@ -23,8 +23,8 @@
{if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a>&nbsp;{/if} {if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a>&nbsp;{/if}
{if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a>&nbsp;{/if} {if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a>&nbsp;{/if}
{if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a>&nbsp;{/if} {if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a>&nbsp;{/if}
{if check_permission('gen_settings_robots')}<a data-dialog="robots" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=robots&cp={$sess}">{#SETTINGS_FILE_ROBOTS#}</a>&nbsp;{/if} {if check_permission('gen_settings_robots')}<a data-dialog="robots" data-title="{#SETTINGS_FILE_ROBOTS#}" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=robots&cp={$sess}">{#SETTINGS_FILE_ROBOTS#}</a>&nbsp;{/if}
{if check_permission('gen_settings_fcustom')}<a data-dialog="custom" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=custom&cp={$sess}">{#SETTINGS_FILE_CUSTOM#}</a>{/if} {if check_permission('gen_settings_fcustom')}<a data-dialog="custom" data-title="{#SETTINGS_FILE_CUSTOM#}" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=custom&cp={$sess}">{#SETTINGS_FILE_CUSTOM#}</a>{/if}
</div> </div>
</div> </div>

4
admin/templates/settings/settings_lang.tpl

@ -22,8 +22,8 @@
{if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a>&nbsp;{/if} {if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a>&nbsp;{/if}
{if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a>&nbsp;{/if} {if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a>&nbsp;{/if}
{if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a>&nbsp;{/if} {if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a>&nbsp;{/if}
{if check_permission('gen_settings_robots')}<a data-dialog="robots" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=robots&cp={$sess}">{#SETTINGS_FILE_ROBOTS#}</a>&nbsp;{/if} {if check_permission('gen_settings_robots')}<a data-dialog="robots" data-title="{#SETTINGS_FILE_ROBOTS#}" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=robots&cp={$sess}">{#SETTINGS_FILE_ROBOTS#}</a>&nbsp;{/if}
{if check_permission('gen_settings_fcustom')}<a data-dialog="custom" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=custom&cp={$sess}">{#SETTINGS_FILE_CUSTOM#}</a>{/if} {if check_permission('gen_settings_fcustom')}<a data-dialog="custom" data-title="{#SETTINGS_FILE_CUSTOM#}" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=custom&cp={$sess}">{#SETTINGS_FILE_CUSTOM#}</a>{/if}
</div> </div>
</div> </div>

4
admin/templates/settings/settings_main.tpl

@ -23,8 +23,8 @@
{if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a>&nbsp;{/if} {if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a>&nbsp;{/if}
{if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a>&nbsp;{/if} {if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a>&nbsp;{/if}
{if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a>&nbsp;{/if} {if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a>&nbsp;{/if}
{if check_permission('gen_settings_robots')}<a data-dialog="robots" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=robots&cp={$sess}">{#SETTINGS_FILE_ROBOTS#}</a>&nbsp;{/if} {if check_permission('gen_settings_robots')}<a data-dialog="robots" data-title="{#SETTINGS_FILE_ROBOTS#}" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=robots&cp={$sess}">{#SETTINGS_FILE_ROBOTS#}</a>&nbsp;{/if}
{if check_permission('gen_settings_fcustom')}<a data-dialog="custom" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=custom&cp={$sess}">{#SETTINGS_FILE_CUSTOM#}</a>{/if} {if check_permission('gen_settings_fcustom')}<a data-dialog="custom" data-title="{#SETTINGS_FILE_CUSTOM#}" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=custom&cp={$sess}">{#SETTINGS_FILE_CUSTOM#}</a>{/if}
</div> </div>
</div> </div>

4
admin/templates/settings/settings_pagination.tpl

@ -23,8 +23,8 @@
{if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a>&nbsp;{/if} {if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a>&nbsp;{/if}
{if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a>&nbsp;{/if} {if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a>&nbsp;{/if}
{if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a>&nbsp;{/if} {if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a>&nbsp;{/if}
{if check_permission('gen_settings_robots')}<a data-dialog="robots" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=robots&cp={$sess}">{#SETTINGS_FILE_ROBOTS#}</a>&nbsp;{/if} {if check_permission('gen_settings_robots')}<a data-dialog="robots" data-title="{#SETTINGS_FILE_ROBOTS#}" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=robots&cp={$sess}">{#SETTINGS_FILE_ROBOTS#}</a>&nbsp;{/if}
{if check_permission('gen_settings_fcustom')}<a data-dialog="custom" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=custom&cp={$sess}">{#SETTINGS_FILE_CUSTOM#}</a>{/if} {if check_permission('gen_settings_fcustom')}<a data-dialog="custom" data-title="{#SETTINGS_FILE_CUSTOM#}" data-height="650" data-modal="true" class="button greenBtn openDialog" href="index.php?do=settings&action=custom&cp={$sess}">{#SETTINGS_FILE_CUSTOM#}</a>{/if}
</div> </div>
</div> </div>

2
admin/templates/sysblocks/list.tpl

@ -120,7 +120,7 @@
<td align="center">{$sysblock->sysblock_author_id|escape}</td> <td align="center">{$sysblock->sysblock_author_id|escape}</td>
<td align="center"> <td align="center">
<span class="date_text dgrey">{$sysblock->sysblock_created|date_format:$TIME_FORMAT|pretty_date}</span> <span class="date_text dgrey">{$sysblock->sysblock_created|date_format:$TIME_FORMAT|translate_date}</span>
</td> </td>
<td> <td>

269
class/class.core.php

@ -16,11 +16,6 @@
class AVE_Core class AVE_Core
{ {
/**
* Свойства класса
*/
/** /**
* Текущий документ * Текущий документ
* *
@ -70,9 +65,6 @@
*/ */
public $_module_not_found = 'Запрашиваемый модуль не найден.'; public $_module_not_found = 'Запрашиваемый модуль не найден.';
/**
* Внутренние методы класса
*/
/** /**
* Получение основных настроек сисблока * Получение основных настроек сисблока
@ -268,6 +260,9 @@
{ {
global $AVE_DB; global $AVE_DB;
if (isset($_REQUEST['module']) && ! preg_match('/^[A-Za-z0-9-_]{1,20}$/i', $_REQUEST['module']))
return '';
// Если папка, с запрашиваемым модулем не существует, выполняем редирект // Если папка, с запрашиваемым модулем не существует, выполняем редирект
// на главную страницу и отображаем сообщение с ошибкой // на главную страницу и отображаем сообщение с ошибкой
if (! is_dir(BASE_DIR . '/modules/' . $_REQUEST['module'])) if (! is_dir(BASE_DIR . '/modules/' . $_REQUEST['module']))
@ -368,6 +363,7 @@
} }
} }
/** /**
* Метод, предназначенный для обработки события 404 Not Found, т.е. когда страница не найдена. * Метод, предназначенный для обработки события 404 Not Found, т.е. когда страница не найдена.
* *
@ -403,6 +399,7 @@
exit; exit;
} }
/** /**
* Метод, предназначенный для формирования хэша страницы * Метод, предназначенный для формирования хэша страницы
* *
@ -418,6 +415,7 @@
return md5($hash); return md5($hash);
} }
/** /**
* Метод, предназначенный для проверки существования документа в БД * Метод, предназначенный для проверки существования документа в БД
* *
@ -520,7 +518,7 @@
/** /**
* Метод, предназначенный для получения МЕТА-тегов для различных модулей. * Метод, предназначенный для получения МЕТА-тегов для различных модулей.
* * ToDo
* @return boolean * @return boolean
*/ */
function _coreModuleMetatagsFetch() function _coreModuleMetatagsFetch()
@ -649,9 +647,134 @@
return $combine; return $combine;
} }
/**
* Внешние методы класса function _main_content ($main_content, $id, $rubTmpl)
*/ {
global $AVE_DB, $AVE_Template;
// Проверяем теги полей в шаблоне рубрики на условие != ''
$main_content = preg_replace("/\[tag:if_notempty:fld:([a-zA-Z0-9-_]+)\]/u", '<'.'?php if((htmlspecialchars(document_get_field(\'$1\'), ENT_QUOTES)) != \'\') { '.'?'.'>', $rubTmpl);
$main_content = preg_replace("/\[tag:if_empty:fld:([a-zA-Z0-9-_]+)\]/u", '<'.'?php if((htmlspecialchars(document_get_field(\'$1\'), ENT_QUOTES)) == \'\') { '.'?'.'>', $main_content);
$main_content = str_replace('[tag:if:else]', '<?php }else{ ?>', $main_content);
$main_content = str_replace('[tag:/if]', '<?php } ?>', $main_content);
// Парсим элементы полей
$main_content = preg_replace_callback(
'/\[tag:fld:([a-zA-Z0-9-_]+)\]\[([0-9]+)]\[([0-9]+)]/',
create_function(
'$m',
'return get_field_element($m[1], $m[2], $m[3], ' . $this->curentdoc->Id . ');'
),
$main_content
);
// Парсим теги полей документа в шаблоне рубрики
$main_content = preg_replace_callback('/\[tag:fld:([a-zA-Z0-9-_]+)(|[:(\d)])+?\]/', 'document_get_field', $main_content);
// Повторно парсим элементы полей
$main_content = preg_replace_callback(
'/\[tag:fld:([a-zA-Z0-9-_]+)\]\[([0-9]+)]\[([0-9]+)]/',
create_function(
'$m',
'return get_field_element($m[1], $m[2], $m[3], ' . $this->curentdoc->Id . ');'
),
$main_content
);
// Повторно парсим теги полей документа в шаблоне рубрики
$main_content = preg_replace_callback('/\[tag:fld:([a-zA-Z0-9-_]+)(|[:(\d)])+?\]/', 'document_get_field', $main_content);
// Watermarks
$main_content = preg_replace_callback('/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/', 'watermarks', $main_content);
// Thumbnail
$main_content = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $main_content);
// Возвращаем поле из БД документа
$main_content = preg_replace_callback('/\[tag:doc:([a-zA-Z0-9-_]+)\]/u',
function ($match)
{
return isset($this->curentdoc->{$match[1]})
? $this->curentdoc->{$match[1]}
: null;
},
$main_content
);
// Если пришел вызов на активацию языковых файлов
$main_content = preg_replace_callback(
'/\[tag:langfile:([a-zA-Z0-9-_]+)\]/u',
function ($match)
{
global $AVE_Template;
return $AVE_Template->get_config_vars($match[1]);
},
$main_content
);
// Удаляем ошибочные теги полей документа в шаблоне рубрики
$main_content = preg_replace('/\[tag:watermark:\w*\]/', '', $main_content);
$main_content = preg_replace('/\[tag:fld:\d*\]/', '', $main_content);
$main_content = preg_replace('/\[tag:doc:\w*\]/', '', $main_content);
$main_content = preg_replace('/\[tag:langfile:\w*\]/', '', $main_content);
// парсим теги в шаблоне рубрики
$main_content = preg_replace_callback(
'/\[tag:date:([a-zA-Z0-9-. \/]+)\]/',
create_function('$m','return translate_date(date($m[1], '.$this->curentdoc->document_published.'));
'),
$main_content
);
$main_content = str_replace('[tag:docdate]', pretty_date(strftime(DATE_FORMAT, $this->curentdoc->document_published)), $main_content);
$main_content = str_replace('[tag:doctime]', pretty_date(strftime(TIME_FORMAT, $this->curentdoc->document_published)), $main_content);
$main_content = str_replace('[tag:humandate]', human_date($this->curentdoc->document_published), $main_content);
$main_content = str_replace('[tag:docauthorid]', $this->curentdoc->document_author_id, $main_content);
if (preg_match('[tag:docauthor]', $main_content))
$main_content = str_replace('[tag:docauthor]', get_username_by_id($this->curentdoc->document_author_id), $main_content);
if (CACHE_DOC_TPL && empty($_POST))
{
$cache_id = (int)$this->curentdoc->Id;
$cache_id = 'compiled/' . (floor($cache_id / 1000)) . '/' . $cache_id;
$cache_file = $this->_get_cache_hash();
$cache_dir = BASE_DIR . '/cache/sql/' . (trim($cache_id) > ''
? trim($cache_id) . '/'
: substr($cache_file, 0, 2) . '/' . substr($cache_file, 2, 2) . '/' . substr($cache_file, 4, 2) . '/');
// кэширование разрешено
// сохраняем скомпилированный шаблон в кэш
if (CACHE_DOC_FILE)
{
if (! is_dir($cache_dir))
mkdir($cache_dir, 0766, true);
file_put_contents($cache_dir . $cache_file, $main_content);
}
// кэширование разрешено
// сохраняем скомпилированный шаблон в кэш
$AVE_DB->Query("
INSERT INTO
" . PREFIX . "_rubric_template_cache
SET
hash = '" . $cache_file . "',
rub_id = '" . RUB_ID . "',
rub_tmpl_id = '" . $this->curentdoc->rubric_tmpl_id . "',
grp_id = '" . UGROUP . "',
doc_id = '" . $id . "',
compiled = '" . addslashes($main_content) . "'
");
unset ($cache_id, $cache_file, $cache_dir);
}
return $main_content;
}
/** /**
* Метод, предназначенный для обработки системных тегов модулей. Здесь подключаются только те файлы модулей, * Метод, предназначенный для обработки системных тегов модулей. Здесь подключаются только те файлы модулей,
@ -663,11 +786,14 @@
*/ */
function coreModuleTagParse($template) function coreModuleTagParse($template)
{ {
global $AVE_DB, $AVE_Template; global $AVE_DB, $AVE_Template, $AVE_Module;
$pattern = array(); // Массив системных тегов $pattern = array(); // Массив системных тегов
$replace = array(); // Массив функций, на которые будут заменены системные теги $replace = array(); // Массив функций, на которые будут заменены системные теги
if (null !== $AVE_Module->moduleListGet())
$this->install_modules = $AVE_Module->moduleListGet();
// Если уже имеются данные об установленных модулях // Если уже имеются данные об установленных модулях
if (null !== $this->install_modules) if (null !== $this->install_modules)
{ {
@ -752,7 +878,7 @@
// получаем php код функции, в противном случае формируем сообщение с ошибкой // получаем php код функции, в противном случае формируем сообщение с ошибкой
$replace[] = function_exists($row->ModuleFunction) $replace[] = function_exists($row->ModuleFunction)
? $row->ModulePHPTag ? $row->ModulePHPTag
: ($this->_module_error . ' &quot;' . $row->ModuleName . '&quot;'); : ($this->_module_error . ' &quot;' . $row->ModuleSysName . '&quot;');
} }
// Сохряняем информацию о модуле // Сохряняем информацию о модуле
$this->install_modules[$row->ModuleSysName] = $row; $this->install_modules[$row->ModuleSysName] = $row;
@ -760,7 +886,7 @@
elseif ($row->ModuleAveTag) // Если файла module.php не существует, формируем сообщение с ошибкой elseif ($row->ModuleAveTag) // Если файла module.php не существует, формируем сообщение с ошибкой
{ {
$pattern[] = $row->ModuleAveTag; $pattern[] = $row->ModuleAveTag;
$replace[] = $this->_module_error . ' &quot;' . $row->ModuleName . '&quot;'; $replace[] = $this->_module_error . ' &quot;' . $row->ModuleSysName . '&quot;';
} }
} }
else else
@ -768,6 +894,7 @@
$this->install_modules[$row->ModuleSysName] = $row; $this->install_modules[$row->ModuleSysName] = $row;
} }
} }
// Выполняем замену систеного тега на php код и возвращаем результат // Выполняем замену систеного тега на php код и возвращаем результат
return preg_replace($pattern, $replace, $template); return preg_replace($pattern, $replace, $template);
} }
@ -946,7 +1073,7 @@
} }
} }
if (CACHE_DOC_TPL && empty ($_POST) && !(isset ($_SESSION['user_adminmode']) && $_SESSION['user_adminmode'] == 1)) if (CACHE_DOC_TPL && empty ($_POST))
{ {
// Кэширование разрешено // Кэширование разрешено
// Извлекаем скомпилированный шаблон документа из кэша // Извлекаем скомпилированный шаблон документа из кэша
@ -1036,109 +1163,17 @@
} }
else else
{ {
// Проверяем теги полей в шаблоне рубрики на условие != '' // Обрабатываем основные поля рубрики
$main_content = preg_replace("/\[tag:if_notempty:fld:([a-zA-Z0-9-_]+)\]/u", '<'.'?php if((htmlspecialchars(document_get_field(\'$1\'), ENT_QUOTES)) != \'\') { '.'?'.'>', $rubTmpl); $main_content = $this->_main_content($main_content, $id, $rubTmpl);
$main_content = preg_replace("/\[tag:if_empty:fld:([a-zA-Z0-9-_]+)\]/u", '<'.'?php if((htmlspecialchars(document_get_field(\'$1\'), ENT_QUOTES)) == \'\') { '.'?'.'>', $main_content);
$main_content = str_replace('[tag:if:else]', '<?php }else{ ?>', $main_content);
$main_content = str_replace('[tag:/if]', '<?php } ?>', $main_content);
// Парсим теги полей документа в шаблоне рубрики
$main_content = preg_replace_callback('/\[tag:fld:([a-zA-Z0-9-_]+)\]\[([0-9]+)]\[([0-9]+)]/', 'return_element', $main_content);
$main_content = preg_replace_callback('/\[tag:fld:([a-zA-Z0-9-_]+)\]/', 'document_get_field', $main_content);
$main_content = preg_replace_callback('/\[tag:fld:([a-zA-Z0-9-_]+)\]\[([0-9]+)]\[([0-9]+)]/', 'return_element', $main_content);
$main_content = preg_replace_callback('/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/', 'watermarks', $main_content);
$main_content = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $main_content);
// Возвращаем поле из БД документа
$main_content = preg_replace_callback('/\[tag:doc:([a-zA-Z0-9-_]+)\]/u',
function ($match)
{
return isset($this->curentdoc->{$match[1]})
? $this->curentdoc->{$match[1]}
: null;
},
$main_content
);
// Если пришел вызов на активацию языковых файлов
$main_content = preg_replace_callback(
'/\[tag:langfile:([a-zA-Z0-9-_]+)\]/u',
function ($match)
{
global $AVE_Template;
return $AVE_Template->get_config_vars($match[1]);
},
$main_content
);
// Удаляем ошибочные теги полей документа в шаблоне рубрики
$main_content = preg_replace('/\[tag:watermark:\w*\]/', '', $main_content);
$main_content = preg_replace('/\[tag:fld:\d*\]/', '', $main_content);
$main_content = preg_replace('/\[tag:doc:\w*\]/', '', $main_content);
$main_content = preg_replace('/\[tag:langfile:\w*\]/', '', $main_content);
if (CACHE_DOC_TPL && empty ($_POST) && !(isset ($_SESSION['user_adminmode']) && $_SESSION['user_adminmode'] == 1))
{
$cache_id = (int)$this->curentdoc->Id;
$cache_id = 'compiled/' . (floor($cache_id / 1000)) . '/' . $cache_id;
$cache_file = $this->_get_cache_hash();
$cache_dir = BASE_DIR . '/cache/sql/' . (trim($cache_id) > ''
? trim($cache_id) . '/'
: substr($cache_file, 0, 2) . '/' . substr($cache_file, 2, 2) . '/' . substr($cache_file, 4, 2) . '/');
// кэширование разрешено
// сохраняем скомпилированный шаблон в кэш
if (CACHE_DOC_FILE)
{
if(! is_dir($cache_dir))
mkdir($cache_dir, 0777, true);
file_put_contents($cache_dir . $cache_file, $main_content);
}
// кэширование разрешено
// сохраняем скомпилированный шаблон в кэш
$AVE_DB->Query("
INSERT " . PREFIX . "_rubric_template_cache
SET
hash = '" . $cache_file . "',
rub_id = '" . RUB_ID . "',
rub_tmpl_id = '" . $this->curentdoc->rubric_tmpl_id . "',
grp_id = '" . UGROUP . "',
doc_id = '" . $id . "',
compiled = '" . addslashes($main_content) . "'
");
unset($cache_id, $cache_file, $cache_dir);
}
} }
} }
// парсим теги в шаблоне рубрики
$main_content = preg_replace_callback(
'/\[tag:date:([a-zA-Z0-9-. \/]+)\]/',
create_function('$m','return translate_date(date($m[1], '.$this->curentdoc->document_published.'));
'),
$main_content
);
$main_content = str_replace('[tag:docdate]', pretty_date(strftime(DATE_FORMAT, $this->curentdoc->document_published)), $main_content);
$main_content = str_replace('[tag:doctime]', pretty_date(strftime(TIME_FORMAT, $this->curentdoc->document_published)), $main_content);
$main_content = str_replace('[tag:humandate]', human_date($this->curentdoc->document_published), $main_content);
$main_content = str_replace('[tag:docauthorid]', $this->curentdoc->document_author_id, $main_content);
if (preg_match('[tag:docauthor]', $main_content))
$main_content = str_replace('[tag:docauthor]', get_username_by_id($this->curentdoc->document_author_id), $main_content);
} }
$out = str_replace('[tag:maincontent]', $main_content, $out); $out = str_replace('[tag:maincontent]', $main_content, $out);
unset($this->curentdoc->rubric_template, $this->curentdoc->template); unset ($this->curentdoc->rubric_template, $this->curentdoc->template);
} }
// Конец вывода документа //-- Конец вывода документа
//Работа с условиями //Работа с условиями
/* /*
@ -1519,6 +1554,9 @@
$get_url = implode('/', $get_url); $get_url = implode('/', $get_url);
} }
//-- Экранируем поступающий URL
$get_url = $AVE_DB->ClearUrl($get_url);
//-- Проверяем есть ли данный URL в таблице алиасов модулей //-- Проверяем есть ли данный URL в таблице алиасов модулей
$sql = " $sql = "
SELECT SELECT
@ -1554,15 +1592,10 @@
Id = '" . (int)$_REQUEST['id'] . "' Id = '" . (int)$_REQUEST['id'] . "'
")->GetCell(); ")->GetCell();
} }
// Выполняем запрос к БД на получение всей необходимой // Выполняем запрос к БД на получение всей необходимой
// информации о документе // информации о документе
// Экранируем поступающий URL
$get_url = $AVE_DB->EscStr($get_url);
if (mb_strlen($get_url) > 255)
$get_url = '';
// Забираем нужные данные // Забираем нужные данные
$sql = $AVE_DB->Query(" $sql = $AVE_DB->Query("
SELECT SELECT

2047
class/class.database.php

File diff suppressed because it is too large Load Diff

958
class/class.dbdump.php

File diff suppressed because it is too large Load Diff

127
class/class.debug.php

@ -30,12 +30,13 @@
// //
} }
/** /**
* Функция для вывода переменной (для отладки) * Функция для вывода переменной (для отладки)
* *
* @param mixed $var любая переменная * @param mixed $var любая переменная
*/ */
public static function _echo($var, $exit = false) public static function _echo($var, $exit = false, $bg = null)
{ {
$backtrace = debug_backtrace(); $backtrace = debug_backtrace();
@ -52,14 +53,14 @@
$line = 0; $line = 0;
while (++$line <= $backtrace['line']) while (++$line <= $backtrace['line'])
{
$code = fgets($fh); $code = fgets($fh);
}
fclose($fh); fclose($fh);
preg_match('/' . __FUNCTION__ . '\s*\((.*)\)\s*;/u', $code, $name); preg_match('/' . __FUNCTION__ . '\s*\((.*)\)\s*;/u', $code, $name);
unset ($code, $backtrace);
ob_start(); ob_start();
var_dump($var); var_dump($var);
@ -70,17 +71,31 @@
$var_dump = htmlspecialchars($var_dump); $var_dump = htmlspecialchars($var_dump);
$var_dump = preg_replace('/(=&gt; )+([a-zA-Z]+\(\d+\))/', '$1<span style="color: #FF8C00;">$2</span>', $var_dump); $var_dump = preg_replace('/(=&gt;)/', '<span style="color: #FF8C00;">$1</span>', $var_dump);
ob_end_clean(); ob_end_clean();
$fn_name = ! empty($name) if (! empty($name))
? $name[1] {
: 'EVAL'; $fn_name = explode(',', $name[1]);
$fn_name = array_shift($fn_name);
}
else
$fn_name = 'EVAL';
if (! $bg)
{
$br = '2a5885';
$bg = '43648c';
}
else
{
$br = $bg;
}
$var_dump = ' $var_dump = '
<div style="border: 1px solid #2a5885; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;"> <div style="border: 1px solid #'.$br.'; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;">
<div style="background:#43648c; color: #fff; margin: 0; padding: 5px;"> <div style="background:#'.$bg.'; color: #fff; margin: 0; padding: 5px;">
var_dump(<strong>' . trim($fn_name) . '</strong>) - ' . self::_trace() . var_dump(<strong>' . trim($fn_name) . '</strong>) - ' . self::_trace() .
'</div> '</div>
<pre style="background:#f5f5f5; color: #000; margin: 0; padding: 5px; border: 0; font-size: 11px; font-family: Consolas, Verdana, Arial;">' <pre style="background:#f5f5f5; color: #000; margin: 0; padding: 5px; border: 0; font-size: 11px; font-family: Consolas, Verdana, Arial;">'
@ -91,7 +106,8 @@
echo $var_dump; echo $var_dump;
if ($exit) exit; if ($exit)
exit;
} }
@ -100,7 +116,7 @@
* *
* @param mixed $var любая переменная * @param mixed $var любая переменная
*/ */
public static function _print($var, $exit = false) public static function _print($var, $exit = false, $bg = null)
{ {
$backtrace = debug_backtrace(); $backtrace = debug_backtrace();
@ -135,13 +151,27 @@
ob_end_clean(); ob_end_clean();
$fn_name = !empty($name) if (! empty($name))
? $name[1] {
: 'EVAL'; $fn_name = explode(',', $name[1]);
$fn_name = array_shift($fn_name);
}
else
$fn_name = 'EVAL';
if (! $bg)
{
$br = '365899';
$bg = '4e5665';
}
else
{
$br = $bg;
}
$var_dump = ' $var_dump = '
<div style="border: 1px solid #365899; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;"> <div style="border: 1px solid #'.$br.'; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;">
<div style="background:#4e5665; color: #fff; margin: 0; padding: 5px;"> <div style="background:#'.$bg.'; color: #fff; margin: 0; padding: 5px;">
print_r(<strong>' . trim($fn_name) . '</strong>) - ' . self::_trace() . print_r(<strong>' . trim($fn_name) . '</strong>) - ' . self::_trace() .
'</div> '</div>
<pre style="background:#f0f0f0; color: #000; margin: 0; padding: 5px; border: 0; font-size: 11px; font-family: Consolas, Verdana, Arial;">' <pre style="background:#f0f0f0; color: #000; margin: 0; padding: 5px; border: 0; font-size: 11px; font-family: Consolas, Verdana, Arial;">'
@ -152,7 +182,8 @@
echo $var_dump; echo $var_dump;
if ($exit) exit; if ($exit)
exit;
} }
@ -161,7 +192,7 @@
* *
* @param mixed $var любая переменная * @param mixed $var любая переменная
*/ */
public static function _exp($var, $exit = false) public static function _exp($var, $exit = false, $bg = null)
{ {
$backtrace = debug_backtrace(); $backtrace = debug_backtrace();
@ -190,9 +221,23 @@
var_export($var); var_export($var);
$fn_name = !empty($name) if (! empty($name))
? $name[1] {
: 'EVAL'; $fn_name = explode(',', $name[1]);
$fn_name = array_shift($fn_name);
}
else
$fn_name = 'EVAL';
if (! $bg)
{
$br = 'bbb';
$bg = 'ccc';
}
else
{
$br = $bg;
}
$var_export = htmlspecialchars(ob_get_contents()); $var_export = htmlspecialchars(ob_get_contents());
@ -201,8 +246,8 @@
ob_end_clean(); ob_end_clean();
$var_dump = ' $var_dump = '
<div style="border: 1px solid #bbb; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;"> <div style="border: 1px solid #'.$br.'; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;">
<div style="background:#ccc; color: #000; margin: 0; padding: 5px;">var_export(<strong>' <div style="background:#'.$bg.'; color: #000; margin: 0; padding: 5px;">var_export(<strong>'
. trim($fn_name) . '</strong>) - ' . self::_trace() . . trim($fn_name) . '</strong>) - ' . self::_trace() .
'</div> '</div>
<pre style="background:#f0f0f0; color: #000; margin: 0; padding: 5px; border: 0; font-size: 11px; font-family: Consolas, Verdana, Arial;">' <pre style="background:#f0f0f0; color: #000; margin: 0; padding: 5px; border: 0; font-size: 11px; font-family: Consolas, Verdana, Arial;">'
@ -213,7 +258,8 @@
echo $var_dump; echo $var_dump;
if ($exit) exit; if ($exit)
exit;
} }
@ -277,14 +323,13 @@
} }
/** /**
* Функция для записи переменной в файл (для отладки) * Функция для записи переменной в файл (для отладки)
* *
* @param mixed $var любая переменная * @param mixed $var любая переменная
* @param bool $exit true - остановливает дальнейшее выполнение скрипта, false - продолжает выполнять скрипт * @param bool $exit true - остановливает дальнейшее выполнение скрипта, false - продолжает выполнять скрипт
*/ */
public static function _dump($var, $append = true, $exit = false) public static function _dump($var, $append = true, $exit = false, $bg = null)
{ {
$backtrace = debug_backtrace(); $backtrace = debug_backtrace();
@ -323,13 +368,27 @@
ob_end_clean(); ob_end_clean();
$fn_name = ! empty($name) if (! empty($name))
? $name[1] {
: 'EVAL'; $fn_name = explode(',', $name[1]);
$fn_name = array_shift($fn_name);
}
else
$fn_name = 'EVAL';
if (! $bg)
{
$br = '2a5885';
$bg = '43648c';
}
else
{
$br = $bg;
}
$var_dump = ' $var_dump = '
<div style="border: 1px solid #2a5885; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;"> <div style="border: 1px solid #'.$br.'; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;">
<div style="background:#43648c; color: #fff; margin: 0; padding: 5px;"> <div style="background:#'.$bg.'; color: #fff; margin: 0; padding: 5px;">
<strong>' . date("j F Y, H:i:s") . '</strong> - var_dump(<strong>' . trim($fn_name) . '</strong>) - ' . self::_trace() . <strong>' . date("j F Y, H:i:s") . '</strong> - var_dump(<strong>' . trim($fn_name) . '</strong>) - ' . self::_trace() .
'</div> '</div>
<pre style="background:#f5f5f5; color: #000; margin: 0; padding: 5px; border: 0; font-size: 11px; font-family: Consolas, Verdana, Arial;">' <pre style="background:#f5f5f5; color: #000; margin: 0; padding: 5px; border: 0; font-size: 11px; font-family: Consolas, Verdana, Arial;">'
@ -386,6 +445,7 @@
return sprintf('Class: <strong>%s</strong> | Type: <strong>%s</strong> | Function: <strong>%s</strong> | File: <strong>%s</strong> line <strong>%s</strong>', $class, $type, $function, $file, $line); return sprintf('Class: <strong>%s</strong> | Type: <strong>%s</strong> | Function: <strong>%s</strong> | File: <strong>%s</strong> line <strong>%s</strong>', $class, $type, $function, $file, $line);
} }
/** /**
* Функция отвечает за начало таймера * Функция отвечает за начало таймера
* *
@ -396,6 +456,7 @@
Debug::$time[$name] = microtime(true); Debug::$time[$name] = microtime(true);
} }
/** /**
* Функция отвечает за окончание таймера * Функция отвечает за окончание таймера
* *
@ -408,6 +469,7 @@
return sprintf("%01.4f", microtime(true) - Debug::$time[$name]) . ' sec'; return sprintf("%01.4f", microtime(true) - Debug::$time[$name]) . ' sec';
} }
/** /**
* Функция отвечает за начало подсчета используеой памяти * Функция отвечает за начало подсчета используеой памяти
* *
@ -418,6 +480,7 @@
Debug::$memory[$name] = memory_get_usage(); Debug::$memory[$name] = memory_get_usage();
} }
/** /**
* Функция отвечает за окончание подсчета используемой памяти * Функция отвечает за окончание подсчета используемой памяти
* *
@ -430,6 +493,7 @@
return Debug::formatSize(memory_get_usage() - Debug::$memory[$name]); return Debug::formatSize(memory_get_usage() - Debug::$memory[$name]);
} }
/** /**
* Форматированный вывод размера * Форматированный вывод размера
* *
@ -458,6 +522,7 @@
return $size; return $size;
} }
/** /**
* Форматированный вывод чисел * Форматированный вывод чисел
* *

13
class/class.docs.php

@ -163,19 +163,20 @@ class AVE_Document
$func = 'get_field_'.$field_type; $func = 'get_field_'.$field_type;
if (! is_callable($func)) if (! is_callable($func))
$func='get_field_default'; $func = 'get_field_default';
$field = $func($field_value, 'edit', $field_id, '', 0, $x, 0, 0, $default); $field = $func($field_value, 'edit', $field_id, '', 0, $x, 0, 0, $default);
return $field; return $field;
} }
function _documentFieldSave($field_type, $field_value, $field_id, $default = '') function _documentFieldSave($field_type, $field_value, $field_id, $default = '')
{ {
$func = 'get_field_'.$field_type; $func = 'get_field_'.$field_type;
if (! is_callable($func)) if (! is_callable($func))
$func='get_field_default'; $func = 'get_field_default';
$field = $func($field_value, 'save', $field_id, '', 0, $x, 0, 0, $default); $field = $func($field_value, 'save', $field_id, '', 0, $x, 0, 0, $default);
@ -340,7 +341,9 @@ class AVE_Document
AND AND
(df1.rubric_field_id = '" . (int)$_REQUEST['field_id'] . "' (df1.rubric_field_id = '" . (int)$_REQUEST['field_id'] . "'
AND AND
UPPER(CONCAT_WS('', df1.field_value, NULLIF(df2.field_value, '')) = '" . mb_strtoupper($_REQUEST['field_search']) . "')) UPPER(CONCAT_WS('', df1.field_value, NULLIF(df2.field_value, '')) = '" . mb_strtoupper($_REQUEST['field_search']) . "')
OR
df1.field_number_value = '" . mb_strtoupper($_REQUEST['field_search']) . "')
"; ";
} }
else if ($_REQUEST['field_request'] == 'like') else if ($_REQUEST['field_request'] == 'like')
@ -349,7 +352,9 @@ class AVE_Document
AND AND
(df1.rubric_field_id = '" . (int)$_REQUEST['field_id'] . "' (df1.rubric_field_id = '" . (int)$_REQUEST['field_id'] . "'
AND AND
UPPER(CONCAT_WS('', df1.field_value, NULLIF(df2.field_value, '')) LIKE '%" . mb_strtoupper($_REQUEST['field_search']) . "%')) UPPER(CONCAT_WS('', df1.field_value, NULLIF(df2.field_value, '')) LIKE '%" . mb_strtoupper($_REQUEST['field_search']) . "%')
OR
df1.field_number_value LIKE '%" . mb_strtoupper($_REQUEST['field_search']) . "%')
"; ";
} }

58
class/class.modules.php

@ -14,11 +14,13 @@
{ {
public $_modules = array(); public $_modules = array();
function __construct() function __construct()
{ {
$this->_modules = $this->getModules(); $this->_modules = $this->getModules();
} }
/** /**
* Метод, который обрабатывает все module.php и записывает как свойство класса списки модулей * Метод, который обрабатывает все module.php и записывает как свойство класса списки модулей
*/ */
@ -61,7 +63,7 @@
$module = array(); $module = array();
if (! (is_file($module_dir . '/info.php') && @include($module_dir . '/info.php'))) if (! (is_file($module_dir . '/info.php') && @include_once($module_dir . '/info.php')))
{ {
// Если не удалось подключить основной файл модуля module.php - Фиксируем ошибку // Если не удалось подключить основной файл модуля module.php - Фиксируем ошибку
$modules['errors'][] = $entry; $modules['errors'][] = $entry;
@ -113,6 +115,7 @@
return $modules; return $modules;
} }
/** /**
* Метод, преданзначеный для выода модулей * Метод, преданзначеный для выода модулей
* *
@ -196,25 +199,38 @@
$modules = array(); $modules = array();
// Условие, определяющее статус документа для запроса к БД if (! empty($this->_modules))
$where_status = ($status !== null) {
? "WHERE ModuleStatus = '" . (int)$status . "'" foreach ($this->_modules AS $k => $v)
: ''; {
if ($status && $v['status'] != $status)
// Выполняем запрос к БД и получаем список документов, continue;
// согласно статусу, либо все модули, если статус не указан
$sql = $AVE_DB->Query("
SELECT
*
FROM
" . PREFIX . "_module
" . $where_status . "
ORDER BY
ModuleName ASC
");
while ($row = $sql->FetchRow()) $modules[$k] = $v;
$modules[$row->ModuleSysName] = $row; }
}
else
{
// Условие, определяющее статус документа для запроса к БД
$where_status = ($status !== null)
? "WHERE ModuleStatus = '" . (int)$status . "'"
: '';
// Выполняем запрос к БД и получаем список документов,
// согласно статусу, либо все модули, если статус не указан
$sql = $AVE_DB->Query("
SELECT
*
FROM
" . PREFIX . "_module
" . $where_status . "
ORDER BY
ModuleName ASC
");
while ($row = $sql->FetchRow())
$modules[$row->ModuleSysName] = $row;
}
// Возвращаем список модулей // Возвращаем список модулей
return $modules; return $modules;
@ -248,6 +264,7 @@
exit; exit;
} }
/** /**
* Метод, предназанченный для установки или переустановки модуля * Метод, предназанченный для установки или переустановки модуля
* *
@ -328,6 +345,7 @@
exit; exit;
} }
/** /**
* Метод, предназначенный для обновления модуля при увеличении номера версии модуля * Метод, предназначенный для обновления модуля при увеличении номера версии модуля
* *
@ -385,6 +403,7 @@
exit; exit;
} }
/** /**
* Метод, предназанченный для удаление модуля * Метод, предназанченный для удаление модуля
* *
@ -425,6 +444,7 @@
exit; exit;
} }
/** /**
* Метод, предназначенный для отключения/включение модуля в Панели управления * Метод, предназначенный для отключения/включение модуля в Панели управления
* *

1453
class/class.request.php

File diff suppressed because it is too large Load Diff

84
class/class.rubs.php

@ -15,11 +15,6 @@
*/ */
class AVE_Rubric class AVE_Rubric
{ {
/**
* СВОЙСТВА
*/
/** /**
* Количество рубрик на странице * Количество рубрик на странице
* *
@ -27,9 +22,6 @@
*/ */
public $_limit = 30; public $_limit = 30;
/**
* ВНУТРЕННИЕ МЕТОДЫ
*/
function get_rubric_fields_group($rubric_id) function get_rubric_fields_group($rubric_id)
{ {
@ -58,10 +50,6 @@
} }
/**
* ВНЕШНИЕ МЕТОДЫ
*/
/** /**
* Вывод списка рубрик * Вывод списка рубрик
* *
@ -219,6 +207,7 @@
} }
} }
/** /**
* Запись настроек рубрики * Запись настроек рубрики
* *
@ -308,6 +297,7 @@
} }
} }
/** /**
* Копирование рубрики * Копирование рубрики
* *
@ -440,6 +430,7 @@
} }
} }
/** /**
* Удаление рубрики * Удаление рубрики
* *
@ -495,6 +486,7 @@
exit; exit;
} }
/** /**
* Вывод списка полей рубрики * Вывод списка полей рубрики
* *
@ -504,12 +496,15 @@
{ {
global $AVE_DB, $AVE_Template; global $AVE_DB, $AVE_Template;
if(check_permission_acp('rubric_edit')) if (check_permission_acp('rubric_edit'))
{ {
// Поля // Поля
$sql = $AVE_DB->Query(" $sql = $AVE_DB->Query("
SELECT SELECT
a.*, b.group_title, b.group_description, b.group_position a.*,
b.group_title,
b.group_description,
b.group_position
FROM FROM
" . PREFIX . "_rubric_fields AS a " . PREFIX . "_rubric_fields AS a
LEFT JOIN LEFT JOIN
@ -551,19 +546,19 @@
$sql = $AVE_DB->Query(" $sql = $AVE_DB->Query("
SELECT * SELECT *
FROM " . PREFIX . "_rubric_fields_group FROM
WHERE rubric_id = '" . $rubric_id . "' " . PREFIX . "_rubric_fields_group
ORDER BY group_position ASC WHERE
rubric_id = '" . $rubric_id . "'
ORDER BY
group_position ASC
"); ");
while ($row = $sql->FetchRow()) while ($row = $sql->FetchRow())
{
array_push($fields_groups, $row); array_push($fields_groups, $row);
}
$AVE_Template->assign('fields_groups', $fields_groups); $AVE_Template->assign('fields_groups', $fields_groups);
// Права // Права
$groups = array(); $groups = array();
@ -575,10 +570,14 @@
$row->doall_h = ($row->user_group == 1) ? 1 : ''; $row->doall_h = ($row->user_group == 1) ? 1 : '';
$rubric_permission = $AVE_DB->Query(" $rubric_permission = $AVE_DB->Query("
SELECT rubric_permission SELECT
FROM " . PREFIX . "_rubric_permissions rubric_permission
WHERE user_group_id = '" . $row->user_group . "' FROM
AND rubric_id = '" . $rubric_id . "' " . PREFIX . "_rubric_permissions
WHERE
user_group_id = '" . $row->user_group . "'
AND
rubric_id = '" . $rubric_id . "'
")->GetCell(); ")->GetCell();
$row->permissions = @explode('|', $rubric_permission); $row->permissions = @explode('|', $rubric_permission);
@ -587,15 +586,22 @@
} }
$sql = $AVE_DB->Query(" $sql = $AVE_DB->Query("
SELECT rubric_title, rubric_linked_rubric, rubric_description SELECT
FROM " . PREFIX . "_rubrics rubric_title,
WHERE id = '" . $rubric_id . "' rubric_linked_rubric,
rubric_description
FROM
" . PREFIX . "_rubrics
WHERE
id = '" . $rubric_id . "'
LIMIT 1 LIMIT 1
"); ");
$rubrik = $sql->FetchRow(); $rubrik = $sql->FetchRow();
$rubrik->rubric_linked_rubric = ($rubrik->rubric_linked_rubric != '0') ? unserialize($rubrik->rubric_linked_rubric) : array(); $rubrik->rubric_linked_rubric = ($rubrik->rubric_linked_rubric != '0')
? unserialize($rubrik->rubric_linked_rubric)
: array();
$AVE_Template->assign('rubric', $rubrik); $AVE_Template->assign('rubric', $rubrik);
$AVE_Template->assign('groups', $groups); $AVE_Template->assign('groups', $groups);
@ -691,14 +697,17 @@
{ {
global $AVE_DB; global $AVE_DB;
if ($RubLink!==null) { if ($RubLink !== null)
{
$AVE_DB->Query(" $AVE_DB->Query("
UPDATE " . PREFIX . "_rubrics UPDATE
" . PREFIX . "_rubrics
SET SET
rubric_linked_rubric = '" . serialize($_REQUEST['rubric_linked']) . "' rubric_linked_rubric = '" . serialize($_REQUEST['rubric_linked']) . "'
WHERE WHERE
Id = '" . (int)$_REQUEST['Id'] . "' Id = '" . (int)$_REQUEST['Id'] . "'
"); ");
header('Location:index.php?do=rubs&action=edit&Id=' . (int)$_REQUEST['Id'] . '&cp=' . SESSION); header('Location:index.php?do=rubs&action=edit&Id=' . (int)$_REQUEST['Id'] . '&cp=' . SESSION);
exit; exit;
} }
@ -706,15 +715,18 @@
{ {
$rubs = array(); $rubs = array();
$sql = $AVE_DB->Query(" $sql = $AVE_DB->Query("
SELECT rubric_title, Id SELECT
FROM " . PREFIX . "_rubrics rubric_title,
ORDER BY rubric_position ASC Id
FROM
" . PREFIX . "_rubrics
ORDER BY
rubric_position ASC
"); ");
while ($row = $sql->FetchRow()) while ($row = $sql->FetchRow())
{ array_push($rubs, $row);
array_push($rubs,$row);
}
return $rubs; return $rubs;
} }
} }

3
class/class.thumbnail.php

@ -180,7 +180,8 @@ class Image_Toolbox {
} }
$this->_gd_ttf = $gd_info['FreeType Support']; $this->_gd_ttf = $gd_info['FreeType Support'];
$this->_gd_ps = $gd_info['T1Lib Support']; $this->_gd_ps = isset($gd_info['T1Lib Support']) ? $gd_info['T1Lib Support'] : false;
if ($gd_info['GIF Read Support']) { if ($gd_info['GIF Read Support']) {
$this->_types[1]['supported'] = 1; $this->_types[1]['supported'] = 1;
if ($gd_info['GIF Create Support']) { if ($gd_info['GIF Create Support']) {

149
fields/checkbox/field.php

@ -1,97 +1,100 @@
<? <?
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Чекбокс (Checkbox)
function get_field_checkbox($field_value, $action, $field_id = 0, $tpl = '', $tpl_empty = 0, &$maxlength = null, $document_fields = array(), $rubric_id = 0, $default = null, $_tpl = null)
{
global $AVE_Template;
// Чекбокс (Checkbox) $fld_dir = dirname(__FILE__) . '/';
function get_field_checkbox($field_value, $action, $field_id = 0, $tpl = '', $tpl_empty = 0, &$maxlength = null, $document_fields = array(), $rubric_id = 0, $default = null) $tpl_dir = $fld_dir . 'tpl/';
{
global $AVE_Template; $lang_file = $fld_dir . 'lang/' . (defined('ACP')
? $_SESSION['admin_language']
: $_SESSION['user_language']) . '.txt';
$fld_dir = dirname(__FILE__) . '/'; $AVE_Template->config_load($lang_file, 'lang');
$tpl_dir = $fld_dir . 'tpl/'; $AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$lang_file = $fld_dir . 'lang/' . (defined('ACP') $res = '';
? $_SESSION['admin_language']
: $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang'); switch ($action)
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); {
$AVE_Template->config_load($lang_file, 'admin'); case 'edit':
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', (int)$field_value);
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
$res = ''; $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
switch ($action) return $AVE_Template->fetch($tpl_file);
{ break;
case 'edit':
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', (int)$field_value);
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); case 'doc':
$field_value = clean_php($field_value);
return $AVE_Template->fetch($tpl_file); $res = ((int)$field_value === 1)
break; ? (int)$field_value
: null;
case 'doc': $tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
$field_value = clean_php($field_value);
$res = ((int)$field_value === 1) if ($tpl_empty && $tpl_file)
? (int)$field_value {
: 0; $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_default', $default);
$AVE_Template->assign('field_value', $field_value);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc'); return $AVE_Template->fetch($tpl_file);
}
if ($tpl_empty && $tpl_file) return $res;
{ break;
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
}
return $res; case 'req':
break; $field_value = clean_php($field_value);
case 'req': $res = ((int)$field_value === 1)
$field_value = clean_php($field_value); ? (int)$field_value
: null;
$res = ((int)$field_value === 1) $tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
? (int)$field_value
: 0;
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req'); if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_default', $default);
$AVE_Template->assign('field_value', $field_value);
if ($tpl_empty && $tpl_file) return $AVE_Template->fetch($tpl_file);
{ }
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
}
return $res; return $res;
break; break;
case 'save': case 'save':
$field_value = clean_php($field_value); $field_value = clean_php($field_value);
$res = ((int)$field_value === 1) $res = ((int)$field_value === 1)
? $field_value ? $field_value
: '0'; : null;
break; break;
case 'name': case 'name':
return $AVE_Template->get_config_vars('name'); return $AVE_Template->get_config_vars('name');
break; break;
} }
return ($res ? $res : $field_value); return ($res ? $res : $field_value);
} }
?> ?>

5
fields/checkbox/tpl/field-doc.tpl

@ -1 +1,6 @@
{*
$field_id
$field_default
$field_value
*}
{$field_value} {$field_value}

5
fields/checkbox/tpl/field-req.tpl

@ -1 +1,6 @@
{*
$field_id
$field_default
$field_value
*}
{$field_value} {$field_value}

2
fields/checkbox/tpl/field.tpl

@ -1,2 +1,2 @@
<input type="hidden" name="feld[{$field_id}]" value=""> <input type="hidden" name="feld[{$field_id}]" value="0">
<input type="checkbox" name="feld[{$field_id}]" value="1" {if $field_value == 1}checked{/if} /> <input type="checkbox" name="feld[{$field_id}]" value="1" {if $field_value == 1}checked{/if} />

163
fields/checkbox_multi/field.php

@ -0,0 +1,163 @@
<?php
/**
* AVE.cms
*
* @package AVE.cms
* @version 3.x
* @filesource
* @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
// Мульти чекбокс
function get_field_checkbox_multi($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{
global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$res = array();
switch ($action)
{
case 'edit':
$default_items = explode(',', $default);
$default_items = array_diff($default_items, array(''));
$field_value_array = explode('|', $field_value);
$field_value_array = array_values(array_diff($field_value_array, array('')));
$AVE_Template->assign('items', $default_items);
$AVE_Template->assign('used', $field_value_array);
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
return $AVE_Template->fetch($tpl_file);
break;
case 'doc':
$default_items = explode(',', $default);
$items = explode('|', $field_value);
$items = array_diff($items, array(''));
if (! empty($items))
{
foreach($items as $item)
{
if ($item)
{
if ($tpl_empty)
{
$item = $default_items[(int)$item-1];
}
else
{
$field_param = explode('|', $item);
$item = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param, $default_items)
{
return $default_items[$field_param[(int)$data[1]]-1];
},
$tpl
);
}
}
$res[] = $item;
}
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res);
$AVE_Template->assign('rubric_id', $rubric_id);
$AVE_Template->assign('default', $default_items);
return $AVE_Template->fetch($tpl_file);
}
return (! empty($res))
? implode(PHP_EOL, $res)
: $tpl;
break;
case 'req':
$default_items = explode(',', $default);
$items = explode('|', $field_value);
$items = array_diff($items, array(''));
if (! empty($items))
{
foreach($items as $item)
{
if ($item)
{
if ($tpl_empty)
{
$item = $default_items[(int)$item-1];
}
else
{
$field_param = explode('|', $item);
$item = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param, $default_items)
{
return $default_items[$field_param[(int)$data[1]]-1];
},
$tpl
);
}
}
$res[] = $item;
}
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res);
$AVE_Template->assign('rubric_id', $rubric_id);
$AVE_Template->assign('default', $default_items);
return $AVE_Template->fetch($tpl_file);
}
return (! empty($res))
? implode(PHP_EOL, $res)
: $tpl;
break;
case 'name':
return $AVE_Template->get_config_vars('name');
break;
}
return ($res ? $res : $field_value);
}
?>

0
fields/multi_checkbox/lang/bg.txt → fields/checkbox_multi/lang/bg.txt

0
fields/multi_checkbox/lang/cz.txt → fields/checkbox_multi/lang/cz.txt

0
fields/multi_checkbox/lang/en.txt → fields/checkbox_multi/lang/en.txt

0
fields/multi_checkbox/lang/pl.txt → fields/checkbox_multi/lang/pl.txt

0
fields/multi_checkbox/lang/ru.txt → fields/checkbox_multi/lang/ru.txt

0
fields/multi_checkbox/lang/ua.txt → fields/checkbox_multi/lang/ua.txt

0
fields/multi_checkbox/tpl/field-doc.tpl → fields/checkbox_multi/tpl/field-doc.tpl

0
fields/multi_checkbox/tpl/field-req.tpl → fields/checkbox_multi/tpl/field-req.tpl

0
fields/multi_checkbox/tpl/field.tpl → fields/checkbox_multi/tpl/field.tpl

146
fields/code/field.php

@ -1,54 +1,112 @@
<?php <?php
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Код (Codemirror) // Код (Codemirror)
function get_field_code ($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength='', $document_fields=array(), $rubric_id=0, $default='') function get_field_code ($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength='', $document_fields=array(), $rubric_id=0, $default='', $_tpl=null)
{
global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
switch ($action)
{ {
case 'edit': global $AVE_Template;
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value); $fld_dir = dirname(__FILE__) . '/';
$AVE_Template->assign('doc_id', (int)$_REQUEST['Id']); $tpl_dir = $fld_dir . 'tpl/';
$AVE_Template->assign('rubric_id', $rubric_id);
$AVE_Template->assign('f_id', $field_id.'_'.$_REQUEST['Id']); $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
switch ($action)
{
case 'edit':
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$AVE_Template->assign('doc_id', (int)$_REQUEST['Id']);
$AVE_Template->assign('rubric_id', $rubric_id);
$AVE_Template->assign('f_id', $field_id.'_'.(int)$_REQUEST['Id']);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
return $AVE_Template->fetch($tpl_file);
break;
case 'doc':
$AVE_Template->config_load($lang_file, 'public');
if (! $tpl_empty)
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function ($data) use ($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_default', $default);
$AVE_Template->assign('field_value', $field_value);
$AVE_Template->assign('rubric_id', $rubric_id);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
case 'req':
$AVE_Template->config_load($lang_file, 'public');
if (! $tpl_empty)
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_default', $default);
$AVE_Template->assign('field_value', $field_value);
$AVE_Template->assign('rubric_id', $rubric_id);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
break; }
case 'doc': return $field_value;
case 'req': break;
return get_field_default($field_value, $action, $field_id, $tpl, $tpl_empty);
break;
case 'name': case 'name':
return $AVE_Template->get_config_vars('name'); return $AVE_Template->get_config_vars('name');
break; break;
default: return $field_value; default: return $field_value;
}
} }
}
?> ?>

6
fields/code/tpl/field-doc.tpl

@ -0,0 +1,6 @@
{*
$field_id
$field_default
$field_value
*}
{$field_value}

6
fields/code/tpl/field-req.tpl

@ -0,0 +1,6 @@
{*
$field_id
$field_default
$field_value
*}
{$field_value}

219
fields/date/field.php

@ -1,117 +1,126 @@
<? <?
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Дата (TimeStamp) // Дата (TimeStamp)
function get_field_date($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){ function get_field_date($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{
global $AVE_Template;
global $AVE_Template; $fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$fld_dir = dirname(__FILE__) . '/'; $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$tpl_dir = $fld_dir . 'tpl/';
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; $AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$AVE_Template->config_load($lang_file, 'lang'); $res=0;
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$res=0; switch ($action)
{
case 'edit':
$field_value = ($field_value != 0) ? $field_value : '';
switch ($action) $AVE_Template->assign('field_id', $field_id);
{
case 'edit':
$field_value = ($field_value != 0) ? $field_value : '';
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$AVE_Template->assign('doc_id', (int)$_REQUEST['Id']);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
return $AVE_Template->fetch($tpl_file);
break;
case 'doc':
$field_value = clean_php($field_value);
if ($tpl_empty)
{
$value = pretty_date(strftime(TIME_FORMAT, $field_value));
}
else
{
$value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_value)
{
return $field_value;
},
$tpl
);
return $res = $value;
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
if($tpl_empty && $tpl_file){
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
}
$res = $field_value;
break;
case 'req':
$field_value = clean_php($field_value);
if ($tpl_empty)
{
$value = pretty_date(strftime(TIME_FORMAT, $field_value));
}
else
{
$value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_value)
{
return $field_value;
},
$tpl
);
return $res = $value;
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
if($tpl_empty && $tpl_file){
$AVE_Template->assign('field_value', $field_value); $AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file); $AVE_Template->assign('doc_id', (int)$_REQUEST['Id']);
}
$res = $field_value;
break;
case 'save':
$res = $field_value;
break;
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
case 'name': return $AVE_Template->fetch($tpl_file);
return $AVE_Template->get_config_vars('name'); break;
break;
case 'doc':
$field_value = clean_php($field_value);
if ($tpl_empty)
{
$value = pretty_date(strftime(TIME_FORMAT, $field_value));
}
else
{
$value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_value)
{
return $field_value;
},
$tpl
);
return $res = $value;
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$AVE_Template->assign('field_default', $default);
return $AVE_Template->fetch($tpl_file);
}
$res = $field_value;
break;
case 'req':
$field_value = clean_php($field_value);
if ($tpl_empty)
{
$value = pretty_date(strftime(TIME_FORMAT, $field_value));
}
else
{
$value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_value)
{
return $field_value;
},
$tpl
);
return $res = $value;
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$AVE_Template->assign('field_default', $default);
return $AVE_Template->fetch($tpl_file);
}
$res = $field_value;
break;
case 'save':
$res = $field_value;
break;
case 'name':
return $AVE_Template->get_config_vars('name');
break;
}
return ($res ? $res : $field_value);
} }
return ($res ? $res : $field_value); ?>
}
?>

288
fields/doc_from_rub/field.php

@ -1,170 +1,180 @@
<? <?
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Документ из рубрики // Документ из рубрики
function get_field_doc_from_rub($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){ function get_field_doc_from_rub($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{
global $AVE_DB, $AVE_Template; global $AVE_DB, $AVE_Template;
$fld_dir = dirname(__FILE__) . '/'; $fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/'; $tpl_dir = $fld_dir . 'tpl/';
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang'); $AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); $AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin'); $AVE_Template->config_load($lang_file, 'admin');
$res = 0; $res = 0;
switch ($action) switch ($action)
{ {
case 'edit': case 'edit':
if (isset($default)) if (isset($default))
{
$parent = $AVE_DB->Query("
SELECT
MIN(document_parent) AS min
FROM
". PREFIX ."_documents
WHERE
rubric_id IN (" . $default . ")
")->GetCell();
$sql = $AVE_DB->Query("
SELECT
Id, document_parent, document_title
FROM
". PREFIX ."_documents
WHERE
rubric_id IN (" . $default . ")
");
$cats = array();
while($cat = $sql->FetchAssocArray())
{ {
$cats_ID[$cat['Id']][] = $cat; $parent = $AVE_DB->Query("
$cats[$cat['document_parent']][$cat['Id']] = $cat; SELECT
MIN(document_parent) AS min
FROM
". PREFIX ."_documents
WHERE
rubric_id IN (" . $default . ")
")->GetCell();
$sql = $AVE_DB->Query("
SELECT
Id, document_parent, document_title
FROM
". PREFIX ."_documents
WHERE
rubric_id IN (" . $default . ")
");
$cats = array();
while ($cat = $sql->FetchAssocArray())
{
$cats_ID[$cat['Id']][] = $cat;
$cats[$cat['document_parent']][$cat['Id']] = $cat;
}
$AVE_Template->assign('subtpl', $tpl_dir . "list.tpl");
$AVE_Template->assign('fields', doc_from_rub_tree($cats, $parent));
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
$AVE_Template->assign('field_value', $field_value);
}
else
{
$AVE_Template->assign('error', $AVE_Template->get_config_vars('error'));
} }
$AVE_Template->assign('subtpl', $tpl_dir . "list.tpl"); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
$AVE_Template->assign('fields', doc_from_rub_tree($cats, $parent));
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
$AVE_Template->assign('field_value', $field_value);
}
else
{
$AVE_Template->assign('error', $AVE_Template->get_config_vars('error'));
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
break; break;
case 'doc': case 'doc':
$document = get_document($field_value); $document = get_document($field_value);
if ($tpl_empty) if ($tpl_empty)
{
$field_value = $document['document_title'];
$field_value = clean_php($field_value);
$field_value = stripcslashes($field_value);
$field_value = htmlspecialchars_decode($field_value);
}
else
{ {
$field_param = explode('|', $field_value); $field_value = $document['document_title'];
$field_value = preg_replace_callback( $field_value = clean_php($field_value);
'/\[tag:parametr:(\d+)\]/i', $field_value = stripcslashes($field_value);
function($data) use($field_param) $field_value = htmlspecialchars_decode($field_value);
{
return $field_param[(int)$data[1]];
},
$tpl
);
} }
else
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$AVE_Template->assign('document', $document);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc'); return $AVE_Template->fetch($tpl_file);
}
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('document', $document);
return $AVE_Template->fetch($tpl_file);
}
$res = $field_value; $res = $field_value;
break; break;
case 'req': case 'req':
$document = get_document($field_value); $document = get_document($field_value);
if ($tpl_empty) if ($tpl_empty)
{
$field_value = $document['document_title'];
$field_value = clean_php($field_value);
$field_value = stripcslashes($field_value);
$field_value = htmlspecialchars_decode($field_value);
}
else
{ {
$field_param = explode('|', $field_value); $field_value = $document['document_title'];
$field_value = preg_replace_callback( $field_value = clean_php($field_value);
'/\[tag:parametr:(\d+)\]/i', $field_value = stripcslashes($field_value);
function($data) use($field_param) $field_value = htmlspecialchars_decode($field_value);
{
return $field_param[(int)$data[1]];
},
$tpl
);
} }
else
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$AVE_Template->assign('document', $document);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req'); return $AVE_Template->fetch($tpl_file);
}
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('document', $document);
return $AVE_Template->fetch($tpl_file);
}
$res = $field_value; $res = $field_value;
break; break;
case 'name': case 'name':
return $AVE_Template->get_config_vars('name'); return $AVE_Template->get_config_vars('name');
break; break;
}
return ($res ? $res : $field_value);
} }
return ($res ? $res : $field_value);
}
function doc_from_rub_tree($cats, $parent)
{ if (! function_exists('doc_from_rub_tree'))
if (is_array($cats) and isset($cats[$parent]))
{ {
foreach($cats[$parent] as $cat) function doc_from_rub_tree($cats, $parent)
{ {
$array[$cat['Id']]['Id'] = $cat['Id']; if (is_array($cats) and isset($cats[$parent]))
$array[$cat['Id']]['document_title'] = $cat['document_title']; {
$array[$cat['Id']]['child'] = doc_from_rub_tree($cats, $cat['Id']); foreach($cats[$parent] as $cat)
{
$array[$cat['Id']]['Id'] = $cat['Id'];
$array[$cat['Id']]['document_title'] = $cat['document_title'];
$array[$cat['Id']]['child'] = doc_from_rub_tree($cats, $cat['Id']);
}
}
else
{
return null;
}
return $array;
} }
} }
else
{
return null;
}
return $array;
}
?> ?>

295
fields/doc_from_rub_check/field.php

@ -1,201 +1,204 @@
<? <?
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Документ из рубрики (Checkbox) // Документ из рубрики (Checkbox)
function get_field_doc_from_rub_check($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){ function get_field_doc_from_rub_check($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{
global $AVE_DB, $AVE_Template; global $AVE_DB, $AVE_Template;
$fld_dir = dirname(__FILE__) . '/'; $fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/'; $tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir); $fld_name = basename($fld_dir);
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang'); $AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); $AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin'); $AVE_Template->config_load($lang_file, 'admin');
$res = array(); $res = array();
switch ($action) switch ($action)
{ {
case 'edit': case 'edit':
if (isset($default)) if (isset($default))
{ {
$parent = $AVE_DB->Query(" $parent = $AVE_DB->Query("
SELECT
MIN(document_parent) AS min
FROM
". PREFIX ."_documents
WHERE
rubric_id IN (" . $default . ")
")->GetCell();
$sql = $AVE_DB->Query("
SELECT SELECT
MIN(document_parent) AS min Id, document_parent, document_title
FROM FROM
". PREFIX ."_documents ". PREFIX ."_documents
WHERE WHERE
rubric_id IN (" . $default . ") rubric_id IN (" . $default . ")
")->GetCell(); ");
$sql = $AVE_DB->Query(" $field_value_array = explode('|', $field_value);
SELECT $field_value_array = array_values(array_diff($field_value_array, array('')));
Id, document_parent, document_title
FROM
". PREFIX ."_documents
WHERE
rubric_id IN (" . $default . ")
");
$field_value_array = explode('|', $field_value); $cats = array();
$field_value_array = array_values(array_diff($field_value_array, array('')));
$cats = array(); while($cat = $sql->FetchAssocArray())
{
$cat['checked'] = ((in_array($cat['Id'], $field_value_array) == false) ? "0" : "1");
$cats_ID[$cat['Id']][] = $cat;
$cats[$cat['document_parent']][$cat['Id']] = $cat;
}
while($cat = $sql->FetchAssocArray()) $AVE_Template->assign('subtpl', $tpl_dir."list.tpl");
$AVE_Template->assign('fields', doc_from_rub_check_tree($cats, $parent));
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
$AVE_Template->assign('field_value', $field_value);
}
else
{ {
$cat['checked'] = ((in_array($cat['Id'], $field_value_array) == false) ? "0" : "1"); $AVE_Template->assign('error', $AVE_Template->get_config_vars('error'));
$cats_ID[$cat['Id']][] = $cat;
$cats[$cat['document_parent']][$cat['Id']] = $cat;
} }
$AVE_Template->assign('subtpl', $tpl_dir."list.tpl"); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
$AVE_Template->assign('fields', doc_from_rub_check_tree($cats, $parent));
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
$AVE_Template->assign('field_value', $field_value);
}
else
{
$AVE_Template->assign('error', $AVE_Template->get_config_vars('error'));
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
$AVE_Template->assign('subtpl', $tpl_dir."list.tpl"); $AVE_Template->assign('subtpl', $tpl_dir."list.tpl");
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
break; break;
case 'doc': case 'doc':
$field_value_array = explode('|', $field_value); $field_value_array = explode('|', $field_value);
$field_value_array = array_values(array_diff($field_value_array, array(''))); $field_value_array = array_values(array_diff($field_value_array, array('')));
if ($field_value_array != false) if ($field_value_array != false)
{
foreach ($field_value_array as $list_item)
{ {
if ($list_item) foreach ($field_value_array as $list_item)
{ {
if ($tpl_empty) if ($list_item)
{ {
$list_item = $AVE_DB->Query(" if ($tpl_empty)
SELECT {
Id, $list_item = $AVE_DB->Query("
document_title, SELECT
document_alias, Id,
document_breadcrum_title document_title,
FROM document_alias,
".PREFIX."_documents document_breadcrum_title
WHERE FROM
Id = '" . $list_item . "' ".PREFIX."_documents
")->FetchAssocArray(); WHERE
Id = '" . $list_item . "'
")->FetchAssocArray();
}
} }
$res[] = $list_item;
} }
$res[] = $list_item;
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res)); $AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl; return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl;
break; break;
case 'req': case 'req':
$field_value_array = explode('|', $field_value); $field_value_array = explode('|', $field_value);
$field_value_array = array_values(array_diff($field_value_array, array(''))); $field_value_array = array_values(array_diff($field_value_array, array('')));
if ($field_value_array != false) if ($field_value_array != false)
{
foreach ($field_value_array as $list_item)
{ {
if ($list_item) foreach ($field_value_array as $list_item)
{ {
if ($tpl_empty) if ($list_item)
{ {
$list_item = $AVE_DB->Query(" if ($tpl_empty)
SELECT {
Id, $list_item = $AVE_DB->Query("
document_title, SELECT
document_alias, Id,
document_breadcrum_title document_title,
FROM document_alias,
".PREFIX."_documents document_breadcrum_title
WHERE FROM
Id = '" . $list_item . "' ".PREFIX."_documents
")->FetchAssocArray(); WHERE
Id = '" . $list_item . "'
")->FetchAssocArray();
}
} }
$res[] = $list_item;
} }
$res[] = $list_item;
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res)); $AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl; return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl;
break; break;
case 'name' : case 'name' :
return $AVE_Template->get_config_vars('name'); return $AVE_Template->get_config_vars('name');
break; break;
} }
return ($res ? $res : $field_value); return ($res ? $res : $field_value);
} }
function doc_from_rub_check_tree($cats, $parent) if (! function_exists('doc_from_rub_check_tree'))
{
if (is_array($cats) and isset($cats[$parent]))
{ {
foreach ($cats[$parent] as $cat) function doc_from_rub_check_tree($cats, $parent)
{ {
$array[$cat['Id']]['Id'] = $cat['Id']; if (is_array($cats) and isset($cats[$parent]))
$array[$cat['Id']]['checked'] = $cat['checked']; {
$array[$cat['Id']]['document_title'] = $cat['document_title']; foreach ($cats[$parent] as $cat)
$array[$cat['Id']]['child'] = doc_from_rub_check_tree($cats, $cat['Id']); {
$array[$cat['Id']]['Id'] = $cat['Id'];
$array[$cat['Id']]['checked'] = $cat['checked'];
$array[$cat['Id']]['document_title'] = $cat['document_title'];
$array[$cat['Id']]['child'] = doc_from_rub_check_tree($cats, $cat['Id']);
}
}
else
{
return null;
}
return $array;
} }
} }
else
{
return null;
}
return $array;
}
?> ?>

358
fields/doc_from_rub_search/field.php

@ -1,224 +1,224 @@
<?php <?php
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Документы из рубрик (Поиск) // Документы из рубрик (Поиск)
function get_field_doc_from_rub_search($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength = '', $doc_fields=array(), $rubric_id=0, $default='') function get_field_doc_from_rub_search($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength = '', $doc_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{
global $AVE_DB, $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir);
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$res = array();
switch ($action)
{ {
case 'edit': global $AVE_DB, $AVE_Template;
$items = array(); $fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir);
if ($field_value != '' && $field_value != $default) $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
{
$items = explode('|', $field_value);
$items = array_values(array_diff($items, array('')));
}
if(! empty($items)) $AVE_Template->config_load($lang_file, 'lang');
{ $AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
foreach($items as $k => $v) $AVE_Template->config_load($lang_file, 'admin');
$res = array();
switch ($action)
{
case 'edit':
$items = array();
if ($field_value != '' && $field_value != $default)
{ {
$list[$k]['param'] = htmlspecialchars(get_document($v, 'document_title'), ENT_QUOTES); $items = explode('|', $field_value);
$list[$k]['value'] = $v; $items = array_values(array_diff($items, array('')));
} }
$items = $list; if(! empty($items))
}
else
{ {
$items[0]['param'] = ''; foreach($items as $k => $v)
$items[0]['value'] = ''; {
$list[$k]['param'] = htmlspecialchars(get_document($v, 'document_title'), ENT_QUOTES);
$list[$k]['value'] = $v;
}
$items = $list;
} }
else
{
$items[0]['param'] = '';
$items[0]['value'] = '';
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
$AVE_Template->assign('doc_id', $_REQUEST['Id']); $AVE_Template->assign('doc_id', $_REQUEST['Id']);
$AVE_Template->assign('items', $items); $AVE_Template->assign('items', $items);
$AVE_Template->assign('field_dir', $fld_name); $AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
case 'save': case 'save':
foreach ($field_value as $v) foreach ($field_value as $v)
{
if (! empty($v['value']))
{ {
$field_value_new[] = $v['value']; if (! empty($v['value']))
{
$field_value_new[] = $v['value'];
}
} }
}
if (isset($field_value_new)) if (isset($field_value_new))
{
return '|' . implode('|', $field_value_new) . '|';
}
else
{ {
return $field_value_new = ''; return '|' . implode('|', $field_value_new) . '|';
} }
break; else
{
return $field_value_new = '';
}
break;
case 'doc': case 'doc':
$field_value_array = explode('|', $field_value); $field_value_array = explode('|', $field_value);
$field_value_array = array_values(array_diff($field_value_array, array(''))); $field_value_array = array_values(array_diff($field_value_array, array('')));
if ($field_value_array != false) if ($field_value_array != false)
{
foreach ($field_value_array as $list_item)
{ {
if ($list_item) foreach ($field_value_array as $list_item)
{ {
if ($tpl_empty) if ($list_item)
{ {
$list_item = $AVE_DB->Query(" if ($tpl_empty)
SELECT {
Id, $list_item = $AVE_DB->Query("
document_title, SELECT
document_alias, Id,
document_breadcrum_title document_title,
FROM document_alias,
".PREFIX."_documents document_breadcrum_title
WHERE FROM
Id = '" . $list_item . "' ".PREFIX."_documents
")->FetchAssocArray(); WHERE
Id = '" . $list_item . "'
")->FetchAssocArray();
}
} }
$res[] = $list_item;
} }
$res[] = $list_item;
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res)); $AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl; return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl;
break; break;
case 'req': case 'req':
$field_value_array = explode('|', $field_value); $field_value_array = explode('|', $field_value);
$field_value_array = array_values(array_diff($field_value_array, array(''))); $field_value_array = array_values(array_diff($field_value_array, array('')));
if ($field_value_array != false) if ($field_value_array != false)
{
foreach ($field_value_array as $list_item)
{ {
if ($list_item) foreach ($field_value_array as $list_item)
{ {
if ($tpl_empty) if ($list_item)
{ {
$list_item = $AVE_DB->Query(" if ($tpl_empty)
SELECT {
Id, $list_item = $AVE_DB->Query("
document_title, SELECT
document_alias, Id,
document_breadcrum_title document_title,
FROM document_alias,
".PREFIX."_documents document_breadcrum_title
WHERE FROM
Id = '" . $list_item . "' ".PREFIX."_documents
")->FetchAssocArray(); WHERE
Id = '" . $list_item . "'
")->FetchAssocArray();
}
} }
$res[] = $list_item;
} }
$res[] = $list_item;
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res)); $AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl; return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl;
break; break;
case 'name' : case 'name' :
return $AVE_Template->get_config_vars('name'); return $AVE_Template->get_config_vars('name');
break; break;
case 'search': case 'search':
$default = get_field_default_value($_REQUEST['field_id']); $default = get_field_default_value($_REQUEST['field_id']);
$sql = $AVE_DB->Query(" $sql = $AVE_DB->Query("
SELECT SELECT
doc.Id, doc.Id,
doc.document_title, doc.document_title,
rub.rubric_title rub.rubric_title
FROM FROM
" . PREFIX . "_documents AS doc " . PREFIX . "_documents AS doc
JOIN JOIN
" . PREFIX . "_rubrics AS rub " . PREFIX . "_rubrics AS rub
ON doc.rubric_id = rub.Id ON doc.rubric_id = rub.Id
WHERE WHERE
doc.rubric_id IN (" . $default . ") doc.rubric_id IN (" . $default . ")
AND AND
doc.document_status = 1 doc.document_status = 1
AND AND
UPPER (doc.document_title) LIKE UPPER('%" . $_REQUEST['q'] . "%') UPPER (doc.document_title) LIKE UPPER('%" . $_REQUEST['q'] . "%')
GROUP BY GROUP BY
doc.Id doc.Id
LIMIT LIMIT
0,5 0,5
"); ");
$doc_finded = array(); $doc_finded = array();
while ($row = $sql->FetchRow()) while ($row = $sql->FetchRow())
{ {
$doc_finded[] = array( $doc_finded[] = array(
'doc_id' => $row->Id, 'doc_id' => $row->Id,
'doc_title' => $row->document_title, 'doc_title' => $row->document_title,
'doc_rubric' => $row->rubric_title 'doc_rubric' => $row->rubric_title
); );
} }
echo json_encode($doc_finded);
exit;
default:
return $field_value;
}
return ($res ? $res : $field_value); echo json_encode($doc_finded);
} exit;
default:
return $field_value;
}
return ($res ? $res : $field_value);
}
?> ?>

127
fields/doc_from_rub_search/js/outside.js

@ -1,127 +0,0 @@
var DocSearch = {
init: false,
init: function() {
if (this.initialized) return;
this.initialized = true;
this.DocSearch_items();
},
DocSearch_items: function() {
this.DocSearch_sortable();
this.DocSearch_del_item();
this.DocSearch_add();
this.DocSearch_search();
},
DocSearch_update: function() {
this.DocSearch_maxid();
this.DocSearch_del_item();
this.DocSearch_search();
AveAdmin.tooltip();
},
DocSearch_maxid: function(id) {
var maxid = 1;
$('#docsearch_lists_' + id).children('.docsearch_list').each(function() {
maxid = Math.max(maxid, parseInt($(this).attr("data-id")) + 1);
});
return maxid;
},
DocSearch_del_item: function() {
$('.docsearch_list .DelButton').on('click', function(event) {
event.preventDefault();
var id = $(this).attr('data-id');
jConfirm(
docsearch_del_conf,
docsearch_del_head,
function(b) {
if (b) {
$('#docsearch_list_' + id).remove();
}
}
);
});
},
DocSearch_add: function() {
$('.AddButton').on('click', function() {
c_id = $(this).parent().parent('.docsearch_lists').attr("data-id");
d_id = $(this).parent().parent('.docsearch_lists').attr("data-docid");
i_id = DocSearch.DocSearch_maxid(d_id + '_' + c_id);
$('#docsearch_lists_' + d_id + '_' + c_id + ':last').append(
'<div class="docsearch_list fix mb10" id="docsearch_list_' + d_id + '_' + c_id + '_' + i_id + '" data-id="' + i_id + '">' +
'<input class="mousetrap search_docsearch" name="data[' + d_id + '][feld][' + c_id + '][' + i_id + '][param]" type="text" value="" placeholder="' + docsearch_param + '" data-docid="' + d_id + '" data-fieldid="' + c_id + '" data-id="' + i_id + '" style="width: 450px;"/>&nbsp;&nbsp;Id:&nbsp;<input type="text" class="mousetrap field_' + d_id + '_' + c_id + '_' + i_id + '" value="" name="data[' + d_id + '][feld][' + c_id + '][' + i_id + '][value]" placeholder="' + docsearch_value + '" style="width: 50px;" readonly />&nbsp;&nbsp;<a href="javascript:void(0);" data-id="' + d_id + '_' + c_id + '_' + i_id + '" class="button redBtn topDir DelButton" title="' + docsearch_del + '">&times;</a>' +
'<div class="handle" style="float: left; display: inline-block; margin: 4px 7px; cursor: move;"><span class="icon_sprite ico_move"></span></div>' +
'</div>'
);
DocSearch.DocSearch_update();
});
},
DocSearch_sortable: function() {
$('.docsearch_lists').sortable({
handle: ".handle",
placeholder: "ui-state-highlight grey_bg"
});
},
/**
* @return {boolean}
*/
DocSearch_search: function() {
$(document).on('input', '.search_docsearch', function(event)
{
event.preventDefault();
var query = $(this);
var did = query.attr('data-docid');
var fid = query.attr('data-fieldid');
var kid = query.attr('data-id');
var field_id_input = $('.field_' + did + '_' + fid + '_' + kid);
query.autocomplete("index.php?do=fields&field=doc_from_rub_search&type=search&doc_id=" + did + "&field_id=" + fid, {
width: query.outerWidth(),
max: 5,
dataType: "json",
matchContains: "word",
scroll: true,
scrollHeight: 200,
parse: function(data) {
return $.map(data, function(row) {
return {
data: row,
value: row.doc_title,
result: query.val()
}
});
},
formatItem: function(item) {
return '<div style="padding: 3px 0;"><span style="font-weight: 700;">(' + item.doc_rubric + ')</span> ' + item.doc_title + '</div>';
}
}).result(function(event, item) {
query.val(item.doc_title);
field_id_input.val(item.doc_id);
query.unautocomplete();
});
return false;
});
return false;
}
}
$(document).ready(function()
{
DocSearch.init();
});

76
fields/download/field.php

@ -1,76 +0,0 @@
<?
/**
* AVE.cms
*
* @package AVE.cms
* @version 3.x
* @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
// Загрузить файл
function get_field_download($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){
global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$res=0;
switch ($action)
{
case 'edit':
$field_value = !empty($field_value) ? htmlspecialchars($field_value, ENT_QUOTES) : '';
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
return $AVE_Template->fetch($tpl_file);
break;
case 'doc':
$field_value = clean_php($field_value);
$field_param = explode('|', $field_value);
if ($tpl_empty)
{
$field_value = (!empty($field_param[1]) ? $field_param[1] . '<br />' : '')
. '<form method="get" target="_blank" action="' . $field_param[0]
. '"><input class="basicBtn" type="submit" value="Скачать" /></form>';
}
else
{
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$res = $field_value;
break;
case 'req':
$res=get_field_default($field_value,$action,$field_id,$tpl,$tpl_empty,$maxlength,$document_fields,$rubric_id);
break;
case 'name' :
return $AVE_Template->get_config_vars('name');
break;
}
return ($res ? $res : $field_value);
}
?>

3
fields/download/lang/bg.txt

@ -1,3 +0,0 @@
[admin]
name = "Линк към файл"

2
fields/download/lang/cz.txt

@ -1,2 +0,0 @@
[admin]
name = "Soubor ke stažení"

2
fields/download/lang/en.txt

@ -1,2 +0,0 @@
[admin]
name = "Download file"

2
fields/download/lang/pl.txt

@ -1,2 +0,0 @@
[admin]
name = "Pobierz plik"

2
fields/download/lang/ru.txt

@ -1,2 +0,0 @@
[admin]
name = "Загрузить файл"

2
fields/download/lang/ua.txt

@ -1,2 +0,0 @@
[admin]
name = "Завантажити файл"

7
fields/download/tpl/field.tpl

@ -1,7 +0,0 @@
<div style="" id="feld_{$field_id}"><a name="{$field_id}"></a>
<div style="display:none" id="feld_{$field_id}">
<img style="display:none" id="_img_feld__{$field_id}" src="{$field_value}" alt="" border="0" /></div>
<div style="display:none" id="span_feld__{$field_id}"></div>
<input class="mousetrap" type="text" style="width: 400px;" name="feld[{$field_id}]" value="{$field_value|escape}" id="img_feld__{$field_id}" />&nbsp;
<input value="{#MAIN_OPEN_MEDIAPATH#}"" class="basicBtn" type="button" onclick="browse_uploads('img_feld__{$field_id}', '', '', '0');" />&nbsp;
<a class="button blackBtn topDir" title="{#DOC_FILE_TYPE_HELP#}" href="#">?</a>

168
fields/drop_down/field.php

@ -1,87 +1,91 @@
<? <?
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Выпадающий список // Выпадающий список
function get_field_drop_down($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null) function get_field_drop_down($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{
global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$res = 0;
switch ($action)
{ {
case 'edit': global $AVE_Template;
$items = array();
$items = explode(',', $default); $fld_dir = dirname(__FILE__) . '/';
$items = array_diff($items, array('')); $tpl_dir = $fld_dir . 'tpl/';
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->assign('items', $items); $AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->assign('field_value', trim($field_value)); $AVE_Template->config_load($lang_file, 'admin');
return $AVE_Template->fetch($tpl_file); $res = 0;
break;
switch ($action)
case 'doc': {
@$field_value = clean_php($field_value); case 'edit':
if (!$tpl_empty) $items = array();
{ $items = explode(',', $default);
$field_param = explode('|', $field_value); $items = array_diff($items, array(''));
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i', $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
function($data) use($field_param)
{ $AVE_Template->assign('items', $items);
return $field_param[(int)$data[1]]; $AVE_Template->assign('field_id', $field_id);
}, $AVE_Template->assign('field_value', trim($field_value));
$tpl
); return $AVE_Template->fetch($tpl_file);
} break;
$res = $field_value;
break; case 'doc':
@$field_value = clean_php($field_value);
case 'req':
@$field_value = clean_php($field_value); if (! $tpl_empty)
if (!$tpl_empty) {
{ $field_param = explode('|', $field_value);
$field_param = explode('|', $field_value); $field_value = preg_replace_callback(
$field_value = preg_replace_callback( '/\[tag:parametr:(\d+)\]/i',
'/\[tag:parametr:(\d+)\]/i', function($data) use($field_param)
function($data) use($field_param) {
{ return $field_param[(int)$data[1]];
return $field_param[(int)$data[1]]; },
}, $tpl
$tpl );
); }
}
$res = $field_value; $res = $field_value;
break; break;
case 'name': case 'req':
return $AVE_Template->get_config_vars('name'); @$field_value = clean_php($field_value);
break;
if (! $tpl_empty)
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$res = $field_value;
break;
case 'name':
return $AVE_Template->get_config_vars('name');
break;
}
return ($res ? $res : $field_value);
} }
return ($res ? $res : $field_value); ?>
}
?>

122
fields/drop_down_key/field.php

@ -1,78 +1,78 @@
<? <?
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Выпадающий список (Ключ) // Выпадающий список (Ключ)
function get_field_drop_down_key($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null) function get_field_drop_down_key($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{ {
global $AVE_Template; global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/'; $fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/'; $tpl_dir = $fld_dir . 'tpl/';
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang'); $AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); $AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin'); $AVE_Template->config_load($lang_file, 'admin');
$res = 0; $res = 0;
switch ($action) switch ($action)
{ {
case 'edit': case 'edit':
$items = explode(',', $default); $items = explode(',', $default);
$items = array_diff($items, array('')); $items = array_diff($items, array(''));
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
$AVE_Template->assign('items', $items); $AVE_Template->assign('items', $items);
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', trim($field_value)); $AVE_Template->assign('field_value', trim($field_value));
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
break; break;
case 'doc': case 'doc':
case 'req': case 'req':
@$field_value = clean_php($field_value); @$field_value = clean_php($field_value);
if (!$tpl_empty) if (!$tpl_empty)
{ {
$field_param = explode('|', $field_value); $field_param = explode('|', $field_value);
$field_value = preg_replace_callback( $field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i', '/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param) function($data) use($field_param)
{ {
return $field_param[(int)$data[1]]; return $field_param[(int)$data[1]];
}, },
$tpl $tpl
); );
} }
else else
{ {
$items = explode(',', $default); $items = explode(',', $default);
$items = array_diff($items, array('')); $items = array_diff($items, array(''));
$field_value = $items[$field_value]; $field_value = $items[$field_value];
} }
return $field_value = ($field_value != '') ? $field_value : ''; return $field_value = ($field_value != '') ? $field_value : '';
break; break;
case 'name': case 'name':
return $AVE_Template->get_config_vars('name'); return $AVE_Template->get_config_vars('name');
break; break;
}
return ($res ? $res : $field_value);
} }
return ($res ? $res : $field_value); ?>
}
?>

79
fields/flash/field.php

@ -1,79 +0,0 @@
<?
/**
* AVE.cms
*
* @package AVE.cms
* @version 3.x
* @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
//Flash-ролик
function get_field_flash($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){
global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$res = 0;
switch ($action)
{
case 'edit':
$field_value = !empty($field_value) ? htmlspecialchars($field_value, ENT_QUOTES) : '';
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
return $AVE_Template->fetch($tpl_file);
break;
case 'doc':
$field_value = clean_php($field_value);
$field_param = explode('|', $field_value);
$field_param[1] = (!empty($field_param[1]) && is_numeric($field_param[1])) ? $field_param[1] : 470;
$field_param[2] = (!empty($field_param[2]) && is_numeric($field_param[2])) ? $field_param[2] : 320;
if ($tpl_empty)
{
$field_value = '<embed scale="exactfit" width="' . $field_param[1] . '" height="' . $field_param[2]
. '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'
. ABS_PATH . $field_param[0] . '" play="true" loop="true" menu="true"></embed>';
}
else
{
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$res=$field_value;
break;
case 'req':
$res=get_field_default($field_value,$action,$field_id,$tpl,$tpl_empty,$maxlength,$document_fields,$rubric_id);
break;
case 'name' :
return $AVE_Template->get_config_vars('name');
break;
}
return ($res ? $res : $field_value);
}
?>

2
fields/flash/lang/bg.txt

@ -1,2 +0,0 @@
[admin]
name = "Flash"

2
fields/flash/lang/cz.txt

@ -1,2 +0,0 @@
[admin]
name = "Flash video (Flash)"

2
fields/flash/lang/pl.txt

@ -1,2 +0,0 @@
[admin]
name = "Wideo w formacie Flash"

2
fields/flash/lang/ru.txt

@ -1,2 +0,0 @@
[admin]
name = "Флеш ролик (Flash)"

2
fields/flash/lang/ua.txt

@ -1,2 +0,0 @@
[admin]
name = "Флеш ролик (Flash)"

6
fields/flash/tpl/field.tpl

@ -1,6 +0,0 @@
<a name="{$field_id}"></a>
<div style="display:none" id="feld_{$field_id}"><img style="display:none" id="_img_feld__{$field_id}" src="{$field_value|escape}" alt="" border="0" /></div>
<div style="display:none" id="span_feld__{$field_id}"></div>
<input type="text" style="width: 400px;" name="feld[{$field_id}]" value="{$field_value|escape}" id="img_feld__{$field_id}" />&nbsp;
<input value="{#MAIN_OPEN_MEDIAPATH#}" class="basicBtn" type="button" onclick="browse_uploads('img_feld__{$field_id}', '', '', '0');" />&nbsp;
<a class="button blackBtn topDir" title="{#DOC_FLASH_TYPE_HELP#}" href="#"> ? </a>

25
fields/image_mega/field.php

@ -24,7 +24,7 @@
// Изображение (Каскад) // Изображение (Каскад)
function get_field_image_mega($field_value, $action, $field_id = 0, $tpl = '', $tpl_empty = 0, &$maxlength = null, $document_fields = array(), $rubric_id = 0, $default = null) function get_field_image_mega($field_value, $action, $field_id = 0, $tpl = '', $tpl_empty = 0, &$maxlength = null, $document_fields = array(), $rubric_id = 0, $default = null, $_tpl=null)
{ {
global $AVE_Template, $img_pixel; global $AVE_Template, $img_pixel;
@ -91,9 +91,9 @@
$default = explode('|', $default); $default = explode('|', $default);
list($path, $watermark, $position, $transparency) = $default; list ($path, $watermark, $position, $transparency) = $default;
if(preg_match("/%id/i", $path)) if (preg_match("/%id/i", $path))
{ {
if ($_REQUEST['action'] != 'new') if ($_REQUEST['action'] != 'new')
{ {
@ -122,7 +122,7 @@
? $path_upload . '/' ? $path_upload . '/'
: ''); : '');
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
$AVE_Template->assign('max_files', $AVE_Template->get_config_vars('max_f_f') . $iniset_count); $AVE_Template->assign('max_files', $AVE_Template->get_config_vars('max_f_f') . $iniset_count);
$AVE_Template->assign('dir_upload', $AVE_Template->get_config_vars('upl_dir') . $dir_upload); $AVE_Template->assign('dir_upload', $AVE_Template->get_config_vars('upl_dir') . $dir_upload);
@ -194,7 +194,7 @@
} }
} }
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
@ -268,7 +268,7 @@
} }
} }
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
@ -301,13 +301,9 @@
} }
if (isset($field_value_new)) if (isset($field_value_new))
{
return serialize($field_value_new); return serialize($field_value_new);
}
else else
{ return $field_value_new = '';
return $field_value_new = '';
}
break; break;
@ -365,6 +361,9 @@
if (! is_dir($dir_abs)) if (! is_dir($dir_abs))
mkdir($dir_abs, 0777, true); mkdir($dir_abs, 0777, true);
$new_files = array();
$thumbs = array();
foreach ($_FILES[$files_unput]['name'] as $name => $value) foreach ($_FILES[$files_unput]['name'] as $name => $value)
{ {
$filename = strtolower(stripslashes(prepare_url($_FILES[$files_unput]['name'][$name]))); $filename = strtolower(stripslashes(prepare_url($_FILES[$files_unput]['name'][$name])));
@ -383,6 +382,8 @@
{ {
$new_files[] = $filename; $new_files[] = $filename;
$thumbs[] = make_thumbnail(array('link' => $dir . $filename, 'size' => 'f128x128'));
if ((bool)$watermark) if ((bool)$watermark)
{ {
$position = ($position != '') ? $position : 'center'; $position = ($position != '') ? $position : 'center';
@ -409,6 +410,7 @@
{ {
echo json_encode(array( echo json_encode(array(
'files' => $new_files, 'files' => $new_files,
'thumbs' => $thumbs,
'dir' => $dir, 'dir' => $dir,
'respons' => 'succes', 'respons' => 'succes',
'message' => $AVE_Template->get_config_vars('resp_s_m'), 'message' => $AVE_Template->get_config_vars('resp_s_m'),
@ -433,3 +435,4 @@
return ($res ? $res : $field_value); return ($res ? $res : $field_value);
} }
?>

2
fields/image_mega/js/field.js

@ -117,7 +117,7 @@ var Mega = {
iid = Mega.mega_maxid(c_id, d_id); iid = Mega.mega_maxid(c_id, d_id);
var field_value = data['dir'] + data.files[p]; var field_value = data['dir'] + data.files[p];
var img_path = '../index.php?thumb=' + field_value + '&mode=f&width=128&height=128'; var img_path = data.thumbs[p];
$('#mega_' + d_id + '_' + c_id + ' > .mega_sortable:last').prepend( $('#mega_' + d_id + '_' + c_id + ' > .mega_sortable:last').prepend(
'<div class="mega_item ui-state-default" id="mega_image_' + c_id + '_' + d_id + '_' + iid + '" data-id="' + iid + '" data-doc="' + d_id + '">' + '<div class="mega_item ui-state-default" id="mega_image_' + c_id + '_' + d_id + '_' + iid + '" data-id="' + iid + '" data-doc="' + d_id + '">' +

571
fields/image_multi/field.php

@ -1,395 +1,396 @@
<?php <?php
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Изображение (Каскад) // Изображение (Каскад)
function get_field_image_multi($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null) function get_field_image_multi($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{ {
global $AVE_Template, $img_pixel;
$fld_dir = dirname(__FILE__) . '/'; global $AVE_Template, $img_pixel;
$tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir);
$lang_file = $fld_dir . 'lang/' . (defined('ACP') $fld_dir = dirname(__FILE__) . '/';
? $_SESSION['admin_language'] $tpl_dir = $fld_dir . 'tpl/';
: $_SESSION['user_language']) . '.txt'; $fld_name = basename($fld_dir);
$AVE_Template->config_load($lang_file, 'lang'); $lang_file = $fld_dir . 'lang/' . (defined('ACP')
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); ? $_SESSION['admin_language']
$AVE_Template->config_load($lang_file, 'admin'); : $_SESSION['user_language']) . '.txt';
$res = 0; $AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$iniset_count = ini_get('max_file_uploads'); $res = 0;
switch ($action) $iniset_count = ini_get('max_file_uploads');
{
case 'edit':
$items = array(); switch ($action)
$image_items = array(); {
case 'edit':
if ($_REQUEST['action'] != 'new') $items = array();
{ $image_items = array();
$items = unserialize($field_value);
if($items != false) if ($_REQUEST['action'] != 'new')
{ {
foreach($items as $k => $v) $items = unserialize($field_value);
if($items != false)
{ {
$image_item = explode('|', $v); foreach($items as $k => $v)
{
$image_item = explode('|', $v);
$img = $image_item[0]; $img = $image_item[0];
unset($image_item[0]); unset($image_item[0]);
$image_item = array($img, implode('|', $image_item)); $image_item = array($img, implode('|', $image_item));
$image[$k]['url'] = $image_item[0]; $image[$k]['url'] = $image_item[0];
$image[$k]['thumb'] = ($image_item[0] != '') $image[$k]['thumb'] = ($image_item[0] != '')
? make_thumbnail(array('size' => 'f100x100', 'link' => $image_item[0])) ? make_thumbnail(array('size' => 'f100x100', 'link' => $image_item[0]))
: $img_pixel; : $img_pixel;
$image[$k]['desc'] = (isset($image_item[1])) $image[$k]['desc'] = (isset($image_item[1]))
? htmlspecialchars($image_item[1], ENT_QUOTES) ? htmlspecialchars($image_item[1], ENT_QUOTES)
: ''; : '';
} }
if (! empty($image)) if (! empty($image))
{ {
$image_items = $image; $image_items = $image;
}
} }
} }
}
$show_upload = true; $show_upload = true;
$default = explode('|', $default); $default = explode('|', $default);
list($path, $watermark, $position, $transparency) = $default; list($path, $watermark, $position, $transparency) = $default;
if(preg_match("/%id/i", $path)) if(preg_match("/%id/i", $path))
{
if ($_REQUEST['action'] != 'new')
{ {
$path_upload = trim(@str_replace('%id', $_REQUEST['Id'], $path), '/'); if ($_REQUEST['action'] != 'new')
$show_upload = true; {
$path_upload = trim(@str_replace('%id', $_REQUEST['Id'], $path), '/');
$show_upload = true;
}
else
{
$path_upload = (! empty($path))
? trim($path, '/')
: '';
$show_upload = false;
}
} }
else else
{ {
$path_upload = (! empty($path)) $path_upload = (! empty($path))
? trim($path, '/') ? $path
: ''; : '';
$show_upload = false; $show_upload = true;
} }
}
else
{
$path_upload = (! empty($path))
? $path
: '';
$show_upload = true;
}
$dir_upload = '/' . UPLOAD_DIR . '/' . ((!empty($path_upload)) $dir_upload = '/' . UPLOAD_DIR . '/' . ((!empty($path_upload))
? $path_upload . '/' ? $path_upload . '/'
: ''); : '');
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
$AVE_Template->assign('max_files', $AVE_Template->get_config_vars('max_f_f') . $iniset_count); $AVE_Template->assign('max_files', $AVE_Template->get_config_vars('max_f_f') . $iniset_count);
$AVE_Template->assign('dir_upload', $AVE_Template->get_config_vars('upl_dir') . $dir_upload); $AVE_Template->assign('dir_upload', $AVE_Template->get_config_vars('upl_dir') . $dir_upload);
$AVE_Template->assign('show_upload', $show_upload); $AVE_Template->assign('show_upload', $show_upload);
$AVE_Template->assign('field_dir', $fld_name); $AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('images', $image_items); $AVE_Template->assign('images', $image_items);
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0)); $AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
break; break;
case 'doc': case 'doc':
$items = (isset($field_value)) $items = (isset($field_value))
? unserialize($field_value) ? unserialize($field_value)
: array(); : array();
$res = array(); $res = array();
if ($items != false) if ($items != false)
{
foreach ($items as $image_item)
{ {
$image_item = clean_php($image_item); foreach ($items as $image_item)
$field_param = explode('|', $image_item);
if ($image_item)
{ {
if ($tpl_empty) $image_item = clean_php($image_item);
$field_param = explode('|', $image_item);
if ($image_item)
{ {
$image_item = $field_param; if ($tpl_empty)
}
else
{ {
$image_item = preg_replace_callback( $image_item = $field_param;
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
$image_item = preg_replace_callback(
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
create_function(
'$m',
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
),
$image_item
);
$image_item = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $image_item);
} }
} else
{
$image_item = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
$image_item = preg_replace_callback(
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
create_function(
'$m',
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
),
$image_item
);
$image_item = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $image_item);
}
}
$res[] = $image_item; $res[] = $image_item;
}
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res)); $AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('rubric_id', $rubric_id); $AVE_Template->assign('rubric_id', $rubric_id);
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (! empty($res)) return (! empty($res))
? implode(PHP_EOL, $res) ? implode(PHP_EOL, $res)
: $tpl; : $tpl;
break; break;
case 'req': case 'req':
$items = unserialize($field_value); $items = unserialize($field_value);
$res = array(); $res = array();
if ($items != false) if ($items != false)
{
foreach ($items as $image_item)
{ {
$image_item = clean_php($image_item); foreach ($items as $image_item)
$field_param = explode('|', $image_item);
if ($image_item)
{ {
if ($tpl_empty) $image_item = clean_php($image_item);
$field_param = explode('|', $image_item);
if ($image_item)
{ {
$image_item = $field_param; if ($tpl_empty)
}
else
{ {
$image_item = preg_replace_callback( $image_item = $field_param;
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
$image_item = preg_replace_callback(
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
create_function(
'$m',
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
),
$image_item
);
$image_item = preg_replace_callback('/\[tag:([r|c|f]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $image_item);
} }
} else
{
$image_item = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
$image_item = preg_replace_callback(
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
create_function(
'$m',
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
),
$image_item
);
$image_item = preg_replace_callback('/\[tag:([r|c|f]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $image_item);
}
}
$res[] = $image_item; $res[] = $image_item;
}
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res)); $AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('rubric_id', $rubric_id); $AVE_Template->assign('rubric_id', $rubric_id);
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (! empty($res)) return (! empty($res))
? implode(PHP_EOL, $res) ? implode(PHP_EOL, $res)
: $tpl; : $tpl;
break; break;
case 'save': case 'save':
foreach ($field_value as $v) foreach ($field_value as $v)
{
if (! empty($v['url']))
{ {
$field_value_new[] = $v['url'] . ($v['descr'] ? '|' . $v['descr'] : ''); if (! empty($v['url']))
{
$field_value_new[] = $v['url'] . ($v['descr'] ? '|' . $v['descr'] : '');
}
} }
}
if (isset($field_value_new)) if (isset($field_value_new))
{
return @serialize($field_value_new);
}
else
{ {
return $field_value_new = ''; return @serialize($field_value_new);
} }
else
{
return $field_value_new = '';
}
break; break;
case 'name' : case 'name' :
return $AVE_Template->get_config_vars('name'); return $AVE_Template->get_config_vars('name');
break; break;
case 'upload': case 'upload':
$error = false; $error = false;
$search = array(); $search = array();
$replace = array(); $replace = array();
$files_unput = 'cascade_files'.'_'.$_REQUEST['field_id'].'_'.$_REQUEST['doc_id']; $files_unput = 'cascade_files'.'_'.$_REQUEST['field_id'].'_'.$_REQUEST['doc_id'];
$search[] = '%d'; $search[] = '%d';
$replace[] = date('d'); $replace[] = date('d');
$search[] = '%m'; $search[] = '%m';
$replace[] = date('m'); $replace[] = date('m');
$search[] = '%Y'; $search[] = '%Y';
$replace[] = date('Y'); $replace[] = date('Y');
$default = explode('|', $default); $default = explode('|', $default);
list($path_upload, $watermark, $position, $transparency) = $default; list($path_upload, $watermark, $position, $transparency) = $default;
if (! empty($path_upload)) if (! empty($path_upload))
$path_upload = str_replace($search, $replace, $path_upload); $path_upload = str_replace($search, $replace, $path_upload);
if(preg_match("/%id/i", $path_upload)) if(preg_match("/%id/i", $path_upload))
{
$path = trim(@str_replace('%id', $_REQUEST['doc_id'], $path_upload), '/');
}
else
{ {
$path = (! empty($path_upload)) $path = trim(@str_replace('%id', $_REQUEST['doc_id'], $path_upload), '/');
? $path_upload
: '';
} }
else
{
$path = (! empty($path_upload))
? $path_upload
: '';
}
function getExtension($file) function getExtension($file)
{ {
$file = pathinfo($file); $file = pathinfo($file);
return $file['extension']; return $file['extension'];
} }
$valid_formats = array("jpg", "png", "gif", "bmp","jpeg");
$dir = '/' . UPLOAD_DIR . '/' . ((! empty($path))
? trim($path, '/') . '/'
: '');
$dir_abs = BASE_DIR . $dir; $valid_formats = array("jpg", "png", "gif", "bmp","jpeg");
if (! is_dir($dir_abs)) $dir = '/' . UPLOAD_DIR . '/' . ((! empty($path))
@mkdir($dir_abs, 0777, true); ? trim($path, '/') . '/'
: '');
foreach ($_FILES[$files_unput]['name'] as $name => $value) $dir_abs = BASE_DIR . $dir;
{
$filename = strtolower(stripslashes(prepare_url($_FILES[$files_unput]['name'][$name])));
$ext = getExtension($filename); if (! is_dir($dir_abs))
$ext = strtolower($ext); @mkdir($dir_abs, 0777, true);
if(in_array($ext, $valid_formats)) foreach ($_FILES[$files_unput]['name'] as $name => $value)
{ {
if (file_exists($dir_abs . $filename)) $filename = strtolower(stripslashes(prepare_url($_FILES[$files_unput]['name'][$name])));
{
$filename = rand(1000, 9999) . '_' . $filename; $ext = getExtension($filename);
} $ext = strtolower($ext);
if (@move_uploaded_file($_FILES[$files_unput]['tmp_name'][$name], $dir_abs . $filename)) if(in_array($ext, $valid_formats))
{ {
$new_files[] = $filename; if (file_exists($dir_abs . $filename))
$error = false; {
$filename = rand(1000, 9999) . '_' . $filename;
}
if ((bool)$watermark) if (@move_uploaded_file($_FILES[$files_unput]['tmp_name'][$name], $dir_abs . $filename))
{ {
$position = ($position != '') ? $position : 'center'; $new_files[] = $filename;
$transparency = ($transparency != '') ? $transparency : '100'; $error = false;
watermarks($dir . $filename, $position, $transparency); if ((bool)$watermark)
{
$position = ($position != '') ? $position : 'center';
$transparency = ($transparency != '') ? $transparency : '100';
watermarks($dir . $filename, $position, $transparency);
}
} }
else
{
$error = true;
}
} }
else else
{ {
$error = true; $error = true;
@unlink($_FILES[$files_unput]['tmp_name'][$name]);
} }
} }
else
{ if ($error !== true)
$error = true;
@unlink($_FILES[$files_unput]['tmp_name'][$name]);
}
}
if ($error !== true)
{
echo json_encode(array(
'files' => $new_files,
'dir' => $dir,
'respons' => 'succes',
'message' => $AVE_Template->get_config_vars('resp_s_m'),
'header' => $AVE_Template->get_config_vars('resp_s_h'),
'theme' => 'accept'
)
);
}
else
{ {
echo json_encode(array( echo json_encode(array(
'respons' => 'error', 'files' => $new_files,
'message' => $AVE_Template->get_config_vars('resp_e_m'), 'dir' => $dir,
'header' => $AVE_Template->get_config_vars('resp_e_h'), 'respons' => 'succes',
'theme' => 'error' 'message' => $AVE_Template->get_config_vars('resp_s_m'),
'header' => $AVE_Template->get_config_vars('resp_s_h'),
'theme' => 'accept'
) )
); );
} }
else
{
echo json_encode(array(
'respons' => 'error',
'message' => $AVE_Template->get_config_vars('resp_e_m'),
'header' => $AVE_Template->get_config_vars('resp_e_h'),
'theme' => 'error'
)
);
}
exit; exit;
} }
return ($res ? $res : $field_value); return ($res ? $res : $field_value);
} }
?>

231
fields/image_multi/js/outside.js

@ -1,231 +0,0 @@
var Cascad = {
init: false,
init: function() {
if (this.initialized) return;
this.initialized = true;
this.cascad();
},
cascad: function() {
this.cascad_sortable();
this.cascad_del_item();
this.cascad_del_all_item();
this.cascad_add_single();
this.cascad_add_folder();
this.cascade_upload_files();
this.cascad_click_upload();
},
cascad_update: function() {
this.cascad_maxid();
this.cascad_del_item();
AveAdmin.fancy_box();
AveAdmin.tooltip();
},
cascad_maxid: function(id, doc) {
var maxid = 1;
$('#cascad_' + doc + '_' + id).children('.cascad_sortable').children('.cascad_item').each(function() {
maxid = Math.max(maxid, parseInt($(this).attr("data-id")) + 1);
});
return maxid;
},
cascad_del_item: function() {
$('.cascad_item .delete').on('click', function(event) {
event.preventDefault();
var id = $(this).attr('data-id');
jConfirm(
del_conf,
del_head,
function(b) {
if (b) {
$('#cascad_image_' + id).remove();
}
}
);
});
},
cascad_del_all_item: function() {
$('.del_all').on('click', function(event) {
event.preventDefault();
var c_id = $(this).parent().parent().parent('.cascad').attr("data-id");
var d_id = $(this).parent().parent().parent('.cascad').attr("data-doc");
jConfirm(
del_all_c,
del_all_h,
function(b) {
if (b) {
$('#cascad_' + d_id + '_' + c_id).children('.cascad_sortable').children('.cascad_item').each(function() {
$(this).remove();
});
}
}
);
});
},
cascade_upload_files: function() {
$('.cascade_upload').on('change', function(event) {
event.preventDefault();
var cascade_input = $(this);
event.preventDefault();
if (cascade_input.val() == '') {
return false;
}
var files_input = this.files.length;
var max_files = cascade_input.attr("data-max-files");
if (files_input > max_files) {
$.jGrowl(max_f_t, {
header: max_f_h,
theme: 'error'
});
cascade_input.replaceWith(cascade_input.val('').clone(true));
return false;
}
var cid = $(this).parent('.cascad').attr("data-id");
var did = $(this).parent('.cascad').attr("data-doc");
var rid = $(this).parent('.cascad').attr("data-rubric");
$('#docmanager_edit').ajaxSubmit({
url: 'index.php?do=fields',
data: {
"field_id": cid,
"rubric_id": rid,
"doc_id": did,
"field": 'image_multi',
"type": 'upload'
},
beforeSend: function() {
$.alerts._overlay('show');
},
dataType: "json",
success: function(data) {
if (data['respons'] == 'succes') {
for (var p = 0, max = data.files.length; p < max; p++) {
iid = Cascad.cascad_maxid(cid, did);
var field_value = data['dir'] + data.files[p];
var img_path = '../index.php?thumb=' + field_value + '&mode=f&width=128&height=128';
$('#cascad_' + did + '_' + cid + ' > .cascad_sortable:last').prepend(
'<div class="cascad_item ui-state-default" id="cascad_image_' + cid + '_' + did + '_' + iid + '" data-id="' + iid + '" doc=id="' + did + '">' +
'<div class="header grey_bg"></div>' +
'<a class="topDir icon_sprite ico_photo view fancy preview__' + cid + '_' + did + '_' + iid + '" href="' + field_value + '" title="' + look + '"></a>' +
'<a class="topDir icon_sprite ico_delete delete" href="javascript:void(0);" title="' + del + '" data-id="' + cid + '_' + did + '_' + iid + '"></a>' +
'<span class="topDir icon_sprite ico_info info" title="' + field_value + '"></span>' +
'<input type="hidden" value="' + field_value + '" name="data[' + did + '][feld][' + cid + '][' + iid + '][url]" id="image__' + cid + '_' + did + '_' + iid + '">' +
'<img id="preview__' + cid + '_' + did + '_' + iid + '" src="' + img_path + '" onclick="browse_uploads(\'image__' + cid + '_' + did + '_' + iid + '\');" class="image" alt="" width="100" height="100" />' +
'<textarea class="mousetrap" name="data[' + did + '][feld][' + cid + '][' + iid + '][descr]" placeholder="' + place + '"></textarea>' +
'</div>'
);
$.alerts._overlay('hide');
Cascad.cascad_update();
}
}
$.jGrowl(data['message'], {
header: data['header'],
theme: data['theme']
});
cascade_input.replaceWith(cascade_input = cascade_input.clone(true));
cascade_input.val();
}
});
return false;
});
},
cascad_click_upload: function() {
$('.upload_local').on('click', function(event) {
event.preventDefault();
var c_id = $(this).parent().parent().parent('.cascad').attr("data-id");
var d_id = $(this).parent().parent().parent('.cascad').attr("data-doc");
$('.cascade_upload_field_' + c_id + '_' + d_id).trigger('click');
});
},
cascad_add_single: function() {
$('.add_single').on('click', function(event) {
event.preventDefault();
var c_id = $(this).parent().parent().parent('.cascad').attr("data-id");
var d_id = $(this).parent().parent().parent('.cascad').attr("data-doc");
var iid = Cascad.cascad_maxid(c_id, d_id);
$('#cascad_' + d_id + '_' + c_id + ' > .cascad_sortable:last').prepend(
'<div class="cascad_item ui-state-default" id="cascad_image_' + c_id + '_' + d_id + '_' + iid + '" data-id="' + iid + '" data-doc="' + d_id + '">' +
'<div class="header grey_bg"></div>' +
'<a class="topDir icon_sprite ico_photo view fancy preview__' + c_id + '_' + d_id + '_' + iid + '" href="" title="' + look + '"></a>' +
'<a class="topDir icon_sprite ico_delete delete" href="javascript:void(0);" title="' + del + '" data-id="' + c_id + '_' + d_id + '_' + iid + '"></a>' +
'<input type="hidden" value="" name="data[' + d_id + '][feld][' + c_id + '][' + iid + '][url]" id="image__' + c_id + '_' + d_id + '_' + iid + '">' +
'<img id="preview__' + c_id + '_' + d_id + '_' + iid + '" src="' + blank + '" onclick="browse_uploads(\'image__' + c_id + '_' + d_id + '_' + iid + '\');" class="image" alt="" width="100" height="100" />' +
'<textarea class="mousetrap" name="data[' + d_id + '][feld][' + c_id + '][' + iid + '][descr]" placeholder="' + place + '"></textarea>' +
'</div>'
);
browse_uploads('image__' + c_id + '_' + d_id + '_' + iid + '');
Cascad.cascad_update();
});
},
cascad_sortable: function() {
$('.cascad_sortable').sortable({
handle: ".header",
placeholder: "ui-state-highlight grey_bg"
});
//$(".cascad").disableSelection();
},
cascad_add_folder: function() {
$('.add_folder').on('click', function(event) {
event.preventDefault();
var c_id = $(this).parent().parent().parent('.cascad').attr("data-id");
var d_id = $(this).parent().parent().parent('.cascad').attr("data-doc");
browse_dirs("cascad__" + c_id + '_' + d_id);
});
}
}
$(document).ready(function() {
Cascad.init();
$.fn.myPlugin = function cascad_add_items(dir, cid, did) {
$.ajax({
url: ave_path + 'admin/index.php?do=docs&action=image_import&ajax=run',
data: {
"path": dir
},
dataType: "json",
success: function(data) {
$.alerts._overlay('hide');
for (var p = 0, max = data.respons.length; p < max; p++) {
var iid = Cascad.cascad_maxid(cid, did);
var field_value = dir + data.respons[p];
var img_path = '../index.php?thumb=' + field_value + '&mode=f&width=128&height=128';
$('#cascad_' + did + '_' + cid + ' > .cascad_sortable:last').prepend(
'<div class="cascad_item ui-state-default" id="cascad_image_' + cid + '_' + did + '_' + iid + '" data-id="' + iid + '" doc=id="' + did + '">' +
'<div class="header grey_bg"></div>' +
'<a class="topDir icon_sprite ico_photo view fancy preview__' + cid + '_' + did + '_' + iid + '" href="' + field_value + '" title="' + look + '"></a>' +
'<a class="topDir icon_sprite ico_delete delete" href="javascript:void(0);" title="' + del + '" data-id="' + cid + '_' + did + '_' + iid + '"></a>' +
'<span class="topDir icon_sprite ico_info info" title="' + field_value + '"></span>' +
'<input type="hidden" value="' + field_value + '" name="data[' + did + '][feld][' + cid + '][' + iid + '][url]" id="image__' + cid + '_' + did + '_' + iid + '">' +
'<img id="preview__' + cid + '_' + did + '_' + iid + '" src="' + img_path + '" onclick="browse_uploads(\'image__' + cid + '_' + did + '_' + iid + '\');" class="image" alt="" width="100" height="100" />' +
'<textarea class="mousetrap" name="data[' + did + '][feld][' + cid + '][' + iid + '][descr]" placeholder="' + place + '"></textarea>' +
'</div>'
);
Cascad.cascad_update();
}
}
});
}
});

300
fields/image_single/field.php

@ -1,161 +1,161 @@
<? <?
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Изображение
function get_field_image_single($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{
global $AVE_Template;
// Изображение $fld_dir = dirname(__FILE__) . '/';
function get_field_image_single($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){ $tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir);
global $AVE_Template; $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$fld_dir = dirname(__FILE__) . '/'; $AVE_Template->config_load($lang_file, 'lang');
$tpl_dir = $fld_dir . 'tpl/'; $AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$fld_name = basename($fld_dir); $AVE_Template->config_load($lang_file, 'admin');
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; $res = 0;
$AVE_Template->config_load($lang_file, 'lang'); switch ($action)
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); {
$AVE_Template->config_load($lang_file, 'admin'); case 'edit':
$blanc = '/uploads/images/noimage.gif';
$image = explode('|', $field_value);
$img = $image[0];
unset($image[0]);
$image = array($img, implode('|', $image));
$field = (!empty($image[0]) ? '../' . make_thumbnail(array('link' => $image[0], 'size' => 'f128x128')) : make_thumbnail(array('link' => $blanc, 'size' => 'f128x128')));
$res = 0; $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
$AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('image', $image);
$AVE_Template->assign('doc_id', (int)$_REQUEST['Id']);
$AVE_Template->assign('field', $field);
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
switch ($action)
{
case 'edit':
$blanc = '/uploads/images/noimage.gif';
$image = explode('|', $field_value);
$img = $image[0];
unset($image[0]);
$image = array($img, implode('|', $image));
$field = (!empty($image[0]) ? '../' . make_thumbnail(array('link' => $image[0], 'size' => 'f128x128')) : make_thumbnail(array('link' => $blanc, 'size' => 'f128x128')));
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
$AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('image', $image);
$AVE_Template->assign('doc_id', (int)$_REQUEST['Id']);
$AVE_Template->assign('field', $field);
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
break;
case 'doc':
$field_value = clean_php($field_value);
$field_param = explode('|', $field_value);
if ($tpl_empty)
{
$field_value = '<img alt="' . (isset($field_param[1]) ? $field_param[1] : '')
. '" src="' . $field_param[0] . '" border="0" />';
}
else
{
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
$field_value = preg_replace_callback(
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
create_function(
'$m',
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
),
$field_value
);
$field_value = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $field_value);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
if($tpl_empty && $tpl_file)
{
$AVE_Template->assign('image', $field_param);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
case 'req':
$field_value = clean_php($field_value);
$field_param = explode('|', $field_value);
if ($tpl_empty)
{
$field_param[1] = isset($field_param[1]) ? $field_param[1] : '';
$field_value = '<img src="' . $field_param[0] . '" alt="' . $field_param[1] . '" border="0" />';
}
else
{
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
$field_value = preg_replace_callback(
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
create_function(
'$m',
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
),
$field_value
);
$field_value = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $field_value);
}
$maxlength = null;
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
if($tpl_empty && $tpl_file)
{
$AVE_Template->assign('image', $field_param);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} break;
return $field_value; case 'doc':
break; $field_value = clean_php($field_value);
case 'save': $field_param = explode('|', $field_value);
if (isset($field_value) && $field_value['img'] != '' )
{ if ($tpl_empty)
$field_value = htmlspecialchars(implode("|", $field_value), ENT_QUOTES); {
} $field_value = '<img alt="' . (isset($field_param[1]) ? $field_param[1] : '')
else . '" src="' . $field_param[0] . '" border="0" />';
{ }
$field_value = ''; else
} {
break; $field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
case 'name' : function($data) use($field_param)
return $AVE_Template->get_config_vars('name'); {
break; return $field_param[(int)$data[1]];
},
$tpl
);
$field_value = preg_replace_callback(
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
create_function(
'$m',
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
),
$field_value
);
$field_value = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $field_value);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if($tpl_empty && $tpl_file)
{
$AVE_Template->assign('image', $field_param);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
case 'req':
$field_value = clean_php($field_value);
$field_param = explode('|', $field_value);
if ($tpl_empty)
{
$field_param[1] = isset($field_param[1]) ? $field_param[1] : '';
$field_value = '<img src="' . $field_param[0] . '" alt="' . $field_param[1] . '" border="0" />';
}
else
{
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
$field_value = preg_replace_callback(
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
create_function(
'$m',
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
),
$field_value
);
$field_value = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $field_value);
}
$maxlength = null;
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if($tpl_empty && $tpl_file)
{
$AVE_Template->assign('image', $field_param);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
case 'save':
if (isset($field_value) && $field_value['img'] != '' )
{
$field_value = htmlspecialchars(implode("|", $field_value), ENT_QUOTES);
}
else
{
$field_value = '';
}
break;
case 'name' :
return $AVE_Template->get_config_vars('name');
break;
}
return ($res ? $res : $field_value);
} }
?>
return ($res ? $res : $field_value);
}
?>

194
fields/link/field.php

@ -1,100 +1,100 @@
<? <?php
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Ссылка // Ссылка
function get_field_link($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){ function get_field_link($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$res = '';
switch ($action)
{ {
case 'edit': global $AVE_Template;
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value); $fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
return $AVE_Template->fetch($tpl_file);
break; $AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
case 'doc': $AVE_Template->config_load($lang_file, 'admin');
$field_value = clean_php($field_value);
$field_param = explode('|', $field_value); $res = '';
$field_param[1] = empty($field_param[1]) ? $field_param[0] : $field_param[1];
switch ($action)
if ($tpl_empty) {
{ case 'edit':
$field_value = ' <a target="_self" href="' . ABS_PATH . $field_param[0] . '">' . $field_param[1] . '</a>'; $AVE_Template->assign('field_id', $field_id);
} $AVE_Template->assign('field_value', $field_value);
else
{ $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i', return $AVE_Template->fetch($tpl_file);
function($data) use($field_param) break;
{
return $field_param[(int)$data[1]]; case 'doc':
}, $field_value = clean_php($field_value);
$tpl $field_param = explode('|', $field_value);
); $field_param[1] = empty($field_param[1]) ? $field_param[0] : $field_param[1];
}
if ($tpl_empty)
$res = $field_value; {
break; $field_value = ' <a target="_self" href="' . ABS_PATH . $field_param[0] . '">' . $field_param[1] . '</a>';
}
case 'req': else
$field_value = clean_php($field_value); {
$field_param = explode('|', $field_value); $field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
if (empty($field_param[1])) function($data) use($field_param)
$field_param[1] = $field_param[0]; {
return $field_param[(int)$data[1]];
if (isset($document_fields[$rubric_id]['tpl_req_empty'])) },
{ $tpl
$field_value = " <a target=\"_self\" href=\"" . ABS_PATH . $field_param[0] . "\">" . $field_param[1] . "</a>"; );
} }
else
{ $res = $field_value;
$field_value = preg_replace_callback( break;
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param) case 'req':
{ $field_value = clean_php($field_value);
return $field_param[(int)$data[1]]; $field_param = explode('|', $field_value);
},
$tpl if (empty($field_param[1]))
); $field_param[1] = $field_param[0];
}
if (isset($document_fields[$rubric_id]['tpl_req_empty']))
$maxlength = null; {
$field_value = " <a target=\"_self\" href=\"" . ABS_PATH . $field_param[0] . "\">" . $field_param[1] . "</a>";
$res = $field_value; }
break; else
{
case 'name' : $field_value = preg_replace_callback(
return $AVE_Template->get_config_vars('name'); '/\[tag:parametr:(\d+)\]/i',
break; function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$maxlength = null;
$res = $field_value;
break;
case 'name' :
return $AVE_Template->get_config_vars('name');
break;
}
return ($res ? $res : $field_value);
} }
return ($res ? $res : $field_value);
}
?> ?>

18
fields/link_multi/css/field.css

@ -0,0 +1,18 @@
.multi_lists {
position: relative;
}
.multi_lists > .ui-state-highlight {
display: inline-block;
margin: 3px;
width: 450px;
height: 26px;
background-color: rgba(255,255,255,0.5); !important;
border: solid 1px #eaeaea;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
position: relative;
text-align: center;
padding: 0 !important;
}

194
fields/link_multi/field.php

@ -0,0 +1,194 @@
<?php
/**
* AVE.cms
*
* @package AVE.cms
* @version 3.x
* @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
// Мульти лист
function get_field_link_multi($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{
global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir);
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$res = array();
switch ($action)
{
case 'edit':
$items = array();
$items = unserialize($field_value);
if ($items != false)
{
foreach($items as $k => $v){
$list_item = explode('|', $v);
$list[$k]['param'] = (isset($list_item[0])) ? htmlspecialchars($list_item[0], ENT_QUOTES) : '';
$list[$k]['value'] = (isset($list_item[1])) ? htmlspecialchars($list_item[1], ENT_QUOTES) : '';
}
$items = $list;
}
else
{
$items = explode(',', $default);
foreach($items as $k => $v){
$list_item = explode('|', $v);
$list[$k]['param'] = (isset($list_item[0])) ? htmlspecialchars($list_item[0], ENT_QUOTES) : '';
$list[$k]['value'] = (isset($list_item[1])) ? htmlspecialchars($list_item[1], ENT_QUOTES) : '';
}
$items = $list;
}
$AVE_Template->assign('doc_id', $_REQUEST['Id']);
$AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('items', $items);
$AVE_Template->assign('field_id', $field_id);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
return $AVE_Template->fetch($tpl_file);
break;
case 'doc':
$items = unserialize($field_value);
if ($items != false)
{
foreach($items as $list_item)
{
$list_item = clean_php($list_item);
$field_param = explode('|', $list_item);
if ($list_item)
{
if ($tpl_empty)
{
$list_item = $field_param;
}
else
{
$list_item = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
}
$res[] = $list_item;
}
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file);
}
return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl;
break;
case 'req':
$items = unserialize($field_value);
if ($items != false)
{
foreach($items as $list_item)
{
$list_item = clean_php($list_item);
$field_param = explode('|', $list_item);
if ($list_item)
{
if ($tpl_empty)
{
$list_item = $field_param;
}
else
{
$list_item = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
}
$res[] = $list_item;
}
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file);
}
return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl;
break;
case 'save':
foreach ($field_value as $v)
{
if (! empty($v['param']))
{
$field_value_new[] = $v['param'] . ($v['value'] ? '|' . $v['value'] : '');
}
}
if (isset($field_value_new))
{
return @serialize($field_value_new);
}
else
{
return $field_value_new = '';
}
break;
case 'name':
return $AVE_Template->get_config_vars('name');
break;
}
return ($res ? $res : $field_value);
}
?>

31
fields/multi_list/js/outside.js → fields/link_multi/js/field.js

@ -1,4 +1,4 @@
var MultiList = { var MultiLinks = {
init: false, init: false,
@ -23,22 +23,22 @@ var MultiList = {
lists_maxid: function(id) { lists_maxid: function(id) {
var maxid = 1; var maxid = 1;
$('#multi_lists_' + id).children('.multi_list').each(function() { $('#multi_links_' + id).children('.multi_link').each(function() {
maxid = Math.max(maxid, parseInt($(this).attr("data-id")) + 1); maxid = Math.max(maxid, parseInt($(this).attr("data-id")) + 1);
}); });
return maxid; return maxid;
}, },
lists_del_item: function() { lists_del_item: function() {
$('.multi_list .DelButton').on('click', function(event) { $('.multi_link .DelButton').on('click', function(event) {
event.preventDefault(); event.preventDefault();
var id = $(this).attr('data-id'); var id = $(this).attr('data-id');
jConfirm( jConfirm(
list_del_conf, links_del_conf,
list_del_head, links_del_head,
function(b) { function(b) {
if (b) { if (b) {
$('#list_' + id).remove(); $('#link_' + id).remove();
} }
} }
); );
@ -46,30 +46,29 @@ var MultiList = {
}, },
lists_add: function() { lists_add: function() {
$('.AddButton').on('click', function(event) { $('.multi_links .AddButton').on('click', function(event) {
event.preventDefault(); event.preventDefault();
c_id = $(this).parent().parent('.multi_lists').attr("data-id"); c_id = $(this).parent().parent('.multi_links').attr("data-id");
iid = MultiList.lists_maxid(c_id); iid = MultiLinks.lists_maxid(c_id);
$('#multi_lists_' + c_id + ':last').append( $('#multi_links_' + c_id + ':last').append(
'<div class="multi_list fix mb10" id="list_' + c_id + '_' + iid + '" data-id="' + iid + '">' + '<div class="multi_link fix mb10" id="link_' + c_id + '_' + iid + '" data-id="' + iid + '">' +
'<input class="mousetrap" type="text" value="" name="feld[' + c_id + '][' + iid + '][param]" placeholder="' + list_param + '" style="width: 200px;"/>&nbsp;&nbsp;<input type="text" class="mousetrap" value="" name="feld[' + c_id + '][' + iid + '][value]" placeholder="' + list_value + '" style="width: 300px;" />&nbsp;&nbsp;<a href="javascript:void(0);" data-id="' + c_id + '_' + iid + '" class="button redBtn topDir DelButton" title="' + list_del + '">&times;</a>' + '<input class="mousetrap" type="text" value="" name="feld[' + c_id + '][' + iid + '][param]" placeholder="' + links_name + '" style="width: 200px;"/>&nbsp;&nbsp;<input type="text" class="mousetrap" value="" name="feld[' + c_id + '][' + iid + '][value]" id="links_' + c_id + '_' + iid + '" placeholder="' + links_url + '" style="width: 300px;" />&nbsp;&nbsp;<a class="btn greyishBtn" onclick="openFileWindow(\'links_' + c_id + '_' + iid + '\',\'links_' + c_id + '_' + iid + '\',\'links_' + c_id + '_' + iid + '\');">PDF</a>&nbsp;&nbsp;<a href="javascript:void(0);" data-id="' + c_id + '_' + iid + '" class="button redBtn topDir DelButton" title="' + links_del + '">&times;</a>' +
'<div class="handle" style="float: left; display: inline-block; margin: 4px 7px; cursor: move;"><span class="icon_sprite ico_move"></span></div>' + '<div class="handle" style="float: left; display: inline-block; margin: 4px 7px; cursor: move;"><span class="icon_sprite ico_move"></span></div>' +
'</div>' '</div>'
); );
MultiList.lists_update(); MultiLinks.lists_update();
}); });
}, },
lists_sortable: function() { lists_sortable: function() {
$('.multi_lists').sortable({ $('.multi_links').sortable({
handle: ".handle", handle: ".handle",
placeholder: "ui-state-highlight grey_bg" placeholder: "ui-state-highlight grey_bg"
}); });
//$(".multi_lists").disableSelection();
} }
} }
$(document).ready(function() { $(document).ready(function() {
MultiList.init(); MultiLinks.init();
}); });

8
fields/link_multi/lang/ru.txt

@ -0,0 +1,8 @@
[admin]
name = "Мульти ссылки"
delete = "Удалить элемент"
param = "Наименование"
value = "Ссылка"
del_conf = "Вы уверены, что хотите удалить данный элемент?"
del_head = "Удаление элемента..."
add = "Добавить"

33
fields/link_multi/tpl/field-doc-181.tpl

@ -0,0 +1,33 @@
{if ! empty($field_value)}
<table class="table table-params table-no-border">
<tr>
<td class="table-header">
Документация
</td>
</tr>
{foreach from=$field_value item=list}
<tr>
<td>
<a href="{$list[1]}" target="_blank"><i class="fa fa-file-pdf-o"></i>&nbsp;{$list[0]}</a>
</td>
</tr>
{/foreach}
</table>
{else}
<table class="table table-params table-no-border">
<tr>
<td class="table-header">
Документация
</td>
</tr>
<tr>
<td>
<div class="alert alert-warning">
Нет файлов для скачивания
</div>
</td>
</tr>
</table>
{/if}

5
fields/link_multi/tpl/field-doc.tpl

@ -0,0 +1,5 @@
<ul>
{foreach from=$field_value item=list}
<li>{$list[0]}: {$list[1]}</li>
{/foreach}
</ul>

5
fields/link_multi/tpl/field-req.tpl

@ -0,0 +1,5 @@
<ul>
{foreach from=$field_value item=list}
<li>{$list[0]}: {$list[1]}</li>
{/foreach}
</ul>

29
fields/link_multi/tpl/field.tpl

@ -0,0 +1,29 @@
{if $multi_list != load}
{assign var=multi_list value='' scope="global"}
{if $smarty.request.outside}
<script src="{$ABS_PATH}fields/{$field_dir}/js/outside.js" type="text/javascript"></script>
{else}
<script src="{$ABS_PATH}fields/{$field_dir}/js/field.js" type="text/javascript"></script>
{/if}
<link href="{$ABS_PATH}fields/{$field_dir}/css/field.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
var links_name = '{#param#}';
var links_url = '{#value#}';
var links_add = '{#add#}';
var links_del = '{#delete#}';
var links_del_conf = '{#del_conf#}';
var links_del_head = '{#del_head#}';
</script>
{assign var=multi_list value="load" scope="global"}
{/if}
<div class="multi_links mt10" id="multi_links_{$field_id}" data-id="{$field_id}">
{foreach from=$items key=key item=item}
<div class="multi_link fix mb10" id="link_{$field_id}_{$key}" data-id="{$key}">
<input type="text" class="mousetrap" value="{$item.param|escape}" name="feld[{$field_id}][{$key}][param]" placeholder="{#param#}" style="width: 200px;"/>&nbsp;&nbsp;<input type="text" class="mousetrap" value="{$item.value|escape}" name="feld[{$field_id}][{$key}][value]" id="links_{$field_id}_{$key}" placeholder="{#value#}" style="width: 300px;" />&nbsp;&nbsp;<a class="btn greyishBtn" onclick="openFileWindow('links_{$field_id}_{$key}','links_{$field_id}_{$key}','links_{$field_id}_{$key}');">PDF</a>&nbsp;&nbsp;{if $key == 0}<a href="javascript:void(0);" class="button basicBtn topDir AddButton" title="{#add#}">+</a>{else}<a href="javascript:void(0);" data-id="{$field_id}_{$key}" class="button redBtn topDir DelButton" title="{#delete#}">&times;</a>{/if}
<div class="handle" style="float: left; display: inline-block; margin: 4px 7px; cursor: move;"><span class="icon_sprite ico_move"></span></div>
</div>
{/foreach}
</div>

163
fields/multi_checkbox/field.php

@ -1,163 +0,0 @@
<?
/**
* AVE.cms
*
* @package AVE.cms
* @version 3.x
* @filesource
* @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
// Мульти чекбокс
function get_field_multi_checkbox($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null)
{
global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$res = array();
switch ($action)
{
case 'edit':
$default_items = explode(',', $default);
$default_items = array_diff($default_items, array(''));
$field_value_array = explode('|', $field_value);
$field_value_array = array_values(array_diff($field_value_array, array('')));
$AVE_Template->assign('items', $default_items);
$AVE_Template->assign('used', $field_value_array);
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
return $AVE_Template->fetch($tpl_file);
break;
case 'doc':
$default_items = explode(',', $default);
$items = explode('|', $field_value);
$items = array_diff($items, array(''));
if (! empty($items))
{
foreach($items as $item)
{
if ($item)
{
if ($tpl_empty)
{
$item = $default_items[(int)$item-1];
}
else
{
$field_param = explode('|', $item);
$item = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param, $default_items)
{
return $default_items[$field_param[(int)$data[1]]-1];
},
$tpl
);
}
}
$res[] = $item;
}
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res);
$AVE_Template->assign('rubric_id', $rubric_id);
$AVE_Template->assign('default', $default_items);
return $AVE_Template->fetch($tpl_file);
}
return (! empty($res))
? implode(PHP_EOL, $res)
: $tpl;
break;
case 'req':
$default_items = explode(',', $default);
$items = explode('|', $field_value);
$items = array_diff($items, array(''));
if (! empty($items))
{
foreach($items as $item)
{
if ($item)
{
if ($tpl_empty)
{
$item = $default_items[(int)$item-1];
}
else
{
$field_param = explode('|', $item);
$item = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param, $default_items)
{
return $default_items[$field_param[(int)$data[1]]-1];
},
$tpl
);
}
}
$res[] = $item;
}
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res);
$AVE_Template->assign('rubric_id', $rubric_id);
$AVE_Template->assign('default', $default_items);
return $AVE_Template->fetch($tpl_file);
}
return (! empty($res))
? implode(PHP_EOL, $res)
: $tpl;
break;
case 'name':
return $AVE_Template->get_config_vars('name');
break;
}
return ($res ? $res : $field_value);
}
?>

140
fields/multi_line/field.php

@ -1,89 +1,77 @@
<? <?php
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Многострочное // Многострочное
function get_field_multi_line($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){ function get_field_multi_line($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl = null)
{
global $AVE_Template, $AVE_Document; global $AVE_Template, $AVE_Document;
$fld_dir = dirname(__FILE__) . '/';
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; $fld_dir = dirname(__FILE__) . '/';
$AVE_Template->config_load($lang_file, 'lang'); $lang_file = $fld_dir . 'lang/' . (defined('ACP')
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); ? $_SESSION['admin_language']
$AVE_Template->config_load($lang_file, 'admin'); : $_SESSION['user_language']) . '.txt';
$res=0; $AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
switch ($action) $res = null;
{
case 'edit':
if (isset($_COOKIE['no_wysiwyg']) && $_COOKIE['no_wysiwyg'] == 1)
{
$field = '<a name="' . $field_id . '"></a>';
$field .= '<textarea style="width: 98%" name="feld[' . $field_id . ']">' . $field_value . '</textarea>';
}
else
{
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === (bool)true)) {
switch ($_SESSION['use_editor']) {
case '0':
case '1':
case '2':
$oCKeditor = new CKeditor();
$oCKeditor->returnOutput = true;
$oCKeditor->config['toolbar'] = 'Verysmall';
$oCKeditor->config['height'] = 250;
$config = array();
$field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
break;
default: switch ($action)
$field = $field_value; {
break; case 'edit':
if (isset($_COOKIE['no_wysiwyg']) && $_COOKIE['no_wysiwyg'] == 1)
{
$field = '<a name="' . $field_id . '"></a>';
$field .= '<textarea style="width: 98%" name="feld[' . $field_id . ']">' . $field_value . '</textarea>';
}
else
{
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === true))
{
$oCKeditor = new CKeditor();
$oCKeditor->returnOutput = true;
$oCKeditor->config['toolbar'] = 'Verysmall';
$oCKeditor->config['height'] = 250;
$config = array();
$field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
} }
} else { else
switch ($_SESSION['use_editor']) { {
case '0': // CKEditor $oCKeditor = new CKeditor();
case '1': $oCKeditor->returnOutput = true;
$oCKeditor = new CKeditor(); $oCKeditor->config['toolbar'] = 'Big';
$oCKeditor->returnOutput = true; $oCKeditor->config['height'] = 400;
$oCKeditor->config['toolbar'] = 'Big'; $config = array();
$oCKeditor->config['height'] = 400; $field = $oCKeditor->editor('feld[' . $field_id . ']', $field_value, $config);
$config = array();
$field = $oCKeditor->editor('feld[' . $field_id . ']', $field_value, $config);
break;
default:
$field = $field_value;
break;
} }
} }
}
$res = $field;
break;
case 'doc': $res = $field;
case 'req': break;
$res = get_field_default($field_value, $action, $field_id, $tpl, $tpl_empty, $maxlength, $document_fields, $rubric_id);
$res = document_pagination($res); case 'doc':
break; case 'req':
$res = get_field_default($field_value, $action, $field_id, $tpl, $tpl_empty, $maxlength, $document_fields, $rubric_id);
$res = document_pagination($res);
break;
case 'name' :
return $AVE_Template->get_config_vars('name');
break;
}
case 'name' : return ($res ? $res : $field_value);
return $AVE_Template->get_config_vars('name');
break;
} }
return ($res ? $res : $field_value); ?>
}
?>

135
fields/multi_line_simple/field.php

@ -1,91 +1,74 @@
<? <?php
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Многострочное (Упрощенное) // Многострочное (Упрощенное)
function get_field_multi_line_simple($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){ function get_field_multi_line_simple($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{
global $AVE_Template; global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/'; $fld_dir = dirname(__FILE__) . '/';
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang'); $AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); $AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin'); $AVE_Template->config_load($lang_file, 'admin');
$res=0; $res=0;
switch ($action) switch ($action)
{ {
case 'edit': case 'edit':
if (isset($_COOKIE['no_wysiwyg']) && $_COOKIE['no_wysiwyg'] == 1) if (isset($_COOKIE['no_wysiwyg']) && $_COOKIE['no_wysiwyg'] == 1)
{ {
$field = "<a name=\"" . $field_id . "\"></a>"; $field = '<a name="' . $field_id . '"></a>';
$field .= "<textarea style=\"98%\" name=\"feld[" . $field_id . "]\">" . $field_value . "</textarea>"; $field .= '<textarea style="width: 98%" name="feld[' . $field_id . ']">' . $field_value . '</textarea>';
} }
else else
{ {
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === (bool)true)) { if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === true))
switch ($_SESSION['use_editor'])
{ {
case '0': $oCKeditor = new CKeditor();
case '1': $oCKeditor->returnOutput = true;
case '2': $oCKeditor->config['toolbar'] = 'Verysmall';
$oCKeditor = new CKeditor(); $oCKeditor->config['height'] = 250;
$oCKeditor->returnOutput = true; $config = array();
$oCKeditor->config['toolbar'] = 'Verysmall'; $field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
$oCKeditor->config['height'] = 200;
$config = array();
$field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
break;
default:
$field = $field_value;
break;
} }
} else { else
switch ($_SESSION['use_editor']) { {
case '0': // CKEditor $oCKeditor = new CKeditor();
case '1': $oCKeditor->returnOutput = true;
$oCKeditor = new CKeditor(); $oCKeditor->config['toolbar'] = 'Small';
$oCKeditor->returnOutput = true; $oCKeditor->config['height'] = 300;
$oCKeditor->config['toolbar'] = 'Small'; $config = array();
$oCKeditor->config['height'] = 300; $field = $oCKeditor->editor('feld[' . $field_id . ']', $field_value, $config);
$config = array();
$field = $oCKeditor->editor('feld[' . $field_id . ']', $field_value, $config);
break;
default:
$field = $field_value;
break;
} }
} }
}
$res = $field; $res = $field;
break; break;
case 'doc': case 'doc':
case 'req': case 'req':
$res = get_field_default($field_value,$action,$field_id,$tpl,$tpl_empty,$maxlength,$document_fields,$rubric_id); $res = get_field_default($field_value,$action,$field_id,$tpl,$tpl_empty,$maxlength,$document_fields,$rubric_id);
$res = document_pagination($res); $res = document_pagination($res);
break; break;
case 'name' : case 'name' :
return $AVE_Template->get_config_vars('name'); return $AVE_Template->get_config_vars('name');
break; break;
}
return ($res ? $res : $field_value);
} }
return ($res ? $res : $field_value); ?>
}
?>

138
fields/multi_line_slim/field.php

@ -1,91 +1,75 @@
<? <?php
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Многострочное (Слим) // Многострочное (Слим)
function get_field_multi_line_slim($field_value,$action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){ function get_field_multi_line_slim($field_value,$action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{
global $AVE_Template, $AVE_Document; global $AVE_Template, $AVE_Document;
$fld_dir = dirname(__FILE__) . '/';
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; $fld_dir = dirname(__FILE__) . '/';
$AVE_Template->config_load($lang_file, 'lang'); $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$res=0; $AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
switch ($action) $res = 0;
{
case 'edit':
if (isset($_COOKIE['no_wysiwyg']) && $_COOKIE['no_wysiwyg'] == 1)
{
$field = "<a name=\"" . $field_id . "\"></a>";
$field .= "<textarea style=\"width:" . $AVE_Document->_textarea_width_small . "; height:" . $AVE_Document->_textarea_height_small . "\" name=\"feld[" . $field_id . "]\">" . $field_value . "</textarea>";
}
else
{
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === (bool)true)) {
switch ($_SESSION['use_editor']) {
case '0':
case '1':
case '2':
$oCKeditor = new CKeditor();
$oCKeditor->returnOutput = true;
$oCKeditor->config['toolbar'] = 'Verysmall';
$oCKeditor->config['height'] = 200;
$config = array();
$field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
break;
default: switch ($action)
$field = $field_value; {
break; case 'edit':
if (isset($_COOKIE['no_wysiwyg']) && $_COOKIE['no_wysiwyg'] == 1)
{
$field = '<a name="' . $field_id . '"></a>';
$field .= '<textarea style="width: 98%" name="feld[' . $field_id . ']">' . $field_value . '</textarea>';
}
else
{
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === true))
{
$oCKeditor = new CKeditor();
$oCKeditor->returnOutput = true;
$oCKeditor->config['toolbar'] = 'Verysmall';
$oCKeditor->config['height'] = 250;
$config = array();
$field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
} }
} else { else
switch ($_SESSION['use_editor']) { {
case '0': // CKEditor $oCKeditor = new CKeditor();
case '1': $oCKeditor->returnOutput = true;
$oCKeditor = new CKeditor(); $oCKeditor->config['toolbar'] = 'Verysmall';
$oCKeditor->returnOutput = true; $oCKeditor->config['height'] = 200;
$oCKeditor->config['toolbar'] = 'Verysmall'; $config = array();
$oCKeditor->config['height'] = 200; $field = $oCKeditor->editor('feld[' . $field_id . ']', $field_value, $config);
$config = array();
$field = $oCKeditor->editor('feld[' . $field_id . ']', $field_value, $config);
break;
default:
$field = $field_value;
break;
} }
} }
}
$res = $field; $res = $field;
break; break;
case 'doc': case 'doc':
case 'req': case 'req':
$res = get_field_default($field_value,$action,$field_id,$tpl,$tpl_empty,$maxlength,$document_fields,$rubric_id); $res = get_field_default($field_value,$action,$field_id,$tpl,$tpl_empty,$maxlength,$document_fields,$rubric_id);
$res = document_pagination($res); $res = document_pagination($res);
break; break;
case 'name' : case 'name' :
return $AVE_Template->get_config_vars('name'); return $AVE_Template->get_config_vars('name');
break; break;
} }
return ($res ? $res : $field_value); return ($res ? $res : $field_value);
} }
?> ?>

284
fields/multi_list/field.php

@ -1,194 +1,194 @@
<? <?php
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Мульти лист // Мульти лист
function get_field_multi_list($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){ function get_field_multi_list($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{
global $AVE_Template;
global $AVE_Template; $fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir);
$fld_dir = dirname(__FILE__) . '/'; $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir);
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; $AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$AVE_Template->config_load($lang_file, 'lang'); $res = array();
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$res = array(); switch ($action)
{
case 'edit':
switch ($action) $items = array();
{
case 'edit':
$items = array(); $items = unserialize($field_value);
$items = unserialize($field_value); if ($items != false)
{
if ($items != false) foreach($items as $k => $v){
{ $list_item = explode('|', $v);
foreach($items as $k => $v){ $list[$k]['param'] = (isset($list_item[0])) ? htmlspecialchars($list_item[0], ENT_QUOTES) : '';
$list_item = explode('|', $v); $list[$k]['value'] = (isset($list_item[1])) ? htmlspecialchars($list_item[1], ENT_QUOTES) : '';
}
$list[$k]['param'] = (isset($list_item[0])) ? htmlspecialchars($list_item[0], ENT_QUOTES) : ''; $items = $list;
$list[$k]['value'] = (isset($list_item[1])) ? htmlspecialchars($list_item[1], ENT_QUOTES) : '';
} }
else
{
$items = explode(',', $default);
$items = $list; foreach($items as $k => $v){
} $list_item = explode('|', $v);
else
{
$items = explode(',', $default);
foreach($items as $k => $v){
$list_item = explode('|', $v);
$list[$k]['param'] = (isset($list_item[0])) ? htmlspecialchars($list_item[0], ENT_QUOTES) : ''; $list[$k]['param'] = (isset($list_item[0])) ? htmlspecialchars($list_item[0], ENT_QUOTES) : '';
$list[$k]['value'] = (isset($list_item[1])) ? htmlspecialchars($list_item[1], ENT_QUOTES) : ''; $list[$k]['value'] = (isset($list_item[1])) ? htmlspecialchars($list_item[1], ENT_QUOTES) : '';
}
$items = $list;
} }
$items = $list;
}
$AVE_Template->assign('doc_id', $_REQUEST['Id']); $AVE_Template->assign('doc_id', $_REQUEST['Id']);
$AVE_Template->assign('field_dir', $fld_name); $AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('items', $items); $AVE_Template->assign('items', $items);
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
break; break;
case 'doc': case 'doc':
$items = unserialize($field_value); $items = unserialize($field_value);
if ($items != false) if ($items != false)
{
foreach($items as $list_item)
{ {
$list_item = clean_php($list_item); foreach($items as $list_item)
$field_param = explode('|', $list_item);
if ($list_item)
{ {
if ($tpl_empty) $list_item = clean_php($list_item);
{ $field_param = explode('|', $list_item);
$list_item = $field_param;
} if ($list_item)
else
{ {
$list_item = preg_replace_callback( if ($tpl_empty)
'/\[tag:parametr:(\d+)\]/i', {
function($data) use($field_param) $list_item = $field_param;
{ }
return $field_param[(int)$data[1]]; else
}, {
$tpl $list_item = preg_replace_callback(
); '/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
} }
$res[] = $list_item;
} }
$res[] = $list_item;
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res)); $AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl; return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl;
break; break;
case 'req': case 'req':
$items = unserialize($field_value); $items = unserialize($field_value);
if ($items != false) if ($items != false)
{
foreach($items as $list_item)
{ {
$list_item = clean_php($list_item); foreach($items as $list_item)
$field_param = explode('|', $list_item);
if ($list_item)
{ {
if ($tpl_empty) $list_item = clean_php($list_item);
{ $field_param = explode('|', $list_item);
$list_item = $field_param;
} if ($list_item)
else
{ {
$list_item = preg_replace_callback( if ($tpl_empty)
'/\[tag:parametr:(\d+)\]/i', {
function($data) use($field_param) $list_item = $field_param;
{ }
return $field_param[(int)$data[1]]; else
}, {
$tpl $list_item = preg_replace_callback(
); '/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
} }
$res[] = $list_item;
} }
$res[] = $list_item;
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res)); $AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl; return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl;
break; break;
case 'save': case 'save':
foreach ($field_value as $v) foreach ($field_value as $v)
{
if(! empty($v['param']))
{ {
$field_value_new[] = $v['param'] . ($v['value'] ? '|' . $v['value'] : ''); if(! empty($v['param']))
{
$field_value_new[] = $v['param'] . ($v['value'] ? '|' . $v['value'] : '');
}
} }
}
if (isset($field_value_new)) if (isset($field_value_new))
{
return @serialize($field_value_new);
}
else
{ {
return $field_value_new = ''; return @serialize($field_value_new);
} }
break; else
{
return $field_value_new = '';
}
break;
case 'name': case 'name':
return $AVE_Template->get_config_vars('name'); return $AVE_Template->get_config_vars('name');
break; break;
}
return ($res ? $res : $field_value);
} }
return ($res ? $res : $field_value);
}
?> ?>

260
fields/multi_list_single/field.php

@ -1,177 +1,177 @@
<? <?php
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
*/ */
// Мульти лист // Мульти лист
function get_field_multi_list_single($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){ function get_field_multi_list_single($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{
global $AVE_Template; global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/'; $fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/'; $tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir); $fld_name = basename($fld_dir);
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang'); $AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); $AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin'); $AVE_Template->config_load($lang_file, 'admin');
$res = array(); $res = array();
switch ($action) switch ($action)
{ {
case 'edit': case 'edit':
$items = array(); $items = array();
$items = unserialize($field_value); $items = unserialize($field_value);
if ($items != false) if ($items != false)
{
$items = $items;
}
else
{ {
$items = explode(',', $default); $items = $items;
} }
else
{
$items = explode(',', $default);
}
$AVE_Template->assign('doc_id', $_REQUEST['Id']); $AVE_Template->assign('doc_id', $_REQUEST['Id']);
$AVE_Template->assign('field_dir', $fld_name); $AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('items', $items); $AVE_Template->assign('items', $items);
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
break; break;
case 'doc': case 'doc':
$items = unserialize($field_value); $items = unserialize($field_value);
if ($items != false) if ($items != false)
{
foreach($items as $list_item)
{ {
$list_item = clean_php($list_item); foreach($items as $list_item)
$field_param = explode('|', $list_item);
if ($list_item)
{ {
if ($tpl_empty) $list_item = clean_php($list_item);
{ $field_param = explode('|', $list_item);
$list_item = $field_param;
} if ($list_item)
else
{ {
$list_item = preg_replace_callback( if ($tpl_empty)
'/\[tag:parametr:(\d+)\]/i', {
function($data) use($field_param) $list_item = $field_param;
{ }
return $field_param[(int)$data[1]]; else
}, {
$tpl $list_item = preg_replace_callback(
); '/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
} }
$res[] = $list_item;
} }
$res[] = $list_item;
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res)); $AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl; return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl;
break; break;
case 'req': case 'req':
$items = unserialize($field_value); $items = unserialize($field_value);
if ($items != false) if ($items != false)
{
foreach($items as $list_item)
{ {
$list_item = clean_php($list_item); foreach($items as $list_item)
$field_param = explode('|', $list_item);
if ($list_item)
{ {
if ($tpl_empty) $list_item = clean_php($list_item);
{ $field_param = explode('|', $list_item);
$list_item = $field_param;
} if ($list_item)
else
{ {
$list_item = preg_replace_callback( if ($tpl_empty)
'/\[tag:parametr:(\d+)\]/i', {
function($data) use($field_param) $list_item = $field_param;
{ }
return $field_param[(int)$data[1]]; else
}, {
$tpl $list_item = preg_replace_callback(
); '/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
} }
$res[] = $list_item;
} }
$res[] = $list_item;
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res)); $AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl; return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl;
break; break;
case 'save': case 'save':
foreach ($field_value as $v) foreach ($field_value as $v)
{
if (! empty($v))
{ {
$field_value_new[] = $v; if (! empty($v))
{
$field_value_new[] = $v;
}
} }
}
if (isset($field_value_new)) if (isset($field_value_new))
{
return @serialize($field_value_new);
}
else
{ {
return $field_value_new = ''; return @serialize($field_value_new);
} }
break; else
{
return $field_value_new = '';
}
break;
case 'name': case 'name':
return $AVE_Template->get_config_vars('name'); return $AVE_Template->get_config_vars('name');
break; break;
}
return ($res ? $res : $field_value);
} }
return ($res ? $res : $field_value);
}
?> ?>

75
fields/multi_list_single/js/outside.js

@ -1,75 +0,0 @@
var MultiListSingle = {
init: false,
init: function() {
if (this.initialized) return;
this.initialized = true;
this.s_lists();
},
s_lists: function() {
this.s_lists_sortable();
this.s_lists_del_item();
this.s_lists_add();
},
s_lists_update: function() {
this.s_lists_maxid();
this.s_lists_del_item();
AveAdmin.tooltip();
},
s_lists_maxid: function(id) {
var maxid = 1;
$('#multi_lists_single_' + id).children('.multi_list_single').each(function() {
maxid = Math.max(maxid, parseInt($(this).attr("data-id")) + 1);
});
return maxid;
},
s_lists_del_item: function() {
$('.multi_list_single .DelSingleButton').on('click', function(event) {
event.preventDefault();
var id = $(this).attr('data-id');
jConfirm(
s_list_del_conf,
s_list_del_head,
function(b) {
if (b) {
$('#list_' + id).remove();
}
}
);
});
},
s_lists_add: function() {
$('.AddSingleButton').on('click', function(event) {
event.preventDefault();
c_id = $(this).parent().parent('.multi_lists_single').attr("data-id");
iid = MultiListSingle.s_lists_maxid(c_id);
$('#multi_lists_single_' + c_id + ':last').append(
'<div class="multi_list_single fix mb10" id="list_' + c_id + '_' + iid + '" data-id="' + iid + '">' +
'<input type="text" class="mousetrap" value="" name="feld[' + c_id + '][' + iid + ']" placeholder="' + s_list_value + '" style="width: 400px;"/>&nbsp;&nbsp;<a href="javascript:void(0);" data-id="' + c_id + '_' + iid + '" class="button redBtn topDir DelSingleButton" title="' + s_list_del + '">&times;</a>' +
'<div class="handle" style="float: left; display: inline-block; margin: 4px 7px; cursor: move;"><span class="icon_sprite ico_move"></span></div>' +
'</div>'
);
MultiListSingle.s_lists_update();
});
},
s_lists_sortable: function() {
$('.multi_lists_single').sortable({
handle: ".handle",
placeholder: "ui-state-highlight grey_bg"
});
//$(".multi_lists_single").disableSelection();
}
}
$(document).ready(function() {
MultiListSingle.init();
});

291
fields/multi_list_triple/field.php

@ -1,200 +1,199 @@
<? <?php
/**
/** * AVE.cms
* AVE.cms *
* * @package AVE.cms
* @package AVE.cms * @version 3.x
* @version 3.x * @filesource
* @filesource * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru *
* * @license GPL v.2
* @license GPL v.2 */
*/
// Мульти лист
function get_field_multi_list_triple($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{
global $AVE_Template;
// Мульти лист $fld_dir = dirname(__FILE__) . '/';
function get_field_multi_list_triple($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){ $tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir);
global $AVE_Template; $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$fld_dir = dirname(__FILE__) . '/'; $AVE_Template->config_load($lang_file, 'lang');
$tpl_dir = $fld_dir . 'tpl/'; $AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$fld_name = basename($fld_dir); $AVE_Template->config_load($lang_file, 'admin');
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; $res = array();
$AVE_Template->config_load($lang_file, 'lang'); switch ($action)
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); {
$AVE_Template->config_load($lang_file, 'admin'); case 'edit':
$res = array(); $items = array();
switch ($action) $items = unserialize($field_value);
{
case 'edit':
$items = array(); if ($items != false)
{
$items = unserialize($field_value);
if ($items != false) foreach($items as $k => $v)
{ {
$list_item = explode('|', $v);
foreach($items as $k => $v) $list[$k]['param'] = (isset($list_item[0])) ? htmlspecialchars($list_item[0], ENT_QUOTES) : '';
{ $list[$k]['value'] = (isset($list_item[1])) ? htmlspecialchars($list_item[1], ENT_QUOTES) : '';
$list_item = explode('|', $v); $list[$k]['value2'] = (isset($list_item[2])) ? htmlspecialchars($list_item[2], ENT_QUOTES) : '';
}
$list[$k]['param'] = (isset($list_item[0])) ? htmlspecialchars($list_item[0], ENT_QUOTES) : ''; $items = $list;
$list[$k]['value'] = (isset($list_item[1])) ? htmlspecialchars($list_item[1], ENT_QUOTES) : '';
$list[$k]['value2'] = (isset($list_item[2])) ? htmlspecialchars($list_item[2], ENT_QUOTES) : '';
} }
else
{
$items = $list; $items = explode(',', $default);
}
else
{
$items = explode(',', $default); foreach ($items as $k => $v)
{
$list_item = explode('|', $v);
foreach ($items as $k => $v) $list[$k]['param'] = (isset($list_item[0])) ? htmlspecialchars($list_item[0], ENT_QUOTES) : '';
{ $list[$k]['value'] = (isset($list_item[1])) ? htmlspecialchars($list_item[1], ENT_QUOTES) : '';
$list_item = explode('|', $v); $list[$k]['value2'] = (isset($list_item[2])) ? htmlspecialchars($list_item[2], ENT_QUOTES) : '';
}
$list[$k]['param'] = (isset($list_item[0])) ? htmlspecialchars($list_item[0], ENT_QUOTES) : ''; $items = $list;
$list[$k]['value'] = (isset($list_item[1])) ? htmlspecialchars($list_item[1], ENT_QUOTES) : '';
$list[$k]['value2'] = (isset($list_item[2])) ? htmlspecialchars($list_item[2], ENT_QUOTES) : '';
} }
$items = $list; $AVE_Template->assign('doc_id', $_REQUEST['Id']);
} $AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('items', $items);
$AVE_Template->assign('doc_id', $_REQUEST['Id']); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('items', $items);
$AVE_Template->assign('field_id', $field_id);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
break; break;
case 'doc': case 'doc':
$items = unserialize($field_value); $items = unserialize($field_value);
if ($items != false) if ($items != false)
{
foreach ($items as $list_item)
{ {
$list_item = clean_php($list_item); foreach ($items as $list_item)
$field_param = explode('|', $list_item);
if ($list_item)
{ {
if ($tpl_empty) $list_item = clean_php($list_item);
{ $field_param = explode('|', $list_item);
$list_item = $field_param;
} if ($list_item)
else
{ {
$list_item = preg_replace_callback( if ($tpl_empty)
'/\[tag:parametr:(\d+)\]/i', {
function($data) use($field_param) $list_item = $field_param;
{ }
return $field_param[(int)$data[1]]; else
}, {
$tpl $list_item = preg_replace_callback(
); '/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
} }
$res[] = $list_item;
} }
$res[] = $list_item;
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if($tpl_empty && $tpl_file) if($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res)); $AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl; return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl;
break; break;
case 'req': case 'req':
$items = unserialize($field_value); $items = unserialize($field_value);
if ($items != false) if ($items != false)
{
foreach ($items as $list_item)
{ {
$list_item = clean_php($list_item); foreach ($items as $list_item)
$field_param = explode('|', $list_item);
if ($list_item)
{ {
if ($tpl_empty) $list_item = clean_php($list_item);
{ $field_param = explode('|', $list_item);
$list_item = $field_param;
} if ($list_item)
else
{ {
$list_item = preg_replace_callback( if ($tpl_empty)
'/\[tag:parametr:(\d+)\]/i', {
function($data) use($field_param) $list_item = $field_param;
{ }
return $field_param[(int)$data[1]]; else
}, {
$tpl $list_item = preg_replace_callback(
); '/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
} }
$res[] = $list_item;
} }
$res[] = $list_item;
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('field_count', count($res)); $AVE_Template->assign('field_count', count($res));
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl; return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl;
break; break;
case 'save': case 'save':
foreach ($field_value as $v) foreach ($field_value as $v)
{
if(!empty($v['param']))
{ {
$field_value_new[] = $v['param'] . '|' . $v['value'] . '|' . $v['value2']; if(!empty($v['param']))
{
$field_value_new[] = $v['param'] . '|' . $v['value'] . '|' . $v['value2'];
}
} }
}
if (isset($field_value_new)) if (isset($field_value_new))
{
return @serialize($field_value_new);
}
else
{ {
return $field_value_new = ''; return @serialize($field_value_new);
} }
break; else
{
return $field_value_new = '';
}
break;
case 'name': case 'name':
return $AVE_Template->get_config_vars('name'); return $AVE_Template->get_config_vars('name');
break; break;
}
return ($res ? $res : $field_value);
} }
return ($res ? $res : $field_value);
}
?> ?>

75
fields/multi_list_triple/js/outside.js

@ -1,75 +0,0 @@
var MultiListTriple = {
init: false,
init: function() {
if (this.initialized) return;
this.initialized = true;
this.lists();
},
lists: function() {
this.lists_sortable();
this.lists_del_item();
this.lists_add();
},
lists_update: function() {
this.lists_maxid();
this.lists_del_item();
AveAdmin.tooltip();
},
lists_maxid: function(id) {
var maxid = 1;
$('#multi_lists_triple_' + id).children('.multi_list_triple').each(function() {
maxid = Math.max(maxid, parseInt($(this).attr("data-id")) + 1);
});
return maxid;
},
lists_del_item: function() {
$('.multi_list_triple .DelButton').on('click', function(event) {
event.preventDefault();
var id = $(this).attr('data-id');
jConfirm(
list_del_conf,
list_del_head,
function(b) {
if (b) {
$('#list_' + id).remove();
}
}
);
});
},
lists_add: function() {
$('.AddButton').on('click', function(event) {
event.preventDefault();
c_id = $(this).parent().parent('.multi_lists_triple').attr("data-id");
iid = MultiListTriple.lists_maxid(c_id);
$('#multi_lists_triple_' + c_id + ':last').append(
'<div class="multi_list_triple fix mb10" id="list_' + c_id + '_' + iid + '" data-id="' + iid + '">' +
'<input class="mousetrap" type="text" value="" name="feld[' + c_id + '][' + iid + '][param]" placeholder="' + list_param + '" style="width: 200px;"/>&nbsp;&nbsp;<input type="text" class="mousetrap" value="" name="feld[' + c_id + '][' + iid + '][value]" placeholder="' + list_value + '" style="width: 200px;" />&nbsp;&nbsp;<input type="text" class="mousetrap" value="" name="feld[' + c_id + '][' + iid + '][value2]" placeholder="' + list_value2 + '" style="width: 200px;" />&nbsp;&nbsp;<a href="javascript:void(0);" data-id="' + c_id + '_' + iid + '" class="button redBtn topDir DelButton" title="' + list_del + '">&times;</a>' +
'<div class="handle" style="float: left; display: inline-block; margin: 4px 7px; cursor: move;"><span class="icon_sprite ico_move"></span></div>' +
'</div>'
);
MultiListTriple.lists_update();
});
},
lists_sortable: function() {
$('.multi_lists_triple').sortable({
handle: ".handle",
placeholder: "ui-state-highlight grey_bg"
});
//$(".multi_lists_triple").disableSelection();
}
}
$(document).ready(function() {
MultiListTriple.init();
});

236
fields/multi_select/field.php

@ -1,159 +1,159 @@
<? <?php
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Мульти список // Мульти список
function get_field_multi_select($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null) function get_field_multi_select($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
{ {
global $AVE_Template; global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/'; $fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/'; $tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir); $fld_name = basename($fld_dir);
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang'); $AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); $AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin'); $AVE_Template->config_load($lang_file, 'admin');
$res = array(); $res = array();
switch ($action) switch ($action)
{ {
case 'edit': case 'edit':
$items = array(); $items = array();
$items = explode(',', $default); $items = explode(',', $default);
$items = array_diff($items, array('')); $items = array_diff($items, array(''));
@$field_value = unserialize($field_value); @$field_value = unserialize($field_value);
$AVE_Template->assign('items', $items); $AVE_Template->assign('items', $items);
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value); $AVE_Template->assign('field_value', $field_value);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
break; break;
case 'doc': case 'doc':
$items = (isset($field_value)) $items = (isset($field_value))
? unserialize($field_value) ? unserialize($field_value)
: array(); : array();
if ($items != false) if ($items != false)
{
foreach($items as $item)
{ {
$item = clean_php($item); foreach($items as $item)
{
$item = clean_php($item);
$field_param = explode('|', $item); $field_param = explode('|', $item);
if ($item) if ($item)
{
if ($tpl_empty)
{
$item = $field_param[0];
}
else
{ {
$item = preg_replace_callback( if ($tpl_empty)
'/\[tag:parametr:(\d+)\]/i', {
function($data) use($field_param) $item = $field_param[0];
{ }
return $field_param[(int)$data[1]]; else
}, {
$tpl $item = preg_replace_callback(
); '/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
} }
$res[] = $item;
} }
$res[] = $item;
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file) if ($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('rubric_id', $rubric_id); $AVE_Template->assign('rubric_id', $rubric_id);
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (! empty($res)) return (! empty($res))
? implode(PHP_EOL, $res) ? implode(PHP_EOL, $res)
: $tpl; : $tpl;
break; break;
case 'req': case 'req':
$items = (isset($field_value)) ? unserialize($field_value) : array(); $items = (isset($field_value)) ? unserialize($field_value) : array();
if ($items != false) if ($items != false)
{
foreach($items as $item)
{ {
$item = clean_php($item); foreach($items as $item)
{
$item = clean_php($item);
$field_param = explode('|', $item); $field_param = explode('|', $item);
if ($item) if ($item)
{
if ($tpl_empty)
{
$item = $field_param[0];
}
else
{ {
$item = preg_replace_callback( if ($tpl_empty)
'/\[tag:parametr:(\d+)\]/i', {
function($data) use($field_param) $item = $field_param[0];
{ }
return $field_param[(int)$data[1]]; else
}, {
$tpl $item = preg_replace_callback(
); '/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
} }
$res[] = $item;
} }
$res[] = $item;
} }
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req'); $tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if($tpl_empty && $tpl_file) if($tpl_empty && $tpl_file)
{ {
$AVE_Template->assign('field_id', $field_id); $AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $res); $AVE_Template->assign('field_value', $res);
$AVE_Template->assign('rubric_id', $rubric_id); $AVE_Template->assign('rubric_id', $rubric_id);
$AVE_Template->assign('default', $default); $AVE_Template->assign('default', $default);
return $AVE_Template->fetch($tpl_file); return $AVE_Template->fetch($tpl_file);
} }
return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl; return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl;
break; break;
case 'name': case 'name':
return $AVE_Template->get_config_vars('name'); return $AVE_Template->get_config_vars('name');
break; break;
} }
return ($res ? $res : $field_value); return ($res ? $res : $field_value);
} }
?> ?>

222
fields/single_line/field.php

@ -1,115 +1,123 @@
<? <?
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Однострочное // Однострочное
function get_field_single_line ($field_value, $action, $field_id = 0, $tpl = '', $tpl_empty = 0, &$maxlength = null, $document_fields = array(), $rubric_id = 0, $default = null) function get_field_single_line ($field_value, $action, $field_id = 0, $tpl = '', $tpl_empty = 0, &$maxlength = null, $document_fields = array(), $rubric_id = 0, $default = null, $_tpl = null)
{
global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir);
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
switch ($action)
{ {
case 'edit': global $AVE_Template;
$AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
return $AVE_Template->fetch($tpl_file);
break;
case 'doc':
$AVE_Template->config_load($lang_file, 'public');
if ($tpl_empty)
{
$field_value = clean_php($field_value);
}
else
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
if($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
case 'req':
$AVE_Template->config_load($lang_file, 'public');
if ($tpl_empty)
{
$field_value = clean_php($field_value);
}
else
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
if($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
}
return $field_value; $fld_dir = dirname(__FILE__) . '/';
break; $tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir);
case 'save': $lang_file = $fld_dir . 'lang/' . (defined('ACP')
return $field_value; ? $_SESSION['admin_language']
: $_SESSION['user_language']) . '.txt';
case 'name': $AVE_Template->config_load($lang_file, 'lang');
return $AVE_Template->get_config_vars('name'); $AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
default: return $field_value; switch ($action)
} {
} case 'edit':
$AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
?> return $AVE_Template->fetch($tpl_file);
break;
case 'doc':
$AVE_Template->config_load($lang_file, 'public');
if ($tpl_empty)
{
$field_value = clean_php($field_value);
}
else
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function ($data) use ($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_default', $default);
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
case 'req':
$AVE_Template->config_load($lang_file, 'public');
if ($tpl_empty)
{
$field_value = clean_php($field_value);
}
else
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_default', $default);
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
case 'save':
return $field_value;
case 'name':
return $AVE_Template->get_config_vars('name');
default:
return $field_value;
}
}
?>

4
fields/single_line/tpl/field-doc.tpl

@ -1 +1,5 @@
{*
$field_id
$field_value
*}
{$field_value} {$field_value}

4
fields/single_line/tpl/field-req.tpl

@ -1 +1,5 @@
{*
$field_id
$field_value
*}
{$field_value} {$field_value}

211
fields/single_line_numeric/field.php

@ -1,106 +1,115 @@
<? <?php
/** /**
* AVE.cms * AVE.cms
* *
* @package AVE.cms * @package AVE.cms
* @version 3.x * @version 3.x
* @filesource * @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
* *
* @license GPL v.2 * @license GPL v.2
*/ */
// Однострочное числовое // Однострочное числовое
function get_field_single_line_numeric ($field_value, $action, $field_id = 0, $tpl = '', $tpl_empty = 0, &$maxlength = null, $document_fields = array(), $rubric_id = 0, $default = null) function get_field_single_line_numeric ($field_value, $action, $field_id = 0, $tpl = '', $tpl_empty = 0, &$maxlength = null, $document_fields = array(), $rubric_id = 0, $default = null, $_tpl = null)
{
global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir);
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
switch ($action)
{ {
case 'edit': global $AVE_Template;
$AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
return $AVE_Template->fetch($tpl_file);
break;
case 'doc':
if ($tpl_empty)
{
$field_value = clean_php($field_value);
}
else
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
if($tpl_empty && $tpl_file){
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
case 'req':
if ($tpl_empty)
{
$field_value = clean_php($field_value);
}
else
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
if($tpl_empty && $tpl_file){
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
case 'save': $fld_dir = dirname(__FILE__) . '/';
$field_value = preg_replace('/[^\d.]/','',$field_value); $tpl_dir = $fld_dir . 'tpl/';
return $field_value; $fld_name = basename($fld_dir);
case 'name': $lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
return $AVE_Template->get_config_vars('name');
default: return $field_value; $AVE_Template->config_load($lang_file, 'lang');
} $AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
} $AVE_Template->config_load($lang_file, 'admin');
?> switch ($action)
{
case 'edit':
$AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
return $AVE_Template->fetch($tpl_file);
break;
case 'doc':
if ($tpl_empty)
{
$field_value = clean_php($field_value);
}
else
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_default', $default);
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
case 'req':
if ($tpl_empty)
{
$field_value = clean_php($field_value);
}
else
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$AVE_Template->assign('field_default', $default);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
case 'save':
$field_value = preg_replace('/[^\d.]/','',$field_value);
return $field_value;
case 'name':
return $AVE_Template->get_config_vars('name');
default: return $field_value;
}
}
?>

134
fields/single_line_numeric_three/field.php

@ -0,0 +1,134 @@
<?php
/**
* AVE.cms
*
* @package AVE.cms
* @version 3.x
* @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
// Однострочное числовое
function get_field_single_line_numeric_three ($field_value, $action, $field_id = 0, $tpl = '', $tpl_empty = 0, &$maxlength = null, $document_fields = array(), $rubric_id = 0, $default = null, $_tpl=null)
{
global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
$tpl_dir = $fld_dir . 'tpl/';
$fld_name = basename($fld_dir);
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
switch ($action)
{
case 'edit':
if (! empty($field_value))
$field_value = explode('|', $field_value);
$AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
return $AVE_Template->fetch($tpl_file);
break;
case 'doc':
if ($tpl_empty)
{
$value = array();
if (! empty($field_value))
{
$value = array_diff(explode('|', $field_value), array(''));
$value = array_map('clean_php', $value);
}
}
else
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_value', $value);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
case 'req':
if ($tpl_empty)
{
$value = array();
if (! empty($field_value))
{
$value = explode('|', $field_value);
$value = array_map('clean_php', $value);
}
}
else
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
{
return $field_param[(int)$data[1]];
},
$tpl
);
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
if ($tpl_empty && $tpl_file)
{
$AVE_Template->assign('field_value', $value);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
case 'save':
$save = array();
if (is_array($field_value))
{
foreach ($field_value AS $k => $v)
{
$save[] = preg_replace('/[^\d.]/', '', $v);
}
}
return empty($save) ? '' : implode('|', $save);
case 'name':
return $AVE_Template->get_config_vars('name');
default: return $field_value;
}
}
?>

26
fields/single_line_numeric_three/js/field.js

@ -0,0 +1,26 @@
$(document).ready(function() {
$(".field_numeric").on('keydown', function(event) {
var num_dot = $(this).attr('data-num-dot');
var keyCode = window.event ? event.keyCode : event.which;
var foo = 0;
// prevent if already dot
if (keyCode != 8 && keyCode != 46) {
if ((foo == 0) && (keyCode != 190) && (keyCode < 96 || keyCode > 105) && (keyCode < 46 || keyCode > 59)) {
event.preventDefault();
} // prevent if not number/dot
}
if ($(this).val().indexOf('.') > -1) {
if (keyCode == 190) event.preventDefault();
}
$(this).keyup(function() {
this.value = this.value.replace(/[^0-9.]/i, "");
if($(this).val().indexOf('.')!=-1){
if($(this).val().split(".")[1].length >= num_dot){
if( isNaN( parseFloat( this.value ) ) ) return;
this.value = parseFloat(this.value).toFixed(num_dot);
}
}
return this;
});
});
});

3
fields/single_line_numeric_three/lang/bg.txt

@ -0,0 +1,3 @@
[admin]
name = "Едноредово (Числово)"

2
fields/single_line_numeric_three/lang/cz.txt

@ -0,0 +1,2 @@
[admin]
name = "Jednořádkový (Číselný)"

2
fields/single_line_numeric_three/lang/en.txt

@ -0,0 +1,2 @@
[admin]
name = "Single line (Numbers)"

2
fields/single_line_numeric_three/lang/pl.txt

@ -0,0 +1,2 @@
[admin]
name = "Linia pojedyncza (Numeryczne)"

2
fields/single_line_numeric_three/lang/ru.txt

@ -0,0 +1,2 @@
[admin]
name = "Однострочное (Числовое тройное)"

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save