/
headers.inc.php
108 lines (100 loc) · 3.65 KB
/
headers.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* @author Black Cat Development
* @copyright 2014, Black Cat Development
* @link http://blackcat-cms.org
* @license http://www.gnu.org/licenses/gpl.html
* @category CAT_Core
* @package freshcat
*
*/
if (defined('CAT_PATH')) {
include(CAT_PATH.'/framework/class.secure.php');
} else {
$root = "../";
$level = 1;
while (($level < 10) && (!file_exists($root.'/framework/class.secure.php'))) {
$root .= "../";
$level += 1;
}
if (file_exists($root.'/framework/class.secure.php')) {
include($root.'/framework/class.secure.php');
} else {
trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
}
}
$local = array (
'pages' => 'backend_pages_modify.js',
'access' => 'backend_users_index.js',
'addons' => 'backend_addons.js',
'media' => 'backend_media.js',
'preferences' => 'backend_preferences.js',
'settings' => array('backend_pages_modify.js','backend_settings_index.js'),
'login_index' => 'login.js',
);
$mod_headers = array(
'backend' => array(
'meta' => array(
array( 'name' => 'viewport', 'content' => 'width=device-width, initial-scale=1' ),
),
'css' => array(
array(
'media' => 'screen',
'file' => 'templates/freshcat/css/default/index.css'
),
array(
'media' => 'screen',
'file' => 'modules/lib_jquery/plugins/qtip2/qtip2.min.css'
),
),
'jquery' => array(
array(
'core' => true,
'ui' => true,
'all' => array ( 'jquery.highlight', 'jquery.cookies', 'tag-it', 'qtip2', 'jquery.form' , 'jquery.livesearch' , 'jquery.smarttruncation', 'cattranslate' )
)
),
'js' => array(
array(
'debug.js', 'jquery.fc_set_tab_list.js', 'jquery.fc_toggle_element.js', 'jquery.fc_resize_elements.js', 'jquery.fc_show_popup.js', 'general.js', 'pages_tree.js', 'session.js',
)
)
)
);
// get current backend section to add local JS
$page = strtolower(CAT_Backend::getInstance()->section_name);
if(isset($local[$page]))
{
if(!is_array($local[$page])) $local[$page] = array($local[$page]);
$mod_headers['backend']['js'][0] = array_merge(
$mod_headers['backend']['js'][0],
$local[$page]
);
}
if($page=='addons')
{
array_push($mod_headers['backend']['css'], array('file'=>'templates/freshcat/css/default/tabs.css'));
if(CAT_Helper_Addons::isModuleInstalled('lib_dropzone'))
{
$mod_headers['backend']['js'][0][] = '/modules/lib_dropzone/vendor/dropzone.min.js';
array_push($mod_headers['backend']['css'], array('file'=>'modules/lib_dropzone/vendor/dropzone.min.css'));
}
array_push($mod_headers['backend']['css'], array('file'=>'templates/freshcat/css/default/addons.css'));
}
// check for custom JS for current backend page
if ( CAT_Registry::get('DEFAULT_THEME_VARIANT') == 'custom' )
if(file_exists(dirname(__FILE__).'/templates/custom/backend_'.$page.'.js'))
$mod_headers['backend']['js'][0][] = '/custom/backend_'.$page.'.js';