Browse Source

Fixes

master
M@d D3n 6 years ago
parent
commit
0296ba4ddb
  1. 4
      README.md
  2. 61
      admin/browser.php
  3. 32
      admin/dbsettings.php
  4. 4
      admin/index.php
  5. 38
      admin/templates/css/main.css
  6. 3
      admin/templates/modules/modules.tpl
  7. 4
      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. 269
      class/class.database.php
  20. 18
      class/class.dbdump.php
  21. 127
      class/class.debug.php
  22. 13
      class/class.docs.php
  23. 22
      class/class.modules.php
  24. 15
      class/class.request.php
  25. 84
      class/class.rubs.php
  26. 3
      class/class.thumbnail.php
  27. 27
      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. 74
      fields/code/field.php
  42. 6
      fields/code/tpl/field-doc.tpl
  43. 6
      fields/code/tpl/field-req.tpl
  44. 31
      fields/date/field.php
  45. 34
      fields/doc_from_rub/field.php
  46. 25
      fields/doc_from_rub_check/field.php
  47. 16
      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. 20
      fields/drop_down/field.php
  58. 12
      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. 23
      fields/image_mega/field.php
  67. 2
      fields/image_mega/js/field.js
  68. 17
      fields/image_multi/field.php
  69. 231
      fields/image_multi/js/outside.js
  70. 16
      fields/image_single/field.php
  71. 14
      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. 44
      fields/multi_line/field.php
  82. 41
      fields/multi_line_simple/field.php
  83. 44
      fields/multi_line_slim/field.php
  84. 18
      fields/multi_list/field.php
  85. 18
      fields/multi_list_single/field.php
  86. 75
      fields/multi_list_single/js/outside.js
  87. 19
      fields/multi_list_triple/field.php
  88. 75
      fields/multi_list_triple/js/outside.js
  89. 16
      fields/multi_select/field.php
  90. 36
      fields/single_line/field.php
  91. 4
      fields/single_line/tpl/field-doc.tpl
  92. 4
      fields/single_line/tpl/field-req.tpl
  93. 31
      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)

61
admin/browser.php

@ -1,6 +1,6 @@
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,36 +11,39 @@
* @license GPL v.2
*/
if (!defined('ACP') || !check_permission('mediapool_int'))
{
if (! defined('ACP') || !check_permission('mediapool_int'))
{
header('Location:index.php');
exit;
}
}
global $AVE_DB, $AVE_Template;
global $AVE_DB, $AVE_Template;
ob_start();
ob_implicit_flush(0);
ob_start();
ob_implicit_flush(0);
$_REQUEST['onlycontent'] = 1;
$_REQUEST['onlycontent'] = 1;
$max_size = 128; // максимальный размер миниатюры
$thumb_size = '-t' . $max_size . 'x' . $max_size; // формат миниатюр
$images_ext = array('jpg', 'jpeg', 'png', 'gif', 'JPG', 'JPEG', 'PNG', 'GIF');
$max_size = 128; // максимальный размер миниатюры
$thumb_size = '-t' . $max_size . 'x' . $max_size; // формат миниатюр
$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->config_load(BASE_DIR . '/admin/lang/' . $lang . '/main.txt');
$AVE_Template->assign('tpl_dir', 'templates/');
$AVE_Template->assign('ABS_PATH', '../');
$AVE_Template = new AVE_Template(BASE_DIR . '/admin/templates/browser');
$AVE_Template->config_load(BASE_DIR . '/admin/lang/' . $lang . '/main.txt');
$AVE_Template->assign('tpl_dir', 'templates/');
$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':
$dir = (empty($_REQUEST['dir'])
|| strpos($_REQUEST['dir'], '..') !== false
@ -57,9 +60,11 @@ switch ($_REQUEST['action'])
$files = array();
$d = @dir($path);
while (false !== ($entry = @$d->read()))
{
if (in_array($entry, $skip_entry) || $entry{0} === '.') continue;
if (in_array($entry, $skip_entry) || $entry{0} === '.')
continue;
if (is_dir($path . $entry))
{
@ -88,6 +93,7 @@ switch ($_REQUEST['action'])
$files[$entry] = $file;
}
}
$d->close();
ksort($dirs);
@ -109,7 +115,9 @@ switch ($_REQUEST['action'])
if (check_permission('mediapool_add'))
{
$AVE_Template->display('browser_upload.tpl');
}else{
}
else
{
echo '<script type="text/javascript">window.close();</script>';
}
break;
@ -121,7 +129,8 @@ switch ($_REQUEST['action'])
case 'delfile':
if (check_permission('mediapool_del'))
{
if (empty($_REQUEST['file']) || empty($_REQUEST['dir'])) exit(0);
if (empty($_REQUEST['file']) || empty($_REQUEST['dir']))
exit(0);
$file_name = basename($_REQUEST['file']);
@ -183,10 +192,10 @@ switch ($_REQUEST['action'])
$AVE_Template->display('browser_2frames.tpl');
break;
}
}
$out = ob_get_clean();
$out = ob_get_clean();
echo $out;
echo $out;
?>

32
admin/dbsettings.php

@ -1,6 +1,6 @@
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,21 +11,22 @@
* @license GPL v.2
*/
if (!defined('ACP'))
{
if (! defined('ACP'))
{
header('Location:index.php');
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;
$AVE_DB_Service = new AVE_DB_Service;
if (!empty($_REQUEST['action']))
{
if (!empty($_REQUEST['action']))
{
switch ($_REQUEST['action'])
{
case 'optimize':
@ -60,11 +61,10 @@ if (!empty($_REQUEST['action']))
$AVE_DB_Service->databaseDumpFileDelete($_REQUEST['file']);
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);
// Статистика
if (defined('PROFILING') && PROFILING)
echo get_statistic(1, 1, 1, 1);
//if (defined('PROFILING') && PROFILING)
// 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 .lastNav { width: 2px; height: 30px; position: absolute; top: 0; right: 0; }
.userNav ul { margin-right: 2px; }
.userNav ul li { display: inline; float: left; position: relative; cursor: pointer; border-right: 1px solid #3F3F3F; }
.userNav ul li:first-child { border-left: 1px solid #3F3F3F; }
.userNav ul li a { color: #eeeeee; text-decoration: none; display: block; float: left; }
.userNav ul li:hover, .selected { background: #212121; }
.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 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: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: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 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 { margin-right: 2px; }
.userNav > ul > li { display: inline; float: left; position: relative; cursor: pointer; 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:hover, .selected { background: #212121; }
.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 > 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: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: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 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;}
#menu {width: 180px;}
/* ===== 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]: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]:hover, .mainForm input[disabled]:hover, .mainForm textarea[readonly]:hover, .mainForm textarea[disabled]:hover { background: #f5f5f5; border: 1px solid #aaa; color: #aaa; }
.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], .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, .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, .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;}

3
admin/templates/modules/modules.tpl

@ -49,6 +49,9 @@ $(document).ready(function(){ldelim}
</div>
<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">
<li class="activeTab"><a href="#tab1">{#MODULES_INSTALLED#}</a></li>
<li class=""><a href="#tab2">{#MODULES_NOT_INSTALLED#}</a></li>

4
admin/templates/request/conditions.tpl

@ -1,7 +1,5 @@
<script language="Javascript" type="text/javascript">
var sess = '{$sess}';
var sess = '{$sess}';
</script>
<div class="title {if $smarty.request.pop}first{/if}">

2
admin/templates/rubs/change.tpl

@ -1,5 +1,5 @@
{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">
<select class="mousetrap" name="rubric_field_type" id="rubric_field_type_{$field_id|escape}" style="width: 200px;">
{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">
<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">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<col width="50%">
<col>
<thead>
<tr>
<td>{#RUBRIK_FIELD_DEFAULT#}</td>
<td>{#RUBRIK_FILED_TEMPLATE_DESCR#}</td>
</tr>
</thead>
<tr>
<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>
<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>
</td>
</tr>
<tr>
<td>INT, STRING, JSON</td>
<td>
|&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});
{literal}
setTimeout(function(){editorrftdf.refresh();}, 20);
setTimeout(function(){editorrft.refresh();}, 20);
setTimeout(function(){editorrftr.refresh();}, 20);
setTimeout(function(){editorrftd.refresh();}, 20);
@ -258,6 +262,7 @@ $(document).ready(function(){ldelim}
{rdelim});
</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="rft" textarea_id='rubric_field_template' ctrls='$(".SaveEditFieldTemplate").trigger("click");' height=130}
{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="rftd" textarea_id='rubric_field_description' ctrls='$(".SaveEditFieldTemplate").trigger("click");' height=120}
{include file="$codemirror_editor" conn_id="rftdf" textarea_id='rubric_field_default' ctrls='$(".SaveEditFieldTemplate").trigger("click");' height=120}
{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>
</td>
<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>
</tr>
{/foreach}
@ -290,10 +290,9 @@ function openAliasWindow(fieldId, rubId, width, height, target) {ldelim}
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<col width="10">
<col width="10">
<col width="350">
<col>
<col width="220">
<col width="100">
<col>
<thead>
<tr>
<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_TYPE#}</td>
<td>{#RUBRIK_FIELD_GROUP#}</td>
<td>{#RUBRIK_FIELD_DEFAULT#}</td>
</tr>
</thead>
<tbody>
@ -328,11 +326,6 @@ function openAliasWindow(fieldId, rubId, width, height, target) {ldelim}
{/foreach}
</select>
</td>
<td>
<div class="pr12">
<input name="default_value" type="text" id="default_value" value="" style="width:100%;" />
</div>
</td>
</tr>
</tbody>
</table>
@ -631,8 +624,7 @@ $(document).ready(function(){ldelim}
function resetForms(){ldelim}
$('#newfld').find('a.jqTransformCheckbox').removeClass('jqTransformChecked');
$('#newfld').find('select').prop('selectedIndex',0);
$('#newfld').find('select').trigger('refresh');
$('#newfld').find('input[type="checkbox"]').prop('checked', false).trigger('refresh');
$('#newfld input[type=text]').val('');
$('#newfld').trigger('refresh');
{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('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_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_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_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-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>

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('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_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_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_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-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>

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('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_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_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_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-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>

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('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_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_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_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-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>

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('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_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_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_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-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>

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('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_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_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_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-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>

2
admin/templates/sysblocks/list.tpl

@ -120,7 +120,7 @@
<td align="center">{$sysblock->sysblock_author_id|escape}</td>
<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>

269
class/class.core.php

@ -16,11 +16,6 @@
class AVE_Core
{
/**
* Свойства класса
*/
/**
* Текущий документ
*
@ -70,9 +65,6 @@
*/
public $_module_not_found = 'Запрашиваемый модуль не найден.';
/**
* Внутренние методы класса
*/
/**
* Получение основных настроек сисблока
@ -268,6 +260,9 @@
{
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']))
@ -368,6 +363,7 @@
}
}
/**
* Метод, предназначенный для обработки события 404 Not Found, т.е. когда страница не найдена.
*
@ -403,6 +399,7 @@
exit;
}
/**
* Метод, предназначенный для формирования хэша страницы
*
@ -418,6 +415,7 @@
return md5($hash);
}
/**
* Метод, предназначенный для проверки существования документа в БД
*
@ -520,7 +518,7 @@
/**
* Метод, предназначенный для получения МЕТА-тегов для различных модулей.
*
* ToDo
* @return boolean
*/
function _coreModuleMetatagsFetch()
@ -649,9 +647,134 @@
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)
{
global $AVE_DB, $AVE_Template;
global $AVE_DB, $AVE_Template, $AVE_Module;
$pattern = array(); // Массив системных тегов
$replace = array(); // Массив функций, на которые будут заменены системные теги
if (null !== $AVE_Module->moduleListGet())
$this->install_modules = $AVE_Module->moduleListGet();
// Если уже имеются данные об установленных модулях
if (null !== $this->install_modules)
{
@ -752,7 +878,7 @@
// получаем php код функции, в противном случае формируем сообщение с ошибкой
$replace[] = function_exists($row->ModuleFunction)
? $row->ModulePHPTag
: ($this->_module_error . ' &quot;' . $row->ModuleName . '&quot;');
: ($this->_module_error . ' &quot;' . $row->ModuleSysName . '&quot;');
}
// Сохряняем информацию о модуле
$this->install_modules[$row->ModuleSysName] = $row;
@ -760,7 +886,7 @@
elseif ($row->ModuleAveTag) // Если файла module.php не существует, формируем сообщение с ошибкой
{
$pattern[] = $row->ModuleAveTag;
$replace[] = $this->_module_error . ' &quot;' . $row->ModuleName . '&quot;';
$replace[] = $this->_module_error . ' &quot;' . $row->ModuleSysName . '&quot;';
}
}
else
@ -768,6 +894,7 @@
$this->install_modules[$row->ModuleSysName] = $row;
}
}
// Выполняем замену систеного тега на php код и возвращаем результат
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
{
// Проверяем теги полей в шаблоне рубрики на условие != ''
$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]+)]/', '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 = $this->_main_content($main_content, $id, $rubTmpl);
}
}
}
// парсим теги в шаблоне рубрики
$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);
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);
}
//-- Экранируем поступающий URL
$get_url = $AVE_DB->ClearUrl($get_url);
//-- Проверяем есть ли данный URL в таблице алиасов модулей
$sql = "
SELECT
@ -1554,15 +1592,10 @@
Id = '" . (int)$_REQUEST['id'] . "'
")->GetCell();
}
// Выполняем запрос к БД на получение всей необходимой
// информации о документе
// Экранируем поступающий URL
$get_url = $AVE_DB->EscStr($get_url);
if (mb_strlen($get_url) > 255)
$get_url = '';
// Забираем нужные данные
$sql = $AVE_DB->Query("
SELECT

269
class/class.database.php

@ -1,6 +1,6 @@
<?php
/**
/**
* AVE.cms
*
* Класс предназначен для создания обертки над MySql запросами к БД.
@ -13,11 +13,11 @@
* @license GPL v.2
*/
/***************************************************************************
/***************************************************************************
* Класс, предназначенный для работы с ошибками
***************************************************************************/
class AVE_DB_Exception extends Exception
{
class AVE_DB_Exception extends Exception
{
/**
* @param string $e
*/
@ -25,20 +25,13 @@ class AVE_DB_Exception extends Exception
{
parent::__construct($e);
}
}
}
/***************************************************************************
/***************************************************************************
* Класс, предназначенный для работы с результатами выполнения MySQL-запроса
***************************************************************************/
class AVE_DB_Result
{
/******************
*
* Свойства класса
*
******************/
class AVE_DB_Result
{
/**
* Конечный результат выполнения запроса
*
@ -46,11 +39,6 @@ class AVE_DB_Result
*/
public $_result = null;
/************************
*
* Внешние методы класса
*
************************/
/**
* Конструктор, возвращает объект с указателем на результат выполнения SQL-запроса
@ -160,6 +148,58 @@ class AVE_DB_Result
return false;
}
/**
* Метод, предназначенный для обработки результата запроса.
* Возвращает полный ассоциативный массив.
*
* @return array
*/
public function GetArray()
{
if (is_array($this->_result))
{
$data = current($this->_result);
next($this->_result);
return $data;
}
$array = array();
while ($row = mysqli_fetch_assoc($this->_result))
array_push($array, $row);
return $array;
}
/**
* Метод, предназначенный для обработки результата запроса.
* Возвращает данные в виде объекта.
*
* @return array
*/
public function GetObject()
{
if (is_array($this->_result))
{
$data = $this->FetchAssocArray();
return array2object($data);
}
$array = array();
while ($row = mysqli_fetch_object($this->_result))
array_push($array, $row);
return $array;
}
/**
* Метод, предназначенный для перемещения внутреннего указателя в результате запроса
*
@ -168,19 +208,21 @@ class AVE_DB_Result
*/
public function DataSeek($id = 0)
{
if(is_array($this->_result))
if (is_array($this->_result))
{
//не нашел как переместить указатель в массиве на конкретный
reset($this->_result);
for($x = 0; $x == $id; $x++)
next($this->_result);
for ($x = 0; $x == $id; $x++)
next ($this->_result);
return $id; //эээ а что вернуть то надо было?
}
return mysqli_data_seek($this->_result, $id);
}
/**
* Метод, предназначенный для получения количества рядов результата запроса
*
@ -189,13 +231,12 @@ class AVE_DB_Result
public function NumRows()
{
if (is_array($this->_result))
{
return (int)count($this->_result);
}
return (int)mysqli_num_rows($this->_result);
}
/**
* Метод, предназначенный для получения количества полей результата запроса
*
@ -213,6 +254,7 @@ class AVE_DB_Result
return (int)mysqli_num_fields($this->_result);
}
/**
* Метод, предназначенный для получения названия указанной колонки результата запроса
*
@ -221,14 +263,15 @@ class AVE_DB_Result
*/
public function FieldName($i)
{
if(is_array($this->_result)){
if (is_array($this->_result))
{
$a = current($this->_result);
$b = array_keys($a);
return($b[$i]);
}
mysqli_field_seek($this->_result, $i);
$field = mysqli_fetch_field($this->_result);
@ -236,6 +279,7 @@ class AVE_DB_Result
return $field->name;
}
/**
* Метод, предназначенный для освобождения памяти от результата запроса
*
@ -249,6 +293,7 @@ class AVE_DB_Result
return true;
}
/**
* Возвращает объект результата _result.
*
@ -260,6 +305,7 @@ class AVE_DB_Result
return $this->_result;
}
/**
* Удаляем объект
*/
@ -267,21 +313,16 @@ class AVE_DB_Result
{
$this->Close();
}
}
}
/**************************************************************
/**************************************************************
*
* Класс, предназначенный для работы непосредственно с MySQL БД
*
**************************************************************/
class AVE_DB
{
/**
* Свойства класса
*/
class AVE_DB
{
/**
* Хост
*
@ -398,6 +439,7 @@ class AVE_DB
}
}
/**
* Устанавливает соеденение с базой данных.
*
@ -551,6 +593,74 @@ class AVE_DB
}
public function prepareQuery($string)
{
$search = array(
"/[\t]/",
'/(\s)+/s',
'/(GROUP BY |STRAIGHT_JOIN |UNION |FROM |WHERE |LIMIT |ORDER BY |LEFT JOIN|INNER JOIN|RIGHT JOIN|JOIN|ON |AND |OR |SET)/s'
);
$replace = array(
" ",
'\\1',
"\r\n$1"
);
return trim(preg_replace($search, $replace, $string));
}
public function showAllQueries ()
{
if (! is_array($this->_query_list))
return false;
foreach ($this->_query_list AS $k => $v)
{
$_caller = '';
if (is_array($v['caller']))
{
foreach ($v['caller'] AS $caller)
{
$_caller .= 'File: ' . $caller['call_file'] . PHP_EOL;
$_caller .= 'Func: ' . $caller['call_func'] . PHP_EOL;
$_caller .= 'Line: ' . $caller['call_line'] . PHP_EOL;
$_caller .= PHP_EOL;
}
}
$_ttl = $v['ttl'] > 0 ? $v['ttl'] : 'None';
if ($v['cache'])
$_ttl .= PHP_EOL . $v['cache'];
$_query = $this->prepareQuery($v['query']);
$div = '
<div style="border: 1px solid #aaa; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;">' .
'<div style="background:#aaa; color: #fff; margin: 0; padding: 5px;">' .
'<strong>' . $k . '</strong>' .
'</div>' .
'<pre style="background:#f5f5f5; color: #000; margin: 0; padding: 5px; border: 0; font-size: 11px; font-family: Consolas, Verdana, Arial;">' .
'<strong>Trace:</strong>' . PHP_EOL .
$_caller .
'<strong>Cache:</strong>' . PHP_EOL .
$_ttl . PHP_EOL .
PHP_EOL .
'<strong>Query:</strong>' . PHP_EOL .
'<div style="background: #fcfcfc; padding: 10px; margin: 10px; border: 1px solid #ccc; border-radius: 3px;">' .
$_query .
'</div>' .
'</pre>' .
'</div>
';
echo($div);
}
}
/**
* Возвращает id, сгенерированный предыдущей операцией INSERT.
*
@ -582,7 +692,8 @@ class AVE_DB
*/
public function getCaller()
{
if (! function_exists('debug_backtrace')) return '';
if (! function_exists('debug_backtrace'))
return '';
$stack = debug_backtrace();
$stack = array_reverse($stack);
@ -622,7 +733,7 @@ class AVE_DB
* @param bool $log - записать ошибки в лог? по умолчанию включено
* @return object/bool - объект с указателем на результат выполнения запроса
*/
public function Real_Query($query, $log = true)
public function Real_Query($query, $log = true, $TTL = null)
{
$result = @mysqli_query($this->mysqli, $query);
@ -630,9 +741,10 @@ class AVE_DB
$this->_last_query = $query;
// Если стоит в настройках, запоминать все запросы
if (SQL_PROFILING)
if (defined('SQL_PROFILING') && SQL_PROFILING)
{
$this->_query_list[] = $query;
$_caller = $this->getCaller();
$this->_query_list[] = array('caller' => $_caller, 'query' => $query, 'ttl' => $TTL);
}
// Если нет результата и стоит выводить логи, выводим лог ошибки
@ -667,7 +779,8 @@ class AVE_DB
}
// Принудительная фильтрация запроса
//$query = filter_var($query, FILTER_SANITIZE_STRING);
if (defined(SQL_QUERY_SANITIZE) && SQL_QUERY_SANITIZE)
$query = filter_var($query, FILTER_SANITIZE_STRING);
$result = array();
@ -680,6 +793,7 @@ class AVE_DB
if (defined('DEV_MODE') AND DEV_MODE)
$TTL = null;
if ($TTL && ($TTL != 'nocache' AND $TTL != null))
{
$cache_file = md5($query);
@ -691,6 +805,13 @@ class AVE_DB
if (! file_exists($cache_dir))
mkdir($cache_dir, 0777, true);
// Если стоит в настройках, запоминать все запросы
if (defined('SQL_PROFILING') && SQL_PROFILING)
{
$_caller = $this->getCaller();
$this->_query_list[] = array('caller' => $_caller, 'query' => $query, 'ttl' => $TTL, 'cache' => $cache_dir . $cache_file);
}
if (! (file_exists($cache_dir . $cache_file) && ($TTL == -1 ? true : time() - filemtime($cache_dir . $cache_file) < $TTL)))
{
$res = $this->Real_Query($query, $log);
@ -709,7 +830,7 @@ class AVE_DB
}
else
return $this->Real_Query($query, $log);
return $this->Real_Query($query, $log, $TTL);
}
@ -774,13 +895,12 @@ class AVE_DB
*/
public function EscStr($value)
{
$value = htmlspecialchars($value);
$search = array(
'&' => '&#38;',
'&amp;gt;' => '&gt;',
'<' => '&lt;',
';' => '&#58;',
'|' => '&#124;',
'&' => '&#38;',
'>' => '&gt;',
"'" => '&apos;',
'"' => '&#x22;',
@ -788,28 +908,70 @@ class AVE_DB
'(' => '&#x28;',
'{' => '&#123;',
'}' => '&#125;',
'$' => '&#36;',
'&amp;gt;' => '&gt;'
'$' => '&#36;'
);
$value = str_replace(array_keys($search), array_values($search), $value);
$value = str_ireplace('%3Cscript', '', $value);
$value = filter_var($value, FILTER_SANITIZE_STRING);
$value = htmlspecialchars($value, ENT_QUOTES);
if (! is_array($value))
{
$value = $this->mysqli->real_escape_string($value);
$value = mysqli_real_escape_string($this->mysqli, $value);
}
else
{
$value = array_map(array($this, 'escape'), $value);
$value = array_map(array($AVE_DB, 'Escape'), $value);
}
return $value;
}
/**
* Метод, предназначенный для экранирования и очищения значения при поиске url в базе
*
* @param string $value - обрабатываемое значение
* @return string - возвращает строку запроса вычещенной
*/
function ClearUrl($url)
{
// Убираем пробелы
$url = trim($url);
// Условия
$search = array('<', ';', '|', '&', '>', "'", '"', ')', '(', '{', '}', '$', '=');
// Убираем пробелы
$url = preg_replace('/[\s,]+/i', '', $url);
// Проходимся условиями
$url = str_replace($search, '', $url);
$url = str_ireplace('%3Cscript', '', $url);
// Применяем встроенный SANITIZE
$url = filter_var($url, FILTER_SANITIZE_STRING);
// Переводим html в сущности, если чтото осталось
$url = htmlspecialchars($url);
// Если это не массив
if (! is_array($url))
{
// Проходимся функцией от MySQL
$url = $this->mysqli->real_escape_string($url);
}
// Иначе вообще очищаем строку
else
{
$url = array_map(array($AVE_DB, 'Escape'), $url);
}
return $url;
}
/**
* Метод, предназначенный для возвращения количества всех найденных записей (после запроса)
*
@ -858,7 +1020,8 @@ class AVE_DB
}
else
{
$res = (int)$this->Query("SELECT FOUND_ROWS()")->GetCell();
$res = (int)$this->Query("SELECT FOUND_ROWS();")->GetCell();
file_put_contents($cache_dir . $cache_file, $res);
}
@ -870,7 +1033,7 @@ class AVE_DB
}
}
return (int)$this->Query("SELECT FOUND_ROWS()")->GetCell();
return (int)$this->Query("SELECT FOUND_ROWS();")->GetCell();
}
@ -1200,5 +1363,5 @@ class AVE_DB
return (rrmdir($cache_from_id) AND rrmdir($cache_from_alias));
}
} // End AVE_DB class
} // End AVE_DB class
?>

18
class/class.dbdump.php

@ -1,6 +1,6 @@
<?php
/**
/**
* AVE.cms
*
* Класс, предназначенный для создания и восстановления дампов БД через Панель управления
@ -12,13 +12,8 @@
*
*/
class AVE_DB_Service
{
/**
* Свойства класса
*/
class AVE_DB_Service
{
/**
* Метка-разделитель SQL-запросов
*
@ -33,9 +28,6 @@ class AVE_DB_Service
*/
public $_database_dump = '';
/**
* Внутренние методы
*/
/**
* Метод, предназначенный для формирования файла дампа базы данных
@ -218,7 +210,7 @@ class AVE_DB_Service
}
/**
/**
* Внешние методы класса
*/
@ -644,5 +636,5 @@ class AVE_DB_Service
return msort($files, 'data', null, SORT_DESC);
}
}
}
?>

127
class/class.debug.php

@ -30,12 +30,13 @@
//
}
/**
* Функция для вывода переменной (для отладки)
*
* @param mixed $var любая переменная
*/
public static function _echo($var, $exit = false)
public static function _echo($var, $exit = false, $bg = null)
{
$backtrace = debug_backtrace();
@ -52,14 +53,14 @@
$line = 0;
while (++$line <= $backtrace['line'])
{
$code = fgets($fh);
}
fclose($fh);
preg_match('/' . __FUNCTION__ . '\s*\((.*)\)\s*;/u', $code, $name);
unset ($code, $backtrace);
ob_start();
var_dump($var);
@ -70,17 +71,31 @@
$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();
$fn_name = ! empty($name)
? $name[1]
: 'EVAL';
if (! empty($name))
{
$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 = '
<div style="border: 1px solid #2a5885; 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="border: 1px solid #'.$br.'; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;">
<div style="background:#'.$bg.'; color: #fff; margin: 0; padding: 5px;">
var_dump(<strong>' . trim($fn_name) . '</strong>) - ' . self::_trace() .
'</div>
<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;
if ($exit) exit;
if ($exit)
exit;
}
@ -100,7 +116,7 @@
*
* @param mixed $var любая переменная
*/
public static function _print($var, $exit = false)
public static function _print($var, $exit = false, $bg = null)
{
$backtrace = debug_backtrace();
@ -135,13 +151,27 @@
ob_end_clean();
$fn_name = !empty($name)
? $name[1]
: 'EVAL';
if (! empty($name))
{
$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 = '
<div style="border: 1px solid #365899; 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="border: 1px solid #'.$br.'; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;">
<div style="background:#'.$bg.'; color: #fff; margin: 0; padding: 5px;">
print_r(<strong>' . trim($fn_name) . '</strong>) - ' . self::_trace() .
'</div>
<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;
if ($exit) exit;
if ($exit)
exit;
}
@ -161,7 +192,7 @@
*
* @param mixed $var любая переменная
*/
public static function _exp($var, $exit = false)
public static function _exp($var, $exit = false, $bg = null)
{
$backtrace = debug_backtrace();
@ -190,9 +221,23 @@
var_export($var);
$fn_name = !empty($name)
? $name[1]
: 'EVAL';
if (! empty($name))
{
$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());
@ -201,8 +246,8 @@
ob_end_clean();
$var_dump = '
<div style="border: 1px solid #bbb; 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="border: 1px solid #'.$br.'; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;">
<div style="background:#'.$bg.'; color: #000; margin: 0; padding: 5px;">var_export(<strong>'
. trim($fn_name) . '</strong>) - ' . self::_trace() .
'</div>
<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;
if ($exit) exit;
if ($exit)
exit;
}
@ -277,14 +323,13 @@
}
/**
* Функция для записи переменной в файл (для отладки)
*
* @param mixed $var любая переменная
* @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();
@ -323,13 +368,27 @@
ob_end_clean();
$fn_name = ! empty($name)
? $name[1]
: 'EVAL';
if (! empty($name))
{
$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 = '
<div style="border: 1px solid #2a5885; 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="border: 1px solid #'.$br.'; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;">
<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() .
'</div>
<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);
}
/**
* Функция отвечает за начало таймера
*
@ -396,6 +456,7 @@
Debug::$time[$name] = microtime(true);
}
/**
* Функция отвечает за окончание таймера
*
@ -408,6 +469,7 @@
return sprintf("%01.4f", microtime(true) - Debug::$time[$name]) . ' sec';
}
/**
* Функция отвечает за начало подсчета используеой памяти
*
@ -418,6 +480,7 @@
Debug::$memory[$name] = memory_get_usage();
}
/**
* Функция отвечает за окончание подсчета используемой памяти
*
@ -430,6 +493,7 @@
return Debug::formatSize(memory_get_usage() - Debug::$memory[$name]);
}
/**
* Форматированный вывод размера
*
@ -458,6 +522,7 @@
return $size;
}
/**
* Форматированный вывод чисел
*

13
class/class.docs.php

@ -163,19 +163,20 @@ class AVE_Document
$func = 'get_field_'.$field_type;
if (! is_callable($func))
$func='get_field_default';
$func = 'get_field_default';
$field = $func($field_value, 'edit', $field_id, '', 0, $x, 0, 0, $default);
return $field;
}
function _documentFieldSave($field_type, $field_value, $field_id, $default = '')
{
$func = 'get_field_'.$field_type;
if (! is_callable($func))
$func='get_field_default';
$func = 'get_field_default';
$field = $func($field_value, 'save', $field_id, '', 0, $x, 0, 0, $default);
@ -340,7 +341,9 @@ class AVE_Document
AND
(df1.rubric_field_id = '" . (int)$_REQUEST['field_id'] . "'
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')
@ -349,7 +352,9 @@ class AVE_Document
AND
(df1.rubric_field_id = '" . (int)$_REQUEST['field_id'] . "'
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']) . "%')
";
}

22
class/class.modules.php

@ -14,11 +14,13 @@
{
public $_modules = array();
function __construct()
{
$this->_modules = $this->getModules();
}
/**
* Метод, который обрабатывает все module.php и записывает как свойство класса списки модулей
*/
@ -61,7 +63,7 @@
$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 - Фиксируем ошибку
$modules['errors'][] = $entry;
@ -113,6 +115,7 @@
return $modules;
}
/**
* Метод, преданзначеный для выода модулей
*
@ -196,6 +199,18 @@
$modules = array();
if (! empty($this->_modules))
{
foreach ($this->_modules AS $k => $v)
{
if ($status && $v['status'] != $status)
continue;
$modules[$k] = $v;
}
}
else
{
// Условие, определяющее статус документа для запроса к БД
$where_status = ($status !== null)
? "WHERE ModuleStatus = '" . (int)$status . "'"
@ -215,6 +230,7 @@
while ($row = $sql->FetchRow())
$modules[$row->ModuleSysName] = $row;
}
// Возвращаем список модулей
return $modules;
@ -248,6 +264,7 @@
exit;
}
/**
* Метод, предназанченный для установки или переустановки модуля
*
@ -328,6 +345,7 @@
exit;
}
/**
* Метод, предназначенный для обновления модуля при увеличении номера версии модуля
*
@ -385,6 +403,7 @@
exit;
}
/**
* Метод, предназанченный для удаление модуля
*
@ -425,6 +444,7 @@
exit;
}
/**
* Метод, предназначенный для отключения/включение модуля в Панели управления
*

15
class/class.request.php

@ -1,6 +1,6 @@
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -10,10 +10,10 @@
*
*/
class AVE_Request
{
class AVE_Request
{
/**
/**
* Свойстав класса
*/
@ -24,7 +24,7 @@ class AVE_Request
*/
public $_limit = 25;
/**
/**
* Внутренние методы
*/
@ -132,7 +132,7 @@ class AVE_Request
")->GetCell();
}
/**
/**
* Внешние методы класса
*/
@ -864,6 +864,5 @@ class AVE_Request
$AVE_Template->assign('cond_id', $cond_id);
$AVE_Template->assign('content', $AVE_Template->fetch('request/change.tpl'));
}
}
}
?>

84
class/class.rubs.php

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

3
class/class.thumbnail.php

@ -180,7 +180,8 @@ class Image_Toolbox {
}
$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']) {
$this->_types[1]['supported'] = 1;
if ($gd_info['GIF Create Support']) {

27
fields/checkbox/field.php

@ -1,6 +1,6 @@
<?
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,10 +11,9 @@
* @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)
{
// Чекбокс (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;
$fld_dir = dirname(__FILE__) . '/';
@ -37,7 +36,7 @@ function get_field_checkbox($field_value, $action, $field_id = 0, $tpl = '', $tp
$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');
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
return $AVE_Template->fetch($tpl_file);
break;
@ -47,14 +46,16 @@ function get_field_checkbox($field_value, $action, $field_id = 0, $tpl = '', $tp
$res = ((int)$field_value === 1)
? (int)$field_value
: 0;
: null;
$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)
{
$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);
}
@ -66,14 +67,16 @@ function get_field_checkbox($field_value, $action, $field_id = 0, $tpl = '', $tp
$res = ((int)$field_value === 1)
? (int)$field_value
: 0;
: null;
$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)
{
$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);
}
@ -84,7 +87,7 @@ function get_field_checkbox($field_value, $action, $field_id = 0, $tpl = '', $tp
$field_value = clean_php($field_value);
$res = ((int)$field_value === 1)
? $field_value
: '0';
: null;
break;
case 'name':
@ -93,5 +96,5 @@ function get_field_checkbox($field_value, $action, $field_id = 0, $tpl = '', $tp
}
return ($res ? $res : $field_value);
}
}
?>

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

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

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

@ -1 +1,6 @@
{*
$field_id
$field_default
$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} />

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

74
fields/code/field.php

@ -1,6 +1,6 @@
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @license GPL v.2
*/
// Код (Codemirror)
function get_field_code ($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength='', $document_fields=array(), $rubric_id=0, $default='')
{
// Код (Codemirror)
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__) . '/';
@ -32,16 +32,74 @@ function get_field_code ($field_value, $action, $field_id=0, $tpl='', $tpl_empty
$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.'_'.$_REQUEST['Id']);
$AVE_Template->assign('f_id', $field_id.'_'.(int)$_REQUEST['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);
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':
return get_field_default($field_value, $action, $field_id, $tpl, $tpl_empty);
$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);
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 'name':
@ -50,5 +108,5 @@ function get_field_code ($field_value, $action, $field_id=0, $tpl='', $tpl_empty
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}

31
fields/date/field.php

@ -1,6 +1,6 @@
<?
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @license GPL v.2
*/
// Дата (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){
// Дата (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, $_tpl=null)
{
global $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
@ -36,13 +36,14 @@ function get_field_date($field_value, $action, $field_id=0, $tpl='', $tpl_empty=
$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');
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
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));
@ -61,10 +62,14 @@ function get_field_date($field_value, $action, $field_id=0, $tpl='', $tpl_empty=
return $res = $value;
}
$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_value', $field_value);
$AVE_Template->assign('field_default', $default);
return $AVE_Template->fetch($tpl_file);
}
@ -72,8 +77,8 @@ function get_field_date($field_value, $action, $field_id=0, $tpl='', $tpl_empty=
break;
case 'req':
$field_value = clean_php($field_value);
if ($tpl_empty)
{
$value = pretty_date(strftime(TIME_FORMAT, $field_value));
@ -92,10 +97,14 @@ function get_field_date($field_value, $action, $field_id=0, $tpl='', $tpl_empty=
return $res = $value;
}
$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_value', $field_value);
$AVE_Template->assign('field_default', $default);
return $AVE_Template->fetch($tpl_file);
}
@ -113,5 +122,5 @@ function get_field_date($field_value, $action, $field_id=0, $tpl='', $tpl_empty=
}
return ($res ? $res : $field_value);
}
}
?>

34
fields/doc_from_rub/field.php

@ -1,6 +1,6 @@
<?
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @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;
$fld_dir = dirname(__FILE__) . '/';
@ -52,7 +52,7 @@ function get_field_doc_from_rub($field_value, $action, $field_id=0, $tpl='', $tp
$cats = array();
while($cat = $sql->FetchAssocArray())
while ($cat = $sql->FetchAssocArray())
{
$cats_ID[$cat['Id']][] = $cat;
$cats[$cat['document_parent']][$cat['Id']] = $cat;
@ -69,7 +69,7 @@ function get_field_doc_from_rub($field_value, $action, $field_id=0, $tpl='', $tp
$AVE_Template->assign('error', $AVE_Template->get_config_vars('error'));
}
$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);
break;
@ -97,11 +97,14 @@ function get_field_doc_from_rub($field_value, $action, $field_id=0, $tpl='', $tp
);
}
$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)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$AVE_Template->assign('document', $document);
return $AVE_Template->fetch($tpl_file);
}
@ -131,11 +134,14 @@ function get_field_doc_from_rub($field_value, $action, $field_id=0, $tpl='', $tp
);
}
$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)
{
$AVE_Template->assign('field_id', $field_id);
$AVE_Template->assign('field_value', $field_value);
$AVE_Template->assign('document', $document);
return $AVE_Template->fetch($tpl_file);
}
@ -147,10 +153,13 @@ function get_field_doc_from_rub($field_value, $action, $field_id=0, $tpl='', $tp
break;
}
return ($res ? $res : $field_value);
}
}
function doc_from_rub_tree($cats, $parent)
{
if (! function_exists('doc_from_rub_tree'))
{
function doc_from_rub_tree($cats, $parent)
{
if (is_array($cats) and isset($cats[$parent]))
{
foreach($cats[$parent] as $cat)
@ -166,5 +175,6 @@ function doc_from_rub_tree($cats, $parent)
}
return $array;
}
}
}
?>

25
fields/doc_from_rub_check/field.php

@ -1,6 +1,6 @@
<?
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @license GPL v.2
*/
// Документ из рубрики (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){
// Документ из рубрики (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, $_tpl=null)
{
global $AVE_DB, $AVE_Template;
$fld_dir = dirname(__FILE__) . '/';
@ -74,7 +74,7 @@ function get_field_doc_from_rub_check($field_value, $action, $field_id=0, $tpl='
$AVE_Template->assign('error', $AVE_Template->get_config_vars('error'));
}
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
$AVE_Template->assign('subtpl', $tpl_dir."list.tpl");
@ -110,7 +110,7 @@ function get_field_doc_from_rub_check($field_value, $action, $field_id=0, $tpl='
}
}
$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)
{
@ -155,7 +155,7 @@ function get_field_doc_from_rub_check($field_value, $action, $field_id=0, $tpl='
}
}
$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)
{
@ -177,10 +177,12 @@ function get_field_doc_from_rub_check($field_value, $action, $field_id=0, $tpl='
}
return ($res ? $res : $field_value);
}
}
function doc_from_rub_check_tree($cats, $parent)
{
if (! function_exists('doc_from_rub_check_tree'))
{
function doc_from_rub_check_tree($cats, $parent)
{
if (is_array($cats) and isset($cats[$parent]))
{
foreach ($cats[$parent] as $cat)
@ -197,5 +199,6 @@ function doc_from_rub_check_tree($cats, $parent)
}
return $array;
}
}
}
?>

16
fields/doc_from_rub_search/field.php

@ -1,6 +1,6 @@
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @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__) . '/';
@ -56,7 +56,7 @@ function get_field_doc_from_rub_search($field_value, $action, $field_id=0, $tpl=
$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('items', $items);
@ -113,7 +113,7 @@ function get_field_doc_from_rub_search($field_value, $action, $field_id=0, $tpl=
}
}
$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)
{
@ -157,7 +157,7 @@ function get_field_doc_from_rub_search($field_value, $action, $field_id=0, $tpl=
}
}
$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)
{
@ -220,5 +220,5 @@ function get_field_doc_from_rub_search($field_value, $action, $field_id=0, $tpl=
}
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>

20
fields/drop_down/field.php

@ -1,6 +1,6 @@
<?
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @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__) . '/';
@ -34,7 +34,7 @@ function get_field_drop_down($field_value, $action, $field_id=0, $tpl='', $tpl_e
$items = explode(',', $default);
$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('field_id', $field_id);
@ -45,7 +45,8 @@ function get_field_drop_down($field_value, $action, $field_id=0, $tpl='', $tpl_e
case 'doc':
@$field_value = clean_php($field_value);
if (!$tpl_empty)
if (! $tpl_empty)
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
@ -57,12 +58,14 @@ function get_field_drop_down($field_value, $action, $field_id=0, $tpl='', $tpl_e
$tpl
);
}
$res = $field_value;
break;
case 'req':
@$field_value = clean_php($field_value);
if (!$tpl_empty)
if (! $tpl_empty)
{
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
@ -74,6 +77,7 @@ function get_field_drop_down($field_value, $action, $field_id=0, $tpl='', $tpl_e
$tpl
);
}
$res = $field_value;
break;
@ -83,5 +87,5 @@ function get_field_drop_down($field_value, $action, $field_id=0, $tpl='', $tpl_e
}
return ($res ? $res : $field_value);
}
}
?>

12
fields/drop_down_key/field.php

@ -1,6 +1,6 @@
<?
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @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;
$fld_dir = dirname(__FILE__) . '/';
@ -33,7 +33,7 @@ function get_field_drop_down_key($field_value, $action, $field_id=0, $tpl='', $t
$items = explode(',', $default);
$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('field_id', $field_id);
@ -74,5 +74,5 @@ function get_field_drop_down_key($field_value, $action, $field_id=0, $tpl='', $t
}
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>

23
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;
@ -91,9 +91,9 @@
$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')
{
@ -122,7 +122,7 @@
? $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('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)
{
@ -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)
{
@ -301,13 +301,9 @@
}
if (isset($field_value_new))
{
return serialize($field_value_new);
}
else
{
return $field_value_new = '';
}
break;
@ -365,6 +361,9 @@
if (! is_dir($dir_abs))
mkdir($dir_abs, 0777, true);
$new_files = array();
$thumbs = array();
foreach ($_FILES[$files_unput]['name'] as $name => $value)
{
$filename = strtolower(stripslashes(prepare_url($_FILES[$files_unput]['name'][$name])));
@ -383,6 +382,8 @@
{
$new_files[] = $filename;
$thumbs[] = make_thumbnail(array('link' => $dir . $filename, 'size' => 'f128x128'));
if ((bool)$watermark)
{
$position = ($position != '') ? $position : 'center';
@ -409,6 +410,7 @@
{
echo json_encode(array(
'files' => $new_files,
'thumbs' => $thumbs,
'dir' => $dir,
'respons' => 'succes',
'message' => $AVE_Template->get_config_vars('resp_s_m'),
@ -433,3 +435,4 @@
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);
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(
'<div class="mega_item ui-state-default" id="mega_image_' + c_id + '_' + d_id + '_' + iid + '" data-id="' + iid + '" data-doc="' + d_id + '">' +

17
fields/image_multi/field.php

@ -1,6 +1,6 @@
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @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;
@ -106,7 +106,7 @@ function get_field_image_multi($field_value, $action, $field_id=0, $tpl='', $tpl
? $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('dir_upload', $AVE_Template->get_config_vars('upl_dir') . $dir_upload);
@ -168,7 +168,7 @@ function get_field_image_multi($field_value, $action, $field_id=0, $tpl='', $tpl
}
}
$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)
{
@ -233,7 +233,7 @@ function get_field_image_multi($field_value, $action, $field_id=0, $tpl='', $tpl
}
}
$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)
{
@ -392,4 +392,5 @@ function get_field_image_multi($field_value, $action, $field_id=0, $tpl='', $tpl
}
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();
}
}
});
}
});

16
fields/image_single/field.php

@ -1,6 +1,6 @@
<?
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @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){
// Изображение
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__) . '/';
@ -38,7 +38,7 @@ function get_field_image_single($field_value, $action, $field_id=0, $tpl='', $tp
$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');
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
$AVE_Template->assign('field_dir', $fld_name);
$AVE_Template->assign('image', $image);
@ -83,7 +83,7 @@ function get_field_image_single($field_value, $action, $field_id=0, $tpl='', $tp
$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_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
if($tpl_empty && $tpl_file)
{
@ -129,7 +129,7 @@ function get_field_image_single($field_value, $action, $field_id=0, $tpl='', $tp
$maxlength = null;
$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)
{
@ -157,5 +157,5 @@ function get_field_image_single($field_value, $action, $field_id=0, $tpl='', $tp
}
return ($res ? $res : $field_value);
}
}
?>

14
fields/link/field.php

@ -1,6 +1,6 @@
<?
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @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__) . '/';
@ -33,7 +33,7 @@ function get_field_link($field_value, $action, $field_id=0, $tpl='', $tpl_empty=
$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_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
return $AVE_Template->fetch($tpl_file);
break;
@ -96,5 +96,5 @@ function get_field_link($field_value, $action, $field_id=0, $tpl='', $tpl_empty=
}
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,
@ -23,22 +23,22 @@ var MultiList = {
lists_maxid: function(id) {
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);
});
return maxid;
},
lists_del_item: function() {
$('.multi_list .DelButton').on('click', function(event) {
$('.multi_link .DelButton').on('click', function(event) {
event.preventDefault();
var id = $(this).attr('data-id');
jConfirm(
list_del_conf,
list_del_head,
links_del_conf,
links_del_head,
function(b) {
if (b) {
$('#list_' + id).remove();
$('#link_' + id).remove();
}
}
);
@ -46,30 +46,29 @@ var MultiList = {
},
lists_add: function() {
$('.AddButton').on('click', function(event) {
$('.multi_links .AddButton').on('click', function(event) {
event.preventDefault();
c_id = $(this).parent().parent('.multi_lists').attr("data-id");
iid = MultiList.lists_maxid(c_id);
$('#multi_lists_' + c_id + ':last').append(
'<div class="multi_list 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: 300px;" />&nbsp;&nbsp;<a href="javascript:void(0);" data-id="' + c_id + '_' + iid + '" class="button redBtn topDir DelButton" title="' + list_del + '">&times;</a>' +
c_id = $(this).parent().parent('.multi_links').attr("data-id");
iid = MultiLinks.lists_maxid(c_id);
$('#multi_links_' + c_id + ':last').append(
'<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="' + 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>'
);
MultiList.lists_update();
MultiLinks.lists_update();
});
},
lists_sortable: function() {
$('.multi_lists').sortable({
$('.multi_links').sortable({
handle: ".handle",
placeholder: "ui-state-highlight grey_bg"
});
//$(".multi_lists").disableSelection();
}
}
$(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);
}
?>

44
fields/multi_line/field.php

@ -1,6 +1,6 @@
<?
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,20 +11,22 @@
* @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;
$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->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$res=0;
$res = null;
switch ($action)
{
@ -36,41 +38,26 @@ function get_field_multi_line($field_value, $action, $field_id=0, $tpl='', $tpl_
}
else
{
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === (bool)true)) {
switch ($_SESSION['use_editor']) {
case '0':
case '1':
case '2':
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);
break;
default:
$field = $field_value;
break;
}
} else {
switch ($_SESSION['use_editor']) {
case '0': // CKEditor
case '1':
else
{
$oCKeditor = new CKeditor();
$oCKeditor->returnOutput = true;
$oCKeditor->config['toolbar'] = 'Big';
$oCKeditor->config['height'] = 400;
$config = array();
$field = $oCKeditor->editor('feld[' . $field_id . ']', $field_value, $config);
break;
default:
$field = $field_value;
break;
}
}
}
$res = $field;
break;
@ -84,6 +71,7 @@ function get_field_multi_line($field_value, $action, $field_id=0, $tpl='', $tpl_
return $AVE_Template->get_config_vars('name');
break;
}
return ($res ? $res : $field_value);
}
}
?>

41
fields/multi_line_simple/field.php

@ -1,6 +1,6 @@
<?
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @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;
$fld_dir = dirname(__FILE__) . '/';
@ -31,45 +31,28 @@ function get_field_multi_line_simple($field_value, $action, $field_id=0, $tpl=''
case 'edit':
if (isset($_COOKIE['no_wysiwyg']) && $_COOKIE['no_wysiwyg'] == 1)
{
$field = "<a name=\"" . $field_id . "\"></a>";
$field .= "<textarea style=\"98%\" name=\"feld[" . $field_id . "]\">" . $field_value . "</textarea>";
$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'])
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === true))
{
case '0':
case '1':
case '2':
$oCKeditor = new CKeditor();
$oCKeditor->returnOutput = true;
$oCKeditor->config['toolbar'] = 'Verysmall';
$oCKeditor->config['height'] = 200;
$oCKeditor->config['height'] = 250;
$config = array();
$field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
break;
default:
$field = $field_value;
break;
}
} else {
switch ($_SESSION['use_editor']) {
case '0': // CKEditor
case '1':
else
{
$oCKeditor = new CKeditor();
$oCKeditor->returnOutput = true;
$oCKeditor->config['toolbar'] = 'Small';
$oCKeditor->config['height'] = 300;
$config = array();
$field = $oCKeditor->editor('feld[' . $field_id . ']', $field_value, $config);
break;
default:
$field = $field_value;
break;
}
}
}
@ -87,5 +70,5 @@ function get_field_multi_line_simple($field_value, $action, $field_id=0, $tpl=''
break;
}
return ($res ? $res : $field_value);
}
}
?>

44
fields/multi_line_slim/field.php

@ -1,6 +1,6 @@
<?
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @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;
$fld_dir = dirname(__FILE__) . '/';
@ -24,51 +24,35 @@ function get_field_multi_line_slim($field_value,$action, $field_id=0, $tpl='', $
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
$res=0;
$res = 0;
switch ($action)
{
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>";
$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':
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === true))
{
$oCKeditor = new CKeditor();
$oCKeditor->returnOutput = true;
$oCKeditor->config['toolbar'] = 'Verysmall';
$oCKeditor->config['height'] = 200;
$oCKeditor->config['height'] = 250;
$config = array();
$field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
break;
default:
$field = $field_value;
break;
}
} else {
switch ($_SESSION['use_editor']) {
case '0': // CKEditor
case '1':
else
{
$oCKeditor = new CKeditor();
$oCKeditor->returnOutput = true;
$oCKeditor->config['toolbar'] = 'Verysmall';
$oCKeditor->config['height'] = 200;
$config = array();
$field = $oCKeditor->editor('feld[' . $field_id . ']', $field_value, $config);
break;
default:
$field = $field_value;
break;
}
}
}
@ -87,5 +71,5 @@ function get_field_multi_line_slim($field_value,$action, $field_id=0, $tpl='', $
}
return ($res ? $res : $field_value);
}
}
?>

18
fields/multi_list/field.php

@ -1,6 +1,6 @@
<?
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @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;
$fld_dir = dirname(__FILE__) . '/';
@ -66,7 +66,7 @@ function get_field_multi_list($field_value, $action, $field_id=0, $tpl='', $tpl_
$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);
break;
@ -103,7 +103,7 @@ function get_field_multi_list($field_value, $action, $field_id=0, $tpl='', $tpl_
}
}
$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)
{
@ -150,7 +150,7 @@ function get_field_multi_list($field_value, $action, $field_id=0, $tpl='', $tpl_
}
}
$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)
{
@ -190,5 +190,5 @@ function get_field_multi_list($field_value, $action, $field_id=0, $tpl='', $tpl_
}
return ($res ? $res : $field_value);
}
}
?>

18
fields/multi_list_single/field.php

@ -1,6 +1,6 @@
<?
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -10,9 +10,9 @@
*
*/
// Мульти лист
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;
$fld_dir = dirname(__FILE__) . '/';
@ -49,7 +49,7 @@ function get_field_multi_list_single($field_value, $action, $field_id=0, $tpl=''
$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);
break;
@ -86,7 +86,7 @@ function get_field_multi_list_single($field_value, $action, $field_id=0, $tpl=''
}
}
$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)
{
@ -133,7 +133,7 @@ function get_field_multi_list_single($field_value, $action, $field_id=0, $tpl=''
}
}
$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)
{
@ -173,5 +173,5 @@ function get_field_multi_list_single($field_value, $action, $field_id=0, $tpl=''
}
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();
});

19
fields/multi_list_triple/field.php

@ -1,6 +1,5 @@
<?
/**
<?php
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +10,9 @@
* @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){
// Мульти лист
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__) . '/';
@ -72,7 +71,7 @@ function get_field_multi_list_triple($field_value, $action, $field_id=0, $tpl=''
$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);
break;
@ -109,7 +108,7 @@ function get_field_multi_list_triple($field_value, $action, $field_id=0, $tpl=''
}
}
$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)
{
@ -156,7 +155,7 @@ function get_field_multi_list_triple($field_value, $action, $field_id=0, $tpl=''
}
}
$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)
{
@ -196,5 +195,5 @@ function get_field_multi_list_triple($field_value, $action, $field_id=0, $tpl=''
}
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();
});

16
fields/multi_select/field.php

@ -1,6 +1,6 @@
<?
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @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;
$fld_dir = dirname(__FILE__) . '/';
@ -82,7 +82,7 @@ function get_field_multi_select($field_value, $action, $field_id=0, $tpl='', $tp
}
}
$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)
{
@ -133,7 +133,7 @@ function get_field_multi_select($field_value, $action, $field_id=0, $tpl='', $tp
}
}
$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)
{
@ -155,5 +155,5 @@ function get_field_multi_select($field_value, $action, $field_id=0, $tpl='', $tp
}
return ($res ? $res : $field_value);
}
}
?>

36
fields/single_line/field.php

@ -1,6 +1,6 @@
<?
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,16 +11,18 @@
* @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';
$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());
@ -33,7 +35,7 @@ function get_field_single_line ($field_value, $action, $field_id = 0, $tpl = '',
$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_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
return $AVE_Template->fetch($tpl_file);
break;
@ -51,7 +53,7 @@ function get_field_single_line ($field_value, $action, $field_id = 0, $tpl = '',
$field_param = explode('|', $field_value);
$field_value = preg_replace_callback(
'/\[tag:parametr:(\d+)\]/i',
function($data) use($field_param)
function ($data) use ($field_param)
{
return $field_param[(int)$data[1]];
},
@ -59,11 +61,14 @@ function get_field_single_line ($field_value, $action, $field_id = 0, $tpl = '',
);
}
$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_default', $default);
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
}
@ -91,11 +96,14 @@ function get_field_single_line ($field_value, $action, $field_id = 0, $tpl = '',
);
}
$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_default', $default);
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
}
@ -108,8 +116,8 @@ function get_field_single_line ($field_value, $action, $field_id = 0, $tpl = '',
case 'name':
return $AVE_Template->get_config_vars('name');
default: return $field_value;
default:
return $field_value;
}
}
}
?>

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

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

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

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

31
fields/single_line_numeric/field.php

@ -1,6 +1,6 @@
<?
<?php
/**
/**
* AVE.cms
*
* @package AVE.cms
@ -11,9 +11,9 @@
* @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__) . '/';
@ -56,12 +56,17 @@ function get_field_single_line_numeric ($field_value, $action, $field_id = 0, $t
);
}
$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_default', $default);
$AVE_Template->assign('field_value', $field_value);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
@ -83,12 +88,17 @@ function get_field_single_line_numeric ($field_value, $action, $field_id = 0, $t
);
}
$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_value', $field_value);
$AVE_Template->assign('field_default', $default);
return $AVE_Template->fetch($tpl_file);
}
return $field_value;
break;
@ -101,6 +111,5 @@ function get_field_single_line_numeric ($field_value, $action, $field_id = 0, $t
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