@@ -1,15 +1,15 @@ discard block |
||
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 | 15 | $module_handler4menu = xoops_gethandler('module'); |
@@ -17,45 +17,45 @@ discard block |
||
17 | 17 | //$criteria4menu->add(new Criteria('hasmain', 1)); |
18 | 18 | $criteria4menu->add(new Criteria('mid', '1', '>')); |
19 | 19 | $modules4menu = $module_handler4menu->getObjects($criteria4menu, true); |
20 | - $system_module = $module_handler4menu->get(1) ; |
|
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 , |
|
39 | + 'selected' => true, |
|
40 | + 'title' => $m4menu->getVar('name', 'n').$block_desc, |
|
41 | 41 | 'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n') |
42 | - ) ; |
|
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 , |
|
46 | + 'selected' => false, |
|
47 | + 'title' => $m4menu->getVar('name', 'n').$block_desc, |
|
48 | 48 | 'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n') |
49 | - ) ; |
|
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'); |
@@ -1,37 +1,37 @@ |
||
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)" , |
|
16 | + 'selected' => true, |
|
17 | + 'title' => $name." ($count)", |
|
18 | 18 | 'link' => '?mode=admin&lib=altsys&page=mylangadmin&dirname='.$dirname |
19 | - ) ; |
|
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)" , |
|
23 | + 'selected' => false, |
|
24 | + 'title' => $name." ($count)", |
|
25 | 25 | 'link' => '?mode=admin&lib=altsys&page=mylangadmin&dirname='.$dirname |
26 | - ) ; |
|
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'); |
@@ -1,56 +1,56 @@ |
||
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)" , |
|
22 | + 'selected' => $custom_selected, |
|
23 | + 'title' => _MYTPLSADMIN_CUSTOMTEMPLATE." ($count)", |
|
24 | 24 | 'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname=_custom' |
25 | 25 | ) |
26 | -) ; |
|
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)" , |
|
35 | + 'selected' => true, |
|
36 | + 'title' => $name." ($count)", |
|
37 | 37 | 'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$dirname |
38 | - ) ; |
|
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)" , |
|
42 | + 'selected' => false, |
|
43 | + 'title' => $name." ($count)", |
|
44 | 44 | 'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$dirname |
45 | - ) ; |
|
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'); |
@@ -354,7 +354,7 @@ |
||
354 | 354 | $fingerprints[ $fingerprint ] = $class ; |
355 | 355 | } |
356 | 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' /> <a href='?mode=admin&lib=altsys&page=mytplsform&tpl_file=".htmlspecialchars($tpl['tpl_file'], ENT_QUOTES) . '&tpl_tplset=' |
357 | - . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES) . '&dirname=' . htmlspecialchars($target_dirname, ENT_QUOTES) . "'>" . _EDIT . "</a> ($numrows)</td>\n" ; |
|
357 | + . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES) . '&dirname=' . htmlspecialchars($target_dirname, ENT_QUOTES) . "'>" . _EDIT . "</a> ($numrows)</td>\n" ; |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 |
@@ -5,63 +5,63 @@ discard block |
||
5 | 5 | // GIJOE <http://www.peak.ne.jp/> // |
6 | 6 | // ------------------------------------------------------------------------- // |
7 | 7 | |
8 | -require_once __DIR__.'/class/AltsysBreadcrumbs.class.php' ; |
|
9 | -include_once __DIR__ . '/include/gtickets.php'; |
|
10 | -include_once __DIR__.'/include/altsys_functions.php' ; |
|
11 | -include_once __DIR__ . '/include/tpls_functions.php'; |
|
8 | +require_once __DIR__.'/class/AltsysBreadcrumbs.class.php'; |
|
9 | +include_once __DIR__.'/include/gtickets.php'; |
|
10 | +include_once __DIR__.'/include/altsys_functions.php'; |
|
11 | +include_once __DIR__.'/include/tpls_functions.php'; |
|
12 | 12 | |
13 | 13 | |
14 | 14 | // only groups have 'module_admin' of 'altsys' can do that. |
15 | -$module_handler = xoops_gethandler('module') ; |
|
16 | -$module =& $module_handler->getByDirname('altsys') ; |
|
17 | -if (! is_object($module)) { |
|
18 | - die('install altsys') ; |
|
15 | +$module_handler = xoops_gethandler('module'); |
|
16 | +$module = & $module_handler->getByDirname('altsys'); |
|
17 | +if (!is_object($module)) { |
|
18 | + die('install altsys'); |
|
19 | 19 | } |
20 | -$moduleperm_handler = xoops_gethandler('groupperm') ; |
|
21 | -if (! is_object(@$xoopsUser) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { |
|
22 | - die('only admin of altsys can access this area') ; |
|
20 | +$moduleperm_handler = xoops_gethandler('groupperm'); |
|
21 | +if (!is_object(@$xoopsUser) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { |
|
22 | + die('only admin of altsys can access this area'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | 26 | // initials |
27 | 27 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
28 | -(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance() ; |
|
28 | +(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
29 | 29 | |
30 | 30 | // language file |
31 | -altsys_include_language_file('mytplsadmin') ; |
|
31 | +altsys_include_language_file('mytplsadmin'); |
|
32 | 32 | |
33 | 33 | // check $xoopsModule |
34 | -if (! is_object($xoopsModule)) { |
|
35 | - redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM) ; |
|
34 | +if (!is_object($xoopsModule)) { |
|
35 | + redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // set target_module if specified by $_GET['dirname'] |
39 | 39 | $module_handler = xoops_gethandler('module'); |
40 | -if (! empty($_GET['dirname'])) { |
|
41 | - $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']) ; |
|
42 | - $target_module =& $module_handler->getByDirname($dirname) ; |
|
40 | +if (!empty($_GET['dirname'])) { |
|
41 | + $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']); |
|
42 | + $target_module = & $module_handler->getByDirname($dirname); |
|
43 | 43 | } |
44 | 44 | |
45 | -if (! empty($target_module) && is_object($target_module)) { |
|
45 | +if (!empty($target_module) && is_object($target_module)) { |
|
46 | 46 | // specified by dirname (for tplsadmin as an independent module) |
47 | - $target_mid = $target_module->getVar('mid') ; |
|
48 | - $target_dirname = $target_module->getVar('dirname') ; |
|
49 | - $target_dirname4sql = addslashes($target_dirname) ; |
|
50 | - $target_mname = $target_module->getVar('name') . ' ' . 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').' '.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 |
||
71 | 71 | //**************// |
72 | 72 | |
73 | 73 | // Create new template set (blank or clone) |
74 | -if (! empty($_POST['clone_tplset_do']) && ! empty($_POST['clone_tplset_from']) && ! empty($_POST['clone_tplset_to'])) { |
|
74 | +if (!empty($_POST['clone_tplset_do']) && !empty($_POST['clone_tplset_from']) && !empty($_POST['clone_tplset_to'])) { |
|
75 | 75 | // Ticket Check |
76 | - if (! $xoopsGTicket->check()) { |
|
76 | + if (!$xoopsGTicket->check()) { |
|
77 | 77 | redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); |
78 | 78 | } |
79 | 79 | |
80 | - $tplset_from = $myts->stripSlashesGPC($_POST['clone_tplset_from']) ; |
|
81 | - $tplset_to = $myts->stripSlashesGPC($_POST['clone_tplset_to']) ; |
|
80 | + $tplset_from = $myts->stripSlashesGPC($_POST['clone_tplset_from']); |
|
81 | + $tplset_to = $myts->stripSlashesGPC($_POST['clone_tplset_to']); |
|
82 | 82 | // check tplset_name "from" and "to" |
83 | - if (! preg_match('/^[0-9A-Za-z_-]{1,16}$/', $_POST['clone_tplset_from'])) { |
|
84 | - tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDSETNAME, $target_dirname) ; |
|
83 | + if (!preg_match('/^[0-9A-Za-z_-]{1,16}$/', $_POST['clone_tplset_from'])) { |
|
84 | + tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDSETNAME, $target_dirname); |
|
85 | 85 | } |
86 | - if (! preg_match('/^[0-9A-Za-z_-]{1,16}$/', $_POST['clone_tplset_to'])) { |
|
87 | - tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDSETNAME, $target_dirname) ; |
|
86 | + if (!preg_match('/^[0-9A-Za-z_-]{1,16}$/', $_POST['clone_tplset_to'])) { |
|
87 | + tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDSETNAME, $target_dirname); |
|
88 | 88 | } |
89 | - list($is_exist) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset_to) . "'")) ; |
|
89 | + list($is_exist) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset_to)."'")); |
|
90 | 90 | if ($is_exist) { |
91 | - tplsadmin_die(_MYTPLSADMIN_ERR_DUPLICATEDSETNAME, $target_dirname) ; |
|
91 | + tplsadmin_die(_MYTPLSADMIN_ERR_DUPLICATEDSETNAME, $target_dirname); |
|
92 | 92 | } |
93 | - list($is_exist) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('tplset') . " WHERE tplset_name='" . addslashes($tplset_to) . "'")) ; |
|
93 | + list($is_exist) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('tplset')." WHERE tplset_name='".addslashes($tplset_to)."'")); |
|
94 | 94 | if ($is_exist) { |
95 | - tplsadmin_die(_MYTPLSADMIN_ERR_DUPLICATEDSETNAME, $target_dirname) ; |
|
95 | + tplsadmin_die(_MYTPLSADMIN_ERR_DUPLICATEDSETNAME, $target_dirname); |
|
96 | 96 | } |
97 | 97 | // insert tplset table |
98 | - $db->query('INSERT INTO ' . $db->prefix('tplset') . " SET tplset_name='" . addslashes($tplset_to) . "', tplset_desc='Created by tplsadmin', tplset_created=UNIX_TIMESTAMP()") ; |
|
99 | - tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, "tpl_module='$target_dirname4sql'") ; |
|
100 | - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED) ; |
|
101 | - exit ; |
|
98 | + $db->query('INSERT INTO '.$db->prefix('tplset')." SET tplset_name='".addslashes($tplset_to)."', tplset_desc='Created by tplsadmin', tplset_created=UNIX_TIMESTAMP()"); |
|
99 | + tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, "tpl_module='$target_dirname4sql'"); |
|
100 | + redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED); |
|
101 | + exit; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | // DB to DB template copy (checked templates) |
105 | 105 | if (is_array(@$_POST['copy_do'])) { |
106 | 106 | foreach ($_POST['copy_do'] as $tplset_from_tmp => $val) { |
107 | - if (! empty($val)) { |
|
107 | + if (!empty($val)) { |
|
108 | 108 | // Ticket Check |
109 | - if (! $xoopsGTicket->check()) { |
|
109 | + if (!$xoopsGTicket->check()) { |
|
110 | 110 | redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); |
111 | 111 | } |
112 | 112 | |
113 | - $tplset_from = $myts->stripSlashesGPC($tplset_from_tmp) ; |
|
113 | + $tplset_from = $myts->stripSlashesGPC($tplset_from_tmp); |
|
114 | 114 | if (empty($_POST['copy_to'][$tplset_from]) || $_POST['copy_to'][$tplset_from] == $tplset_from) { |
115 | - tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDTPLSET, $target_dirname) ; |
|
115 | + tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDTPLSET, $target_dirname); |
|
116 | 116 | } |
117 | 117 | if (empty($_POST["{$tplset_from}_check"])) { |
118 | - tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname) ; |
|
118 | + tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname); |
|
119 | 119 | } |
120 | - $tplset_to = $myts->stripSlashesGPC($_POST['copy_to'][$tplset_from]) ; |
|
120 | + $tplset_to = $myts->stripSlashesGPC($_POST['copy_to'][$tplset_from]); |
|
121 | 121 | foreach ($_POST["{$tplset_from}_check"] as $tplfile_tmp => $val) { |
122 | 122 | if (empty($val)) { |
123 | - continue ; |
|
123 | + continue; |
|
124 | 124 | } |
125 | - $tplfile = $myts->stripSlashesGPC($tplfile_tmp) ; |
|
126 | - tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, "tpl_file='".addslashes($tplfile)."'") ; |
|
125 | + $tplfile = $myts->stripSlashesGPC($tplfile_tmp); |
|
126 | + tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, "tpl_file='".addslashes($tplfile)."'"); |
|
127 | 127 | } |
128 | - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED) ; |
|
129 | - exit ; |
|
128 | + redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED); |
|
129 | + exit; |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | 134 | // File to DB template copy (checked templates) |
135 | -if (! empty($_POST['copyf2db_do'])) { |
|
135 | +if (!empty($_POST['copyf2db_do'])) { |
|
136 | 136 | // Ticket Check |
137 | - if (! $xoopsGTicket->check()) { |
|
137 | + if (!$xoopsGTicket->check()) { |
|
138 | 138 | redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); |
139 | 139 | } |
140 | 140 | |
141 | 141 | if (empty($_POST['copyf2db_to'])) { |
142 | - tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDTPLSET, $target_dirname) ; |
|
142 | + tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDTPLSET, $target_dirname); |
|
143 | 143 | } |
144 | 144 | if (empty($_POST['basecheck'])) { |
145 | - tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname) ; |
|
145 | + tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname); |
|
146 | 146 | } |
147 | - $tplset_to = $myts->stripSlashesGPC($_POST['copyf2db_to']) ; |
|
147 | + $tplset_to = $myts->stripSlashesGPC($_POST['copyf2db_to']); |
|
148 | 148 | foreach ($_POST['basecheck'] as $tplfile_tmp => $val) { |
149 | 149 | if (empty($val)) { |
150 | - continue ; |
|
150 | + continue; |
|
151 | 151 | } |
152 | - $tplfile = $myts->stripSlashesGPC($tplfile_tmp) ; |
|
153 | - tplsadmin_copy_templates_f2db($tplset_to, "tpl_file='".addslashes($tplfile)."'") ; |
|
152 | + $tplfile = $myts->stripSlashesGPC($tplfile_tmp); |
|
153 | + tplsadmin_copy_templates_f2db($tplset_to, "tpl_file='".addslashes($tplfile)."'"); |
|
154 | 154 | } |
155 | - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED) ; |
|
156 | - exit ; |
|
155 | + redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED); |
|
156 | + exit; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // DB template remove (checked templates) |
160 | 160 | if (is_array(@$_POST['del_do'])) { |
161 | 161 | foreach ($_POST['del_do'] as $tplset_from_tmp => $val) { |
162 | - if (! empty($val)) { |
|
162 | + if (!empty($val)) { |
|
163 | 163 | // Ticket Check |
164 | - if (! $xoopsGTicket->check()) { |
|
164 | + if (!$xoopsGTicket->check()) { |
|
165 | 165 | redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); |
166 | 166 | } |
167 | 167 | |
168 | - $tplset_from = $myts->stripSlashesGPC($tplset_from_tmp) ; |
|
168 | + $tplset_from = $myts->stripSlashesGPC($tplset_from_tmp); |
|
169 | 169 | if ($tplset_from == 'default' && $target_dirname != '_custom') { |
170 | - tplsadmin_die(_MYTPLSADMIN_ERR_CANTREMOVEDEFAULT, $target_dirname) ; |
|
170 | + tplsadmin_die(_MYTPLSADMIN_ERR_CANTREMOVEDEFAULT, $target_dirname); |
|
171 | 171 | } |
172 | 172 | if (empty($_POST["{$tplset_from}_check"])) { |
173 | - tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname) ; |
|
173 | + tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname); |
|
174 | 174 | } |
175 | 175 | |
176 | - require_once XOOPS_ROOT_PATH.'/class/template.php' ; |
|
176 | + require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
177 | 177 | $tpl = new XoopsTpl(); |
178 | 178 | $tpl->force_compile = true; |
179 | 179 | |
180 | 180 | foreach ($_POST["{$tplset_from}_check"] as $tplfile_tmp => $val) { |
181 | 181 | if (empty($val)) { |
182 | - continue ; |
|
182 | + continue; |
|
183 | 183 | } |
184 | - $tplfile = $myts->stripSlashesGPC($tplfile_tmp) ; |
|
185 | - $result = $db->query('SELECT tpl_id FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset_from) . "' AND tpl_file='" . addslashes($tplfile) . "'") ; |
|
184 | + $tplfile = $myts->stripSlashesGPC($tplfile_tmp); |
|
185 | + $result = $db->query('SELECT tpl_id FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset_from)."' AND tpl_file='".addslashes($tplfile)."'"); |
|
186 | 186 | while (list($tpl_id) = $db->fetchRow($result)) { |
187 | 187 | $tpl_id = (int)$tpl_id; |
188 | - $db->query('DELETE FROM ' . $db->prefix('tplfile') . " WHERE tpl_id=$tpl_id") ; |
|
189 | - $db->query('DELETE FROM ' . $db->prefix('tplsource') . " WHERE tpl_id=$tpl_id") ; |
|
188 | + $db->query('DELETE FROM '.$db->prefix('tplfile')." WHERE tpl_id=$tpl_id"); |
|
189 | + $db->query('DELETE FROM '.$db->prefix('tplsource')." WHERE tpl_id=$tpl_id"); |
|
190 | 190 | } |
191 | 191 | // remove templates_c |
192 | 192 | $tpl->clear_cache('db:'.$tplfile); |
193 | 193 | $tpl->clear_compiled_tpl('db:'.$tplfile); |
194 | 194 | } |
195 | - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED) ; |
|
196 | - exit ; |
|
195 | + redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED); |
|
196 | + exit; |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | } |
@@ -234,60 +234,60 @@ discard block |
||
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&lib=altsys&page=mytplsadmin', _MI_ALTSYS_MENU_MYTPLSADMIN) ; |
|
283 | - $breadcrumbsObj->appendPath('', $target_mname) ; |
|
282 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', _MI_ALTSYS_MENU_MYTPLSADMIN); |
|
283 | + $breadcrumbsObj->appendPath('', $target_mname); |
|
284 | 284 | } |
285 | 285 | |
286 | -echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>"._MYTPLSADMIN_H3_MODULE." : $target_mname</h3>\n" ; |
|
286 | +echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>"._MYTPLSADMIN_H3_MODULE." : $target_mname</h3>\n"; |
|
287 | 287 | |
288 | 288 | // link to create a new custom template |
289 | 289 | if ($target_dirname == '_custom') { |
290 | - echo "<a href='index.php?mode=admin&lib=altsys&page=mytplsform&tpl_tplset=default'>"._MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE."</a>\n" ; |
|
290 | + echo "<a href='index.php?mode=admin&lib=altsys&page=mytplsform&tpl_tplset=default'>"._MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE."</a>\n"; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | // beggining of table & form |
@@ -296,18 +296,18 @@ discard block |
||
296 | 296 | ".$xoopsGTicket->getTicketHtml(__LINE__)." |
297 | 297 | <table class='outer altsys_mytplsadmin'> |
298 | 298 | <tr> |
299 | - <th>"._MYTPLSADMIN_TH_NAME . '</th> |
|
300 | - <th>' . _MYTPLSADMIN_TH_TYPE . "</th> |
|
299 | + <th>"._MYTPLSADMIN_TH_NAME.'</th> |
|
300 | + <th>' . _MYTPLSADMIN_TH_TYPE."</th> |
|
301 | 301 | <th><input type='checkbox' title="._MYTPLSADMIN_TITLE_CHECKALL." onclick=\"with(document.MainForm){for(i=0;i<length;i++){if(elements[i].type=='checkbox'&&elements[i].name.indexOf('basecheck')>=0){elements[i].checked=this.checked;}}}\" />"._MYTPLSADMIN_TH_FILE."</th> |
302 | 302 | $tplsets_th4disp |
303 | - </tr>\n" ; |
|
303 | + </tr>\n"; |
|
304 | 304 | |
305 | 305 | // STYLE for distinguishing fingerprints |
306 | -$fingerprint_classes = array( '' , ' fingerprint1' , ' fingerprint2' , ' fingerprint3' , ' fingerprint4' , ' fingerprint5' , ' fingerprint6' , ' fingerprint7' ) ; |
|
306 | +$fingerprint_classes = array('', ' fingerprint1', ' fingerprint2', ' fingerprint3', ' fingerprint4', ' fingerprint5', ' fingerprint6', ' fingerprint7'); |
|
307 | 307 | |
308 | 308 | // template ROWS |
309 | 309 | while (list($tpl_file, $tpl_desc, $type, $count) = $db->fetchRow($frs)) { |
310 | - $evenodd = @$evenodd == 'even' ? 'odd' : 'even' ; |
|
310 | + $evenodd = @$evenodd == 'even' ? 'odd' : 'even'; |
|
311 | 311 | $fingerprints = array(); |
312 | 312 | |
313 | 313 | // information about the template |
@@ -315,64 +315,64 @@ discard block |
||
315 | 315 | <tr> |
316 | 316 | <td class='$evenodd'> |
317 | 317 | <dl> |
318 | - <dt>".htmlspecialchars($tpl_file, ENT_QUOTES) . '</dt> |
|
319 | - <dd>' . htmlspecialchars($tpl_desc, ENT_QUOTES) . "</dd> |
|
318 | + <dt>".htmlspecialchars($tpl_file, ENT_QUOTES).'</dt> |
|
319 | + <dd>' . htmlspecialchars($tpl_desc, ENT_QUOTES)."</dd> |
|
320 | 320 | </dl> |
321 | 321 | </td> |
322 | - <td class='$evenodd'>".$type . '<br />(' . $count . ")</td>\n" ; |
|
322 | + <td class='$evenodd'>".$type.'<br />('.$count.")</td>\n"; |
|
323 | 323 | |
324 | 324 | // the base file template column |
325 | - $basefilepath = tplsadmin_get_basefilepath($target_dirname, $type, $tpl_file) ; |
|
325 | + $basefilepath = tplsadmin_get_basefilepath($target_dirname, $type, $tpl_file); |
|
326 | 326 | |
327 | 327 | if (file_exists($basefilepath)) { |
328 | - $fingerprint = tplsadmin_get_fingerprint(file($basefilepath)) ; |
|
329 | - $fingerprints[ $fingerprint ] = '' ; |
|
330 | - echo "<td class='$evenodd'>".formatTimestamp(filemtime($basefilepath), 'm').'<br />'.substr($fingerprint, 0, 16)."<br /><input type='checkbox' name='basecheck[$tpl_file]' value='1' /></td>\n" ; |
|
331 | - $fingerprint_class_count = 0 ; |
|
328 | + $fingerprint = tplsadmin_get_fingerprint(file($basefilepath)); |
|
329 | + $fingerprints[$fingerprint] = ''; |
|
330 | + echo "<td class='$evenodd'>".formatTimestamp(filemtime($basefilepath), 'm').'<br />'.substr($fingerprint, 0, 16)."<br /><input type='checkbox' name='basecheck[$tpl_file]' value='1' /></td>\n"; |
|
331 | + $fingerprint_class_count = 0; |
|
332 | 332 | } else { |
333 | - echo "<td class='$evenodd'><br /></td>" ; |
|
334 | - $fingerprint_class_count = -1 ; |
|
333 | + echo "<td class='$evenodd'><br /></td>"; |
|
334 | + $fingerprint_class_count = -1; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | // db template columns |
338 | 338 | foreach ($tplsets as $tplset) { |
339 | - $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ; |
|
339 | + $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES); |
|
340 | 340 | |
341 | 341 | // query for templates in db |
342 | - $drs = $db->query('SELECT * FROM ' . $db->prefix('tplfile') . ' f NATURAL LEFT JOIN ' . $db->prefix('tplsource') . " s WHERE tpl_file='" . addslashes($tpl_file) . "' AND tpl_tplset='" . addslashes($tplset) . "'") ; |
|
343 | - $numrows = $db->getRowsNum($drs) ; |
|
344 | - $tpl = $db->fetchArray($drs) ; |
|
342 | + $drs = $db->query('SELECT * FROM '.$db->prefix('tplfile').' f NATURAL LEFT JOIN '.$db->prefix('tplsource')." s WHERE tpl_file='".addslashes($tpl_file)."' AND tpl_tplset='".addslashes($tplset)."'"); |
|
343 | + $numrows = $db->getRowsNum($drs); |
|
344 | + $tpl = $db->fetchArray($drs); |
|
345 | 345 | if (empty($tpl['tpl_id'])) { |
346 | - echo "<td class='$evenodd'>($numrows)</td>\n" ; |
|
346 | + echo "<td class='$evenodd'>($numrows)</td>\n"; |
|
347 | 347 | } else { |
348 | - $fingerprint = tplsadmin_get_fingerprint(explode("\n", $tpl['tpl_source'])) ; |
|
349 | - if (isset($fingerprints[ $fingerprint ])) { |
|
350 | - $class = $fingerprints[ $fingerprint ] ; |
|
348 | + $fingerprint = tplsadmin_get_fingerprint(explode("\n", $tpl['tpl_source'])); |
|
349 | + if (isset($fingerprints[$fingerprint])) { |
|
350 | + $class = $fingerprints[$fingerprint]; |
|
351 | 351 | } else { |
352 | 352 | //$fingerprint_class_count ++ ; |
353 | - $class = $fingerprint_classes[++$fingerprint_class_count] ; |
|
354 | - $fingerprints[ $fingerprint ] = $class ; |
|
353 | + $class = $fingerprint_classes[++$fingerprint_class_count]; |
|
354 | + $fingerprints[$fingerprint] = $class; |
|
355 | 355 | } |
356 | - echo "<td class='{$evenodd}{$class}'>".formatTimestamp($tpl['tpl_lastmodified'], 'm').'<br />'.substr($fingerprint, 0, 16)."<br /><input type='checkbox' name='{$tplset4disp}_check[{$tpl_file}]' value='1' /> <a href='?mode=admin&lib=altsys&page=mytplsform&tpl_file=".htmlspecialchars($tpl['tpl_file'], ENT_QUOTES) . '&tpl_tplset=' |
|
357 | - . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES) . '&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' /> <a href='?mode=admin&lib=altsys&page=mytplsform&tpl_file=".htmlspecialchars($tpl['tpl_file'], ENT_QUOTES).'&tpl_tplset=' |
|
357 | + . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES).'&dirname='.htmlspecialchars($target_dirname, ENT_QUOTES)."'>"._EDIT."</a> ($numrows)</td>\n"; |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
361 | - echo "</tr>\n" ; |
|
361 | + echo "</tr>\n"; |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | // command submit ROW |
365 | 365 | echo " |
366 | 366 | <tr> |
367 | 367 | <td class='head'> |
368 | - "._MYTPLSADMIN_CREATE_NEW_TPLSET . ': <br /> |
|
369 | - ' . _MYTPLSADMIN_CAPTION_BASE . ": |
|
368 | + "._MYTPLSADMIN_CREATE_NEW_TPLSET.': <br /> |
|
369 | + ' . _MYTPLSADMIN_CAPTION_BASE.": |
|
370 | 370 | <select name='clone_tplset_from'> |
371 | 371 | $tplset_options |
372 | - <option value='_blank_'>"._MYTPLSADMIN_OPT_BLANKSET . '</option> |
|
372 | + <option value='_blank_'>"._MYTPLSADMIN_OPT_BLANKSET.'</option> |
|
373 | 373 | </select> |
374 | 374 | <br /> |
375 | - ' . _MYTPLSADMIN_CAPTION_SETNAME . ": <input type='text' name='clone_tplset_to' size='8' maxlength='16' /> <input type='submit' name='clone_tplset_do' value='" . _MYTPLSADMIN_BTN_NEWTPLSET . "' /> |
|
375 | + ' . _MYTPLSADMIN_CAPTION_SETNAME.": <input type='text' name='clone_tplset_to' size='8' maxlength='16' /> <input type='submit' name='clone_tplset_do' value='"._MYTPLSADMIN_BTN_NEWTPLSET."' /> |
|
376 | 376 | </td> |
377 | 377 | <td class='head'></td> |
378 | 378 | <td class='head'> |
@@ -385,21 +385,21 @@ discard block |
||
385 | 385 | </td>\n" ; |
386 | 386 | |
387 | 387 | foreach ($tplsets as $tplset) { |
388 | - $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ; |
|
388 | + $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES); |
|
389 | 389 | echo "\t\t<td class='head'> |
390 | - " . ($tplset == 'default' && $target_dirname != '_custom' ? '' : "<input name='del_do[{$tplset4disp}]' type='submit' value='" . _DELETE . "' onclick='return altsys_mytpladmin_check_copy_submit(\"" . _MYTPLSADMIN_CNF_DELETE_SELECTED_TEMPLATES . "\", \"{$tplset4disp}_\", false);' /><br /><br />") . ' |
|
391 | - ' . _MYTPLSADMIN_CAPTION_COPYTO . ": |
|
390 | + " . ($tplset == 'default' && $target_dirname != '_custom' ? '' : "<input name='del_do[{$tplset4disp}]' type='submit' value='"._DELETE."' onclick='return altsys_mytpladmin_check_copy_submit(\""._MYTPLSADMIN_CNF_DELETE_SELECTED_TEMPLATES."\", \"{$tplset4disp}_\", false);' /><br /><br />").' |
|
391 | + ' . _MYTPLSADMIN_CAPTION_COPYTO.": |
|
392 | 392 | <select name='copy_to[{$tplset4disp}]'> |
393 | 393 | ".str_replace('<option value=\''.$tplset4disp.'\'>'.$tplset4disp.'</option>', '', $tplset_options)." |
394 | 394 | </select> |
395 | 395 | <input name='copy_do[{$tplset4disp}]' type='submit' value='"._MYTPLSADMIN_BTN_COPY."' onclick='return altsys_mytpladmin_check_copy_submit(\""._MYTPLSADMIN_CNF_COPY_SELECTED_TEMPLATES."\", \"{$tplset4disp}_\", true);' /> |
396 | - </td>\n" ; |
|
396 | + </td>\n"; |
|
397 | 397 | } |
398 | 398 | |
399 | -echo " </tr>\n" ; |
|
399 | +echo " </tr>\n"; |
|
400 | 400 | |
401 | 401 | |
402 | 402 | echo '</table></form>'; |
403 | 403 | // end of table & form |
404 | 404 | |
405 | -xoops_cp_footer() ; |
|
405 | +xoops_cp_footer(); |
@@ -1,63 +1,63 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -eval(' function xoops_module_install_'.$mydirname.'( $module ) { return altsys_oninstall_base( $module , "'.$mydirname.'" ) ; } ') ; |
|
3 | +eval(' function xoops_module_install_'.$mydirname.'( $module ) { return altsys_oninstall_base( $module , "'.$mydirname.'" ) ; } '); |
|
4 | 4 | |
5 | 5 | |
6 | -if (! function_exists('altsys_oninstall_base')) { |
|
6 | +if (!function_exists('altsys_oninstall_base')) { |
|
7 | 7 | function altsys_oninstall_base($module, $mydirname) |
8 | 8 | { |
9 | 9 | // transations on module install |
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.ModuleInstall.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_oninstall') ; |
|
17 | - $ret = array() ; |
|
15 | + $root = & XCube_Root::getSingleton(); |
|
16 | + $root->mDelegateManager->add('Legacy.Admin.Event.ModuleInstall.'.ucfirst($mydirname).'.Success', 'altsys_message_append_oninstall'); |
|
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 | /*************** BEGIN ALTSYS SPECIFIC PART ******************/ |
28 | 28 | // set weight=0 |
29 | - $db->queryF('UPDATE ' . $db->prefix('modules') . " SET weight=0 WHERE mid=$mid") ; |
|
29 | + $db->queryF('UPDATE '.$db->prefix('modules')." SET weight=0 WHERE mid=$mid"); |
|
30 | 30 | /*************** END ALTSYS SPECIFIC PART ******************/ |
31 | 31 | |
32 | 32 | // TABLES (loading mysql.sql) |
33 | - $sql_file_path = __DIR__.'/sql/mysql.sql' ; |
|
34 | - $prefix_mod = $db->prefix() . '_' . $mydirname ; |
|
33 | + $sql_file_path = __DIR__.'/sql/mysql.sql'; |
|
34 | + $prefix_mod = $db->prefix().'_'.$mydirname; |
|
35 | 35 | if (file_exists($sql_file_path)) { |
36 | - $ret[] = 'SQL file found at <b>' . htmlspecialchars($sql_file_path) . '</b>.<br /> Creating tables...'; |
|
36 | + $ret[] = 'SQL file found at <b>'.htmlspecialchars($sql_file_path).'</b>.<br /> Creating tables...'; |
|
37 | 37 | |
38 | 38 | if (file_exists(XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php')) { |
39 | - include_once XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php' ; |
|
40 | - $sqlutil = new OldSqlUtility ; |
|
39 | + include_once XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php'; |
|
40 | + $sqlutil = new OldSqlUtility; |
|
41 | 41 | } else { |
42 | - include_once XOOPS_ROOT_PATH.'/class/database/sqlutility.php' ; |
|
43 | - $sqlutil = new SqlUtility ; |
|
42 | + include_once XOOPS_ROOT_PATH.'/class/database/sqlutility.php'; |
|
43 | + $sqlutil = new SqlUtility; |
|
44 | 44 | } |
45 | 45 | |
46 | - $sql_query = trim(file_get_contents($sql_file_path)) ; |
|
47 | - $sqlutil->splitMySqlFile($pieces, $sql_query) ; |
|
48 | - $created_tables = array() ; |
|
46 | + $sql_query = trim(file_get_contents($sql_file_path)); |
|
47 | + $sqlutil->splitMySqlFile($pieces, $sql_query); |
|
48 | + $created_tables = array(); |
|
49 | 49 | foreach ($pieces as $piece) { |
50 | - $prefixed_query = $sqlutil->prefixQuery($piece, $prefix_mod) ; |
|
51 | - if (! $prefixed_query) { |
|
52 | - $ret[] = 'Invalid SQL <b>' . htmlspecialchars($piece) . '</b><br />'; |
|
53 | - return false ; |
|
50 | + $prefixed_query = $sqlutil->prefixQuery($piece, $prefix_mod); |
|
51 | + if (!$prefixed_query) { |
|
52 | + $ret[] = 'Invalid SQL <b>'.htmlspecialchars($piece).'</b><br />'; |
|
53 | + return false; |
|
54 | 54 | } |
55 | - if (! $db->query($prefixed_query[0])) { |
|
56 | - $ret[] = '<b>'.htmlspecialchars($db->error()).'</b><br />' ; |
|
55 | + if (!$db->query($prefixed_query[0])) { |
|
56 | + $ret[] = '<b>'.htmlspecialchars($db->error()).'</b><br />'; |
|
57 | 57 | //var_dump( $db->error() ) ; |
58 | - return false ; |
|
58 | + return false; |
|
59 | 59 | } else { |
60 | - if (! in_array($prefixed_query[4], $created_tables)) { |
|
60 | + if (!in_array($prefixed_query[4], $created_tables)) { |
|
61 | 61 | $ret[] = 'Table <b>'.htmlspecialchars($prefix_mod.'_'.$prefixed_query[4]).'</b> created.<br />'; |
62 | 62 | $created_tables[] = $prefixed_query[4]; |
63 | 63 | } else { |
@@ -68,33 +68,33 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | // TEMPLATES |
71 | - $tplfile_handler = xoops_gethandler('tplfile') ; |
|
72 | - $tpl_path = __DIR__.'/templates' ; |
|
73 | - if ($handler = @opendir($tpl_path . '/')) { |
|
71 | + $tplfile_handler = xoops_gethandler('tplfile'); |
|
72 | + $tpl_path = __DIR__.'/templates'; |
|
73 | + if ($handler = @opendir($tpl_path.'/')) { |
|
74 | 74 | while (($file = readdir($handler)) !== false) { |
75 | 75 | if (substr($file, 0, 1) == '.') { |
76 | - continue ; |
|
76 | + continue; |
|
77 | 77 | } |
78 | - $file_path = $tpl_path . '/' . $file ; |
|
78 | + $file_path = $tpl_path.'/'.$file; |
|
79 | 79 | if (is_file($file_path)) { |
80 | 80 | $mtime = (int)(@filemtime($file_path)); |
81 | - $tplfile =& $tplfile_handler->create() ; |
|
82 | - $tplfile->setVar('tpl_source', file_get_contents($file_path), true) ; |
|
83 | - $tplfile->setVar('tpl_refid', $mid) ; |
|
84 | - $tplfile->setVar('tpl_tplset', 'default') ; |
|
85 | - $tplfile->setVar('tpl_file', $mydirname . '_' . $file) ; |
|
86 | - $tplfile->setVar('tpl_desc', '', true) ; |
|
87 | - $tplfile->setVar('tpl_module', $mydirname) ; |
|
88 | - $tplfile->setVar('tpl_lastmodified', $mtime) ; |
|
89 | - $tplfile->setVar('tpl_lastimported', 0) ; |
|
90 | - $tplfile->setVar('tpl_type', 'module') ; |
|
91 | - if (! $tplfile_handler->insert($tplfile)) { |
|
81 | + $tplfile = & $tplfile_handler->create(); |
|
82 | + $tplfile->setVar('tpl_source', file_get_contents($file_path), true); |
|
83 | + $tplfile->setVar('tpl_refid', $mid); |
|
84 | + $tplfile->setVar('tpl_tplset', 'default'); |
|
85 | + $tplfile->setVar('tpl_file', $mydirname.'_'.$file); |
|
86 | + $tplfile->setVar('tpl_desc', '', true); |
|
87 | + $tplfile->setVar('tpl_module', $mydirname); |
|
88 | + $tplfile->setVar('tpl_lastmodified', $mtime); |
|
89 | + $tplfile->setVar('tpl_lastimported', 0); |
|
90 | + $tplfile->setVar('tpl_type', 'module'); |
|
91 | + if (!$tplfile_handler->insert($tplfile)) { |
|
92 | 92 | $ret[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> to the database.</span><br />'; |
93 | 93 | } else { |
94 | - $tplid = $tplfile->getVar('tpl_id') ; |
|
94 | + $tplid = $tplfile->getVar('tpl_id'); |
|
95 | 95 | $ret[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)<br />'; |
96 | - require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php' ; |
|
97 | - altsys_clear_templates_c() ; |
|
96 | + require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php'; |
|
97 | + altsys_clear_templates_c(); |
|
98 | 98 | // generate compiled file |
99 | 99 | /*include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; |
100 | 100 | include_once XOOPS_ROOT_PATH.'/class/template.php' ; |
@@ -106,20 +106,20 @@ discard block |
||
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
109 | - closedir($handler) ; |
|
109 | + closedir($handler); |
|
110 | 110 | } |
111 | - include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; |
|
112 | - include_once XOOPS_ROOT_PATH.'/class/template.php' ; |
|
113 | - xoops_template_clear_module_cache($mid) ; |
|
111 | + include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; |
|
112 | + include_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
113 | + xoops_template_clear_module_cache($mid); |
|
114 | 114 | |
115 | - return true ; |
|
115 | + return true; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | function altsys_message_append_oninstall(&$module_obj, &$log) |
119 | 119 | { |
120 | 120 | if (is_array(@$GLOBALS['ret'])) { |
121 | 121 | foreach ($GLOBALS['ret'] as $message) { |
122 | - $log->add(strip_tags($message)) ; |
|
122 | + $log->add(strip_tags($message)); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 |
@@ -1,35 +1,35 @@ discard block |
||
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 = __DIR__.'/sql/mysql.sql' ; |
|
29 | - $prefix_mod = $db->prefix() . '_' . $mydirname ; |
|
28 | + $sql_file_path = __DIR__.'/sql/mysql.sql'; |
|
29 | + $prefix_mod = $db->prefix().'_'.$mydirname; |
|
30 | 30 | if (file_exists($sql_file_path)) { |
31 | - $ret[] = 'SQL file found at <b>' . htmlspecialchars($sql_file_path) . '</b>.<br /> Deleting tables...<br />'; |
|
32 | - $sql_lines = file($sql_file_path) ; |
|
31 | + $ret[] = 'SQL file found at <b>'.htmlspecialchars($sql_file_path).'</b>.<br /> Deleting tables...<br />'; |
|
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 |
||
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 |
@@ -77,12 +77,12 @@ |
||
77 | 77 | $type = $tplobj->getVar('tpl_type', 'n'); |
78 | 78 | $blockpath = ($type == 'block') ? 'blocks/' : ''; |
79 | 79 | // First, check for an overloaded version within the theme folder |
80 | - $filepath = XOOPS_THEME_PATH . "/$theme/modules/$module/$blockpath$tpl_name"; |
|
80 | + $filepath = XOOPS_THEME_PATH."/$theme/modules/$module/$blockpath$tpl_name"; |
|
81 | 81 | if (!file_exists($filepath)) { |
82 | 82 | // If no custom version exists, get the tpl from its default location |
83 | - $filepath = XOOPS_ROOT_PATH . "/modules/$module/templates/$blockpath$tpl_name"; |
|
83 | + $filepath = XOOPS_ROOT_PATH."/modules/$module/templates/$blockpath$tpl_name"; |
|
84 | 84 | if (!file_exists($filepath)) { |
85 | - return $cache[$tpl_name] = $tplobj ; |
|
85 | + return $cache[$tpl_name] = $tplobj; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | return $cache[$tpl_name] = $filepath; |
@@ -1,75 +1,75 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -eval(' function xoops_module_update_'.$mydirname.'( $module ) { return altsys_onupdate_base( $module , "'.$mydirname.'" ) ; } ') ; |
|
3 | +eval(' function xoops_module_update_'.$mydirname.'( $module ) { return altsys_onupdate_base( $module , "'.$mydirname.'" ) ; } '); |
|
4 | 4 | |
5 | 5 | |
6 | -if (! function_exists('altsys_onupdate_base')) { |
|
6 | +if (!function_exists('altsys_onupdate_base')) { |
|
7 | 7 | function altsys_onupdate_base($module, $mydirname) |
8 | 8 | { |
9 | 9 | // transations on module update |
10 | 10 | |
11 | - global $msgs ; // TODO :-D |
|
11 | + global $msgs; // 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.ModuleUpdate.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_onupdate') ; |
|
17 | - $msgs = array() ; |
|
15 | + $root = & XCube_Root::getSingleton(); |
|
16 | + $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUpdate.'.ucfirst($mydirname).'.Success', 'altsys_message_append_onupdate'); |
|
17 | + $msgs = array(); |
|
18 | 18 | } else { |
19 | - if (! is_array($msgs)) { |
|
20 | - $msgs = array() ; |
|
19 | + if (!is_array($msgs)) { |
|
20 | + $msgs = 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 | |
28 | 28 | |
29 | 29 | // TABLES (write here ALTER TABLE etc. if necessary) |
30 | 30 | |
31 | 31 | // configs (Though I know it is not a recommended way...) |
32 | - $check_sql = 'SHOW COLUMNS FROM ' . $db->prefix('config') . " LIKE 'conf_title'" ; |
|
32 | + $check_sql = 'SHOW COLUMNS FROM '.$db->prefix('config')." LIKE 'conf_title'"; |
|
33 | 33 | if (($result = $db->query($check_sql)) && ($myrow = $db->fetchArray($result)) && @$myrow['Type'] == 'varchar(30)') { |
34 | - $db->queryF('ALTER TABLE ' . $db->prefix('config') . " MODIFY `conf_title` varchar(255) NOT NULL default '', MODIFY `conf_desc` varchar(255) NOT NULL default ''") ; |
|
34 | + $db->queryF('ALTER TABLE '.$db->prefix('config')." MODIFY `conf_title` varchar(255) NOT NULL default '', MODIFY `conf_desc` varchar(255) NOT NULL default ''"); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | // 0.4 -> 0.5 |
38 | - $check_sql = 'SELECT COUNT(*) FROM ' . $db->prefix($mydirname . '_language_constants') ; |
|
39 | - if (! $db->query($check_sql)) { |
|
40 | - $db->queryF('CREATE TABLE ' . $db->prefix($mydirname . '_language_constants') . " (mid smallint(5) unsigned NOT NULL default 0,language varchar(32) NOT NULL default '',name varchar(255) NOT NULL default '',value text,PRIMARY KEY (mid,language,name)) ENGINE=MyISAM") ; |
|
38 | + $check_sql = 'SELECT COUNT(*) FROM '.$db->prefix($mydirname.'_language_constants'); |
|
39 | + if (!$db->query($check_sql)) { |
|
40 | + $db->queryF('CREATE TABLE '.$db->prefix($mydirname.'_language_constants')." (mid smallint(5) unsigned NOT NULL default 0,language varchar(32) NOT NULL default '',name varchar(255) NOT NULL default '',value text,PRIMARY KEY (mid,language,name)) ENGINE=MyISAM"); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | // TEMPLATES (all templates have been already removed by modulesadmin) |
45 | - $tplfile_handler = xoops_gethandler('tplfile') ; |
|
46 | - $tpl_path = __DIR__.'/templates' ; |
|
47 | - if ($handler = @opendir($tpl_path . '/')) { |
|
45 | + $tplfile_handler = xoops_gethandler('tplfile'); |
|
46 | + $tpl_path = __DIR__.'/templates'; |
|
47 | + if ($handler = @opendir($tpl_path.'/')) { |
|
48 | 48 | while (($file = readdir($handler)) !== false) { |
49 | 49 | if (substr($file, 0, 1) == '.') { |
50 | - continue ; |
|
50 | + continue; |
|
51 | 51 | } |
52 | - $file_path = $tpl_path . '/' . $file ; |
|
52 | + $file_path = $tpl_path.'/'.$file; |
|
53 | 53 | if (is_file($file_path)) { |
54 | 54 | $mtime = (int)(@filemtime($file_path)); |
55 | - $tplfile =& $tplfile_handler->create() ; |
|
56 | - $tplfile->setVar('tpl_source', file_get_contents($file_path), true) ; |
|
57 | - $tplfile->setVar('tpl_refid', $mid) ; |
|
58 | - $tplfile->setVar('tpl_tplset', 'default') ; |
|
59 | - $tplfile->setVar('tpl_file', $mydirname . '_' . $file) ; |
|
60 | - $tplfile->setVar('tpl_desc', '', true) ; |
|
61 | - $tplfile->setVar('tpl_module', $mydirname) ; |
|
62 | - $tplfile->setVar('tpl_lastmodified', $mtime) ; |
|
63 | - $tplfile->setVar('tpl_lastimported', 0) ; |
|
64 | - $tplfile->setVar('tpl_type', 'module') ; |
|
65 | - if (! $tplfile_handler->insert($tplfile)) { |
|
55 | + $tplfile = & $tplfile_handler->create(); |
|
56 | + $tplfile->setVar('tpl_source', file_get_contents($file_path), true); |
|
57 | + $tplfile->setVar('tpl_refid', $mid); |
|
58 | + $tplfile->setVar('tpl_tplset', 'default'); |
|
59 | + $tplfile->setVar('tpl_file', $mydirname.'_'.$file); |
|
60 | + $tplfile->setVar('tpl_desc', '', true); |
|
61 | + $tplfile->setVar('tpl_module', $mydirname); |
|
62 | + $tplfile->setVar('tpl_lastmodified', $mtime); |
|
63 | + $tplfile->setVar('tpl_lastimported', 0); |
|
64 | + $tplfile->setVar('tpl_type', 'module'); |
|
65 | + if (!$tplfile_handler->insert($tplfile)) { |
|
66 | 66 | $msgs[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> to the database.</span>'; |
67 | 67 | } else { |
68 | - $tplid = $tplfile->getVar('tpl_id') ; |
|
68 | + $tplid = $tplfile->getVar('tpl_id'); |
|
69 | 69 | $msgs[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)'; |
70 | 70 | // generate compiled file |
71 | - require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php' ; |
|
72 | - altsys_clear_templates_c() ; |
|
71 | + require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php'; |
|
72 | + altsys_clear_templates_c(); |
|
73 | 73 | /*include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; |
74 | 74 | if( ! xoops_template_touch( $tplid ) ) { |
75 | 75 | $msgs[] = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b>.</span>'; |
@@ -79,20 +79,20 @@ discard block |
||
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
82 | - closedir($handler) ; |
|
82 | + closedir($handler); |
|
83 | 83 | } |
84 | - include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; |
|
85 | - include_once XOOPS_ROOT_PATH.'/class/template.php' ; |
|
86 | - xoops_template_clear_module_cache($mid) ; |
|
84 | + include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; |
|
85 | + include_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
86 | + xoops_template_clear_module_cache($mid); |
|
87 | 87 | |
88 | - return true ; |
|
88 | + return true; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | function altsys_message_append_onupdate(&$module_obj, &$log) |
92 | 92 | { |
93 | 93 | if (is_array(@$GLOBALS['msgs'])) { |
94 | 94 | foreach ($GLOBALS['msgs'] as $message) { |
95 | - $log->add(strip_tags($message)) ; |
|
95 | + $log->add(strip_tags($message)); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 |