-
Notifications
You must be signed in to change notification settings - Fork 1
/
jfox.php
244 lines (199 loc) · 7.58 KB
/
jfox.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<?php
/**
* @package JFox
* @author Emerson Rocha Luiz ([email protected])
* @copyright Copyright (C) 2005 - 2010 Webdesign Assessoria em Tecnologia da Informação LTDA.
* @license GNU General Public License version 2 or later;
*/
// no direct access
defined('_JEXEC') or die;
jimport('joomla.plugin.plugin');
/**
* JFox Plugin
*
* @package Joomla
* @subpackage JFox
*/
class plgSystemJFox extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @access protected
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.0
*/
function plgSystemJFox( &$subject, $config )
{
parent::__construct( $subject, $config );
// Do some extra initialisation in this constructor if required
}
/**
*Do something onAfterInitialize
*/
function onAfterInitialise()
{
$db =& JFactory::getDBO();
//$db->debug(1);
}
/**
* Do something onAfterRender
*/
function onAfterRender()
{
//load user info
$user =& JFactory::getUser();
$app =& JFactory::getApplication();
//Block non superadmins
if (!JFactory::getUser()->authorise('core.admin', 'plg_jfox'))
{
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
$document = JFactory::getDocument();
$doctype = $document->getType();
// Only render for HTML output
if ($doctype !== 'html') {
return;
}
// take body
if ($this->params->get('enable_jfox_frontend', 1) != 1 AND $app->isSite() ){
return;
}
if ($this->params->get('enable_jfox_backend', 1) != 1 AND $app->isAdmin() ){
return;
}
//load files
$joomlafoxcontent = NULL;
//jfox_general
if ($this->params->get('show_jfox_tab_general', 1) == 1){
include_once( JPATH_PLUGINS.DS.'system'.DS.'jfox'.DS.'general.php' );
$joomlafoxcontent .= $generalfox;
}
//jfox_system
if ($this->params->get('show_jfox_tab_system', 1) == 1){
include_once( JPATH_PLUGINS.DS.'system'.DS.'jfox'.DS.'system.php' );
$joomlafoxcontent .= $systemfox;
}
//jfox_page
if ($this->params->get('show_jfox_tab_page', 1) == 1){
include_once( JPATH_PLUGINS.DS.'system'.DS.'jfox'.DS.'page.php' );
$joomlafoxcontent .= $pagefox;
}
//jfox_queries
if ($this->params->get('show_jfox_tab_queries', 1) == 1){
include_once( JPATH_PLUGINS.DS.'system'.DS.'jfox'.DS.'queries.php' );
$joomlafoxcontent .= $queriesfox;
}
//jfox_form
if ($this->params->get('show_jfox_tab_request', 1) == 1){
include_once( JPATH_PLUGINS.DS.'system'.DS.'jfox'.DS.'request.php' );
$joomlafoxcontent .= $requestfox;
}
//jfox_permissions
if ($this->params->get('show_jfox_tab_permissions', 1) == 1){
include_once( JPATH_PLUGINS.DS.'system'.DS.'jfox'.DS.'permissions.php' );
$joomlafoxcontent .= $permissionsfox;
}
//jfox_php
if ($this->params->get('show_jfox_tab_jfoxconsole', 1) == 1){
include_once( JPATH_PLUGINS.DS.'system'.DS.'jfox'.DS.'php.php' );
$joomlafoxcontent .= $phpfox;
}
/*
if ($user->get('gid') == 25) { //if is superadmin load content
//check if is administrator or frontend
$app =& JFactory::getApplication();
$isbackend = $app->isAdmin();
//Load params
$params = &JComponentHelper::getParams( 'com_joomlafox' );
$disable_all = $params->get( 'disable_all' );
$enable_frontend = $params->get( 'enable_frontend' );
$enable_backend = $params->get( 'enable_backend' );
if ( !$disable_all == '1'){
if($isbackend AND !$enable_backend == '0') {
$showjoomlafox = TRUE;
} elseif (!$isbackend AND !$enable_frontend == '0') {
$showjoomlafox = TRUE;
}
}
if ($showjoomlafox) {
//Load params
$show_general = $params->get( 'show_general' );
$show_system = $params->get( 'show_system' );
$show_page = $params->get( 'show_page' );
$show_queries = $params->get( 'show_queries' );
$show_forms = $params->get( 'show_forms' );
$show_permissions = $params->get( 'show_permissions' );
$show_3rddeveloper = $params->get( 'show_3rddeveloper' );
$show_extras = $params->get( 'show_extras' );
$show_jfoxconsole = $params->get( 'show_jfoxconsole' );
//includes
if ($show_general == '1'){
include_once( JPATH_PLUGINS.DS.'system'.DS.'joomlafox'.DS.'general.php' );
}
if ($show_system == '1'){
include_once( JPATH_PLUGINS.DS.'system'.DS.'joomlafox'.DS.'system.php' );
}
if ($show_page == '1'){
include_once( JPATH_PLUGINS.DS.'system'.DS.'joomlafox'.DS.'page.php' );
}
if ($show_queries == '1'){
include_once( JPATH_PLUGINS.DS.'system'.DS.'joomlafox'.DS.'queries.php' );
}
if ($show_forms == '1'){
include_once( JPATH_PLUGINS.DS.'system'.DS.'joomlafox'.DS.'form.php' );
}
if ($show_permissions == '1'){
include_once( JPATH_PLUGINS.DS.'system'.DS.'joomlafox'.DS.'permissions.php' );
}
if ($show_3rddeveloper == '1'){
include_once( JPATH_PLUGINS.DS.'system'.DS.'joomlafox'.DS.'3rddeveloper.php' );
}
if ($show_extras == '1'){
include_once( JPATH_PLUGINS.DS.'system'.DS.'joomlafox'.DS.'extra.php' );
}
if ($show_jfoxconsole == '1'){
include_once( JPATH_PLUGINS.DS.'system'.DS.'joomlafox'.DS.'php.php' );
}
//include_once( JPATH_PLUGINS.DS.'system'.DS.'joomlafox'.DS.'nosuperadminuser.php' );
//General
$joomlafoxcontent .= $generalfox;
//system
$joomlafoxcontent .= $systemfox;
//system2
$joomlafoxcontent .= $systemfox;
//page
$joomlafoxcontent .= $pagefox;
//queries
$joomlafoxcontent .= $queriesfox;
//form
$joomlafoxcontent .= $requestfox;
//permissions
$joomlafoxcontent .= $permissionsfox;
//3rddeveloper
$joomlafoxcontent .= $developerfox;
//extras
$joomlafoxcontent .= $extrafox;
//php
$joomlafoxcontent .= $phpfox;
} else { //if is not superadmin
//General ( for non admin users
$joomlafoxcontent .= $nosuperadminuserfox;
}
//replace on on the html for output the tag </body> for ' + </body>'
$body = str_replace('</body>', $joomlafoxcontent .'</body>', $body);
JResponse::setBody($body);
}//if disable_all
*/
$body1 = JResponse::getBody();
//replace on on the html for output the tag </body> for ' + </body>'
$body = str_replace('</body>', $joomlafoxcontent .'</body>', $body1);
JResponse::setBody($body);
return true;
}
}