Completed
Push — master ( 3a6ebc...3a5a05 )
by Michael
04:13
created
xoops_trust_path/libs/altsys/mylangadmin.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@
 block discarded – undo
302 302
     'use_my_language' => strlen($langman->my_language) > 0,
303 303
     'mylang_file_name' => htmlspecialchars($mylang_unique_path, ENT_QUOTES),
304 304
     'cache_file_name' => htmlspecialchars($cache_file_name, ENT_QUOTES),
305
-     'cache_file_mtime' => (int)$cache_file_mtime,
305
+        'cache_file_mtime' => (int)$cache_file_mtime,
306 306
     'timezone_offset' => xoops_getUserTimestamp(0),
307 307
     'notice' => $notice4disp,
308 308
     'already_read' => $already_read,
Please login to merge, or discard this patch.
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -5,170 +5,170 @@  discard block
 block discarded – undo
5 5
 //                       GIJOE <http://www.peak.ne.jp/>                      //
6 6
 // ------------------------------------------------------------------------- //
7 7
 
8
-require_once __DIR__.'/class/AltsysBreadcrumbs.class.php' ;
9
-include_once __DIR__ . '/include/gtickets.php';
10
-include_once __DIR__.'/include/altsys_functions.php' ;
11
-include_once __DIR__.'/include/lang_functions.php' ;
12
-include_once __DIR__.'/class/D3LanguageManager.class.php' ;
8
+require_once __DIR__.'/class/AltsysBreadcrumbs.class.php';
9
+include_once __DIR__.'/include/gtickets.php';
10
+include_once __DIR__.'/include/altsys_functions.php';
11
+include_once __DIR__.'/include/lang_functions.php';
12
+include_once __DIR__.'/class/D3LanguageManager.class.php';
13 13
 
14 14
 
15 15
 // only groups have 'module_admin' of 'altsys' can do that.
16
-$module_handler = xoops_gethandler('module') ;
17
-$module =& $module_handler->getByDirname('altsys') ;
18
-if (! is_object($module)) {
19
-    die('install altsys') ;
16
+$module_handler = xoops_gethandler('module');
17
+$module = & $module_handler->getByDirname('altsys');
18
+if (!is_object($module)) {
19
+    die('install altsys');
20 20
 }
21
-$moduleperm_handler = xoops_gethandler('groupperm') ;
22
-if (! is_object(@$xoopsUser) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) {
23
-    die('only admin of altsys can access this area') ;
21
+$moduleperm_handler = xoops_gethandler('groupperm');
22
+if (!is_object(@$xoopsUser) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) {
23
+    die('only admin of altsys can access this area');
24 24
 }
25 25
 
26 26
 
27 27
 // initials
28 28
 $db = XoopsDatabaseFactory::getDatabaseConnection();
29
-(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance() ;
30
-$langman =& D3LanguageManager::getInstance() ;
29
+(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance();
30
+$langman = & D3LanguageManager::getInstance();
31 31
 
32 32
 // language file of this controller
33
-altsys_include_language_file('mylangadmin') ;
33
+altsys_include_language_file('mylangadmin');
34 34
 
35 35
 // check $xoopsModule
36
-if (! is_object($xoopsModule)) {
37
-    redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM) ;
36
+if (!is_object($xoopsModule)) {
37
+    redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM);
38 38
 }
39 39
 
40 40
 // set target_module if specified by $_GET['dirname']
41 41
 $module_handler = xoops_gethandler('module');
42
-if (! empty($_GET['dirname'])) {
43
-    $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']) ;
44
-    $target_module =& $module_handler->getByDirname($dirname) ;
42
+if (!empty($_GET['dirname'])) {
43
+    $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']);
44
+    $target_module = & $module_handler->getByDirname($dirname);
45 45
 }
46 46
 
47
-if (! empty($target_module) && is_object($target_module)) {
47
+if (!empty($target_module) && is_object($target_module)) {
48 48
     // specified by dirname (for langadmin as an independent module)
49
-    $target_mid = $target_module->getVar('mid') ;
50
-    $target_dirname = $target_module->getVar('dirname') ;
51
-    $target_dirname4sql = addslashes($target_dirname) ;
52
-    $target_mname = $target_module->getVar('name') . '&nbsp;' . sprintf('(%2.2f)', $target_module->getVar('version') / 100.0) ;
49
+    $target_mid = $target_module->getVar('mid');
50
+    $target_dirname = $target_module->getVar('dirname');
51
+    $target_dirname4sql = addslashes($target_dirname);
52
+    $target_mname = $target_module->getVar('name').'&nbsp;'.sprintf('(%2.2f)', $target_module->getVar('version') / 100.0);
53 53
     //$query4redirect = '?dirname='.urlencode(strip_tags($_GET['dirname'])) ;
54 54
 } else {
55 55
     // not specified by dirname (for 3rd party modules as mylangadmin)
56
-    $target_mid = $xoopsModule->getVar('mid') ;
57
-    $target_dirname = $xoopsModule->getVar('dirname') ;
58
-    $target_dirname4sql = addslashes($target_dirname) ;
59
-    $target_mname = $xoopsModule->getVar('name') ;
56
+    $target_mid = $xoopsModule->getVar('mid');
57
+    $target_dirname = $xoopsModule->getVar('dirname');
58
+    $target_dirname4sql = addslashes($target_dirname);
59
+    $target_mname = $xoopsModule->getVar('name');
60 60
     //$query4redirect = '' ;
61 61
 }
62 62
 
63 63
 // basic GET variables
64
-$target_lang = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['target_lang']) ;
64
+$target_lang = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['target_lang']);
65 65
 if (empty($target_lang)) {
66
-    $target_lang = $GLOBALS['xoopsConfig']['language'] ;
66
+    $target_lang = $GLOBALS['xoopsConfig']['language'];
67 67
 }
68
-$target_lang4sql = addslashes($target_lang) ;
69
-$target_file = preg_replace('/[^0-9a-zA-Z_.-]/', '', @$_GET['target_file']) ;
68
+$target_lang4sql = addslashes($target_lang);
69
+$target_file = preg_replace('/[^0-9a-zA-Z_.-]/', '', @$_GET['target_file']);
70 70
 if (empty($target_file)) {
71
-    $target_file = 'main.php' ;
71
+    $target_file = 'main.php';
72 72
 }
73 73
 
74 74
 // get $target_trustdirname
75
-$mytrustdirname = '' ;
75
+$mytrustdirname = '';
76 76
 if (file_exists(XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/mytrustdirname.php')) {
77
-    require XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/mytrustdirname.php' ;
77
+    require XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/mytrustdirname.php';
78 78
 }
79
-$target_trustdirname = $mytrustdirname ;
79
+$target_trustdirname = $mytrustdirname;
80 80
 
81 81
 // get base directory
82 82
 if (empty($target_trustdirname)) {
83 83
     // conventinal module
84
-    $base_dir = XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/language' ;
84
+    $base_dir = XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/language';
85 85
 } else {
86 86
     // D3 module
87
-    $base_dir = XOOPS_TRUST_PATH.'/modules/'.$target_trustdirname.'/language' ;
87
+    $base_dir = XOOPS_TRUST_PATH.'/modules/'.$target_trustdirname.'/language';
88 88
 }
89 89
 
90 90
 // make list of language and check $target_lang
91
-$languages = array() ;
92
-$languages4disp = array() ;
93
-if (! is_dir($base_dir)) {
94
-    altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODNOLANGUAGE) ;
91
+$languages = array();
92
+$languages4disp = array();
93
+if (!is_dir($base_dir)) {
94
+    altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODNOLANGUAGE);
95 95
 }
96
-$dh = opendir($base_dir) ;
96
+$dh = opendir($base_dir);
97 97
 if ($dh) {
98 98
     while ($file = readdir($dh)) {
99 99
         if (substr($file, 0, 1) == '.') {
100
-            continue ;
100
+            continue;
101 101
         }
102 102
         if (is_dir("$base_dir/$file")) {
103
-            list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('altsys_language_constants') . " WHERE mid=$target_mid AND language='" . addslashes($file) . "'")) ;
104
-            $languages[] = $file ;
105
-            $languages4disp[] = $file . " ($count)" ;
103
+            list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('altsys_language_constants')." WHERE mid=$target_mid AND language='".addslashes($file)."'"));
104
+            $languages[] = $file;
105
+            $languages4disp[] = $file." ($count)";
106 106
         }
107 107
     }
108 108
 }
109
-closedir($dh) ;
110
-if (! in_array($target_lang, $languages)) {
111
-    $target_lang = $languages[0] ;
109
+closedir($dh);
110
+if (!in_array($target_lang, $languages)) {
111
+    $target_lang = $languages[0];
112 112
 }
113 113
 
114 114
 // get base directory seleced language
115
-$lang_base_dir = $base_dir.'/'.$target_lang ;
116
-if (! is_dir($lang_base_dir)) {
117
-    altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODLANGINCOMPATIBLE) ;
115
+$lang_base_dir = $base_dir.'/'.$target_lang;
116
+if (!is_dir($lang_base_dir)) {
117
+    altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODLANGINCOMPATIBLE);
118 118
 }
119 119
 
120 120
 // make list of files and check $target_file
121
-$lang_files = array() ;
122
-$dh = opendir($lang_base_dir) ;
121
+$lang_files = array();
122
+$dh = opendir($lang_base_dir);
123 123
 if ($dh) {
124 124
     while ($file = readdir($dh)) {
125 125
         if (substr($file, 0, 1) == '.') {
126
-            continue ;
126
+            continue;
127 127
         }
128 128
         if ($file == 'index.html') {
129
-            continue ;
129
+            continue;
130 130
         }
131 131
     //if( $file == 'modinfo.php' ) continue ; // TODO(?)
132 132
     //if( $file == 'global.php' ) continue ; // TODO(?)
133 133
     if (is_file("$lang_base_dir/$file")) {
134
-        $lang_files[] = $file ;
134
+        $lang_files[] = $file;
135 135
     }
136 136
     }
137 137
 }
138
-closedir($dh) ;
138
+closedir($dh);
139 139
 if (empty($lang_files)) {
140
-    altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODEMPTYLANGDIR) ;
140
+    altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODEMPTYLANGDIR);
141 141
 }
142
-if (! in_array($target_file, $lang_files)) {
143
-    $target_file = $lang_files[0] ;
142
+if (!in_array($target_file, $lang_files)) {
143
+    $target_file = $lang_files[0];
144 144
 }
145 145
 
146 146
 // get unique path of language_file
147
-$langfile_unique_path = "$lang_base_dir/$target_file" ;
147
+$langfile_unique_path = "$lang_base_dir/$target_file";
148 148
 
149 149
 // get constants defined by the target_file
150
-list($langfile_names, $constpref, $already_read) = altsys_mylangadmin_get_constant_names($langfile_unique_path, $target_dirname) ;
150
+list($langfile_names, $constpref, $already_read) = altsys_mylangadmin_get_constant_names($langfile_unique_path, $target_dirname);
151 151
 
152 152
 // get user_values should be overridden
153
-$langfile_constants = array() ;
153
+$langfile_constants = array();
154 154
 foreach ($langfile_names as $name) {
155
-    list($value) = $db->fetchRow($db->query('SELECT value FROM ' . $db->prefix('altsys_language_constants') . " WHERE mid=$target_mid AND language='$target_lang4sql' AND name='" . addslashes($name) . "'")) ;
156
-    $langfile_constants[ $name ] = $value ;
155
+    list($value) = $db->fetchRow($db->query('SELECT value FROM '.$db->prefix('altsys_language_constants')." WHERE mid=$target_mid AND language='$target_lang4sql' AND name='".addslashes($name)."'"));
156
+    $langfile_constants[$name] = $value;
157 157
 }
158 158
 
159 159
 // constants defined in XOOPS_ROOT_PATH/my_language/(dirname)/...
160 160
 if ($langman->my_language) {
161
-    $mylang_unique_path = $langman->my_language.'/modules/'.$target_dirname.'/'.$target_lang.'/'.$target_file ;
162
-    $mylang_constants = array_map('htmlspecialchars', altsys_mylangadmin_get_constants_by_pcre($mylang_unique_path)) ;
161
+    $mylang_unique_path = $langman->my_language.'/modules/'.$target_dirname.'/'.$target_lang.'/'.$target_file;
162
+    $mylang_constants = array_map('htmlspecialchars', altsys_mylangadmin_get_constants_by_pcre($mylang_unique_path));
163 163
     foreach ($mylang_constants as $key => $val) {
164
-        if (! in_array($key, array_keys($langfile_constants))) {
165
-            $langfile_constants[ $key ] = null ;
166
-            define($key, _MYLANGADMIN_NOTE_ADDEDBYMYLANG) ;
164
+        if (!in_array($key, array_keys($langfile_constants))) {
165
+            $langfile_constants[$key] = null;
166
+            define($key, _MYLANGADMIN_NOTE_ADDEDBYMYLANG);
167 167
         }
168 168
     }
169 169
 } else {
170
-    $mylang_unique_path = '' ;
171
-    $mylang_constants = array() ;
170
+    $mylang_unique_path = '';
171
+    $mylang_constants = array();
172 172
 }
173 173
 
174 174
 
@@ -177,57 +177,57 @@  discard block
 block discarded – undo
177 177
 //
178 178
 
179 179
 // Update language table and cache file
180
-if (! empty($_POST['do_update'])) {
180
+if (!empty($_POST['do_update'])) {
181 181
     // Ticket Check
182
-    if (! $xoopsGTicket->check(true, 'altsys')) {
182
+    if (!$xoopsGTicket->check(true, 'altsys')) {
183 183
         redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
184 184
     }
185 185
 
186 186
     // read original file
187
-    $file_contents = file_get_contents($langfile_unique_path) ;
187
+    $file_contents = file_get_contents($langfile_unique_path);
188 188
 
189 189
     // insert fingerprint of langfile_unique_path
190
-    $langfile_fingerprint = '_MYLANGADMIN_'.md5($langfile_unique_path) ;
191
-    $file_contents = str_replace('<?php', "<?php\nif(!defined('$langfile_fingerprint'))define('$langfile_fingerprint',1);", $file_contents) ;
190
+    $langfile_fingerprint = '_MYLANGADMIN_'.md5($langfile_unique_path);
191
+    $file_contents = str_replace('<?php', "<?php\nif(!defined('$langfile_fingerprint'))define('$langfile_fingerprint',1);", $file_contents);
192 192
 
193 193
     // constants loop
194
-    $overrides_counter = 0 ;
194
+    $overrides_counter = 0;
195 195
     foreach (array_reverse($langfile_names) as $name) {
196
-        $user_value = $myts->stripSlashesGPC(@$_POST[$name]) ;
197
-        $db->query('DELETE FROM ' . $db->prefix('altsys_language_constants') . " WHERE mid=$target_mid AND language='$target_lang4sql' AND name='" . addslashes($name) . "'") ;
196
+        $user_value = $myts->stripSlashesGPC(@$_POST[$name]);
197
+        $db->query('DELETE FROM '.$db->prefix('altsys_language_constants')." WHERE mid=$target_mid AND language='$target_lang4sql' AND name='".addslashes($name)."'");
198 198
         if ($user_value !== '') {
199
-            $overrides_counter ++ ;
199
+            $overrides_counter++;
200 200
             // Update table
201
-            $db->query('INSERT INTO ' . $db->prefix('altsys_language_constants') . " (mid,language,name,value) VALUES ($target_mid,'$target_lang4sql','" . addslashes($name) . "','" . addslashes($user_value) . "')") ;
201
+            $db->query('INSERT INTO '.$db->prefix('altsys_language_constants')." (mid,language,name,value) VALUES ($target_mid,'$target_lang4sql','".addslashes($name)."','".addslashes($user_value)."')");
202 202
             // rewrite script for cache
203 203
             // comment-out the line of define()
204 204
             if (empty($constpref)) {
205
-                $from = '/.*define\s?\(\s*(["\'])'.preg_quote($name).'(\\1).*\;.*/' ;
205
+                $from = '/.*define\s?\(\s*(["\'])'.preg_quote($name).'(\\1).*\;.*/';
206 206
             } else {
207
-                $from = '/.*define\s?\(\s*\$constpref\s*\.\s*(["\'])'.preg_quote(substr($name, strlen($constpref))).'(\\1).*\;.*/' ;
207
+                $from = '/.*define\s?\(\s*\$constpref\s*\.\s*(["\'])'.preg_quote(substr($name, strlen($constpref))).'(\\1).*\;.*/';
208 208
             }
209
-            $to = '//$0'."\ndefine('".addslashes($name)."','".addslashes($user_value)."');" ;
210
-            $file_contents = preg_replace($from, $to, $file_contents) ;
209
+            $to = '//$0'."\ndefine('".addslashes($name)."','".addslashes($user_value)."');";
210
+            $file_contents = preg_replace($from, $to, $file_contents);
211 211
         }
212 212
     }
213 213
 
214 214
     // get the file name for caching
215
-    $cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang) ;
215
+    $cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang);
216 216
 
217 217
     // Create language cache file
218 218
     if ($overrides_counter > 0) {
219
-        $fp = fopen($cache_file_name, 'wb') ;
220
-        if (! $fp) {
221
-            die('Invalid Cache Directory. (Set XOOPS_TRUST_PATH/cache writable)') ;
219
+        $fp = fopen($cache_file_name, 'wb');
220
+        if (!$fp) {
221
+            die('Invalid Cache Directory. (Set XOOPS_TRUST_PATH/cache writable)');
222 222
         }
223
-        fwrite($fp, $file_contents) ;
224
-        fclose($fp) ;
223
+        fwrite($fp, $file_contents);
224
+        fclose($fp);
225 225
     } else {
226
-        unlink($cache_file_name) ;
226
+        unlink($cache_file_name);
227 227
     }
228 228
 
229
-    redirect_header('?mode=admin&lib=altsys&page=mylangadmin&dirname='.$target_dirname.'&target_lang='.rawurlencode($target_lang).'&target_file='.rawurlencode($target_file), 1, _MYLANGADMIN_CACHEUPDATED) ;
230
-    exit ;
229
+    redirect_header('?mode=admin&lib=altsys&page=mylangadmin&dirname='.$target_dirname.'&target_lang='.rawurlencode($target_lang).'&target_file='.rawurlencode($target_file), 1, _MYLANGADMIN_CACHEUPDATED);
230
+    exit;
231 231
 }
232 232
 
233 233
 
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 //
237 237
 
238 238
 // check cache file
239
-$cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang) ;
240
-$cache_file_mtime = file_exists($cache_file_name) ? filemtime($cache_file_name) : 0 ;
239
+$cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang);
240
+$cache_file_mtime = file_exists($cache_file_name) ? filemtime($cache_file_name) : 0;
241 241
 
242 242
 // check core version and generate message to enable D3LanguageManager
243 243
 if (altsys_get_core_type() == ALTSYS_CORE_TYPE_XCL21) {
244 244
     // XoopsCube Legacy without preload
245 245
     if (class_exists('AltsysLangMgr_LanguageManager')) {
246 246
         // the preload enabled
247
-        $notice4disp = _MYLANGADMIN_MSG_D3LANGMANENABLED ;
247
+        $notice4disp = _MYLANGADMIN_MSG_D3LANGMANENABLED;
248 248
     } else {
249 249
         // the preload disabled
250
-        $notice4disp = sprintf(_MYLANGADMIN_FMT_HOWTOENABLED3LANGMAN4XCL, 'SetupAltsysLangMgr.class.php', 'XOOPS_ROOT_PATH/preload') ;
250
+        $notice4disp = sprintf(_MYLANGADMIN_FMT_HOWTOENABLED3LANGMAN4XCL, 'SetupAltsysLangMgr.class.php', 'XOOPS_ROOT_PATH/preload');
251 251
     }
252 252
 } else {
253 253
     // X2 core etc.
254
-    $notice4disp = _MYLANGADMIN_MSG_HOWTOENABLED3LANGMAN4X2.'<br />' ;
254
+    $notice4disp = _MYLANGADMIN_MSG_HOWTOENABLED3LANGMAN4X2.'<br />';
255 255
     $notice4disp .= '
256 256
 		<h4>include/common.php</h4>
257 257
 		<pre>
@@ -275,20 +275,20 @@  discard block
 block discarded – undo
275 275
 //
276 276
 
277 277
 
278
-xoops_cp_header() ;
278
+xoops_cp_header();
279 279
 
280 280
 // mymenu
281
-altsys_include_mymenu() ;
281
+altsys_include_mymenu();
282 282
 
283 283
 // breadcrumbs
284
-$breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ;
284
+$breadcrumbsObj = & AltsysBreadcrumbs::getInstance();
285 285
 if ($breadcrumbsObj->hasPaths()) {
286
-    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN) ;
287
-    $breadcrumbsObj->appendPath('', $target_mname) ;
286
+    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN);
287
+    $breadcrumbsObj->appendPath('', $target_mname);
288 288
 }
289 289
 
290
-require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ;
291
-$tpl = new D3Tpl() ;
290
+require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php';
291
+$tpl = new D3Tpl();
292 292
 $tpl->assign(array(
293 293
     'target_dirname' => $target_dirname,
294 294
     'target_mname' => $target_mname,
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
     'notice' => $notice4disp,
308 308
     'already_read' => $already_read,
309 309
     'gticket_hidden' => $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'altsys')
310
-)) ;
311
-$tpl->display('db:altsys_main_mylangadmin.html') ;
310
+));
311
+$tpl->display('db:altsys_main_mylangadmin.html');
312 312
 
313
-xoops_cp_footer() ;
314
-exit ;
313
+xoops_cp_footer();
314
+exit;
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/x20_keepblockoptions.inc.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
 
4 4
 // Keep Block option values when update (by nobunobu) for XOOPS 2.0.x
5 5
 global $xoopsDB;
6
-$query = 'SELECT mid FROM ' . $xoopsDB->prefix('modules') . " WHERE dirname='" . $modversion['dirname'] . "' ";
6
+$query = 'SELECT mid FROM '.$xoopsDB->prefix('modules')." WHERE dirname='".$modversion['dirname']."' ";
7 7
 $result = $xoopsDB->query($query);
8
-$record= $xoopsDB->fetcharray($result);
8
+$record = $xoopsDB->fetcharray($result);
9 9
 if ($record) {
10 10
     $mid = $record['mid'];
11 11
     $count = count($modversion['blocks']);
@@ -53,40 +53,40 @@  discard block
 block discarded – undo
53 53
         }
54 54
     } */
55 55
     
56
-    $sql = 'SELECT * FROM ' . $xoopsDB->prefix('newblocks') . ' WHERE mid=' . $mid . " AND block_type <>'D' AND func_num > $count";
56
+    $sql = 'SELECT * FROM '.$xoopsDB->prefix('newblocks').' WHERE mid='.$mid." AND block_type <>'D' AND func_num > $count";
57 57
     $fresult = $xoopsDB->query($sql);
58 58
     while ($fblock = $xoopsDB->fetchArray($fresult)) {
59
-        $local_msgs[] = 'Non Defined Block <b>' . $fblock['name'] . '</b> will be deleted';
60
-        $sql = 'DELETE FROM ' . $xoopsDB->prefix('newblocks') . " WHERE bid='" . $fblock['bid'] . "'";
59
+        $local_msgs[] = 'Non Defined Block <b>'.$fblock['name'].'</b> will be deleted';
60
+        $sql = 'DELETE FROM '.$xoopsDB->prefix('newblocks')." WHERE bid='".$fblock['bid']."'";
61 61
         $iret = $xoopsDB->query($sql);
62 62
     }
63 63
     
64
-    for ($i = 1 ; $i <= $count ; $i++) {
65
-        $sql = 'SELECT name,options FROM ' . $xoopsDB->prefix('newblocks') . ' WHERE mid=' . $mid . ' AND func_num=' . $i . " AND show_func='" . addslashes($modversion['blocks'][$i]['show_func']) . "' AND func_file='" . addslashes($modversion['blocks'][$i]['file']) . "'";
64
+    for ($i = 1; $i <= $count; $i++) {
65
+        $sql = 'SELECT name,options FROM '.$xoopsDB->prefix('newblocks').' WHERE mid='.$mid.' AND func_num='.$i." AND show_func='".addslashes($modversion['blocks'][$i]['show_func'])."' AND func_file='".addslashes($modversion['blocks'][$i]['file'])."'";
66 66
         $fresult = $xoopsDB->query($sql);
67 67
         $fblock = $xoopsDB->fetchArray($fresult);
68 68
         if (isset($fblock['options'])) {
69
-            $old_vals=explode('|', $fblock['options']);
70
-            $def_vals=explode('|', $modversion['blocks'][$i]['options']);
69
+            $old_vals = explode('|', $fblock['options']);
70
+            $def_vals = explode('|', $modversion['blocks'][$i]['options']);
71 71
             if (count($old_vals) == count($def_vals)) {
72 72
                 $modversion['blocks'][$i]['options'] = $fblock['options'];
73
-                $local_msgs[] = "Option's values of the block <b>".$fblock['name'] . '</b> will be kept. (value = <b>' . $fblock['options'] . '</b>)';
73
+                $local_msgs[] = "Option's values of the block <b>".$fblock['name'].'</b> will be kept. (value = <b>'.$fblock['options'].'</b>)';
74 74
             } elseif (count($old_vals) < count($def_vals)) {
75
-                for ($j=0; $j < count($old_vals); $j++) {
75
+                for ($j = 0; $j < count($old_vals); $j++) {
76 76
                     $def_vals[$j] = $old_vals[$j];
77 77
                 }
78 78
                 $modversion['blocks'][$i]['options'] = implode('|', $def_vals);
79
-                $local_msgs[] = "Option's values of the block <b>".$fblock['name'] . '</b> will be kept and new option(s) are added. (value = <b>' . $modversion['blocks'][$i]['options'] . '</b>)';
79
+                $local_msgs[] = "Option's values of the block <b>".$fblock['name'].'</b> will be kept and new option(s) are added. (value = <b>'.$modversion['blocks'][$i]['options'].'</b>)';
80 80
             } else {
81
-                $local_msgs[] = "Option's values of the block <b>".$fblock['name'] . '</b> will be reset to the default, because of some decrease of options. (value = <b>'
82
-                                . $modversion['blocks'][$i]['options'] . '</b>)';
81
+                $local_msgs[] = "Option's values of the block <b>".$fblock['name'].'</b> will be reset to the default, because of some decrease of options. (value = <b>'
82
+                                . $modversion['blocks'][$i]['options'].'</b>)';
83 83
             }
84 84
         }
85 85
     }
86 86
 }
87 87
 
88
-global $msgs , $myblocksadmin_parsed_updateblock ;
89
-if (! empty($msgs) && ! empty($local_msgs) && empty($myblocksadmin_parsed_updateblock)) {
90
-    $msgs = array_merge($msgs, $local_msgs) ;
91
-    $myblocksadmin_parsed_updateblock = true ;
88
+global $msgs, $myblocksadmin_parsed_updateblock;
89
+if (!empty($msgs) && !empty($local_msgs) && empty($myblocksadmin_parsed_updateblock)) {
90
+    $msgs = array_merge($msgs, $local_msgs);
91
+    $myblocksadmin_parsed_updateblock = true;
92 92
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/tpls_functions.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 
61 61
     // get tplfile and tplsource
62 62
     $result = $db->query("SELECT tpl_refid,tpl_module,'".addslashes($tplset_to)."',tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type,tpl_source FROM ".$db->prefix('tplfile') . ' NATURAL LEFT JOIN '
63
-                         . $db->prefix('tplsource') . " WHERE tpl_tplset='" . addslashes($tplset_from) . "' AND ($whr_append)") ;
63
+                            . $db->prefix('tplsource') . " WHERE tpl_tplset='" . addslashes($tplset_from) . "' AND ($whr_append)") ;
64 64
 
65 65
     while ($row = $db->fetchArray($result)) {
66 66
         $tpl_source = array_pop($row) ;
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,41 +1,41 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 include_once XOOPS_ROOT_PATH.'/class/template.php';
4
-include_once __DIR__.'/altsys_functions.php' ;
4
+include_once __DIR__.'/altsys_functions.php';
5 5
 
6 6
 function tplsadmin_import_data($tplset, $tpl_file, $tpl_source, $lastmodified = 0)
7 7
 {
8
-    $db = XoopsDatabaseFactory::getDatabaseConnection() ;
8
+    $db = XoopsDatabaseFactory::getDatabaseConnection();
9 9
 
10 10
     // check the file is valid template
11
-    list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes($tpl_file) . "'")) ;
12
-    if (! $count) {
13
-        return false ;
11
+    list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='default' AND tpl_file='".addslashes($tpl_file)."'"));
12
+    if (!$count) {
13
+        return false;
14 14
     }
15 15
 
16 16
     // check the template exists in the tplset
17 17
     if ($tplset != 'default') {
18
-        list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset) . "' AND tpl_file='" . addslashes($tpl_file) . "'")) ;
18
+        list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset)."' AND tpl_file='".addslashes($tpl_file)."'"));
19 19
         if ($count <= 0) {
20 20
             // copy from 'default' to the tplset
21
-            $result = $db->query('SELECT * FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes($tpl_file) . "'") ;
21
+            $result = $db->query('SELECT * FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='default' AND tpl_file='".addslashes($tpl_file)."'");
22 22
             while ($row = $db->fetchArray($result)) {
23
-                $db->queryF('INSERT INTO ' . $db->prefix('tplfile') . " SET tpl_refid='" . addslashes($row['tpl_refid']) . "',tpl_module='" . addslashes($row['tpl_module']) . "',tpl_tplset='" . addslashes($tplset) . "',tpl_file='" . addslashes($tpl_file) . "',tpl_desc='" . addslashes($row['tpl_desc']) . "',tpl_type='" . addslashes($row['tpl_type']) . "'") ;
24
-                $tpl_id = $db->getInsertId() ;
25
-                $db->queryF('INSERT INTO ' . $db->prefix('tplsource') . " SET tpl_id='$tpl_id', tpl_source=''") ;
23
+                $db->queryF('INSERT INTO '.$db->prefix('tplfile')." SET tpl_refid='".addslashes($row['tpl_refid'])."',tpl_module='".addslashes($row['tpl_module'])."',tpl_tplset='".addslashes($tplset)."',tpl_file='".addslashes($tpl_file)."',tpl_desc='".addslashes($row['tpl_desc'])."',tpl_type='".addslashes($row['tpl_type'])."'");
24
+                $tpl_id = $db->getInsertId();
25
+                $db->queryF('INSERT INTO '.$db->prefix('tplsource')." SET tpl_id='$tpl_id', tpl_source=''");
26 26
             }
27 27
         }
28 28
     }
29 29
 
30 30
     // UPDATE just tpl_lastmodified and tpl_source
31
-    $drs = $db->query('SELECT tpl_id FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset) . "' AND tpl_file='" . addslashes($tpl_file) . "'") ;
31
+    $drs = $db->query('SELECT tpl_id FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset)."' AND tpl_file='".addslashes($tpl_file)."'");
32 32
     while (list($tpl_id) = $db->fetchRow($drs)) {
33
-        $db->queryF('UPDATE ' . $db->prefix('tplfile') . " SET tpl_lastmodified='" . addslashes($lastmodified) . "',tpl_lastimported=UNIX_TIMESTAMP() WHERE tpl_id='$tpl_id'") ;
34
-        $db->queryF('UPDATE ' . $db->prefix('tplsource') . " SET tpl_source='" . addslashes($tpl_source) . "' WHERE tpl_id='$tpl_id'") ;
35
-        altsys_template_touch($tpl_id) ;
33
+        $db->queryF('UPDATE '.$db->prefix('tplfile')." SET tpl_lastmodified='".addslashes($lastmodified)."',tpl_lastimported=UNIX_TIMESTAMP() WHERE tpl_id='$tpl_id'");
34
+        $db->queryF('UPDATE '.$db->prefix('tplsource')." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'");
35
+        altsys_template_touch($tpl_id);
36 36
     }
37 37
 
38
-    return true ;
38
+    return true;
39 39
 }
40 40
 
41 41
 
@@ -43,46 +43,46 @@  discard block
 block discarded – undo
43 43
 
44 44
 function tplsadmin_get_fingerprint($lines)
45 45
 {
46
-    $str = '' ;
46
+    $str = '';
47 47
     foreach ($lines as $line) {
48 48
         if (trim($line)) {
49
-            $str .= md5(trim($line)) ;
49
+            $str .= md5(trim($line));
50 50
         }
51 51
     }
52
-    return md5($str) ;
52
+    return md5($str);
53 53
 }
54 54
 
55 55
 
56 56
 
57 57
 function tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, $whr_append = '1')
58 58
 {
59
-    global $db ;
59
+    global $db;
60 60
 
61 61
     // get tplfile and tplsource
62
-    $result = $db->query("SELECT tpl_refid,tpl_module,'".addslashes($tplset_to)."',tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type,tpl_source FROM ".$db->prefix('tplfile') . ' NATURAL LEFT JOIN '
63
-                         . $db->prefix('tplsource') . " WHERE tpl_tplset='" . addslashes($tplset_from) . "' AND ($whr_append)") ;
62
+    $result = $db->query("SELECT tpl_refid,tpl_module,'".addslashes($tplset_to)."',tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type,tpl_source FROM ".$db->prefix('tplfile').' NATURAL LEFT JOIN '
63
+                         . $db->prefix('tplsource')." WHERE tpl_tplset='".addslashes($tplset_from)."' AND ($whr_append)");
64 64
 
65 65
     while ($row = $db->fetchArray($result)) {
66
-        $tpl_source = array_pop($row) ;
66
+        $tpl_source = array_pop($row);
67 67
 
68
-        $drs = $db->query('SELECT tpl_id FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset_to) . "' AND ($whr_append) AND tpl_file='" . addslashes($row['tpl_file']) . "' AND tpl_refid='" . addslashes($row['tpl_refid']) . "'") ;
68
+        $drs = $db->query('SELECT tpl_id FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset_to)."' AND ($whr_append) AND tpl_file='".addslashes($row['tpl_file'])."' AND tpl_refid='".addslashes($row['tpl_refid'])."'");
69 69
 
70
-        if (! $db->getRowsNum($drs)) {
70
+        if (!$db->getRowsNum($drs)) {
71 71
             // INSERT mode
72
-            $sql = 'INSERT INTO ' . $db->prefix('tplfile') . ' (tpl_refid,tpl_module,tpl_tplset,tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type) VALUES (';
72
+            $sql = 'INSERT INTO '.$db->prefix('tplfile').' (tpl_refid,tpl_module,tpl_tplset,tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type) VALUES (';
73 73
             foreach ($row as $colval) {
74
-                $sql .= "'".addslashes($colval)."'," ;
74
+                $sql .= "'".addslashes($colval)."',";
75 75
             }
76
-            $db->query(substr($sql, 0, -1) . ')') ;
77
-            $tpl_id = $db->getInsertId() ;
78
-            $db->query('INSERT INTO ' . $db->prefix('tplsource') . " SET tpl_id='$tpl_id', tpl_source='" . addslashes($tpl_source) . "'") ;
79
-            altsys_template_touch($tpl_id) ;
76
+            $db->query(substr($sql, 0, -1).')');
77
+            $tpl_id = $db->getInsertId();
78
+            $db->query('INSERT INTO '.$db->prefix('tplsource')." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'");
79
+            altsys_template_touch($tpl_id);
80 80
         } else {
81 81
             while (list($tpl_id) = $db->fetchRow($drs)) {
82 82
                 // UPDATE mode
83
-                $db->query('UPDATE ' . $db->prefix('tplfile') . " SET tpl_refid='" . addslashes($row['tpl_refid']) . "',tpl_desc='" . addslashes($row['tpl_desc']) . "',tpl_lastmodified='" . addslashes($row['tpl_lastmodified']) . "',tpl_lastimported='" . addslashes($row['tpl_lastimported']) . "',tpl_type='" . addslashes($row['tpl_type']) . "' WHERE tpl_id='$tpl_id'") ;
84
-                $db->query('UPDATE ' . $db->prefix('tplsource') . " SET tpl_source='" . addslashes($tpl_source) . "' WHERE tpl_id='$tpl_id'") ;
85
-                altsys_template_touch($tpl_id) ;
83
+                $db->query('UPDATE '.$db->prefix('tplfile')." SET tpl_refid='".addslashes($row['tpl_refid'])."',tpl_desc='".addslashes($row['tpl_desc'])."',tpl_lastmodified='".addslashes($row['tpl_lastmodified'])."',tpl_lastimported='".addslashes($row['tpl_lastimported'])."',tpl_type='".addslashes($row['tpl_type'])."' WHERE tpl_id='$tpl_id'");
84
+                $db->query('UPDATE '.$db->prefix('tplsource')." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'");
85
+                altsys_template_touch($tpl_id);
86 86
             }
87 87
         }
88 88
     }
@@ -92,31 +92,31 @@  discard block
 block discarded – undo
92 92
 
93 93
 function tplsadmin_copy_templates_f2db($tplset_to, $whr_append = '1')
94 94
 {
95
-    global $db ;
95
+    global $db;
96 96
 
97 97
     // get tplsource
98
-    $result = $db->query('SELECT * FROM ' . $db->prefix('tplfile') . "  WHERE tpl_tplset='default' AND ($whr_append)") ;
98
+    $result = $db->query('SELECT * FROM '.$db->prefix('tplfile')."  WHERE tpl_tplset='default' AND ($whr_append)");
99 99
 
100 100
     while ($row = $db->fetchArray($result)) {
101
-        $basefilepath = tplsadmin_get_basefilepath($row['tpl_module'], $row['tpl_type'], $row['tpl_file']) ;
102
-        $tpl_source = rtrim(implode('', file($basefilepath))) ;
103
-        $lastmodified = filemtime($basefilepath) ;
101
+        $basefilepath = tplsadmin_get_basefilepath($row['tpl_module'], $row['tpl_type'], $row['tpl_file']);
102
+        $tpl_source = rtrim(implode('', file($basefilepath)));
103
+        $lastmodified = filemtime($basefilepath);
104 104
 
105
-        $drs = $db->query('SELECT tpl_id FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset_to) . "' AND ($whr_append) AND tpl_file='" . addslashes($row['tpl_file']) . "' AND tpl_refid='" . addslashes($row['tpl_refid']) . "'") ;
105
+        $drs = $db->query('SELECT tpl_id FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset_to)."' AND ($whr_append) AND tpl_file='".addslashes($row['tpl_file'])."' AND tpl_refid='".addslashes($row['tpl_refid'])."'");
106 106
 
107
-        if (! $db->getRowsNum($drs)) {
107
+        if (!$db->getRowsNum($drs)) {
108 108
             // INSERT mode
109
-            $sql = 'INSERT INTO ' . $db->prefix('tplfile') . " SET tpl_refid='" . addslashes($row['tpl_refid']) . "',tpl_desc='" . addslashes($row['tpl_desc']) . "',tpl_lastmodified='" . addslashes($lastmodified) . "',tpl_type='" . addslashes($row['tpl_type']) . "',tpl_tplset='" . addslashes($tplset_to) . "',tpl_file='" . addslashes($row['tpl_file']) . "',tpl_module='" . addslashes($row['tpl_module']) . "'" ;
110
-            $db->query($sql) ;
111
-            $tpl_id = $db->getInsertId() ;
112
-            $db->query('INSERT INTO ' . $db->prefix('tplsource') . " SET tpl_id='$tpl_id', tpl_source='" . addslashes($tpl_source) . "'") ;
113
-            altsys_template_touch($tpl_id) ;
109
+            $sql = 'INSERT INTO '.$db->prefix('tplfile')." SET tpl_refid='".addslashes($row['tpl_refid'])."',tpl_desc='".addslashes($row['tpl_desc'])."',tpl_lastmodified='".addslashes($lastmodified)."',tpl_type='".addslashes($row['tpl_type'])."',tpl_tplset='".addslashes($tplset_to)."',tpl_file='".addslashes($row['tpl_file'])."',tpl_module='".addslashes($row['tpl_module'])."'";
110
+            $db->query($sql);
111
+            $tpl_id = $db->getInsertId();
112
+            $db->query('INSERT INTO '.$db->prefix('tplsource')." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'");
113
+            altsys_template_touch($tpl_id);
114 114
         } else {
115 115
             while (list($tpl_id) = $db->fetchRow($drs)) {
116 116
                 // UPDATE mode
117
-                $db->query('UPDATE ' . $db->prefix('tplfile') . " SET tpl_lastmodified='" . addslashes($lastmodified) . "' WHERE tpl_id='$tpl_id'") ;
118
-                $db->query('UPDATE ' . $db->prefix('tplsource') . " SET tpl_source='" . addslashes($tpl_source) . "' WHERE tpl_id='$tpl_id'") ;
119
-                altsys_template_touch($tpl_id) ;
117
+                $db->query('UPDATE '.$db->prefix('tplfile')." SET tpl_lastmodified='".addslashes($lastmodified)."' WHERE tpl_id='$tpl_id'");
118
+                $db->query('UPDATE '.$db->prefix('tplsource')." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'");
119
+                altsys_template_touch($tpl_id);
120 120
             }
121 121
         }
122 122
     }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 function tplsadmin_get_basefilepath($dirname, $type, $tpl_file)
128 128
 {
129 129
     // module instance
130
-    $path = $basefilepath = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates/'.($type=='block'?'blocks/':'').$tpl_file ;
130
+    $path = $basefilepath = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates/'.($type == 'block' ? 'blocks/' : '').$tpl_file;
131 131
 
132 132
     if (is_callable('Legacy_Utils::getTrustDirnameByDirname')) {
133 133
         $mytrustdirname = Legacy_Utils::getTrustDirnameByDirname($dirname);
@@ -135,33 +135,33 @@  discard block
 block discarded – undo
135 135
 
136 136
     if (defined('ALTSYS_TPLSADMIN_BASEPATH')) {
137 137
         // Special hook
138
-        $path = ALTSYS_TPLSADMIN_BASEPATH.'/'.substr($tpl_file, strlen($dirname) + 1) ;
138
+        $path = ALTSYS_TPLSADMIN_BASEPATH.'/'.substr($tpl_file, strlen($dirname) + 1);
139 139
     } elseif ($mytrustdirname || @include(XOOPS_ROOT_PATH.'/modules/'.$dirname.'/mytrustdirname.php')) {
140 140
         // D3 module base
141
-        if (! empty($mytrustdirname)) {
142
-            $mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/' ;
141
+        if (!empty($mytrustdirname)) {
142
+            $mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/';
143 143
 
144
-            $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').substr($tpl_file, strlen($dirname) + 1) ;
144
+            $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type == 'block' ? 'blocks/' : '').substr($tpl_file, strlen($dirname) + 1);
145 145
             //new for xcck etc.other trust_module
146
-            if (! file_exists($path)) {
147
-                $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').$tpl_file ;
148
-                if (! file_exists($path)) {
146
+            if (!file_exists($path)) {
147
+                $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type == 'block' ? 'blocks/' : '').$tpl_file;
148
+                if (!file_exists($path)) {
149 149
                     $path = $basefilepath;
150 150
                 }
151 151
             }
152 152
         }
153 153
     }
154 154
 
155
-    return $path ;
155
+    return $path;
156 156
 }
157 157
 
158 158
 
159 159
 function tplsadmin_die($msg, $target_dirname = '', $wait = 2)
160 160
 {
161 161
     if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') {
162
-        redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, $wait, $msg) ;
163
-        exit ;
162
+        redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, $wait, $msg);
163
+        exit;
164 164
     } else {
165
-        die($msg) ;
165
+        die($msg);
166 166
     }
167 167
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/admin_in_theme.inc.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,29 +2,29 @@
 block discarded – undo
2 2
 
3 3
 // render admin in theme.html
4 4
 if (is_object($xoopsUser)) {
5
-    $xoops_subpath = substr($_SERVER['REQUEST_URI'], strpos(strrev(XOOPS_URL), strrev($_SERVER['HTTP_HOST']))) ;
5
+    $xoops_subpath = substr($_SERVER['REQUEST_URI'], strpos(strrev(XOOPS_URL), strrev($_SERVER['HTTP_HOST'])));
6 6
     if (preg_match('#(^/admin.php|^/modules/system/|^/modules/[a-zA-Z0-9_.-]+/admin/)#', $xoops_subpath)) {
7 7
         // The request looks like admin
8
-        require_once __DIR__.'/altsys_functions.php' ;
9
-        if (! empty($GLOBALS['altsysModuleConfig']['admin_in_theme']) && file_exists(XOOPS_THEME_PATH.'/'.$GLOBALS['altsysModuleConfig']['admin_in_theme'].'/theme.html')) {
8
+        require_once __DIR__.'/altsys_functions.php';
9
+        if (!empty($GLOBALS['altsysModuleConfig']['admin_in_theme']) && file_exists(XOOPS_THEME_PATH.'/'.$GLOBALS['altsysModuleConfig']['admin_in_theme'].'/theme.html')) {
10 10
             // configs OK
11
-            require_once __DIR__.'/admin_in_theme_functions.php' ;
11
+            require_once __DIR__.'/admin_in_theme_functions.php';
12 12
 
13 13
             // for security with register_globals=1
14
-            unset($GLOBALS['altsysAdminPageTitle'], /* $GLOBALS['altsysXoopsBreadcrumbs'] ,*/ $GLOBALS['xoops_admin_contents']) ;
14
+            unset($GLOBALS['altsysAdminPageTitle'], /* $GLOBALS['altsysXoopsBreadcrumbs'] ,*/ $GLOBALS['xoops_admin_contents']);
15 15
 
16 16
             // disable error handler without XOOPS 2.0.14/15/16
17
-            if (! (is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array( 1, 2 )))) {
18
-                restore_error_handler() ;
17
+            if (!(is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array(1, 2)))) {
18
+                restore_error_handler();
19 19
             }
20 20
 
21 21
             // to prepend Notice with 2.0.14/15/16 with PHP4
22
-            if (! defined('E_STRICT')) {
23
-                define('E_STRICT', 2048) ;
22
+            if (!defined('E_STRICT')) {
23
+                define('E_STRICT', 2048);
24 24
             }
25 25
 
26
-            register_shutdown_function('altsys_admin_in_theme_in_last') ;
27
-            ob_start('altsys_admin_in_theme') ;
26
+            register_shutdown_function('altsys_admin_in_theme_in_last');
27
+            ob_start('altsys_admin_in_theme');
28 28
         }
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/admin_in_theme_functions.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -2,94 +2,94 @@  discard block
 block discarded – undo
2 2
 
3 3
 function altsys_admin_in_theme($s)
4 4
 {
5
-    global $xoops_admin_contents ;
5
+    global $xoops_admin_contents;
6 6
 
7
-    $xoops_admin_contents = '' ;
7
+    $xoops_admin_contents = '';
8 8
 
9 9
     if (defined('ALTSYS_DONT_USE_ADMIN_IN_THEME')) {
10
-        return $s ;
10
+        return $s;
11 11
     }
12 12
 
13 13
     // check whether cp_functions.php is loaded
14
-    if (! defined('XOOPS_CPFUNC_LOADED')) {
15
-        define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ;
16
-        return $s ;
14
+    if (!defined('XOOPS_CPFUNC_LOADED')) {
15
+        define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1);
16
+        return $s;
17 17
     }
18 18
 
19 19
     // redirect
20 20
     if (strstr($s, '<meta http-equiv="Refresh" ')) {
21
-        define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ;
22
-        return $s ;
21
+        define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1);
22
+        return $s;
23 23
     }
24 24
 
25 25
     // outputs before cp_header()
26
-    @list($former_outputs, $tmp_s) = explode('<!DOCTYPE', $s, 2) ;
26
+    @list($former_outputs, $tmp_s) = explode('<!DOCTYPE', $s, 2);
27 27
     if (empty($tmp_s)) {
28
-        $tmp_s = $s ;
28
+        $tmp_s = $s;
29 29
     }
30 30
 
31
-    @list(, $tmp_s) = explode("<div class='content'>", $tmp_s, 2) ;
31
+    @list(, $tmp_s) = explode("<div class='content'>", $tmp_s, 2);
32 32
     if (empty($tmp_s)) {
33
-        define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ;
34
-        return $s ;
33
+        define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1);
34
+        return $s;
35 35
     }
36 36
 
37
-    list($tmp_s, $tmp_after) = explode("<td width='1%' background='".XOOPS_URL."/modules/system/images/bg_content.gif'>", $tmp_s) ;
37
+    list($tmp_s, $tmp_after) = explode("<td width='1%' background='".XOOPS_URL."/modules/system/images/bg_content.gif'>", $tmp_s);
38 38
     if (empty($tmp_after)) {
39
-        define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ;
40
-        return $s ;
39
+        define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1);
40
+        return $s;
41 41
     }
42 42
 
43
-    $xoops_admin_contents = $former_outputs . substr(strrev(strstr(strrev($tmp_s), strrev('</div>'))), 0, -6) ;
43
+    $xoops_admin_contents = $former_outputs.substr(strrev(strstr(strrev($tmp_s), strrev('</div>'))), 0, -6);
44 44
 
45
-    return '' ;
45
+    return '';
46 46
 }
47 47
 
48 48
 
49 49
 function altsys_admin_in_theme_in_last($contents = null)
50 50
 {
51
-    global $xoops_admin_contents , $xoopsConfig , $xoopsModule , $xoopsUser , $xoopsUserIsAdmin , $xoopsLogger , $altsysModuleConfig , $altsysModuleId ;
51
+    global $xoops_admin_contents, $xoopsConfig, $xoopsModule, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger, $altsysModuleConfig, $altsysModuleId;
52 52
 
53
-    if (! isset($contents)) {
53
+    if (!isset($contents)) {
54 54
         while (ob_get_level()) {
55
-            ob_end_flush() ;
55
+            ob_end_flush();
56 56
         }
57 57
     } else {
58
-        $xoops_admin_contents = $contents ;
58
+        $xoops_admin_contents = $contents;
59 59
     }
60 60
 
61
-    if (! isset($xoops_admin_contents)) {
62
-        return ;
61
+    if (!isset($xoops_admin_contents)) {
62
+        return;
63 63
     }
64 64
     if (defined('ALTSYS_DONT_USE_ADMIN_IN_THEME')) {
65
-        return ;
65
+        return;
66 66
     }
67 67
 
68
-    if (! is_object($xoopsUser)) {
69
-        exit ;
68
+    if (!is_object($xoopsUser)) {
69
+        exit;
70 70
     }
71 71
 
72 72
     // language files
73 73
     if (file_exists(dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php')) {
74
-        include_once dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php' ;
74
+        include_once dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php';
75 75
     } else {
76
-        include_once dirname(__DIR__).'/language/english/admin_in_theme.php' ;
76
+        include_once dirname(__DIR__).'/language/english/admin_in_theme.php';
77 77
     }
78 78
 
79 79
     // set the theme
80
-    $xoopsConfig['theme_set'] = $altsysModuleConfig['admin_in_theme'] ;
80
+    $xoopsConfig['theme_set'] = $altsysModuleConfig['admin_in_theme'];
81 81
 
82 82
     // language files under the theme
83
-    $original_error_level = error_reporting() ;
84
-    error_reporting($original_error_level & ~ E_NOTICE) ;
83
+    $original_error_level = error_reporting();
84
+    error_reporting($original_error_level & ~ E_NOTICE);
85 85
     if (file_exists(XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php')) {
86
-        include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php' ;
86
+        include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php';
87 87
     } elseif (file_exists(XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php')) {
88
-        include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php' ;
88
+        include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php';
89 89
     }
90
-    error_reporting($original_error_level) ;
90
+    error_reporting($original_error_level);
91 91
 
92
-    include __DIR__.'/admin_in_theme_header.inc.php' ;
92
+    include __DIR__.'/admin_in_theme_header.inc.php';
93 93
 
94 94
 /*	// include adminmenu
95 95
     include XOOPS_CACHE_PATH.'/adminmenu.php' ;
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
         function shutdown() {'.implode("\n",$xoops_admin_menu_sd).'}' ; */
126 126
 
127 127
     // appendix (core specific css etc)
128
-    $xoops_module_header = '' ;
128
+    $xoops_module_header = '';
129 129
     if (altsys_get_core_type() == ALTSYS_CORE_TYPE_XCL21) {
130
-        $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=style.css" />'."\n" ;
130
+        $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=style.css" />'."\n";
131 131
         if (is_object(@$xoopsModule)) {
132
-            $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=module.css&amp;dirname='.$xoopsModule->getVar('dirname').'" />'."\n" ;
132
+            $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=module.css&amp;dirname='.$xoopsModule->getVar('dirname').'" />'."\n";
133 133
         }
134 134
     }
135 135
 
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
         'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES),
149 149
         'xoops_contents' => $xoops_admin_contents, //. '<div id="adminmenu_layers">' . $xoops_admin_menu_dv . '</div>' ,
150 150
         'xoops_module_header' => $xoops_module_header
151
-    )) ;
151
+    ));
152 152
 
153 153
     // rendering
154
-    $xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html') ;
154
+    $xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html');
155 155
 
156 156
     // for XOOPS 2.0.14/15/16 from xoops.org
157
-    if (is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array( 1, 2 ))) {
158
-        $xoopsLogger->activated = true ;
159
-        echo $xoopsLogger->render('') ;
157
+    if (is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array(1, 2))) {
158
+        $xoopsLogger->activated = true;
159
+        echo $xoopsLogger->render('');
160 160
     }
161 161
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/autoupdate_from_d3module.inc.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,33 +1,33 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! $xoopsConfig['theme_fromfile']) {
4
-    return ;
3
+if (!$xoopsConfig['theme_fromfile']) {
4
+    return;
5 5
 }
6 6
 
7 7
 // templates/ under modules
8 8
 // $tplsadmin_autoupdate_path = XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'] . '/templates' ;
9 9
 
10
-if (! is_array(@$tplsadmin_autoupdate_mydirnames)) {
11
-    return ;
10
+if (!is_array(@$tplsadmin_autoupdate_mydirnames)) {
11
+    return;
12 12
 }
13 13
 
14 14
 foreach ($tplsadmin_autoupdate_mydirnames as $tplsadmin_mydirname) {
15
-    $tplsadmin_mydirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $tplsadmin_mydirname) ;
16
-    require XOOPS_ROOT_PATH . '/modules/' . $tplsadmin_mydirname . '/mytrustdirname.php' ;
17
-    $altsys_mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/' ;
18
-    $tplsadmin_autoupdate_path = XOOPS_TRUST_PATH . $altsys_mid_path . $mytrustdirname . '/templates' ;
15
+    $tplsadmin_mydirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $tplsadmin_mydirname);
16
+    require XOOPS_ROOT_PATH.'/modules/'.$tplsadmin_mydirname.'/mytrustdirname.php';
17
+    $altsys_mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/';
18
+    $tplsadmin_autoupdate_path = XOOPS_TRUST_PATH.$altsys_mid_path.$mytrustdirname.'/templates';
19 19
 
20 20
     // modules
21
-    if ($handler = @opendir($tplsadmin_autoupdate_path . '/')) {
21
+    if ($handler = @opendir($tplsadmin_autoupdate_path.'/')) {
22 22
         while (($file = readdir($handler)) !== false) {
23
-            $file_path = $tplsadmin_autoupdate_path . '/' . $file ;
23
+            $file_path = $tplsadmin_autoupdate_path.'/'.$file;
24 24
             if (is_file($file_path)) {
25 25
                 $mtime = (int)(@filemtime($file_path));
26
-                $tpl_file = $tplsadmin_mydirname . '_' . $file ;
27
-                list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($xoopsConfig['template_set']) . "' AND tpl_file='" . addslashes($tpl_file) . "' AND tpl_lastmodified >= $mtime")) ;
26
+                $tpl_file = $tplsadmin_mydirname.'_'.$file;
27
+                list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('tplfile')." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($tpl_file)."' AND tpl_lastmodified >= $mtime"));
28 28
                 if ($count <= 0) {
29
-                    include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php' ;
30
-                    tplsadmin_import_data($xoopsConfig['template_set'], $tpl_file, implode('', file($file_path)), $mtime) ;
29
+                    include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php';
30
+                    tplsadmin_import_data($xoopsConfig['template_set'], $tpl_file, implode('', file($file_path)), $mtime);
31 31
                 }
32 32
             }
33 33
         }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/blocks.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$mytrustdirname = basename(__DIR__) ;
4
-$mytrustdirpath = __DIR__ ;
3
+$mytrustdirname = basename(__DIR__);
4
+$mytrustdirpath = __DIR__;
5 5
 
6 6
 // language files
7
-$language = empty($GLOBALS['xoopsConfig']['language']) ? 'english' : $GLOBALS['xoopsConfig']['language'] ;
7
+$language = empty($GLOBALS['xoopsConfig']['language']) ? 'english' : $GLOBALS['xoopsConfig']['language'];
8 8
 if (file_exists("$mydirpath/language/$language/blocks.php")) {
9 9
     // user customized language file (already read by class/xoopsblock.php etc)
10 10
     // include_once "$mydirpath/language/$language/blocks.php" ;
11 11
 } elseif (file_exists("$mytrustdirpath/language/$language/blocks_common.php")) {
12 12
     // default language file
13
-    include_once "$mytrustdirpath/language/$language/blocks_common.php" ;
14
-    include "$mytrustdirpath/language/$language/blocks_each.php" ;
13
+    include_once "$mytrustdirpath/language/$language/blocks_common.php";
14
+    include "$mytrustdirpath/language/$language/blocks_each.php";
15 15
 } else {
16 16
     // fallback english
17
-    include_once "$mytrustdirpath/language/english/blocks_common.php" ;
18
-    include "$mytrustdirpath/language/english/blocks_each.php" ;
17
+    include_once "$mytrustdirpath/language/english/blocks_common.php";
18
+    include "$mytrustdirpath/language/english/blocks_each.php";
19 19
 }
20 20
 
21
-require_once "$mytrustdirpath/blocks/block_functions.php" ;
21
+require_once "$mytrustdirpath/blocks/block_functions.php";
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/compilehookadmin.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -5,16 +5,16 @@  discard block
 block discarded – undo
5 5
 //                       GIJOE <http://www.peak.ne.jp/>                      //
6 6
 // ------------------------------------------------------------------------- //
7 7
 
8
-require_once __DIR__.'/class/AltsysBreadcrumbs.class.php' ;
9
-include_once __DIR__.'/include/gtickets.php' ;
10
-include_once __DIR__.'/include/altsys_functions.php' ;
8
+require_once __DIR__.'/class/AltsysBreadcrumbs.class.php';
9
+include_once __DIR__.'/include/gtickets.php';
10
+include_once __DIR__.'/include/altsys_functions.php';
11 11
 
12 12
 
13 13
 // this page can be called only from altsys
14 14
 // if( $xoopsModule->getVar('dirname') != 'altsys' ) die( 'this page can be called only from altsys' ) ;
15 15
 
16 16
 // language file
17
-altsys_include_language_file('compilehookadmin') ;
17
+altsys_include_language_file('compilehookadmin');
18 18
 
19 19
 //
20 20
 // DEFINITIONS
@@ -23,46 +23,46 @@  discard block
 block discarded – undo
23 23
 $compile_hooks = array(
24 24
 
25 25
     'enclosebycomment' => array(
26
-        'pre' => '<!-- begin altsys_tplsadmin %s -->' ,
27
-        'post' => '<!-- end altsys_tplsadmin %s -->' ,
28
-        'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYCOMMENT ,
29
-        'dt' => _TPLSADMIN_DT_ENCLOSEBYCOMMENT ,
30
-        'dd' => _TPLSADMIN_DD_ENCLOSEBYCOMMENT ,
31
-        'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYCOMMENT ,
26
+        'pre' => '<!-- begin altsys_tplsadmin %s -->',
27
+        'post' => '<!-- end altsys_tplsadmin %s -->',
28
+        'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYCOMMENT,
29
+        'dt' => _TPLSADMIN_DT_ENCLOSEBYCOMMENT,
30
+        'dd' => _TPLSADMIN_DD_ENCLOSEBYCOMMENT,
31
+        'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYCOMMENT,
32 32
         'skip_theme' => true
33
-    ) ,
33
+    ),
34 34
 
35 35
     'enclosebybordereddiv' => array(
36
-        'pre' => '<div class="altsys_tplsadmin_frame" style="border:1px solid black;word-wrap:break-word;">' ,
37
-        'post' => '<br /><a href="'.XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsform&amp;tpl_file=%1$s" style="color:red;">Edit:<br />%1$s</a></div>' ,
38
-        'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV ,
39
-        'dt' => _TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV ,
40
-        'dd' => _TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV ,
41
-        'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV ,
36
+        'pre' => '<div class="altsys_tplsadmin_frame" style="border:1px solid black;word-wrap:break-word;">',
37
+        'post' => '<br /><a href="'.XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsform&amp;tpl_file=%1$s" style="color:red;">Edit:<br />%1$s</a></div>',
38
+        'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV,
39
+        'dt' => _TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV,
40
+        'dd' => _TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV,
41
+        'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV,
42 42
         'skip_theme' => true
43
-    ) ,
43
+    ),
44 44
 
45 45
     'hooksavevars' => array(
46
-        'pre' => '<?php include_once "'.XOOPS_TRUST_PATH.'/libs/altsys/include/compilehook.inc.php" ; tplsadmin_save_tplsvars(\'%s\',$this) ; ?>' ,
47
-        'post' => '' ,
48
-        'success_msg' => _TPLSADMIN_FMT_MSG_HOOKSAVEVARS ,
49
-        'dt' => _TPLSADMIN_DT_HOOKSAVEVARS ,
50
-        'dd' => _TPLSADMIN_DD_HOOKSAVEVARS ,
51
-        'conf_msg' => _TPLSADMIN_CNF_HOOKSAVEVARS ,
46
+        'pre' => '<?php include_once "'.XOOPS_TRUST_PATH.'/libs/altsys/include/compilehook.inc.php" ; tplsadmin_save_tplsvars(\'%s\',$this) ; ?>',
47
+        'post' => '',
48
+        'success_msg' => _TPLSADMIN_FMT_MSG_HOOKSAVEVARS,
49
+        'dt' => _TPLSADMIN_DT_HOOKSAVEVARS,
50
+        'dd' => _TPLSADMIN_DD_HOOKSAVEVARS,
51
+        'conf_msg' => _TPLSADMIN_CNF_HOOKSAVEVARS,
52 52
         'skip_theme' => false
53
-    ) ,
53
+    ),
54 54
 
55 55
     'removehooks' => array(
56
-        'pre' => '' ,
57
-        'post' => '' ,
58
-        'success_msg' => _TPLSADMIN_FMT_MSG_REMOVEHOOKS ,
59
-        'dt' => _TPLSADMIN_DT_REMOVEHOOKS ,
60
-        'dd' => _TPLSADMIN_DD_REMOVEHOOKS ,
61
-        'conf_msg' => _TPLSADMIN_CNF_REMOVEHOOKS ,
56
+        'pre' => '',
57
+        'post' => '',
58
+        'success_msg' => _TPLSADMIN_FMT_MSG_REMOVEHOOKS,
59
+        'dt' => _TPLSADMIN_DT_REMOVEHOOKS,
60
+        'dd' => _TPLSADMIN_DD_REMOVEHOOKS,
61
+        'conf_msg' => _TPLSADMIN_CNF_REMOVEHOOKS,
62 62
         'skip_theme' => false
63 63
     )
64 64
 
65
-) ;
65
+);
66 66
 
67 67
 
68 68
 //
@@ -70,115 +70,115 @@  discard block
 block discarded – undo
70 70
 //
71 71
 
72 72
 // clearing files in templates_c/
73
-if (! empty($_POST['clearcache']) || ! empty($_POST['cleartplsvars'])) {
73
+if (!empty($_POST['clearcache']) || !empty($_POST['cleartplsvars'])) {
74 74
     // Ticket Check
75
-    if (! $xoopsGTicket->check()) {
75
+    if (!$xoopsGTicket->check()) {
76 76
         redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
77 77
     }
78 78
 
79
-    if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) {
79
+    if ($handler = opendir(XOOPS_COMPILE_PATH.'/')) {
80 80
         while (($file = readdir($handler)) !== false) {
81
-            if (! empty($_POST['clearcache'])) {
81
+            if (!empty($_POST['clearcache'])) {
82 82
                 // judging template cache '*.php'
83 83
                 if (substr($file, -4) !== '.php') {
84
-                    continue ;
84
+                    continue;
85 85
                 }
86 86
             } else {
87 87
                 // judging tplsvars cache 'tplsvars_*'
88 88
                 if (substr($file, 0, 9) !== 'tplsvars_') {
89
-                    continue ;
89
+                    continue;
90 90
                 }
91 91
             }
92 92
 
93
-            $file_path = XOOPS_COMPILE_PATH . '/' . $file ;
94
-            @unlink($file_path) ;
93
+            $file_path = XOOPS_COMPILE_PATH.'/'.$file;
94
+            @unlink($file_path);
95 95
         }
96
-        redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 1, _TPLSADMIN_MSG_CLEARCACHE) ;
97
-        exit ;
96
+        redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 1, _TPLSADMIN_MSG_CLEARCACHE);
97
+        exit;
98 98
     } else {
99
-        die('XOOPS_COMPILE_PATH cannot be opened') ;
99
+        die('XOOPS_COMPILE_PATH cannot be opened');
100 100
     }
101 101
 }
102 102
 
103 103
 // append hooking commands
104 104
 foreach ($compile_hooks as $command => $compile_hook) {
105
-    if (! empty($_POST[$command])) {
105
+    if (!empty($_POST[$command])) {
106 106
         // Ticket Check
107
-        if (! $xoopsGTicket->check()) {
107
+        if (!$xoopsGTicket->check()) {
108 108
             redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
109 109
         }
110 110
 
111
-        if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) {
112
-            $file_count = 0 ;
111
+        if ($handler = opendir(XOOPS_COMPILE_PATH.'/')) {
112
+            $file_count = 0;
113 113
             while (($file = readdir($handler)) !== false) {
114 114
 
115 115
                 // skip /. /.. and hidden files
116 116
                 if ($file{0} == '.') {
117
-                    continue ;
117
+                    continue;
118 118
                 }
119 119
 
120 120
                 // skip if the extension is not .html.php
121 121
                 if (substr($file, -9) != '.html.php') {
122
-                    continue ;
122
+                    continue;
123 123
                 }
124 124
 
125 125
                 // skip theme.html when comment-mode or div-mode
126 126
                 if ($compile_hook['skip_theme'] && substr($file, -15) == '%theme.html.php') {
127
-                    $skip_mode = true ;
127
+                    $skip_mode = true;
128 128
                 } else {
129
-                    $skip_mode = false ;
129
+                    $skip_mode = false;
130 130
                 }
131 131
 
132
-                $file_path = XOOPS_COMPILE_PATH . '/' . $file ;
133
-                $file_bodies = file($file_path) ;
132
+                $file_path = XOOPS_COMPILE_PATH.'/'.$file;
133
+                $file_bodies = file($file_path);
134 134
 
135 135
                 // remove lines inserted by compilehookadmin
136 136
                 if (strstr($file_bodies[0], 'altsys')) {
137
-                    array_shift($file_bodies) ;
137
+                    array_shift($file_bodies);
138 138
                 }
139
-                if (strstr($file_bodies[count($file_bodies)-1], 'altsys')) {
140
-                    array_pop($file_bodies) ;
141
-                    $file_bodies[count($file_bodies)-1] = rtrim($file_bodies[count($file_bodies)-1]) ;
139
+                if (strstr($file_bodies[count($file_bodies) - 1], 'altsys')) {
140
+                    array_pop($file_bodies);
141
+                    $file_bodies[count($file_bodies) - 1] = rtrim($file_bodies[count($file_bodies) - 1]);
142 142
                 }
143 143
 
144 144
                 // get the name of the source template from Smarty's comment
145 145
                 if (preg_match('/compiled from (\S+)/', $file_bodies[1], $regs)) {
146
-                    $tpl_name = $regs[1] ;
146
+                    $tpl_name = $regs[1];
147 147
                 } else {
148
-                    $tpl_name = '__FILE__' ;
148
+                    $tpl_name = '__FILE__';
149 149
                 }
150 150
 
151
-                $fw = fopen($file_path, 'w') ;
151
+                $fw = fopen($file_path, 'w');
152 152
 
153 153
                 // insert "pre" command before the compiled cache
154
-                if ($compile_hook['pre'] && ! $skip_mode) {
155
-                    fwrite($fw, sprintf($compile_hook['pre'], htmlspecialchars($tpl_name, ENT_QUOTES)) . "\r\n") ;
154
+                if ($compile_hook['pre'] && !$skip_mode) {
155
+                    fwrite($fw, sprintf($compile_hook['pre'], htmlspecialchars($tpl_name, ENT_QUOTES))."\r\n");
156 156
                 }
157 157
 
158 158
                 // rest of template cache
159 159
                 foreach ($file_bodies as $line) {
160
-                    fwrite($fw, $line) ;
160
+                    fwrite($fw, $line);
161 161
                 }
162 162
 
163 163
                 // insert "post" command after the compiled cache
164
-                if ($compile_hook['post'] && ! $skip_mode) {
165
-                    fwrite($fw, "\r\n" . sprintf($compile_hook['post'], htmlspecialchars($tpl_name, ENT_QUOTES))) ;
164
+                if ($compile_hook['post'] && !$skip_mode) {
165
+                    fwrite($fw, "\r\n".sprintf($compile_hook['post'], htmlspecialchars($tpl_name, ENT_QUOTES)));
166 166
                 }
167 167
 
168
-                fclose($fw) ;
168
+                fclose($fw);
169 169
 
170
-                $file_count ++ ;
170
+                $file_count++;
171 171
             }
172 172
 
173 173
             if ($file_count > 0) {
174
-                redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf($compile_hook['success_msg'], $file_count)) ;
175
-                exit ;
174
+                redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf($compile_hook['success_msg'], $file_count));
175
+                exit;
176 176
             } else {
177
-                redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, _TPLSADMIN_MSG_CREATECOMPILECACHEFIRST) ;
178
-                exit ;
177
+                redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, _TPLSADMIN_MSG_CREATECOMPILECACHEFIRST);
178
+                exit;
179 179
             }
180 180
         } else {
181
-            die('XOOPS_COMPILE_PATH cannot be opened') ;
181
+            die('XOOPS_COMPILE_PATH cannot be opened');
182 182
         }
183 183
     }
184 184
 }
@@ -190,25 +190,25 @@  discard block
 block discarded – undo
190 190
 //
191 191
 
192 192
 // count template vars & compiled caches
193
-$compiledcache_num = 0 ;
194
-$tplsvars_num = 0 ;
195
-if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) {
193
+$compiledcache_num = 0;
194
+$tplsvars_num = 0;
195
+if ($handler = opendir(XOOPS_COMPILE_PATH.'/')) {
196 196
     while (($file = readdir($handler)) !== false) {
197 197
         if (strncmp($file, 'tplsvars_', 9) === 0) {
198
-            $tplsvars_num ++ ;
198
+            $tplsvars_num++;
199 199
         } elseif (substr($file, -4) === '.php') {
200
-            $compiledcache_num ++ ;
200
+            $compiledcache_num++;
201 201
         }
202 202
     }
203 203
 }
204 204
 
205 205
 // get tplsets
206
-$sql = 'SELECT tplset_name,COUNT(distinct tpl_file) FROM ' . $xoopsDB->prefix('tplset') . ' LEFT JOIN ' . $xoopsDB->prefix('tplfile') . " ON tplset_name=tpl_tplset GROUP BY tpl_tplset ORDER BY tpl_tplset='default' DESC,tpl_tplset" ;
206
+$sql = 'SELECT tplset_name,COUNT(distinct tpl_file) FROM '.$xoopsDB->prefix('tplset').' LEFT JOIN '.$xoopsDB->prefix('tplfile')." ON tplset_name=tpl_tplset GROUP BY tpl_tplset ORDER BY tpl_tplset='default' DESC,tpl_tplset";
207 207
 $srs = $xoopsDB->query($sql);
208
-$tplset_options = "<option value=''>----</option>\n" ;
208
+$tplset_options = "<option value=''>----</option>\n";
209 209
 while (list($tplset, $tpl_count) = $xoopsDB->fetchRow($srs)) {
210
-    $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ;
211
-    $tplset_options .= "<option value='$tplset4disp'>$tplset4disp ($tpl_count)</option>\n" ;
210
+    $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES);
211
+    $tplset_options .= "<option value='$tplset4disp'>$tplset4disp ($tpl_count)</option>\n";
212 212
 }
213 213
 
214 214
 
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
 // FORM STAGE
219 219
 //
220 220
 
221
-xoops_cp_header() ;
221
+xoops_cp_header();
222 222
 
223 223
 // mymenu
224
-altsys_include_mymenu() ;
224
+altsys_include_mymenu();
225 225
 
226 226
 // breadcrumbs
227
-$breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ;
228
-$breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=compilehookadmin', _MI_ALTSYS_MENU_COMPILEHOOKADMIN) ;
227
+$breadcrumbsObj = & AltsysBreadcrumbs::getInstance();
228
+$breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=compilehookadmin', _MI_ALTSYS_MENU_COMPILEHOOKADMIN);
229 229
 
230 230
 echo "
231 231
 	<style>
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 				</dd>
251 251
 			</dl>
252 252
 		</p>
253
-	\n" ;
253
+	\n";
254 254
 }
255 255
 
256 256
 echo "
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
 		<p>
272 272
 			<dl>
273 273
 				<dt>
274
-                    "._TPLSADMIN_DT_GETTPLSVARSINFO_DW . '
274
+                    "._TPLSADMIN_DT_GETTPLSVARSINFO_DW.'
275 275
 				</dt>
276 276
 				<dd>
277
-                    ' . _TPLSADMIN_DD_GETTPLSVARSINFO_DW . "
277
+                    ' . _TPLSADMIN_DD_GETTPLSVARSINFO_DW."
278 278
 					<br />
279 279
 					<input type='submit' name='as_dw_extension_zip' value='zip' />
280 280
 					<input type='submit' name='as_dw_extension_tgz' value='tar.gz' />
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 		<p>
288 288
 			<dl>
289 289
 				<dt>
290
-                    "._TPLSADMIN_DT_GETTEMPLATES . '
290
+                    "._TPLSADMIN_DT_GETTEMPLATES.'
291 291
 				</dt>
292 292
 				<dd>
293
-                    ' . _TPLSADMIN_DD_GETTEMPLATES . "
293
+                    ' . _TPLSADMIN_DD_GETTEMPLATES."
294 294
 					<br />
295 295
 					<select name='tplset'>$tplset_options</select>
296 296
 					<input type='submit' name='download_zip' value='zip' />
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 		<p>
305 305
 			<dl>
306 306
 				<dt>
307
-                    "._TPLSADMIN_DT_PUTTEMPLATES . '
307
+                    "._TPLSADMIN_DT_PUTTEMPLATES.'
308 308
 				</dt>
309 309
 				<dd>
310
-                    ' . _TPLSADMIN_DD_PUTTEMPLATES . "
310
+                    ' . _TPLSADMIN_DD_PUTTEMPLATES."
311 311
 					<br />
312 312
 					<select name='tplset'>$tplset_options</select>
313 313
 					<input type='file' name='tplset_archive' size='60' />
@@ -319,4 +319,4 @@  discard block
 block discarded – undo
319 319
 \n" ;
320 320
 
321 321
 
322
-xoops_cp_footer() ;
322
+xoops_cp_footer();
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/get_templates.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -5,37 +5,37 @@  discard block
 block discarded – undo
5 5
 //                       GIJOE <http://www.peak.ne.jp/>                      //
6 6
 // ------------------------------------------------------------------------- //
7 7
 
8
-error_reporting(0) ;
8
+error_reporting(0);
9 9
 
10
-include_once __DIR__.'/include/gtickets.php' ;
11
-include_once __DIR__.'/include/altsys_functions.php' ;
10
+include_once __DIR__.'/include/gtickets.php';
11
+include_once __DIR__.'/include/altsys_functions.php';
12 12
 
13 13
 
14 14
 // this page can be called only from altsys
15 15
 if ($xoopsModule->getVar('dirname') != 'altsys') {
16
-    die('this page can be called only from altsys') ;
16
+    die('this page can be called only from altsys');
17 17
 }
18 18
 
19 19
 
20 20
 // language file
21
-altsys_include_language_file('compilehookadmin') ;
21
+altsys_include_language_file('compilehookadmin');
22 22
 
23
-if (! empty($_POST['download_zip'])) {
24
-    require_once XOOPS_ROOT_PATH.'/class/zipdownloader.php' ;
23
+if (!empty($_POST['download_zip'])) {
24
+    require_once XOOPS_ROOT_PATH.'/class/zipdownloader.php';
25 25
     $downloader = new XoopsZipDownloader();
26
-    $do_download = true ;
27
-} elseif (! empty($_POST['download_tgz'])) {
28
-    require_once XOOPS_ROOT_PATH.'/class/tardownloader.php' ;
26
+    $do_download = true;
27
+} elseif (!empty($_POST['download_tgz'])) {
28
+    require_once XOOPS_ROOT_PATH.'/class/tardownloader.php';
29 29
     $downloader = new XoopsTarDownloader();
30
-    $do_download = true ;
30
+    $do_download = true;
31 31
 }
32 32
 if (empty($do_download)) {
33
-    exit ;
33
+    exit;
34 34
 }
35 35
 
36
-$tplset = @$_POST['tplset'] ;
37
-if (! preg_match('/^[0-9A-Za-z_-]{1,16}$/', $tplset)) {
38
-    die(_TPLSADMIN_ERR_INVALIDTPLSET) ;
36
+$tplset = @$_POST['tplset'];
37
+if (!preg_match('/^[0-9A-Za-z_-]{1,16}$/', $tplset)) {
38
+    die(_TPLSADMIN_ERR_INVALIDTPLSET);
39 39
 }
40 40
 
41 41
 //fix for mb_http_output setting and for add any browsers
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 //ob_buffer over flow
46 46
 //HACK by suin & nao-pon 2012/01/06
47 47
     while (ob_get_level() > 0) {
48
-        if (! ob_end_clean()) {
48
+        if (!ob_end_clean()) {
49 49
             break;
50 50
         }
51 51
     }
52
-$trs = $xoopsDB->query('SELECT distinct tpl_file,tpl_source,tpl_lastmodified FROM ' . $xoopsDB->prefix('tplfile') . ' NATURAL LEFT JOIN ' . $xoopsDB->prefix('tplsource') . " WHERE tpl_tplset='" . addslashes($tplset) . "' ORDER BY tpl_file") ;
52
+$trs = $xoopsDB->query('SELECT distinct tpl_file,tpl_source,tpl_lastmodified FROM '.$xoopsDB->prefix('tplfile').' NATURAL LEFT JOIN '.$xoopsDB->prefix('tplsource')." WHERE tpl_tplset='".addslashes($tplset)."' ORDER BY tpl_file");
53 53
 if ($xoopsDB->getRowsNum($trs) <= 0) {
54
-    die(_TPLSADMIN_ERR_INVALIDTPLSET) ;
54
+    die(_TPLSADMIN_ERR_INVALIDTPLSET);
55 55
 }
56 56
 
57 57
 while (list($tpl_file, $tpl_source, $tpl_lastmodified) = $xoopsDB->fetchRow($trs)) {
58
-    $downloader->addFileData($tpl_source, $tplset.'/'.$tpl_file, $tpl_lastmodified) ;
58
+    $downloader->addFileData($tpl_source, $tplset.'/'.$tpl_file, $tpl_lastmodified);
59 59
 }
60 60
 //bugfix by nao-pon ,echo is not necessary for downloader
61
-$downloader->download('template_'.$tplset, true) ;
61
+$downloader->download('template_'.$tplset, true);
Please login to merge, or discard this patch.