Browse Source

Fixes

master
M@d D3n 4 years ago
parent
commit
ca61704d08
  1. 53
      .htaccess
  2. 66
      admin/templates/css/main.css
  3. 8
      fields/youtube/field.php
  4. 38
      functions/func.common.php
  5. 10
      functions/func.documents.php
  6. 87
      functions/func.parserequest.php
  7. 31
      lib/scripts/jquery.formstyler.min.js

53
.htaccess

@ -13,25 +13,25 @@ Options -Indexes +FollowSymLinks
php_value default_charset utf-8 php_value default_charset utf-8
#Отлючаем вывод ошибок #Отлючаем вывод ошибок
#php_value error_reporting E_NONE #php_value error_reporting E_NONE
# Этот параметр устанавливает максимальное время в секундах, позволяющее скрипту запускаться прежде, чем он завершается синтаксическим анализатором. # Этот параметр устанавливает максимальное время в секундах, позволяющее скрипту запускаться прежде, чем он завершается синтаксическим анализатором.
#php_value max_execution_time 300 #php_value max_execution_time 300
# Максимальное время загрузки данных для скрипта, в том числе и файлов из формы # Максимальное время загрузки данных для скрипта, в том числе и файлов из формы
#php_value max_input_time 300 #php_value max_input_time 300
# Ограничивает максимальный объем данных, получаемых от пользователя методом POST # Ограничивает максимальный объем данных, получаемых от пользователя методом POST
#php_value post_max_size 512M #php_value post_max_size 512M
# Устанавливает максимальный размер файла, который может быть получен методом POST (меньше, чем post_max_size) # Устанавливает максимальный размер файла, который может быть получен методом POST (меньше, чем post_max_size)
#php_value upload_max_filesize 128M #php_value upload_max_filesize 128M
# Максимальное кол-во загружаемых файлов # Максимальное кол-во загружаемых файлов
#php_value max_file_uploads 50 #php_value max_file_uploads 50
# Включаем у PHP короткие <? # Включаем у PHP короткие <?
#php_value short_open_tag On #php_value short_open_tag On
php_flag magic_quotes_gpc off php_flag magic_quotes_gpc off
@ -40,6 +40,7 @@ Options -Indexes +FollowSymLinks
php_flag register_globals off php_flag register_globals off
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# | CORS-enabled images | # | CORS-enabled images |
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -195,16 +196,17 @@ AddDefaultCharset utf-8
ExpiresByType text/xml "access plus 0 seconds" ExpiresByType text/xml "access plus 0 seconds"
# Favicon (cannot be renamed!) and cursor images # Favicon (cannot be renamed!) and cursor images
ExpiresByType image/x-icon "access plus 1 week" ExpiresByType image/x-icon "access plus 2 months"
# HTML components (HTCs) # HTML components (HTCs)
ExpiresByType text/x-component "access plus 1 month" ExpiresByType text/x-component "access plus 1 month"
# HTML # HTML
ExpiresByType text/html "access plus 0 seconds" ExpiresByType text/html "access plus 0 seconds"
# JavaScript # JavaScript
ExpiresByType application/javascript "access plus 1 year" ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
# Manifest files # Manifest files
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
@ -221,7 +223,7 @@ AddDefaultCharset utf-8
# Web feeds # Web feeds
ExpiresByType application/atom+xml "access plus 1 hour" ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour" ExpiresByType application/rss+xml "access plus 1 hour"
# Web fonts # Web fonts
ExpiresByType application/font-woff "access plus 1 month" ExpiresByType application/font-woff "access plus 1 month"
@ -229,12 +231,22 @@ AddDefaultCharset utf-8
ExpiresByType application/x-font-ttf "access plus 1 month" ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month" ExpiresByType font/opentype "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month" ExpiresByType image/svg+xml "access plus 1 month"
# Images
ExpiresByType image/gif "access plus 2 months"
ExpiresByType image/jpeg "access plus 2 months"
ExpiresByType image/x-icon "access plus 2 months"
ExpiresByType image/png "access plus 2 months"
</IfModule> </IfModule>
<FilesMatch "\.(backup|cache|class|fields|functions|inc|modules|lib|session|templates)$"> <FilesMatch "\.(class|config|fields|functions|inc|modules|lib|templates|tmp)$">
Order allow,deny Order allow,deny
</FilesMatch> </FilesMatch>
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$">
Header set Cache-Control "max-age=2592000, must-revalidate"
</FilesMatch>
<IfModule mod_security.c> <IfModule mod_security.c>
SecFilterScanPOST Off SecFilterScanPOST Off
</IfModule> </IfModule>
@ -249,6 +261,21 @@ AddDefaultCharset utf-8
</FilesMatch> </FilesMatch>
</IfModule> </IfModule>
# ------------------------------------------------------------------------------
# | mod_gzip.c |
# ------------------------------------------------------------------------------
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_include mime ^text/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_include handler ^cgi-script$
</ifModule>
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# | Rewrite engine | # | Rewrite engine |
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -278,7 +305,7 @@ AddDefaultCharset utf-8
# RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] # RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) # RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteCond %{REQUEST_URI} !^/(backup|cache|class|fields|functions|inc|modules|lib|session|templates)/ RewriteCond %{REQUEST_URI} !^/(class|config|fields|functions|inc|modules|lib|templates|tmp)/
# Файл robots.txt # Файл robots.txt
RewriteCond %{REQUEST_URI} !^/robots\.txt$ [NC] RewriteCond %{REQUEST_URI} !^/robots\.txt$ [NC]

66
admin/templates/css/main.css

@ -1426,6 +1426,10 @@ li.plupload_droptext { background: transparent; text-align: center; vertical-ali
margin: 5px; margin: 5px;
} }
.jq-selectbox__search {
margin: 5px;
}
.jq-selectbox__search input { .jq-selectbox__search input {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
@ -1437,4 +1441,66 @@ li.plupload_droptext { background: transparent; text-align: center; vertical-ali
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAGXRFWV6u2aoSqBZD/lDrNWRJynLK2qpBn4rc6K2XB9/Nb8EGABtf1thzY6X2AAAAABJRU5ErkJggg==) no-repeat 100% 50%; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAGXRFWV6u2aoSqBZD/lDrNWRJynLK2qpBn4rc6K2XB9/Nb8EGABtf1thzY6X2AAAAABJRU5ErkJggg==) no-repeat 100% 50%;
box-shadow: inset 1px 1px #F1F1F1; box-shadow: inset 1px 1px #F1F1F1;
color: #333; color: #333;
}
.jq-selectbox,
.jq-select-multiple {
position: relative;
display: inline-block;
}
.jq-selectbox select,
.jq-select-multiple select {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
opacity: 0;
}
.jq-selectbox li,
.jq-select-multiple li {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
}
.jq-selectbox {
z-index: 10;
}
.jq-selectbox__select {
position: relative;
}
.jq-selectbox__select-text {
overflow: hidden;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
text-overflow: ellipsis;
}
.jq-selectbox__dropdown {
position: absolute;
}
.jq-selectbox__search input {
-webkit-appearance: textfield;
}
.jq-selectbox__search input::-webkit-search-cancel-button,
.jq-selectbox__search input::-webkit-search-decoration {
-webkit-appearance: none;
}
.jq-selectbox__dropdown ul {
position: relative;
overflow: auto;
overflow-x: hidden;
list-style: none;
-webkit-overflow-scrolling: touch;
}
.jq-select-multiple ul {
position: relative;
overflow-x: hidden;
-webkit-overflow-scrolling: touch;
} }

8
fields/youtube/field.php

@ -162,11 +162,11 @@
if ($source == 'embed') if ($source == 'embed')
{ {
return 'http://www.youtube.com/v/'.$vid; return 'https://www.youtube.com/v/'.$vid;
} }
else else
{ {
return 'http://www.youtube.com/embed/'.$vid; return 'https://www.youtube.com/embed/'.$vid;
} }
} }
@ -185,11 +185,11 @@
if ($source == 'embed') if ($source == 'embed')
{ {
return 'http://www.youtube.com/v/'.$vid; return 'https://www.youtube.com/v/'.$vid;
} }
else else
{ {
return 'http://www.youtube.com/embed/'.$vid; return 'https://www.youtube.com/embed/'.$vid;
} }
} }
else else

38
functions/func.common.php

@ -1280,6 +1280,7 @@
return strtr(base64_encode($input), '+/=', '-_,'); return strtr(base64_encode($input), '+/=', '-_,');
} }
/** /**
* _base64_decode() * _base64_decode()
* *
@ -1290,4 +1291,41 @@
{ {
return base64_decode(strtr($input, '-_,', '+/=')); return base64_decode(strtr($input, '-_,', '+/='));
} }
/**
* Функция принимает строку, и возвращает
* адрес первого изображения, которую найдет
*
* @param $data
*
* @return string
*/
function getImgSrc($data)
{
$_req_exp = '/(<img )(.+?)( \/)?(>)/u';
preg_match_all($_req_exp, $data, $images);
$host = $images[2][0];
if (preg_match("/(src=)('|\")(.+?)('|\")/u", $host, $matches) == 1)
$host = $matches[3];
preg_match('@/index\.php\?.*thumb=(.*?)\&@i', $host, $matches);
if (isset($matches[1]))
{
return $matches[1];
}
else
{
preg_match('/(.+)' . THUMBNAIL_DIR . '\/(.+)-.\d+x\d+(\..+)/u', $host, $matches);
if (isset($matches[1]))
return $matches[1] . $matches[2] . $matches[3];
else
return $host;
}
}
?> ?>

10
functions/func.documents.php

@ -18,7 +18,7 @@
* @param string $text текст многострочной части документа * @param string $text текст многострочной части документа
* @return string * @return string
*/ */
function document_pagination($text) function document_pagination ($text)
{ {
global $AVE_Core; global $AVE_Core;
@ -67,7 +67,7 @@
* *
* @return int идентификатор родительского документа * @return int идентификатор родительского документа
*/ */
function get_parent_document_id() function get_parent_document_id ()
{ {
global $AVE_DB; global $AVE_DB;
return $AVE_DB->Query("SELECT document_parent FROM " . PREFIX . "_documents WHERE Id = '".get_current_document_id()."' ")->GetCell(); return $AVE_DB->Query("SELECT document_parent FROM " . PREFIX . "_documents WHERE Id = '".get_current_document_id()."' ")->GetCell();
@ -83,14 +83,12 @@
*/ */
function get_document ($doc_id , $key ='') function get_document ($doc_id , $key ='')
{ {
global $AVE_DB;
$doc_id = (int)$doc_id; $doc_id = (int)$doc_id;
if ($doc_id < 1) if ($doc_id < 1)
return array(); return [];
static $get_documents_data = array(); static $get_documents_data = [];
if (! isset ($get_documents_data[$doc_id])) if (! isset ($get_documents_data[$doc_id]))
{ {

87
functions/func.parserequest.php

@ -58,8 +58,8 @@
global $AVE_DB, $AVE_Core; global $AVE_DB, $AVE_Core;
$id = (int)$id; $id = (int)$id;
$from = array(); $from = [];
$where = array(); $where = [];
$sql_ak = $AVE_DB->Query(" $sql_ak = $AVE_DB->Query("
SELECT * SELECT *
@ -108,14 +108,18 @@
{ {
// id поля рубрики // id поля рубрики
$fid = $row_ak->condition_field_id; $fid = $row_ak->condition_field_id;
// значение для условия // значение для условия
$val = trim($row_ak->condition_value); $val = trim($row_ak->condition_value);
// если это поле используется для выпадающего списка или пустое значение для условия, пропускаем // если это поле используется для выпадающего списка или пустое значение для условия, пропускаем
if (isset($_POST['req_' . $id]) && isset($_POST['req_' . $id][$fid]) || $val === '') if (isset($_POST['req_' . $id]) && isset($_POST['req_' . $id][$fid]) || $val === '')
continue; continue;
// И / ИЛИ // И / ИЛИ
if (! isset($join) && $row_ak->condition_join) if (! isset($join) && $row_ak->condition_join)
$join = $row_ak->condition_join; $join = $row_ak->condition_join;
// тип сравнения // тип сравнения
$type = $row_ak->condition_compare; $type = $row_ak->condition_compare;
@ -142,7 +146,7 @@
// формируем выбор таблицы // формируем выбор таблицы
// первый раз евалом проходим значение и запоминаем это в переменной $v[$i] // первый раз евалом проходим значение и запоминаем это в переменной $v[$i]
// как только таблица выбрана, фиксируем это в $t[$fid], чтобы не выбирать по несколько раз одни и те же таблицы // как только таблица выбрана, фиксируем это в $t[$fid], чтобы не выбирать по несколько раз одни и те же таблицы
$from[] = "<?php \$v[$i] = trim(eval2var(' ?>$val<?php ')); \$t = array(); if (\$v[$i]>'' && !isset(\$t[$fid])) {echo \"%%PREFIX%%_document_fields AS t$fid,\"; \$t[$fid]=1;} ?>"; $from[] = "<?php \$v[$i] = trim(eval2var(' ?>$val<?php ')); \$t = []; if (\$v[$i]>'' && !isset(\$t[$fid])) {echo \"%%PREFIX%%_document_fields AS t$fid,\"; \$t[$fid]=1;} ?>";
// обрабатываем условия // обрабатываем условия
switch ($type) switch ($type)
@ -180,7 +184,7 @@
$i++; $i++;
} }
$retval = array(); $retval = [];
if (! empty($where) || ! empty($where_dd)) if (! empty($where) || ! empty($where_dd))
{ {
@ -189,14 +193,14 @@
$from = (isset($from_dd) ? array_merge($from, $from_dd) : $from); $from = (isset($from_dd) ? array_merge($from, $from_dd) : $from);
$from = implode(' ', $from); $from = implode(' ', $from);
$where_dd = (isset($where_dd) ? ' AND ' : '') . implode(' AND ', $where_dd); $where_dd = (isset($where_dd) ? ' AND ' : '') . implode(' AND ', $where_dd);
$where = implode(' ', $where) . " <?php \$a = array(); echo (!array_sum(\$a) || '$join'=='AND') ? '1=1' : '1=0'; ?>"; $where = implode(' ', $where) . " <?php \$a = []; echo (!array_sum(\$a) || '$join'=='AND') ? '1=1' : '1=0'; ?>";
$retval = array('from' => $from, 'where' => $where . $where_dd); $retval = ['from' => $from, 'where' => $where . $where_dd];
} }
else else
{ {
$from = implode(' ', $from); $from = implode(' ', $from);
$where = implode(' ', $where) . " <?php \$a = array(); echo (!array_sum(\$a) || '$join'=='AND') ? '1=1' : '1=0'; ?>"; $where = implode(' ', $where) . " <?php \$a = []; echo (!array_sum(\$a) || '$join'=='AND') ? '1=1' : '1=0'; ?>";
$retval = array('from' => $from, 'where' => $where); $retval = ['from' => $from, 'where' => $where];
} }
} }
@ -219,43 +223,6 @@
} }
/**
* Функция принимает строку, и возвращает
* адрес первого изображения, которую найдет
*
* @param $data
*
* @return string
*/
function getImgSrc($data)
{
$_req_exp = '/(<img )(.+?)( \/)?(>)/u';
preg_match_all($_req_exp, $data, $images);
$host = $images[2][0];
if (preg_match("/(src=)('|\")(.+?)('|\")/u", $host, $matches) == 1)
$host = $matches[3];
preg_match('@/index\.php\?.*thumb=(.*?)\&@i', $host, $matches);
if (isset($matches[1]))
{
return $matches[1];
}
else
{
preg_match('/(.+)' . THUMBNAIL_DIR . '\/(.+)-.\d+x\d+(\..+)/u', $host, $matches);
if (isset($matches[1]))
return $matches[1] . $matches[2] . $matches[3];
else
return $host;
}
}
/** /**
* Функция обработки тэгов полей с использованием шаблонов * Функция обработки тэгов полей с использованием шаблонов
* в соответствии с типом поля * в соответствии с типом поля
@ -267,7 +234,7 @@
* *
* @return string * @return string
*/ */
function request_get_document_field($field_id, $document_id, $maxlength = null, $rubric_id = 0) function request_get_document_field ($field_id, $document_id, $maxlength = null, $rubric_id = 0)
{ {
if (! is_numeric($document_id) || $document_id < 1) if (! is_numeric($document_id) || $document_id < 1)
return ''; return '';
@ -354,6 +321,7 @@
return $item; return $item;
} }
// Функция получения уникальных параметров для каждого тизера // Функция получения уникальных параметров для каждого тизера
function f_params_of_teaser($id_param_array,$num) function f_params_of_teaser($id_param_array,$num)
{ {
@ -361,6 +329,7 @@
return $params_of_teaser[$id_param_array][$num]; return $params_of_teaser[$id_param_array][$num];
} }
// Функция получения элемента запроса // Функция получения элемента запроса
function showrequestelement($mixed, $template = '', $tparams = '') function showrequestelement($mixed, $template = '', $tparams = '')
{ {
@ -392,7 +361,7 @@
if ($tparams != '') if ($tparams != '')
{ {
$tparams_id = $row->Id . md5($tparams); // Создаем уникальный id для каждого набора параметров $tparams_id = $row->Id . md5($tparams); // Создаем уникальный id для каждого набора параметров
$params_of_teaser[$tparams_id] = array(); // Для отмены лишних ворнингов $params_of_teaser[$tparams_id] = []; // Для отмены лишних ворнингов
$tparams = trim($tparams,'[]:'); // Удаляем: слева ':[', справа ']' $tparams = trim($tparams,'[]:'); // Удаляем: слева ':[', справа ']'
$params_of_teaser[$tparams_id] = explode('|',$tparams); // Заносим параметры в массив уникального id $params_of_teaser[$tparams_id] = explode('|',$tparams); // Заносим параметры в массив уникального id
} }
@ -629,7 +598,7 @@
* *
* @return string * @return string
*/ */
function request_parse($id, $params = array()) function request_parse($id, $params = [])
{ {
global $AVE_Core, $AVE_DB, $request_documents; global $AVE_Core, $AVE_DB, $request_documents;
@ -637,9 +606,9 @@
if (is_array($id)) if (is_array($id))
$id = $id[1]; $id = $id[1];
$t = array(); $t = [];
$a = array(); $a = [];
$v = array(); $v = [];
// Получаем информацию о запросе // Получаем информацию о запросе
$request = request_get_settings($id); $request = request_get_settings($id);
@ -648,15 +617,15 @@
Debug::startTime('request_' . $id); Debug::startTime('request_' . $id);
// Массив для полей SELECT // Массив для полей SELECT
$request_select = array(); $request_select = [];
// Массив для присоединения таблиц JOIN // Массив для присоединения таблиц JOIN
$request_join = array(); $request_join = [];
// Массив для добавления условий WHERE // Массив для добавления условий WHERE
$request_where = array(); $request_where = [];
// Массив для сортировки результатов ORDER BY // Массив для сортировки результатов ORDER BY
$request_order = array(); $request_order = [];
// Массив для сортировки результатов ORDER BY // Массив для сортировки результатов ORDER BY
$request_order_fields = array(); $request_order_fields = [];
$request_order_str = ''; $request_order_str = '';
$request_select_str = ''; $request_select_str = '';
@ -667,7 +636,7 @@
// Разрешаем перебор полей для сортировки через ";" // Разрешаем перебор полей для сортировки через ";"
$sort = explode(';', $_REQUEST['requestsort_' . $id]); $sort = explode(';', $_REQUEST['requestsort_' . $id]);
foreach($sort as $v) foreach($sort AS $v)
{ {
$v1 = explode('=', $v); $v1 = explode('=', $v);
@ -1029,10 +998,10 @@
} }
// Элементы запроса // Элементы запроса
$rows = array(); $rows = [];
// id найденных документов // id найденных документов
$request_documents = array(); $request_documents = [];
while ($row = $sql->FetchRow()) while ($row = $sql->FetchRow())
{ {

31
lib/scripts/jquery.formstyler.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save