mirror of
https://github.com/avecms/AVE.cms.git
synced 2025-01-22 07:20:07 +00:00
Fixes
This commit is contained in:
parent
4e4a58d40a
commit
0296ba4ddb
@ -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)
|
@ -1,192 +1,201 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
|
||||
if (!defined('ACP') || !check_permission('mediapool_int'))
|
||||
{
|
||||
header('Location:index.php');
|
||||
exit;
|
||||
}
|
||||
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'])
|
||||
{
|
||||
case 'list':
|
||||
$dir = (empty($_REQUEST['dir'])
|
||||
|| strpos($_REQUEST['dir'], '..') !== false
|
||||
|| strpos($_REQUEST['dir'], '//') !== false) ? '/' : $_REQUEST['dir'];
|
||||
switch ($_REQUEST['action'])
|
||||
{
|
||||
case 'list':
|
||||
$dir = (empty($_REQUEST['dir'])
|
||||
|| strpos($_REQUEST['dir'], '..') !== false
|
||||
|| strpos($_REQUEST['dir'], '//') !== false) ? '/' : $_REQUEST['dir'];
|
||||
|
||||
$path = $upload_path . (is_dir($upload_path . $dir) ? $dir : '/');
|
||||
$path = $upload_path . (is_dir($upload_path . $dir) ? $dir : '/');
|
||||
|
||||
$new_dir = $path . (isset($_REQUEST['newdir']) ? $_REQUEST['newdir'] : '');
|
||||
$new_dir_rezult = (!is_dir($new_dir) && !mkdir($new_dir, 0777));
|
||||
$new_dir = $path . (isset($_REQUEST['newdir']) ? $_REQUEST['newdir'] : '');
|
||||
$new_dir_rezult = (!is_dir($new_dir) && !mkdir($new_dir, 0777));
|
||||
|
||||
$skip_entry = array(THUMBNAIL_DIR, 'recycled', 'index.php');
|
||||
$skip_entry = array(THUMBNAIL_DIR, 'recycled', 'index.php');
|
||||
|
||||
$dirs = array();
|
||||
$files = array();
|
||||
$dirs = array();
|
||||
$files = array();
|
||||
|
||||
$d = @dir($path);
|
||||
while (false !== ($entry = @$d->read()))
|
||||
{
|
||||
if (in_array($entry, $skip_entry) || $entry{0} === '.') continue;
|
||||
$d = @dir($path);
|
||||
|
||||
if (is_dir($path . $entry))
|
||||
while (false !== ($entry = @$d->read()))
|
||||
{
|
||||
$dirs[$entry] = 'index.php?do=browser&type=' . $_REQUEST['type']
|
||||
. '&action=list&dir=' . $dir . $entry . '/';
|
||||
}
|
||||
else
|
||||
{
|
||||
$nameParts = explode('.', $entry);
|
||||
$ext = strtolower(end($nameParts));
|
||||
if (in_array($entry, $skip_entry) || $entry{0} === '.')
|
||||
continue;
|
||||
|
||||
$file['icon'] = file_exists("templates/images/mediapool/{$ext}.gif") ? $ext : 'attach';
|
||||
$file['filesize'] = @round(@filesize($path . $entry)/1024, 2);
|
||||
$file['moddate'] = date("d.m.y, H:i", @filemtime($path . $entry));
|
||||
|
||||
if (in_array($ext, $images_ext))
|
||||
if (is_dir($path . $entry))
|
||||
{
|
||||
$nameParts[count($nameParts)-2] .= $thumb_size;
|
||||
$file['bild'] = '/' . UPLOAD_DIR . $dir . THUMBNAIL_DIR . '/' . implode('.', $nameParts);
|
||||
$dirs[$entry] = 'index.php?do=browser&type=' . $_REQUEST['type']
|
||||
. '&action=list&dir=' . $dir . $entry . '/';
|
||||
}
|
||||
else
|
||||
{
|
||||
$file['bild'] = 'templates/images/file.gif';
|
||||
$nameParts = explode('.', $entry);
|
||||
$ext = strtolower(end($nameParts));
|
||||
|
||||
$file['icon'] = file_exists("templates/images/mediapool/{$ext}.gif") ? $ext : 'attach';
|
||||
$file['filesize'] = @round(@filesize($path . $entry)/1024, 2);
|
||||
$file['moddate'] = date("d.m.y, H:i", @filemtime($path . $entry));
|
||||
|
||||
if (in_array($ext, $images_ext))
|
||||
{
|
||||
$nameParts[count($nameParts)-2] .= $thumb_size;
|
||||
$file['bild'] = '/' . UPLOAD_DIR . $dir . THUMBNAIL_DIR . '/' . implode('.', $nameParts);
|
||||
}
|
||||
else
|
||||
{
|
||||
$file['bild'] = 'templates/images/file.gif';
|
||||
}
|
||||
|
||||
$files[$entry] = $file;
|
||||
}
|
||||
|
||||
$files[$entry] = $file;
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
|
||||
ksort($dirs);
|
||||
ksort($files);
|
||||
$d->close();
|
||||
|
||||
$AVE_Template->assign('new_dir_rezult', $new_dir_rezult);
|
||||
$AVE_Template->assign('recycled', strpos($dir, '/recycled/') === 0);
|
||||
$AVE_Template->assign('dirs', $dirs);
|
||||
$AVE_Template->assign('files', $files);
|
||||
$AVE_Template->assign('max_size', $max_size);
|
||||
$AVE_Template->assign('dir', $dir);
|
||||
$AVE_Template->assign('dirup', rtrim(dirname($dir), '\\/') . '/');
|
||||
$AVE_Template->assign('mediapath', UPLOAD_DIR);
|
||||
ksort($dirs);
|
||||
ksort($files);
|
||||
|
||||
$AVE_Template->display('browser.tpl');
|
||||
break;
|
||||
$AVE_Template->assign('new_dir_rezult', $new_dir_rezult);
|
||||
$AVE_Template->assign('recycled', strpos($dir, '/recycled/') === 0);
|
||||
$AVE_Template->assign('dirs', $dirs);
|
||||
$AVE_Template->assign('files', $files);
|
||||
$AVE_Template->assign('max_size', $max_size);
|
||||
$AVE_Template->assign('dir', $dir);
|
||||
$AVE_Template->assign('dirup', rtrim(dirname($dir), '\\/') . '/');
|
||||
$AVE_Template->assign('mediapath', UPLOAD_DIR);
|
||||
|
||||
case 'upload':
|
||||
if (check_permission('mediapool_add'))
|
||||
{
|
||||
$AVE_Template->display('browser_upload.tpl');
|
||||
}else{
|
||||
echo '<script type="text/javascript">window.close();</script>';
|
||||
}
|
||||
break;
|
||||
$AVE_Template->display('browser.tpl');
|
||||
break;
|
||||
|
||||
case 'upload2':
|
||||
header('Location:index.php?do=browser&type=image&target=' . $_REQUEST['target'] . '&tval=/' . UPLOAD_DIR . $_REQUEST['tval']);
|
||||
break;
|
||||
|
||||
case 'delfile':
|
||||
if (check_permission('mediapool_del'))
|
||||
{
|
||||
if (empty($_REQUEST['file']) || empty($_REQUEST['dir'])) exit(0);
|
||||
|
||||
$file_name = basename($_REQUEST['file']);
|
||||
|
||||
$del_file = $upload_path . $_REQUEST['dir'] . $file_name;
|
||||
if (strpos($del_file, '..') !== false || !is_file($del_file)) exit(0);
|
||||
|
||||
$recycled_path = $upload_path . '/recycled/';
|
||||
if (!is_dir($recycled_path) && !mkdir($recycled_path)) exit(0);
|
||||
|
||||
do {$nameParts = explode('.', $file_name);
|
||||
$nameParts[count($nameParts)-2] .= '-' . uniqid(rand());
|
||||
$recycled_file_name = implode('.', $nameParts);
|
||||
} while (file_exists($recycled_path . $recycled_file_name));
|
||||
|
||||
@copy($del_file, $recycled_path . $recycled_file_name);
|
||||
|
||||
if (@unlink($del_file))
|
||||
case 'upload':
|
||||
if (check_permission('mediapool_add'))
|
||||
{
|
||||
$nameParts = explode('.', $file_name);
|
||||
$ext = strtolower(end($nameParts));
|
||||
if (in_array($ext, $images_ext))
|
||||
$AVE_Template->display('browser_upload.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<script type="text/javascript">window.close();</script>';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'upload2':
|
||||
header('Location:index.php?do=browser&type=image&target=' . $_REQUEST['target'] . '&tval=/' . UPLOAD_DIR . $_REQUEST['tval']);
|
||||
break;
|
||||
|
||||
case 'delfile':
|
||||
if (check_permission('mediapool_del'))
|
||||
{
|
||||
if (empty($_REQUEST['file']) || empty($_REQUEST['dir']))
|
||||
exit(0);
|
||||
|
||||
$file_name = basename($_REQUEST['file']);
|
||||
|
||||
$del_file = $upload_path . $_REQUEST['dir'] . $file_name;
|
||||
if (strpos($del_file, '..') !== false || !is_file($del_file)) exit(0);
|
||||
|
||||
$recycled_path = $upload_path . '/recycled/';
|
||||
if (!is_dir($recycled_path) && !mkdir($recycled_path)) exit(0);
|
||||
|
||||
do {$nameParts = explode('.', $file_name);
|
||||
$nameParts[count($nameParts)-2] .= '-' . uniqid(rand());
|
||||
$recycled_file_name = implode('.', $nameParts);
|
||||
} while (file_exists($recycled_path . $recycled_file_name));
|
||||
|
||||
@copy($del_file, $recycled_path . $recycled_file_name);
|
||||
|
||||
if (@unlink($del_file))
|
||||
{
|
||||
$nameParts[count($nameParts)-2] .= $thumb_size;
|
||||
@unlink($upload_path . $_REQUEST['dir'] . THUMBNAIL_DIR . '/' . implode('.', $nameParts));
|
||||
$nameParts = explode('.', $file_name);
|
||||
$ext = strtolower(end($nameParts));
|
||||
if (in_array($ext, $images_ext))
|
||||
{
|
||||
$nameParts[count($nameParts)-2] .= $thumb_size;
|
||||
@unlink($upload_path . $_REQUEST['dir'] . THUMBNAIL_DIR . '/' . implode('.', $nameParts));
|
||||
}
|
||||
|
||||
reportLog($_SESSION['user_name'] . ' - удалил файл ('
|
||||
. UPLOAD_DIR . $_REQUEST['dir'] . $file_name . ')');
|
||||
}
|
||||
}
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
parent.frames[\'zf\'].location.href="index.php?do=browser&type=', $_REQUEST['type'], '&action=list&dir=', $_REQUEST['dir'], '";
|
||||
</script>';
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@list($target, $target_id) = explode('__', $_REQUEST['target']);
|
||||
|
||||
$tval = '/';
|
||||
|
||||
if (!empty($_REQUEST['tval']) && 0 === strpos($_REQUEST['tval'], '/' . UPLOAD_DIR . '/'))
|
||||
{
|
||||
if (is_dir(BASE_DIR . '/' . $_REQUEST['tval'])) {
|
||||
$tval = rtrim(substr($_REQUEST['tval'], strlen('/' . UPLOAD_DIR)), '\\/') . '/';
|
||||
}
|
||||
|
||||
reportLog($_SESSION['user_name'] . ' - удалил файл ('
|
||||
. UPLOAD_DIR . $_REQUEST['dir'] . $file_name . ')');
|
||||
}
|
||||
}
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
parent.frames[\'zf\'].location.href="index.php?do=browser&type=', $_REQUEST['type'], '&action=list&dir=', $_REQUEST['dir'], '";
|
||||
</script>';
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@list($target, $target_id) = explode('__', $_REQUEST['target']);
|
||||
|
||||
$tval = '/';
|
||||
|
||||
if (!empty($_REQUEST['tval']) && 0 === strpos($_REQUEST['tval'], '/' . UPLOAD_DIR . '/'))
|
||||
{
|
||||
if (is_dir(BASE_DIR . '/' . $_REQUEST['tval'])) {
|
||||
$tval = rtrim(substr($_REQUEST['tval'], strlen('/' . UPLOAD_DIR)), '\\/') . '/';
|
||||
if (is_file(BASE_DIR . '/' . $_REQUEST['tval'])) {
|
||||
$tval = rtrim(dirname(substr($_REQUEST['tval'], strlen('/' . UPLOAD_DIR))), '\\/') . '/';
|
||||
}
|
||||
}
|
||||
|
||||
if (is_file(BASE_DIR . '/' . $_REQUEST['tval'])) {
|
||||
$tval = rtrim(dirname(substr($_REQUEST['tval'], strlen('/' . UPLOAD_DIR))), '\\/') . '/';
|
||||
}
|
||||
}
|
||||
$AVE_Template->assign('dir', $tval);
|
||||
$AVE_Template->assign('target', $target);
|
||||
$AVE_Template->assign('target_id', $target_id);
|
||||
$AVE_Template->assign('cppath', substr($_SERVER['PHP_SELF'], 0, -18));
|
||||
$AVE_Template->assign('mediapath', UPLOAD_DIR);
|
||||
|
||||
$AVE_Template->assign('dir', $tval);
|
||||
$AVE_Template->assign('target', $target);
|
||||
$AVE_Template->assign('target_id', $target_id);
|
||||
$AVE_Template->assign('cppath', substr($_SERVER['PHP_SELF'], 0, -18));
|
||||
$AVE_Template->assign('mediapath', UPLOAD_DIR);
|
||||
$AVE_Template->display('browser_2frames.tpl');
|
||||
break;
|
||||
}
|
||||
|
||||
$AVE_Template->display('browser_2frames.tpl');
|
||||
break;
|
||||
}
|
||||
$out = ob_get_clean();
|
||||
|
||||
$out = ob_get_clean();
|
||||
echo $out;
|
||||
|
||||
echo $out;
|
||||
|
||||
?>
|
||||
?>
|
@ -1,70 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
|
||||
if (!defined('ACP'))
|
||||
{
|
||||
header('Location:index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
check_permission_acp('db_actions');
|
||||
|
||||
$AVE_Template->config_load(BASE_DIR . '/admin/lang/' . $_SESSION['admin_language'] . '/dbactions.txt', 'db');
|
||||
|
||||
require(BASE_DIR . '/class/class.dbdump.php');
|
||||
$AVE_DB_Service = new AVE_DB_Service;
|
||||
|
||||
if (!empty($_REQUEST['action']))
|
||||
{
|
||||
switch ($_REQUEST['action'])
|
||||
if (! defined('ACP'))
|
||||
{
|
||||
case 'optimize':
|
||||
$AVE_DB_Service->databaseTableOptimize();
|
||||
break;
|
||||
|
||||
case 'repair':
|
||||
$AVE_DB_Service->databaseTableRepair();
|
||||
break;
|
||||
|
||||
case 'dump_top':
|
||||
$AVE_DB_Service->databaseDumpExport(1);
|
||||
exit;
|
||||
|
||||
case 'dump':
|
||||
$AVE_DB_Service->databaseDumpExport();
|
||||
exit;
|
||||
|
||||
case 'restore':
|
||||
$AVE_DB_Service->databaseDumpImport(BASE_DIR . "/" . ATTACH_DIR . "/");
|
||||
break;
|
||||
|
||||
case 'download':
|
||||
$AVE_DB_Service->databaseDumpFileSave($_REQUEST['file']);
|
||||
break;
|
||||
|
||||
case 'restorefile':
|
||||
$AVE_DB_Service->databaseDumpFileImport($_REQUEST['file']);
|
||||
break;
|
||||
|
||||
case 'deletefile':
|
||||
$AVE_DB_Service->databaseDumpFileDelete($_REQUEST['file']);
|
||||
break;
|
||||
header('Location:index.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$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'));
|
||||
check_permission_acp('db_actions');
|
||||
|
||||
$AVE_Template->config_load(BASE_DIR . '/admin/lang/' . $_SESSION['admin_language'] . '/dbactions.txt', 'db');
|
||||
|
||||
require (BASE_DIR . '/class/class.dbdump.php');
|
||||
|
||||
$AVE_DB_Service = new AVE_DB_Service;
|
||||
|
||||
if (!empty($_REQUEST['action']))
|
||||
{
|
||||
switch ($_REQUEST['action'])
|
||||
{
|
||||
case 'optimize':
|
||||
$AVE_DB_Service->databaseTableOptimize();
|
||||
break;
|
||||
|
||||
case 'repair':
|
||||
$AVE_DB_Service->databaseTableRepair();
|
||||
break;
|
||||
|
||||
case 'dump_top':
|
||||
$AVE_DB_Service->databaseDumpExport(1);
|
||||
exit;
|
||||
|
||||
case 'dump':
|
||||
$AVE_DB_Service->databaseDumpExport();
|
||||
exit;
|
||||
|
||||
case 'restore':
|
||||
$AVE_DB_Service->databaseDumpImport(BASE_DIR . "/" . ATTACH_DIR . "/");
|
||||
break;
|
||||
|
||||
case 'download':
|
||||
$AVE_DB_Service->databaseDumpFileSave($_REQUEST['file']);
|
||||
break;
|
||||
|
||||
case 'restorefile':
|
||||
$AVE_DB_Service->databaseDumpFileImport($_REQUEST['file']);
|
||||
break;
|
||||
|
||||
case 'deletefile':
|
||||
$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'));
|
||||
?>
|
@ -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);
|
||||
?>
|
@ -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 { 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;}
|
||||
.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;}
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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}">
|
||||
@ -420,4 +418,4 @@ $(document).ready(function(){ldelim}
|
||||
{/if}
|
||||
|
||||
{rdelim});
|
||||
</script>
|
||||
</script>
|
@ -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}
|
||||
|
@ -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>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelectionrftd('<div>', '</div>');"><strong>DIV</strong></a> |
|
||||
@ -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}
|
@ -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}
|
||||
|
@ -28,8 +28,8 @@
|
||||
{if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a> {/if}
|
||||
{if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a> {/if}
|
||||
{if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a> {/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> {/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> {/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>
|
||||
|
||||
|
@ -22,8 +22,8 @@
|
||||
{if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a> {/if}
|
||||
{if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a> {/if}
|
||||
{if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a> {/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> {/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> {/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>
|
||||
|
||||
|
@ -23,8 +23,8 @@
|
||||
{if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a> {/if}
|
||||
{if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a> {/if}
|
||||
{if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a> {/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> {/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> {/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>
|
||||
|
||||
|
@ -22,8 +22,8 @@
|
||||
{if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a> {/if}
|
||||
{if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a> {/if}
|
||||
{if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a> {/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> {/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> {/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>
|
||||
|
||||
|
@ -23,8 +23,8 @@
|
||||
{if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a> {/if}
|
||||
{if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a> {/if}
|
||||
{if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a> {/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> {/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> {/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>
|
||||
|
||||
|
@ -23,8 +23,8 @@
|
||||
{if check_permission('cache_thumb')}<a class="button redBtn clearThumb" href="javascript:void(0);">{#MAIN_STAT_CLEAR_THUMB#}</a> {/if}
|
||||
{if check_permission('document_revisions')}<a class="button redBtn clearRev" href="javascript:void(0);">{#MAIN_STAT_CLEAR_REV#}</a> {/if}
|
||||
{if check_permission('gen_settings')}<a class="button redBtn clearCount" href="javascript:void(0);">{#MAIN_STAT_CLEAR_COUNT#}</a> {/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> {/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> {/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>
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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 . ' "' . $row->ModuleName . '"');
|
||||
: ($this->_module_error . ' "' . $row->ModuleSysName . '"');
|
||||
}
|
||||
// Сохряняем информацию о модуле
|
||||
$this->install_modules[$row->ModuleSysName] = $row;
|
||||
@ -760,7 +886,7 @@
|
||||
elseif ($row->ModuleAveTag) // Если файла module.php не существует, формируем сообщение с ошибкой
|
||||
{
|
||||
$pattern[] = $row->ModuleAveTag;
|
||||
$replace[] = $this->_module_error . ' "' . $row->ModuleName . '"';
|
||||
$replace[] = $this->_module_error . ' "' . $row->ModuleSysName . '"';
|
||||
}
|
||||
}
|
||||
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
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -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('/(=> )+([a-zA-Z]+\(\d+\))/', '$1<span style="color: #FF8C00;">$2</span>', $var_dump);
|
||||
$var_dump = preg_replace('/(=>)/', '<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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Форматированный вывод чисел
|
||||
*
|
||||
|
@ -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']) . "%')
|
||||
";
|
||||
}
|
||||
|
||||
|
@ -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,25 +199,38 @@
|
||||
|
||||
$modules = array();
|
||||
|
||||
// Условие, определяющее статус документа для запроса к БД
|
||||
$where_status = ($status !== null)
|
||||
? "WHERE ModuleStatus = '" . (int)$status . "'"
|
||||
: '';
|
||||
if (! empty($this->_modules))
|
||||
{
|
||||
foreach ($this->_modules AS $k => $v)
|
||||
{
|
||||
if ($status && $v['status'] != $status)
|
||||
continue;
|
||||
|
||||
// Выполняем запрос к БД и получаем список документов,
|
||||
// согласно статусу, либо все модули, если статус не указан
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
" . PREFIX . "_module
|
||||
" . $where_status . "
|
||||
ORDER BY
|
||||
ModuleName ASC
|
||||
");
|
||||
$modules[$k] = $v;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Условие, определяющее статус документа для запроса к БД
|
||||
$where_status = ($status !== null)
|
||||
? "WHERE ModuleStatus = '" . (int)$status . "'"
|
||||
: '';
|
||||
|
||||
while ($row = $sql->FetchRow())
|
||||
$modules[$row->ModuleSysName] = $row;
|
||||
// Выполняем запрос к БД и получаем список документов,
|
||||
// согласно статусу, либо все модули, если статус не указан
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
" . PREFIX . "_module
|
||||
" . $where_status . "
|
||||
ORDER BY
|
||||
ModuleName ASC
|
||||
");
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для отключения/включение модуля в Панели управления
|
||||
*
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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']) {
|
||||
|
@ -1,97 +1,100 @@
|
||||
<?
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
|
||||
global $AVE_Template;
|
||||
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP')
|
||||
? $_SESSION['admin_language']
|
||||
: $_SESSION['user_language']) . '.txt';
|
||||
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
$res = '';
|
||||
|
||||
switch ($action)
|
||||
// Чекбокс (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)
|
||||
{
|
||||
case 'edit':
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', (int)$field_value);
|
||||
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
|
||||
global $AVE_Template;
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP')
|
||||
? $_SESSION['admin_language']
|
||||
: $_SESSION['user_language']) . '.txt';
|
||||
|
||||
case 'doc':
|
||||
$field_value = clean_php($field_value);
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
$res = ((int)$field_value === 1)
|
||||
? (int)$field_value
|
||||
: 0;
|
||||
$res = '';
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
$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);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
break;
|
||||
|
||||
return $res;
|
||||
break;
|
||||
case 'doc':
|
||||
$field_value = clean_php($field_value);
|
||||
|
||||
case 'req':
|
||||
$field_value = clean_php($field_value);
|
||||
$res = ((int)$field_value === 1)
|
||||
? (int)$field_value
|
||||
: null;
|
||||
|
||||
$res = ((int)$field_value === 1)
|
||||
? (int)$field_value
|
||||
: 0;
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_default', $default);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
return $res;
|
||||
break;
|
||||
return $res;
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
$field_value = clean_php($field_value);
|
||||
$res = ((int)$field_value === 1)
|
||||
? $field_value
|
||||
: '0';
|
||||
break;
|
||||
case 'req':
|
||||
$field_value = clean_php($field_value);
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
$res = ((int)$field_value === 1)
|
||||
? (int)$field_value
|
||||
: null;
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_default', $default);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
return $res;
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
$field_value = clean_php($field_value);
|
||||
$res = ((int)$field_value === 1)
|
||||
? $field_value
|
||||
: null;
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
}
|
||||
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
||||
?>
|
@ -1 +1,6 @@
|
||||
{*
|
||||
$field_id
|
||||
$field_default
|
||||
$field_value
|
||||
*}
|
||||
{$field_value}
|
@ -1 +1,6 @@
|
||||
{*
|
||||
$field_id
|
||||
$field_default
|
||||
$field_value
|
||||
*}
|
||||
{$field_value}
|
@ -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
Normal file
163
fields/checkbox_multi/field.php
Normal file
@ -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);
|
||||
}
|
||||
?>
|
@ -1,54 +1,112 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @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='')
|
||||
{
|
||||
global $AVE_Template;
|
||||
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
switch ($action)
|
||||
// Код (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)
|
||||
{
|
||||
case 'edit':
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
$AVE_Template->assign('doc_id', (int)$_REQUEST['Id']);
|
||||
$AVE_Template->assign('rubric_id', $rubric_id);
|
||||
$AVE_Template->assign('f_id', $field_id.'_'.$_REQUEST['Id']);
|
||||
global $AVE_Template;
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
case 'doc':
|
||||
case 'req':
|
||||
return get_field_default($field_value, $action, $field_id, $tpl, $tpl_empty);
|
||||
break;
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
$AVE_Template->assign('doc_id', (int)$_REQUEST['Id']);
|
||||
$AVE_Template->assign('rubric_id', $rubric_id);
|
||||
$AVE_Template->assign('f_id', $field_id.'_'.(int)$_REQUEST['Id']);
|
||||
|
||||
default: return $field_value;
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
$AVE_Template->config_load($lang_file, 'public');
|
||||
|
||||
if (! $tpl_empty)
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function ($data) use ($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_default', $default);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
$AVE_Template->assign('rubric_id', $rubric_id);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
return $field_value;
|
||||
break;
|
||||
|
||||
case 'req':
|
||||
|
||||
$AVE_Template->config_load($lang_file, 'public');
|
||||
|
||||
if (! $tpl_empty)
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
|
||||
|
||||
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':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
|
||||
default: return $field_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
6
fields/code/tpl/field-doc.tpl
Normal file
6
fields/code/tpl/field-doc.tpl
Normal file
@ -0,0 +1,6 @@
|
||||
{*
|
||||
$field_id
|
||||
$field_default
|
||||
$field_value
|
||||
*}
|
||||
{$field_value}
|
6
fields/code/tpl/field-req.tpl
Normal file
6
fields/code/tpl/field-req.tpl
Normal file
@ -0,0 +1,6 @@
|
||||
{*
|
||||
$field_id
|
||||
$field_default
|
||||
$field_value
|
||||
*}
|
||||
{$field_value}
|
@ -1,117 +1,126 @@
|
||||
<?
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @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){
|
||||
|
||||
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)
|
||||
// Дата (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)
|
||||
{
|
||||
case 'edit':
|
||||
$field_value = ($field_value != 0) ? $field_value : '';
|
||||
global $AVE_Template;
|
||||
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
$AVE_Template->assign('doc_id', (int)$_REQUEST['Id']);
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
case 'doc':
|
||||
$field_value = clean_php($field_value);
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$value = pretty_date(strftime(TIME_FORMAT, $field_value));
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_value)
|
||||
{
|
||||
return $field_value;
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
$res=0;
|
||||
|
||||
return $res = $value;
|
||||
}
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
$field_value = ($field_value != 0) ? $field_value : '';
|
||||
|
||||
$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', $field_value);
|
||||
$AVE_Template->assign('doc_id', (int)$_REQUEST['Id']);
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
break;
|
||||
|
||||
$res = $field_value;
|
||||
break;
|
||||
case 'doc':
|
||||
$field_value = clean_php($field_value);
|
||||
|
||||
case 'req':
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$value = pretty_date(strftime(TIME_FORMAT, $field_value));
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_value)
|
||||
{
|
||||
return $field_value;
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
|
||||
$field_value = clean_php($field_value);
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$value = pretty_date(strftime(TIME_FORMAT, $field_value));
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_value)
|
||||
{
|
||||
return $field_value;
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
return $res = $value;
|
||||
}
|
||||
|
||||
return $res = $value;
|
||||
}
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
|
||||
|
||||
$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', $field_value);
|
||||
$AVE_Template->assign('field_default', $default);
|
||||
|
||||
if($tpl_empty && $tpl_file){
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
$res = $field_value;
|
||||
break;
|
||||
$res = $field_value;
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
$res = $field_value;
|
||||
break;
|
||||
case 'req':
|
||||
$field_value = clean_php($field_value);
|
||||
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$value = pretty_date(strftime(TIME_FORMAT, $field_value));
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_value)
|
||||
{
|
||||
return $field_value;
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
|
||||
return $res = $value;
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
$AVE_Template->assign('field_default', $default);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
$res = $field_value;
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
$res = $field_value;
|
||||
break;
|
||||
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
||||
?>
|
@ -1,170 +1,180 @@
|
||||
<?
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* 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_doc_from_rub($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){
|
||||
|
||||
global $AVE_DB, $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)
|
||||
// Документ из рубрики
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
if (isset($default))
|
||||
{
|
||||
$parent = $AVE_DB->Query("
|
||||
SELECT
|
||||
MIN(document_parent) AS min
|
||||
FROM
|
||||
". PREFIX ."_documents
|
||||
WHERE
|
||||
rubric_id IN (" . $default . ")
|
||||
")->GetCell();
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT
|
||||
Id, document_parent, document_title
|
||||
FROM
|
||||
". PREFIX ."_documents
|
||||
WHERE
|
||||
rubric_id IN (" . $default . ")
|
||||
");
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
|
||||
$cats = array();
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
while($cat = $sql->FetchAssocArray())
|
||||
{
|
||||
$cats_ID[$cat['Id']][] = $cat;
|
||||
$cats[$cat['document_parent']][$cat['Id']] = $cat;
|
||||
}
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
$AVE_Template->assign('subtpl', $tpl_dir . "list.tpl");
|
||||
$AVE_Template->assign('fields', doc_from_rub_tree($cats, $parent));
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$AVE_Template->assign('error', $AVE_Template->get_config_vars('error'));
|
||||
}
|
||||
$res = 0;
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
$document = get_document($field_value);
|
||||
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = $document['document_title'];
|
||||
$field_value = clean_php($field_value);
|
||||
$field_value = stripcslashes($field_value);
|
||||
$field_value = htmlspecialchars_decode($field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('document', $document);
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
$res = $field_value;
|
||||
break;
|
||||
|
||||
case 'req':
|
||||
$document = get_document($field_value);
|
||||
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = $document['document_title'];
|
||||
$field_value = clean_php($field_value);
|
||||
$field_value = stripcslashes($field_value);
|
||||
$field_value = htmlspecialchars_decode($field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('document', $document);
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
$res = $field_value;
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
|
||||
function doc_from_rub_tree($cats, $parent)
|
||||
{
|
||||
if (is_array($cats) and isset($cats[$parent]))
|
||||
{
|
||||
foreach($cats[$parent] as $cat)
|
||||
switch ($action)
|
||||
{
|
||||
$array[$cat['Id']]['Id'] = $cat['Id'];
|
||||
$array[$cat['Id']]['document_title'] = $cat['document_title'];
|
||||
$array[$cat['Id']]['child'] = doc_from_rub_tree($cats, $cat['Id']);
|
||||
case 'edit':
|
||||
if (isset($default))
|
||||
{
|
||||
$parent = $AVE_DB->Query("
|
||||
SELECT
|
||||
MIN(document_parent) AS min
|
||||
FROM
|
||||
". PREFIX ."_documents
|
||||
WHERE
|
||||
rubric_id IN (" . $default . ")
|
||||
")->GetCell();
|
||||
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT
|
||||
Id, document_parent, document_title
|
||||
FROM
|
||||
". PREFIX ."_documents
|
||||
WHERE
|
||||
rubric_id IN (" . $default . ")
|
||||
");
|
||||
|
||||
$cats = array();
|
||||
|
||||
while ($cat = $sql->FetchAssocArray())
|
||||
{
|
||||
$cats_ID[$cat['Id']][] = $cat;
|
||||
$cats[$cat['document_parent']][$cat['Id']] = $cat;
|
||||
}
|
||||
|
||||
$AVE_Template->assign('subtpl', $tpl_dir . "list.tpl");
|
||||
$AVE_Template->assign('fields', doc_from_rub_tree($cats, $parent));
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$AVE_Template->assign('error', $AVE_Template->get_config_vars('error'));
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
$document = get_document($field_value);
|
||||
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = $document['document_title'];
|
||||
$field_value = clean_php($field_value);
|
||||
$field_value = stripcslashes($field_value);
|
||||
$field_value = htmlspecialchars_decode($field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
$AVE_Template->assign('document', $document);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
$res = $field_value;
|
||||
break;
|
||||
|
||||
case 'req':
|
||||
$document = get_document($field_value);
|
||||
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = $document['document_title'];
|
||||
$field_value = clean_php($field_value);
|
||||
$field_value = stripcslashes($field_value);
|
||||
$field_value = htmlspecialchars_decode($field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
$AVE_Template->assign('document', $document);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
$res = $field_value;
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
$array[$cat['Id']]['Id'] = $cat['Id'];
|
||||
$array[$cat['Id']]['document_title'] = $cat['document_title'];
|
||||
$array[$cat['Id']]['child'] = doc_from_rub_tree($cats, $cat['Id']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
?>
|
@ -1,201 +1,204 @@
|
||||
<?
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @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){
|
||||
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
$fld_name = basename($fld_dir);
|
||||
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
$res = array();
|
||||
|
||||
switch ($action)
|
||||
// Документ из рубрики (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)
|
||||
{
|
||||
case 'edit':
|
||||
if (isset($default))
|
||||
{
|
||||
$parent = $AVE_DB->Query("
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
$fld_name = basename($fld_dir);
|
||||
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
$res = array();
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
if (isset($default))
|
||||
{
|
||||
$parent = $AVE_DB->Query("
|
||||
SELECT
|
||||
MIN(document_parent) AS min
|
||||
FROM
|
||||
". PREFIX ."_documents
|
||||
WHERE
|
||||
rubric_id IN (" . $default . ")
|
||||
")->GetCell();
|
||||
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT
|
||||
MIN(document_parent) AS min
|
||||
Id, document_parent, document_title
|
||||
FROM
|
||||
". PREFIX ."_documents
|
||||
WHERE
|
||||
rubric_id IN (" . $default . ")
|
||||
")->GetCell();
|
||||
");
|
||||
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT
|
||||
Id, document_parent, document_title
|
||||
FROM
|
||||
". PREFIX ."_documents
|
||||
WHERE
|
||||
rubric_id IN (" . $default . ")
|
||||
");
|
||||
$field_value_array = explode('|', $field_value);
|
||||
$field_value_array = array_values(array_diff($field_value_array, array('')));
|
||||
|
||||
$cats = array();
|
||||
|
||||
while($cat = $sql->FetchAssocArray())
|
||||
{
|
||||
$cat['checked'] = ((in_array($cat['Id'], $field_value_array) == false) ? "0" : "1");
|
||||
$cats_ID[$cat['Id']][] = $cat;
|
||||
$cats[$cat['document_parent']][$cat['Id']] = $cat;
|
||||
}
|
||||
|
||||
$AVE_Template->assign('subtpl', $tpl_dir."list.tpl");
|
||||
$AVE_Template->assign('fields', doc_from_rub_check_tree($cats, $parent));
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$AVE_Template->assign('error', $AVE_Template->get_config_vars('error'));
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
$AVE_Template->assign('subtpl', $tpl_dir."list.tpl");
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
$field_value_array = explode('|', $field_value);
|
||||
$field_value_array = array_values(array_diff($field_value_array, array('')));
|
||||
|
||||
$cats = array();
|
||||
|
||||
while($cat = $sql->FetchAssocArray())
|
||||
if ($field_value_array != false)
|
||||
{
|
||||
$cat['checked'] = ((in_array($cat['Id'], $field_value_array) == false) ? "0" : "1");
|
||||
$cats_ID[$cat['Id']][] = $cat;
|
||||
$cats[$cat['document_parent']][$cat['Id']] = $cat;
|
||||
foreach ($field_value_array as $list_item)
|
||||
{
|
||||
if ($list_item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$list_item = $AVE_DB->Query("
|
||||
SELECT
|
||||
Id,
|
||||
document_title,
|
||||
document_alias,
|
||||
document_breadcrum_title
|
||||
FROM
|
||||
".PREFIX."_documents
|
||||
WHERE
|
||||
Id = '" . $list_item . "'
|
||||
")->FetchAssocArray();
|
||||
}
|
||||
}
|
||||
$res[] = $list_item;
|
||||
}
|
||||
}
|
||||
|
||||
$AVE_Template->assign('subtpl', $tpl_dir."list.tpl");
|
||||
$AVE_Template->assign('fields', doc_from_rub_check_tree($cats, $parent));
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
$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':
|
||||
$field_value_array = explode('|', $field_value);
|
||||
$field_value_array = array_values(array_diff($field_value_array, array('')));
|
||||
|
||||
if ($field_value_array != false)
|
||||
{
|
||||
foreach ($field_value_array as $list_item)
|
||||
{
|
||||
if ($list_item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$list_item = $AVE_DB->Query("
|
||||
SELECT
|
||||
Id,
|
||||
document_title,
|
||||
document_alias,
|
||||
document_breadcrum_title
|
||||
FROM
|
||||
".PREFIX."_documents
|
||||
WHERE
|
||||
Id = '" . $list_item . "'
|
||||
")->FetchAssocArray();
|
||||
}
|
||||
}
|
||||
$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 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
$array[$cat['Id']]['Id'] = $cat['Id'];
|
||||
$array[$cat['Id']]['checked'] = $cat['checked'];
|
||||
$array[$cat['Id']]['document_title'] = $cat['document_title'];
|
||||
$array[$cat['Id']]['child'] = doc_from_rub_check_tree($cats, $cat['Id']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$AVE_Template->assign('error', $AVE_Template->get_config_vars('error'));
|
||||
return null;
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
|
||||
$AVE_Template->assign('subtpl', $tpl_dir."list.tpl");
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
$field_value_array = explode('|', $field_value);
|
||||
$field_value_array = array_values(array_diff($field_value_array, array('')));
|
||||
|
||||
if ($field_value_array != false)
|
||||
{
|
||||
foreach ($field_value_array as $list_item)
|
||||
{
|
||||
if ($list_item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$list_item = $AVE_DB->Query("
|
||||
SELECT
|
||||
Id,
|
||||
document_title,
|
||||
document_alias,
|
||||
document_breadcrum_title
|
||||
FROM
|
||||
".PREFIX."_documents
|
||||
WHERE
|
||||
Id = '" . $list_item . "'
|
||||
")->FetchAssocArray();
|
||||
}
|
||||
}
|
||||
$res[] = $list_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('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':
|
||||
$field_value_array = explode('|', $field_value);
|
||||
$field_value_array = array_values(array_diff($field_value_array, array('')));
|
||||
|
||||
if ($field_value_array != false)
|
||||
{
|
||||
foreach ($field_value_array as $list_item)
|
||||
{
|
||||
if ($list_item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$list_item = $AVE_DB->Query("
|
||||
SELECT
|
||||
Id,
|
||||
document_title,
|
||||
document_alias,
|
||||
document_breadcrum_title
|
||||
FROM
|
||||
".PREFIX."_documents
|
||||
WHERE
|
||||
Id = '" . $list_item . "'
|
||||
")->FetchAssocArray();
|
||||
}
|
||||
}
|
||||
$res[] = $list_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('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 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
|
||||
function doc_from_rub_check_tree($cats, $parent)
|
||||
{
|
||||
if (is_array($cats) and isset($cats[$parent]))
|
||||
{
|
||||
foreach ($cats[$parent] as $cat)
|
||||
{
|
||||
$array[$cat['Id']]['Id'] = $cat['Id'];
|
||||
$array[$cat['Id']]['checked'] = $cat['checked'];
|
||||
$array[$cat['Id']]['document_title'] = $cat['document_title'];
|
||||
$array[$cat['Id']]['child'] = doc_from_rub_check_tree($cats, $cat['Id']);
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
?>
|
@ -1,224 +1,224 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* 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_doc_from_rub_search($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength = '', $doc_fields=array(), $rubric_id=0, $default='')
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
$fld_name = basename($fld_dir);
|
||||
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
$res = array();
|
||||
|
||||
switch ($action)
|
||||
// Документы из рубрик (Поиск)
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
$items = array();
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
$fld_name = basename($fld_dir);
|
||||
|
||||
if ($field_value != '' && $field_value != $default)
|
||||
{
|
||||
$items = explode('|', $field_value);
|
||||
$items = array_values(array_diff($items, array('')));
|
||||
}
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
if(! empty($items))
|
||||
{
|
||||
foreach($items as $k => $v)
|
||||
$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();
|
||||
|
||||
if ($field_value != '' && $field_value != $default)
|
||||
{
|
||||
$list[$k]['param'] = htmlspecialchars(get_document($v, 'document_title'), ENT_QUOTES);
|
||||
$list[$k]['value'] = $v;
|
||||
$items = explode('|', $field_value);
|
||||
$items = array_values(array_diff($items, array('')));
|
||||
}
|
||||
|
||||
$items = $list;
|
||||
}
|
||||
else
|
||||
if(! empty($items))
|
||||
{
|
||||
$items[0]['param'] = '';
|
||||
$items[0]['value'] = '';
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
|
||||
$AVE_Template->assign('doc_id', $_REQUEST['Id']);
|
||||
$AVE_Template->assign('items', $items);
|
||||
$AVE_Template->assign('field_dir', $fld_name);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
|
||||
case 'save':
|
||||
foreach ($field_value as $v)
|
||||
{
|
||||
if (! empty($v['value']))
|
||||
{
|
||||
$field_value_new[] = $v['value'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($field_value_new))
|
||||
{
|
||||
return '|' . implode('|', $field_value_new) . '|';
|
||||
}
|
||||
else
|
||||
{
|
||||
return $field_value_new = '';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
$field_value_array = explode('|', $field_value);
|
||||
$field_value_array = array_values(array_diff($field_value_array, array('')));
|
||||
|
||||
if ($field_value_array != false)
|
||||
{
|
||||
foreach ($field_value_array as $list_item)
|
||||
{
|
||||
if ($list_item)
|
||||
foreach($items as $k => $v)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$list_item = $AVE_DB->Query("
|
||||
SELECT
|
||||
Id,
|
||||
document_title,
|
||||
document_alias,
|
||||
document_breadcrum_title
|
||||
FROM
|
||||
".PREFIX."_documents
|
||||
WHERE
|
||||
Id = '" . $list_item . "'
|
||||
")->FetchAssocArray();
|
||||
}
|
||||
$list[$k]['param'] = htmlspecialchars(get_document($v, 'document_title'), ENT_QUOTES);
|
||||
$list[$k]['value'] = $v;
|
||||
}
|
||||
$res[] = $list_item;
|
||||
|
||||
$items = $list;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$items[0]['param'] = '';
|
||||
$items[0]['value'] = '';
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('doc_id', $_REQUEST['Id']);
|
||||
$AVE_Template->assign('items', $items);
|
||||
$AVE_Template->assign('field_dir', $fld_name);
|
||||
$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':
|
||||
$field_value_array = explode('|', $field_value);
|
||||
$field_value_array = array_values(array_diff($field_value_array, array('')));
|
||||
|
||||
if ($field_value_array != false)
|
||||
{
|
||||
foreach ($field_value_array as $list_item)
|
||||
case 'save':
|
||||
foreach ($field_value as $v)
|
||||
{
|
||||
if ($list_item)
|
||||
if (! empty($v['value']))
|
||||
{
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$list_item = $AVE_DB->Query("
|
||||
SELECT
|
||||
Id,
|
||||
document_title,
|
||||
document_alias,
|
||||
document_breadcrum_title
|
||||
FROM
|
||||
".PREFIX."_documents
|
||||
WHERE
|
||||
Id = '" . $list_item . "'
|
||||
")->FetchAssocArray();
|
||||
}
|
||||
$field_value_new[] = $v['value'];
|
||||
}
|
||||
$res[] = $list_item;
|
||||
}
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
|
||||
if (isset($field_value_new))
|
||||
{
|
||||
return '|' . implode('|', $field_value_new) . '|';
|
||||
}
|
||||
else
|
||||
{
|
||||
return $field_value_new = '';
|
||||
}
|
||||
break;
|
||||
|
||||
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);
|
||||
case 'doc':
|
||||
$field_value_array = explode('|', $field_value);
|
||||
$field_value_array = array_values(array_diff($field_value_array, array('')));
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
if ($field_value_array != false)
|
||||
{
|
||||
foreach ($field_value_array as $list_item)
|
||||
{
|
||||
if ($list_item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$list_item = $AVE_DB->Query("
|
||||
SELECT
|
||||
Id,
|
||||
document_title,
|
||||
document_alias,
|
||||
document_breadcrum_title
|
||||
FROM
|
||||
".PREFIX."_documents
|
||||
WHERE
|
||||
Id = '" . $list_item . "'
|
||||
")->FetchAssocArray();
|
||||
}
|
||||
}
|
||||
$res[] = $list_item;
|
||||
}
|
||||
}
|
||||
|
||||
return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl;
|
||||
break;
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
|
||||
|
||||
case 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
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);
|
||||
|
||||
case 'search':
|
||||
$default = get_field_default_value($_REQUEST['field_id']);
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT
|
||||
doc.Id,
|
||||
doc.document_title,
|
||||
rub.rubric_title
|
||||
FROM
|
||||
" . PREFIX . "_documents AS doc
|
||||
JOIN
|
||||
" . PREFIX . "_rubrics AS rub
|
||||
ON doc.rubric_id = rub.Id
|
||||
WHERE
|
||||
doc.rubric_id IN (" . $default . ")
|
||||
AND
|
||||
doc.document_status = 1
|
||||
AND
|
||||
UPPER (doc.document_title) LIKE UPPER('%" . $_REQUEST['q'] . "%')
|
||||
GROUP BY
|
||||
doc.Id
|
||||
LIMIT
|
||||
0,5
|
||||
");
|
||||
return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl;
|
||||
break;
|
||||
|
||||
$doc_finded = array();
|
||||
case 'req':
|
||||
$field_value_array = explode('|', $field_value);
|
||||
$field_value_array = array_values(array_diff($field_value_array, array('')));
|
||||
|
||||
while ($row = $sql->FetchRow())
|
||||
{
|
||||
$doc_finded[] = array(
|
||||
'doc_id' => $row->Id,
|
||||
'doc_title' => $row->document_title,
|
||||
'doc_rubric' => $row->rubric_title
|
||||
);
|
||||
}
|
||||
if ($field_value_array != false)
|
||||
{
|
||||
foreach ($field_value_array as $list_item)
|
||||
{
|
||||
if ($list_item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$list_item = $AVE_DB->Query("
|
||||
SELECT
|
||||
Id,
|
||||
document_title,
|
||||
document_alias,
|
||||
document_breadcrum_title
|
||||
FROM
|
||||
".PREFIX."_documents
|
||||
WHERE
|
||||
Id = '" . $list_item . "'
|
||||
")->FetchAssocArray();
|
||||
}
|
||||
}
|
||||
$res[] = $list_item;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($doc_finded);
|
||||
exit;
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
|
||||
|
||||
default:
|
||||
return $field_value;
|
||||
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 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
|
||||
case 'search':
|
||||
$default = get_field_default_value($_REQUEST['field_id']);
|
||||
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT
|
||||
doc.Id,
|
||||
doc.document_title,
|
||||
rub.rubric_title
|
||||
FROM
|
||||
" . PREFIX . "_documents AS doc
|
||||
JOIN
|
||||
" . PREFIX . "_rubrics AS rub
|
||||
ON doc.rubric_id = rub.Id
|
||||
WHERE
|
||||
doc.rubric_id IN (" . $default . ")
|
||||
AND
|
||||
doc.document_status = 1
|
||||
AND
|
||||
UPPER (doc.document_title) LIKE UPPER('%" . $_REQUEST['q'] . "%')
|
||||
GROUP BY
|
||||
doc.Id
|
||||
LIMIT
|
||||
0,5
|
||||
");
|
||||
|
||||
$doc_finded = array();
|
||||
|
||||
while ($row = $sql->FetchRow())
|
||||
{
|
||||
$doc_finded[] = array(
|
||||
'doc_id' => $row->Id,
|
||||
'doc_title' => $row->document_title,
|
||||
'doc_rubric' => $row->rubric_title
|
||||
);
|
||||
}
|
||||
|
||||
echo json_encode($doc_finded);
|
||||
exit;
|
||||
|
||||
default:
|
||||
return $field_value;
|
||||
}
|
||||
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
@ -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;"/> Id: <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 /> <a href="javascript:void(0);" data-id="' + d_id + '_' + c_id + '_' + i_id + '" class="button redBtn topDir DelButton" title="' + docsearch_del + '">×</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();
|
||||
});
|
@ -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);
|
||||
}
|
||||
?>
|
@ -1,3 +0,0 @@
|
||||
[admin]
|
||||
|
||||
name = "Линк към файл"
|
@ -1,2 +0,0 @@
|
||||
[admin]
|
||||
name = "Soubor ke stažení"
|
@ -1,2 +0,0 @@
|
||||
[admin]
|
||||
name = "Download file"
|
@ -1,2 +0,0 @@
|
||||
[admin]
|
||||
name = "Pobierz plik"
|
@ -1,2 +0,0 @@
|
||||
[admin]
|
||||
name = "Загрузить файл"
|
@ -1,2 +0,0 @@
|
||||
[admin]
|
||||
name = "Завантажити файл"
|
@ -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}" />
|
||||
<input value="{#MAIN_OPEN_MEDIAPATH#}"" class="basicBtn" type="button" onclick="browse_uploads('img_feld__{$field_id}', '', '', '0');" />
|
||||
<a class="button blackBtn topDir" title="{#DOC_FILE_TYPE_HELP#}" href="#">?</a>
|
@ -1,87 +1,91 @@
|
||||
<?
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* 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_drop_down($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)
|
||||
// Выпадающий список
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
$items = array();
|
||||
$items = explode(',', $default);
|
||||
$items = array_diff($items, array(''));
|
||||
global $AVE_Template;
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
|
||||
$AVE_Template->assign('items', $items);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', trim($field_value));
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
case 'doc':
|
||||
@$field_value = clean_php($field_value);
|
||||
if (!$tpl_empty)
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
$res = $field_value;
|
||||
break;
|
||||
$res = 0;
|
||||
|
||||
case 'req':
|
||||
@$field_value = clean_php($field_value);
|
||||
if (!$tpl_empty)
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
$res = $field_value;
|
||||
break;
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
$items = array();
|
||||
$items = explode(',', $default);
|
||||
$items = array_diff($items, array(''));
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
$AVE_Template->assign('items', $items);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', trim($field_value));
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
@$field_value = clean_php($field_value);
|
||||
|
||||
if (! $tpl_empty)
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
$res = $field_value;
|
||||
break;
|
||||
|
||||
case 'req':
|
||||
@$field_value = clean_php($field_value);
|
||||
|
||||
if (! $tpl_empty)
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
$res = $field_value;
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
||||
?>
|
@ -1,78 +1,78 @@
|
||||
<?
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* 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_drop_down_key($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)
|
||||
// Выпадающий список (Ключ)
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
$items = explode(',', $default);
|
||||
$items = array_diff($items, array(''));
|
||||
global $AVE_Template;
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
|
||||
$AVE_Template->assign('items', $items);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', trim($field_value));
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
case 'doc':
|
||||
case 'req':
|
||||
@$field_value = clean_php($field_value);
|
||||
$res = 0;
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
$items = explode(',', $default);
|
||||
$items = array_diff($items, array(''));
|
||||
$field_value = $items[$field_value];
|
||||
}
|
||||
|
||||
return $field_value = ($field_value != '') ? $field_value : '';
|
||||
break;
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
$AVE_Template->assign('items', $items);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', trim($field_value));
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
case 'req':
|
||||
@$field_value = clean_php($field_value);
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$items = explode(',', $default);
|
||||
$items = array_diff($items, array(''));
|
||||
$field_value = $items[$field_value];
|
||||
}
|
||||
|
||||
return $field_value = ($field_value != '') ? $field_value : '';
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
||||
?>
|
@ -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);
|
||||
}
|
||||
?>
|
@ -1,2 +0,0 @@
|
||||
[admin]
|
||||
name = "Flash"
|
@ -1,2 +0,0 @@
|
||||
[admin]
|
||||
name = "Flash video (Flash)"
|
@ -1,2 +0,0 @@
|
||||
[admin]
|
||||
name = "Wideo w formacie Flash"
|
@ -1,2 +0,0 @@
|
||||
[admin]
|
||||
name = "Флеш ролик (Flash)"
|
@ -1,2 +0,0 @@
|
||||
[admin]
|
||||
name = "Флеш ролик (Flash)"
|
@ -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}" />
|
||||
<input value="{#MAIN_OPEN_MEDIAPATH#}" class="basicBtn" type="button" onclick="browse_uploads('img_feld__{$field_id}', '', '', '0');" />
|
||||
<a class="button blackBtn topDir" title="{#DOC_FLASH_TYPE_HELP#}" href="#"> ? </a>
|
@ -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 = '';
|
||||
}
|
||||
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);
|
||||
}
|
||||
?>
|
@ -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 + '">' +
|
||||
|
@ -1,395 +1,396 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* 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_image_multi($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null)
|
||||
{
|
||||
|
||||
global $AVE_Template, $img_pixel;
|
||||
|
||||
$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 = 0;
|
||||
|
||||
$iniset_count = ini_get('max_file_uploads');
|
||||
|
||||
switch ($action)
|
||||
// Изображение (Каскад)
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
|
||||
$items = array();
|
||||
$image_items = array();
|
||||
global $AVE_Template, $img_pixel;
|
||||
|
||||
if ($_REQUEST['action'] != 'new')
|
||||
{
|
||||
$items = unserialize($field_value);
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
$fld_name = basename($fld_dir);
|
||||
|
||||
if($items != false)
|
||||
{
|
||||
foreach($items as $k => $v)
|
||||
{
|
||||
$image_item = explode('|', $v);
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP')
|
||||
? $_SESSION['admin_language']
|
||||
: $_SESSION['user_language']) . '.txt';
|
||||
|
||||
$img = $image_item[0];
|
||||
unset($image_item[0]);
|
||||
$image_item = array($img, implode('|', $image_item));
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
$image[$k]['url'] = $image_item[0];
|
||||
$image[$k]['thumb'] = ($image_item[0] != '')
|
||||
? make_thumbnail(array('size' => 'f100x100', 'link' => $image_item[0]))
|
||||
: $img_pixel;
|
||||
$res = 0;
|
||||
|
||||
$image[$k]['desc'] = (isset($image_item[1]))
|
||||
? htmlspecialchars($image_item[1], ENT_QUOTES)
|
||||
: '';
|
||||
}
|
||||
$iniset_count = ini_get('max_file_uploads');
|
||||
|
||||
if (! empty($image))
|
||||
{
|
||||
$image_items = $image;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
|
||||
$show_upload = true;
|
||||
$items = array();
|
||||
$image_items = array();
|
||||
|
||||
$default = explode('|', $default);
|
||||
|
||||
list($path, $watermark, $position, $transparency) = $default;
|
||||
|
||||
if(preg_match("/%id/i", $path))
|
||||
{
|
||||
if ($_REQUEST['action'] != 'new')
|
||||
{
|
||||
$path_upload = trim(@str_replace('%id', $_REQUEST['Id'], $path), '/');
|
||||
$show_upload = true;
|
||||
$items = unserialize($field_value);
|
||||
|
||||
if($items != false)
|
||||
{
|
||||
foreach($items as $k => $v)
|
||||
{
|
||||
$image_item = explode('|', $v);
|
||||
|
||||
$img = $image_item[0];
|
||||
unset($image_item[0]);
|
||||
$image_item = array($img, implode('|', $image_item));
|
||||
|
||||
$image[$k]['url'] = $image_item[0];
|
||||
$image[$k]['thumb'] = ($image_item[0] != '')
|
||||
? make_thumbnail(array('size' => 'f100x100', 'link' => $image_item[0]))
|
||||
: $img_pixel;
|
||||
|
||||
$image[$k]['desc'] = (isset($image_item[1]))
|
||||
? htmlspecialchars($image_item[1], ENT_QUOTES)
|
||||
: '';
|
||||
}
|
||||
|
||||
if (! empty($image))
|
||||
{
|
||||
$image_items = $image;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$show_upload = true;
|
||||
|
||||
$default = explode('|', $default);
|
||||
|
||||
list($path, $watermark, $position, $transparency) = $default;
|
||||
|
||||
if(preg_match("/%id/i", $path))
|
||||
{
|
||||
if ($_REQUEST['action'] != 'new')
|
||||
{
|
||||
$path_upload = trim(@str_replace('%id', $_REQUEST['Id'], $path), '/');
|
||||
$show_upload = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$path_upload = (! empty($path))
|
||||
? trim($path, '/')
|
||||
: '';
|
||||
|
||||
$show_upload = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$path_upload = (! empty($path))
|
||||
? trim($path, '/')
|
||||
? $path
|
||||
: '';
|
||||
|
||||
$show_upload = false;
|
||||
$show_upload = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$path_upload = (! empty($path))
|
||||
? $path
|
||||
: '';
|
||||
|
||||
$show_upload = true;
|
||||
$dir_upload = '/' . UPLOAD_DIR . '/' . ((!empty($path_upload))
|
||||
? $path_upload . '/'
|
||||
: '');
|
||||
|
||||
$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);
|
||||
$AVE_Template->assign('show_upload', $show_upload);
|
||||
|
||||
$AVE_Template->assign('field_dir', $fld_name);
|
||||
$AVE_Template->assign('images', $image_items);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
|
||||
$items = (isset($field_value))
|
||||
? unserialize($field_value)
|
||||
: array();
|
||||
|
||||
$res = array();
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
foreach ($items as $image_item)
|
||||
{
|
||||
$image_item = clean_php($image_item);
|
||||
$field_param = explode('|', $image_item);
|
||||
|
||||
if ($image_item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$image_item = $field_param;
|
||||
}
|
||||
else
|
||||
{
|
||||
$image_item = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
|
||||
$image_item = preg_replace_callback(
|
||||
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
|
||||
create_function(
|
||||
'$m',
|
||||
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
|
||||
),
|
||||
$image_item
|
||||
);
|
||||
|
||||
$image_item = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $image_item);
|
||||
}
|
||||
}
|
||||
|
||||
$res[] = $image_item;
|
||||
}
|
||||
}
|
||||
|
||||
$dir_upload = '/' . UPLOAD_DIR . '/' . ((!empty($path_upload))
|
||||
? $path_upload . '/'
|
||||
: '');
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
|
||||
$AVE_Template->assign('max_files', $AVE_Template->get_config_vars('max_f_f') . $iniset_count);
|
||||
$AVE_Template->assign('dir_upload', $AVE_Template->get_config_vars('upl_dir') . $dir_upload);
|
||||
$AVE_Template->assign('show_upload', $show_upload);
|
||||
|
||||
$AVE_Template->assign('field_dir', $fld_name);
|
||||
$AVE_Template->assign('images', $image_items);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0));
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
|
||||
$items = (isset($field_value))
|
||||
? unserialize($field_value)
|
||||
: array();
|
||||
|
||||
$res = array();
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
foreach ($items as $image_item)
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$image_item = clean_php($image_item);
|
||||
$field_param = explode('|', $image_item);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $res);
|
||||
$AVE_Template->assign('field_count', count($res));
|
||||
$AVE_Template->assign('rubric_id', $rubric_id);
|
||||
$AVE_Template->assign('default', $default);
|
||||
|
||||
if ($image_item)
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
return (! empty($res))
|
||||
? implode(PHP_EOL, $res)
|
||||
: $tpl;
|
||||
|
||||
break;
|
||||
|
||||
case 'req':
|
||||
$items = unserialize($field_value);
|
||||
|
||||
$res = array();
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
foreach ($items as $image_item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
$image_item = clean_php($image_item);
|
||||
$field_param = explode('|', $image_item);
|
||||
|
||||
if ($image_item)
|
||||
{
|
||||
$image_item = $field_param;
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$image_item = $field_param;
|
||||
}
|
||||
else
|
||||
{
|
||||
$image_item = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
|
||||
$image_item = preg_replace_callback(
|
||||
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
|
||||
create_function(
|
||||
'$m',
|
||||
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
|
||||
),
|
||||
$image_item
|
||||
);
|
||||
|
||||
$image_item = preg_replace_callback('/\[tag:([r|c|f]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $image_item);
|
||||
}
|
||||
}
|
||||
|
||||
$res[] = $image_item;
|
||||
}
|
||||
}
|
||||
|
||||
$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('rubric_id', $rubric_id);
|
||||
$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['url']))
|
||||
{
|
||||
$field_value_new[] = $v['url'] . ($v['descr'] ? '|' . $v['descr'] : '');
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
case 'upload':
|
||||
$error = false;
|
||||
|
||||
$search = array();
|
||||
$replace = array();
|
||||
|
||||
$files_unput = 'cascade_files'.'_'.$_REQUEST['field_id'].'_'.$_REQUEST['doc_id'];
|
||||
|
||||
$search[] = '%d';
|
||||
$replace[] = date('d');
|
||||
$search[] = '%m';
|
||||
$replace[] = date('m');
|
||||
$search[] = '%Y';
|
||||
$replace[] = date('Y');
|
||||
|
||||
$default = explode('|', $default);
|
||||
|
||||
list($path_upload, $watermark, $position, $transparency) = $default;
|
||||
|
||||
if (! empty($path_upload))
|
||||
$path_upload = str_replace($search, $replace, $path_upload);
|
||||
|
||||
if(preg_match("/%id/i", $path_upload))
|
||||
{
|
||||
$path = trim(@str_replace('%id', $_REQUEST['doc_id'], $path_upload), '/');
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = (! empty($path_upload))
|
||||
? $path_upload
|
||||
: '';
|
||||
}
|
||||
|
||||
function getExtension($file)
|
||||
{
|
||||
$file = pathinfo($file);
|
||||
return $file['extension'];
|
||||
}
|
||||
|
||||
$valid_formats = array("jpg", "png", "gif", "bmp","jpeg");
|
||||
|
||||
$dir = '/' . UPLOAD_DIR . '/' . ((! empty($path))
|
||||
? trim($path, '/') . '/'
|
||||
: '');
|
||||
|
||||
$dir_abs = BASE_DIR . $dir;
|
||||
|
||||
if (! is_dir($dir_abs))
|
||||
@mkdir($dir_abs, 0777, true);
|
||||
|
||||
foreach ($_FILES[$files_unput]['name'] as $name => $value)
|
||||
{
|
||||
$filename = strtolower(stripslashes(prepare_url($_FILES[$files_unput]['name'][$name])));
|
||||
|
||||
$ext = getExtension($filename);
|
||||
$ext = strtolower($ext);
|
||||
|
||||
if(in_array($ext, $valid_formats))
|
||||
{
|
||||
if (file_exists($dir_abs . $filename))
|
||||
{
|
||||
$filename = rand(1000, 9999) . '_' . $filename;
|
||||
}
|
||||
|
||||
if (@move_uploaded_file($_FILES[$files_unput]['tmp_name'][$name], $dir_abs . $filename))
|
||||
{
|
||||
$new_files[] = $filename;
|
||||
$error = false;
|
||||
|
||||
if ((bool)$watermark)
|
||||
{
|
||||
$position = ($position != '') ? $position : 'center';
|
||||
$transparency = ($transparency != '') ? $transparency : '100';
|
||||
|
||||
watermarks($dir . $filename, $position, $transparency);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$image_item = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
|
||||
$image_item = preg_replace_callback(
|
||||
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
|
||||
create_function(
|
||||
'$m',
|
||||
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
|
||||
),
|
||||
$image_item
|
||||
);
|
||||
|
||||
$image_item = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $image_item);
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
|
||||
$res[] = $image_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('field_count', count($res));
|
||||
$AVE_Template->assign('rubric_id', $rubric_id);
|
||||
$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);
|
||||
|
||||
$res = array();
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
foreach ($items as $image_item)
|
||||
{
|
||||
$image_item = clean_php($image_item);
|
||||
$field_param = explode('|', $image_item);
|
||||
|
||||
if ($image_item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$image_item = $field_param;
|
||||
}
|
||||
else
|
||||
{
|
||||
$image_item = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
|
||||
$image_item = preg_replace_callback(
|
||||
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
|
||||
create_function(
|
||||
'$m',
|
||||
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
|
||||
),
|
||||
$image_item
|
||||
);
|
||||
|
||||
$image_item = preg_replace_callback('/\[tag:([r|c|f]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $image_item);
|
||||
}
|
||||
}
|
||||
|
||||
$res[] = $image_item;
|
||||
}
|
||||
}
|
||||
|
||||
$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('field_count', count($res));
|
||||
$AVE_Template->assign('rubric_id', $rubric_id);
|
||||
$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['url']))
|
||||
{
|
||||
$field_value_new[] = $v['url'] . ($v['descr'] ? '|' . $v['descr'] : '');
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
case 'upload':
|
||||
$error = false;
|
||||
|
||||
$search = array();
|
||||
$replace = array();
|
||||
|
||||
$files_unput = 'cascade_files'.'_'.$_REQUEST['field_id'].'_'.$_REQUEST['doc_id'];
|
||||
|
||||
$search[] = '%d';
|
||||
$replace[] = date('d');
|
||||
$search[] = '%m';
|
||||
$replace[] = date('m');
|
||||
$search[] = '%Y';
|
||||
$replace[] = date('Y');
|
||||
|
||||
$default = explode('|', $default);
|
||||
|
||||
list($path_upload, $watermark, $position, $transparency) = $default;
|
||||
|
||||
if (! empty($path_upload))
|
||||
$path_upload = str_replace($search, $replace, $path_upload);
|
||||
|
||||
if(preg_match("/%id/i", $path_upload))
|
||||
{
|
||||
$path = trim(@str_replace('%id', $_REQUEST['doc_id'], $path_upload), '/');
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = (! empty($path_upload))
|
||||
? $path_upload
|
||||
: '';
|
||||
}
|
||||
|
||||
function getExtension($file)
|
||||
{
|
||||
$file = pathinfo($file);
|
||||
return $file['extension'];
|
||||
}
|
||||
|
||||
$valid_formats = array("jpg", "png", "gif", "bmp","jpeg");
|
||||
|
||||
$dir = '/' . UPLOAD_DIR . '/' . ((! empty($path))
|
||||
? trim($path, '/') . '/'
|
||||
: '');
|
||||
|
||||
$dir_abs = BASE_DIR . $dir;
|
||||
|
||||
if (! is_dir($dir_abs))
|
||||
@mkdir($dir_abs, 0777, true);
|
||||
|
||||
foreach ($_FILES[$files_unput]['name'] as $name => $value)
|
||||
{
|
||||
$filename = strtolower(stripslashes(prepare_url($_FILES[$files_unput]['name'][$name])));
|
||||
|
||||
$ext = getExtension($filename);
|
||||
$ext = strtolower($ext);
|
||||
|
||||
if(in_array($ext, $valid_formats))
|
||||
{
|
||||
if (file_exists($dir_abs . $filename))
|
||||
{
|
||||
$filename = rand(1000, 9999) . '_' . $filename;
|
||||
}
|
||||
|
||||
if (@move_uploaded_file($_FILES[$files_unput]['tmp_name'][$name], $dir_abs . $filename))
|
||||
{
|
||||
$new_files[] = $filename;
|
||||
$error = false;
|
||||
|
||||
if ((bool)$watermark)
|
||||
{
|
||||
$position = ($position != '') ? $position : 'center';
|
||||
$transparency = ($transparency != '') ? $transparency : '100';
|
||||
|
||||
watermarks($dir . $filename, $position, $transparency);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = true;
|
||||
@unlink($_FILES[$files_unput]['tmp_name'][$name]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = true;
|
||||
@unlink($_FILES[$files_unput]['tmp_name'][$name]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($error !== true)
|
||||
{
|
||||
echo json_encode(array(
|
||||
'files' => $new_files,
|
||||
'dir' => $dir,
|
||||
'respons' => 'succes',
|
||||
'message' => $AVE_Template->get_config_vars('resp_s_m'),
|
||||
'header' => $AVE_Template->get_config_vars('resp_s_h'),
|
||||
'theme' => 'accept'
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
if ($error !== true)
|
||||
{
|
||||
echo json_encode(array(
|
||||
'respons' => 'error',
|
||||
'message' => $AVE_Template->get_config_vars('resp_e_m'),
|
||||
'header' => $AVE_Template->get_config_vars('resp_e_h'),
|
||||
'theme' => 'error'
|
||||
'files' => $new_files,
|
||||
'dir' => $dir,
|
||||
'respons' => 'succes',
|
||||
'message' => $AVE_Template->get_config_vars('resp_s_m'),
|
||||
'header' => $AVE_Template->get_config_vars('resp_s_h'),
|
||||
'theme' => 'accept'
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array(
|
||||
'respons' => 'error',
|
||||
'message' => $AVE_Template->get_config_vars('resp_e_m'),
|
||||
'header' => $AVE_Template->get_config_vars('resp_e_h'),
|
||||
'theme' => 'error'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
@ -1,161 +1,161 @@
|
||||
<?
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* 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_image_single($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/';
|
||||
$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 = 0;
|
||||
|
||||
switch ($action)
|
||||
// Изображение
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
$blanc = '/uploads/images/noimage.gif';
|
||||
$image = explode('|', $field_value);
|
||||
$img = $image[0];
|
||||
unset($image[0]);
|
||||
$image = array($img, implode('|', $image));
|
||||
$field = (!empty($image[0]) ? '../' . make_thumbnail(array('link' => $image[0], 'size' => 'f128x128')) : make_thumbnail(array('link' => $blanc, 'size' => 'f128x128')));
|
||||
global $AVE_Template;
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
$fld_name = basename($fld_dir);
|
||||
|
||||
$AVE_Template->assign('field_dir', $fld_name);
|
||||
$AVE_Template->assign('image', $image);
|
||||
$AVE_Template->assign('doc_id', (int)$_REQUEST['Id']);
|
||||
$AVE_Template->assign('field', $field);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
case 'doc':
|
||||
$field_value = clean_php($field_value);
|
||||
$res = 0;
|
||||
|
||||
$field_param = explode('|', $field_value);
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
$blanc = '/uploads/images/noimage.gif';
|
||||
$image = explode('|', $field_value);
|
||||
$img = $image[0];
|
||||
unset($image[0]);
|
||||
$image = array($img, implode('|', $image));
|
||||
$field = (!empty($image[0]) ? '../' . make_thumbnail(array('link' => $image[0], 'size' => 'f128x128')) : make_thumbnail(array('link' => $blanc, 'size' => 'f128x128')));
|
||||
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = '<img alt="' . (isset($field_param[1]) ? $field_param[1] : '')
|
||||
. '" src="' . $field_param[0] . '" border="0" />';
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
|
||||
create_function(
|
||||
'$m',
|
||||
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
|
||||
),
|
||||
$field_value
|
||||
);
|
||||
$AVE_Template->assign('field_dir', $fld_name);
|
||||
$AVE_Template->assign('image', $image);
|
||||
$AVE_Template->assign('doc_id', (int)$_REQUEST['Id']);
|
||||
$AVE_Template->assign('field', $field);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
|
||||
$field_value = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $field_value);
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
|
||||
|
||||
if($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('image', $field_param);
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
break;
|
||||
|
||||
return $field_value;
|
||||
break;
|
||||
case 'doc':
|
||||
$field_value = clean_php($field_value);
|
||||
|
||||
case 'req':
|
||||
$field_value = clean_php($field_value);
|
||||
$field_param = explode('|', $field_value);
|
||||
|
||||
$field_param = explode('|', $field_value);
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = '<img alt="' . (isset($field_param[1]) ? $field_param[1] : '')
|
||||
. '" src="' . $field_param[0] . '" border="0" />';
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_param[1] = isset($field_param[1]) ? $field_param[1] : '';
|
||||
$field_value = '<img src="' . $field_param[0] . '" alt="' . $field_param[1] . '" border="0" />';
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
|
||||
create_function(
|
||||
'$m',
|
||||
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
|
||||
),
|
||||
$field_value
|
||||
);
|
||||
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
|
||||
create_function(
|
||||
'$m',
|
||||
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
|
||||
),
|
||||
$field_value
|
||||
);
|
||||
$field_value = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $field_value);
|
||||
}
|
||||
|
||||
$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);
|
||||
|
||||
$maxlength = null;
|
||||
if($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('image', $field_param);
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
|
||||
return $field_value;
|
||||
break;
|
||||
|
||||
if($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('image', $field_param);
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
case 'req':
|
||||
$field_value = clean_php($field_value);
|
||||
|
||||
return $field_value;
|
||||
break;
|
||||
$field_param = explode('|', $field_value);
|
||||
|
||||
case 'save':
|
||||
if (isset($field_value) && $field_value['img'] != '' )
|
||||
{
|
||||
$field_value = htmlspecialchars(implode("|", $field_value), ENT_QUOTES);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_value = '';
|
||||
}
|
||||
break;
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_param[1] = isset($field_param[1]) ? $field_param[1] : '';
|
||||
$field_value = '<img src="' . $field_param[0] . '" alt="' . $field_param[1] . '" border="0" />';
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
|
||||
case 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
|
||||
create_function(
|
||||
'$m',
|
||||
'return watermarks(\'$m[1]\', \'$m[2]\', $m[3]);'
|
||||
),
|
||||
$field_value
|
||||
);
|
||||
|
||||
$field_value = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $field_value);
|
||||
}
|
||||
|
||||
$maxlength = null;
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
|
||||
|
||||
if($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('image', $field_param);
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
return $field_value;
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
if (isset($field_value) && $field_value['img'] != '' )
|
||||
{
|
||||
$field_value = htmlspecialchars(implode("|", $field_value), ENT_QUOTES);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_value = '';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
}
|
||||
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
||||
?>
|
@ -1,100 +1,100 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* 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($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 = '';
|
||||
|
||||
switch ($action)
|
||||
// Ссылка
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
global $AVE_Template;
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
case 'doc':
|
||||
$field_value = clean_php($field_value);
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_param[1] = empty($field_param[1]) ? $field_param[0] : $field_param[1];
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = ' <a target="_self" href="' . ABS_PATH . $field_param[0] . '">' . $field_param[1] . '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
$res = '';
|
||||
|
||||
$res = $field_value;
|
||||
break;
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
|
||||
case 'req':
|
||||
$field_value = clean_php($field_value);
|
||||
$field_param = explode('|', $field_value);
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
if (empty($field_param[1]))
|
||||
$field_param[1] = $field_param[0];
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
|
||||
if (isset($document_fields[$rubric_id]['tpl_req_empty']))
|
||||
{
|
||||
$field_value = " <a target=\"_self\" href=\"" . ABS_PATH . $field_param[0] . "\">" . $field_param[1] . "</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
case 'doc':
|
||||
$field_value = clean_php($field_value);
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_param[1] = empty($field_param[1]) ? $field_param[0] : $field_param[1];
|
||||
|
||||
$maxlength = null;
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = ' <a target="_self" href="' . ABS_PATH . $field_param[0] . '">' . $field_param[1] . '</a>';
|
||||
}
|
||||
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;
|
||||
$res = $field_value;
|
||||
break;
|
||||
|
||||
case 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
case 'req':
|
||||
$field_value = clean_php($field_value);
|
||||
$field_param = explode('|', $field_value);
|
||||
|
||||
if (empty($field_param[1]))
|
||||
$field_param[1] = $field_param[0];
|
||||
|
||||
if (isset($document_fields[$rubric_id]['tpl_req_empty']))
|
||||
{
|
||||
$field_value = " <a target=\"_self\" href=\"" . ABS_PATH . $field_param[0] . "\">" . $field_param[1] . "</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
$maxlength = null;
|
||||
|
||||
$res = $field_value;
|
||||
break;
|
||||
|
||||
case 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
18
fields/link_multi/css/field.css
Normal file
18
fields/link_multi/css/field.css
Normal file
@ -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
Normal file
194
fields/link_multi/field.php
Normal file
@ -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);
|
||||
}
|
||||
?>
|
@ -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;"/> <input type="text" class="mousetrap" value="" name="feld[' + c_id + '][' + iid + '][value]" placeholder="' + list_value + '" style="width: 300px;" /> <a href="javascript:void(0);" data-id="' + c_id + '_' + iid + '" class="button redBtn topDir DelButton" title="' + list_del + '">×</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;"/> <input type="text" class="mousetrap" value="" name="feld[' + c_id + '][' + iid + '][value]" id="links_' + c_id + '_' + iid + '" placeholder="' + links_url + '" style="width: 300px;" /> <a class="btn greyishBtn" onclick="openFileWindow(\'links_' + c_id + '_' + iid + '\',\'links_' + c_id + '_' + iid + '\',\'links_' + c_id + '_' + iid + '\');">PDF</a> <a href="javascript:void(0);" data-id="' + c_id + '_' + iid + '" class="button redBtn topDir DelButton" title="' + links_del + '">×</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
Normal file
8
fields/link_multi/lang/ru.txt
Normal file
@ -0,0 +1,8 @@
|
||||
[admin]
|
||||
name = "Мульти ссылки"
|
||||
delete = "Удалить элемент"
|
||||
param = "Наименование"
|
||||
value = "Ссылка"
|
||||
del_conf = "Вы уверены, что хотите удалить данный элемент?"
|
||||
del_head = "Удаление элемента..."
|
||||
add = "Добавить"
|
33
fields/link_multi/tpl/field-doc-181.tpl
Normal file
33
fields/link_multi/tpl/field-doc-181.tpl
Normal file
@ -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> {$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
Normal file
5
fields/link_multi/tpl/field-doc.tpl
Normal file
@ -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
Normal file
5
fields/link_multi/tpl/field-req.tpl
Normal file
@ -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
Normal file
29
fields/link_multi/tpl/field.tpl
Normal file
@ -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;"/> <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;" /> <a class="btn greyishBtn" onclick="openFileWindow('links_{$field_id}_{$key}','links_{$field_id}_{$key}','links_{$field_id}_{$key}');">PDF</a> {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#}">×</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>
|
@ -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);
|
||||
}
|
||||
?>
|
@ -1,89 +1,77 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* 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_multi_line($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){
|
||||
|
||||
global $AVE_Template, $AVE_Document;
|
||||
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
|
||||
$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)
|
||||
// Многострочное
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
if (isset($_COOKIE['no_wysiwyg']) && $_COOKIE['no_wysiwyg'] == 1)
|
||||
{
|
||||
$field = '<a name="' . $field_id . '"></a>';
|
||||
$field .= '<textarea style="width: 98%" name="feld[' . $field_id . ']">' . $field_value . '</textarea>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === (bool)true)) {
|
||||
switch ($_SESSION['use_editor']) {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
$oCKeditor = new CKeditor();
|
||||
$oCKeditor->returnOutput = true;
|
||||
$oCKeditor->config['toolbar'] = 'Verysmall';
|
||||
$oCKeditor->config['height'] = 250;
|
||||
$config = array();
|
||||
$field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
|
||||
break;
|
||||
global $AVE_Template, $AVE_Document;
|
||||
|
||||
default:
|
||||
$field = $field_value;
|
||||
break;
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
|
||||
$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 = null;
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
if (isset($_COOKIE['no_wysiwyg']) && $_COOKIE['no_wysiwyg'] == 1)
|
||||
{
|
||||
$field = '<a name="' . $field_id . '"></a>';
|
||||
$field .= '<textarea style="width: 98%" name="feld[' . $field_id . ']">' . $field_value . '</textarea>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === true))
|
||||
{
|
||||
$oCKeditor = new CKeditor();
|
||||
$oCKeditor->returnOutput = true;
|
||||
$oCKeditor->config['toolbar'] = 'Verysmall';
|
||||
$oCKeditor->config['height'] = 250;
|
||||
$config = array();
|
||||
$field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
|
||||
}
|
||||
} else {
|
||||
switch ($_SESSION['use_editor']) {
|
||||
case '0': // CKEditor
|
||||
case '1':
|
||||
$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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
$res = $field;
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
case 'req':
|
||||
$res = get_field_default($field_value, $action, $field_id, $tpl, $tpl_empty, $maxlength, $document_fields, $rubric_id);
|
||||
$res = document_pagination($res);
|
||||
break;
|
||||
$res = $field;
|
||||
break;
|
||||
|
||||
case 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
case 'doc':
|
||||
case 'req':
|
||||
$res = get_field_default($field_value, $action, $field_id, $tpl, $tpl_empty, $maxlength, $document_fields, $rubric_id);
|
||||
$res = document_pagination($res);
|
||||
break;
|
||||
|
||||
case 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
}
|
||||
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
||||
?>
|
@ -1,91 +1,74 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* 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_multi_line_simple($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__) . '/';
|
||||
|
||||
$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)
|
||||
// Многострочное (Упрощенное)
|
||||
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)
|
||||
{
|
||||
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>";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === (bool)true)) {
|
||||
switch ($_SESSION['use_editor'])
|
||||
global $AVE_Template;
|
||||
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
|
||||
$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':
|
||||
if (isset($_COOKIE['no_wysiwyg']) && $_COOKIE['no_wysiwyg'] == 1)
|
||||
{
|
||||
$field = '<a name="' . $field_id . '"></a>';
|
||||
$field .= '<textarea style="width: 98%" name="feld[' . $field_id . ']">' . $field_value . '</textarea>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === true))
|
||||
{
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
$oCKeditor = new CKeditor();
|
||||
$oCKeditor->returnOutput = true;
|
||||
$oCKeditor->config['toolbar'] = 'Verysmall';
|
||||
$oCKeditor->config['height'] = 200;
|
||||
$config = array();
|
||||
$field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
|
||||
break;
|
||||
|
||||
default:
|
||||
$field = $field_value;
|
||||
break;
|
||||
$oCKeditor = new CKeditor();
|
||||
$oCKeditor->returnOutput = true;
|
||||
$oCKeditor->config['toolbar'] = 'Verysmall';
|
||||
$oCKeditor->config['height'] = 250;
|
||||
$config = array();
|
||||
$field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
|
||||
}
|
||||
} else {
|
||||
switch ($_SESSION['use_editor']) {
|
||||
case '0': // CKEditor
|
||||
case '1':
|
||||
$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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$res = $field;
|
||||
break;
|
||||
$res = $field;
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
case 'req':
|
||||
$res = get_field_default($field_value,$action,$field_id,$tpl,$tpl_empty,$maxlength,$document_fields,$rubric_id);
|
||||
$res = document_pagination($res);
|
||||
break;
|
||||
case 'doc':
|
||||
case 'req':
|
||||
$res = get_field_default($field_value,$action,$field_id,$tpl,$tpl_empty,$maxlength,$document_fields,$rubric_id);
|
||||
$res = document_pagination($res);
|
||||
break;
|
||||
|
||||
case 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
case 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
||||
?>
|
@ -1,91 +1,75 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* 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_multi_line_slim($field_value,$action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){
|
||||
|
||||
global $AVE_Template, $AVE_Document;
|
||||
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
|
||||
$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)
|
||||
// Многострочное (Слим)
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
if (isset($_COOKIE['no_wysiwyg']) && $_COOKIE['no_wysiwyg'] == 1)
|
||||
{
|
||||
$field = "<a name=\"" . $field_id . "\"></a>";
|
||||
$field .= "<textarea style=\"width:" . $AVE_Document->_textarea_width_small . "; height:" . $AVE_Document->_textarea_height_small . "\" name=\"feld[" . $field_id . "]\">" . $field_value . "</textarea>";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === (bool)true)) {
|
||||
switch ($_SESSION['use_editor']) {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
$oCKeditor = new CKeditor();
|
||||
$oCKeditor->returnOutput = true;
|
||||
$oCKeditor->config['toolbar'] = 'Verysmall';
|
||||
$oCKeditor->config['height'] = 200;
|
||||
$config = array();
|
||||
$field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
|
||||
break;
|
||||
global $AVE_Template, $AVE_Document;
|
||||
|
||||
default:
|
||||
$field = $field_value;
|
||||
break;
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
|
||||
$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':
|
||||
if (isset($_COOKIE['no_wysiwyg']) && $_COOKIE['no_wysiwyg'] == 1)
|
||||
{
|
||||
$field = '<a name="' . $field_id . '"></a>';
|
||||
$field .= '<textarea style="width: 98%" name="feld[' . $field_id . ']">' . $field_value . '</textarea>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_REQUEST['outside']) && ($_REQUEST['outside'] === true))
|
||||
{
|
||||
$oCKeditor = new CKeditor();
|
||||
$oCKeditor->returnOutput = true;
|
||||
$oCKeditor->config['toolbar'] = 'Verysmall';
|
||||
$oCKeditor->config['height'] = 250;
|
||||
$config = array();
|
||||
$field = $oCKeditor->editor('data['.$_REQUEST['Id'].'][feld][' . $field_id . ']', $field_value, $config);
|
||||
}
|
||||
} else {
|
||||
switch ($_SESSION['use_editor']) {
|
||||
case '0': // CKEditor
|
||||
case '1':
|
||||
$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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$res = $field;
|
||||
break;
|
||||
$res = $field;
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
case 'req':
|
||||
$res = get_field_default($field_value,$action,$field_id,$tpl,$tpl_empty,$maxlength,$document_fields,$rubric_id);
|
||||
$res = document_pagination($res);
|
||||
break;
|
||||
case 'doc':
|
||||
case 'req':
|
||||
$res = get_field_default($field_value,$action,$field_id,$tpl,$tpl_empty,$maxlength,$document_fields,$rubric_id);
|
||||
$res = document_pagination($res);
|
||||
break;
|
||||
|
||||
case 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
|
||||
case 'name' :
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
@ -1,194 +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
|
||||
*/
|
||||
/**
|
||||
* 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_multi_list($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/';
|
||||
$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)
|
||||
// Мульти лист
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
global $AVE_Template;
|
||||
|
||||
$items = array();
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
$fld_name = basename($fld_dir);
|
||||
|
||||
$items = unserialize($field_value);
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
foreach($items as $k => $v){
|
||||
$list_item = explode('|', $v);
|
||||
$res = array();
|
||||
|
||||
$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) : '';
|
||||
}
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
|
||||
$items = $list;
|
||||
}
|
||||
else
|
||||
{
|
||||
$items = explode(',', $default);
|
||||
$items = array();
|
||||
|
||||
foreach($items as $k => $v){
|
||||
$list_item = explode('|', $v);
|
||||
$items = unserialize($field_value);
|
||||
|
||||
$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');
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
|
||||
case 'doc':
|
||||
$items = unserialize($field_value);
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
foreach($items as $list_item)
|
||||
if ($items != false)
|
||||
{
|
||||
$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
|
||||
);
|
||||
}
|
||||
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) : '';
|
||||
}
|
||||
$res[] = $list_item;
|
||||
|
||||
$items = $list;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$items = explode(',', $default);
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
|
||||
foreach($items as $k => $v){
|
||||
$list_item = explode('|', $v);
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$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);
|
||||
$AVE_Template->assign('field_value', $res);
|
||||
$AVE_Template->assign('field_count', count($res));
|
||||
$AVE_Template->assign('default', $default);
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
break;
|
||||
|
||||
return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl;
|
||||
break;
|
||||
case 'doc':
|
||||
$items = unserialize($field_value);
|
||||
|
||||
case 'req':
|
||||
$items = unserialize($field_value);
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
foreach($items as $list_item)
|
||||
if ($items != false)
|
||||
{
|
||||
$list_item = clean_php($list_item);
|
||||
$field_param = explode('|', $list_item);
|
||||
|
||||
if ($list_item)
|
||||
foreach($items as $list_item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
$list_item = clean_php($list_item);
|
||||
$field_param = explode('|', $list_item);
|
||||
|
||||
if ($list_item)
|
||||
{
|
||||
$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
|
||||
);
|
||||
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;
|
||||
}
|
||||
$res[] = $list_item;
|
||||
}
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
|
||||
$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 'save':
|
||||
foreach ($field_value as $v)
|
||||
{
|
||||
if(! empty($v['param']))
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$field_value_new[] = $v['param'] . ($v['value'] ? '|' . $v['value'] : '');
|
||||
}
|
||||
}
|
||||
$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);
|
||||
|
||||
if (isset($field_value_new))
|
||||
{
|
||||
return @serialize($field_value_new);
|
||||
}
|
||||
else
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl;
|
||||
break;
|
||||
|
||||
case 'req':
|
||||
$items = unserialize($field_value);
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
return $field_value_new = '';
|
||||
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;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
$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);
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
@ -1,177 +1,177 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
*/
|
||||
|
||||
// Мульти лист
|
||||
function get_field_multi_list_single($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){
|
||||
|
||||
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)
|
||||
// Мульти лист
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
global $AVE_Template;
|
||||
|
||||
$items = array();
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
$fld_name = basename($fld_dir);
|
||||
|
||||
$items = unserialize($field_value);
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
$items = $items;
|
||||
}
|
||||
else
|
||||
$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)
|
||||
{
|
||||
$items = explode(',', $default);
|
||||
$items = $items;
|
||||
}
|
||||
|
||||
$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');
|
||||
|
||||
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)
|
||||
else
|
||||
{
|
||||
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
|
||||
);
|
||||
}
|
||||
$items = explode(',', $default);
|
||||
}
|
||||
$res[] = $list_item;
|
||||
}
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$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);
|
||||
$AVE_Template->assign('field_value', $res);
|
||||
$AVE_Template->assign('field_count', count($res));
|
||||
$AVE_Template->assign('default', $default);
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
break;
|
||||
|
||||
return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl;
|
||||
break;
|
||||
case 'doc':
|
||||
$items = unserialize($field_value);
|
||||
|
||||
case 'req':
|
||||
$items = unserialize($field_value);
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
foreach($items as $list_item)
|
||||
if ($items != false)
|
||||
{
|
||||
$list_item = clean_php($list_item);
|
||||
$field_param = explode('|', $list_item);
|
||||
|
||||
if ($list_item)
|
||||
foreach($items as $list_item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
$list_item = clean_php($list_item);
|
||||
$field_param = explode('|', $list_item);
|
||||
|
||||
if ($list_item)
|
||||
{
|
||||
$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
|
||||
);
|
||||
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;
|
||||
}
|
||||
$res[] = $list_item;
|
||||
}
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
|
||||
$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 'save':
|
||||
foreach ($field_value as $v)
|
||||
{
|
||||
if (! empty($v))
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$field_value_new[] = $v;
|
||||
}
|
||||
}
|
||||
$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);
|
||||
|
||||
if (isset($field_value_new))
|
||||
{
|
||||
return @serialize($field_value_new);
|
||||
}
|
||||
else
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl;
|
||||
break;
|
||||
|
||||
case 'req':
|
||||
$items = unserialize($field_value);
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
return $field_value_new = '';
|
||||
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;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
$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))
|
||||
{
|
||||
$field_value_new[] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
@ -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;"/> <a href="javascript:void(0);" data-id="' + c_id + '_' + iid + '" class="button redBtn topDir DelSingleButton" title="' + s_list_del + '">×</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();
|
||||
});
|
@ -1,200 +1,199 @@
|
||||
<?
|
||||
<?php
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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_multi_list_triple($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/';
|
||||
$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)
|
||||
// Мульти лист
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
global $AVE_Template;
|
||||
|
||||
$items = array();
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
$fld_name = basename($fld_dir);
|
||||
|
||||
$items = unserialize($field_value);
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
foreach($items as $k => $v)
|
||||
$res = array();
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
|
||||
$items = array();
|
||||
|
||||
$items = unserialize($field_value);
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
$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) : '';
|
||||
$list[$k]['value2'] = (isset($list_item[2])) ? htmlspecialchars($list_item[2], 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) : '';
|
||||
$list[$k]['value2'] = (isset($list_item[2])) ? htmlspecialchars($list_item[2], ENT_QUOTES) : '';
|
||||
}
|
||||
|
||||
$items = $list;
|
||||
}
|
||||
|
||||
$AVE_Template->assign('doc_id', $_REQUEST['Id']);
|
||||
$AVE_Template->assign('field_dir', $fld_name);
|
||||
$AVE_Template->assign('items', $items);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
|
||||
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)
|
||||
foreach($items as $k => $v)
|
||||
{
|
||||
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
|
||||
);
|
||||
}
|
||||
$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) : '';
|
||||
$list[$k]['value2'] = (isset($list_item[2])) ? htmlspecialchars($list_item[2], ENT_QUOTES) : '';
|
||||
}
|
||||
$res[] = $list_item;
|
||||
|
||||
$items = $list;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
|
||||
$items = explode(',', $default);
|
||||
|
||||
if($tpl_empty && $tpl_file)
|
||||
{
|
||||
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) : '';
|
||||
$list[$k]['value2'] = (isset($list_item[2])) ? htmlspecialchars($list_item[2], ENT_QUOTES) : '';
|
||||
}
|
||||
|
||||
$items = $list;
|
||||
}
|
||||
|
||||
$AVE_Template->assign('doc_id', $_REQUEST['Id']);
|
||||
$AVE_Template->assign('field_dir', $fld_name);
|
||||
$AVE_Template->assign('items', $items);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $res);
|
||||
$AVE_Template->assign('field_count', count($res));
|
||||
$AVE_Template->assign('default', $default);
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
break;
|
||||
|
||||
return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl;
|
||||
break;
|
||||
case 'doc':
|
||||
$items = unserialize($field_value);
|
||||
|
||||
case 'req':
|
||||
$items = unserialize($field_value);
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
foreach ($items as $list_item)
|
||||
if ($items != false)
|
||||
{
|
||||
$list_item = clean_php($list_item);
|
||||
$field_param = explode('|', $list_item);
|
||||
|
||||
if ($list_item)
|
||||
foreach ($items as $list_item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
$list_item = clean_php($list_item);
|
||||
$field_param = explode('|', $list_item);
|
||||
|
||||
if ($list_item)
|
||||
{
|
||||
$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
|
||||
);
|
||||
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;
|
||||
}
|
||||
$res[] = $list_item;
|
||||
}
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
|
||||
$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 'save':
|
||||
foreach ($field_value as $v)
|
||||
{
|
||||
if(!empty($v['param']))
|
||||
if($tpl_empty && $tpl_file)
|
||||
{
|
||||
$field_value_new[] = $v['param'] . '|' . $v['value'] . '|' . $v['value2'];
|
||||
}
|
||||
}
|
||||
$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);
|
||||
|
||||
if (isset($field_value_new))
|
||||
{
|
||||
return @serialize($field_value_new);
|
||||
}
|
||||
else
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl;
|
||||
break;
|
||||
|
||||
case 'req':
|
||||
$items = unserialize($field_value);
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
return $field_value_new = '';
|
||||
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;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
$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['value2'];
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
@ -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;"/> <input type="text" class="mousetrap" value="" name="feld[' + c_id + '][' + iid + '][value]" placeholder="' + list_value + '" style="width: 200px;" /> <input type="text" class="mousetrap" value="" name="feld[' + c_id + '][' + iid + '][value2]" placeholder="' + list_value2 + '" style="width: 200px;" /> <a href="javascript:void(0);" data-id="' + c_id + '_' + iid + '" class="button redBtn topDir DelButton" title="' + list_del + '">×</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();
|
||||
});
|
@ -1,159 +1,159 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* 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_multi_select($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/';
|
||||
$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)
|
||||
// Мульти список
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
$items = array();
|
||||
global $AVE_Template;
|
||||
|
||||
$items = explode(',', $default);
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
$fld_name = basename($fld_dir);
|
||||
|
||||
$items = array_diff($items, array(''));
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
@$field_value = unserialize($field_value);
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
$AVE_Template->assign('items', $items);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
$res = array();
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
$items = array();
|
||||
|
||||
case 'doc':
|
||||
$items = (isset($field_value))
|
||||
? unserialize($field_value)
|
||||
: array();
|
||||
$items = explode(',', $default);
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
foreach($items as $item)
|
||||
{
|
||||
$item = clean_php($item);
|
||||
$items = array_diff($items, array(''));
|
||||
|
||||
$field_param = explode('|', $item);
|
||||
@$field_value = unserialize($field_value);
|
||||
|
||||
if ($item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$item = $field_param[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$item = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
}
|
||||
$res[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('items', $items);
|
||||
$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);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
break;
|
||||
|
||||
return (! empty($res))
|
||||
? implode(PHP_EOL, $res)
|
||||
: $tpl;
|
||||
case 'doc':
|
||||
$items = (isset($field_value))
|
||||
? unserialize($field_value)
|
||||
: array();
|
||||
|
||||
break;
|
||||
|
||||
case 'req':
|
||||
$items = (isset($field_value)) ? unserialize($field_value) : array();
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
foreach($items as $item)
|
||||
if ($items != false)
|
||||
{
|
||||
$item = clean_php($item);
|
||||
|
||||
$field_param = explode('|', $item);
|
||||
|
||||
if ($item)
|
||||
foreach($items as $item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
$item = clean_php($item);
|
||||
|
||||
$field_param = explode('|', $item);
|
||||
|
||||
if ($item)
|
||||
{
|
||||
$item = $field_param[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$item = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$item = $field_param[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$item = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
}
|
||||
$res[] = $item;
|
||||
}
|
||||
$res[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, '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);
|
||||
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);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl;
|
||||
break;
|
||||
return (! empty($res))
|
||||
? implode(PHP_EOL, $res)
|
||||
: $tpl;
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'req':
|
||||
$items = (isset($field_value)) ? unserialize($field_value) : array();
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
foreach($items as $item)
|
||||
{
|
||||
$item = clean_php($item);
|
||||
|
||||
$field_param = explode('|', $item);
|
||||
|
||||
if ($item)
|
||||
{
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$item = $field_param[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$item = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return ($res ? $res : $field_value);
|
||||
}
|
||||
?>
|
@ -1,115 +1,123 @@
|
||||
<?
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* 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 ($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/';
|
||||
$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)
|
||||
// Однострочное
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
$AVE_Template->assign('field_dir', $fld_name);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
global $AVE_Template;
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
$fld_name = basename($fld_dir);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP')
|
||||
? $_SESSION['admin_language']
|
||||
: $_SESSION['user_language']) . '.txt';
|
||||
|
||||
case 'doc':
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
$AVE_Template->config_load($lang_file, 'public');
|
||||
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = clean_php($field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
|
||||
|
||||
if($tpl_empty && $tpl_file)
|
||||
{
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
$AVE_Template->assign('field_dir', $fld_name);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
break;
|
||||
|
||||
return $field_value;
|
||||
break;
|
||||
case 'doc':
|
||||
|
||||
case 'req':
|
||||
$AVE_Template->config_load($lang_file, 'public');
|
||||
|
||||
$AVE_Template->config_load($lang_file, 'public');
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = clean_php($field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function ($data) use ($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = clean_php($field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_default', $default);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
|
||||
if($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
return $field_value;
|
||||
break;
|
||||
return $field_value;
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
return $field_value;
|
||||
case 'req':
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
$AVE_Template->config_load($lang_file, 'public');
|
||||
|
||||
default: return $field_value;
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = clean_php($field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_default', $default);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
return $field_value;
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
return $field_value;
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
|
||||
default:
|
||||
return $field_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
@ -1 +1,5 @@
|
||||
{*
|
||||
$field_id
|
||||
$field_value
|
||||
*}
|
||||
{$field_value}
|
@ -1 +1,5 @@
|
||||
{*
|
||||
$field_id
|
||||
$field_value
|
||||
*}
|
||||
{$field_value}
|
@ -1,106 +1,115 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
/**
|
||||
* 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 ($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/';
|
||||
$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)
|
||||
// Однострочное числовое
|
||||
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)
|
||||
{
|
||||
case 'edit':
|
||||
$AVE_Template->assign('field_dir', $fld_name);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
global $AVE_Template;
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
$fld_name = basename($fld_dir);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
break;
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
|
||||
|
||||
case 'doc':
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = clean_php($field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
$AVE_Template->config_load($lang_file, 'lang');
|
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
|
||||
$AVE_Template->config_load($lang_file, 'admin');
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc');
|
||||
|
||||
if($tpl_empty && $tpl_file){
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
$AVE_Template->assign('field_dir', $fld_name);
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin');
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
return $field_value;
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'req':
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = clean_php($field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
case 'doc':
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = clean_php($field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req');
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl);
|
||||
|
||||
if($tpl_empty && $tpl_file){
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
return $field_value;
|
||||
break;
|
||||
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);
|
||||
|
||||
case 'save':
|
||||
$field_value = preg_replace('/[^\d.]/','',$field_value);
|
||||
return $field_value;
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
return $field_value;
|
||||
break;
|
||||
|
||||
default: return $field_value;
|
||||
case 'req':
|
||||
if ($tpl_empty)
|
||||
{
|
||||
$field_value = clean_php($field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_param = explode('|', $field_value);
|
||||
$field_value = preg_replace_callback(
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_param)
|
||||
{
|
||||
return $field_param[(int)$data[1]];
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
}
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl);
|
||||
|
||||
if ($tpl_empty && $tpl_file)
|
||||
{
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('field_value', $field_value);
|
||||
$AVE_Template->assign('field_default', $default);
|
||||
|
||||
return $AVE_Template->fetch($tpl_file);
|
||||
}
|
||||
|
||||
return $field_value;
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
$field_value = preg_replace('/[^\d.]/','',$field_value);
|
||||
return $field_value;
|
||||
|
||||
case 'name':
|
||||
return $AVE_Template->get_config_vars('name');
|
||||
|
||||
default: return $field_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
134
fields/single_line_numeric_three/field.php
Normal file
134
fields/single_line_numeric_three/field.php
Normal file
@ -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
Normal file
26
fields/single_line_numeric_three/js/field.js
Normal file
@ -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
Normal file
3
fields/single_line_numeric_three/lang/bg.txt
Normal file
@ -0,0 +1,3 @@
|
||||
[admin]
|
||||
|
||||
name = "Едноредово (Числово)"
|
2
fields/single_line_numeric_three/lang/cz.txt
Normal file
2
fields/single_line_numeric_three/lang/cz.txt
Normal file
@ -0,0 +1,2 @@
|
||||
[admin]
|
||||
name = "Jednořádkový (Číselný)"
|
2
fields/single_line_numeric_three/lang/en.txt
Normal file
2
fields/single_line_numeric_three/lang/en.txt
Normal file
@ -0,0 +1,2 @@
|
||||
[admin]
|
||||
name = "Single line (Numbers)"
|
2
fields/single_line_numeric_three/lang/pl.txt
Normal file
2
fields/single_line_numeric_three/lang/pl.txt
Normal file
@ -0,0 +1,2 @@
|
||||
[admin]
|
||||
name = "Linia pojedyncza (Numeryczne)"
|
2
fields/single_line_numeric_three/lang/ru.txt
Normal file
2
fields/single_line_numeric_three/lang/ru.txt
Normal file
@ -0,0 +1,2 @@
|
||||
[admin]
|
||||
name = "Однострочное (Числовое тройное)"
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user