@@ -2,30 +2,30 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | /********* mymenu only for ALTSYS ********/ |
| 4 | 4 | |
| 5 | -if (! defined('XOOPS_ROOT_PATH')) { |
|
| 6 | - exit ; |
|
| 5 | +if (!defined('XOOPS_ROOT_PATH')) { |
|
| 6 | + exit; |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | // Skip for ORETEKI XOOPS |
| 10 | 10 | if (defined('XOOPS_ORETEKI')) { |
| 11 | - return ; |
|
| 11 | + return; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if (! isset($module) || ! is_object($module)) { |
|
| 15 | - $module = $xoopsModule ; |
|
| 16 | -} elseif (! is_object($xoopsModule)) { |
|
| 17 | - die('$xoopsModule is not set') ; |
|
| 14 | +if (!isset($module) || !is_object($module)) { |
|
| 15 | + $module = $xoopsModule; |
|
| 16 | +} elseif (!is_object($xoopsModule)) { |
|
| 17 | + die('$xoopsModule is not set'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // language files (modinfo.php) |
| 21 | -altsys_include_language_file('modinfo') ; |
|
| 21 | +altsys_include_language_file('modinfo'); |
|
| 22 | 22 | |
| 23 | -include __DIR__.'/admin_menu.php' ; |
|
| 23 | +include __DIR__.'/admin_menu.php'; |
|
| 24 | 24 | |
| 25 | -$adminmenu = array_merge($adminmenu, $adminmenu4altsys) ; |
|
| 25 | +$adminmenu = array_merge($adminmenu, $adminmenu4altsys); |
|
| 26 | 26 | |
| 27 | -$mymenu_uri = empty($mymenu_fake_uri) ? $_SERVER['REQUEST_URI'] : $mymenu_fake_uri ; |
|
| 28 | -$mymenu_link = substr(strstr($mymenu_uri, '/admin/'), 1) ; |
|
| 27 | +$mymenu_uri = empty($mymenu_fake_uri) ? $_SERVER['REQUEST_URI'] : $mymenu_fake_uri; |
|
| 28 | +$mymenu_link = substr(strstr($mymenu_uri, '/admin/'), 1); |
|
| 29 | 29 | |
| 30 | 30 | // xoops_breadcrumbs |
| 31 | 31 | // $GLOBALS['altsysXoopsBreadcrumbs'] = array( array( 'url' => XOOPS_URL.'/modules/altsys/admin/index.php' , 'name' => $xoopsModule->getVar('name') ) ) ; |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | // highlight |
| 34 | 34 | foreach (array_keys($adminmenu) as $i) { |
| 35 | 35 | if ($mymenu_link == $adminmenu[$i]['link']) { |
| 36 | - $adminmenu[$i]['selected'] = true ; |
|
| 37 | - $adminmenu_hilighted = true ; |
|
| 36 | + $adminmenu[$i]['selected'] = true; |
|
| 37 | + $adminmenu_hilighted = true; |
|
| 38 | 38 | // $GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'url' => XOOPS_URL."/modules/altsys/".htmlspecialchars($adminmenu[$i]['link'],ENT_QUOTES) , 'name' => htmlspecialchars( $adminmenu[$i]['title'] , ENT_QUOTES ) ) ; |
| 39 | 39 | } else { |
| 40 | - $adminmenu[$i]['selected'] = false ; |
|
| 40 | + $adminmenu[$i]['selected'] = false; |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | if (empty($adminmenu_hilighted)) { |
| 44 | 44 | foreach (array_keys($adminmenu) as $i) { |
| 45 | 45 | if (stristr($mymenu_uri, $adminmenu[$i]['link'])) { |
| 46 | - $adminmenu[$i]['selected'] = true ; |
|
| 46 | + $adminmenu[$i]['selected'] = true; |
|
| 47 | 47 | // $GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'url' => XOOPS_URL."/modules/altsys/".htmlspecialchars($adminmenu[$i]['link'],ENT_QUOTES) , 'name' => htmlspecialchars( $adminmenu[$i]['title'] , ENT_QUOTES ) ) ; |
| 48 | - break ; |
|
| 48 | + break; |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -53,20 +53,20 @@ discard block |
||
| 53 | 53 | // link conversion from relative to absolute |
| 54 | 54 | foreach (array_keys($adminmenu) as $i) { |
| 55 | 55 | if (stristr($adminmenu[$i]['link'], XOOPS_URL) === false) { |
| 56 | - $adminmenu[$i]['link'] = XOOPS_URL."/modules/$mydirname/" . $adminmenu[$i]['link'] ; |
|
| 56 | + $adminmenu[$i]['link'] = XOOPS_URL."/modules/$mydirname/".$adminmenu[$i]['link']; |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // display |
| 61 | -require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; |
|
| 62 | -$tpl = new D3Tpl() ; |
|
| 61 | +require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php'; |
|
| 62 | +$tpl = new D3Tpl(); |
|
| 63 | 63 | $tpl->assign(array( |
| 64 | 64 | 'adminmenu' => $adminmenu |
| 65 | -)) ; |
|
| 66 | -$tpl->display('db:altsys_inc_mymenu.html') ; |
|
| 65 | +)); |
|
| 66 | +$tpl->display('db:altsys_inc_mymenu.html'); |
|
| 67 | 67 | |
| 68 | 68 | // submenu |
| 69 | -$page = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['page']) ; |
|
| 69 | +$page = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['page']); |
|
| 70 | 70 | if (file_exists(__DIR__.'/mymenusub/'.$page.'.php')) { |
| 71 | - include __DIR__.'/mymenusub/'.$page.'.php' ; |
|
| 71 | + include __DIR__.'/mymenusub/'.$page.'.php'; |
|
| 72 | 72 | } |
@@ -302,7 +302,7 @@ |
||
| 302 | 302 | 'use_my_language' => strlen($langman->my_language) > 0, |
| 303 | 303 | 'mylang_file_name' => htmlspecialchars($mylang_unique_path, ENT_QUOTES), |
| 304 | 304 | 'cache_file_name' => htmlspecialchars($cache_file_name, ENT_QUOTES), |
| 305 | - 'cache_file_mtime' => (int)$cache_file_mtime, |
|
| 305 | + 'cache_file_mtime' => (int)$cache_file_mtime, |
|
| 306 | 306 | 'timezone_offset' => xoops_getUserTimestamp(0), |
| 307 | 307 | 'notice' => $notice4disp, |
| 308 | 308 | 'already_read' => $already_read, |
@@ -5,170 +5,170 @@ 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/lang_functions.php' ; |
|
| 12 | -include_once __DIR__.'/class/D3LanguageManager.class.php' ; |
|
| 8 | +require_once __DIR__.'/class/AltsysBreadcrumbs.class.php'; |
|
| 9 | +include_once __DIR__.'/include/gtickets.php'; |
|
| 10 | +include_once __DIR__.'/include/altsys_functions.php'; |
|
| 11 | +include_once __DIR__.'/include/lang_functions.php'; |
|
| 12 | +include_once __DIR__.'/class/D3LanguageManager.class.php'; |
|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | // only groups have 'module_admin' of 'altsys' can do that. |
| 16 | -$module_handler = xoops_getHandler('module') ; |
|
| 17 | -$module = $module_handler->getByDirname('altsys') ; |
|
| 18 | -if (! is_object($module)) { |
|
| 19 | - die('install altsys') ; |
|
| 16 | +$module_handler = xoops_getHandler('module'); |
|
| 17 | +$module = $module_handler->getByDirname('altsys'); |
|
| 18 | +if (!is_object($module)) { |
|
| 19 | + die('install altsys'); |
|
| 20 | 20 | } |
| 21 | -$moduleperm_handler = xoops_getHandler('groupperm') ; |
|
| 22 | -if (! is_object(@$xoopsUser) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { |
|
| 23 | - die('only admin of altsys can access this area') ; |
|
| 21 | +$moduleperm_handler = xoops_getHandler('groupperm'); |
|
| 22 | +if (!is_object(@$xoopsUser) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { |
|
| 23 | + die('only admin of altsys can access this area'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | // initials |
| 28 | 28 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
| 29 | -(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance() ; |
|
| 30 | -$langman = D3LanguageManager::getInstance() ; |
|
| 29 | +(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
| 30 | +$langman = D3LanguageManager::getInstance(); |
|
| 31 | 31 | |
| 32 | 32 | // language file of this controller |
| 33 | -altsys_include_language_file('mylangadmin') ; |
|
| 33 | +altsys_include_language_file('mylangadmin'); |
|
| 34 | 34 | |
| 35 | 35 | // check $xoopsModule |
| 36 | -if (! is_object($xoopsModule)) { |
|
| 37 | - redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM) ; |
|
| 36 | +if (!is_object($xoopsModule)) { |
|
| 37 | + redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // set target_module if specified by $_GET['dirname'] |
| 41 | 41 | $module_handler = xoops_getHandler('module'); |
| 42 | -if (! empty($_GET['dirname'])) { |
|
| 43 | - $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']) ; |
|
| 44 | - $target_module = $module_handler->getByDirname($dirname) ; |
|
| 42 | +if (!empty($_GET['dirname'])) { |
|
| 43 | + $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']); |
|
| 44 | + $target_module = $module_handler->getByDirname($dirname); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if (! empty($target_module) && is_object($target_module)) { |
|
| 47 | +if (!empty($target_module) && is_object($target_module)) { |
|
| 48 | 48 | // specified by dirname (for langadmin as an independent module) |
| 49 | - $target_mid = $target_module->getVar('mid') ; |
|
| 50 | - $target_dirname = $target_module->getVar('dirname') ; |
|
| 51 | - $target_dirname4sql = addslashes($target_dirname) ; |
|
| 52 | - $target_mname = $target_module->getVar('name') . ' ' . 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').' '.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 |
||
| 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 |
||
| 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 |
||
| 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&lib=altsys&page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN) ; |
|
| 287 | - $breadcrumbsObj->appendPath('', $target_mname) ; |
|
| 286 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&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 |
||
| 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; |
|
@@ -3,9 +3,9 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | // Keep Block option values when update (by nobunobu) for XOOPS 2.0.x |
| 5 | 5 | global $xoopsDB; |
| 6 | -$query = 'SELECT mid FROM ' . $xoopsDB->prefix('modules') . " WHERE dirname='" . $modversion['dirname'] . "' "; |
|
| 6 | +$query = 'SELECT mid FROM '.$xoopsDB->prefix('modules')." WHERE dirname='".$modversion['dirname']."' "; |
|
| 7 | 7 | $result = $xoopsDB->query($query); |
| 8 | -$record= $xoopsDB->fetcharray($result); |
|
| 8 | +$record = $xoopsDB->fetcharray($result); |
|
| 9 | 9 | if ($record) { |
| 10 | 10 | $mid = $record['mid']; |
| 11 | 11 | $count = count($modversion['blocks']); |
@@ -53,40 +53,40 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | } */ |
| 55 | 55 | |
| 56 | - $sql = 'SELECT * FROM ' . $xoopsDB->prefix('newblocks') . ' WHERE mid=' . $mid . " AND block_type <>'D' AND func_num > $count"; |
|
| 56 | + $sql = 'SELECT * FROM '.$xoopsDB->prefix('newblocks').' WHERE mid='.$mid." AND block_type <>'D' AND func_num > $count"; |
|
| 57 | 57 | $fresult = $xoopsDB->query($sql); |
| 58 | 58 | while ($fblock = $xoopsDB->fetchArray($fresult)) { |
| 59 | - $local_msgs[] = 'Non Defined Block <b>' . $fblock['name'] . '</b> will be deleted'; |
|
| 60 | - $sql = 'DELETE FROM ' . $xoopsDB->prefix('newblocks') . " WHERE bid='" . $fblock['bid'] . "'"; |
|
| 59 | + $local_msgs[] = 'Non Defined Block <b>'.$fblock['name'].'</b> will be deleted'; |
|
| 60 | + $sql = 'DELETE FROM '.$xoopsDB->prefix('newblocks')." WHERE bid='".$fblock['bid']."'"; |
|
| 61 | 61 | $iret = $xoopsDB->query($sql); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - for ($i = 1 ; $i <= $count ; $i++) { |
|
| 65 | - $sql = 'SELECT name,options FROM ' . $xoopsDB->prefix('newblocks') . ' WHERE mid=' . $mid . ' AND func_num=' . $i . " AND show_func='" . addslashes($modversion['blocks'][$i]['show_func']) . "' AND func_file='" . addslashes($modversion['blocks'][$i]['file']) . "'"; |
|
| 64 | + for ($i = 1; $i <= $count; $i++) { |
|
| 65 | + $sql = 'SELECT name,options FROM '.$xoopsDB->prefix('newblocks').' WHERE mid='.$mid.' AND func_num='.$i." AND show_func='".addslashes($modversion['blocks'][$i]['show_func'])."' AND func_file='".addslashes($modversion['blocks'][$i]['file'])."'"; |
|
| 66 | 66 | $fresult = $xoopsDB->query($sql); |
| 67 | 67 | $fblock = $xoopsDB->fetchArray($fresult); |
| 68 | 68 | if (isset($fblock['options'])) { |
| 69 | - $old_vals=explode('|', $fblock['options']); |
|
| 70 | - $def_vals=explode('|', $modversion['blocks'][$i]['options']); |
|
| 69 | + $old_vals = explode('|', $fblock['options']); |
|
| 70 | + $def_vals = explode('|', $modversion['blocks'][$i]['options']); |
|
| 71 | 71 | if (count($old_vals) == count($def_vals)) { |
| 72 | 72 | $modversion['blocks'][$i]['options'] = $fblock['options']; |
| 73 | - $local_msgs[] = "Option's values of the block <b>".$fblock['name'] . '</b> will be kept. (value = <b>' . $fblock['options'] . '</b>)'; |
|
| 73 | + $local_msgs[] = "Option's values of the block <b>".$fblock['name'].'</b> will be kept. (value = <b>'.$fblock['options'].'</b>)'; |
|
| 74 | 74 | } elseif (count($old_vals) < count($def_vals)) { |
| 75 | - for ($j=0; $j < count($old_vals); $j++) { |
|
| 75 | + for ($j = 0; $j < count($old_vals); $j++) { |
|
| 76 | 76 | $def_vals[$j] = $old_vals[$j]; |
| 77 | 77 | } |
| 78 | 78 | $modversion['blocks'][$i]['options'] = implode('|', $def_vals); |
| 79 | - $local_msgs[] = "Option's values of the block <b>".$fblock['name'] . '</b> will be kept and new option(s) are added. (value = <b>' . $modversion['blocks'][$i]['options'] . '</b>)'; |
|
| 79 | + $local_msgs[] = "Option's values of the block <b>".$fblock['name'].'</b> will be kept and new option(s) are added. (value = <b>'.$modversion['blocks'][$i]['options'].'</b>)'; |
|
| 80 | 80 | } else { |
| 81 | - $local_msgs[] = "Option's values of the block <b>".$fblock['name'] . '</b> will be reset to the default, because of some decrease of options. (value = <b>' |
|
| 82 | - . $modversion['blocks'][$i]['options'] . '</b>)'; |
|
| 81 | + $local_msgs[] = "Option's values of the block <b>".$fblock['name'].'</b> will be reset to the default, because of some decrease of options. (value = <b>' |
|
| 82 | + . $modversion['blocks'][$i]['options'].'</b>)'; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | -global $msgs , $myblocksadmin_parsed_updateblock ; |
|
| 89 | -if (! empty($msgs) && ! empty($local_msgs) && empty($myblocksadmin_parsed_updateblock)) { |
|
| 90 | - $msgs = array_merge($msgs, $local_msgs) ; |
|
| 91 | - $myblocksadmin_parsed_updateblock = true ; |
|
| 88 | +global $msgs, $myblocksadmin_parsed_updateblock; |
|
| 89 | +if (!empty($msgs) && !empty($local_msgs) && empty($myblocksadmin_parsed_updateblock)) { |
|
| 90 | + $msgs = array_merge($msgs, $local_msgs); |
|
| 91 | + $myblocksadmin_parsed_updateblock = true; |
|
| 92 | 92 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | |
| 61 | 61 | // get tplfile and tplsource |
| 62 | 62 | $result = $db->query("SELECT tpl_refid,tpl_module,'".addslashes($tplset_to)."',tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type,tpl_source FROM ".$db->prefix('tplfile') . ' NATURAL LEFT JOIN ' |
| 63 | - . $db->prefix('tplsource') . " WHERE tpl_tplset='" . addslashes($tplset_from) . "' AND ($whr_append)") ; |
|
| 63 | + . $db->prefix('tplsource') . " WHERE tpl_tplset='" . addslashes($tplset_from) . "' AND ($whr_append)") ; |
|
| 64 | 64 | |
| 65 | 65 | while ($row = $db->fetchArray($result)) { |
| 66 | 66 | $tpl_source = array_pop($row) ; |
@@ -1,41 +1,41 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | include_once XOOPS_ROOT_PATH.'/class/template.php'; |
| 4 | -include_once __DIR__.'/altsys_functions.php' ; |
|
| 4 | +include_once __DIR__.'/altsys_functions.php'; |
|
| 5 | 5 | |
| 6 | 6 | function tplsadmin_import_data($tplset, $tpl_file, $tpl_source, $lastmodified = 0) |
| 7 | 7 | { |
| 8 | - $db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
| 8 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 9 | 9 | |
| 10 | 10 | // check the file is valid template |
| 11 | - list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes($tpl_file) . "'")) ; |
|
| 12 | - if (! $count) { |
|
| 13 | - return false ; |
|
| 11 | + list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='default' AND tpl_file='".addslashes($tpl_file)."'")); |
|
| 12 | + if (!$count) { |
|
| 13 | + return false; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // check the template exists in the tplset |
| 17 | 17 | if ($tplset != 'default') { |
| 18 | - list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset) . "' AND tpl_file='" . addslashes($tpl_file) . "'")) ; |
|
| 18 | + list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset)."' AND tpl_file='".addslashes($tpl_file)."'")); |
|
| 19 | 19 | if ($count <= 0) { |
| 20 | 20 | // copy from 'default' to the tplset |
| 21 | - $result = $db->query('SELECT * FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes($tpl_file) . "'") ; |
|
| 21 | + $result = $db->query('SELECT * FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='default' AND tpl_file='".addslashes($tpl_file)."'"); |
|
| 22 | 22 | while ($row = $db->fetchArray($result)) { |
| 23 | - $db->queryF('INSERT INTO ' . $db->prefix('tplfile') . " SET tpl_refid='" . addslashes($row['tpl_refid']) . "',tpl_module='" . addslashes($row['tpl_module']) . "',tpl_tplset='" . addslashes($tplset) . "',tpl_file='" . addslashes($tpl_file) . "',tpl_desc='" . addslashes($row['tpl_desc']) . "',tpl_type='" . addslashes($row['tpl_type']) . "'") ; |
|
| 24 | - $tpl_id = $db->getInsertId() ; |
|
| 25 | - $db->queryF('INSERT INTO ' . $db->prefix('tplsource') . " SET tpl_id='$tpl_id', tpl_source=''") ; |
|
| 23 | + $db->queryF('INSERT INTO '.$db->prefix('tplfile')." SET tpl_refid='".addslashes($row['tpl_refid'])."',tpl_module='".addslashes($row['tpl_module'])."',tpl_tplset='".addslashes($tplset)."',tpl_file='".addslashes($tpl_file)."',tpl_desc='".addslashes($row['tpl_desc'])."',tpl_type='".addslashes($row['tpl_type'])."'"); |
|
| 24 | + $tpl_id = $db->getInsertId(); |
|
| 25 | + $db->queryF('INSERT INTO '.$db->prefix('tplsource')." SET tpl_id='$tpl_id', tpl_source=''"); |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // UPDATE just tpl_lastmodified and tpl_source |
| 31 | - $drs = $db->query('SELECT tpl_id FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset) . "' AND tpl_file='" . addslashes($tpl_file) . "'") ; |
|
| 31 | + $drs = $db->query('SELECT tpl_id FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset)."' AND tpl_file='".addslashes($tpl_file)."'"); |
|
| 32 | 32 | while (list($tpl_id) = $db->fetchRow($drs)) { |
| 33 | - $db->queryF('UPDATE ' . $db->prefix('tplfile') . " SET tpl_lastmodified='" . addslashes($lastmodified) . "',tpl_lastimported=UNIX_TIMESTAMP() WHERE tpl_id='$tpl_id'") ; |
|
| 34 | - $db->queryF('UPDATE ' . $db->prefix('tplsource') . " SET tpl_source='" . addslashes($tpl_source) . "' WHERE tpl_id='$tpl_id'") ; |
|
| 35 | - altsys_template_touch($tpl_id) ; |
|
| 33 | + $db->queryF('UPDATE '.$db->prefix('tplfile')." SET tpl_lastmodified='".addslashes($lastmodified)."',tpl_lastimported=UNIX_TIMESTAMP() WHERE tpl_id='$tpl_id'"); |
|
| 34 | + $db->queryF('UPDATE '.$db->prefix('tplsource')." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'"); |
|
| 35 | + altsys_template_touch($tpl_id); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - return true ; |
|
| 38 | + return true; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -43,46 +43,46 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | function tplsadmin_get_fingerprint($lines) |
| 45 | 45 | { |
| 46 | - $str = '' ; |
|
| 46 | + $str = ''; |
|
| 47 | 47 | foreach ($lines as $line) { |
| 48 | 48 | if (trim($line)) { |
| 49 | - $str .= md5(trim($line)) ; |
|
| 49 | + $str .= md5(trim($line)); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | - return md5($str) ; |
|
| 52 | + return md5($str); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | function tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, $whr_append = '1') |
| 58 | 58 | { |
| 59 | - global $db ; |
|
| 59 | + global $db; |
|
| 60 | 60 | |
| 61 | 61 | // get tplfile and tplsource |
| 62 | - $result = $db->query("SELECT tpl_refid,tpl_module,'".addslashes($tplset_to)."',tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type,tpl_source FROM ".$db->prefix('tplfile') . ' NATURAL LEFT JOIN ' |
|
| 63 | - . $db->prefix('tplsource') . " WHERE tpl_tplset='" . addslashes($tplset_from) . "' AND ($whr_append)") ; |
|
| 62 | + $result = $db->query("SELECT tpl_refid,tpl_module,'".addslashes($tplset_to)."',tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type,tpl_source FROM ".$db->prefix('tplfile').' NATURAL LEFT JOIN ' |
|
| 63 | + . $db->prefix('tplsource')." WHERE tpl_tplset='".addslashes($tplset_from)."' AND ($whr_append)"); |
|
| 64 | 64 | |
| 65 | 65 | while ($row = $db->fetchArray($result)) { |
| 66 | - $tpl_source = array_pop($row) ; |
|
| 66 | + $tpl_source = array_pop($row); |
|
| 67 | 67 | |
| 68 | - $drs = $db->query('SELECT tpl_id FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset_to) . "' AND ($whr_append) AND tpl_file='" . addslashes($row['tpl_file']) . "' AND tpl_refid='" . addslashes($row['tpl_refid']) . "'") ; |
|
| 68 | + $drs = $db->query('SELECT tpl_id FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset_to)."' AND ($whr_append) AND tpl_file='".addslashes($row['tpl_file'])."' AND tpl_refid='".addslashes($row['tpl_refid'])."'"); |
|
| 69 | 69 | |
| 70 | - if (! $db->getRowsNum($drs)) { |
|
| 70 | + if (!$db->getRowsNum($drs)) { |
|
| 71 | 71 | // INSERT mode |
| 72 | - $sql = 'INSERT INTO ' . $db->prefix('tplfile') . ' (tpl_refid,tpl_module,tpl_tplset,tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type) VALUES ('; |
|
| 72 | + $sql = 'INSERT INTO '.$db->prefix('tplfile').' (tpl_refid,tpl_module,tpl_tplset,tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type) VALUES ('; |
|
| 73 | 73 | foreach ($row as $colval) { |
| 74 | - $sql .= "'".addslashes($colval)."'," ; |
|
| 74 | + $sql .= "'".addslashes($colval)."',"; |
|
| 75 | 75 | } |
| 76 | - $db->query(substr($sql, 0, -1) . ')') ; |
|
| 77 | - $tpl_id = $db->getInsertId() ; |
|
| 78 | - $db->query('INSERT INTO ' . $db->prefix('tplsource') . " SET tpl_id='$tpl_id', tpl_source='" . addslashes($tpl_source) . "'") ; |
|
| 79 | - altsys_template_touch($tpl_id) ; |
|
| 76 | + $db->query(substr($sql, 0, -1).')'); |
|
| 77 | + $tpl_id = $db->getInsertId(); |
|
| 78 | + $db->query('INSERT INTO '.$db->prefix('tplsource')." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'"); |
|
| 79 | + altsys_template_touch($tpl_id); |
|
| 80 | 80 | } else { |
| 81 | 81 | while (list($tpl_id) = $db->fetchRow($drs)) { |
| 82 | 82 | // UPDATE mode |
| 83 | - $db->query('UPDATE ' . $db->prefix('tplfile') . " SET tpl_refid='" . addslashes($row['tpl_refid']) . "',tpl_desc='" . addslashes($row['tpl_desc']) . "',tpl_lastmodified='" . addslashes($row['tpl_lastmodified']) . "',tpl_lastimported='" . addslashes($row['tpl_lastimported']) . "',tpl_type='" . addslashes($row['tpl_type']) . "' WHERE tpl_id='$tpl_id'") ; |
|
| 84 | - $db->query('UPDATE ' . $db->prefix('tplsource') . " SET tpl_source='" . addslashes($tpl_source) . "' WHERE tpl_id='$tpl_id'") ; |
|
| 85 | - altsys_template_touch($tpl_id) ; |
|
| 83 | + $db->query('UPDATE '.$db->prefix('tplfile')." SET tpl_refid='".addslashes($row['tpl_refid'])."',tpl_desc='".addslashes($row['tpl_desc'])."',tpl_lastmodified='".addslashes($row['tpl_lastmodified'])."',tpl_lastimported='".addslashes($row['tpl_lastimported'])."',tpl_type='".addslashes($row['tpl_type'])."' WHERE tpl_id='$tpl_id'"); |
|
| 84 | + $db->query('UPDATE '.$db->prefix('tplsource')." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'"); |
|
| 85 | + altsys_template_touch($tpl_id); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -92,31 +92,31 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | function tplsadmin_copy_templates_f2db($tplset_to, $whr_append = '1') |
| 94 | 94 | { |
| 95 | - global $db ; |
|
| 95 | + global $db; |
|
| 96 | 96 | |
| 97 | 97 | // get tplsource |
| 98 | - $result = $db->query('SELECT * FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='default' AND ($whr_append)") ; |
|
| 98 | + $result = $db->query('SELECT * FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='default' AND ($whr_append)"); |
|
| 99 | 99 | |
| 100 | 100 | while ($row = $db->fetchArray($result)) { |
| 101 | - $basefilepath = tplsadmin_get_basefilepath($row['tpl_module'], $row['tpl_type'], $row['tpl_file']) ; |
|
| 102 | - $tpl_source = rtrim(implode('', file($basefilepath))) ; |
|
| 103 | - $lastmodified = filemtime($basefilepath) ; |
|
| 101 | + $basefilepath = tplsadmin_get_basefilepath($row['tpl_module'], $row['tpl_type'], $row['tpl_file']); |
|
| 102 | + $tpl_source = rtrim(implode('', file($basefilepath))); |
|
| 103 | + $lastmodified = filemtime($basefilepath); |
|
| 104 | 104 | |
| 105 | - $drs = $db->query('SELECT tpl_id FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset_to) . "' AND ($whr_append) AND tpl_file='" . addslashes($row['tpl_file']) . "' AND tpl_refid='" . addslashes($row['tpl_refid']) . "'") ; |
|
| 105 | + $drs = $db->query('SELECT tpl_id FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset_to)."' AND ($whr_append) AND tpl_file='".addslashes($row['tpl_file'])."' AND tpl_refid='".addslashes($row['tpl_refid'])."'"); |
|
| 106 | 106 | |
| 107 | - if (! $db->getRowsNum($drs)) { |
|
| 107 | + if (!$db->getRowsNum($drs)) { |
|
| 108 | 108 | // INSERT mode |
| 109 | - $sql = 'INSERT INTO ' . $db->prefix('tplfile') . " SET tpl_refid='" . addslashes($row['tpl_refid']) . "',tpl_desc='" . addslashes($row['tpl_desc']) . "',tpl_lastmodified='" . addslashes($lastmodified) . "',tpl_type='" . addslashes($row['tpl_type']) . "',tpl_tplset='" . addslashes($tplset_to) . "',tpl_file='" . addslashes($row['tpl_file']) . "',tpl_module='" . addslashes($row['tpl_module']) . "'" ; |
|
| 110 | - $db->query($sql) ; |
|
| 111 | - $tpl_id = $db->getInsertId() ; |
|
| 112 | - $db->query('INSERT INTO ' . $db->prefix('tplsource') . " SET tpl_id='$tpl_id', tpl_source='" . addslashes($tpl_source) . "'") ; |
|
| 113 | - altsys_template_touch($tpl_id) ; |
|
| 109 | + $sql = 'INSERT INTO '.$db->prefix('tplfile')." SET tpl_refid='".addslashes($row['tpl_refid'])."',tpl_desc='".addslashes($row['tpl_desc'])."',tpl_lastmodified='".addslashes($lastmodified)."',tpl_type='".addslashes($row['tpl_type'])."',tpl_tplset='".addslashes($tplset_to)."',tpl_file='".addslashes($row['tpl_file'])."',tpl_module='".addslashes($row['tpl_module'])."'"; |
|
| 110 | + $db->query($sql); |
|
| 111 | + $tpl_id = $db->getInsertId(); |
|
| 112 | + $db->query('INSERT INTO '.$db->prefix('tplsource')." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'"); |
|
| 113 | + altsys_template_touch($tpl_id); |
|
| 114 | 114 | } else { |
| 115 | 115 | while (list($tpl_id) = $db->fetchRow($drs)) { |
| 116 | 116 | // UPDATE mode |
| 117 | - $db->query('UPDATE ' . $db->prefix('tplfile') . " SET tpl_lastmodified='" . addslashes($lastmodified) . "' WHERE tpl_id='$tpl_id'") ; |
|
| 118 | - $db->query('UPDATE ' . $db->prefix('tplsource') . " SET tpl_source='" . addslashes($tpl_source) . "' WHERE tpl_id='$tpl_id'") ; |
|
| 119 | - altsys_template_touch($tpl_id) ; |
|
| 117 | + $db->query('UPDATE '.$db->prefix('tplfile')." SET tpl_lastmodified='".addslashes($lastmodified)."' WHERE tpl_id='$tpl_id'"); |
|
| 118 | + $db->query('UPDATE '.$db->prefix('tplsource')." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'"); |
|
| 119 | + altsys_template_touch($tpl_id); |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | function tplsadmin_get_basefilepath($dirname, $type, $tpl_file) |
| 128 | 128 | { |
| 129 | 129 | // module instance |
| 130 | - $path = $basefilepath = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates/'.($type=='block'?'blocks/':'').$tpl_file ; |
|
| 130 | + $path = $basefilepath = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates/'.($type == 'block' ? 'blocks/' : '').$tpl_file; |
|
| 131 | 131 | |
| 132 | 132 | if (is_callable('Legacy_Utils::getTrustDirnameByDirname')) { |
| 133 | 133 | $mytrustdirname = Legacy_Utils::getTrustDirnameByDirname($dirname); |
@@ -137,33 +137,33 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | if (defined('ALTSYS_TPLSADMIN_BASEPATH')) { |
| 139 | 139 | // Special hook |
| 140 | - $path = ALTSYS_TPLSADMIN_BASEPATH.'/'.substr($tpl_file, strlen($dirname) + 1) ; |
|
| 141 | - } elseif ($mytrustdirname || @include XOOPS_ROOT_PATH . '/modules/' . $dirname . '/mytrustdirname.php') { |
|
| 140 | + $path = ALTSYS_TPLSADMIN_BASEPATH.'/'.substr($tpl_file, strlen($dirname) + 1); |
|
| 141 | + } elseif ($mytrustdirname || @include XOOPS_ROOT_PATH.'/modules/'.$dirname.'/mytrustdirname.php') { |
|
| 142 | 142 | // D3 module base |
| 143 | - if (! empty($mytrustdirname)) { |
|
| 144 | - $mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/' ; |
|
| 143 | + if (!empty($mytrustdirname)) { |
|
| 144 | + $mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/'; |
|
| 145 | 145 | |
| 146 | - $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').substr($tpl_file, strlen($dirname) + 1) ; |
|
| 146 | + $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type == 'block' ? 'blocks/' : '').substr($tpl_file, strlen($dirname) + 1); |
|
| 147 | 147 | //new for xcck etc.other trust_module |
| 148 | - if (! file_exists($path)) { |
|
| 149 | - $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').$tpl_file ; |
|
| 150 | - if (! file_exists($path)) { |
|
| 148 | + if (!file_exists($path)) { |
|
| 149 | + $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type == 'block' ? 'blocks/' : '').$tpl_file; |
|
| 150 | + if (!file_exists($path)) { |
|
| 151 | 151 | $path = $basefilepath; |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - return $path ; |
|
| 157 | + return $path; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
| 161 | 161 | function tplsadmin_die($msg, $target_dirname = '', $wait = 2) |
| 162 | 162 | { |
| 163 | 163 | if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') { |
| 164 | - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, $wait, $msg) ; |
|
| 165 | - exit ; |
|
| 164 | + redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, $wait, $msg); |
|
| 165 | + exit; |
|
| 166 | 166 | } else { |
| 167 | - die($msg) ; |
|
| 167 | + die($msg); |
|
| 168 | 168 | } |
| 169 | 169 | } |
@@ -2,29 +2,29 @@ |
||
| 2 | 2 | |
| 3 | 3 | // render admin in theme.html |
| 4 | 4 | if (is_object($xoopsUser)) { |
| 5 | - $xoops_subpath = substr($_SERVER['REQUEST_URI'], strpos(strrev(XOOPS_URL), strrev($_SERVER['HTTP_HOST']))) ; |
|
| 5 | + $xoops_subpath = substr($_SERVER['REQUEST_URI'], strpos(strrev(XOOPS_URL), strrev($_SERVER['HTTP_HOST']))); |
|
| 6 | 6 | if (preg_match('#(^/admin.php|^/modules/system/|^/modules/[a-zA-Z0-9_.-]+/admin/)#', $xoops_subpath)) { |
| 7 | 7 | // The request looks like admin |
| 8 | - require_once __DIR__.'/altsys_functions.php' ; |
|
| 9 | - if (! empty($GLOBALS['altsysModuleConfig']['admin_in_theme']) && file_exists(XOOPS_THEME_PATH.'/'.$GLOBALS['altsysModuleConfig']['admin_in_theme'].'/theme.html')) { |
|
| 8 | + require_once __DIR__.'/altsys_functions.php'; |
|
| 9 | + if (!empty($GLOBALS['altsysModuleConfig']['admin_in_theme']) && file_exists(XOOPS_THEME_PATH.'/'.$GLOBALS['altsysModuleConfig']['admin_in_theme'].'/theme.html')) { |
|
| 10 | 10 | // configs OK |
| 11 | - require_once __DIR__.'/admin_in_theme_functions.php' ; |
|
| 11 | + require_once __DIR__.'/admin_in_theme_functions.php'; |
|
| 12 | 12 | |
| 13 | 13 | // for security with register_globals=1 |
| 14 | - unset($GLOBALS['altsysAdminPageTitle'], /* $GLOBALS['altsysXoopsBreadcrumbs'] ,*/ $GLOBALS['xoops_admin_contents']) ; |
|
| 14 | + unset($GLOBALS['altsysAdminPageTitle'], /* $GLOBALS['altsysXoopsBreadcrumbs'] ,*/ $GLOBALS['xoops_admin_contents']); |
|
| 15 | 15 | |
| 16 | 16 | // disable error handler without XOOPS 2.0.14/15/16 |
| 17 | - if (! (is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array( 1, 2 )))) { |
|
| 18 | - restore_error_handler() ; |
|
| 17 | + if (!(is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array(1, 2)))) { |
|
| 18 | + restore_error_handler(); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | // to prepend Notice with 2.0.14/15/16 with PHP4 |
| 22 | - if (! defined('E_STRICT')) { |
|
| 23 | - define('E_STRICT', 2048) ; |
|
| 22 | + if (!defined('E_STRICT')) { |
|
| 23 | + define('E_STRICT', 2048); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - register_shutdown_function('altsys_admin_in_theme_in_last') ; |
|
| 27 | - ob_start('altsys_admin_in_theme') ; |
|
| 26 | + register_shutdown_function('altsys_admin_in_theme_in_last'); |
|
| 27 | + ob_start('altsys_admin_in_theme'); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -2,94 +2,94 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | function altsys_admin_in_theme($s) |
| 4 | 4 | { |
| 5 | - global $xoops_admin_contents ; |
|
| 5 | + global $xoops_admin_contents; |
|
| 6 | 6 | |
| 7 | - $xoops_admin_contents = '' ; |
|
| 7 | + $xoops_admin_contents = ''; |
|
| 8 | 8 | |
| 9 | 9 | if (defined('ALTSYS_DONT_USE_ADMIN_IN_THEME')) { |
| 10 | - return $s ; |
|
| 10 | + return $s; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // check whether cp_functions.php is loaded |
| 14 | - if (! defined('XOOPS_CPFUNC_LOADED')) { |
|
| 15 | - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; |
|
| 16 | - return $s ; |
|
| 14 | + if (!defined('XOOPS_CPFUNC_LOADED')) { |
|
| 15 | + define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1); |
|
| 16 | + return $s; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | // redirect |
| 20 | 20 | if (strstr($s, '<meta http-equiv="Refresh" ')) { |
| 21 | - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; |
|
| 22 | - return $s ; |
|
| 21 | + define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1); |
|
| 22 | + return $s; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | // outputs before cp_header() |
| 26 | - @list($former_outputs, $tmp_s) = explode('<!DOCTYPE', $s, 2) ; |
|
| 26 | + @list($former_outputs, $tmp_s) = explode('<!DOCTYPE', $s, 2); |
|
| 27 | 27 | if (empty($tmp_s)) { |
| 28 | - $tmp_s = $s ; |
|
| 28 | + $tmp_s = $s; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - @list(, $tmp_s) = explode("<div class='content'>", $tmp_s, 2) ; |
|
| 31 | + @list(, $tmp_s) = explode("<div class='content'>", $tmp_s, 2); |
|
| 32 | 32 | if (empty($tmp_s)) { |
| 33 | - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; |
|
| 34 | - return $s ; |
|
| 33 | + define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1); |
|
| 34 | + return $s; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - list($tmp_s, $tmp_after) = explode("<td width='1%' background='".XOOPS_URL."/modules/system/images/bg_content.gif'>", $tmp_s) ; |
|
| 37 | + list($tmp_s, $tmp_after) = explode("<td width='1%' background='".XOOPS_URL."/modules/system/images/bg_content.gif'>", $tmp_s); |
|
| 38 | 38 | if (empty($tmp_after)) { |
| 39 | - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; |
|
| 40 | - return $s ; |
|
| 39 | + define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1); |
|
| 40 | + return $s; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $xoops_admin_contents = $former_outputs . substr(strrev(strstr(strrev($tmp_s), strrev('</div>'))), 0, -6) ; |
|
| 43 | + $xoops_admin_contents = $former_outputs.substr(strrev(strstr(strrev($tmp_s), strrev('</div>'))), 0, -6); |
|
| 44 | 44 | |
| 45 | - return '' ; |
|
| 45 | + return ''; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | function altsys_admin_in_theme_in_last($contents = null) |
| 50 | 50 | { |
| 51 | - global $xoops_admin_contents , $xoopsConfig , $xoopsModule , $xoopsUser , $xoopsUserIsAdmin , $xoopsLogger , $altsysModuleConfig , $altsysModuleId ; |
|
| 51 | + global $xoops_admin_contents, $xoopsConfig, $xoopsModule, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger, $altsysModuleConfig, $altsysModuleId; |
|
| 52 | 52 | |
| 53 | - if (! isset($contents)) { |
|
| 53 | + if (!isset($contents)) { |
|
| 54 | 54 | while (ob_get_level()) { |
| 55 | - ob_end_flush() ; |
|
| 55 | + ob_end_flush(); |
|
| 56 | 56 | } |
| 57 | 57 | } else { |
| 58 | - $xoops_admin_contents = $contents ; |
|
| 58 | + $xoops_admin_contents = $contents; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if (! isset($xoops_admin_contents)) { |
|
| 62 | - return ; |
|
| 61 | + if (!isset($xoops_admin_contents)) { |
|
| 62 | + return; |
|
| 63 | 63 | } |
| 64 | 64 | if (defined('ALTSYS_DONT_USE_ADMIN_IN_THEME')) { |
| 65 | - return ; |
|
| 65 | + return; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if (! is_object($xoopsUser)) { |
|
| 69 | - exit ; |
|
| 68 | + if (!is_object($xoopsUser)) { |
|
| 69 | + exit; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // language files |
| 73 | 73 | if (file_exists(dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php')) { |
| 74 | - include_once dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php' ; |
|
| 74 | + include_once dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php'; |
|
| 75 | 75 | } else { |
| 76 | - include_once dirname(__DIR__).'/language/english/admin_in_theme.php' ; |
|
| 76 | + include_once dirname(__DIR__).'/language/english/admin_in_theme.php'; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // set the theme |
| 80 | - $xoopsConfig['theme_set'] = $altsysModuleConfig['admin_in_theme'] ; |
|
| 80 | + $xoopsConfig['theme_set'] = $altsysModuleConfig['admin_in_theme']; |
|
| 81 | 81 | |
| 82 | 82 | // language files under the theme |
| 83 | - $original_error_level = error_reporting() ; |
|
| 84 | - error_reporting($original_error_level & ~ E_NOTICE) ; |
|
| 83 | + $original_error_level = error_reporting(); |
|
| 84 | + error_reporting($original_error_level & ~ E_NOTICE); |
|
| 85 | 85 | if (file_exists(XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php')) { |
| 86 | - include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php' ; |
|
| 86 | + include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php'; |
|
| 87 | 87 | } elseif (file_exists(XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php')) { |
| 88 | - include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php' ; |
|
| 88 | + include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php'; |
|
| 89 | 89 | } |
| 90 | - error_reporting($original_error_level) ; |
|
| 90 | + error_reporting($original_error_level); |
|
| 91 | 91 | |
| 92 | - include __DIR__.'/admin_in_theme_header.inc.php' ; |
|
| 92 | + include __DIR__.'/admin_in_theme_header.inc.php'; |
|
| 93 | 93 | |
| 94 | 94 | /* // include adminmenu |
| 95 | 95 | include XOOPS_CACHE_PATH.'/adminmenu.php' ; |
@@ -125,11 +125,11 @@ discard block |
||
| 125 | 125 | function shutdown() {'.implode("\n",$xoops_admin_menu_sd).'}' ; */ |
| 126 | 126 | |
| 127 | 127 | // appendix (core specific css etc) |
| 128 | - $xoops_module_header = '' ; |
|
| 128 | + $xoops_module_header = ''; |
|
| 129 | 129 | if (altsys_get_core_type() == ALTSYS_CORE_TYPE_XCL21) { |
| 130 | - $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=style.css" />'."\n" ; |
|
| 130 | + $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=style.css" />'."\n"; |
|
| 131 | 131 | if (is_object(@$xoopsModule)) { |
| 132 | - $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=module.css&dirname='.$xoopsModule->getVar('dirname').'" />'."\n" ; |
|
| 132 | + $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=module.css&dirname='.$xoopsModule->getVar('dirname').'" />'."\n"; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES), |
| 149 | 149 | 'xoops_contents' => $xoops_admin_contents, //. '<div id="adminmenu_layers">' . $xoops_admin_menu_dv . '</div>' , |
| 150 | 150 | 'xoops_module_header' => $xoops_module_header |
| 151 | - )) ; |
|
| 151 | + )); |
|
| 152 | 152 | |
| 153 | 153 | // rendering |
| 154 | - $xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html') ; |
|
| 154 | + $xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html'); |
|
| 155 | 155 | |
| 156 | 156 | // for XOOPS 2.0.14/15/16 from xoops.org |
| 157 | - if (is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array( 1, 2 ))) { |
|
| 158 | - $xoopsLogger->activated = true ; |
|
| 159 | - echo $xoopsLogger->render('') ; |
|
| 157 | + if (is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array(1, 2))) { |
|
| 158 | + $xoopsLogger->activated = true; |
|
| 159 | + echo $xoopsLogger->render(''); |
|
| 160 | 160 | } |
| 161 | 161 | } |
@@ -1,33 +1,33 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! $xoopsConfig['theme_fromfile']) { |
|
| 4 | - return ; |
|
| 3 | +if (!$xoopsConfig['theme_fromfile']) { |
|
| 4 | + return; |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | // templates/ under modules |
| 8 | 8 | // $tplsadmin_autoupdate_path = XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'] . '/templates' ; |
| 9 | 9 | |
| 10 | -if (! is_array(@$tplsadmin_autoupdate_mydirnames)) { |
|
| 11 | - return ; |
|
| 10 | +if (!is_array(@$tplsadmin_autoupdate_mydirnames)) { |
|
| 11 | + return; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | foreach ($tplsadmin_autoupdate_mydirnames as $tplsadmin_mydirname) { |
| 15 | - $tplsadmin_mydirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $tplsadmin_mydirname) ; |
|
| 16 | - require XOOPS_ROOT_PATH . '/modules/' . $tplsadmin_mydirname . '/mytrustdirname.php' ; |
|
| 17 | - $altsys_mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/' ; |
|
| 18 | - $tplsadmin_autoupdate_path = XOOPS_TRUST_PATH . $altsys_mid_path . $mytrustdirname . '/templates' ; |
|
| 15 | + $tplsadmin_mydirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $tplsadmin_mydirname); |
|
| 16 | + require XOOPS_ROOT_PATH.'/modules/'.$tplsadmin_mydirname.'/mytrustdirname.php'; |
|
| 17 | + $altsys_mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/'; |
|
| 18 | + $tplsadmin_autoupdate_path = XOOPS_TRUST_PATH.$altsys_mid_path.$mytrustdirname.'/templates'; |
|
| 19 | 19 | |
| 20 | 20 | // modules |
| 21 | - if ($handler = @opendir($tplsadmin_autoupdate_path . '/')) { |
|
| 21 | + if ($handler = @opendir($tplsadmin_autoupdate_path.'/')) { |
|
| 22 | 22 | while (($file = readdir($handler)) !== false) { |
| 23 | - $file_path = $tplsadmin_autoupdate_path . '/' . $file ; |
|
| 23 | + $file_path = $tplsadmin_autoupdate_path.'/'.$file; |
|
| 24 | 24 | if (is_file($file_path)) { |
| 25 | 25 | $mtime = (int)(@filemtime($file_path)); |
| 26 | - $tpl_file = $tplsadmin_mydirname . '_' . $file ; |
|
| 27 | - list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($xoopsConfig['template_set']) . "' AND tpl_file='" . addslashes($tpl_file) . "' AND tpl_lastmodified >= $mtime")) ; |
|
| 26 | + $tpl_file = $tplsadmin_mydirname.'_'.$file; |
|
| 27 | + list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('tplfile')." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($tpl_file)."' AND tpl_lastmodified >= $mtime")); |
|
| 28 | 28 | if ($count <= 0) { |
| 29 | - include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php' ; |
|
| 30 | - tplsadmin_import_data($xoopsConfig['template_set'], $tpl_file, implode('', file($file_path)), $mtime) ; |
|
| 29 | + include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php'; |
|
| 30 | + tplsadmin_import_data($xoopsConfig['template_set'], $tpl_file, implode('', file($file_path)), $mtime); |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array()) |
| 360 | 360 | { |
| 361 | 361 | $tree .= $prefix."<input type=\"checkbox\" name=\"".$this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . "]\" id=\"" . $this->getName() . '[groups][' . $this->_groupId . '][' |
| 362 | - . $option['id'] . "]\" onclick=\""; |
|
| 362 | + . $option['id'] . "]\" onclick=\""; |
|
| 363 | 363 | // If there are parent elements, add javascript that will |
| 364 | 364 | // make them selecteded when this element is checked to make |
| 365 | 365 | // sure permissions to parent items are added as well. |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | $tree .= ' checked="checked"'; |
| 381 | 381 | } |
| 382 | 382 | $tree .= ' />' . $option['name'] . "<input type=\"hidden\" name=\"" . $this->getName() . '[parents][' . $option['id'] . "]\" value=\"" . implode(':', $parentIds) . "\" /><input type=\"hidden\" name=\"" . $this->getName() . '[itemname][' |
| 383 | - . $option['id'] . "]\" value=\"" . htmlspecialchars($option['name']) . "\" /><br />\n"; |
|
| 383 | + . $option['id'] . "]\" value=\"" . htmlspecialchars($option['name']) . "\" /><br />\n"; |
|
| 384 | 384 | if (isset($option['children'])) { |
| 385 | 385 | foreach ($option['children'] as $child) { |
| 386 | 386 | array_push($parentIds, $option['id']); |
@@ -70,6 +70,12 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | //HACK by domifara |
| 72 | 72 | // public function MyXoopsGroupPermForm($title, $modid, $permname, $permdesc) |
| 73 | + /** |
|
| 74 | + * @param string $title |
|
| 75 | + * @param integer $modid |
|
| 76 | + * @param string $permname |
|
| 77 | + * @param string $permdesc |
|
| 78 | + */ |
|
| 73 | 79 | public function __construct($title, $modid, $permname, $permdesc) |
| 74 | 80 | { |
| 75 | 81 | // $this->XoopsForm($title, 'groupperm_form', XOOPS_URL.'/modules/system/admin/groupperm.php', 'post'); GIJ |
@@ -100,6 +106,9 @@ discard block |
||
| 100 | 106 | * Add appendix |
| 101 | 107 | * |
| 102 | 108 | * @access public |
| 109 | + * @param string $permName |
|
| 110 | + * @param integer $itemId |
|
| 111 | + * @param string $itemName |
|
| 103 | 112 | */ |
| 104 | 113 | public function addAppendix($permName, $itemId, $itemName) |
| 105 | 114 | { |
@@ -239,6 +248,7 @@ discard block |
||
| 239 | 248 | |
| 240 | 249 | /** |
| 241 | 250 | * Constructor |
| 251 | + * @param string $name |
|
| 242 | 252 | */ |
| 243 | 253 | public function __construct($caption, $name, $groupId, $values = null) |
| 244 | 254 | { |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | * @author XOOPS Development Team, Kazumi Ono (AKA onokazu) |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | -if (! defined('XOOPS_ROOT_PATH')) { |
|
| 21 | - exit ; |
|
| 20 | +if (!defined('XOOPS_ROOT_PATH')) { |
|
| 21 | + exit; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php'; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * Tree structure of items |
| 49 | 49 | * @var array |
| 50 | 50 | */ |
| 51 | - public $_itemTree = array() ; |
|
| 51 | + public $_itemTree = array(); |
|
| 52 | 52 | /** |
| 53 | 53 | * Name of permission |
| 54 | 54 | * @var string |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * Appendix |
| 64 | 64 | * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>) |
| 65 | 65 | */ |
| 66 | - public $_appendix = array() ; |
|
| 66 | + public $_appendix = array(); |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * Constructor |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function addAppendix($permName, $itemId, $itemName) |
| 105 | 105 | { |
| 106 | - $this->_appendix[] = array('permname'=>$permName,'itemid'=>$itemId,'itemname'=>$itemName,'selected'=>false); |
|
| 106 | + $this->_appendix[] = array('permname'=>$permName, 'itemid'=>$itemId, 'itemname'=>$itemName, 'selected'=>false); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function render() |
| 139 | 139 | { |
| 140 | - global $xoopsGTicket ; |
|
| 140 | + global $xoopsGTicket; |
|
| 141 | 141 | |
| 142 | 142 | // load all child ids for javascript codes |
| 143 | 143 | foreach (array_keys($this->_itemTree) as $item_id) { |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | $ele->setOptionTree($this->_itemTree); |
| 155 | 155 | |
| 156 | 156 | // GIJ start |
| 157 | - $ele->setDescription('<input type="checkbox" onclick="with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].name.match(/^perms\[(module_admin|module_read|block_read)\]\[groups\]\['.$i.'\]/)){elements[i].checked=this.checked;}}};">') ; |
|
| 157 | + $ele->setDescription('<input type="checkbox" onclick="with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].name.match(/^perms\[(module_admin|module_read|block_read)\]\[groups\]\['.$i.'\]/)){elements[i].checked=this.checked;}}};">'); |
|
| 158 | 158 | // GIJ_end |
| 159 | 159 | |
| 160 | 160 | foreach ($this->_appendix as $key => $append) { |
| 161 | - $this->_appendix[$key]['selected'] = $gperm_handler->checkRight($append['permname'], $append['itemid'], $i, $this->_modid) ; |
|
| 161 | + $this->_appendix[$key]['selected'] = $gperm_handler->checkRight($append['permname'], $append['itemid'], $i, $this->_modid); |
|
| 162 | 162 | } |
| 163 | 163 | $ele->setAppendix($this->_appendix); |
| 164 | 164 | $this->addElement($ele); |
@@ -168,11 +168,11 @@ discard block |
||
| 168 | 168 | // GIJ start |
| 169 | 169 | $jstray = new XoopsFormElementTray(' '); |
| 170 | 170 | $jsuncheckbutton = new XoopsFormButton('', 'none', _NONE, 'button'); |
| 171 | - $jsuncheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox'){elements[i].checked=false;}}}\"") ; |
|
| 171 | + $jsuncheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox'){elements[i].checked=false;}}}\""); |
|
| 172 | 172 | $jscheckbutton = new XoopsFormButton('', 'all', _ALL, 'button'); |
| 173 | - $jscheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox' && (elements[i].name.indexOf('module_admin')<0 || elements[i].name.indexOf('[groups][1]')>=0)){elements[i].checked=true;}}}\"") ; |
|
| 174 | - $jstray->addElement($jsuncheckbutton) ; |
|
| 175 | - $jstray->addElement($jscheckbutton) ; |
|
| 173 | + $jscheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox' && (elements[i].name.indexOf('module_admin')<0 || elements[i].name.indexOf('[groups][1]')>=0)){elements[i].checked=true;}}}\""); |
|
| 174 | + $jstray->addElement($jsuncheckbutton); |
|
| 175 | + $jstray->addElement($jscheckbutton); |
|
| 176 | 176 | $this->addElement($jstray); |
| 177 | 177 | // GIJ end |
| 178 | 178 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $ret = '<h4>'.$this->getTitle().'</h4>'.$this->_permDesc.'<br />'; |
| 185 | 185 | $ret .= "<form name='".$this->getName()."' id='".$this->getName()."' action='".$this->getAction()."' method='".$this->getMethod()."'".$this->getExtra().">\n<table width='100%' class='outer' cellspacing='1'>\n"; |
| 186 | - $elements =& $this->getElements(); |
|
| 186 | + $elements = & $this->getElements(); |
|
| 187 | 187 | foreach (array_keys($elements) as $i) { |
| 188 | 188 | if (!is_object($elements[$i])) { |
| 189 | 189 | $ret .= $elements[$i]; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $ret .= $elements[$i]->render(); |
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | - $ret .= '</table>' . $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'myblocksadmin') . '</form>'; |
|
| 202 | + $ret .= '</table>'.$xoopsGTicket->getTicketHtml(__LINE__, 1800, 'myblocksadmin').'</form>'; |
|
| 203 | 203 | return $ret; |
| 204 | 204 | } |
| 205 | 205 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * Appendix |
| 236 | 236 | * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>) |
| 237 | 237 | */ |
| 238 | - public $_appendix = array() ; |
|
| 238 | + public $_appendix = array(); |
|
| 239 | 239 | |
| 240 | 240 | /** |
| 241 | 241 | * Constructor |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | public function setAppendix($appendix) |
| 287 | 287 | { |
| 288 | - $this->_appendix = $appendix ; |
|
| 288 | + $this->_appendix = $appendix; |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | public function render() |
| 298 | 298 | { |
| 299 | - $ret = '' ; |
|
| 299 | + $ret = ''; |
|
| 300 | 300 | |
| 301 | 301 | if (count($this->_appendix) > 0) { |
| 302 | 302 | $ret .= '<table class="outer"><tr>'; |
@@ -306,11 +306,11 @@ discard block |
||
| 306 | 306 | $ret .= '</tr><tr>'; |
| 307 | 307 | $cols = 1; |
| 308 | 308 | } |
| 309 | - $checked = $append['selected'] ? 'checked="checked"' : '' ; |
|
| 310 | - $name = 'perms['.$append['permname'].']' ; |
|
| 311 | - $itemid = $append['itemid'] ; |
|
| 312 | - $itemid = $append['itemid'] ; |
|
| 313 | - $ret .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked />{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\" /><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\" /><br /></td>" ; |
|
| 309 | + $checked = $append['selected'] ? 'checked="checked"' : ''; |
|
| 310 | + $name = 'perms['.$append['permname'].']'; |
|
| 311 | + $itemid = $append['itemid']; |
|
| 312 | + $itemid = $append['itemid']; |
|
| 313 | + $ret .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked />{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\" /><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\" /><br /></td>"; |
|
| 314 | 314 | $cols++; |
| 315 | 315 | } |
| 316 | 316 | $ret .= '</tr></table>'; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | $ret .= '<table class="outer"><tr>'; |
| 320 | 320 | $cols = 1; |
| 321 | - if (! empty($this->_optionTree[0]['children'])) { |
|
| 321 | + if (!empty($this->_optionTree[0]['children'])) { |
|
| 322 | 322 | foreach ($this->_optionTree[0]['children'] as $topitem) { |
| 323 | 323 | if ($cols > 4) { |
| 324 | 324 | $ret .= '</tr><tr>'; |
@@ -346,8 +346,8 @@ discard block |
||
| 346 | 346 | */ |
| 347 | 347 | public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array()) |
| 348 | 348 | { |
| 349 | - $tree .= $prefix."<input type=\"checkbox\" name=\"".$this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . "]\" id=\"" . $this->getName() . '[groups][' . $this->_groupId . '][' |
|
| 350 | - . $option['id'] . "]\" onclick=\""; |
|
| 349 | + $tree .= $prefix."<input type=\"checkbox\" name=\"".$this->getName().'[groups]['.$this->_groupId.']['.$option['id']."]\" id=\"".$this->getName().'[groups]['.$this->_groupId.'][' |
|
| 350 | + . $option['id']."]\" onclick=\""; |
|
| 351 | 351 | // If there are parent elements, add javascript that will |
| 352 | 352 | // make them selecteded when this element is checked to make |
| 353 | 353 | // sure permissions to parent items are added as well. |
@@ -367,8 +367,8 @@ discard block |
||
| 367 | 367 | if (isset($this->_value) && in_array($option['id'], $this->_value)) { |
| 368 | 368 | $tree .= ' checked="checked"'; |
| 369 | 369 | } |
| 370 | - $tree .= ' />' . $option['name'] . "<input type=\"hidden\" name=\"" . $this->getName() . '[parents][' . $option['id'] . "]\" value=\"" . implode(':', $parentIds) . "\" /><input type=\"hidden\" name=\"" . $this->getName() . '[itemname][' |
|
| 371 | - . $option['id'] . "]\" value=\"" . htmlspecialchars($option['name']) . "\" /><br />\n"; |
|
| 370 | + $tree .= ' />'.$option['name']."<input type=\"hidden\" name=\"".$this->getName().'[parents]['.$option['id']."]\" value=\"".implode(':', $parentIds)."\" /><input type=\"hidden\" name=\"".$this->getName().'[itemname][' |
|
| 371 | + . $option['id']."]\" value=\"".htmlspecialchars($option['name'])."\" /><br />\n"; |
|
| 372 | 372 | if (isset($option['children'])) { |
| 373 | 373 | foreach ($option['children'] as $child) { |
| 374 | 374 | array_push($parentIds, $option['id']); |
@@ -1,21 +1,21 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$mytrustdirname = basename(__DIR__) ; |
|
| 4 | -$mytrustdirpath = __DIR__ ; |
|
| 3 | +$mytrustdirname = basename(__DIR__); |
|
| 4 | +$mytrustdirpath = __DIR__; |
|
| 5 | 5 | |
| 6 | 6 | // language files |
| 7 | -$language = empty($GLOBALS['xoopsConfig']['language']) ? 'english' : $GLOBALS['xoopsConfig']['language'] ; |
|
| 7 | +$language = empty($GLOBALS['xoopsConfig']['language']) ? 'english' : $GLOBALS['xoopsConfig']['language']; |
|
| 8 | 8 | if (file_exists("$mydirpath/language/$language/blocks.php")) { |
| 9 | 9 | // user customized language file (already read by class/xoopsblock.php etc) |
| 10 | 10 | // include_once "$mydirpath/language/$language/blocks.php" ; |
| 11 | 11 | } elseif (file_exists("$mytrustdirpath/language/$language/blocks_common.php")) { |
| 12 | 12 | // default language file |
| 13 | - include_once "$mytrustdirpath/language/$language/blocks_common.php" ; |
|
| 14 | - include "$mytrustdirpath/language/$language/blocks_each.php" ; |
|
| 13 | + include_once "$mytrustdirpath/language/$language/blocks_common.php"; |
|
| 14 | + include "$mytrustdirpath/language/$language/blocks_each.php"; |
|
| 15 | 15 | } else { |
| 16 | 16 | // fallback english |
| 17 | - include_once "$mytrustdirpath/language/english/blocks_common.php" ; |
|
| 18 | - include "$mytrustdirpath/language/english/blocks_each.php" ; |
|
| 17 | + include_once "$mytrustdirpath/language/english/blocks_common.php"; |
|
| 18 | + include "$mytrustdirpath/language/english/blocks_each.php"; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | -require_once "$mytrustdirpath/blocks/block_functions.php" ; |
|
| 21 | +require_once "$mytrustdirpath/blocks/block_functions.php"; |
|