Completed
Branch master (0881bb)
by Michael
04:14
created
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 dirname(__FILE__).'/include/gtickets.php' ;
11
-include_once dirname(__FILE__).'/include/altsys_functions.php' ;
10
+include_once dirname(__FILE__).'/include/gtickets.php';
11
+include_once dirname(__FILE__).'/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.
xoops_trust_path/libs/altsys/include/admin_in_theme_header.inc.php 2 patches
Switch Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -201,41 +201,41 @@
 block discarded – undo
201 201
             }
202 202
         }
203 203
         switch ($block_arr[$i]->getVar('side')) {
204
-        case XOOPS_SIDEBLOCK_LEFT:
205
-            if (!isset($show_lblock)) {
206
-                $xoopsTpl->assign('xoops_showlblock', 1);
207
-                $show_lblock = 1;
208
-            }
209
-            $xoopsTpl->append('xoops_lblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight')));
210
-            break;
211
-        case XOOPS_CENTERBLOCK_LEFT:
212
-            if (!isset($show_cblock)) {
213
-                $xoopsTpl->assign('xoops_showcblock', 1);
214
-                $show_cblock = 1;
215
-            }
216
-            $xoopsTpl->append('xoops_clblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight')));
217
-            break;
218
-        case XOOPS_CENTERBLOCK_RIGHT:
219
-            if (!isset($show_cblock)) {
220
-                $xoopsTpl->assign('xoops_showcblock', 1);
221
-                $show_cblock = 1;
222
-            }
223
-            $xoopsTpl->append('xoops_crblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight')));
224
-            break;
225
-        case XOOPS_CENTERBLOCK_CENTER:
226
-            if (!isset($show_cblock)) {
227
-                $xoopsTpl->assign('xoops_showcblock', 1);
228
-                $show_cblock = 1;
229
-            }
230
-            $xoopsTpl->append('xoops_ccblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight')));
231
-            break;
232
-        case XOOPS_SIDEBLOCK_RIGHT:
233
-            if (!isset($show_rblock)) {
234
-                $xoopsTpl->assign('xoops_showrblock', 1);
235
-                $show_rblock = 1;
236
-            }
237
-            $xoopsTpl->append('xoops_rblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight')));
238
-            break;
204
+            case XOOPS_SIDEBLOCK_LEFT:
205
+                if (!isset($show_lblock)) {
206
+                    $xoopsTpl->assign('xoops_showlblock', 1);
207
+                    $show_lblock = 1;
208
+                }
209
+                $xoopsTpl->append('xoops_lblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight')));
210
+                break;
211
+            case XOOPS_CENTERBLOCK_LEFT:
212
+                if (!isset($show_cblock)) {
213
+                    $xoopsTpl->assign('xoops_showcblock', 1);
214
+                    $show_cblock = 1;
215
+                }
216
+                $xoopsTpl->append('xoops_clblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight')));
217
+                break;
218
+            case XOOPS_CENTERBLOCK_RIGHT:
219
+                if (!isset($show_cblock)) {
220
+                    $xoopsTpl->assign('xoops_showcblock', 1);
221
+                    $show_cblock = 1;
222
+                }
223
+                $xoopsTpl->append('xoops_crblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight')));
224
+                break;
225
+            case XOOPS_CENTERBLOCK_CENTER:
226
+                if (!isset($show_cblock)) {
227
+                    $xoopsTpl->assign('xoops_showcblock', 1);
228
+                    $show_cblock = 1;
229
+                }
230
+                $xoopsTpl->append('xoops_ccblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight')));
231
+                break;
232
+            case XOOPS_SIDEBLOCK_RIGHT:
233
+                if (!isset($show_rblock)) {
234
+                    $xoopsTpl->assign('xoops_showrblock', 1);
235
+                    $show_rblock = 1;
236
+                }
237
+                $xoopsTpl->append('xoops_rblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight')));
238
+                break;
239 239
         }
240 240
         unset($bcontent);
241 241
     }
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
30 30
 //  ------------------------------------------------------------------------ //
31 31
 
32
-require_once dirname(dirname(__FILE__)).'/class/AltsysBreadcrumbs.class.php' ;
32
+require_once dirname(dirname(__FILE__)).'/class/AltsysBreadcrumbs.class.php';
33 33
 include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php';
34 34
 
35 35
     $xoopsOption['theme_use_smarty'] = 1;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     }
43 43
     $xoopsTpl->assign(array('xoops_theme' => $xoopsConfig['theme_set'], 'xoops_imageurl' => XOOPS_THEME_URL.'/'.$xoopsConfig['theme_set'].'/', 'xoops_themecss'=> xoops_getcss($xoopsConfig['theme_set']), 'xoops_requesturi' => htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES), 'xoops_sitename' => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES), 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
44 44
     // Meta tags
45
-    $config_handler =& xoops_gethandler('config');
45
+    $config_handler = & xoops_gethandler('config');
46 46
     $criteria = new CriteriaCompo(new Criteria('conf_modid', 0));
47 47
     $criteria->add(new Criteria('conf_catid', XOOPS_CONF_METAFOOTER));
48 48
     $config = $config_handler->getConfigs($criteria, true);
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 
58 58
 //HACK by domifara
59 59
     if (defined('XOOPS_CUBE_LEGACY')) {
60
-        $handler =& xoops_gethandler('block');
61
-        $xoopsblock =& $handler->create(false) ;
60
+        $handler = & xoops_gethandler('block');
61
+        $xoopsblock = & $handler->create(false);
62 62
     } else {
63 63
         $xoopsblock = new XoopsBlock();
64 64
     }
@@ -68,46 +68,46 @@  discard block
 block discarded – undo
68 68
     if (is_object($xoopsUser)) {
69 69
         $xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUserIsAdmin));
70 70
         if (is_object(@$xoopsModule)) {
71
-            if ($xoopsModule->getVar('mid') == 1 && @$_GET["fct"] == "preferences" && @$_GET["op"] == "showmod" && ! empty($_GET["mod"])) {
72
-                $module_handler =& xoops_gethandler('module') ;
73
-                $target_module = $module_handler->get(intval($_GET["mod"])) ;
71
+            if ($xoopsModule->getVar('mid') == 1 && @$_GET["fct"] == "preferences" && @$_GET["op"] == "showmod" && !empty($_GET["mod"])) {
72
+                $module_handler = & xoops_gethandler('module');
73
+                $target_module = $module_handler->get(intval($_GET["mod"]));
74 74
             } else {
75
-                $target_module =& $xoopsModule ;
75
+                $target_module = & $xoopsModule;
76 76
             }
77 77
 
78 78
             // set page title
79 79
             $xoopsTpl->assign(array('xoops_pagetitle' => $target_module->getVar('name'), 'xoops_modulename' => $target_module->getVar('name'), 'xoops_dirname' => $target_module->getVar('dirname')));
80 80
 
81 81
             // xoops_breadcrumbs
82
-            $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ;
82
+            $breadcrumbsObj = & AltsysBreadcrumbs::getInstance();
83 83
             if ($breadcrumbsObj->hasPaths()) {
84
-                $xoops_breadcrumbs = $breadcrumbsObj->getXoopsbreadcrumbs() ;
84
+                $xoops_breadcrumbs = $breadcrumbsObj->getXoopsbreadcrumbs();
85 85
             } else {
86
-                $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname') ;
87
-                $mod_path = XOOPS_ROOT_PATH.'/modules/'.$target_module->getVar('dirname') ;
88
-                $modinfo = $target_module->getInfo() ;
89
-                $xoops_breadcrumbs = array() ;
90
-                if (! empty($modinfo['hasMain'])) {
86
+                $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname');
87
+                $mod_path = XOOPS_ROOT_PATH.'/modules/'.$target_module->getVar('dirname');
88
+                $modinfo = $target_module->getInfo();
89
+                $xoops_breadcrumbs = array();
90
+                if (!empty($modinfo['hasMain'])) {
91 91
                     $xoops_breadcrumbs[] = array(
92
-                        'url' => $mod_url.'/' ,
93
-                        'name' => sprintf(_MD_A_AINTHEME_FMT_PUBLICTOP, $target_module->getVar('name')) ,
94
-                    ) ;
92
+                        'url' => $mod_url.'/',
93
+                        'name' => sprintf(_MD_A_AINTHEME_FMT_PUBLICTOP, $target_module->getVar('name')),
94
+                    );
95 95
                 }
96
-                if (! empty($modinfo['adminindex'])) {
96
+                if (!empty($modinfo['adminindex'])) {
97 97
                     $xoops_breadcrumbs[] = array(
98
-                        'url' => $mod_url.'/'.$modinfo['adminindex'] ,
99
-                        'name' => sprintf(_MD_A_AINTHEME_FMT_ADMINTOP, $target_module->getVar('name')) ,
100
-                    ) ;
98
+                        'url' => $mod_url.'/'.$modinfo['adminindex'],
99
+                        'name' => sprintf(_MD_A_AINTHEME_FMT_ADMINTOP, $target_module->getVar('name')),
100
+                    );
101 101
                 }
102
-                if (! empty($GLOBALS['altsysAdminPageTitle'])) {
103
-                    $xoops_breadcrumbs[] = array( 'name' => htmlspecialchars($GLOBALS['altsysAdminPageTitle'], ENT_QUOTES) ) ;
104
-                } elseif (! empty($modinfo['adminmenu'])) {
105
-                    @include $mod_path.'/'.$modinfo['adminmenu'] ;
102
+                if (!empty($GLOBALS['altsysAdminPageTitle'])) {
103
+                    $xoops_breadcrumbs[] = array('name' => htmlspecialchars($GLOBALS['altsysAdminPageTitle'], ENT_QUOTES));
104
+                } elseif (!empty($modinfo['adminmenu'])) {
105
+                    @include $mod_path.'/'.$modinfo['adminmenu'];
106 106
                     if (is_array(@$adminmenu)) {
107 107
                         foreach ($adminmenu as $eachmenu) {
108 108
                             if (strstr($_SERVER['REQUEST_URI'], $eachmenu['link'])) {
109
-                                $xoops_breadcrumbs[] = array( 'name' => $eachmenu['title'] ) ;
110
-                                break ;
109
+                                $xoops_breadcrumbs[] = array('name' => $eachmenu['title']);
110
+                                break;
111 111
                             }
112 112
                         }
113 113
                     }
@@ -116,51 +116,51 @@  discard block
 block discarded – undo
116 116
 
117 117
             //$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), $target_module->getVar('mid'), false, XOOPS_BLOCK_VISIBLE);
118 118
         } else {
119
-            $xoopsTpl->assign(array( 'xoops_pagetitle' => _CPHOME )) ;
119
+            $xoopsTpl->assign(array('xoops_pagetitle' => _CPHOME));
120 120
             $xoops_breadcrumbs = array(
121 121
                 array(
122
-                    'url' => XOOPS_URL.'/admin.php' ,
123
-                    'name' => _CPHOME ,
122
+                    'url' => XOOPS_URL.'/admin.php',
123
+                    'name' => _CPHOME,
124 124
                 )
125
-            ) ;
125
+            );
126 126
         }
127 127
     } else {
128
-        exit ;
128
+        exit;
129 129
     }
130 130
 
131 131
     // get block_arr
132
-    $db =& XoopsDatabaseFactory::getDatabaseConnection() ;
133
-    $sql = "SELECT DISTINCT gperm_itemid FROM ".$db->prefix('group_permission')." WHERE gperm_name = 'block_read' AND gperm_modid = 1 AND gperm_groupid IN (".implode(',', $xoopsUser->getGroups()).")" ;
132
+    $db = & XoopsDatabaseFactory::getDatabaseConnection();
133
+    $sql = "SELECT DISTINCT gperm_itemid FROM ".$db->prefix('group_permission')." WHERE gperm_name = 'block_read' AND gperm_modid = 1 AND gperm_groupid IN (".implode(',', $xoopsUser->getGroups()).")";
134 134
     $result = $db->query($sql);
135 135
 
136 136
     $blockids = array();
137 137
     while (list($blockid) = $db->fetchRow($result)) {
138
-        $blockids[] = intval($blockid) ;
138
+        $blockids[] = intval($blockid);
139 139
     }
140 140
 
141
-    global $block_arr , $i ; // for piCal :-)
142
-    $block_arr = array() ;
141
+    global $block_arr, $i; // for piCal :-)
142
+    $block_arr = array();
143 143
     if (!empty($blockids)) {
144
-        $sql = 'SELECT b.* FROM '.$db->prefix('newblocks').' b, '.$db->prefix('block_module_link').' m WHERE m.block_id=b.bid AND b.isactive=1 AND b.visible=1 AND m.module_id='.intval($altsysModuleId).' AND b.bid IN ('.implode(',', $blockids).') ORDER BY b.weight,b.bid' ;
144
+        $sql = 'SELECT b.* FROM '.$db->prefix('newblocks').' b, '.$db->prefix('block_module_link').' m WHERE m.block_id=b.bid AND b.isactive=1 AND b.visible=1 AND m.module_id='.intval($altsysModuleId).' AND b.bid IN ('.implode(',', $blockids).') ORDER BY b.weight,b.bid';
145 145
         $result = $db->query($sql);
146 146
         while ($myrow = $db->fetchArray($result)) {
147 147
 
148 148
 //HACK by domifara
149 149
             if (defined('XOOPS_CUBE_LEGACY')) {
150
-                $block =& $handler->create(false) ;
150
+                $block = & $handler->create(false);
151 151
                 $block->assignVars($myrow);
152 152
             } else {
153
-                $block = new XoopsBlock($myrow) ;
153
+                $block = new XoopsBlock($myrow);
154 154
             }
155 155
 
156
-            $block_arr[ $myrow['bid'] ] = $block ;
156
+            $block_arr[$myrow['bid']] = $block;
157 157
         }
158 158
     }
159 159
 
160
-    $adminmenublock_exists = false ;
160
+    $adminmenublock_exists = false;
161 161
     foreach (array_keys($block_arr) as $i) {
162 162
         if ($block_arr[$i]->getVar('show_func') == 'b_altsys_admin_menu_show') {
163
-            $adminmenublock_exists = true ;
163
+            $adminmenublock_exists = true;
164 164
         }
165 165
         $bcachetime = $block_arr[$i]->getVar('bcachetime');
166 166
         if (empty($bcachetime)) {
@@ -241,15 +241,15 @@  discard block
 block discarded – undo
241 241
     }
242 242
 
243 243
     // FALLBACK inserting admin_menu_block in admin side
244
-    if (! $adminmenublock_exists) {
245
-        require_once XOOPS_ROOT_PATH.'/modules/altsys/blocks/blocks.php' ;
246
-        $admin_menu_block = array( b_altsys_admin_menu_show(array( 'altsys' )) ) ;
247
-        $admin_menu_block[0]['title'] = 'Admin Menu' ;
248
-        $lblocks = $xoopsTpl->get_template_vars('xoops_lblocks') ;
249
-        if (! is_array($lblocks)) {
250
-            $lblocks = array() ;
244
+    if (!$adminmenublock_exists) {
245
+        require_once XOOPS_ROOT_PATH.'/modules/altsys/blocks/blocks.php';
246
+        $admin_menu_block = array(b_altsys_admin_menu_show(array('altsys')));
247
+        $admin_menu_block[0]['title'] = 'Admin Menu';
248
+        $lblocks = $xoopsTpl->get_template_vars('xoops_lblocks');
249
+        if (!is_array($lblocks)) {
250
+            $lblocks = array();
251 251
         }
252
-        $xoopsTpl->assign('xoops_lblocks', array_merge($admin_menu_block, $lblocks)) ;
252
+        $xoopsTpl->assign('xoops_lblocks', array_merge($admin_menu_block, $lblocks));
253 253
     }
254 254
 
255 255
     //unset($block_arr);
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/autoupdate_from_module.inc.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,45 +1,45 @@
 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_dirnames)) {
11
-    return ;
10
+if (!is_array(@$tplsadmin_autoupdate_dirnames)) {
11
+    return;
12 12
 }
13 13
 
14 14
 foreach ($tplsadmin_autoupdate_dirnames as $dirname) {
15
-    $dirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $dirname) ;
16
-    $tplsadmin_autoupdate_path = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/templates' ;
15
+    $dirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $dirname);
16
+    $tplsadmin_autoupdate_path = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates';
17 17
 
18 18
     // modules
19
-    if ($handler = @opendir($tplsadmin_autoupdate_path . '/')) {
19
+    if ($handler = @opendir($tplsadmin_autoupdate_path.'/')) {
20 20
         while (($file = readdir($handler)) !== false) {
21
-            $file_path = $tplsadmin_autoupdate_path . '/' . $file ;
21
+            $file_path = $tplsadmin_autoupdate_path.'/'.$file;
22 22
             if (is_file($file_path) && substr($file, -5) == '.html') {
23
-                $mtime = intval(@filemtime($file_path)) ;
24
-                list($count) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("tplfile")." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($file)."' AND tpl_lastmodified >= $mtime")) ;
23
+                $mtime = intval(@filemtime($file_path));
24
+                list($count) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("tplfile")." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($file)."' AND tpl_lastmodified >= $mtime"));
25 25
                 if ($count <= 0) {
26
-                    include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php' ;
27
-                    tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime) ;
26
+                    include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php';
27
+                    tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime);
28 28
                 }
29 29
             }
30 30
         }
31 31
     }
32 32
 
33 33
     // blocks
34
-    if ($handler = @opendir($tplsadmin_autoupdate_path . '/blocks/')) {
34
+    if ($handler = @opendir($tplsadmin_autoupdate_path.'/blocks/')) {
35 35
         while (($file = readdir($handler)) !== false) {
36
-            $file_path = $tplsadmin_autoupdate_path . '/blocks/' . $file ;
36
+            $file_path = $tplsadmin_autoupdate_path.'/blocks/'.$file;
37 37
             if (is_file($file_path) && substr($file, -5) == '.html') {
38
-                $mtime = intval(@filemtime($file_path)) ;
39
-                list($count) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("tplfile")." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($file)."' AND tpl_lastmodified >= $mtime")) ;
38
+                $mtime = intval(@filemtime($file_path));
39
+                list($count) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("tplfile")." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($file)."' AND tpl_lastmodified >= $mtime"));
40 40
                 if ($count <= 0) {
41
-                    include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php' ;
42
-                    tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime) ;
41
+                    include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php';
42
+                    tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime);
43 43
                 }
44 44
             }
45 45
         }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/mygroupperm.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! defined('XOOPS_ROOT_PATH')) {
4
-    exit ;
3
+if (!defined('XOOPS_ROOT_PATH')) {
4
+    exit;
5 5
 }
6 6
 
7 7
 function myDeleteByModule($DB, $gperm_modid, $gperm_name = null, $gperm_itemid = null)
@@ -27,47 +27,47 @@  discard block
 block discarded – undo
27 27
 
28 28
 if ($modid == 1) {
29 29
     // check by the permission of eather 'altsys' or 'system'
30
-    $module_handler =& xoops_gethandler('module') ;
31
-    $module =& $module_handler->getByDirname('altsys') ;
32
-    if (! is_object($module)) {
33
-        $module =& $module_handler->getByDirname('system') ;
34
-        if (! is_object($module)) {
35
-            die('there is no altsys nor system.') ;
30
+    $module_handler = & xoops_gethandler('module');
31
+    $module = & $module_handler->getByDirname('altsys');
32
+    if (!is_object($module)) {
33
+        $module = & $module_handler->getByDirname('system');
34
+        if (!is_object($module)) {
35
+            die('there is no altsys nor system.');
36 36
         }
37 37
     }
38
-    $moduleperm_handler =& xoops_gethandler('groupperm') ;
39
-    if (! is_object(@$GLOBALS['xoopsUser']) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) {
40
-        die('only admin of altsys can access this area') ;
38
+    $moduleperm_handler = & xoops_gethandler('groupperm');
39
+    if (!is_object(@$GLOBALS['xoopsUser']) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) {
40
+        die('only admin of altsys can access this area');
41 41
     }
42 42
 } else {
43 43
     // check the permission of 'module_admin' of the module
44 44
     if ($modid <= 0 || !is_object($GLOBALS['xoopsUser']) || !$GLOBALS['xoopsUser']->isAdmin($modid)) {
45
-        die(_NOPERM) ;
45
+        die(_NOPERM);
46 46
     }
47
-    $module_handler =& xoops_gethandler('module');
48
-    $module =& $module_handler->get($modid);
47
+    $module_handler = & xoops_gethandler('module');
48
+    $module = & $module_handler->get($modid);
49 49
     if (!is_object($module) || !$module->getVar('isactive')) {
50
-        die(_MODULENOEXIST) ;
50
+        die(_MODULENOEXIST);
51 51
     }
52 52
 }
53 53
 
54
-$member_handler =& xoops_gethandler('member');
54
+$member_handler = & xoops_gethandler('member');
55 55
 $group_list = $member_handler->getGroupList();
56 56
 if (!empty($_POST['perms']) && is_array($_POST['perms'])) {
57 57
     $gperm_handler = xoops_gethandler('groupperm');
58 58
     foreach ($_POST['perms'] as $perm_name => $perm_data) {
59
-        foreach ($perm_data['itemname' ] as $item_id => $item_name) {
59
+        foreach ($perm_data['itemname'] as $item_id => $item_name) {
60 60
             // checking code
61 61
             // echo "<pre>" ;
62 62
             // var_dump( $_POST['perms'] ) ;
63 63
             // exit ;
64 64
             if (false != myDeleteByModule($gperm_handler->db, $modid, $perm_name, $item_id)) {
65 65
                 if (empty($perm_data['groups'])) {
66
-                    continue ;
66
+                    continue;
67 67
                 }
68 68
                 foreach ($perm_data['groups'] as $group_id => $item_ids) {
69 69
                     //				foreach ($item_ids as $item_id => $selected) {
70
-                    $selected = isset($item_ids[ $item_id ]) ? $item_ids[ $item_id ] : 0 ;
70
+                    $selected = isset($item_ids[$item_id]) ? $item_ids[$item_id] : 0;
71 71
                     if ($selected == 1) {
72 72
                         // make sure that all parent ids are selected as well
73 73
                         if ($perm_data['parents'][$item_id] != '') {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                                 }
81 81
                             }
82 82
                         }
83
-                        $gperm =& $gperm_handler->create();
83
+                        $gperm = & $gperm_handler->create();
84 84
                         $gperm->setVar('gperm_groupid', $group_id);
85 85
                         $gperm->setVar('gperm_name', $perm_name);
86 86
                         $gperm->setVar('gperm_modid', $modid);
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/adminmenu_functions.php 1 patch
Spacing   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once dirname(dirname(__FILE__)).'/class/altsysUtils.class.php' ;
2
+require_once dirname(dirname(__FILE__)).'/class/altsysUtils.class.php';
3 3
 
4
-define('ALTSYS_ADMINMENU_FILE', XOOPS_CACHE_PATH.'/adminmenu.php') ;
5
-define('ALTSYS_ADMINMENU_HACK_NONE', 0) ;
6
-define('ALTSYS_ADMINMENU_HACK_2COL', 1) ;
7
-define('ALTSYS_ADMINMENU_HACK_NOIMG', 2) ;
8
-define('ALTSYS_ADMINMENU_HACK_XCSTY', 3) ;
4
+define('ALTSYS_ADMINMENU_FILE', XOOPS_CACHE_PATH.'/adminmenu.php');
5
+define('ALTSYS_ADMINMENU_HACK_NONE', 0);
6
+define('ALTSYS_ADMINMENU_HACK_2COL', 1);
7
+define('ALTSYS_ADMINMENU_HACK_NOIMG', 2);
8
+define('ALTSYS_ADMINMENU_HACK_XCSTY', 3);
9 9
 
10 10
 
11 11
 //
@@ -13,73 +13,73 @@  discard block
 block discarded – undo
13 13
 //
14 14
 function altsys_adminmenu_insert_mymenu(&$module)
15 15
 {
16
-    global $altsysModuleConfig ;
16
+    global $altsysModuleConfig;
17 17
 
18 18
     if (empty($altsysModuleConfig['adminmenu_insert_mymenu'])) {
19
-        return ;
19
+        return;
20 20
     }
21 21
 
22 22
     if (altsys_get_core_type() < ALTSYS_CORE_TYPE_ORE) {
23
-        altsys_adminmenu_insert_mymenu_x20($module) ;
23
+        altsys_adminmenu_insert_mymenu_x20($module);
24 24
     }
25 25
 }
26 26
 
27 27
 function altsys_adminmenu_insert_mymenu_x20(&$module)
28 28
 {
29 29
     // read
30
-    if (! file_exists(ALTSYS_ADMINMENU_FILE)) {
31
-        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ;
32
-        exit ;
30
+    if (!file_exists(ALTSYS_ADMINMENU_FILE)) {
31
+        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu');
32
+        exit;
33 33
     }
34
-    $not_inside_cp_functions = true ;
35
-    include ALTSYS_ADMINMENU_FILE ;
34
+    $not_inside_cp_functions = true;
35
+    include ALTSYS_ADMINMENU_FILE;
36 36
 
37
-    $dirname = $module->getVar('dirname') ;
38
-    $mid = $module->getVar('mid') ;
39
-    $anchor = '<!-- ALTSYS ANCHOR '.$dirname.' -->' ;
37
+    $dirname = $module->getVar('dirname');
38
+    $mid = $module->getVar('mid');
39
+    $anchor = '<!-- ALTSYS ANCHOR '.$dirname.' -->';
40 40
 
41 41
     // fetch popup_no
42 42
     if (empty($xoops_admin_menu_ft[$mid])) {
43
-        return ;
43
+        return;
44 44
     }
45
-    if (! preg_match('/popUpL(\d+)/', $xoops_admin_menu_ft[$mid], $regs)) {
46
-        return ;
45
+    if (!preg_match('/popUpL(\d+)/', $xoops_admin_menu_ft[$mid], $regs)) {
46
+        return;
47 47
     }
48
-    $popup_no = intval($regs[1]) ;
48
+    $popup_no = intval($regs[1]);
49 49
 
50 50
     // replace
51
-    $search  = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod='.$mid.'\'' ;
52
-    $replace = $anchor.'<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mypreferences\'' ;
51
+    $search  = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod='.$mid.'\'';
52
+    $replace = $anchor.'<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mypreferences\'';
53 53
 
54 54
     // do replacement
55
-    $new_xoops_admin_menu_dv = preg_replace('#'.preg_quote($search).'#', $replace, $xoops_admin_menu_dv) ;
55
+    $new_xoops_admin_menu_dv = preg_replace('#'.preg_quote($search).'#', $replace, $xoops_admin_menu_dv);
56 56
 
57 57
     if ($xoops_admin_menu_dv == $new_xoops_admin_menu_dv) {
58
-        return ;
58
+        return;
59 59
     }
60
-    $xoops_admin_menu_dv = $new_xoops_admin_menu_dv ;
60
+    $xoops_admin_menu_dv = $new_xoops_admin_menu_dv;
61 61
 
62
-    $insert = '' ;
62
+    $insert = '';
63 63
 
64 64
     // insert blocksadmin
65 65
     if ($dirname != 'altsys') {
66
-        $blocksadmin_title = defined('_MD_A_MYMENU_MYBLOCKSADMIN') ? _MD_A_MYMENU_MYBLOCKSADMIN : 'blocksadmin' ;
67
-        $insert .= '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=myblocksadmin\'>'.$blocksadmin_title.'</a><br />'."\n" ;
66
+        $blocksadmin_title = defined('_MD_A_MYMENU_MYBLOCKSADMIN') ? _MD_A_MYMENU_MYBLOCKSADMIN : 'blocksadmin';
67
+        $insert .= '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=myblocksadmin\'>'.$blocksadmin_title.'</a><br />'."\n";
68 68
     }
69 69
 
70 70
     // insert tplsadmin
71
-    $db =& XoopsDatabaseFactory::getDatabaseConnection() ;
72
-    list($count) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("tplfile")." WHERE tpl_module='$dirname'")) ;
71
+    $db = & XoopsDatabaseFactory::getDatabaseConnection();
72
+    list($count) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("tplfile")." WHERE tpl_module='$dirname'"));
73 73
     if ($count > 0) {
74
-        $tplsadmin_title = defined('_MD_A_MYMENU_MYTPLSADMIN') ? _MD_A_MYMENU_MYTPLSADMIN : 'tplsadmin' ;
75
-        $insert = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin\'>'.$tplsadmin_title.'</a><br />'."\n".$insert ;
74
+        $tplsadmin_title = defined('_MD_A_MYMENU_MYTPLSADMIN') ? _MD_A_MYMENU_MYTPLSADMIN : 'tplsadmin';
75
+        $insert = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin\'>'.$tplsadmin_title.'</a><br />'."\n".$insert;
76 76
     }
77 77
 
78 78
     // do insertion
79
-    $xoops_admin_menu_dv = preg_replace('#'.preg_quote($anchor).'#', $anchor.$insert, $xoops_admin_menu_dv) ;
79
+    $xoops_admin_menu_dv = preg_replace('#'.preg_quote($anchor).'#', $anchor.$insert, $xoops_admin_menu_dv);
80 80
 
81 81
     // write back
82
-    altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => intval(@$altsys_adminmenu_ft_hacked), 'altsys_adminmenu_dv_updated' => true )) ;
82
+    altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => intval(@$altsys_adminmenu_ft_hacked), 'altsys_adminmenu_dv_updated' => true));
83 83
 }
84 84
 
85 85
 //
@@ -87,184 +87,184 @@  discard block
 block discarded – undo
87 87
 //
88 88
 function altsys_adminmenu_hack_ft()
89 89
 {
90
-    global $altsysModuleConfig ;
90
+    global $altsysModuleConfig;
91 91
 
92 92
     if (altsys_get_core_type() >= ALTSYS_CORE_TYPE_ORE) {
93
-        return ;
93
+        return;
94 94
     }
95 95
     if (empty($altsysModuleConfig['adminmenu_hack_ft'])) {
96
-        return ;
96
+        return;
97 97
     }
98 98
 
99 99
     if ($altsysModuleConfig['adminmenu_hack_ft'] == ALTSYS_ADMINMENU_HACK_2COL) {
100
-        altsys_adminmenu_hack_ft_2col_x20() ;
100
+        altsys_adminmenu_hack_ft_2col_x20();
101 101
     } elseif ($altsysModuleConfig['adminmenu_hack_ft'] == ALTSYS_ADMINMENU_HACK_NOIMG) {
102
-        altsys_adminmenu_hack_ft_noimg_x20() ;
102
+        altsys_adminmenu_hack_ft_noimg_x20();
103 103
     } elseif ($altsysModuleConfig['adminmenu_hack_ft'] == ALTSYS_ADMINMENU_HACK_XCSTY) {
104
-        altsys_adminmenu_hack_ft_xcsty_x20() ;
104
+        altsys_adminmenu_hack_ft_xcsty_x20();
105 105
     }
106 106
 }
107 107
 
108 108
 function altsys_adminmenu_hack_ft_2col_x20()
109 109
 {
110 110
     // read
111
-    if (! file_exists(ALTSYS_ADMINMENU_FILE)) {
112
-        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ;
113
-        exit ;
111
+    if (!file_exists(ALTSYS_ADMINMENU_FILE)) {
112
+        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu');
113
+        exit;
114 114
     }
115
-    $not_inside_cp_functions = true ;
116
-    include ALTSYS_ADMINMENU_FILE ;
115
+    $not_inside_cp_functions = true;
116
+    include ALTSYS_ADMINMENU_FILE;
117 117
 
118 118
     // check previous hack
119
-    if (! empty($altsys_adminmenu_ft_hacked)) {
119
+    if (!empty($altsys_adminmenu_ft_hacked)) {
120 120
         if ($altsys_adminmenu_ft_hacked == ALTSYS_ADMINMENU_HACK_2COL) {
121 121
             // skip
122
-            return ;
122
+            return;
123 123
         } else {
124 124
             // rebuild adminmenu
125
-            require_once XOOPS_ROOT_PATH.'/include/cp_functions.php' ;
126
-            xoops_module_write_admin_menu(xoops_module_get_admin_menu()) ;
125
+            require_once XOOPS_ROOT_PATH.'/include/cp_functions.php';
126
+            xoops_module_write_admin_menu(xoops_module_get_admin_menu());
127 127
             // backup $xoops_admin_menu_dv
128
-            $backup_admin_menu_dv = $xoops_admin_menu_dv ;
128
+            $backup_admin_menu_dv = $xoops_admin_menu_dv;
129 129
             // include new adminmenu
130
-            include ALTSYS_ADMINMENU_FILE ;
130
+            include ALTSYS_ADMINMENU_FILE;
131 131
             // restore $xoops_admin_menu_dv
132
-            $xoops_admin_menu_dv = $backup_admin_menu_dv ;
132
+            $xoops_admin_menu_dv = $backup_admin_menu_dv;
133 133
         }
134 134
     }
135 135
 
136
-    $search  = ' alt=\'\' /></a><br />' ;
137
-    $replace_fmt = ' alt="%s" /></a>' ;
136
+    $search  = ' alt=\'\' /></a><br />';
137
+    $replace_fmt = ' alt="%s" /></a>';
138 138
 
139
-    $is_left = true ;
140
-    $module_handler =& xoops_gethandler('module') ;
141
-    $mids = array_keys($xoops_admin_menu_ft) ;
142
-    $last_mid = $mids[ sizeof($mids) - 1 ] ;
139
+    $is_left = true;
140
+    $module_handler = & xoops_gethandler('module');
141
+    $mids = array_keys($xoops_admin_menu_ft);
142
+    $last_mid = $mids[sizeof($mids) - 1];
143 143
     foreach ($mids as $mid) {
144
-        $module =& $module_handler->get($mid) ;
145
-        $new_menu_ft = preg_replace('#'.preg_quote($search).'#', sprintf($replace_fmt, $module->getVar('name')), $xoops_admin_menu_ft[$mid]) ;
144
+        $module = & $module_handler->get($mid);
145
+        $new_menu_ft = preg_replace('#'.preg_quote($search).'#', sprintf($replace_fmt, $module->getVar('name')), $xoops_admin_menu_ft[$mid]);
146 146
         if ($is_left) {
147 147
             if ($mid == $last_mid) {
148
-                $xoops_admin_menu_ft[$mid] = $new_menu_ft . '</td><td>' ;
148
+                $xoops_admin_menu_ft[$mid] = $new_menu_ft.'</td><td>';
149 149
             } else {
150
-                $left_body = $new_menu_ft ;
151
-                $left_key = $mid ;
152
-                $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',85);', $xoops_admin_menu_ml[$mid]) ;
150
+                $left_body = $new_menu_ft;
151
+                $left_key = $mid;
152
+                $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',85);', $xoops_admin_menu_ml[$mid]);
153 153
             }
154 154
         } else {
155
-            $xoops_admin_menu_ft[$mid] = $left_body . '</td><td>' . $new_menu_ft ;
156
-            unset($xoops_admin_menu_ft[$left_key]) ;
157
-            $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',185);', $xoops_admin_menu_ml[$mid]) ;
155
+            $xoops_admin_menu_ft[$mid] = $left_body.'</td><td>'.$new_menu_ft;
156
+            unset($xoops_admin_menu_ft[$left_key]);
157
+            $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',185);', $xoops_admin_menu_ml[$mid]);
158 158
         }
159
-        $is_left = ! $is_left ;
159
+        $is_left = !$is_left;
160 160
     }
161 161
 
162 162
     // write back
163
-    altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_2COL )) ;
163
+    altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_2COL));
164 164
 }
165 165
 
166 166
 
167 167
 function altsys_adminmenu_hack_ft_noimg_x20()
168 168
 {
169 169
     // read
170
-    if (! file_exists(ALTSYS_ADMINMENU_FILE)) {
171
-        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ;
172
-        exit ;
170
+    if (!file_exists(ALTSYS_ADMINMENU_FILE)) {
171
+        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu');
172
+        exit;
173 173
     }
174
-    $not_inside_cp_functions = true ;
175
-    include ALTSYS_ADMINMENU_FILE ;
174
+    $not_inside_cp_functions = true;
175
+    include ALTSYS_ADMINMENU_FILE;
176 176
 
177 177
     // check previous hack
178
-    if (! empty($altsys_adminmenu_ft_hacked)) {
178
+    if (!empty($altsys_adminmenu_ft_hacked)) {
179 179
         if ($altsys_adminmenu_ft_hacked == ALTSYS_ADMINMENU_HACK_NOIMG) {
180 180
             // skip
181
-            return ;
181
+            return;
182 182
         } else {
183 183
             // rebuild adminmenu
184
-            require_once XOOPS_ROOT_PATH.'/include/cp_functions.php' ;
185
-            xoops_module_write_admin_menu(xoops_module_get_admin_menu()) ;
184
+            require_once XOOPS_ROOT_PATH.'/include/cp_functions.php';
185
+            xoops_module_write_admin_menu(xoops_module_get_admin_menu());
186 186
             // backup $xoops_admin_menu_dv
187
-            $backup_admin_menu_dv = $xoops_admin_menu_dv ;
187
+            $backup_admin_menu_dv = $xoops_admin_menu_dv;
188 188
             // include new adminmenu
189
-            include ALTSYS_ADMINMENU_FILE ;
189
+            include ALTSYS_ADMINMENU_FILE;
190 190
             // restore $xoops_admin_menu_dv
191
-            $xoops_admin_menu_dv = $backup_admin_menu_dv ;
191
+            $xoops_admin_menu_dv = $backup_admin_menu_dv;
192 192
         }
193 193
     }
194 194
 
195
-    $module_handler =& xoops_gethandler('module') ;
196
-    $mids = array_keys($xoops_admin_menu_ft) ;
195
+    $module_handler = & xoops_gethandler('module');
196
+    $mids = array_keys($xoops_admin_menu_ft);
197 197
     foreach ($mids as $mid) {
198
-        $module =& $module_handler->get($mid) ;
199
-        $xoops_admin_menu_ft[$mid] = preg_replace('/\<img src\=.*$/', $module->getVar('name').'</a>', $xoops_admin_menu_ft[$mid]) ;
200
-        $xoops_admin_menu_ft[$mid] = '<div style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'">'.$xoops_admin_menu_ft[$mid].'</div>' ;
201
-        $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',45);', $xoops_admin_menu_ml[$mid]) ;
198
+        $module = & $module_handler->get($mid);
199
+        $xoops_admin_menu_ft[$mid] = preg_replace('/\<img src\=.*$/', $module->getVar('name').'</a>', $xoops_admin_menu_ft[$mid]);
200
+        $xoops_admin_menu_ft[$mid] = '<div style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'">'.$xoops_admin_menu_ft[$mid].'</div>';
201
+        $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',45);', $xoops_admin_menu_ml[$mid]);
202 202
     }
203 203
 
204 204
     // write back
205
-    altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_NOIMG )) ;
205
+    altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_NOIMG));
206 206
 }
207 207
 
208 208
 
209 209
 function altsys_adminmenu_hack_ft_xcsty_x20()
210 210
 {
211 211
     // read
212
-    if (! file_exists(ALTSYS_ADMINMENU_FILE)) {
213
-        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ;
214
-        exit ;
212
+    if (!file_exists(ALTSYS_ADMINMENU_FILE)) {
213
+        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu');
214
+        exit;
215 215
     }
216
-    $not_inside_cp_functions = true ;
217
-    include ALTSYS_ADMINMENU_FILE ;
216
+    $not_inside_cp_functions = true;
217
+    include ALTSYS_ADMINMENU_FILE;
218 218
 
219 219
     // check previous hack
220
-    if (! empty($altsys_adminmenu_ft_hacked)) {
220
+    if (!empty($altsys_adminmenu_ft_hacked)) {
221 221
         if ($altsys_adminmenu_ft_hacked == ALTSYS_ADMINMENU_HACK_XCSTY && empty($altsys_adminmenu_dv_updated)) {
222 222
             // skip
223
-            return ;
223
+            return;
224 224
         } else {
225 225
             // rebuild adminmenu
226
-            require_once XOOPS_ROOT_PATH.'/include/cp_functions.php' ;
227
-            $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb') ;
228
-            fwrite($fp, xoops_module_get_admin_menu()) ;
229
-            fclose($fp) ;
226
+            require_once XOOPS_ROOT_PATH.'/include/cp_functions.php';
227
+            $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb');
228
+            fwrite($fp, xoops_module_get_admin_menu());
229
+            fclose($fp);
230 230
             // backup $xoops_admin_menu_dv
231
-            $backup_admin_menu_dv = $xoops_admin_menu_dv ;
231
+            $backup_admin_menu_dv = $xoops_admin_menu_dv;
232 232
             // include new adminmenu
233
-            include ALTSYS_ADMINMENU_FILE ;
233
+            include ALTSYS_ADMINMENU_FILE;
234 234
             // restore $xoops_admin_menu_dv
235
-            $xoops_admin_menu_dv = $backup_admin_menu_dv ;
235
+            $xoops_admin_menu_dv = $backup_admin_menu_dv;
236 236
         }
237 237
     }
238 238
 
239
-    $module_handler =& xoops_gethandler('module') ;
240
-    $mids = array_keys($xoops_admin_menu_ft) ;
239
+    $module_handler = & xoops_gethandler('module');
240
+    $mids = array_keys($xoops_admin_menu_ft);
241 241
     foreach ($mids as $mid) {
242
-        $module =& $module_handler->get($mid) ;
243
-        $submenuitems = array() ;
242
+        $module = & $module_handler->get($mid);
243
+        $submenuitems = array();
244 244
         if (preg_match('/popUpL\d+/', $xoops_admin_menu_ft[$mid], $regs)) {
245
-            $popup = $regs[0] ;
246
-            preg_match_all('#\<a href.*'.$popup.'\(\).*\</a>#U', $xoops_admin_menu_dv, $regs) ;
245
+            $popup = $regs[0];
246
+            preg_match_all('#\<a href.*'.$popup.'\(\).*\</a>#U', $xoops_admin_menu_dv, $regs);
247 247
             foreach ($regs[0] as $submenuitem) {
248
-                $submenuitems[] = str_replace($popup.'();', '', $submenuitem) ;
248
+                $submenuitems[] = str_replace($popup.'();', '', $submenuitem);
249 249
             }
250 250
         } else {
251
-            return ;
251
+            return;
252 252
         }
253 253
         // module icon
254 254
         if (preg_match('#\<img .*/\>#U', $xoops_admin_menu_ft[$mid], $regs)) {
255
-            $icon_img = str_replace("alt=''", 'alt="'.$module->getVar('name').'"', $regs[0]) ;
255
+            $icon_img = str_replace("alt=''", 'alt="'.$module->getVar('name').'"', $regs[0]);
256 256
         } else {
257
-            $icon_img = '' ;
257
+            $icon_img = '';
258 258
         }
259 259
         // version number
260
-        $icon_img .= '<span class="version" style="">' . sprintf('%.2f', $module->getVar('version') / 100.0) . '</span>' ;
261
-        $newline = preg_replace('/ onmouseover.*$/', '', $xoops_admin_menu_ft[$mid]) ;
262
-        $newline = "\n".'<!-- '.$popup.' --><div id="adminmenu_ft'.$mid.'" style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'"><a id="adminmenu_ftpoint'.$mid.'" href="javascript:void(0);" onclick="submenuToggle('.$mid.');">+</a> '.$newline.'>'.$module->getVar('name').'</a></div><div id="adminmenu_ftsub'.$mid.'" style="display:none;"><ul>' ;
260
+        $icon_img .= '<span class="version" style="">'.sprintf('%.2f', $module->getVar('version') / 100.0).'</span>';
261
+        $newline = preg_replace('/ onmouseover.*$/', '', $xoops_admin_menu_ft[$mid]);
262
+        $newline = "\n".'<!-- '.$popup.' --><div id="adminmenu_ft'.$mid.'" style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'"><a id="adminmenu_ftpoint'.$mid.'" href="javascript:void(0);" onclick="submenuToggle('.$mid.');">+</a> '.$newline.'>'.$module->getVar('name').'</a></div><div id="adminmenu_ftsub'.$mid.'" style="display:none;"><ul>';
263 263
         foreach ($submenuitems as $submenuitem) {
264
-            $newline .= '<li>'.$submenuitem.'</li>' ;
264
+            $newline .= '<li>'.$submenuitem.'</li>';
265 265
         }
266
-        $newline .= '</ul>'.$icon_img.'</div>' ;
267
-        $xoops_admin_menu_ft[$mid] = $newline ;
266
+        $newline .= '</ul>'.$icon_img.'</div>';
267
+        $xoops_admin_menu_ft[$mid] = $newline;
268 268
     }
269 269
 
270 270
     $xoops_admin_menu_js = "
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	}" ;
281 281
 
282 282
     // write back
283
-    altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => array(), 'xoops_admin_menu_sd' => array(), 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_XCSTY )) ;
283
+    altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => array(), 'xoops_admin_menu_sd' => array(), 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_XCSTY));
284 284
 }
285 285
 
286 286
 
@@ -291,18 +291,18 @@  discard block
 block discarded – undo
291 291
 function altsys_adminmenu_save_x20($xoops_admin_vars)
292 292
 {
293 293
     // variable definitions
294
-    ob_start() ;
295
-    echo "<?php\n// modified by altsys\nif( ! defined('XOOPS_ROOT_PATH') ) exit ;\n" ;
294
+    ob_start();
295
+    echo "<?php\n// modified by altsys\nif( ! defined('XOOPS_ROOT_PATH') ) exit ;\n";
296 296
     foreach ($xoops_admin_vars as $key => $val) {
297
-        echo '$' . $key . " = \n" ;
298
-        @var_export($val) ;
299
-        echo " ;\n" ;
297
+        echo '$'.$key." = \n";
298
+        @var_export($val);
299
+        echo " ;\n";
300 300
     }
301
-    $output = ob_get_contents() ;
302
-    ob_end_clean() ;
301
+    $output = ob_get_contents();
302
+    ob_end_clean();
303 303
 
304 304
     // embedding logics
305
-    if (in_array(@$xoops_admin_vars['altsys_adminmenu_ft_hacked'], array( ALTSYS_ADMINMENU_HACK_NOIMG, ALTSYS_ADMINMENU_HACK_XCSTY ))) {
305
+    if (in_array(@$xoops_admin_vars['altsys_adminmenu_ft_hacked'], array(ALTSYS_ADMINMENU_HACK_NOIMG, ALTSYS_ADMINMENU_HACK_XCSTY))) {
306 306
         $output .= '
307 307
 
308 308
 if( is_object( @$GLOBALS["xoopsModule"] ) && empty( $not_inside_cp_functions ) ) {
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
     }
318 318
 
319 319
     // termination
320
-    $output .= "\n\n?>" ;
320
+    $output .= "\n\n?>";
321 321
 
322 322
     // replace into XOOPS_URL
323
-    $output = str_replace(XOOPS_URL, "'.XOOPS_URL.'", $output) ;
323
+    $output = str_replace(XOOPS_URL, "'.XOOPS_URL.'", $output);
324 324
 
325 325
     // output
326
-    $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb') ;
327
-    fwrite($fp, $output) ;
328
-    fclose($fp) ;
326
+    $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb');
327
+    fwrite($fp, $output);
328
+    fclose($fp);
329 329
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/autoupdate_from_d3module.inc.php 1 patch
Spacing   +15 added lines, -15 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
-                $mtime = intval(@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")) ;
25
+                $mtime = intval(@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"));
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/include/x20_keepblockoptions.inc.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 global $xoopsDB;
6 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']);
@@ -61,18 +61,18 @@  discard block
 block discarded – undo
61 61
         $iret = $xoopsDB->query($sql);
62 62
     }
63 63
     
64
-    for ($i = 1 ; $i <= $count ; $i++) {
64
+    for ($i = 1; $i <= $count; $i++) {
65 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 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);
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
     }
85 85
 }
86 86
 
87
-global $msgs , $myblocksadmin_parsed_updateblock ;
88
-if (! empty($msgs) && ! empty($local_msgs) && empty($myblocksadmin_parsed_updateblock)) {
89
-    $msgs = array_merge($msgs, $local_msgs) ;
90
-    $myblocksadmin_parsed_updateblock = true ;
87
+global $msgs, $myblocksadmin_parsed_updateblock;
88
+if (!empty($msgs) && !empty($local_msgs) && empty($myblocksadmin_parsed_updateblock)) {
89
+    $msgs = array_merge($msgs, $local_msgs);
90
+    $myblocksadmin_parsed_updateblock = true;
91 91
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/tpls_functions.php 1 patch
Spacing   +59 added lines, -59 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 dirname(__FILE__).'/altsys_functions.php' ;
4
+include_once dirname(__FILE__).'/altsys_functions.php';
5 5
 
6 6
 function tplsadmin_import_data($tplset, $tpl_file, $tpl_source, $lastmodified = 0)
7 7
 {
8
-    $db =& Database::getInstance() ;
8
+    $db = & Database::getInstance();
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,45 +43,45 @@  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 ".$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 ".$db->prefix("tplsource")." WHERE tpl_tplset='".addslashes($tplset_from)."' AND ($whr_append)");
63 63
 
64 64
     while ($row = $db->fetchArray($result)) {
65
-        $tpl_source = array_pop($row) ;
65
+        $tpl_source = array_pop($row);
66 66
 
67
-        $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'])."'") ;
67
+        $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 68
 
69
-        if (! $db->getRowsNum($drs)) {
69
+        if (!$db->getRowsNum($drs)) {
70 70
             // INSERT mode
71
-            $sql = "INSERT INTO ".$db->prefix("tplfile")." (tpl_refid,tpl_module,tpl_tplset,tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type) VALUES (" ;
71
+            $sql = "INSERT INTO ".$db->prefix("tplfile")." (tpl_refid,tpl_module,tpl_tplset,tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type) VALUES (";
72 72
             foreach ($row as $colval) {
73
-                $sql .= "'".addslashes($colval)."'," ;
73
+                $sql .= "'".addslashes($colval)."',";
74 74
             }
75
-            $db->query(substr($sql, 0, -1) . ')') ;
76
-            $tpl_id = $db->getInsertId() ;
77
-            $db->query("INSERT INTO ".$db->prefix("tplsource")." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'") ;
78
-            altsys_template_touch($tpl_id) ;
75
+            $db->query(substr($sql, 0, -1).')');
76
+            $tpl_id = $db->getInsertId();
77
+            $db->query("INSERT INTO ".$db->prefix("tplsource")." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'");
78
+            altsys_template_touch($tpl_id);
79 79
         } else {
80 80
             while (list($tpl_id) = $db->fetchRow($drs)) {
81 81
                 // UPDATE mode
82
-                $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'") ;
83
-                $db->query("UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'") ;
84
-                altsys_template_touch($tpl_id) ;
82
+                $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'");
83
+                $db->query("UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'");
84
+                altsys_template_touch($tpl_id);
85 85
             }
86 86
         }
87 87
     }
@@ -91,31 +91,31 @@  discard block
 block discarded – undo
91 91
 
92 92
 function tplsadmin_copy_templates_f2db($tplset_to, $whr_append = '1')
93 93
 {
94
-    global $db ;
94
+    global $db;
95 95
 
96 96
     // get tplsource
97
-    $result = $db->query("SELECT * FROM ".$db->prefix("tplfile")."  WHERE tpl_tplset='default' AND ($whr_append)") ;
97
+    $result = $db->query("SELECT * FROM ".$db->prefix("tplfile")."  WHERE tpl_tplset='default' AND ($whr_append)");
98 98
 
99 99
     while ($row = $db->fetchArray($result)) {
100
-        $basefilepath = tplsadmin_get_basefilepath($row['tpl_module'], $row['tpl_type'], $row['tpl_file']) ;
101
-        $tpl_source = rtrim(implode("", file($basefilepath))) ;
102
-        $lastmodified = filemtime($basefilepath) ;
100
+        $basefilepath = tplsadmin_get_basefilepath($row['tpl_module'], $row['tpl_type'], $row['tpl_file']);
101
+        $tpl_source = rtrim(implode("", file($basefilepath)));
102
+        $lastmodified = filemtime($basefilepath);
103 103
 
104
-        $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'])."'") ;
104
+        $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 105
 
106
-        if (! $db->getRowsNum($drs)) {
106
+        if (!$db->getRowsNum($drs)) {
107 107
             // INSERT mode
108
-            $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'])."'" ;
109
-            $db->query($sql) ;
110
-            $tpl_id = $db->getInsertId() ;
111
-            $db->query("INSERT INTO ".$db->prefix("tplsource")." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'") ;
112
-            altsys_template_touch($tpl_id) ;
108
+            $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'])."'";
109
+            $db->query($sql);
110
+            $tpl_id = $db->getInsertId();
111
+            $db->query("INSERT INTO ".$db->prefix("tplsource")." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'");
112
+            altsys_template_touch($tpl_id);
113 113
         } else {
114 114
             while (list($tpl_id) = $db->fetchRow($drs)) {
115 115
                 // UPDATE mode
116
-                $db->query("UPDATE ".$db->prefix("tplfile")." SET tpl_lastmodified='".addslashes($lastmodified)."' WHERE tpl_id='$tpl_id'") ;
117
-                $db->query("UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'") ;
118
-                altsys_template_touch($tpl_id) ;
116
+                $db->query("UPDATE ".$db->prefix("tplfile")." SET tpl_lastmodified='".addslashes($lastmodified)."' WHERE tpl_id='$tpl_id'");
117
+                $db->query("UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'");
118
+                altsys_template_touch($tpl_id);
119 119
             }
120 120
         }
121 121
     }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 function tplsadmin_get_basefilepath($dirname, $type, $tpl_file)
127 127
 {
128 128
     // module instance
129
-    $path = $basefilepath = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates/'.($type=='block'?'blocks/':'').$tpl_file ;
129
+    $path = $basefilepath = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates/'.($type == 'block' ? 'blocks/' : '').$tpl_file;
130 130
 
131 131
     if (is_callable('Legacy_Utils::getTrustDirnameByDirname')) {
132 132
         $mytrustdirname = Legacy_Utils::getTrustDirnameByDirname($dirname);
@@ -134,33 +134,33 @@  discard block
 block discarded – undo
134 134
 
135 135
     if (defined('ALTSYS_TPLSADMIN_BASEPATH')) {
136 136
         // Special hook
137
-        $path = ALTSYS_TPLSADMIN_BASEPATH.'/'.substr($tpl_file, strlen($dirname) + 1) ;
137
+        $path = ALTSYS_TPLSADMIN_BASEPATH.'/'.substr($tpl_file, strlen($dirname) + 1);
138 138
     } elseif ($mytrustdirname || @include(XOOPS_ROOT_PATH.'/modules/'.$dirname.'/mytrustdirname.php')) {
139 139
         // D3 module base
140
-        if (! empty($mytrustdirname)) {
141
-            $mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/' ;
140
+        if (!empty($mytrustdirname)) {
141
+            $mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/';
142 142
 
143
-            $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').substr($tpl_file, strlen($dirname) + 1) ;
143
+            $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type == 'block' ? 'blocks/' : '').substr($tpl_file, strlen($dirname) + 1);
144 144
             //new for xcck etc.other trust_module
145
-            if (! file_exists($path)) {
146
-                $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').$tpl_file ;
147
-                if (! file_exists($path)) {
145
+            if (!file_exists($path)) {
146
+                $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type == 'block' ? 'blocks/' : '').$tpl_file;
147
+                if (!file_exists($path)) {
148 148
                     $path = $basefilepath;
149 149
                 }
150 150
             }
151 151
         }
152 152
     }
153 153
 
154
-    return $path ;
154
+    return $path;
155 155
 }
156 156
 
157 157
 
158 158
 function tplsadmin_die($msg, $target_dirname = '', $wait = 2)
159 159
 {
160 160
     if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') {
161
-        redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, $wait, $msg) ;
162
-        exit ;
161
+        redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, $wait, $msg);
162
+        exit;
163 163
     } else {
164
-        die($msg) ;
164
+        die($msg);
165 165
     }
166 166
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/compilehook.inc.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -5,20 +5,20 @@
 block discarded – undo
5 5
 // save assigned variables for the template
6 6
 function tplsadmin_save_tplsvars($file, $smarty)
7 7
 {
8
-    $tplsvars_file = 'tplsvars_' ;
9
-    $tplsvars_file .= substr(md5(substr(XOOPS_DB_PASS, 0, 4)), 0, 4) . '_' ;
8
+    $tplsvars_file = 'tplsvars_';
9
+    $tplsvars_file .= substr(md5(substr(XOOPS_DB_PASS, 0, 4)), 0, 4).'_';
10 10
     if (strncmp($file, 'db:', 3) === 0) {
11
-        $tplsvars_file .= substr($file, 3) ;
11
+        $tplsvars_file .= substr($file, 3);
12 12
     } elseif (strncmp($file, 'file:', 5) === 0) {
13
-        $tplsvars_file .= strtr(substr($file, 5), '/', '%') ;
13
+        $tplsvars_file .= strtr(substr($file, 5), '/', '%');
14 14
     } else {
15
-        $tplsvars_file .= strtr($file, '/', '%') ;
15
+        $tplsvars_file .= strtr($file, '/', '%');
16 16
     }
17 17
 
18 18
     if ($fw = @fopen(XOOPS_COMPILE_PATH.'/'.$tplsvars_file, 'x')) {
19
-        fwrite($fw, serialize($smarty->_tpl_vars)) ;
20
-        fclose($fw) ;
21
-        return true ;
19
+        fwrite($fw, serialize($smarty->_tpl_vars));
20
+        fclose($fw);
21
+        return true;
22 22
     }
23
-    return false ;
23
+    return false;
24 24
 }
Please login to merge, or discard this patch.