Completed
Branch master (0881bb)
by Michael
04:14
created
xoops_trust_path/libs/altsys/mymenusub/mylangadmin.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,37 +1,37 @@
 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
-$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']) ;
7
+$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']);
8 8
 
9
-$db =& XoopsDatabaseFactory::getDatabaseConnection() ;
10
-$mrs = $db->query("SELECT m.name,m.dirname,COUNT(l.mid) FROM ".$db->prefix("modules")." m LEFT JOIN ".$db->prefix("altsys_language_constants")." l ON m.mid=l.mid WHERE m.isactive GROUP BY m.mid ORDER BY m.weight,m.mid") ;
9
+$db = & XoopsDatabaseFactory::getDatabaseConnection();
10
+$mrs = $db->query("SELECT m.name,m.dirname,COUNT(l.mid) FROM ".$db->prefix("modules")." m LEFT JOIN ".$db->prefix("altsys_language_constants")." l ON m.mid=l.mid WHERE m.isactive GROUP BY m.mid ORDER BY m.weight,m.mid");
11 11
 
12
-$adminmenu = array() ;
12
+$adminmenu = array();
13 13
 while (list($name, $dirname, $count) = $db->fetchRow($mrs)) {
14 14
     if ($dirname == $current_dirname) {
15 15
         $adminmenu[] = array(
16
-            'selected' => true ,
17
-            'title' => $name . " ($count)" ,
18
-            'link' => '?mode=admin&lib=altsys&page=mylangadmin&dirname='.$dirname ,
19
-        ) ;
16
+            'selected' => true,
17
+            'title' => $name." ($count)",
18
+            'link' => '?mode=admin&lib=altsys&page=mylangadmin&dirname='.$dirname,
19
+        );
20 20
         //$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => htmlspecialchars( $name , ENT_QUOTES ) ) ;
21 21
     } else {
22 22
         $adminmenu[] = array(
23
-            'selected' => false ,
24
-            'title' => $name . " ($count)" ,
25
-            'link' => '?mode=admin&lib=altsys&page=mylangadmin&dirname='.$dirname ,
26
-        ) ;
23
+            'selected' => false,
24
+            'title' => $name." ($count)",
25
+            'link' => '?mode=admin&lib=altsys&page=mylangadmin&dirname='.$dirname,
26
+        );
27 27
     }
28 28
 }
29 29
 
30 30
 // display
31
-require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ;
32
-$tpl = new D3Tpl() ;
31
+require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php';
32
+$tpl = new D3Tpl();
33 33
 $tpl->assign(array(
34 34
     'adminmenu' => $adminmenu,
35 35
     'mypage' => 'mylangadmin',
36
-)) ;
37
-$tpl->display('db:altsys_inc_mymenusub.html') ;
36
+));
37
+$tpl->display('db:altsys_inc_mymenusub.html');
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/mymenusub/mytplsadmin.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,56 +1,56 @@
 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
-$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']) ;
7
+$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']);
8 8
 
9
-$db =& XoopsDatabaseFactory::getDatabaseConnection() ;
9
+$db = & XoopsDatabaseFactory::getDatabaseConnection();
10 10
 
11 11
 // get custom templates
12
-list($count) = $db->fetchRow($db->query("SELECT COUNT(t.tpl_module) AS tpl_count FROM ".$db->prefix("tplfile")." t WHERE t.tpl_type='custom'")) ;
12
+list($count) = $db->fetchRow($db->query("SELECT COUNT(t.tpl_module) AS tpl_count FROM ".$db->prefix("tplfile")." t WHERE t.tpl_type='custom'"));
13 13
 if ($current_dirname == '_custom') {
14 14
     //	$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => _MYTPLSADMIN_CUSTOMTEMPLATE ) ;
15
-    $custom_selected = true ;
15
+    $custom_selected = true;
16 16
 } else {
17
-    $custom_selected = false ;
17
+    $custom_selected = false;
18 18
 }
19 19
 
20 20
 $adminmenu = array(
21 21
     array(
22
-        'selected' => $custom_selected ,
23
-        'title' => _MYTPLSADMIN_CUSTOMTEMPLATE . " ($count)" ,
24
-        'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname=_custom' ,
25
-    ) ,
26
-) ;
22
+        'selected' => $custom_selected,
23
+        'title' => _MYTPLSADMIN_CUSTOMTEMPLATE." ($count)",
24
+        'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname=_custom',
25
+    ),
26
+);
27 27
 
28 28
 // get modules/templates
29
-$mrs = $db->query("SELECT m.name,m.dirname,COUNT(t.tpl_module) AS tpl_count FROM ".$db->prefix("modules")." m LEFT JOIN ".$db->prefix("tplfile")." t ON m.dirname=t.tpl_module WHERE m.isactive GROUP BY m.mid HAVING tpl_count>0 ORDER BY m.weight,m.mid") ;
29
+$mrs = $db->query("SELECT m.name,m.dirname,COUNT(t.tpl_module) AS tpl_count FROM ".$db->prefix("modules")." m LEFT JOIN ".$db->prefix("tplfile")." t ON m.dirname=t.tpl_module WHERE m.isactive GROUP BY m.mid HAVING tpl_count>0 ORDER BY m.weight,m.mid");
30 30
 
31 31
 // module loop
32 32
 while (list($name, $dirname, $count) = $db->fetchRow($mrs)) {
33 33
     if ($dirname == $current_dirname) {
34 34
         $adminmenu[] = array(
35
-            'selected' => true ,
36
-            'title' => $name . " ($count)" ,
37
-            'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$dirname ,
38
-        ) ;
35
+            'selected' => true,
36
+            'title' => $name." ($count)",
37
+            'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$dirname,
38
+        );
39 39
         //$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => htmlspecialchars( $name , ENT_QUOTES ) ) ;
40 40
     } else {
41 41
         $adminmenu[] = array(
42
-            'selected' => false ,
43
-            'title' => $name . " ($count)" ,
44
-            'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$dirname ,
45
-        ) ;
42
+            'selected' => false,
43
+            'title' => $name." ($count)",
44
+            'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$dirname,
45
+        );
46 46
     }
47 47
 }
48 48
 
49 49
 // display
50
-require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ;
51
-$tpl = new D3Tpl() ;
50
+require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php';
51
+$tpl = new D3Tpl();
52 52
 $tpl->assign(array(
53 53
     'adminmenu' => $adminmenu,
54 54
     'mypage' => 'mytplsadmin',
55
-)) ;
56
-$tpl->display('db:altsys_inc_mymenusub.html') ;
55
+));
56
+$tpl->display('db:altsys_inc_mymenusub.html');
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/mymenusub/myblocksadmin.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,61 +1,61 @@
 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
-$core_type = altsys_get_core_type() ;
8
-$db =& XoopsDatabaseFactory::getDatabaseConnection() ;
7
+$core_type = altsys_get_core_type();
8
+$db = & XoopsDatabaseFactory::getDatabaseConnection();
9 9
 
10
-$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']) ;
10
+$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']);
11 11
 if ($current_dirname == '__CustomBlocks__') {
12
-    return ;
12
+    return;
13 13
 }
14 14
 
15
-    $module_handler4menu =& xoops_gethandler('module');
15
+    $module_handler4menu = & xoops_gethandler('module');
16 16
     $criteria4menu = new CriteriaCompo(new Criteria('isactive', 1));
17 17
     //$criteria4menu->add(new Criteria('hasmain', 1));
18 18
     $criteria4menu->add(new Criteria('mid', '1', '>'));
19
-    $modules4menu =& $module_handler4menu->getObjects($criteria4menu, true);
20
-    $system_module =& $module_handler4menu->get(1) ;
19
+    $modules4menu = & $module_handler4menu->getObjects($criteria4menu, true);
20
+    $system_module = & $module_handler4menu->get(1);
21 21
     if (is_object($system_module)) {
22
-        array_unshift($modules4menu, $system_module) ;
22
+        array_unshift($modules4menu, $system_module);
23 23
     }
24 24
 
25
-$adminmenu = array() ;
25
+$adminmenu = array();
26 26
 foreach ($modules4menu as $m4menu) {
27 27
     // get block info
28 28
     if ($core_type != ALTSYS_CORE_TYPE_X22) {
29
-        list($block_count_all) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("newblocks")." WHERE mid=".$m4menu->getVar('mid'))) ;
30
-        list($block_count_visible) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("newblocks")." WHERE mid=".$m4menu->getVar('mid')." AND visible>0")) ;
29
+        list($block_count_all) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("newblocks")." WHERE mid=".$m4menu->getVar('mid')));
30
+        list($block_count_visible) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("newblocks")." WHERE mid=".$m4menu->getVar('mid')." AND visible>0"));
31 31
         // $block_desc = " $block_count_all($block_count_visible)" ;
32
-        $block_desc = " ($block_count_visible/$block_count_all)" ;
32
+        $block_desc = " ($block_count_visible/$block_count_all)";
33 33
     } else {
34
-        $block_desc = '' ;
34
+        $block_desc = '';
35 35
     }
36 36
 
37 37
     if ($m4menu->getVar('dirname') == $current_dirname) {
38 38
         $adminmenu[] = array(
39
-            'selected' => true ,
40
-            'title' => $m4menu->getVar('name', 'n') . $block_desc ,
41
-            'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n') ,
42
-        ) ;
39
+            'selected' => true,
40
+            'title' => $m4menu->getVar('name', 'n').$block_desc,
41
+            'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n'),
42
+        );
43 43
         //$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => $m4menu->getVar('name') ) ;
44 44
     } else {
45 45
         $adminmenu[] = array(
46
-            'selected' => false ,
47
-            'title' => $m4menu->getVar('name', 'n') . $block_desc ,
48
-            'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n') ,
49
-        ) ;
46
+            'selected' => false,
47
+            'title' => $m4menu->getVar('name', 'n').$block_desc,
48
+            'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n'),
49
+        );
50 50
     }
51 51
 }
52 52
 
53 53
 
54 54
 // display
55
-require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ;
56
-$tpl = new D3Tpl() ;
55
+require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php';
56
+$tpl = new D3Tpl();
57 57
 $tpl->assign(array(
58 58
     'adminmenu' => $adminmenu,
59 59
     'mypage' => 'myblocksadmin',
60
-)) ;
61
-$tpl->display('db:altsys_inc_mymenusub.html') ;
60
+));
61
+$tpl->display('db:altsys_inc_mymenusub.html');
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/mytplsform.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -5,36 +5,36 @@  discard block
 block discarded – undo
5 5
 //                       GIJOE <http://www.peak.ne.jp/>                      //
6 6
 // ------------------------------------------------------------------------- //
7 7
 
8
-require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php' ;
9
-include_once dirname(__FILE__)."/include/gtickets.php" ;
10
-include_once dirname(__FILE__).'/include/altsys_functions.php' ;
11
-include_once dirname(__FILE__)."/include/tpls_functions.php" ;
12
-include_once dirname(__FILE__).'/include/Text_Diff.php' ;
13
-include_once dirname(__FILE__).'/include/Text_Diff_Renderer.php' ;
14
-include_once dirname(__FILE__).'/include/Text_Diff_Renderer_unified.php' ;
8
+require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php';
9
+include_once dirname(__FILE__)."/include/gtickets.php";
10
+include_once dirname(__FILE__).'/include/altsys_functions.php';
11
+include_once dirname(__FILE__)."/include/tpls_functions.php";
12
+include_once dirname(__FILE__).'/include/Text_Diff.php';
13
+include_once dirname(__FILE__).'/include/Text_Diff_Renderer.php';
14
+include_once dirname(__FILE__).'/include/Text_Diff_Renderer_unified.php';
15 15
 
16 16
 
17 17
 // only groups have 'module_admin' of 'altsys' can do that.
18
-$module_handler =& xoops_gethandler('module') ;
19
-$module =& $module_handler->getByDirname('altsys') ;
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') ;
18
+$module_handler = & xoops_gethandler('module');
19
+$module = & $module_handler->getByDirname('altsys');
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
 //$xoops_system_path = XOOPS_ROOT_PATH . '/modules/system' ;
26 26
 
27 27
 // initials
28
-$db =& XoopsDatabaseFactory::getDatabaseConnection();
29
-(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance() ;
28
+$db = & XoopsDatabaseFactory::getDatabaseConnection();
29
+(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = & MyTextSanitizer::getInstance();
30 30
 
31 31
 // language file
32
-altsys_include_language_file('mytplsform') ;
33
-altsys_include_language_file('mytplsadmin') ;
32
+altsys_include_language_file('mytplsform');
33
+altsys_include_language_file('mytplsadmin');
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
 // check access right (needs system_admin of tplset)
@@ -42,128 +42,128 @@  discard block
 block discarded – undo
42 42
 //if (!$sysperm_handler->checkRight('system_admin', XOOPS_SYSTEM_TPLSET, $xoopsUser->getGroups())) redirect_header( XOOPS_URL.'/user.php' , 1 , _NOPERM ) ;
43 43
 
44 44
 // tpl_file from $_GET
45
-$tpl_tplset = $myts->stripSlashesGPC(@$_GET['tpl_tplset']) ;
46
-if (! $tpl_tplset) {
47
-    $tpl_tplset = $xoopsConfig['template_set'] ;
45
+$tpl_tplset = $myts->stripSlashesGPC(@$_GET['tpl_tplset']);
46
+if (!$tpl_tplset) {
47
+    $tpl_tplset = $xoopsConfig['template_set'];
48 48
 }
49
-$tpl_tplset4sql = addslashes($tpl_tplset) ;
49
+$tpl_tplset4sql = addslashes($tpl_tplset);
50 50
 
51 51
 if (empty($_GET['tpl_file']) || $_GET['tpl_file'] == '_custom') {
52
-    $edit_mode = 'create' ;
53
-    $tpl_file = '_custom' ;
52
+    $edit_mode = 'create';
53
+    $tpl_file = '_custom';
54 54
     $tpl = array(
55
-        'tpl_id' => 0 ,
56
-        'tpl_refid' => 0 ,
57
-        'tpl_module' => '_custom' ,
58
-        'tpl_tplset' => $tpl_tplset ,
59
-        'tpl_file' => '_custom_'.substr(date('YmdHis'), 2, -2).'.html' ,
60
-        'tpl_desc' => '' ,
61
-        'tpl_lastmodified' => 0 ,
62
-        'tpl_lastimported' => 0 ,
63
-        'tpl_type' => 'custom' ,
64
-        'tpl_source' => '' ,
65
-    ) ;
55
+        'tpl_id' => 0,
56
+        'tpl_refid' => 0,
57
+        'tpl_module' => '_custom',
58
+        'tpl_tplset' => $tpl_tplset,
59
+        'tpl_file' => '_custom_'.substr(date('YmdHis'), 2, -2).'.html',
60
+        'tpl_desc' => '',
61
+        'tpl_lastmodified' => 0,
62
+        'tpl_lastimported' => 0,
63
+        'tpl_type' => 'custom',
64
+        'tpl_source' => '',
65
+    );
66 66
 
67 67
     // breadcrumbs
68
-    $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ;
69
-    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN') ;
70
-    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin&amp;dirname=_custom', _MYTPLSADMIN_CUSTOMTEMPLATE) ;
71
-    $breadcrumbsObj->appendPath('', '_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE') ;
68
+    $breadcrumbsObj = & AltsysBreadcrumbs::getInstance();
69
+    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN');
70
+    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin&amp;dirname=_custom', _MYTPLSADMIN_CUSTOMTEMPLATE);
71
+    $breadcrumbsObj->appendPath('', '_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE');
72 72
     $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE;
73 73
 } else {
74 74
     // tpl_file from $_GET
75
-    $edit_mode = 'modify' ;
76
-    $tpl_file = $myts->stripSlashesGPC(@$_GET['tpl_file']) ;
77
-    $tpl_file = str_replace('db:', '', $tpl_file) ;
78
-    $tpl_file4sql = addslashes($tpl_file) ;
75
+    $edit_mode = 'modify';
76
+    $tpl_file = $myts->stripSlashesGPC(@$_GET['tpl_file']);
77
+    $tpl_file = str_replace('db:', '', $tpl_file);
78
+    $tpl_file4sql = addslashes($tpl_file);
79 79
 
80 80
     // get information from tplfile table
81
-    $sql = "SELECT * FROM ".$db->prefix("tplfile")." f NATURAL LEFT JOIN ".$db->prefix("tplsource")." s WHERE f.tpl_file='$tpl_file4sql' ORDER BY f.tpl_tplset='$tpl_tplset4sql' DESC,f.tpl_tplset='default' DESC" ;
82
-    $tpl = $db->fetchArray($db->query($sql)) ;
81
+    $sql = "SELECT * FROM ".$db->prefix("tplfile")." f NATURAL LEFT JOIN ".$db->prefix("tplsource")." s WHERE f.tpl_file='$tpl_file4sql' ORDER BY f.tpl_tplset='$tpl_tplset4sql' DESC,f.tpl_tplset='default' DESC";
82
+    $tpl = $db->fetchArray($db->query($sql));
83 83
 
84 84
     // get module info
85 85
     if ($tpl['tpl_module'] == '_custom') {
86
-        $target_module = null ;
87
-        $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE ;
86
+        $target_module = null;
87
+        $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE;
88 88
     } else {
89
-        $module_handler =& xoops_gethandler('module') ;
90
-        $target_module =& $module_handler->getByDirname($tpl['tpl_module']) ;
91
-        $target_mname = is_object($target_module) ? $target_module->getVar('name') : '' ;
89
+        $module_handler = & xoops_gethandler('module');
90
+        $target_module = & $module_handler->getByDirname($tpl['tpl_module']);
91
+        $target_mname = is_object($target_module) ? $target_module->getVar('name') : '';
92 92
     }
93 93
 
94 94
     // breadcrumbs
95
-    $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ;
95
+    $breadcrumbsObj = & AltsysBreadcrumbs::getInstance();
96 96
     if ($mydirname != 'altsys' && is_object($target_module)) {
97 97
         // mytplsform in each modules
98
-        $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname') ;
99
-        $modinfo = $target_module->getInfo() ;
100
-        $breadcrumbsObj->appendPath($mod_url.'/'.@$modinfo['adminindex'], $target_mname) ;
101
-        $breadcrumbsObj->appendPath($mod_url.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', _MD_A_MYTPLSFORM_TPLSADMIN) ;
98
+        $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname');
99
+        $modinfo = $target_module->getInfo();
100
+        $breadcrumbsObj->appendPath($mod_url.'/'.@$modinfo['adminindex'], $target_mname);
101
+        $breadcrumbsObj->appendPath($mod_url.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', _MD_A_MYTPLSFORM_TPLSADMIN);
102 102
     } else {
103 103
         // mytplsform in altsys
104
-        $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN') ;
105
-        $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin&amp;dirname='.htmlspecialchars($tpl['tpl_module']), $target_mname) ;
104
+        $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN');
105
+        $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin&amp;dirname='.htmlspecialchars($tpl['tpl_module']), $target_mname);
106 106
     }
107
-    $breadcrumbsObj->appendPath('', _MD_A_MYTPLSFORM_EDIT) ;
107
+    $breadcrumbsObj->appendPath('', _MD_A_MYTPLSFORM_EDIT);
108 108
 }
109 109
 
110 110
 // error in specifying tpl_file
111 111
 if (empty($tpl)) {
112 112
     if (strncmp($tpl_file, 'file:', 5) === 0) {
113
-        die('Not DB template') ;
113
+        die('Not DB template');
114 114
     } else {
115
-        die('Invalid tpl_file.') ;
115
+        die('Invalid tpl_file.');
116 116
     }
117 117
 }
118 118
 
119 119
 //****************//
120 120
 // TRANSACT stage //
121 121
 //****************//
122
-if (! empty($_POST['do_modifycont']) || ! empty($_POST['do_modify'])) {
122
+if (!empty($_POST['do_modifycont']) || !empty($_POST['do_modify'])) {
123 123
     // Ticket Check
124
-    if (! $xoopsGTicket->check(true, 'altsys_tplsform')) {
124
+    if (!$xoopsGTicket->check(true, 'altsys_tplsform')) {
125 125
         redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
126 126
     }
127 127
 
128
-    $result = $db->query("SELECT tpl_id FROM ".$db->prefix("tplfile")." WHERE tpl_file='$tpl_file4sql' AND tpl_tplset='".addslashes($tpl['tpl_tplset'])."'") ;
128
+    $result = $db->query("SELECT tpl_id FROM ".$db->prefix("tplfile")." WHERE tpl_file='$tpl_file4sql' AND tpl_tplset='".addslashes($tpl['tpl_tplset'])."'");
129 129
     while (list($tpl_id) = $db->fetchRow($result)) {
130
-        $sql = "UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($myts->stripSlashesGPC($_POST['tpl_source']))."' WHERE tpl_id=$tpl_id" ;
131
-        if (! $db->query($sql)) {
132
-            die('SQL Error') ;
130
+        $sql = "UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($myts->stripSlashesGPC($_POST['tpl_source']))."' WHERE tpl_id=$tpl_id";
131
+        if (!$db->query($sql)) {
132
+            die('SQL Error');
133 133
         }
134
-        $db->query("UPDATE ".$db->prefix("tplfile")." SET tpl_lastmodified=UNIX_TIMESTAMP() WHERE tpl_id=$tpl_id") ;
135
-        altsys_template_touch($tpl_id) ;
134
+        $db->query("UPDATE ".$db->prefix("tplfile")." SET tpl_lastmodified=UNIX_TIMESTAMP() WHERE tpl_id=$tpl_id");
135
+        altsys_template_touch($tpl_id);
136 136
     }
137 137
 
138 138
     // continue or end ?
139
-    if (! empty($_POST['do_modifycont'])) {
140
-        redirect_header('index.php?mode=admin&lib=altsys&page=mytplsform&tpl_file='.$tpl_file.'&tpl_tplset='.$tpl_tplset.'&dirname='.$tpl['tpl_module'].'#altsys_tplsform_top', 1, _MD_A_MYTPLSFORM_UPDATED) ;
139
+    if (!empty($_POST['do_modifycont'])) {
140
+        redirect_header('index.php?mode=admin&lib=altsys&page=mytplsform&tpl_file='.$tpl_file.'&tpl_tplset='.$tpl_tplset.'&dirname='.$tpl['tpl_module'].'#altsys_tplsform_top', 1, _MD_A_MYTPLSFORM_UPDATED);
141 141
     } else {
142
-        redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_UPDATED) ;
142
+        redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_UPDATED);
143 143
     }
144
-    exit ;
144
+    exit;
145 145
 }
146 146
 
147
-if (! empty($_POST['do_create'])) {
147
+if (!empty($_POST['do_create'])) {
148 148
     // Ticket Check
149
-    if (! $xoopsGTicket->check(true, 'altsys_tplsform')) {
149
+    if (!$xoopsGTicket->check(true, 'altsys_tplsform')) {
150 150
         redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
151 151
     }
152 152
 
153
-    $sql = "INSERT INTO ".$db->prefix("tplfile")." SET tpl_file='".addslashes($myts->stripSlashesGPC($_POST['tpl_file']))."',tpl_refid=0,tpl_module='".addslashes($tpl['tpl_module'])."',tpl_tplset='".addslashes($tpl['tpl_tplset'])."',tpl_lastmodified=UNIX_TIMESTAMP(),tpl_type='".addslashes($tpl['tpl_type'])."'" ;
154
-    if (! $db->query($sql)) {
155
-        die('SQL Error'.__LINE__) ;
153
+    $sql = "INSERT INTO ".$db->prefix("tplfile")." SET tpl_file='".addslashes($myts->stripSlashesGPC($_POST['tpl_file']))."',tpl_refid=0,tpl_module='".addslashes($tpl['tpl_module'])."',tpl_tplset='".addslashes($tpl['tpl_tplset'])."',tpl_lastmodified=UNIX_TIMESTAMP(),tpl_type='".addslashes($tpl['tpl_type'])."'";
154
+    if (!$db->query($sql)) {
155
+        die('SQL Error'.__LINE__);
156 156
     }
157
-    $tpl_id = intval($db->getInsertId()) ;
158
-    $sql = "INSERT INTO ".$db->prefix("tplsource")." SET tpl_id=$tpl_id,tpl_source='".addslashes($myts->stripSlashesGPC($_POST['tpl_source']))."'" ;
159
-    if (! $db->query($sql)) {
160
-        die('SQL Error'.__LINE__) ;
157
+    $tpl_id = intval($db->getInsertId());
158
+    $sql = "INSERT INTO ".$db->prefix("tplsource")." SET tpl_id=$tpl_id,tpl_source='".addslashes($myts->stripSlashesGPC($_POST['tpl_source']))."'";
159
+    if (!$db->query($sql)) {
160
+        die('SQL Error'.__LINE__);
161 161
     }
162
-    altsys_template_touch($tpl_id) ;
162
+    altsys_template_touch($tpl_id);
163 163
 
164 164
     // continue or end ?
165
-    redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_CREATED) ;
166
-    exit ;
165
+    redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_CREATED);
166
+    exit;
167 167
 }
168 168
 
169 169
 
@@ -171,55 +171,55 @@  discard block
 block discarded – undo
171 171
 //****************//
172 172
 //   FORM stage   //
173 173
 //****************//
174
-xoops_cp_header() ;
175
-$mymenu_fake_uri = 'index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$mydirname ;
174
+xoops_cp_header();
175
+$mymenu_fake_uri = 'index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$mydirname;
176 176
 
177 177
 // mymenu
178
-altsys_include_mymenu() ;
178
+altsys_include_mymenu();
179 179
 
180
-echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>"._MD_A_MYTPLSFORM_EDIT." : ".htmlspecialchars($tpl['tpl_type'], ENT_QUOTES)." : ".htmlspecialchars($tpl['tpl_file'], ENT_QUOTES)." (".htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES).")</h3>\n" ;
180
+echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>"._MD_A_MYTPLSFORM_EDIT." : ".htmlspecialchars($tpl['tpl_type'], ENT_QUOTES)." : ".htmlspecialchars($tpl['tpl_file'], ENT_QUOTES)." (".htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES).")</h3>\n";
181 181
 
182 182
 
183 183
 // diff from file to selected DB template
184
-$basefilepath = tplsadmin_get_basefilepath($tpl['tpl_module'], $tpl['tpl_type'], $tpl['tpl_file']) ;
185
-$diff_from_file4disp = '' ;
184
+$basefilepath = tplsadmin_get_basefilepath($tpl['tpl_module'], $tpl['tpl_type'], $tpl['tpl_file']);
185
+$diff_from_file4disp = '';
186 186
 if (file_exists($basefilepath)) {
187
-    $original_error_level = error_reporting() ;
188
-    error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING) ;
189
-    $diff = new Text_Diff(file($basefilepath), explode("\n", $tpl['tpl_source'])) ;
187
+    $original_error_level = error_reporting();
188
+    error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING);
189
+    $diff = new Text_Diff(file($basefilepath), explode("\n", $tpl['tpl_source']));
190 190
     $renderer = new Text_Diff_Renderer_unified();
191
-    $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES) ;
191
+    $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES);
192 192
     foreach (explode("\n", $diff_str) as $line) {
193 193
         if (ord($line) == 0x2d) {
194
-            $diff_from_file4disp .= "<span style='color:red;'>".$line."</span>\n" ;
194
+            $diff_from_file4disp .= "<span style='color:red;'>".$line."</span>\n";
195 195
         } elseif (ord($line) == 0x2b) {
196
-            $diff_from_file4disp .= "<span style='color:blue;'>".$line."</span>\n" ;
196
+            $diff_from_file4disp .= "<span style='color:blue;'>".$line."</span>\n";
197 197
         } else {
198
-            $diff_from_file4disp .= $line."\n" ;
198
+            $diff_from_file4disp .= $line."\n";
199 199
         }
200 200
     }
201
-    error_reporting($original_error_level) ;
201
+    error_reporting($original_error_level);
202 202
 }
203 203
 
204 204
 // diff from DB-default to selected DB template
205
-$diff_from_default4disp = '' ;
205
+$diff_from_default4disp = '';
206 206
 if ($tpl['tpl_tplset'] != 'default') {
207
-    $original_error_level = error_reporting() ;
208
-    error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING) ;
209
-    list($default_source) = $db->fetchRow($db->query("SELECT tpl_source FROM ".$db->prefix("tplfile")." NATURAL LEFT JOIN ".$db->prefix("tplsource")." WHERE tpl_tplset='default' AND tpl_file='".addslashes($tpl['tpl_file'])."' AND tpl_module='".addslashes($tpl['tpl_module'])."'")) ;
210
-    $diff = new Text_Diff(explode("\n", $default_source), explode("\n", $tpl['tpl_source'])) ;
207
+    $original_error_level = error_reporting();
208
+    error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING);
209
+    list($default_source) = $db->fetchRow($db->query("SELECT tpl_source FROM ".$db->prefix("tplfile")." NATURAL LEFT JOIN ".$db->prefix("tplsource")." WHERE tpl_tplset='default' AND tpl_file='".addslashes($tpl['tpl_file'])."' AND tpl_module='".addslashes($tpl['tpl_module'])."'"));
210
+    $diff = new Text_Diff(explode("\n", $default_source), explode("\n", $tpl['tpl_source']));
211 211
     $renderer = new Text_Diff_Renderer_unified();
212
-    $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES) ;
212
+    $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES);
213 213
     foreach (explode("\n", $diff_str) as $line) {
214 214
         if (ord($line) == 0x2d) {
215
-            $diff_from_default4disp .= "<span style='color:red;'>".$line."</span>\n" ;
215
+            $diff_from_default4disp .= "<span style='color:red;'>".$line."</span>\n";
216 216
         } elseif (ord($line) == 0x2b) {
217
-            $diff_from_default4disp .= "<span style='color:blue;'>".$line."</span>\n" ;
217
+            $diff_from_default4disp .= "<span style='color:blue;'>".$line."</span>\n";
218 218
         } else {
219
-            $diff_from_default4disp .= $line."\n" ;
219
+            $diff_from_default4disp .= $line."\n";
220 220
         }
221 221
     }
222
-    error_reporting($original_error_level) ;
222
+    error_reporting($original_error_level);
223 223
 }
224 224
 
225 225
 
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 	<form name='diff_form' id='diff_form' action='' method='get'>\n" ;
228 228
 if ($diff_from_file4disp) {
229 229
     echo "<input type='checkbox' name='display_diff2file' value='1' onClick=\"if(this.checked){document.getElementById('diff2file').style.display='block'}else{document.getElementById('diff2file').style.display='none'};\" id='display_diff2file' checked='checked' />&nbsp;<label for='display_diff2file'>diff from file</label>
230
-	<pre id='diff2file' style='display:block;border:1px solid black;'>$diff_from_file4disp</pre>\n" ;
230
+	<pre id='diff2file' style='display:block;border:1px solid black;'>$diff_from_file4disp</pre>\n";
231 231
 }
232 232
 if ($diff_from_default4disp) {
233 233
     echo "<input type='checkbox' name='display_diff2default' value='1' onClick=\"if(this.checked){document.getElementById('diff2default').style.display='block'}else{document.getElementById('diff2default').style.display='none'};\" id='display_diff2default' />&nbsp;<label for='display_diff2default'>diff from default</label>
234
-	<pre id='diff2default' style='display:none;border:1px solid black;'>$diff_from_default4disp</pre>\n" ;
234
+	<pre id='diff2default' style='display:none;border:1px solid black;'>$diff_from_default4disp</pre>\n";
235 235
 }
236 236
 echo "
237 237
 	</form>\n" ;
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     echo "
250 250
 	<label for='tpl_file'>"._MD_A_MYTPLSFORM_LABEL_TPLFILE."</label>
251 251
 	<input type='text' name='tpl_file' id='tpl_file' value='".htmlspecialchars($tpl['tpl_file'], ENT_QUOTES)."' size='64' /><br />
252
-	<input type='submit' name='do_create' id='do_create' value='"._MD_A_MYTPLSFORM_BTN_CREATE."' />\n" ;
252
+	<input type='submit' name='do_create' id='do_create' value='"._MD_A_MYTPLSFORM_BTN_CREATE."' />\n";
253 253
 } else {
254 254
     // modify form
255 255
     echo "
@@ -259,4 +259,4 @@  discard block
 block discarded – undo
259 259
 </form>\n" ;
260 260
 }
261 261
 
262
-xoops_cp_footer() ;
262
+xoops_cp_footer();
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/admin_menu.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,35 +1,35 @@  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
 $adminmenu = array(
8 8
     array(
9
-        'title' => _MI_ALTSYS_MENU_CUSTOMBLOCKS ,
10
-        'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__' ,
11
-    ) ,
9
+        'title' => _MI_ALTSYS_MENU_CUSTOMBLOCKS,
10
+        'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__',
11
+    ),
12 12
     array(
13
-        'title' => _MI_ALTSYS_MENU_NEWCUSTOMBLOCK ,
14
-        'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__&op=edit' ,
15
-        'show' => false ,
16
-    ) ,
13
+        'title' => _MI_ALTSYS_MENU_NEWCUSTOMBLOCK,
14
+        'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__&op=edit',
15
+        'show' => false,
16
+    ),
17 17
     array(
18
-        'title' => _MI_ALTSYS_MENU_MYBLOCKSADMIN ,
19
-        'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin' ,
20
-    ) ,
18
+        'title' => _MI_ALTSYS_MENU_MYBLOCKSADMIN,
19
+        'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin',
20
+    ),
21 21
     array(
22
-        'title' => _MI_ALTSYS_MENU_MYTPLSADMIN ,
23
-        'link' => 'admin/index.php?mode=admin&lib=altsys&page=mytplsadmin' ,
24
-    ) ,
22
+        'title' => _MI_ALTSYS_MENU_MYTPLSADMIN,
23
+        'link' => 'admin/index.php?mode=admin&lib=altsys&page=mytplsadmin',
24
+    ),
25 25
     array(
26
-        'title' => _MI_ALTSYS_MENU_COMPILEHOOKADMIN ,
27
-        'link' => 'admin/index.php?mode=admin&lib=altsys&page=compilehookadmin' ,
28
-    ) ,
26
+        'title' => _MI_ALTSYS_MENU_COMPILEHOOKADMIN,
27
+        'link' => 'admin/index.php?mode=admin&lib=altsys&page=compilehookadmin',
28
+    ),
29 29
     array(
30
-        'title' => _MI_ALTSYS_MENU_MYLANGADMIN ,
31
-        'link' => 'admin/index.php?mode=admin&lib=altsys&page=mylangadmin' ,
32
-    ) ,
30
+        'title' => _MI_ALTSYS_MENU_MYLANGADMIN,
31
+        'link' => 'admin/index.php?mode=admin&lib=altsys&page=mylangadmin',
32
+    ),
33 33
 /*	array(
34 34
         'title' => _MI_ALTSYS_MENU_MYAVATAR ,
35 35
         'link' => 'index.php?mode=admin&lib=altsys&page=myavatar' ,
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
         'title' => _MI_ALTSYS_MENU_MYSMILEY ,
39 39
         'link' => 'index.php?mode=admin&lib=altsys&page=mysmiley' ,
40 40
     ) ,*/
41
-) ;
41
+);
42 42
 
43 43
 $adminmenu4altsys = array(
44 44
     array(
45
-        'title' => 'ALTSYS '._PREFERENCES ,
46
-        'link' => 'admin/index.php?mode=admin&lib=altsys&page=mypreferences' ,
47
-    ) ,
48
-) ;
45
+        'title' => 'ALTSYS '._PREFERENCES,
46
+        'link' => 'admin/index.php?mode=admin&lib=altsys&page=mypreferences',
47
+    ),
48
+);
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/onuninstall.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,35 +1,35 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-eval(' function xoops_module_uninstall_'.$mydirname.'( $module ) { return altsys_onuninstall_base( $module , "'.$mydirname.'" ) ; } ') ;
3
+eval(' function xoops_module_uninstall_'.$mydirname.'( $module ) { return altsys_onuninstall_base( $module , "'.$mydirname.'" ) ; } ');
4 4
 
5 5
 
6
-if (! function_exists('altsys_onuninstall_base')) {
6
+if (!function_exists('altsys_onuninstall_base')) {
7 7
     function altsys_onuninstall_base($module, $mydirname)
8 8
     {
9 9
         // transations on module uninstall
10 10
 
11
-    global $ret ; // TODO :-D
11
+    global $ret; // TODO :-D
12 12
 
13 13
     // for Cube 2.1
14 14
     if (defined('XOOPS_CUBE_LEGACY')) {
15
-        $root =& XCube_Root::getSingleton();
16
-        $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUninstall.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_onuninstall') ;
17
-        $ret = array() ;
15
+        $root = & XCube_Root::getSingleton();
16
+        $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUninstall.'.ucfirst($mydirname).'.Success', 'altsys_message_append_onuninstall');
17
+        $ret = array();
18 18
     } else {
19
-        if (! is_array($ret)) {
20
-            $ret = array() ;
19
+        if (!is_array($ret)) {
20
+            $ret = array();
21 21
         }
22 22
     }
23 23
 
24
-        $db =& XoopsDatabaseFactory::getDatabaseConnection() ;
25
-        $mid = $module->getVar('mid') ;
24
+        $db = & XoopsDatabaseFactory::getDatabaseConnection();
25
+        $mid = $module->getVar('mid');
26 26
 
27 27
     // TABLES (loading mysql.sql)
28
-    $sql_file_path = dirname(__FILE__).'/sql/mysql.sql' ;
29
-        $prefix_mod = $db->prefix() . '_' . $mydirname ;
28
+    $sql_file_path = dirname(__FILE__).'/sql/mysql.sql';
29
+        $prefix_mod = $db->prefix().'_'.$mydirname;
30 30
         if (file_exists($sql_file_path)) {
31 31
             $ret[] = "SQL file found at <b>".htmlspecialchars($sql_file_path)."</b>.<br  /> Deleting tables...<br />";
32
-            $sql_lines = file($sql_file_path) ;
32
+            $sql_lines = file($sql_file_path);
33 33
             foreach ($sql_lines as $sql_line) {
34 34
                 if (preg_match('/^CREATE TABLE \`?([a-zA-Z0-9_-]+)\`? /i', $sql_line, $regs)) {
35 35
                     $sql = 'DROP TABLE '.addslashes($prefix_mod.'_'.$regs[1]);
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
     unset($templates); */
60 60
 
61 61
 
62
-    return true ;
62
+    return true;
63 63
     }
64 64
 
65 65
     function altsys_message_append_onuninstall(&$module_obj, &$log)
66 66
     {
67 67
         if (is_array(@$GLOBALS['ret'])) {
68 68
             foreach ($GLOBALS['ret'] as $message) {
69
-                $log->add(strip_tags($message)) ;
69
+                $log->add(strip_tags($message));
70 70
             }
71 71
         }
72 72
 
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/put_templates.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -5,25 +5,25 @@  discard block
 block discarded – undo
5 5
 //                        GIJOE <http://www.peak.ne.jp/>                     //
6 6
 // ------------------------------------------------------------------------- //
7 7
 
8
-include_once dirname(__FILE__).'/include/gtickets.php' ;
9
-include_once dirname(__FILE__).'/include/altsys_functions.php' ;
10
-include_once dirname(__FILE__).'/include/tpls_functions.php' ;
8
+include_once dirname(__FILE__).'/include/gtickets.php';
9
+include_once dirname(__FILE__).'/include/altsys_functions.php';
10
+include_once dirname(__FILE__).'/include/tpls_functions.php';
11 11
 
12 12
 
13 13
 // this page can be called only from altsys
14 14
 if ($xoopsModule->getVar('dirname') != 'altsys') {
15
-    die('this page can be called only from altsys') ;
15
+    die('this page can be called only from altsys');
16 16
 }
17 17
 
18 18
 
19 19
 // language file
20
-altsys_include_language_file('compilehookadmin') ;
20
+altsys_include_language_file('compilehookadmin');
21 21
 
22 22
 
23
-$db =& XoopsDatabaseFactory::getDatabaseConnection() ;
23
+$db = & XoopsDatabaseFactory::getDatabaseConnection();
24 24
 
25
-if (empty($_FILES['tplset_archive']['tmp_name']) || ! is_uploaded_file($_FILES['tplset_archive']['tmp_name'])) {
26
-    die(_TPLSADMIN_ERR_NOTUPLOADED) ;
25
+if (empty($_FILES['tplset_archive']['tmp_name']) || !is_uploaded_file($_FILES['tplset_archive']['tmp_name'])) {
26
+    die(_TPLSADMIN_ERR_NOTUPLOADED);
27 27
 }
28 28
 //fix for mb_http_output setting and for add any browsers
29 29
     if (function_exists('mb_http_output')) {
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 //ob_buffer over flow
33 33
 //HACK by suin & nao-pon 2012/01/06
34 34
     while (ob_get_level() > 0) {
35
-        if (! ob_end_clean()) {
35
+        if (!ob_end_clean()) {
36 36
             break;
37 37
         }
38 38
     }
@@ -41,62 +41,62 @@  discard block
 block discarded – undo
41 41
 // EXTRACT STAGE
42 42
 //
43 43
 
44
-$orig_filename4check = strtolower($_FILES['tplset_archive']['name']) ;
44
+$orig_filename4check = strtolower($_FILES['tplset_archive']['name']);
45 45
 if (strtolower(substr($orig_filename4check, -4)) == '.zip') {
46 46
 
47 47
     // zip
48
-    require_once dirname(__FILE__).'/include/Archive_Zip.php' ;
49
-    $reader = new Archive_Zip($_FILES['tplset_archive']['tmp_name']) ;
50
-    $files = $reader->extract(array( 'extract_as_string' => true )) ;
51
-    if (! is_array(@$files)) {
52
-        die($reader->errorName()) ;
48
+    require_once dirname(__FILE__).'/include/Archive_Zip.php';
49
+    $reader = new Archive_Zip($_FILES['tplset_archive']['tmp_name']);
50
+    $files = $reader->extract(array('extract_as_string' => true));
51
+    if (!is_array(@$files)) {
52
+        die($reader->errorName());
53 53
     }
54
-    $do_upload = true ;
54
+    $do_upload = true;
55 55
 } elseif (substr($orig_filename4check, -4) == '.tgz' || substr($orig_filename4check, -7) == '.tar.gz') {
56 56
 
57 57
     // tar.gz
58
-    require_once XOOPS_ROOT_PATH.'/class/class.tar.php' ;
59
-    $tar = new tar() ;
60
-    $tar->openTar($_FILES['tplset_archive']['tmp_name']) ;
61
-    $files = array() ;
58
+    require_once XOOPS_ROOT_PATH.'/class/class.tar.php';
59
+    $tar = new tar();
60
+    $tar->openTar($_FILES['tplset_archive']['tmp_name']);
61
+    $files = array();
62 62
     foreach ($tar->files as $id => $info) {
63 63
         $files[] = array(
64
-            'filename' => $info['name'] ,
65
-            'mtime' => $info['time'] ,
66
-            'content' => $info['file'] ,
67
-        ) ;
64
+            'filename' => $info['name'],
65
+            'mtime' => $info['time'],
66
+            'content' => $info['file'],
67
+        );
68 68
     }
69 69
     if (empty($files)) {
70
-        die(_TPLSADMIN_ERR_INVALIDARCHIVE) ;
70
+        die(_TPLSADMIN_ERR_INVALIDARCHIVE);
71 71
     }
72
-    $do_upload = true ;
72
+    $do_upload = true;
73 73
 }
74 74
 
75 75
 if (empty($do_upload)) {
76
-    die(_TPLSADMIN_ERR_EXTENSION) ;
76
+    die(_TPLSADMIN_ERR_EXTENSION);
77 77
 }
78 78
 
79 79
 //
80 80
 // IMPORT STAGE
81 81
 //
82 82
 
83
-$tplset = @$_POST['tplset'] ;
84
-if (! preg_match('/^[0-9A-Za-z_-]{1,16}$/', $tplset)) {
85
-    die(_TPLSADMIN_ERR_INVALIDTPLSET) ;
83
+$tplset = @$_POST['tplset'];
84
+if (!preg_match('/^[0-9A-Za-z_-]{1,16}$/', $tplset)) {
85
+    die(_TPLSADMIN_ERR_INVALIDTPLSET);
86 86
 }
87 87
 
88
-$imported = 0 ;
88
+$imported = 0;
89 89
 foreach ($files as $file) {
90
-    if (! empty($file['folder'])) {
91
-        continue ;
90
+    if (!empty($file['folder'])) {
91
+        continue;
92 92
     }
93
-    $pos = strrpos($file['filename'], '/') ;
94
-    $tpl_file = $pos === false ? $file['filename'] : substr($file['filename'], $pos + 1) ;
93
+    $pos = strrpos($file['filename'], '/');
94
+    $tpl_file = $pos === false ? $file['filename'] : substr($file['filename'], $pos + 1);
95 95
 
96 96
     if (tplsadmin_import_data($tplset, $tpl_file, rtrim($file['content']), $file['mtime'])) {
97
-        $imported ++ ;
97
+        $imported++;
98 98
     }
99 99
 }
100 100
 
101
-redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf(_TPLSADMIN_FMT_MSG_PUTTEMPLATES, $imported)) ;
102
-exit ;
101
+redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf(_TPLSADMIN_FMT_MSG_PUTTEMPLATES, $imported));
102
+exit;
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/mylangadmin.php 1 patch
Spacing   +116 added lines, -116 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 dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php' ;
9
-include_once dirname(__FILE__)."/include/gtickets.php" ;
10
-include_once dirname(__FILE__).'/include/altsys_functions.php' ;
11
-include_once dirname(__FILE__).'/include/lang_functions.php' ;
12
-include_once dirname(__FILE__).'/class/D3LanguageManager.class.php' ;
8
+require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php';
9
+include_once dirname(__FILE__)."/include/gtickets.php";
10
+include_once dirname(__FILE__).'/include/altsys_functions.php';
11
+include_once dirname(__FILE__).'/include/lang_functions.php';
12
+include_once dirname(__FILE__).'/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
-$db =& XoopsDatabaseFactory::getDatabaseConnection();
29
-(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance() ;
30
-$langman =& D3LanguageManager::getInstance() ;
28
+$db = & XoopsDatabaseFactory::getDatabaseConnection();
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
-$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) ;
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);
45 45
 }
46 46
 
47
-if (! empty($target_module) && is_object($target_module)) {
47
+if (!empty($target_module) && is_object($target_module)) {
48 48
     // specified by dirname (for langadmin as an independent module)
49
-    $target_mid = $target_module->getVar('mid') ;
50
-    $target_dirname = $target_module->getVar('dirname') ;
51
-    $target_dirname4sql = addslashes($target_dirname) ;
52
-    $target_mname = $target_module->getVar('name') . "&nbsp;" . sprintf("(%2.2f)", $target_module->getVar('version') / 100.0) ;
49
+    $target_mid = $target_module->getVar('mid');
50
+    $target_dirname = $target_module->getVar('dirname');
51
+    $target_dirname4sql = addslashes($target_dirname);
52
+    $target_mname = $target_module->getVar('name')."&nbsp;".sprintf("(%2.2f)", $target_module->getVar('version') / 100.0);
53 53
     //$query4redirect = '?dirname='.urlencode(strip_tags($_GET['dirname'])) ;
54 54
 } else {
55 55
     // not specified by dirname (for 3rd party modules as mylangadmin)
56
-    $target_mid = $xoopsModule->getVar('mid') ;
57
-    $target_dirname = $xoopsModule->getVar('dirname') ;
58
-    $target_dirname4sql = addslashes($target_dirname) ;
59
-    $target_mname = $xoopsModule->getVar('name') ;
56
+    $target_mid = $xoopsModule->getVar('mid');
57
+    $target_dirname = $xoopsModule->getVar('dirname');
58
+    $target_dirname4sql = addslashes($target_dirname);
59
+    $target_mname = $xoopsModule->getVar('name');
60 60
     //$query4redirect = '' ;
61 61
 }
62 62
 
63 63
 // basic GET variables
64
-$target_lang = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['target_lang']) ;
64
+$target_lang = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['target_lang']);
65 65
 if (empty($target_lang)) {
66
-    $target_lang = $GLOBALS['xoopsConfig']['language'] ;
66
+    $target_lang = $GLOBALS['xoopsConfig']['language'];
67 67
 }
68
-$target_lang4sql = addslashes($target_lang) ;
69
-$target_file = preg_replace('/[^0-9a-zA-Z_.-]/', '', @$_GET['target_file']) ;
68
+$target_lang4sql = addslashes($target_lang);
69
+$target_file = preg_replace('/[^0-9a-zA-Z_.-]/', '', @$_GET['target_file']);
70 70
 if (empty($target_file)) {
71
-    $target_file = 'main.php' ;
71
+    $target_file = 'main.php';
72 72
 }
73 73
 
74 74
 // get $target_trustdirname
75
-$mytrustdirname = '' ;
75
+$mytrustdirname = '';
76 76
 if (file_exists(XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/mytrustdirname.php')) {
77
-    require XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/mytrustdirname.php' ;
77
+    require XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/mytrustdirname.php';
78 78
 }
79
-$target_trustdirname = $mytrustdirname ;
79
+$target_trustdirname = $mytrustdirname;
80 80
 
81 81
 // get base directory
82 82
 if (empty($target_trustdirname)) {
83 83
     // conventinal module
84
-    $base_dir = XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/language' ;
84
+    $base_dir = XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/language';
85 85
 } else {
86 86
     // D3 module
87
-    $base_dir = XOOPS_TRUST_PATH.'/modules/'.$target_trustdirname.'/language' ;
87
+    $base_dir = XOOPS_TRUST_PATH.'/modules/'.$target_trustdirname.'/language';
88 88
 }
89 89
 
90 90
 // make list of language and check $target_lang
91
-$languages = array() ;
92
-$languages4disp = array() ;
93
-if (! is_dir($base_dir)) {
94
-    altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODNOLANGUAGE) ;
91
+$languages = array();
92
+$languages4disp = array();
93
+if (!is_dir($base_dir)) {
94
+    altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODNOLANGUAGE);
95 95
 }
96
-$dh = opendir($base_dir) ;
96
+$dh = opendir($base_dir);
97 97
 if ($dh) {
98 98
     while ($file = readdir($dh)) {
99 99
         if (substr($file, 0, 1) == '.') {
100
-            continue ;
100
+            continue;
101 101
         }
102 102
         if (is_dir("$base_dir/$file")) {
103
-            list($count) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("altsys_language_constants")." WHERE mid=$target_mid AND language='".addslashes($file)."'")) ;
104
-            $languages[] = $file ;
105
-            $languages4disp[] = $file . " ($count)" ;
103
+            list($count) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("altsys_language_constants")." WHERE mid=$target_mid AND language='".addslashes($file)."'"));
104
+            $languages[] = $file;
105
+            $languages4disp[] = $file." ($count)";
106 106
         }
107 107
     }
108 108
 }
109
-closedir($dh) ;
110
-if (! in_array($target_lang, $languages)) {
111
-    $target_lang = $languages[0] ;
109
+closedir($dh);
110
+if (!in_array($target_lang, $languages)) {
111
+    $target_lang = $languages[0];
112 112
 }
113 113
 
114 114
 // get base directory seleced language
115
-$lang_base_dir = $base_dir.'/'.$target_lang ;
116
-if (! is_dir($lang_base_dir)) {
117
-    altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODLANGINCOMPATIBLE) ;
115
+$lang_base_dir = $base_dir.'/'.$target_lang;
116
+if (!is_dir($lang_base_dir)) {
117
+    altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODLANGINCOMPATIBLE);
118 118
 }
119 119
 
120 120
 // make list of files and check $target_file
121
-$lang_files = array() ;
122
-$dh = opendir($lang_base_dir) ;
121
+$lang_files = array();
122
+$dh = opendir($lang_base_dir);
123 123
 if ($dh) {
124 124
     while ($file = readdir($dh)) {
125 125
         if (substr($file, 0, 1) == '.') {
126
-            continue ;
126
+            continue;
127 127
         }
128 128
         if ($file == 'index.html') {
129
-            continue ;
129
+            continue;
130 130
         }
131 131
     //if( $file == 'modinfo.php' ) continue ; // TODO(?)
132 132
     //if( $file == 'global.php' ) continue ; // TODO(?)
133 133
     if (is_file("$lang_base_dir/$file")) {
134
-        $lang_files[] = $file ;
134
+        $lang_files[] = $file;
135 135
     }
136 136
     }
137 137
 }
138
-closedir($dh) ;
138
+closedir($dh);
139 139
 if (empty($lang_files)) {
140
-    altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODEMPTYLANGDIR) ;
140
+    altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODEMPTYLANGDIR);
141 141
 }
142
-if (! in_array($target_file, $lang_files)) {
143
-    $target_file = $lang_files[0] ;
142
+if (!in_array($target_file, $lang_files)) {
143
+    $target_file = $lang_files[0];
144 144
 }
145 145
 
146 146
 // get unique path of language_file
147
-$langfile_unique_path = "$lang_base_dir/$target_file" ;
147
+$langfile_unique_path = "$lang_base_dir/$target_file";
148 148
 
149 149
 // get constants defined by the target_file
150
-list($langfile_names, $constpref, $already_read) = altsys_mylangadmin_get_constant_names($langfile_unique_path, $target_dirname) ;
150
+list($langfile_names, $constpref, $already_read) = altsys_mylangadmin_get_constant_names($langfile_unique_path, $target_dirname);
151 151
 
152 152
 // get user_values should be overridden
153
-$langfile_constants = array() ;
153
+$langfile_constants = array();
154 154
 foreach ($langfile_names as $name) {
155
-    list($value) = $db->fetchRow($db->query("SELECT value FROM ".$db->prefix("altsys_language_constants")." WHERE mid=$target_mid AND language='$target_lang4sql' AND name='".addslashes($name)."'")) ;
156
-    $langfile_constants[ $name ] = $value ;
155
+    list($value) = $db->fetchRow($db->query("SELECT value FROM ".$db->prefix("altsys_language_constants")." WHERE mid=$target_mid AND language='$target_lang4sql' AND name='".addslashes($name)."'"));
156
+    $langfile_constants[$name] = $value;
157 157
 }
158 158
 
159 159
 // constants defined in XOOPS_ROOT_PATH/my_language/(dirname)/...
160 160
 if ($langman->my_language) {
161
-    $mylang_unique_path = $langman->my_language.'/modules/'.$target_dirname.'/'.$target_lang.'/'.$target_file ;
162
-    $mylang_constants = array_map('htmlspecialchars', altsys_mylangadmin_get_constants_by_pcre($mylang_unique_path)) ;
161
+    $mylang_unique_path = $langman->my_language.'/modules/'.$target_dirname.'/'.$target_lang.'/'.$target_file;
162
+    $mylang_constants = array_map('htmlspecialchars', altsys_mylangadmin_get_constants_by_pcre($mylang_unique_path));
163 163
     foreach ($mylang_constants as $key => $val) {
164
-        if (! in_array($key, array_keys($langfile_constants))) {
165
-            $langfile_constants[ $key ] = null ;
166
-            define($key, _MYLANGADMIN_NOTE_ADDEDBYMYLANG) ;
164
+        if (!in_array($key, array_keys($langfile_constants))) {
165
+            $langfile_constants[$key] = null;
166
+            define($key, _MYLANGADMIN_NOTE_ADDEDBYMYLANG);
167 167
         }
168 168
     }
169 169
 } else {
170
-    $mylang_unique_path = '' ;
171
-    $mylang_constants = array() ;
170
+    $mylang_unique_path = '';
171
+    $mylang_constants = array();
172 172
 }
173 173
 
174 174
 
@@ -177,57 +177,57 @@  discard block
 block discarded – undo
177 177
 //
178 178
 
179 179
 // Update language table and cache file
180
-if (! empty($_POST['do_update'])) {
180
+if (!empty($_POST['do_update'])) {
181 181
     // Ticket Check
182
-    if (! $xoopsGTicket->check(true, 'altsys')) {
182
+    if (!$xoopsGTicket->check(true, 'altsys')) {
183 183
         redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
184 184
     }
185 185
 
186 186
     // read original file
187
-    $file_contents = file_get_contents($langfile_unique_path) ;
187
+    $file_contents = file_get_contents($langfile_unique_path);
188 188
 
189 189
     // insert fingerprint of langfile_unique_path
190
-    $langfile_fingerprint = '_MYLANGADMIN_'.md5($langfile_unique_path) ;
191
-    $file_contents = str_replace('<?php', "<?php\nif(!defined('$langfile_fingerprint'))define('$langfile_fingerprint',1);", $file_contents) ;
190
+    $langfile_fingerprint = '_MYLANGADMIN_'.md5($langfile_unique_path);
191
+    $file_contents = str_replace('<?php', "<?php\nif(!defined('$langfile_fingerprint'))define('$langfile_fingerprint',1);", $file_contents);
192 192
 
193 193
     // constants loop
194
-    $overrides_counter = 0 ;
194
+    $overrides_counter = 0;
195 195
     foreach (array_reverse($langfile_names) as $name) {
196
-        $user_value = $myts->stripSlashesGPC(@$_POST[$name]) ;
197
-        $db->query("DELETE FROM ".$db->prefix("altsys_language_constants")." WHERE mid=$target_mid AND language='$target_lang4sql' AND name='".addslashes($name)."'") ;
196
+        $user_value = $myts->stripSlashesGPC(@$_POST[$name]);
197
+        $db->query("DELETE FROM ".$db->prefix("altsys_language_constants")." WHERE mid=$target_mid AND language='$target_lang4sql' AND name='".addslashes($name)."'");
198 198
         if ($user_value !== '') {
199
-            $overrides_counter ++ ;
199
+            $overrides_counter++;
200 200
             // Update table
201
-            $db->query("INSERT INTO ".$db->prefix("altsys_language_constants")." (mid,language,name,value) VALUES ($target_mid,'$target_lang4sql','".addslashes($name)."','".addslashes($user_value)."')") ;
201
+            $db->query("INSERT INTO ".$db->prefix("altsys_language_constants")." (mid,language,name,value) VALUES ($target_mid,'$target_lang4sql','".addslashes($name)."','".addslashes($user_value)."')");
202 202
             // rewrite script for cache
203 203
             // comment-out the line of define()
204 204
             if (empty($constpref)) {
205
-                $from = '/.*define\s?\(\s*(["\'])'.preg_quote($name).'(\\1).*\;.*/' ;
205
+                $from = '/.*define\s?\(\s*(["\'])'.preg_quote($name).'(\\1).*\;.*/';
206 206
             } else {
207
-                $from = '/.*define\s?\(\s*\$constpref\s*\.\s*(["\'])'.preg_quote(substr($name, strlen($constpref))).'(\\1).*\;.*/' ;
207
+                $from = '/.*define\s?\(\s*\$constpref\s*\.\s*(["\'])'.preg_quote(substr($name, strlen($constpref))).'(\\1).*\;.*/';
208 208
             }
209
-            $to = '//$0'."\ndefine('".addslashes($name)."','".addslashes($user_value)."');" ;
210
-            $file_contents = preg_replace($from, $to, $file_contents) ;
209
+            $to = '//$0'."\ndefine('".addslashes($name)."','".addslashes($user_value)."');";
210
+            $file_contents = preg_replace($from, $to, $file_contents);
211 211
         }
212 212
     }
213 213
 
214 214
     // get the file name for caching
215
-    $cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang) ;
215
+    $cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang);
216 216
 
217 217
     // Create language cache file
218 218
     if ($overrides_counter > 0) {
219
-        $fp = fopen($cache_file_name, 'wb') ;
220
-        if (! $fp) {
221
-            die('Invalid Cache Directory. (Set XOOPS_TRUST_PATH/cache writable)') ;
219
+        $fp = fopen($cache_file_name, 'wb');
220
+        if (!$fp) {
221
+            die('Invalid Cache Directory. (Set XOOPS_TRUST_PATH/cache writable)');
222 222
         }
223
-        fwrite($fp, $file_contents) ;
224
-        fclose($fp) ;
223
+        fwrite($fp, $file_contents);
224
+        fclose($fp);
225 225
     } else {
226
-        unlink($cache_file_name) ;
226
+        unlink($cache_file_name);
227 227
     }
228 228
 
229
-    redirect_header('?mode=admin&lib=altsys&page=mylangadmin&dirname='.$target_dirname.'&target_lang='.rawurlencode($target_lang).'&target_file='.rawurlencode($target_file), 1, _MYLANGADMIN_CACHEUPDATED) ;
230
-    exit ;
229
+    redirect_header('?mode=admin&lib=altsys&page=mylangadmin&dirname='.$target_dirname.'&target_lang='.rawurlencode($target_lang).'&target_file='.rawurlencode($target_file), 1, _MYLANGADMIN_CACHEUPDATED);
230
+    exit;
231 231
 }
232 232
 
233 233
 
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 //
237 237
 
238 238
 // check cache file
239
-$cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang) ;
240
-$cache_file_mtime = file_exists($cache_file_name) ? filemtime($cache_file_name) : 0 ;
239
+$cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang);
240
+$cache_file_mtime = file_exists($cache_file_name) ? filemtime($cache_file_name) : 0;
241 241
 
242 242
 // check core version and generate message to enable D3LanguageManager
243 243
 if (altsys_get_core_type() == ALTSYS_CORE_TYPE_XCL21) {
244 244
     // XoopsCube Legacy without preload
245 245
     if (class_exists('AltsysLangMgr_LanguageManager')) {
246 246
         // the preload enabled
247
-        $notice4disp = _MYLANGADMIN_MSG_D3LANGMANENABLED ;
247
+        $notice4disp = _MYLANGADMIN_MSG_D3LANGMANENABLED;
248 248
     } else {
249 249
         // the preload disabled
250
-        $notice4disp = sprintf(_MYLANGADMIN_FMT_HOWTOENABLED3LANGMAN4XCL, 'SetupAltsysLangMgr.class.php', 'XOOPS_ROOT_PATH/preload') ;
250
+        $notice4disp = sprintf(_MYLANGADMIN_FMT_HOWTOENABLED3LANGMAN4XCL, 'SetupAltsysLangMgr.class.php', 'XOOPS_ROOT_PATH/preload');
251 251
     }
252 252
 } else {
253 253
     // X2 core etc.
254
-    $notice4disp = _MYLANGADMIN_MSG_HOWTOENABLED3LANGMAN4X2.'<br />' ;
254
+    $notice4disp = _MYLANGADMIN_MSG_HOWTOENABLED3LANGMAN4X2.'<br />';
255 255
     $notice4disp .= '
256 256
 		<h4>include/common.php</h4>
257 257
 		<pre>
@@ -275,20 +275,20 @@  discard block
 block discarded – undo
275 275
 //
276 276
 
277 277
 
278
-xoops_cp_header() ;
278
+xoops_cp_header();
279 279
 
280 280
 // mymenu
281
-altsys_include_mymenu() ;
281
+altsys_include_mymenu();
282 282
 
283 283
 // breadcrumbs
284
-$breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ;
284
+$breadcrumbsObj = & AltsysBreadcrumbs::getInstance();
285 285
 if ($breadcrumbsObj->hasPaths()) {
286
-    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN) ;
287
-    $breadcrumbsObj->appendPath('', $target_mname) ;
286
+    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN);
287
+    $breadcrumbsObj->appendPath('', $target_mname);
288 288
 }
289 289
 
290
-require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ;
291
-$tpl = new D3Tpl() ;
290
+require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php';
291
+$tpl = new D3Tpl();
292 292
 $tpl->assign(array(
293 293
     'target_dirname' => $target_dirname,
294 294
     'target_mname' => $target_mname,
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
     'notice' => $notice4disp,
308 308
     'already_read' => $already_read,
309 309
     'gticket_hidden' => $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'altsys'),
310
-)) ;
311
-$tpl->display('db:altsys_main_mylangadmin.html') ;
310
+));
311
+$tpl->display('db:altsys_main_mylangadmin.html');
312 312
 
313
-xoops_cp_footer() ;
314
-exit ;
313
+xoops_cp_footer();
314
+exit;
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/mytplsadmin.php 1 patch
Spacing   +134 added lines, -134 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 dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php' ;
9
-include_once dirname(__FILE__)."/include/gtickets.php" ;
10
-include_once dirname(__FILE__).'/include/altsys_functions.php' ;
11
-include_once dirname(__FILE__)."/include/tpls_functions.php" ;
8
+require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php';
9
+include_once dirname(__FILE__)."/include/gtickets.php";
10
+include_once dirname(__FILE__).'/include/altsys_functions.php';
11
+include_once dirname(__FILE__)."/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
-$db =& XoopsDatabaseFactory::getDatabaseConnection();
28
-(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance() ;
27
+$db = & XoopsDatabaseFactory::getDatabaseConnection();
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
-$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) ;
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);
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
-                    $tpl_id = intval($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") ;
187
+                    $tpl_id = intval($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
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 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
@@ -319,45 +319,45 @@  discard block
 block discarded – undo
319 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=".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=".htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES)."&amp;dirname=".htmlspecialchars($target_dirname, ENT_QUOTES)."'>"._EDIT."</a> ($numrows)</td>\n";
357 357
         }
358 358
     }
359 359
 
360
-    echo "</tr>\n" ;
360
+    echo "</tr>\n";
361 361
 }
362 362
 
363 363
 // command submit ROW
@@ -384,21 +384,21 @@  discard block
 block discarded – undo
384 384
 		</td>\n" ;
385 385
 
386 386
     foreach ($tplsets as $tplset) {
387
-        $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ;
387
+        $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES);
388 388
         echo "\t\t<td class='head'>
389
-			" . ($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 />") . "
389
+			" . ($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 />")."
390 390
 			"._MYTPLSADMIN_CAPTION_COPYTO.":
391 391
 			<select name='copy_to[{$tplset4disp}]'>
392 392
 				".str_replace('<option value=\''.$tplset4disp.'\'>'.$tplset4disp.'</option>', '', $tplset_options)."
393 393
 			</select>
394 394
 			<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);' />
395
-		</td>\n" ;
395
+		</td>\n";
396 396
     }
397 397
 
398
-echo "	</tr>\n" ;
398
+echo "	</tr>\n";
399 399
 
400 400
 
401
-echo "</table></form>" ;
401
+echo "</table></form>";
402 402
 // end of table & form
403 403
 
404
-xoops_cp_footer() ;
404
+xoops_cp_footer();
Please login to merge, or discard this patch.