From e2a35c89a66c010532abede8d77834c6412ab34e Mon Sep 17 00:00:00 2001 From: "M@dD3n" Date: Thu, 29 Aug 2019 13:12:11 +0300 Subject: [PATCH] Fixes --- class/class.core.php | 6 +-- class/class.database.php | 8 +-- fields/multi_links/field.php | 2 +- fields/rubrics/field.php | 2 +- functions/func.fields.php | 11 +++-- lib/debug/debug.js | 94 ++++++++++++++++++++++++++---------- 6 files changed, 84 insertions(+), 39 deletions(-) diff --git a/class/class.core.php b/class/class.core.php index 2e92d53..5ed9c3f 100755 --- a/class/class.core.php +++ b/class/class.core.php @@ -784,7 +784,7 @@ return false; $cache['id'] = (int)$cache['id']; - $cache['id'] = 'documents/compiled/' . (floor($cache['id'] / 1000)) . '/' . $cache['id']; + $cache['id'] = 'documents/' . (floor($cache['id'] / 1000)) . '/' . $cache['id']; $cache['file'] = $this->_get_cache_hash() . '.compiled'; @@ -1771,7 +1771,7 @@ else $AVE_DB->clearCacheUrl('url_' . $hash_url); - $this->curentdoc = $AVE_DB->Query($sql, $cache_time, 'url_' . $hash_url, true, '.fetch')->FetchRow(); + $this->curentdoc = $AVE_DB->Query($sql, $cache_time, 'url_' . $hash_url, true, '.url')->FetchRow(); if ($this->curentdoc) { @@ -1803,7 +1803,7 @@ rub.Id = '" . $this->curentdoc->rubric_id . "' "; - $query = $AVE_DB->Query($sql, $cache_time, 'rub_' . $this->curentdoc->rubric_id, true, '.fetch')->FetchRow(); + $query = $AVE_DB->Query($sql, $cache_time, 'rub_' . $this->curentdoc->rubric_id, true, '.rubric')->FetchRow(); $this->curentdoc = (object) array_merge((array) $query, (array) $this->curentdoc); diff --git a/class/class.database.php b/class/class.database.php index 7ffd995..081f07d 100755 --- a/class/class.database.php +++ b/class/class.database.php @@ -784,21 +784,21 @@ if (substr($cache_id, 0, 3) == 'dat') { $cache_id = (int)str_replace('dat_', '', $cache_id); - return $cache_id = 'documents/data/' . (floor($cache_id / 1000)) . '/' . $cache_id; + return $cache_id = 'documents/' . (floor($cache_id / 1000)) . '/' . $cache_id; } //-- Если это скомпилированный шаблон документа, то меняем расположение if (substr($cache_id, 0, 3) == 'cmd') { $cache_id = (int)str_replace('cmd_', '', $cache_id); - return $cache_id = 'documents/compiled/' . (floor($cache_id / 1000)) . '/' . $cache_id; + return $cache_id = 'documents/' . (floor($cache_id / 1000)) . '/' . $cache_id; } //-- Если это поля документа, то меняем расположение if (substr($cache_id, 0, 3) == 'fld') { $cache_id = (int)str_replace('fld_', '', $cache_id); - return $cache_id = 'documents/fields/' . (floor($cache_id / 1000)) . '/' . $cache_id; + return $cache_id = 'documents/' . (floor($cache_id / 1000)) . '/' . $cache_id; } //-- Сборка страницы @@ -812,7 +812,7 @@ if (substr($cache_id, 0, 3) == 'brd') { $cache_id = (int)str_replace('brd_', '', $cache_id); - return $cache_id = 'documents/breadcrumbs/' . (floor($cache_id / 1000)) . '/' . $cache_id; + return $cache_id = 'documents/' . (floor($cache_id / 1000)) . '/' . $cache_id; } //-- Если это рубрика, то меняем расположение diff --git a/fields/multi_links/field.php b/fields/multi_links/field.php index 0f7158f..8a74709 100644 --- a/fields/multi_links/field.php +++ b/fields/multi_links/field.php @@ -1,4 +1,4 @@ -curentdoc->Id; - $cache_id = 'documents/fields/' . (floor($cache_id / 1000)) . '/' . $cache_id; + $cache_id = 'documents/' . (floor($cache_id / 1000)) . '/' . $cache_id; $cache_file = md5($query) . '.fields'; @@ -487,7 +490,7 @@ $row['field_value'] = (string)$row['field_value'] . (string)$row['field_value_more']; if ($values) - $row['field_value']=(isset($values[$row['rubric_field_id']]) ? $values[$row['rubric_field_id']] : $row['field_value']); + $row['field_value'] = (isset($values[$row['rubric_field_id']]) ? $values[$row['rubric_field_id']] : $row['field_value']); if ($row['field_value'] === '') { diff --git a/lib/debug/debug.js b/lib/debug/debug.js index 44d9389..7be7d3b 100644 --- a/lib/debug/debug.js +++ b/lib/debug/debug.js @@ -1,35 +1,77 @@ -$(document).ready(function() { +var Debug = { - $('#debug_btn').on('click', function() { + initialized: false, - $bar = $('#debug_bar'); + init: function () { - if ($bar.css('display') == 'none') { - $(document.body).css('overflow', 'hidden'); - $bar.show(); - } else { - $(document.body).css('overflow', ''); - $bar.hide(); - } + if (this.initialized) + return; - }); + this.initialized = true; - $('.debug_tabs > li').on('click', function() { - $('.debug_tabs > li').removeClass('selected'); - $('.debug_tab').hide(); - $(this).addClass('selected'); - $('#'+this.id+'-cont').show(); - if($.cookie){ - $.cookie('__debug_bar', this.id, {expires: 7, path: '/'}); - } - }); + this.build(); + this.events(); + }, + + build: function () { + this.debugCookie(); + }, + + events: function () { + this.debugButton(); + this.debugTabs(); + }, + + debugButton: function () { + $('#debug_btn').on('click', function(event) { + + event.preventDefault(); + + $bar = $('#debug_bar'); + + if ($bar.css('display') == 'none') { + $(document.body).css('overflow', 'hidden'); + $bar.show(); + } else { + $(document.body).css('overflow', 'inherit'); + $bar.hide(); + } + + }); + }, - if($.cookie){ - var id = $.cookie('__debug_bar'); - var tab = $('.debug_tabs > li#'+id); - if(tab.length > 0){ - tab.click(); + debugTabs: function () { + $('.debug_tabs > li').on('click', function(event) { + + event.preventDefault(); + + $('.debug_tabs > li').removeClass('selected'); + + $('.debug_tab').hide(); + + $(this).addClass('selected'); + + $('#' + this.id + '-cont').show(); + + if ($.cookie) { + $.cookie('__debug_bar', this.id, {expires: 7, path: '/'}); + } + }); + }, + + debugCookie: function () { + if ($.cookie) { + var id = $.cookie('__debug_bar'); + + var tab = $('.debug_tabs > li#' + id); + + if (tab.length > 0) { + tab.click(); + } } } +}; -}); //document.ready \ No newline at end of file +$(document).ready(function() { + Debug.init(); +}); \ No newline at end of file