Completed
Push — master ( 4d9699...f6489b )
by Michael
03:33
created
xoops_trust_path/libs/altsys/blocks/block_functions.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,33 +1,33 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once dirname(__DIR__).'/include/altsys_functions.php' ;
3
+require_once dirname(__DIR__).'/include/altsys_functions.php';
4 4
 
5 5
 function b_altsys_admin_menu_show($options)
6 6
 {
7
-    global $xoopsUser ;
7
+    global $xoopsUser;
8 8
 
9
-    $mydirname = empty($options[0]) ? 'altsys' : $options[0] ;
10
-    $this_template = empty($options[1]) ? 'db:'.$mydirname.'_block_admin_menu.html' : trim($options[1]) ;
9
+    $mydirname = empty($options[0]) ? 'altsys' : $options[0];
10
+    $this_template = empty($options[1]) ? 'db:'.$mydirname.'_block_admin_menu.html' : trim($options[1]);
11 11
 
12 12
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
13
-        die('Invalid mydirname') ;
13
+        die('Invalid mydirname');
14 14
     }
15
-    if (! is_object(@$xoopsUser)) {
16
-        return array() ;
15
+    if (!is_object(@$xoopsUser)) {
16
+        return array();
17 17
     }
18 18
 
19 19
     // coretype
20
-    $coretype = altsys_get_core_type() ;
20
+    $coretype = altsys_get_core_type();
21 21
 
22 22
     // mid_selected
23 23
     if (is_object(@$GLOBALS['xoopsModule'])) {
24
-        $mid_selected = $GLOBALS['xoopsModule']->getVar('mid') ;
24
+        $mid_selected = $GLOBALS['xoopsModule']->getVar('mid');
25 25
         // for system->preferences
26
-        if ($mid_selected == 1 && @$_GET['fct'] == 'preferences' && @$_GET['op'] == 'showmod' && ! empty($_GET['mod'])) {
26
+        if ($mid_selected == 1 && @$_GET['fct'] == 'preferences' && @$_GET['op'] == 'showmod' && !empty($_GET['mod'])) {
27 27
             $mid_selected = (int)$_GET['mod'];
28 28
         }
29 29
     } else {
30
-        $mid_selected = 0 ;
30
+        $mid_selected = 0;
31 31
     }
32 32
 
33 33
     $db = XoopsDatabaseFactory::getDatabaseConnection();
@@ -36,72 +36,72 @@  discard block
 block discarded – undo
36 36
     $module_handler = xoops_getHandler('module');
37 37
     $current_module = $module_handler->getByDirname($mydirname);
38 38
     $config_handler = xoops_getHandler('config');
39
-    $current_configs = $config_handler->getConfigList($current_module->mid()) ;
39
+    $current_configs = $config_handler->getConfigList($current_module->mid());
40 40
     $moduleperm_handler = xoops_getHandler('groupperm');
41 41
     $admin_mids = $moduleperm_handler->getItemIds('module_admin', $xoopsUser->getGroups());
42
-    $modules = $module_handler->getObjects(new Criteria('mid', '('.implode(',', $admin_mids) . ')', 'IN'), true) ;
42
+    $modules = $module_handler->getObjects(new Criteria('mid', '('.implode(',', $admin_mids).')', 'IN'), true);
43 43
 
44 44
     $block = array(
45
-        'mydirname' => $mydirname ,
46
-        'mod_url' => XOOPS_URL.'/modules/'.$mydirname ,
47
-        'mod_imageurl' => XOOPS_URL.'/modules/'.$mydirname.'/'.$current_configs['images_dir'] ,
45
+        'mydirname' => $mydirname,
46
+        'mod_url' => XOOPS_URL.'/modules/'.$mydirname,
47
+        'mod_imageurl' => XOOPS_URL.'/modules/'.$mydirname.'/'.$current_configs['images_dir'],
48 48
         'mod_config' => $current_configs
49
-    ) ;
49
+    );
50 50
 
51 51
     foreach ($modules as $mod) {
52 52
         $mid = (int)$mod->getVar('mid');
53
-        $dirname = $mod->getVar('dirname') ;
54
-        $modinfo = $mod->getInfo() ;
55
-        $submenus4assign = array() ;
56
-        $adminmenu = array() ;
57
-        $adminmenu4altsys = array() ;
58
-        unset($adminmenu_use_altsys) ;
59
-        @include XOOPS_ROOT_PATH.'/modules/'.$dirname.'/'.@$modinfo['adminmenu'] ;
53
+        $dirname = $mod->getVar('dirname');
54
+        $modinfo = $mod->getInfo();
55
+        $submenus4assign = array();
56
+        $adminmenu = array();
57
+        $adminmenu4altsys = array();
58
+        unset($adminmenu_use_altsys);
59
+        @include XOOPS_ROOT_PATH.'/modules/'.$dirname.'/'.@$modinfo['adminmenu'];
60 60
         // from admin_menu.php etc.
61
-        $adminmenu = array_merge($adminmenu, $adminmenu4altsys) ;
61
+        $adminmenu = array_merge($adminmenu, $adminmenu4altsys);
62 62
         foreach ($adminmenu as $sub) {
63
-            $link = empty($sub['altsys_link']) ? $sub['link'] : $sub['altsys_link'] ;
63
+            $link = empty($sub['altsys_link']) ? $sub['link'] : $sub['altsys_link'];
64 64
             if (isset($sub['show']) && $sub['show'] === false) {
65
-                continue ;
65
+                continue;
66 66
             }
67 67
             $submenus4assign[] = array(
68
-                'title' => $myts->makeTboxData4Show($sub['title']) ,
68
+                'title' => $myts->makeTboxData4Show($sub['title']),
69 69
                 'url' => XOOPS_URL.'/modules/'.$dirname.'/'.htmlspecialchars($link, ENT_QUOTES)
70
-            ) ;
70
+            );
71 71
         }
72 72
 
73 73
         // for modules overriding Module.class.php (eg. Analyzer for XC)
74
-        if (empty($submenus4assign) && defined('XOOPS_CUBE_LEGACY') && ! empty($modinfo['cube_style'])) {
74
+        if (empty($submenus4assign) && defined('XOOPS_CUBE_LEGACY') && !empty($modinfo['cube_style'])) {
75 75
             $module_handler = xoops_getHandler('module');
76 76
             $module = $module_handler->get($mid);
77 77
             $moduleObj = Legacy_Utils::createModule($module);
78
-            $modinfo['adminindex'] = $moduleObj->getAdminIndex() ;
79
-            $modinfo['adminindex_absolute'] = true ;
78
+            $modinfo['adminindex'] = $moduleObj->getAdminIndex();
79
+            $modinfo['adminindex_absolute'] = true;
80 80
             foreach ($moduleObj->getAdminMenu() as $sub) {
81 81
                 if (@$sub['show'] === false) {
82
-                    continue ;
82
+                    continue;
83 83
                 }
84 84
                 $submenus4assign[] = array(
85
-                    'title' => $myts->makeTboxData4Show($sub['title']) ,
85
+                    'title' => $myts->makeTboxData4Show($sub['title']),
86 86
                     'url' => strncmp($sub['link'], 'http', 4) === 0 ? htmlspecialchars($sub['link'], ENT_QUOTES) : XOOPS_URL.'/modules/'.$dirname.'/'.htmlspecialchars($sub['link'], ENT_QUOTES)
87
-                ) ;
87
+                );
88 88
             }
89 89
         } elseif (empty($adminmenu4altsys)) {
90 90
 
91 91
             // add preferences
92
-            if ($mod->getVar('hasconfig') && ! in_array($mod->getVar('dirname'), array( 'system', 'legacy' ))) {
92
+            if ($mod->getVar('hasconfig') && !in_array($mod->getVar('dirname'), array('system', 'legacy'))) {
93 93
                 $submenus4assign[] = array(
94
-                    'title' => _PREFERENCES ,
94
+                    'title' => _PREFERENCES,
95 95
                     'url' => htmlspecialchars(altsys_get_link2modpreferences($mid, $coretype), ENT_QUOTES)
96
-                ) ;
96
+                );
97 97
             }
98 98
 
99 99
             // add help
100
-            if (defined('XOOPS_CUBE_LEGACY') && ! empty($modinfo['help'])) {
100
+            if (defined('XOOPS_CUBE_LEGACY') && !empty($modinfo['help'])) {
101 101
                 $submenus4assign[] = array(
102
-                    'title' => _HELP ,
102
+                    'title' => _HELP,
103 103
                     'url' => XOOPS_URL.'/modules/legacy/admin/index.php?action=Help&amp;dirname='.$dirname
104
-                ) ;
104
+                );
105 105
             }
106 106
         }
107 107
 
@@ -123,25 +123,25 @@  discard block
 block discarded – undo
123 123
             'submenu' => $submenus4assign,
124 124
             'selected' => $mid == $mid_selected,
125 125
             'dot_suffix' => $mid == $mid_selected ? 'selected_opened' : 'closed'
126
-        ) ;
127
-        $block['modules'][] = $module4assign ;
126
+        );
127
+        $block['modules'][] = $module4assign;
128 128
     }
129 129
 
130
-    require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ;
131
-    $tpl = new D3Tpl() ;
132
-    $tpl->assign('block', $block) ;
133
-    $ret['content'] = $tpl->fetch($this_template) ;
134
-    return $ret ;
130
+    require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php';
131
+    $tpl = new D3Tpl();
132
+    $tpl->assign('block', $block);
133
+    $ret['content'] = $tpl->fetch($this_template);
134
+    return $ret;
135 135
 }
136 136
 
137 137
 
138 138
 function b_altsys_admin_menu_edit($options)
139 139
 {
140
-    $mydirname = empty($options[0]) ? 'd3forum' : $options[0] ;
141
-    $this_template = empty($options[1]) ? 'db:'.$mydirname.'_block_admin_menu.html' : trim($options[1]) ;
140
+    $mydirname = empty($options[0]) ? 'd3forum' : $options[0];
141
+    $this_template = empty($options[1]) ? 'db:'.$mydirname.'_block_admin_menu.html' : trim($options[1]);
142 142
 
143 143
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
144
-        die('Invalid mydirname') ;
144
+        die('Invalid mydirname');
145 145
     }
146 146
 
147 147
     $form = "
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/mytplsadmin.php 1 patch
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -5,63 +5,63 @@  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/tpls_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
+include_once __DIR__.'/include/tpls_functions.php';
12 12
 
13 13
 
14 14
 // only groups have 'module_admin' of 'altsys' can do that.
15
-$module_handler = xoops_getHandler('module') ;
16
-$module = $module_handler->getByDirname('altsys') ;
17
-if (! is_object($module)) {
18
-    die('install altsys') ;
15
+$module_handler = xoops_getHandler('module');
16
+$module = $module_handler->getByDirname('altsys');
17
+if (!is_object($module)) {
18
+    die('install altsys');
19 19
 }
20
-$moduleperm_handler = xoops_getHandler('groupperm') ;
21
-if (! is_object(@$xoopsUser) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) {
22
-    die('only admin of altsys can access this area') ;
20
+$moduleperm_handler = xoops_getHandler('groupperm');
21
+if (!is_object(@$xoopsUser) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) {
22
+    die('only admin of altsys can access this area');
23 23
 }
24 24
 
25 25
 
26 26
 // initials
27 27
 $db = XoopsDatabaseFactory::getDatabaseConnection();
28
-(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance() ;
28
+(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance();
29 29
 
30 30
 // language file
31
-altsys_include_language_file('mytplsadmin') ;
31
+altsys_include_language_file('mytplsadmin');
32 32
 
33 33
 // check $xoopsModule
34
-if (! is_object($xoopsModule)) {
35
-    redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM) ;
34
+if (!is_object($xoopsModule)) {
35
+    redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM);
36 36
 }
37 37
 
38 38
 // set target_module if specified by $_GET['dirname']
39 39
 $module_handler = xoops_getHandler('module');
40
-if (! empty($_GET['dirname'])) {
41
-    $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']) ;
42
-    $target_module = $module_handler->getByDirname($dirname) ;
40
+if (!empty($_GET['dirname'])) {
41
+    $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']);
42
+    $target_module = $module_handler->getByDirname($dirname);
43 43
 }
44 44
 
45
-if (! empty($target_module) && is_object($target_module)) {
45
+if (!empty($target_module) && is_object($target_module)) {
46 46
     // specified by dirname (for tplsadmin as an independent module)
47
-    $target_mid = $target_module->getVar('mid') ;
48
-    $target_dirname = $target_module->getVar('dirname') ;
49
-    $target_dirname4sql = addslashes($target_dirname) ;
50
-    $target_mname = $target_module->getVar('name') . '&nbsp;' . sprintf('(%2.2f)', $target_module->getVar('version') / 100.0) ;
47
+    $target_mid = $target_module->getVar('mid');
48
+    $target_dirname = $target_module->getVar('dirname');
49
+    $target_dirname4sql = addslashes($target_dirname);
50
+    $target_mname = $target_module->getVar('name').'&nbsp;'.sprintf('(%2.2f)', $target_module->getVar('version') / 100.0);
51 51
     //$query4redirect = '?dirname='.urlencode(strip_tags($_GET['dirname'])) ;
52 52
 } elseif (@$_GET['dirname'] == '_custom') {
53 53
     // custom template
54
-    $target_mid = 0 ;
55
-    $target_dirname = '_custom' ;
56
-    $target_dirname4sql = '_custom' ;
57
-    $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE ;
54
+    $target_mid = 0;
55
+    $target_dirname = '_custom';
56
+    $target_dirname4sql = '_custom';
57
+    $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE;
58 58
     //$query4redirect = '' ;
59 59
 } else {
60 60
     // not specified by dirname (for 3rd party modules as mytplsadmin)
61
-    $target_mid = $xoopsModule->getVar('mid') ;
62
-    $target_dirname = $xoopsModule->getVar('dirname') ;
63
-    $target_dirname4sql = addslashes($target_dirname) ;
64
-    $target_mname = $xoopsModule->getVar('name') ;
61
+    $target_mid = $xoopsModule->getVar('mid');
62
+    $target_dirname = $xoopsModule->getVar('dirname');
63
+    $target_dirname4sql = addslashes($target_dirname);
64
+    $target_mname = $xoopsModule->getVar('name');
65 65
     //$query4redirect = '' ;
66 66
 }
67 67
 
@@ -71,129 +71,129 @@  discard block
 block discarded – undo
71 71
 //**************//
72 72
 
73 73
 // Create new template set (blank or clone)
74
-if (! empty($_POST['clone_tplset_do']) && ! empty($_POST['clone_tplset_from']) && ! empty($_POST['clone_tplset_to'])) {
74
+if (!empty($_POST['clone_tplset_do']) && !empty($_POST['clone_tplset_from']) && !empty($_POST['clone_tplset_to'])) {
75 75
     // Ticket Check
76
-    if (! $xoopsGTicket->check()) {
76
+    if (!$xoopsGTicket->check()) {
77 77
         redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
78 78
     }
79 79
 
80
-    $tplset_from = $myts->stripSlashesGPC($_POST['clone_tplset_from']) ;
81
-    $tplset_to = $myts->stripSlashesGPC($_POST['clone_tplset_to']) ;
80
+    $tplset_from = $myts->stripSlashesGPC($_POST['clone_tplset_from']);
81
+    $tplset_to = $myts->stripSlashesGPC($_POST['clone_tplset_to']);
82 82
     // check tplset_name "from" and "to"
83
-    if (! preg_match('/^[0-9A-Za-z_-]{1,16}$/', $_POST['clone_tplset_from'])) {
84
-        tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDSETNAME, $target_dirname) ;
83
+    if (!preg_match('/^[0-9A-Za-z_-]{1,16}$/', $_POST['clone_tplset_from'])) {
84
+        tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDSETNAME, $target_dirname);
85 85
     }
86
-    if (! preg_match('/^[0-9A-Za-z_-]{1,16}$/', $_POST['clone_tplset_to'])) {
87
-        tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDSETNAME, $target_dirname) ;
86
+    if (!preg_match('/^[0-9A-Za-z_-]{1,16}$/', $_POST['clone_tplset_to'])) {
87
+        tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDSETNAME, $target_dirname);
88 88
     }
89
-    list($is_exist) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset_to) . "'")) ;
89
+    list($is_exist) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset_to)."'"));
90 90
     if ($is_exist) {
91
-        tplsadmin_die(_MYTPLSADMIN_ERR_DUPLICATEDSETNAME, $target_dirname) ;
91
+        tplsadmin_die(_MYTPLSADMIN_ERR_DUPLICATEDSETNAME, $target_dirname);
92 92
     }
93
-    list($is_exist) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('tplset') . " WHERE tplset_name='" . addslashes($tplset_to) . "'")) ;
93
+    list($is_exist) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('tplset')." WHERE tplset_name='".addslashes($tplset_to)."'"));
94 94
     if ($is_exist) {
95
-        tplsadmin_die(_MYTPLSADMIN_ERR_DUPLICATEDSETNAME, $target_dirname) ;
95
+        tplsadmin_die(_MYTPLSADMIN_ERR_DUPLICATEDSETNAME, $target_dirname);
96 96
     }
97 97
     // insert tplset table
98
-    $db->query('INSERT INTO ' . $db->prefix('tplset') . " SET tplset_name='" . addslashes($tplset_to) . "', tplset_desc='Created by tplsadmin', tplset_created=UNIX_TIMESTAMP()") ;
99
-    tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, "tpl_module='$target_dirname4sql'") ;
100
-    redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED) ;
101
-    exit ;
98
+    $db->query('INSERT INTO '.$db->prefix('tplset')." SET tplset_name='".addslashes($tplset_to)."', tplset_desc='Created by tplsadmin', tplset_created=UNIX_TIMESTAMP()");
99
+    tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, "tpl_module='$target_dirname4sql'");
100
+    redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED);
101
+    exit;
102 102
 }
103 103
 
104 104
 // DB to DB template copy (checked templates)
105 105
 if (is_array(@$_POST['copy_do'])) {
106 106
     foreach ($_POST['copy_do'] as $tplset_from_tmp => $val) {
107
-        if (! empty($val)) {
107
+        if (!empty($val)) {
108 108
             // Ticket Check
109
-    if (! $xoopsGTicket->check()) {
109
+    if (!$xoopsGTicket->check()) {
110 110
         redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
111 111
     }
112 112
 
113
-            $tplset_from = $myts->stripSlashesGPC($tplset_from_tmp) ;
113
+            $tplset_from = $myts->stripSlashesGPC($tplset_from_tmp);
114 114
             if (empty($_POST['copy_to'][$tplset_from]) || $_POST['copy_to'][$tplset_from] == $tplset_from) {
115
-                tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDTPLSET, $target_dirname) ;
115
+                tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDTPLSET, $target_dirname);
116 116
             }
117 117
             if (empty($_POST["{$tplset_from}_check"])) {
118
-                tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname) ;
118
+                tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname);
119 119
             }
120
-            $tplset_to = $myts->stripSlashesGPC($_POST['copy_to'][$tplset_from]) ;
120
+            $tplset_to = $myts->stripSlashesGPC($_POST['copy_to'][$tplset_from]);
121 121
             foreach ($_POST["{$tplset_from}_check"] as $tplfile_tmp => $val) {
122 122
                 if (empty($val)) {
123
-                    continue ;
123
+                    continue;
124 124
                 }
125
-                $tplfile = $myts->stripSlashesGPC($tplfile_tmp) ;
126
-                tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, "tpl_file='".addslashes($tplfile)."'") ;
125
+                $tplfile = $myts->stripSlashesGPC($tplfile_tmp);
126
+                tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, "tpl_file='".addslashes($tplfile)."'");
127 127
             }
128
-            redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED) ;
129
-            exit ;
128
+            redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED);
129
+            exit;
130 130
         }
131 131
     }
132 132
 }
133 133
 
134 134
 // File to DB template copy (checked templates)
135
-if (! empty($_POST['copyf2db_do'])) {
135
+if (!empty($_POST['copyf2db_do'])) {
136 136
     // Ticket Check
137
-    if (! $xoopsGTicket->check()) {
137
+    if (!$xoopsGTicket->check()) {
138 138
         redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
139 139
     }
140 140
 
141 141
     if (empty($_POST['copyf2db_to'])) {
142
-        tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDTPLSET, $target_dirname) ;
142
+        tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDTPLSET, $target_dirname);
143 143
     }
144 144
     if (empty($_POST['basecheck'])) {
145
-        tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname) ;
145
+        tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname);
146 146
     }
147
-    $tplset_to = $myts->stripSlashesGPC($_POST['copyf2db_to']) ;
147
+    $tplset_to = $myts->stripSlashesGPC($_POST['copyf2db_to']);
148 148
     foreach ($_POST['basecheck'] as $tplfile_tmp => $val) {
149 149
         if (empty($val)) {
150
-            continue ;
150
+            continue;
151 151
         }
152
-        $tplfile = $myts->stripSlashesGPC($tplfile_tmp) ;
153
-        tplsadmin_copy_templates_f2db($tplset_to, "tpl_file='".addslashes($tplfile)."'") ;
152
+        $tplfile = $myts->stripSlashesGPC($tplfile_tmp);
153
+        tplsadmin_copy_templates_f2db($tplset_to, "tpl_file='".addslashes($tplfile)."'");
154 154
     }
155
-    redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED) ;
156
-    exit ;
155
+    redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED);
156
+    exit;
157 157
 }
158 158
 
159 159
 // DB template remove (checked templates)
160 160
 if (is_array(@$_POST['del_do'])) {
161 161
     foreach ($_POST['del_do'] as $tplset_from_tmp => $val) {
162
-        if (! empty($val)) {
162
+        if (!empty($val)) {
163 163
             // Ticket Check
164
-    if (! $xoopsGTicket->check()) {
164
+    if (!$xoopsGTicket->check()) {
165 165
         redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
166 166
     }
167 167
 
168
-            $tplset_from = $myts->stripSlashesGPC($tplset_from_tmp) ;
168
+            $tplset_from = $myts->stripSlashesGPC($tplset_from_tmp);
169 169
             if ($tplset_from == 'default' && $target_dirname != '_custom') {
170
-                tplsadmin_die(_MYTPLSADMIN_ERR_CANTREMOVEDEFAULT, $target_dirname) ;
170
+                tplsadmin_die(_MYTPLSADMIN_ERR_CANTREMOVEDEFAULT, $target_dirname);
171 171
             }
172 172
             if (empty($_POST["{$tplset_from}_check"])) {
173
-                tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname) ;
173
+                tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname);
174 174
             }
175 175
 
176
-            require_once XOOPS_ROOT_PATH.'/class/template.php' ;
176
+            require_once XOOPS_ROOT_PATH.'/class/template.php';
177 177
             $tpl = new XoopsTpl();
178 178
             $tpl->force_compile = true;
179 179
 
180 180
             foreach ($_POST["{$tplset_from}_check"] as $tplfile_tmp => $val) {
181 181
                 if (empty($val)) {
182
-                    continue ;
182
+                    continue;
183 183
                 }
184
-                $tplfile = $myts->stripSlashesGPC($tplfile_tmp) ;
185
-                $result = $db->query('SELECT tpl_id FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset_from) . "' AND tpl_file='" . addslashes($tplfile) . "'") ;
184
+                $tplfile = $myts->stripSlashesGPC($tplfile_tmp);
185
+                $result = $db->query('SELECT tpl_id FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset_from)."' AND tpl_file='".addslashes($tplfile)."'");
186 186
                 while (list($tpl_id) = $db->fetchRow($result)) {
187 187
                     $tpl_id = (int)$tpl_id;
188
-                    $db->query('DELETE FROM ' . $db->prefix('tplfile') . " WHERE tpl_id=$tpl_id") ;
189
-                    $db->query('DELETE FROM ' . $db->prefix('tplsource') . " WHERE tpl_id=$tpl_id") ;
188
+                    $db->query('DELETE FROM '.$db->prefix('tplfile')." WHERE tpl_id=$tpl_id");
189
+                    $db->query('DELETE FROM '.$db->prefix('tplsource')." WHERE tpl_id=$tpl_id");
190 190
                 }
191 191
         // remove templates_c
192 192
         $tpl->clear_cache('db:'.$tplfile);
193 193
                 $tpl->clear_compiled_tpl('db:'.$tplfile);
194 194
             }
195
-            redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED) ;
196
-            exit ;
195
+            redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED);
196
+            exit;
197 197
         }
198 198
     }
199 199
 }
@@ -234,60 +234,60 @@  discard block
 block discarded – undo
234 234
 EOD;
235 235
 
236 236
 // get tplsets
237
-$tplset_handler = xoops_getHandler('tplset') ;
238
-$tplsets = array_keys($tplset_handler->getList()) ;
239
-$sql = 'SELECT distinct tpl_tplset FROM ' . $db->prefix('tplfile') . " ORDER BY tpl_tplset='default' DESC,tpl_tplset" ;
237
+$tplset_handler = xoops_getHandler('tplset');
238
+$tplsets = array_keys($tplset_handler->getList());
239
+$sql = 'SELECT distinct tpl_tplset FROM '.$db->prefix('tplfile')." ORDER BY tpl_tplset='default' DESC,tpl_tplset";
240 240
 $srs = $db->query($sql);
241 241
 while (list($tplset) = $db->fetchRow($srs)) {
242
-    if (! in_array($tplset, $tplsets)) {
243
-        $tplsets[] = $tplset ;
242
+    if (!in_array($tplset, $tplsets)) {
243
+        $tplsets[] = $tplset;
244 244
     }
245 245
 }
246 246
 
247
-$tplsets_th4disp = '' ;
248
-$tplset_options = "<option value=''>----</option>\n" ;
247
+$tplsets_th4disp = '';
248
+$tplset_options = "<option value=''>----</option>\n";
249 249
 foreach ($tplsets as $tplset) {
250
-    $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ;
250
+    $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES);
251 251
     $active = $th_attr = '';
252 252
     if ($tplset == $xoopsConfig['template_set']) {
253 253
         $th_attr = "class='active dbtplset_active'";
254 254
         $active = '<sup>*</sup>';
255 255
     }
256
-    $tplsets_th4disp .= "<th $th_attr><input type='checkbox' title='"._MYTPLSADMIN_TITLE_CHECKALL."' onclick=\"with(document.MainForm){for(i=0;i<length;i++){if(elements[i].type==='checkbox'&&elements[i].name.indexOf('{$tplset4disp}_check')>=0){elements[i].checked=this.checked;}}}\" />{$active}DB-{$tplset4disp}</th>" ;
257
-    $tplset_options .= "<option value='$tplset4disp'>$tplset4disp</option>\n" ;
256
+    $tplsets_th4disp .= "<th $th_attr><input type='checkbox' title='"._MYTPLSADMIN_TITLE_CHECKALL."' onclick=\"with(document.MainForm){for(i=0;i<length;i++){if(elements[i].type==='checkbox'&&elements[i].name.indexOf('{$tplset4disp}_check')>=0){elements[i].checked=this.checked;}}}\" />{$active}DB-{$tplset4disp}</th>";
257
+    $tplset_options .= "<option value='$tplset4disp'>$tplset4disp</option>\n";
258 258
 }
259 259
 
260 260
 // get tpl_file owned by the module
261
-$sql = 'SELECT tpl_file,tpl_desc,tpl_type,COUNT(tpl_id) FROM ' . $db->prefix('tplfile') . " WHERE tpl_module='$target_dirname4sql' GROUP BY tpl_file ORDER BY tpl_type, tpl_file" ;
261
+$sql = 'SELECT tpl_file,tpl_desc,tpl_type,COUNT(tpl_id) FROM '.$db->prefix('tplfile')." WHERE tpl_module='$target_dirname4sql' GROUP BY tpl_file ORDER BY tpl_type, tpl_file";
262 262
 $frs = $db->query($sql);
263 263
 
264
-xoops_cp_header() ;
264
+xoops_cp_header();
265 265
 
266 266
 // css display
267
-require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ;
268
-$tpl = new D3Tpl() ;
267
+require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php';
268
+$tpl = new D3Tpl();
269 269
 echo '<style scoped="scoped">';
270
-$tpl->display('db:altsys_inc_mytplsadmin.css') ;
270
+$tpl->display('db:altsys_inc_mytplsadmin.css');
271 271
 echo '</style>';
272 272
 
273 273
 // javascript
274 274
 echo $javascript;
275 275
 
276 276
 // mymenu
277
-altsys_include_mymenu() ;
277
+altsys_include_mymenu();
278 278
 
279 279
 // breadcrumbs
280
-$breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
280
+$breadcrumbsObj = AltsysBreadcrumbs::getInstance();
281 281
 if ($breadcrumbsObj->hasPaths()) {
282
-    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', _MI_ALTSYS_MENU_MYTPLSADMIN) ;
283
-    $breadcrumbsObj->appendPath('', $target_mname) ;
282
+    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', _MI_ALTSYS_MENU_MYTPLSADMIN);
283
+    $breadcrumbsObj->appendPath('', $target_mname);
284 284
 }
285 285
 
286
-echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>"._MYTPLSADMIN_H3_MODULE." : $target_mname</h3>\n" ;
286
+echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>"._MYTPLSADMIN_H3_MODULE." : $target_mname</h3>\n";
287 287
 
288 288
 // link to create a new custom template
289 289
 if ($target_dirname == '_custom') {
290
-    echo "<a href='index.php?mode=admin&lib=altsys&page=mytplsform&tpl_tplset=default'>"._MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE."</a>\n" ;
290
+    echo "<a href='index.php?mode=admin&lib=altsys&page=mytplsform&tpl_tplset=default'>"._MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE."</a>\n";
291 291
 }
292 292
 
293 293
 // beggining of table & form
@@ -296,18 +296,18 @@  discard block
 block discarded – undo
296 296
 	".$xoopsGTicket->getTicketHtml(__LINE__)."
297 297
 	<table class='outer altsys_mytplsadmin'>
298 298
 		<tr>
299
-            <th>"._MYTPLSADMIN_TH_NAME . '</th>
300
-            <th>' . _MYTPLSADMIN_TH_TYPE . "</th>
299
+            <th>"._MYTPLSADMIN_TH_NAME.'</th>
300
+            <th>' . _MYTPLSADMIN_TH_TYPE."</th>
301 301
 			<th><input type='checkbox' title="._MYTPLSADMIN_TITLE_CHECKALL." onclick=\"with(document.MainForm){for(i=0;i<length;i++){if(elements[i].type==='checkbox'&&elements[i].name.indexOf('basecheck')>=0){elements[i].checked=this.checked;}}}\" />"._MYTPLSADMIN_TH_FILE."</th>
302 302
 			$tplsets_th4disp
303
-		</tr>\n" ;
303
+		</tr>\n";
304 304
 
305 305
 // STYLE for distinguishing fingerprints
306
-$fingerprint_classes = array( '' , ' fingerprint1' , ' fingerprint2' , ' fingerprint3' , ' fingerprint4' , ' fingerprint5' , ' fingerprint6' , ' fingerprint7' ) ;
306
+$fingerprint_classes = array('', ' fingerprint1', ' fingerprint2', ' fingerprint3', ' fingerprint4', ' fingerprint5', ' fingerprint6', ' fingerprint7');
307 307
 
308 308
 // template ROWS
309 309
 while (list($tpl_file, $tpl_desc, $type, $count) = $db->fetchRow($frs)) {
310
-    $evenodd = @$evenodd == 'even' ? 'odd' : 'even' ;
310
+    $evenodd = @$evenodd == 'even' ? 'odd' : 'even';
311 311
     $fingerprints = array();
312 312
 
313 313
     // information about the template
@@ -315,64 +315,64 @@  discard block
 block discarded – undo
315 315
 		<tr>
316 316
 			<td class='$evenodd'>
317 317
 				<dl>
318
-                    <dt>".htmlspecialchars($tpl_file, ENT_QUOTES) . '</dt>
319
-                    <dd>' . htmlspecialchars($tpl_desc, ENT_QUOTES) . "</dd>
318
+                    <dt>".htmlspecialchars($tpl_file, ENT_QUOTES).'</dt>
319
+                    <dd>' . htmlspecialchars($tpl_desc, ENT_QUOTES)."</dd>
320 320
 				</dl>
321 321
 			</td>
322
-            <td class='$evenodd'>".$type . '<br />(' . $count . ")</td>\n" ;
322
+            <td class='$evenodd'>".$type.'<br />('.$count.")</td>\n";
323 323
 
324 324
     // the base file template column
325
-    $basefilepath = tplsadmin_get_basefilepath($target_dirname, $type, $tpl_file) ;
325
+    $basefilepath = tplsadmin_get_basefilepath($target_dirname, $type, $tpl_file);
326 326
 
327 327
     if (file_exists($basefilepath)) {
328
-        $fingerprint = tplsadmin_get_fingerprint(file($basefilepath)) ;
329
-        $fingerprints[ $fingerprint ] = '' ;
330
-        echo "<td class='$evenodd'>".formatTimestamp(filemtime($basefilepath), 'm').'<br />'.substr($fingerprint, 0, 16)."<br /><input type='checkbox' name='basecheck[$tpl_file]' value='1' /></td>\n" ;
331
-        $fingerprint_class_count = 0 ;
328
+        $fingerprint = tplsadmin_get_fingerprint(file($basefilepath));
329
+        $fingerprints[$fingerprint] = '';
330
+        echo "<td class='$evenodd'>".formatTimestamp(filemtime($basefilepath), 'm').'<br />'.substr($fingerprint, 0, 16)."<br /><input type='checkbox' name='basecheck[$tpl_file]' value='1' /></td>\n";
331
+        $fingerprint_class_count = 0;
332 332
     } else {
333
-        echo "<td class='$evenodd'><br /></td>" ;
334
-        $fingerprint_class_count = -1 ;
333
+        echo "<td class='$evenodd'><br /></td>";
334
+        $fingerprint_class_count = -1;
335 335
     }
336 336
 
337 337
     // db template columns
338 338
     foreach ($tplsets as $tplset) {
339
-        $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ;
339
+        $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES);
340 340
 
341 341
         // query for templates in db
342
-        $drs = $db->query('SELECT * FROM ' . $db->prefix('tplfile') . ' f NATURAL LEFT JOIN ' . $db->prefix('tplsource') . " s WHERE tpl_file='" . addslashes($tpl_file) . "' AND tpl_tplset='" . addslashes($tplset) . "'") ;
343
-        $numrows = $db->getRowsNum($drs) ;
344
-        $tpl = $db->fetchArray($drs) ;
342
+        $drs = $db->query('SELECT * FROM '.$db->prefix('tplfile').' f NATURAL LEFT JOIN '.$db->prefix('tplsource')." s WHERE tpl_file='".addslashes($tpl_file)."' AND tpl_tplset='".addslashes($tplset)."'");
343
+        $numrows = $db->getRowsNum($drs);
344
+        $tpl = $db->fetchArray($drs);
345 345
         if (empty($tpl['tpl_id'])) {
346
-            echo "<td class='$evenodd'>($numrows)</td>\n" ;
346
+            echo "<td class='$evenodd'>($numrows)</td>\n";
347 347
         } else {
348
-            $fingerprint = tplsadmin_get_fingerprint(explode("\n", $tpl['tpl_source'])) ;
349
-            if (isset($fingerprints[ $fingerprint ])) {
350
-                $class = $fingerprints[ $fingerprint ] ;
348
+            $fingerprint = tplsadmin_get_fingerprint(explode("\n", $tpl['tpl_source']));
349
+            if (isset($fingerprints[$fingerprint])) {
350
+                $class = $fingerprints[$fingerprint];
351 351
             } else {
352 352
                 //$fingerprint_class_count ++ ;
353
-                $class = $fingerprint_classes[++$fingerprint_class_count] ;
354
-                $fingerprints[ $fingerprint ] = $class ;
353
+                $class = $fingerprint_classes[++$fingerprint_class_count];
354
+                $fingerprints[$fingerprint] = $class;
355 355
             }
356
-            echo "<td class='{$evenodd}{$class}'>".formatTimestamp($tpl['tpl_lastmodified'], 'm').'<br />'.substr($fingerprint, 0, 16)."<br /><input type='checkbox' name='{$tplset4disp}_check[{$tpl_file}]' value='1' /> &nbsp; <a href='?mode=admin&amp;lib=altsys&amp;page=mytplsform&amp;tpl_file=".htmlspecialchars($tpl['tpl_file'], ENT_QUOTES) . '&amp;tpl_tplset='
357
-                 . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES) . '&amp;dirname=' . htmlspecialchars($target_dirname, ENT_QUOTES) . "'>" . _EDIT . "</a> ($numrows)</td>\n" ;
356
+            echo "<td class='{$evenodd}{$class}'>".formatTimestamp($tpl['tpl_lastmodified'], 'm').'<br />'.substr($fingerprint, 0, 16)."<br /><input type='checkbox' name='{$tplset4disp}_check[{$tpl_file}]' value='1' /> &nbsp; <a href='?mode=admin&amp;lib=altsys&amp;page=mytplsform&amp;tpl_file=".htmlspecialchars($tpl['tpl_file'], ENT_QUOTES).'&amp;tpl_tplset='
357
+                 . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES).'&amp;dirname='.htmlspecialchars($target_dirname, ENT_QUOTES)."'>"._EDIT."</a> ($numrows)</td>\n";
358 358
         }
359 359
     }
360 360
 
361
-    echo "</tr>\n" ;
361
+    echo "</tr>\n";
362 362
 }
363 363
 
364 364
 // command submit ROW
365 365
 echo "
366 366
 	<tr>
367 367
 		<td class='head'>
368
-            "._MYTPLSADMIN_CREATE_NEW_TPLSET . ': <br />
369
-            ' . _MYTPLSADMIN_CAPTION_BASE . ":
368
+            "._MYTPLSADMIN_CREATE_NEW_TPLSET.': <br />
369
+            ' . _MYTPLSADMIN_CAPTION_BASE.":
370 370
 			<select name='clone_tplset_from'>
371 371
 				$tplset_options
372
-                <option value='_blank_'>"._MYTPLSADMIN_OPT_BLANKSET . '</option>
372
+                <option value='_blank_'>"._MYTPLSADMIN_OPT_BLANKSET.'</option>
373 373
 			</select>
374 374
 			<br />
375
-            ' . _MYTPLSADMIN_CAPTION_SETNAME . ": <input type='text' name='clone_tplset_to' size='8' maxlength='16' /> <input type='submit' name='clone_tplset_do' value='" . _MYTPLSADMIN_BTN_NEWTPLSET . "' />
375
+            ' . _MYTPLSADMIN_CAPTION_SETNAME.": <input type='text' name='clone_tplset_to' size='8' maxlength='16' /> <input type='submit' name='clone_tplset_do' value='"._MYTPLSADMIN_BTN_NEWTPLSET."' />
376 376
 		</td>
377 377
 		<td class='head'></td>
378 378
 		<td class='head'>
@@ -385,21 +385,21 @@  discard block
 block discarded – undo
385 385
 		</td>\n" ;
386 386
 
387 387
     foreach ($tplsets as $tplset) {
388
-        $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ;
388
+        $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES);
389 389
         echo "\t\t<td class='head'>
390
-            " . ($tplset == 'default' && $target_dirname != '_custom' ? '' : "<input name='del_do[{$tplset4disp}]' type='submit' value='" . _DELETE . "' onclick='return altsys_mytpladmin_check_copy_submit(\"" . _MYTPLSADMIN_CNF_DELETE_SELECTED_TEMPLATES . "\", \"{$tplset4disp}_\", false);' /><br /><br />") . '
391
-            ' . _MYTPLSADMIN_CAPTION_COPYTO . ":
390
+            " . ($tplset == 'default' && $target_dirname != '_custom' ? '' : "<input name='del_do[{$tplset4disp}]' type='submit' value='"._DELETE."' onclick='return altsys_mytpladmin_check_copy_submit(\""._MYTPLSADMIN_CNF_DELETE_SELECTED_TEMPLATES."\", \"{$tplset4disp}_\", false);' /><br /><br />").'
391
+            ' . _MYTPLSADMIN_CAPTION_COPYTO.":
392 392
 			<select name='copy_to[{$tplset4disp}]'>
393 393
 				".str_replace('<option value=\''.$tplset4disp.'\'>'.$tplset4disp.'</option>', '', $tplset_options)."
394 394
 			</select>
395 395
 			<input name='copy_do[{$tplset4disp}]' type='submit' value='"._MYTPLSADMIN_BTN_COPY."' onclick='return altsys_mytpladmin_check_copy_submit(\""._MYTPLSADMIN_CNF_COPY_SELECTED_TEMPLATES."\", \"{$tplset4disp}_\", true);' />
396
-		</td>\n" ;
396
+		</td>\n";
397 397
     }
398 398
 
399
-echo "	</tr>\n" ;
399
+echo "	</tr>\n";
400 400
 
401 401
 
402 402
 echo '</table></form>';
403 403
 // end of table & form
404 404
 
405
-xoops_cp_footer() ;
405
+xoops_cp_footer();
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/mylangadmin.php 1 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.