@@ -1,35 +1,35 @@ 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 | 7 | $adminmenu = array( |
| 8 | 8 | array( |
| 9 | - 'title' => _MI_ALTSYS_MENU_CUSTOMBLOCKS , |
|
| 10 | - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__' , |
|
| 11 | - ) , |
|
| 9 | + 'title' => _MI_ALTSYS_MENU_CUSTOMBLOCKS, |
|
| 10 | + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__', |
|
| 11 | + ), |
|
| 12 | 12 | array( |
| 13 | - 'title' => _MI_ALTSYS_MENU_NEWCUSTOMBLOCK , |
|
| 14 | - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__&op=edit' , |
|
| 15 | - 'show' => false , |
|
| 16 | - ) , |
|
| 13 | + 'title' => _MI_ALTSYS_MENU_NEWCUSTOMBLOCK, |
|
| 14 | + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__&op=edit', |
|
| 15 | + 'show' => false, |
|
| 16 | + ), |
|
| 17 | 17 | array( |
| 18 | - 'title' => _MI_ALTSYS_MENU_MYBLOCKSADMIN , |
|
| 19 | - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin' , |
|
| 20 | - ) , |
|
| 18 | + 'title' => _MI_ALTSYS_MENU_MYBLOCKSADMIN, |
|
| 19 | + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', |
|
| 20 | + ), |
|
| 21 | 21 | array( |
| 22 | - 'title' => _MI_ALTSYS_MENU_MYTPLSADMIN , |
|
| 23 | - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mytplsadmin' , |
|
| 24 | - ) , |
|
| 22 | + 'title' => _MI_ALTSYS_MENU_MYTPLSADMIN, |
|
| 23 | + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', |
|
| 24 | + ), |
|
| 25 | 25 | array( |
| 26 | - 'title' => _MI_ALTSYS_MENU_COMPILEHOOKADMIN , |
|
| 27 | - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=compilehookadmin' , |
|
| 28 | - ) , |
|
| 26 | + 'title' => _MI_ALTSYS_MENU_COMPILEHOOKADMIN, |
|
| 27 | + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=compilehookadmin', |
|
| 28 | + ), |
|
| 29 | 29 | array( |
| 30 | - 'title' => _MI_ALTSYS_MENU_MYLANGADMIN , |
|
| 31 | - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mylangadmin' , |
|
| 32 | - ) , |
|
| 30 | + 'title' => _MI_ALTSYS_MENU_MYLANGADMIN, |
|
| 31 | + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mylangadmin', |
|
| 32 | + ), |
|
| 33 | 33 | /* array( |
| 34 | 34 | 'title' => _MI_ALTSYS_MENU_MYAVATAR , |
| 35 | 35 | 'link' => 'index.php?mode=admin&lib=altsys&page=myavatar' , |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | 'title' => _MI_ALTSYS_MENU_MYSMILEY , |
| 39 | 39 | 'link' => 'index.php?mode=admin&lib=altsys&page=mysmiley' , |
| 40 | 40 | ) ,*/ |
| 41 | -) ; |
|
| 41 | +); |
|
| 42 | 42 | |
| 43 | 43 | $adminmenu4altsys = array( |
| 44 | 44 | array( |
| 45 | - 'title' => 'ALTSYS '._PREFERENCES , |
|
| 46 | - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mypreferences' , |
|
| 47 | - ) , |
|
| 48 | -) ; |
|
| 45 | + 'title' => 'ALTSYS '._PREFERENCES, |
|
| 46 | + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mypreferences', |
|
| 47 | + ), |
|
| 48 | +); |
|
@@ -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 = dirname(__FILE__).'/sql/mysql.sql' ; |
|
| 29 | - $prefix_mod = $db->prefix() . '_' . $mydirname ; |
|
| 28 | + $sql_file_path = dirname(__FILE__).'/sql/mysql.sql'; |
|
| 29 | + $prefix_mod = $db->prefix().'_'.$mydirname; |
|
| 30 | 30 | if (file_exists($sql_file_path)) { |
| 31 | 31 | $ret[] = "SQL file found at <b>".htmlspecialchars($sql_file_path)."</b>.<br /> Deleting tables...<br />"; |
| 32 | - $sql_lines = file($sql_file_path) ; |
|
| 32 | + $sql_lines = file($sql_file_path); |
|
| 33 | 33 | foreach ($sql_lines as $sql_line) { |
| 34 | 34 | if (preg_match('/^CREATE TABLE \`?([a-zA-Z0-9_-]+)\`? /i', $sql_line, $regs)) { |
| 35 | 35 | $sql = 'DROP TABLE '.addslashes($prefix_mod.'_'.$regs[1]); |
@@ -59,14 +59,14 @@ discard block |
||
| 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 | |
@@ -5,25 +5,25 @@ discard block |
||
| 5 | 5 | // GIJOE <http://www.peak.ne.jp/> // |
| 6 | 6 | // ------------------------------------------------------------------------- // |
| 7 | 7 | |
| 8 | -include_once dirname(__FILE__).'/include/gtickets.php' ; |
|
| 9 | -include_once dirname(__FILE__).'/include/altsys_functions.php' ; |
|
| 10 | -include_once dirname(__FILE__).'/include/tpls_functions.php' ; |
|
| 8 | +include_once dirname(__FILE__).'/include/gtickets.php'; |
|
| 9 | +include_once dirname(__FILE__).'/include/altsys_functions.php'; |
|
| 10 | +include_once dirname(__FILE__).'/include/tpls_functions.php'; |
|
| 11 | 11 | |
| 12 | 12 | |
| 13 | 13 | // this page can be called only from altsys |
| 14 | 14 | if ($xoopsModule->getVar('dirname') != 'altsys') { |
| 15 | - die('this page can be called only from altsys') ; |
|
| 15 | + die('this page can be called only from altsys'); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | // language file |
| 20 | -altsys_include_language_file('compilehookadmin') ; |
|
| 20 | +altsys_include_language_file('compilehookadmin'); |
|
| 21 | 21 | |
| 22 | 22 | |
| 23 | -$db =& XoopsDatabaseFactory::getDatabaseConnection() ; |
|
| 23 | +$db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 24 | 24 | |
| 25 | -if (empty($_FILES['tplset_archive']['tmp_name']) || ! is_uploaded_file($_FILES['tplset_archive']['tmp_name'])) { |
|
| 26 | - die(_TPLSADMIN_ERR_NOTUPLOADED) ; |
|
| 25 | +if (empty($_FILES['tplset_archive']['tmp_name']) || !is_uploaded_file($_FILES['tplset_archive']['tmp_name'])) { |
|
| 26 | + die(_TPLSADMIN_ERR_NOTUPLOADED); |
|
| 27 | 27 | } |
| 28 | 28 | //fix for mb_http_output setting and for add any browsers |
| 29 | 29 | if (function_exists('mb_http_output')) { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | //ob_buffer over flow |
| 33 | 33 | //HACK by suin & nao-pon 2012/01/06 |
| 34 | 34 | while (ob_get_level() > 0) { |
| 35 | - if (! ob_end_clean()) { |
|
| 35 | + if (!ob_end_clean()) { |
|
| 36 | 36 | break; |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -41,62 +41,62 @@ discard block |
||
| 41 | 41 | // EXTRACT STAGE |
| 42 | 42 | // |
| 43 | 43 | |
| 44 | -$orig_filename4check = strtolower($_FILES['tplset_archive']['name']) ; |
|
| 44 | +$orig_filename4check = strtolower($_FILES['tplset_archive']['name']); |
|
| 45 | 45 | if (strtolower(substr($orig_filename4check, -4)) == '.zip') { |
| 46 | 46 | |
| 47 | 47 | // zip |
| 48 | - require_once dirname(__FILE__).'/include/Archive_Zip.php' ; |
|
| 49 | - $reader = new Archive_Zip($_FILES['tplset_archive']['tmp_name']) ; |
|
| 50 | - $files = $reader->extract(array( 'extract_as_string' => true )) ; |
|
| 51 | - if (! is_array(@$files)) { |
|
| 52 | - die($reader->errorName()) ; |
|
| 48 | + require_once dirname(__FILE__).'/include/Archive_Zip.php'; |
|
| 49 | + $reader = new Archive_Zip($_FILES['tplset_archive']['tmp_name']); |
|
| 50 | + $files = $reader->extract(array('extract_as_string' => true)); |
|
| 51 | + if (!is_array(@$files)) { |
|
| 52 | + die($reader->errorName()); |
|
| 53 | 53 | } |
| 54 | - $do_upload = true ; |
|
| 54 | + $do_upload = true; |
|
| 55 | 55 | } elseif (substr($orig_filename4check, -4) == '.tgz' || substr($orig_filename4check, -7) == '.tar.gz') { |
| 56 | 56 | |
| 57 | 57 | // tar.gz |
| 58 | - require_once XOOPS_ROOT_PATH.'/class/class.tar.php' ; |
|
| 59 | - $tar = new tar() ; |
|
| 60 | - $tar->openTar($_FILES['tplset_archive']['tmp_name']) ; |
|
| 61 | - $files = array() ; |
|
| 58 | + require_once XOOPS_ROOT_PATH.'/class/class.tar.php'; |
|
| 59 | + $tar = new tar(); |
|
| 60 | + $tar->openTar($_FILES['tplset_archive']['tmp_name']); |
|
| 61 | + $files = array(); |
|
| 62 | 62 | foreach ($tar->files as $id => $info) { |
| 63 | 63 | $files[] = array( |
| 64 | - 'filename' => $info['name'] , |
|
| 65 | - 'mtime' => $info['time'] , |
|
| 66 | - 'content' => $info['file'] , |
|
| 67 | - ) ; |
|
| 64 | + 'filename' => $info['name'], |
|
| 65 | + 'mtime' => $info['time'], |
|
| 66 | + 'content' => $info['file'], |
|
| 67 | + ); |
|
| 68 | 68 | } |
| 69 | 69 | if (empty($files)) { |
| 70 | - die(_TPLSADMIN_ERR_INVALIDARCHIVE) ; |
|
| 70 | + die(_TPLSADMIN_ERR_INVALIDARCHIVE); |
|
| 71 | 71 | } |
| 72 | - $do_upload = true ; |
|
| 72 | + $do_upload = true; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if (empty($do_upload)) { |
| 76 | - die(_TPLSADMIN_ERR_EXTENSION) ; |
|
| 76 | + die(_TPLSADMIN_ERR_EXTENSION); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // |
| 80 | 80 | // IMPORT STAGE |
| 81 | 81 | // |
| 82 | 82 | |
| 83 | -$tplset = @$_POST['tplset'] ; |
|
| 84 | -if (! preg_match('/^[0-9A-Za-z_-]{1,16}$/', $tplset)) { |
|
| 85 | - die(_TPLSADMIN_ERR_INVALIDTPLSET) ; |
|
| 83 | +$tplset = @$_POST['tplset']; |
|
| 84 | +if (!preg_match('/^[0-9A-Za-z_-]{1,16}$/', $tplset)) { |
|
| 85 | + die(_TPLSADMIN_ERR_INVALIDTPLSET); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | -$imported = 0 ; |
|
| 88 | +$imported = 0; |
|
| 89 | 89 | foreach ($files as $file) { |
| 90 | - if (! empty($file['folder'])) { |
|
| 91 | - continue ; |
|
| 90 | + if (!empty($file['folder'])) { |
|
| 91 | + continue; |
|
| 92 | 92 | } |
| 93 | - $pos = strrpos($file['filename'], '/') ; |
|
| 94 | - $tpl_file = $pos === false ? $file['filename'] : substr($file['filename'], $pos + 1) ; |
|
| 93 | + $pos = strrpos($file['filename'], '/'); |
|
| 94 | + $tpl_file = $pos === false ? $file['filename'] : substr($file['filename'], $pos + 1); |
|
| 95 | 95 | |
| 96 | 96 | if (tplsadmin_import_data($tplset, $tpl_file, rtrim($file['content']), $file['mtime'])) { |
| 97 | - $imported ++ ; |
|
| 97 | + $imported++; |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | -redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf(_TPLSADMIN_FMT_MSG_PUTTEMPLATES, $imported)) ; |
|
| 102 | -exit ; |
|
| 101 | +redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf(_TPLSADMIN_FMT_MSG_PUTTEMPLATES, $imported)); |
|
| 102 | +exit; |
|
@@ -5,170 +5,170 @@ discard block |
||
| 5 | 5 | // GIJOE <http://www.peak.ne.jp/> // |
| 6 | 6 | // ------------------------------------------------------------------------- // |
| 7 | 7 | |
| 8 | -require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php' ; |
|
| 9 | -include_once dirname(__FILE__)."/include/gtickets.php" ; |
|
| 10 | -include_once dirname(__FILE__).'/include/altsys_functions.php' ; |
|
| 11 | -include_once dirname(__FILE__).'/include/lang_functions.php' ; |
|
| 12 | -include_once dirname(__FILE__).'/class/D3LanguageManager.class.php' ; |
|
| 8 | +require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php'; |
|
| 9 | +include_once dirname(__FILE__)."/include/gtickets.php"; |
|
| 10 | +include_once dirname(__FILE__).'/include/altsys_functions.php'; |
|
| 11 | +include_once dirname(__FILE__).'/include/lang_functions.php'; |
|
| 12 | +include_once dirname(__FILE__).'/class/D3LanguageManager.class.php'; |
|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | // only groups have 'module_admin' of 'altsys' can do that. |
| 16 | -$module_handler =& xoops_gethandler('module') ; |
|
| 17 | -$module =& $module_handler->getByDirname('altsys') ; |
|
| 18 | -if (! is_object($module)) { |
|
| 19 | - die('install altsys') ; |
|
| 16 | +$module_handler = & xoops_gethandler('module'); |
|
| 17 | +$module = & $module_handler->getByDirname('altsys'); |
|
| 18 | +if (!is_object($module)) { |
|
| 19 | + die('install altsys'); |
|
| 20 | 20 | } |
| 21 | -$moduleperm_handler =& xoops_gethandler('groupperm') ; |
|
| 22 | -if (! is_object(@$xoopsUser) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { |
|
| 23 | - die('only admin of altsys can access this area') ; |
|
| 21 | +$moduleperm_handler = & xoops_gethandler('groupperm'); |
|
| 22 | +if (!is_object(@$xoopsUser) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { |
|
| 23 | + die('only admin of altsys can access this area'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | // initials |
| 28 | -$db =& XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 29 | -(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance() ; |
|
| 30 | -$langman =& D3LanguageManager::getInstance() ; |
|
| 28 | +$db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 29 | +(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = & MyTextSanitizer::getInstance(); |
|
| 30 | +$langman = & D3LanguageManager::getInstance(); |
|
| 31 | 31 | |
| 32 | 32 | // language file of this controller |
| 33 | -altsys_include_language_file('mylangadmin') ; |
|
| 33 | +altsys_include_language_file('mylangadmin'); |
|
| 34 | 34 | |
| 35 | 35 | // check $xoopsModule |
| 36 | -if (! is_object($xoopsModule)) { |
|
| 37 | - redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM) ; |
|
| 36 | +if (!is_object($xoopsModule)) { |
|
| 37 | + redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // set target_module if specified by $_GET['dirname'] |
| 41 | -$module_handler =& xoops_gethandler('module'); |
|
| 42 | -if (! empty($_GET['dirname'])) { |
|
| 43 | - $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']) ; |
|
| 44 | - $target_module =& $module_handler->getByDirname($dirname) ; |
|
| 41 | +$module_handler = & xoops_gethandler('module'); |
|
| 42 | +if (!empty($_GET['dirname'])) { |
|
| 43 | + $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']); |
|
| 44 | + $target_module = & $module_handler->getByDirname($dirname); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if (! empty($target_module) && is_object($target_module)) { |
|
| 47 | +if (!empty($target_module) && is_object($target_module)) { |
|
| 48 | 48 | // specified by dirname (for langadmin as an independent module) |
| 49 | - $target_mid = $target_module->getVar('mid') ; |
|
| 50 | - $target_dirname = $target_module->getVar('dirname') ; |
|
| 51 | - $target_dirname4sql = addslashes($target_dirname) ; |
|
| 52 | - $target_mname = $target_module->getVar('name') . " " . 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; |
|
@@ -5,63 +5,63 @@ discard block |
||
| 5 | 5 | // GIJOE <http://www.peak.ne.jp/> // |
| 6 | 6 | // ------------------------------------------------------------------------- // |
| 7 | 7 | |
| 8 | -require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php' ; |
|
| 9 | -include_once dirname(__FILE__)."/include/gtickets.php" ; |
|
| 10 | -include_once dirname(__FILE__).'/include/altsys_functions.php' ; |
|
| 11 | -include_once dirname(__FILE__)."/include/tpls_functions.php" ; |
|
| 8 | +require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php'; |
|
| 9 | +include_once dirname(__FILE__)."/include/gtickets.php"; |
|
| 10 | +include_once dirname(__FILE__).'/include/altsys_functions.php'; |
|
| 11 | +include_once dirname(__FILE__)."/include/tpls_functions.php"; |
|
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | // only groups have 'module_admin' of 'altsys' can do that. |
| 15 | -$module_handler =& xoops_gethandler('module') ; |
|
| 16 | -$module =& $module_handler->getByDirname('altsys') ; |
|
| 17 | -if (! is_object($module)) { |
|
| 18 | - die('install altsys') ; |
|
| 15 | +$module_handler = & xoops_gethandler('module'); |
|
| 16 | +$module = & $module_handler->getByDirname('altsys'); |
|
| 17 | +if (!is_object($module)) { |
|
| 18 | + die('install altsys'); |
|
| 19 | 19 | } |
| 20 | -$moduleperm_handler =& xoops_gethandler('groupperm') ; |
|
| 21 | -if (! is_object(@$xoopsUser) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { |
|
| 22 | - die('only admin of altsys can access this area') ; |
|
| 20 | +$moduleperm_handler = & xoops_gethandler('groupperm'); |
|
| 21 | +if (!is_object(@$xoopsUser) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { |
|
| 22 | + die('only admin of altsys can access this area'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | // initials |
| 27 | -$db =& XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 28 | -(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance() ; |
|
| 27 | +$db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 28 | +(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = & MyTextSanitizer::getInstance(); |
|
| 29 | 29 | |
| 30 | 30 | // language file |
| 31 | -altsys_include_language_file('mytplsadmin') ; |
|
| 31 | +altsys_include_language_file('mytplsadmin'); |
|
| 32 | 32 | |
| 33 | 33 | // check $xoopsModule |
| 34 | -if (! is_object($xoopsModule)) { |
|
| 35 | - redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM) ; |
|
| 34 | +if (!is_object($xoopsModule)) { |
|
| 35 | + redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // set target_module if specified by $_GET['dirname'] |
| 39 | -$module_handler =& xoops_gethandler('module'); |
|
| 40 | -if (! empty($_GET['dirname'])) { |
|
| 41 | - $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']) ; |
|
| 42 | - $target_module =& $module_handler->getByDirname($dirname) ; |
|
| 39 | +$module_handler = & xoops_gethandler('module'); |
|
| 40 | +if (!empty($_GET['dirname'])) { |
|
| 41 | + $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']); |
|
| 42 | + $target_module = & $module_handler->getByDirname($dirname); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | -if (! empty($target_module) && is_object($target_module)) { |
|
| 45 | +if (!empty($target_module) && is_object($target_module)) { |
|
| 46 | 46 | // specified by dirname (for tplsadmin as an independent module) |
| 47 | - $target_mid = $target_module->getVar('mid') ; |
|
| 48 | - $target_dirname = $target_module->getVar('dirname') ; |
|
| 49 | - $target_dirname4sql = addslashes($target_dirname) ; |
|
| 50 | - $target_mname = $target_module->getVar('name') . " " . 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 | - $tpl_id = intval($tpl_id) ; |
|
| 188 | - $db->query("DELETE FROM ".$db->prefix("tplfile")." WHERE tpl_id=$tpl_id") ; |
|
| 189 | - $db->query("DELETE FROM ".$db->prefix("tplsource")." WHERE tpl_id=$tpl_id") ; |
|
| 187 | + $tpl_id = intval($tpl_id); |
|
| 188 | + $db->query("DELETE FROM ".$db->prefix("tplfile")." WHERE tpl_id=$tpl_id"); |
|
| 189 | + $db->query("DELETE FROM ".$db->prefix("tplsource")." WHERE tpl_id=$tpl_id"); |
|
| 190 | 190 | } |
| 191 | 191 | // remove templates_c |
| 192 | 192 | $tpl->clear_cache('db:'.$tplfile); |
| 193 | 193 | $tpl->clear_compiled_tpl('db:'.$tplfile); |
| 194 | 194 | } |
| 195 | - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED) ; |
|
| 196 | - exit ; |
|
| 195 | + redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED); |
|
| 196 | + exit; |
|
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | } |
@@ -234,60 +234,60 @@ discard block |
||
| 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 |
@@ -300,14 +300,14 @@ discard block |
||
| 300 | 300 | <th>"._MYTPLSADMIN_TH_TYPE."</th> |
| 301 | 301 | <th><input type='checkbox' title="._MYTPLSADMIN_TITLE_CHECKALL." onclick=\"with(document.MainForm){for(i=0;i<length;i++){if(elements[i].type=='checkbox'&&elements[i].name.indexOf('basecheck')>=0){elements[i].checked=this.checked;}}}\" />"._MYTPLSADMIN_TH_FILE."</th> |
| 302 | 302 | $tplsets_th4disp |
| 303 | - </tr>\n" ; |
|
| 303 | + </tr>\n"; |
|
| 304 | 304 | |
| 305 | 305 | // STYLE for distinguishing fingerprints |
| 306 | -$fingerprint_classes = array( '' , ' fingerprint1' , ' fingerprint2' , ' fingerprint3' , ' fingerprint4' , ' fingerprint5' , ' fingerprint6' , ' fingerprint7' ) ; |
|
| 306 | +$fingerprint_classes = array('', ' fingerprint1', ' fingerprint2', ' fingerprint3', ' fingerprint4', ' fingerprint5', ' fingerprint6', ' fingerprint7'); |
|
| 307 | 307 | |
| 308 | 308 | // template ROWS |
| 309 | 309 | while (list($tpl_file, $tpl_desc, $type, $count) = $db->fetchRow($frs)) { |
| 310 | - $evenodd = @$evenodd == 'even' ? 'odd' : 'even' ; |
|
| 310 | + $evenodd = @$evenodd == 'even' ? 'odd' : 'even'; |
|
| 311 | 311 | $fingerprints = array(); |
| 312 | 312 | |
| 313 | 313 | // information about the template |
@@ -319,45 +319,45 @@ discard block |
||
| 319 | 319 | <dd>".htmlspecialchars($tpl_desc, ENT_QUOTES)."</dd> |
| 320 | 320 | </dl> |
| 321 | 321 | </td> |
| 322 | - <td class='$evenodd'>".$type."<br />(".$count.")</td>\n" ; |
|
| 322 | + <td class='$evenodd'>".$type."<br />(".$count.")</td>\n"; |
|
| 323 | 323 | |
| 324 | 324 | // the base file template column |
| 325 | - $basefilepath = tplsadmin_get_basefilepath($target_dirname, $type, $tpl_file) ; |
|
| 325 | + $basefilepath = tplsadmin_get_basefilepath($target_dirname, $type, $tpl_file); |
|
| 326 | 326 | |
| 327 | 327 | if (file_exists($basefilepath)) { |
| 328 | - $fingerprint = tplsadmin_get_fingerprint(file($basefilepath)) ; |
|
| 329 | - $fingerprints[ $fingerprint ] = '' ; |
|
| 330 | - echo "<td class='$evenodd'>".formatTimestamp(filemtime($basefilepath), 'm').'<br />'.substr($fingerprint, 0, 16)."<br /><input type='checkbox' name='basecheck[$tpl_file]' value='1' /></td>\n" ; |
|
| 331 | - $fingerprint_class_count = 0 ; |
|
| 328 | + $fingerprint = tplsadmin_get_fingerprint(file($basefilepath)); |
|
| 329 | + $fingerprints[$fingerprint] = ''; |
|
| 330 | + echo "<td class='$evenodd'>".formatTimestamp(filemtime($basefilepath), 'm').'<br />'.substr($fingerprint, 0, 16)."<br /><input type='checkbox' name='basecheck[$tpl_file]' value='1' /></td>\n"; |
|
| 331 | + $fingerprint_class_count = 0; |
|
| 332 | 332 | } else { |
| 333 | - echo "<td class='$evenodd'><br /></td>" ; |
|
| 334 | - $fingerprint_class_count = -1 ; |
|
| 333 | + echo "<td class='$evenodd'><br /></td>"; |
|
| 334 | + $fingerprint_class_count = -1; |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | // db template columns |
| 338 | 338 | foreach ($tplsets as $tplset) { |
| 339 | - $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ; |
|
| 339 | + $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES); |
|
| 340 | 340 | |
| 341 | 341 | // query for templates in db |
| 342 | - $drs = $db->query("SELECT * FROM ".$db->prefix("tplfile")." f NATURAL LEFT JOIN ".$db->prefix("tplsource")." s WHERE tpl_file='".addslashes($tpl_file)."' AND tpl_tplset='".addslashes($tplset)."'") ; |
|
| 343 | - $numrows = $db->getRowsNum($drs) ; |
|
| 344 | - $tpl = $db->fetchArray($drs) ; |
|
| 342 | + $drs = $db->query("SELECT * FROM ".$db->prefix("tplfile")." f NATURAL LEFT JOIN ".$db->prefix("tplsource")." s WHERE tpl_file='".addslashes($tpl_file)."' AND tpl_tplset='".addslashes($tplset)."'"); |
|
| 343 | + $numrows = $db->getRowsNum($drs); |
|
| 344 | + $tpl = $db->fetchArray($drs); |
|
| 345 | 345 | if (empty($tpl['tpl_id'])) { |
| 346 | - echo "<td class='$evenodd'>($numrows)</td>\n" ; |
|
| 346 | + echo "<td class='$evenodd'>($numrows)</td>\n"; |
|
| 347 | 347 | } else { |
| 348 | - $fingerprint = tplsadmin_get_fingerprint(explode("\n", $tpl['tpl_source'])) ; |
|
| 349 | - if (isset($fingerprints[ $fingerprint ])) { |
|
| 350 | - $class = $fingerprints[ $fingerprint ] ; |
|
| 348 | + $fingerprint = tplsadmin_get_fingerprint(explode("\n", $tpl['tpl_source'])); |
|
| 349 | + if (isset($fingerprints[$fingerprint])) { |
|
| 350 | + $class = $fingerprints[$fingerprint]; |
|
| 351 | 351 | } else { |
| 352 | 352 | //$fingerprint_class_count ++ ; |
| 353 | - $class = $fingerprint_classes[++$fingerprint_class_count] ; |
|
| 354 | - $fingerprints[ $fingerprint ] = $class ; |
|
| 353 | + $class = $fingerprint_classes[++$fingerprint_class_count]; |
|
| 354 | + $fingerprints[$fingerprint] = $class; |
|
| 355 | 355 | } |
| 356 | - echo "<td class='{$evenodd}{$class}'>".formatTimestamp($tpl['tpl_lastmodified'], 'm').'<br />'.substr($fingerprint, 0, 16)."<br /><input type='checkbox' name='{$tplset4disp}_check[{$tpl_file}]' value='1' /> <a href='?mode=admin&lib=altsys&page=mytplsform&tpl_file=".htmlspecialchars($tpl['tpl_file'], ENT_QUOTES)."&tpl_tplset=".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=".htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES)."&dirname=".htmlspecialchars($target_dirname, ENT_QUOTES)."'>"._EDIT."</a> ($numrows)</td>\n"; |
|
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - echo "</tr>\n" ; |
|
| 360 | + echo "</tr>\n"; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | // command submit ROW |
@@ -384,21 +384,21 @@ discard block |
||
| 384 | 384 | </td>\n" ; |
| 385 | 385 | |
| 386 | 386 | foreach ($tplsets as $tplset) { |
| 387 | - $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ; |
|
| 387 | + $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES); |
|
| 388 | 388 | echo "\t\t<td class='head'> |
| 389 | - " . ($tplset == 'default' && $target_dirname != '_custom' ? "" : "<input name='del_do[{$tplset4disp}]' type='submit' value='"._DELETE."' onclick='return altsys_mytpladmin_check_copy_submit(\""._MYTPLSADMIN_CNF_DELETE_SELECTED_TEMPLATES."\", \"{$tplset4disp}_\", false);' /><br /><br />") . " |
|
| 389 | + " . ($tplset == 'default' && $target_dirname != '_custom' ? "" : "<input name='del_do[{$tplset4disp}]' type='submit' value='"._DELETE."' onclick='return altsys_mytpladmin_check_copy_submit(\""._MYTPLSADMIN_CNF_DELETE_SELECTED_TEMPLATES."\", \"{$tplset4disp}_\", false);' /><br /><br />")." |
|
| 390 | 390 | "._MYTPLSADMIN_CAPTION_COPYTO.": |
| 391 | 391 | <select name='copy_to[{$tplset4disp}]'> |
| 392 | 392 | ".str_replace('<option value=\''.$tplset4disp.'\'>'.$tplset4disp.'</option>', '', $tplset_options)." |
| 393 | 393 | </select> |
| 394 | 394 | <input name='copy_do[{$tplset4disp}]' type='submit' value='"._MYTPLSADMIN_BTN_COPY."' onclick='return altsys_mytpladmin_check_copy_submit(\""._MYTPLSADMIN_CNF_COPY_SELECTED_TEMPLATES."\", \"{$tplset4disp}_\", true);' /> |
| 395 | - </td>\n" ; |
|
| 395 | + </td>\n"; |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | -echo " </tr>\n" ; |
|
| 398 | +echo " </tr>\n"; |
|
| 399 | 399 | |
| 400 | 400 | |
| 401 | -echo "</table></form>" ; |
|
| 401 | +echo "</table></form>"; |
|
| 402 | 402 | // end of table & form |
| 403 | 403 | |
| 404 | -xoops_cp_footer() ; |
|
| 404 | +xoops_cp_footer(); |
|
@@ -5,64 +5,64 @@ discard block |
||
| 5 | 5 | // GIJOE <http://www.peak.ne.jp/> // |
| 6 | 6 | // ------------------------------------------------------------------------- // |
| 7 | 7 | |
| 8 | -require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php' ; |
|
| 9 | -include_once dirname(__FILE__).'/include/gtickets.php' ; |
|
| 10 | -include_once dirname(__FILE__).'/include/altsys_functions.php' ; |
|
| 8 | +require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php'; |
|
| 9 | +include_once dirname(__FILE__).'/include/gtickets.php'; |
|
| 10 | +include_once dirname(__FILE__).'/include/altsys_functions.php'; |
|
| 11 | 11 | |
| 12 | 12 | // check access right (needs module_admin of this module) |
| 13 | -if (! is_object($xoopsUser) || ! is_object($xoopsModule) || ! $xoopsUser->isAdmin($xoopsModule->mid())) { |
|
| 14 | - die('Access Denied') ; |
|
| 13 | +if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) { |
|
| 14 | + die('Access Denied'); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | // initials |
| 19 | -$db =& XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 20 | -(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance() ; |
|
| 19 | +$db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 20 | +(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = & MyTextSanitizer::getInstance(); |
|
| 21 | 21 | |
| 22 | 22 | // language file |
| 23 | -altsys_include_language_file('mypreferences') ; |
|
| 23 | +altsys_include_language_file('mypreferences'); |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | -$op = empty($_GET['op']) ? 'showmod' : preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['op']) ; |
|
| 26 | +$op = empty($_GET['op']) ? 'showmod' : preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['op']); |
|
| 27 | 27 | |
| 28 | 28 | if ($op == 'showmod') { |
| 29 | - $config_handler =& xoops_gethandler('config'); |
|
| 30 | - $mod = $xoopsModule->mid() ; |
|
| 31 | - $config =& $config_handler->getConfigs(new Criteria('conf_modid', $mod)); |
|
| 29 | + $config_handler = & xoops_gethandler('config'); |
|
| 30 | + $mod = $xoopsModule->mid(); |
|
| 31 | + $config = & $config_handler->getConfigs(new Criteria('conf_modid', $mod)); |
|
| 32 | 32 | $count = count($config); |
| 33 | 33 | if ($count < 1) { |
| 34 | - die('no configs') ; |
|
| 34 | + die('no configs'); |
|
| 35 | 35 | } |
| 36 | 36 | include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
| 37 | 37 | $form = new XoopsThemeForm(_MD_A_MYPREFERENCES_FORMTITLE, 'pref_form', 'index.php?mode=admin&lib=altsys&page=mypreferences&op=save'); |
| 38 | - $module_handler =& xoops_gethandler('module'); |
|
| 39 | - $module =& $module_handler->get($mod); |
|
| 38 | + $module_handler = & xoops_gethandler('module'); |
|
| 39 | + $module = & $module_handler->get($mod); |
|
| 40 | 40 | |
| 41 | 41 | // language |
| 42 | - $language = empty($xoopsConfig['language']) ? 'english' : $xoopsConfig['language'] ; |
|
| 42 | + $language = empty($xoopsConfig['language']) ? 'english' : $xoopsConfig['language']; |
|
| 43 | 43 | |
| 44 | 44 | // load modinfo.php if necessary (judged by a specific constant is defined) |
| 45 | - if (! defined('_MYMENU_CONSTANT_IN_MODINFO') || ! defined(_MYMENU_CONSTANT_IN_MODINFO)) { |
|
| 45 | + if (!defined('_MYMENU_CONSTANT_IN_MODINFO') || !defined(_MYMENU_CONSTANT_IN_MODINFO)) { |
|
| 46 | 46 | if (file_exists("$mydirpath/language/$language/modinfo.php")) { |
| 47 | 47 | // user customized language file |
| 48 | - include_once "$mydirpath/language/$language/modinfo.php" ; |
|
| 48 | + include_once "$mydirpath/language/$language/modinfo.php"; |
|
| 49 | 49 | } elseif (file_exists("$mytrustdirpath/language/$language/modinfo.php")) { |
| 50 | 50 | // default language file |
| 51 | - include_once "$mytrustdirpath/language/$language/modinfo.php" ; |
|
| 51 | + include_once "$mytrustdirpath/language/$language/modinfo.php"; |
|
| 52 | 52 | } else { |
| 53 | 53 | // fallback english |
| 54 | - include_once "$mytrustdirpath/language/english/modinfo.php" ; |
|
| 54 | + include_once "$mytrustdirpath/language/english/modinfo.php"; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // if has comments feature, need comment lang file |
| 59 | - if ($module->getVar('hascomments') == 1 && ! defined('_CM_TITLE')) { |
|
| 59 | + if ($module->getVar('hascomments') == 1 && !defined('_CM_TITLE')) { |
|
| 60 | 60 | include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/comment.php'; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // RMV-NOTIFY |
| 64 | 64 | // if has notification feature, need notification lang file |
| 65 | - if ($module->getVar('hasnotification') == 1 && ! defined('_NOT_NOTIFICATIONOPTIONS')) { |
|
| 65 | + if ($module->getVar('hasnotification') == 1 && !defined('_NOT_NOTIFICATIONOPTIONS')) { |
|
| 66 | 66 | include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/notification.php'; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | // $form->addElement(new XoopsFormHidden('redirect', XOOPS_URL.'/modules/'.$module->getVar('dirname').'/'.$module->getInfo('adminindex'))); |
| 73 | 73 | // } |
| 74 | 74 | for ($i = 0; $i < $count; $i++) { |
| 75 | - $title_icon = ($config[$i]->getVar('conf_valuetype') === 'encrypt')? '<img src="'.XOOPS_MODULE_URL.'/legacy/admin/theme/icons/textfield_key.png" alt="Encrypted">' : ''; // support XCL 2.2.3 'encrypt' of 'conf_valuetype' |
|
| 75 | + $title_icon = ($config[$i]->getVar('conf_valuetype') === 'encrypt') ? '<img src="'.XOOPS_MODULE_URL.'/legacy/admin/theme/icons/textfield_key.png" alt="Encrypted">' : ''; // support XCL 2.2.3 'encrypt' of 'conf_valuetype' |
|
| 76 | 76 | $title4tray = (!defined($config[$i]->getVar('conf_desc')) || constant($config[$i]->getVar('conf_desc')) == '') ? (constant($config[$i]->getVar('conf_title')).$title_icon) : (constant($config[$i]->getVar('conf_title')).$title_icon.'<br /><br /><span style="font-weight:normal;">'.constant($config[$i]->getVar('conf_desc')).'</span>'); // GIJ |
| 77 | - $title = '' ; // GIJ |
|
| 77 | + $title = ''; // GIJ |
|
| 78 | 78 | switch ($config[$i]->getVar('conf_formtype')) { |
| 79 | 79 | case 'textarea': |
| 80 | - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance(); |
|
| 80 | + (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = & MyTextSanitizer::getInstance(); |
|
| 81 | 81 | if ($config[$i]->getVar('conf_valuetype') == 'array') { |
| 82 | 82 | // this is exceptional.. only when value type is arrayneed a smarter way for this |
| 83 | 83 | $ele = ($config[$i]->getVar('conf_value') != '') ? new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars(implode('|', $config[$i]->getConfValueForOutput())), 5, 50) : new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), '', 5, 50); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $ele = new XoopsFormRadio($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
| 95 | 95 | $addBr = '<br />'; |
| 96 | 96 | } |
| 97 | - $options =& $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); |
|
| 97 | + $options = & $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); |
|
| 98 | 98 | $opcount = count($options); |
| 99 | 99 | for ($j = 0; $j < $opcount; $j++) { |
| 100 | 100 | $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $ele = new XoopsFormCheckBox($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
| 112 | 112 | $addBr = '<br />'; |
| 113 | 113 | } |
| 114 | - $options =& $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); |
|
| 114 | + $options = & $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); |
|
| 115 | 115 | $opcount = count($options); |
| 116 | 116 | for ($j = 0; $j < $opcount; $j++) { |
| 117 | 117 | $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); |
@@ -145,37 +145,37 @@ discard block |
||
| 145 | 145 | $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true); |
| 146 | 146 | break; |
| 147 | 147 | case 'password': |
| 148 | - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance(); |
|
| 148 | + (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = & MyTextSanitizer::getInstance(); |
|
| 149 | 149 | $ele = new XoopsFormPassword($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput())); |
| 150 | 150 | break; |
| 151 | 151 | case 'textbox': |
| 152 | 152 | default: |
| 153 | - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance(); |
|
| 153 | + (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = & MyTextSanitizer::getInstance(); |
|
| 154 | 154 | $ele = new XoopsFormText($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput())); |
| 155 | 155 | break; |
| 156 | 156 | } |
| 157 | 157 | $hidden = new XoopsFormHidden('conf_ids[]', $config[$i]->getVar('conf_id')); |
| 158 | - $ele_tray = new XoopsFormElementTray($title4tray, '') ; |
|
| 158 | + $ele_tray = new XoopsFormElementTray($title4tray, ''); |
|
| 159 | 159 | $ele_tray->addElement($ele); |
| 160 | 160 | $ele_tray->addElement($hidden); |
| 161 | - $form->addElement($ele_tray) ; |
|
| 161 | + $form->addElement($ele_tray); |
|
| 162 | 162 | unset($ele_tray); |
| 163 | 163 | unset($ele); |
| 164 | 164 | unset($hidden); |
| 165 | 165 | } |
| 166 | 166 | // $button_tray->addElement(new XoopsFormHidden('op', 'save')); |
| 167 | - $xoopsGTicket->addTicketXoopsFormElement($button_tray, __LINE__, 1800, 'mypreferences') ; |
|
| 167 | + $xoopsGTicket->addTicketXoopsFormElement($button_tray, __LINE__, 1800, 'mypreferences'); |
|
| 168 | 168 | $button_tray->addElement(new XoopsFormButton('', 'button', _GO, 'submit')); |
| 169 | - $form->addElement($button_tray) ; |
|
| 169 | + $form->addElement($button_tray); |
|
| 170 | 170 | xoops_cp_header(); |
| 171 | 171 | |
| 172 | 172 | // GIJ patch start |
| 173 | - altsys_include_mymenu() ; |
|
| 174 | - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
| 173 | + altsys_include_mymenu(); |
|
| 174 | + $breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
| 175 | 175 | if ($breadcrumbsObj->hasPaths()) { |
| 176 | - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mypreferences', _PREFERENCES) ; |
|
| 176 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mypreferences', _PREFERENCES); |
|
| 177 | 177 | } |
| 178 | - echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>".$module->getvar('name').' '._PREFERENCES."</h3>\n" ; |
|
| 178 | + echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>".$module->getvar('name').' '._PREFERENCES."</h3>\n"; |
|
| 179 | 179 | // GIJ patch end |
| 180 | 180 | |
| 181 | 181 | $form->display(); |
@@ -187,10 +187,10 @@ discard block |
||
| 187 | 187 | //if ( !admin_refcheck("/modules/$admin_mydirname/admin/") ) { |
| 188 | 188 | // exit('Invalid referer'); |
| 189 | 189 | //} |
| 190 | - if (! $xoopsGTicket->check(true, 'mypreferences')) { |
|
| 190 | + if (!$xoopsGTicket->check(true, 'mypreferences')) { |
|
| 191 | 191 | redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); |
| 192 | 192 | } |
| 193 | - require_once XOOPS_ROOT_PATH.'/class/template.php' ; |
|
| 193 | + require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
| 194 | 194 | $xoopsTpl = new XoopsTpl(); |
| 195 | 195 | //HACK by domifara for new XOOPS and XCL etc. |
| 196 | 196 | //old xoops |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | $lang_updated = false; |
| 211 | 211 | if ($count > 0) { |
| 212 | 212 | for ($i = 0; $i < $count; $i++) { |
| 213 | - $config =& $config_handler->getConfig($conf_ids[$i]); |
|
| 214 | - $new_value =& $_POST[$config->getVar('conf_name')]; |
|
| 213 | + $config = & $config_handler->getConfig($conf_ids[$i]); |
|
| 214 | + $new_value = & $_POST[$config->getVar('conf_name')]; |
|
| 215 | 215 | if (is_array($new_value) || $new_value != $config->getVar('conf_value')) { |
| 216 | 216 | // if language has been changed |
| 217 | 217 | if (!$lang_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'language') { |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | // if default theme has been changed |
| 225 | 225 | if (!$theme_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'theme_set') { |
| 226 | - $member_handler =& xoops_gethandler('member'); |
|
| 226 | + $member_handler = & xoops_gethandler('member'); |
|
| 227 | 227 | $member_handler->updateUsersByField('theme', $_POST[$config->getVar('conf_name')]); |
| 228 | 228 | $theme_updated = true; |
| 229 | 229 | } |
@@ -239,14 +239,14 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | // generate compiled files for the new theme |
| 241 | 241 | // block files only for now.. |
| 242 | - $tplfile_handler =& xoops_gethandler('tplfile'); |
|
| 243 | - $dtemplates =& $tplfile_handler->find('default', 'block'); |
|
| 242 | + $tplfile_handler = & xoops_gethandler('tplfile'); |
|
| 243 | + $dtemplates = & $tplfile_handler->find('default', 'block'); |
|
| 244 | 244 | $dcount = count($dtemplates); |
| 245 | 245 | |
| 246 | 246 | // need to do this to pass to xoops_template_touch function |
| 247 | 247 | $GLOBALS['xoopsConfig']['template_set'] = $newtplset; |
| 248 | 248 | |
| 249 | - altsys_clear_templates_c() ; |
|
| 249 | + altsys_clear_templates_c(); |
|
| 250 | 250 | |
| 251 | 251 | /* for ($i = 0; $i < $dcount; $i++) { |
| 252 | 252 | $found =& $tplfile_handler->find($newtplset, 'block', $dtemplates[$i]->getVar('tpl_refid'), null); |
@@ -260,8 +260,8 @@ discard block |
||
| 260 | 260 | }*/ |
| 261 | 261 | |
| 262 | 262 | // generate image cache files from image binary data, save them under cache/ |
| 263 | - $image_handler =& xoops_gethandler('imagesetimg'); |
|
| 264 | - $imagefiles =& $image_handler->getObjects(new Criteria('tplset_name', $newtplset), true); |
|
| 263 | + $image_handler = & xoops_gethandler('imagesetimg'); |
|
| 264 | + $imagefiles = & $image_handler->getObjects(new Criteria('tplset_name', $newtplset), true); |
|
| 265 | 265 | foreach (array_keys($imagefiles) as $i) { |
| 266 | 266 | if (!$fp = fopen(XOOPS_CACHE_PATH.'/'.$newtplset.'_'.$imagefiles[$i]->getVar('imgsetimg_file'), 'wb')) { |
| 267 | 267 | } else { |
@@ -274,12 +274,12 @@ discard block |
||
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | // add read permission for the start module to all groups |
| 277 | - if (!$startmod_updated && $new_value != '--' && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'startpage') { |
|
| 278 | - $member_handler =& xoops_gethandler('member'); |
|
| 279 | - $groups =& $member_handler->getGroupList(); |
|
| 280 | - $moduleperm_handler =& xoops_gethandler('groupperm'); |
|
| 281 | - $module_handler =& xoops_gethandler('module'); |
|
| 282 | - $module =& $module_handler->getByDirname($new_value); |
|
| 277 | + if (!$startmod_updated && $new_value != '--' && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'startpage') { |
|
| 278 | + $member_handler = & xoops_gethandler('member'); |
|
| 279 | + $groups = & $member_handler->getGroupList(); |
|
| 280 | + $moduleperm_handler = & xoops_gethandler('groupperm'); |
|
| 281 | + $module_handler = & xoops_gethandler('module'); |
|
| 282 | + $module = & $module_handler->getByDirname($new_value); |
|
| 283 | 283 | foreach ($groups as $groupid => $groupname) { |
| 284 | 284 | if (!$moduleperm_handler->checkRight('module_read', $module->getVar('mid'), $groupid)) { |
| 285 | 285 | $moduleperm_handler->addRight('module_read', $module->getVar('mid'), $groupid); |
@@ -295,5 +295,5 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - redirect_header('index.php?mode=admin&lib=altsys&page=mypreferences', 2, _MD_A_MYPREFERENCES_UPDATED) ; |
|
| 298 | + redirect_header('index.php?mode=admin&lib=altsys&page=mypreferences', 2, _MD_A_MYPREFERENCES_UPDATED); |
|
| 299 | 299 | } |
@@ -5,37 +5,37 @@ discard block |
||
| 5 | 5 | // GIJOE <http://www.peak.ne.jp/> // |
| 6 | 6 | // ------------------------------------------------------------------------- // |
| 7 | 7 | |
| 8 | -error_reporting(0) ; |
|
| 8 | +error_reporting(0); |
|
| 9 | 9 | |
| 10 | -include_once dirname(__FILE__).'/include/gtickets.php' ; |
|
| 11 | -include_once dirname(__FILE__).'/include/altsys_functions.php' ; |
|
| 10 | +include_once dirname(__FILE__).'/include/gtickets.php'; |
|
| 11 | +include_once dirname(__FILE__).'/include/altsys_functions.php'; |
|
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | // this page can be called only from altsys |
| 15 | 15 | if ($xoopsModule->getVar('dirname') != 'altsys') { |
| 16 | - die('this page can be called only from altsys') ; |
|
| 16 | + die('this page can be called only from altsys'); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | // language file |
| 21 | -altsys_include_language_file('compilehookadmin') ; |
|
| 21 | +altsys_include_language_file('compilehookadmin'); |
|
| 22 | 22 | |
| 23 | -if (! empty($_POST['download_zip'])) { |
|
| 24 | - require_once XOOPS_ROOT_PATH.'/class/zipdownloader.php' ; |
|
| 23 | +if (!empty($_POST['download_zip'])) { |
|
| 24 | + require_once XOOPS_ROOT_PATH.'/class/zipdownloader.php'; |
|
| 25 | 25 | $downloader = new XoopsZipDownloader(); |
| 26 | - $do_download = true ; |
|
| 27 | -} elseif (! empty($_POST['download_tgz'])) { |
|
| 28 | - require_once XOOPS_ROOT_PATH.'/class/tardownloader.php' ; |
|
| 26 | + $do_download = true; |
|
| 27 | +} elseif (!empty($_POST['download_tgz'])) { |
|
| 28 | + require_once XOOPS_ROOT_PATH.'/class/tardownloader.php'; |
|
| 29 | 29 | $downloader = new XoopsTarDownloader(); |
| 30 | - $do_download = true ; |
|
| 30 | + $do_download = true; |
|
| 31 | 31 | } |
| 32 | 32 | if (empty($do_download)) { |
| 33 | - exit ; |
|
| 33 | + exit; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | -$tplset = @$_POST['tplset'] ; |
|
| 37 | -if (! preg_match('/^[0-9A-Za-z_-]{1,16}$/', $tplset)) { |
|
| 38 | - die(_TPLSADMIN_ERR_INVALIDTPLSET) ; |
|
| 36 | +$tplset = @$_POST['tplset']; |
|
| 37 | +if (!preg_match('/^[0-9A-Za-z_-]{1,16}$/', $tplset)) { |
|
| 38 | + die(_TPLSADMIN_ERR_INVALIDTPLSET); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | //fix for mb_http_output setting and for add any browsers |
@@ -45,17 +45,17 @@ discard block |
||
| 45 | 45 | //ob_buffer over flow |
| 46 | 46 | //HACK by suin & nao-pon 2012/01/06 |
| 47 | 47 | while (ob_get_level() > 0) { |
| 48 | - if (! ob_end_clean()) { |
|
| 48 | + if (!ob_end_clean()) { |
|
| 49 | 49 | break; |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | -$trs = $xoopsDB->query("SELECT distinct tpl_file,tpl_source,tpl_lastmodified FROM ".$xoopsDB->prefix("tplfile")." NATURAL LEFT JOIN ".$xoopsDB->prefix("tplsource")." WHERE tpl_tplset='".addslashes($tplset)."' ORDER BY tpl_file") ; |
|
| 52 | +$trs = $xoopsDB->query("SELECT distinct tpl_file,tpl_source,tpl_lastmodified FROM ".$xoopsDB->prefix("tplfile")." NATURAL LEFT JOIN ".$xoopsDB->prefix("tplsource")." WHERE tpl_tplset='".addslashes($tplset)."' ORDER BY tpl_file"); |
|
| 53 | 53 | if ($xoopsDB->getRowsNum($trs) <= 0) { |
| 54 | - die(_TPLSADMIN_ERR_INVALIDTPLSET) ; |
|
| 54 | + die(_TPLSADMIN_ERR_INVALIDTPLSET); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | while (list($tpl_file, $tpl_source, $tpl_lastmodified) = $xoopsDB->fetchRow($trs)) { |
| 58 | - $downloader->addFileData($tpl_source, $tplset.'/'.$tpl_file, $tpl_lastmodified) ; |
|
| 58 | + $downloader->addFileData($tpl_source, $tplset.'/'.$tpl_file, $tpl_lastmodified); |
|
| 59 | 59 | } |
| 60 | 60 | //bugfix by nao-pon ,echo is not necessary for downloader |
| 61 | -$downloader->download('template_'.$tplset, true) ; |
|
| 61 | +$downloader->download('template_'.$tplset, true); |
|
@@ -1,46 +1,46 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -altsys_set_module_config() ; |
|
| 3 | +altsys_set_module_config(); |
|
| 4 | 4 | |
| 5 | 5 | function altsys_set_module_config() |
| 6 | 6 | { |
| 7 | - global $altsysModuleConfig , $altsysModuleId ; |
|
| 7 | + global $altsysModuleConfig, $altsysModuleId; |
|
| 8 | 8 | |
| 9 | - $module_handler =& xoops_gethandler('module') ; |
|
| 10 | - $module =& $module_handler->getByDirname('altsys') ; |
|
| 9 | + $module_handler = & xoops_gethandler('module'); |
|
| 10 | + $module = & $module_handler->getByDirname('altsys'); |
|
| 11 | 11 | if (is_object($module)) { |
| 12 | - $config_handler =& xoops_gethandler('config') ; |
|
| 13 | - $altsysModuleConfig = $config_handler->getConfigList($module->getVar('mid')) ; |
|
| 14 | - $altsysModuleId = $module->getVar('mid') ; |
|
| 12 | + $config_handler = & xoops_gethandler('config'); |
|
| 13 | + $altsysModuleConfig = $config_handler->getConfigList($module->getVar('mid')); |
|
| 14 | + $altsysModuleId = $module->getVar('mid'); |
|
| 15 | 15 | } else { |
| 16 | - $altsysModuleConfig = array() ; |
|
| 17 | - $altsysModuleId = 0 ; |
|
| 16 | + $altsysModuleConfig = array(); |
|
| 17 | + $altsysModuleId = 0; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // for RTL users |
| 21 | - @define('_GLOBAL_LEFT', @_ADM_USE_RTL == 1 ? 'right' : 'left') ; |
|
| 22 | - @define('_GLOBAL_RIGHT', @_ADM_USE_RTL == 1 ? 'left' : 'right') ; |
|
| 21 | + @define('_GLOBAL_LEFT', @_ADM_USE_RTL == 1 ? 'right' : 'left'); |
|
| 22 | + @define('_GLOBAL_RIGHT', @_ADM_USE_RTL == 1 ? 'left' : 'right'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | function altsys_include_mymenu() |
| 27 | 27 | { |
| 28 | - global $xoopsModule , $xoopsConfig , $mydirname , $mydirpath , $mytrustdirname , $mytrustdirpath , $mymenu_fake_uri ; |
|
| 28 | + global $xoopsModule, $xoopsConfig, $mydirname, $mydirpath, $mytrustdirname, $mytrustdirpath, $mymenu_fake_uri; |
|
| 29 | 29 | |
| 30 | 30 | $mymenu_find_paths = array( |
| 31 | - $mydirpath.'/admin/mymenu.php' , |
|
| 32 | - $mydirpath.'/mymenu.php' , |
|
| 33 | - $mytrustdirpath.'/admin/mymenu.php' , |
|
| 34 | - $mytrustdirpath.'/mymenu.php' , |
|
| 35 | - ) ; |
|
| 31 | + $mydirpath.'/admin/mymenu.php', |
|
| 32 | + $mydirpath.'/mymenu.php', |
|
| 33 | + $mytrustdirpath.'/admin/mymenu.php', |
|
| 34 | + $mytrustdirpath.'/mymenu.php', |
|
| 35 | + ); |
|
| 36 | 36 | |
| 37 | 37 | foreach ($mymenu_find_paths as $mymenu_find_path) { |
| 38 | 38 | if (file_exists($mymenu_find_path)) { |
| 39 | - include $mymenu_find_path ; |
|
| 40 | - include_once dirname(__FILE__).'/adminmenu_functions.php' ; |
|
| 41 | - altsys_adminmenu_insert_mymenu($xoopsModule) ; |
|
| 42 | - altsys_adminmenu_hack_ft() ; |
|
| 43 | - break ; |
|
| 39 | + include $mymenu_find_path; |
|
| 40 | + include_once dirname(__FILE__).'/adminmenu_functions.php'; |
|
| 41 | + altsys_adminmenu_insert_mymenu($xoopsModule); |
|
| 42 | + altsys_adminmenu_hack_ft(); |
|
| 43 | + break; |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -48,58 +48,58 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | function altsys_include_language_file($type) |
| 50 | 50 | { |
| 51 | - $mylang = $GLOBALS['xoopsConfig']['language'] ; |
|
| 51 | + $mylang = $GLOBALS['xoopsConfig']['language']; |
|
| 52 | 52 | |
| 53 | 53 | if (file_exists(XOOPS_ROOT_PATH.'/modules/altsys/language/'.$mylang.'/'.$type.'.php')) { |
| 54 | - include_once XOOPS_ROOT_PATH.'/modules/altsys/language/'.$mylang.'/'.$type.'.php' ; |
|
| 54 | + include_once XOOPS_ROOT_PATH.'/modules/altsys/language/'.$mylang.'/'.$type.'.php'; |
|
| 55 | 55 | } elseif (file_exists(XOOPS_TRUST_PATH.'/libs/altsys/language/'.$mylang.'/'.$type.'.php')) { |
| 56 | - include_once XOOPS_TRUST_PATH.'/libs/altsys/language/'.$mylang.'/'.$type.'.php' ; |
|
| 56 | + include_once XOOPS_TRUST_PATH.'/libs/altsys/language/'.$mylang.'/'.$type.'.php'; |
|
| 57 | 57 | } elseif (file_exists(XOOPS_ROOT_PATH.'/modules/altsys/language/english/'.$type.'.php')) { |
| 58 | - include_once XOOPS_ROOT_PATH.'/modules/altsys/language/english/'.$type.'.php' ; |
|
| 58 | + include_once XOOPS_ROOT_PATH.'/modules/altsys/language/english/'.$type.'.php'; |
|
| 59 | 59 | } elseif (file_exists(XOOPS_TRUST_PATH.'/libs/altsys/language/english/'.$type.'.php')) { |
| 60 | - include_once XOOPS_TRUST_PATH.'/libs/altsys/language/english/'.$type.'.php' ; |
|
| 60 | + include_once XOOPS_TRUST_PATH.'/libs/altsys/language/english/'.$type.'.php'; |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
| 65 | -define('ALTSYS_CORE_TYPE_X20', 1) ; // 2.0.0-2.0.13 and 2.0.x-JP |
|
| 66 | -define('ALTSYS_CORE_TYPE_X20S', 2) ; // 2.0.14- from xoops.org (Skalpa's S) |
|
| 67 | -define('ALTSYS_CORE_TYPE_ORE', 4) ; // ORETEKI by marijuana |
|
| 68 | -define('ALTSYS_CORE_TYPE_X22', 8) ; // 2.2 from xoops.org |
|
| 69 | -define('ALTSYS_CORE_TYPE_X23P', 10) ; // 2.3 from xoops.org (phppp's P) |
|
| 70 | -define('ALTSYS_CORE_TYPE_X25', 11) ; // 2.5 from xoops.org |
|
| 71 | -define('ALTSYS_CORE_TYPE_ICMS', 12) ; // ImpressCMS |
|
| 72 | -define('ALTSYS_CORE_TYPE_XCL21', 16) ; // XOOPS Cube 2.1 Legacy |
|
| 65 | +define('ALTSYS_CORE_TYPE_X20', 1); // 2.0.0-2.0.13 and 2.0.x-JP |
|
| 66 | +define('ALTSYS_CORE_TYPE_X20S', 2); // 2.0.14- from xoops.org (Skalpa's S) |
|
| 67 | +define('ALTSYS_CORE_TYPE_ORE', 4); // ORETEKI by marijuana |
|
| 68 | +define('ALTSYS_CORE_TYPE_X22', 8); // 2.2 from xoops.org |
|
| 69 | +define('ALTSYS_CORE_TYPE_X23P', 10); // 2.3 from xoops.org (phppp's P) |
|
| 70 | +define('ALTSYS_CORE_TYPE_X25', 11); // 2.5 from xoops.org |
|
| 71 | +define('ALTSYS_CORE_TYPE_ICMS', 12); // ImpressCMS |
|
| 72 | +define('ALTSYS_CORE_TYPE_XCL21', 16); // XOOPS Cube 2.1 Legacy |
|
| 73 | 73 | |
| 74 | 74 | function altsys_get_core_type() |
| 75 | 75 | { |
| 76 | - static $result = null ; |
|
| 76 | + static $result = null; |
|
| 77 | 77 | |
| 78 | 78 | if (empty($result)) { |
| 79 | 79 | if (defined('XOOPS_ORETEKI')) { |
| 80 | - $result = ALTSYS_CORE_TYPE_ORE ; |
|
| 80 | + $result = ALTSYS_CORE_TYPE_ORE; |
|
| 81 | 81 | } elseif (defined('XOOPS_CUBE_LEGACY')) { |
| 82 | - $result = ALTSYS_CORE_TYPE_XCL21 ; |
|
| 82 | + $result = ALTSYS_CORE_TYPE_XCL21; |
|
| 83 | 83 | } elseif (defined('ICMS_VERSION_NAME')) { |
| 84 | - $result = ALTSYS_CORE_TYPE_ICMS ; |
|
| 84 | + $result = ALTSYS_CORE_TYPE_ICMS; |
|
| 85 | 85 | } elseif (strstr(XOOPS_VERSION, 'JP')) { |
| 86 | - $result = ALTSYS_CORE_TYPE_X20 ; |
|
| 86 | + $result = ALTSYS_CORE_TYPE_X20; |
|
| 87 | 87 | } else { |
| 88 | - $versions = array_map('intval', explode('.', preg_replace('/[^0-9.]/', '', XOOPS_VERSION))) ; |
|
| 88 | + $versions = array_map('intval', explode('.', preg_replace('/[^0-9.]/', '', XOOPS_VERSION))); |
|
| 89 | 89 | if ($versions[0] == 2 && $versions[1] == 2) { |
| 90 | - $result = ALTSYS_CORE_TYPE_X22 ; |
|
| 90 | + $result = ALTSYS_CORE_TYPE_X22; |
|
| 91 | 91 | } elseif ($versions[0] == 2 && $versions[1] == 0 && $versions[2] > 13) { |
| 92 | - $result = ALTSYS_CORE_TYPE_X20S ; |
|
| 92 | + $result = ALTSYS_CORE_TYPE_X20S; |
|
| 93 | 93 | } elseif ($versions[0] == 2 && $versions[1] >= 5) { |
| 94 | - $result = ALTSYS_CORE_TYPE_X25 ; |
|
| 94 | + $result = ALTSYS_CORE_TYPE_X25; |
|
| 95 | 95 | } elseif ($versions[0] == 2 && $versions[1] > 2) { |
| 96 | - $result = ALTSYS_CORE_TYPE_X23P ; |
|
| 96 | + $result = ALTSYS_CORE_TYPE_X23P; |
|
| 97 | 97 | } else { |
| 98 | - $result = ALTSYS_CORE_TYPE_X20 ; |
|
| 98 | + $result = ALTSYS_CORE_TYPE_X20; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | - return $result ; |
|
| 102 | + return $result; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -113,36 +113,36 @@ discard block |
||
| 113 | 113 | case ALTSYS_CORE_TYPE_X23P : |
| 114 | 114 | case ALTSYS_CORE_TYPE_ICMS : |
| 115 | 115 | default : |
| 116 | - return XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mid ; |
|
| 116 | + return XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mid; |
|
| 117 | 117 | case ALTSYS_CORE_TYPE_XCL21 : |
| 118 | - return XOOPS_URL.'/modules/legacy/admin/index.php?action=PreferenceEdit&confmod_id='.$mid ; |
|
| 118 | + return XOOPS_URL.'/modules/legacy/admin/index.php?action=PreferenceEdit&confmod_id='.$mid; |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | function altsys_template_touch($tpl_id) |
| 124 | 124 | { |
| 125 | - if (in_array(altsys_get_core_type(), array( ALTSYS_CORE_TYPE_X20S, ALTSYS_CORE_TYPE_X23P, ALTSYS_CORE_TYPE_X25 ))) { |
|
| 125 | + if (in_array(altsys_get_core_type(), array(ALTSYS_CORE_TYPE_X20S, ALTSYS_CORE_TYPE_X23P, ALTSYS_CORE_TYPE_X25))) { |
|
| 126 | 126 | // need to delete all files under templates_c/ |
| 127 | - altsys_clear_templates_c() ; |
|
| 127 | + altsys_clear_templates_c(); |
|
| 128 | 128 | } else { |
| 129 | 129 | // just touch the template |
| 130 | - xoops_template_touch($tpl_id) ; |
|
| 130 | + xoops_template_touch($tpl_id); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | function altsys_clear_templates_c() |
| 136 | 136 | { |
| 137 | - $dh = opendir(XOOPS_COMPILE_PATH) ; |
|
| 137 | + $dh = opendir(XOOPS_COMPILE_PATH); |
|
| 138 | 138 | while ($file = readdir($dh)) { |
| 139 | 139 | if (substr($file, 0, 1) == '.') { |
| 140 | - continue ; |
|
| 140 | + continue; |
|
| 141 | 141 | } |
| 142 | 142 | if (substr($file, -4) != '.php') { |
| 143 | - continue ; |
|
| 143 | + continue; |
|
| 144 | 144 | } |
| 145 | - @unlink(XOOPS_COMPILE_PATH.'/'.$file) ; |
|
| 145 | + @unlink(XOOPS_COMPILE_PATH.'/'.$file); |
|
| 146 | 146 | } |
| 147 | - closedir($dh) ; |
|
| 147 | + closedir($dh); |
|
| 148 | 148 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
| 30 | 30 | // ------------------------------------------------------------------------ // |
| 31 | 31 | |
| 32 | -require_once dirname(dirname(__FILE__)).'/class/AltsysBreadcrumbs.class.php' ; |
|
| 32 | +require_once dirname(dirname(__FILE__)).'/class/AltsysBreadcrumbs.class.php'; |
|
| 33 | 33 | include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; |
| 34 | 34 | |
| 35 | 35 | $xoopsOption['theme_use_smarty'] = 1; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | $xoopsTpl->assign(array('xoops_theme' => $xoopsConfig['theme_set'], 'xoops_imageurl' => XOOPS_THEME_URL.'/'.$xoopsConfig['theme_set'].'/', 'xoops_themecss'=> xoops_getcss($xoopsConfig['theme_set']), 'xoops_requesturi' => htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES), 'xoops_sitename' => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES), 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES))); |
| 44 | 44 | // Meta tags |
| 45 | - $config_handler =& xoops_gethandler('config'); |
|
| 45 | + $config_handler = & xoops_gethandler('config'); |
|
| 46 | 46 | $criteria = new CriteriaCompo(new Criteria('conf_modid', 0)); |
| 47 | 47 | $criteria->add(new Criteria('conf_catid', XOOPS_CONF_METAFOOTER)); |
| 48 | 48 | $config = $config_handler->getConfigs($criteria, true); |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | //HACK by domifara |
| 59 | 59 | if (defined('XOOPS_CUBE_LEGACY')) { |
| 60 | - $handler =& xoops_gethandler('block'); |
|
| 61 | - $xoopsblock =& $handler->create(false) ; |
|
| 60 | + $handler = & xoops_gethandler('block'); |
|
| 61 | + $xoopsblock = & $handler->create(false); |
|
| 62 | 62 | } else { |
| 63 | 63 | $xoopsblock = new XoopsBlock(); |
| 64 | 64 | } |
@@ -68,46 +68,46 @@ discard block |
||
| 68 | 68 | if (is_object($xoopsUser)) { |
| 69 | 69 | $xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUserIsAdmin)); |
| 70 | 70 | if (is_object(@$xoopsModule)) { |
| 71 | - if ($xoopsModule->getVar('mid') == 1 && @$_GET["fct"] == "preferences" && @$_GET["op"] == "showmod" && ! empty($_GET["mod"])) { |
|
| 72 | - $module_handler =& xoops_gethandler('module') ; |
|
| 73 | - $target_module = $module_handler->get(intval($_GET["mod"])) ; |
|
| 71 | + if ($xoopsModule->getVar('mid') == 1 && @$_GET["fct"] == "preferences" && @$_GET["op"] == "showmod" && !empty($_GET["mod"])) { |
|
| 72 | + $module_handler = & xoops_gethandler('module'); |
|
| 73 | + $target_module = $module_handler->get(intval($_GET["mod"])); |
|
| 74 | 74 | } else { |
| 75 | - $target_module =& $xoopsModule ; |
|
| 75 | + $target_module = & $xoopsModule; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // set page title |
| 79 | 79 | $xoopsTpl->assign(array('xoops_pagetitle' => $target_module->getVar('name'), 'xoops_modulename' => $target_module->getVar('name'), 'xoops_dirname' => $target_module->getVar('dirname'))); |
| 80 | 80 | |
| 81 | 81 | // xoops_breadcrumbs |
| 82 | - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
| 82 | + $breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
| 83 | 83 | if ($breadcrumbsObj->hasPaths()) { |
| 84 | - $xoops_breadcrumbs = $breadcrumbsObj->getXoopsbreadcrumbs() ; |
|
| 84 | + $xoops_breadcrumbs = $breadcrumbsObj->getXoopsbreadcrumbs(); |
|
| 85 | 85 | } else { |
| 86 | - $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname') ; |
|
| 87 | - $mod_path = XOOPS_ROOT_PATH.'/modules/'.$target_module->getVar('dirname') ; |
|
| 88 | - $modinfo = $target_module->getInfo() ; |
|
| 89 | - $xoops_breadcrumbs = array() ; |
|
| 90 | - if (! empty($modinfo['hasMain'])) { |
|
| 86 | + $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname'); |
|
| 87 | + $mod_path = XOOPS_ROOT_PATH.'/modules/'.$target_module->getVar('dirname'); |
|
| 88 | + $modinfo = $target_module->getInfo(); |
|
| 89 | + $xoops_breadcrumbs = array(); |
|
| 90 | + if (!empty($modinfo['hasMain'])) { |
|
| 91 | 91 | $xoops_breadcrumbs[] = array( |
| 92 | - 'url' => $mod_url.'/' , |
|
| 93 | - 'name' => sprintf(_MD_A_AINTHEME_FMT_PUBLICTOP, $target_module->getVar('name')) , |
|
| 94 | - ) ; |
|
| 92 | + 'url' => $mod_url.'/', |
|
| 93 | + 'name' => sprintf(_MD_A_AINTHEME_FMT_PUBLICTOP, $target_module->getVar('name')), |
|
| 94 | + ); |
|
| 95 | 95 | } |
| 96 | - if (! empty($modinfo['adminindex'])) { |
|
| 96 | + if (!empty($modinfo['adminindex'])) { |
|
| 97 | 97 | $xoops_breadcrumbs[] = array( |
| 98 | - 'url' => $mod_url.'/'.$modinfo['adminindex'] , |
|
| 99 | - 'name' => sprintf(_MD_A_AINTHEME_FMT_ADMINTOP, $target_module->getVar('name')) , |
|
| 100 | - ) ; |
|
| 98 | + 'url' => $mod_url.'/'.$modinfo['adminindex'], |
|
| 99 | + 'name' => sprintf(_MD_A_AINTHEME_FMT_ADMINTOP, $target_module->getVar('name')), |
|
| 100 | + ); |
|
| 101 | 101 | } |
| 102 | - if (! empty($GLOBALS['altsysAdminPageTitle'])) { |
|
| 103 | - $xoops_breadcrumbs[] = array( 'name' => htmlspecialchars($GLOBALS['altsysAdminPageTitle'], ENT_QUOTES) ) ; |
|
| 104 | - } elseif (! empty($modinfo['adminmenu'])) { |
|
| 105 | - @include $mod_path.'/'.$modinfo['adminmenu'] ; |
|
| 102 | + if (!empty($GLOBALS['altsysAdminPageTitle'])) { |
|
| 103 | + $xoops_breadcrumbs[] = array('name' => htmlspecialchars($GLOBALS['altsysAdminPageTitle'], ENT_QUOTES)); |
|
| 104 | + } elseif (!empty($modinfo['adminmenu'])) { |
|
| 105 | + @include $mod_path.'/'.$modinfo['adminmenu']; |
|
| 106 | 106 | if (is_array(@$adminmenu)) { |
| 107 | 107 | foreach ($adminmenu as $eachmenu) { |
| 108 | 108 | if (strstr($_SERVER['REQUEST_URI'], $eachmenu['link'])) { |
| 109 | - $xoops_breadcrumbs[] = array( 'name' => $eachmenu['title'] ) ; |
|
| 110 | - break ; |
|
| 109 | + $xoops_breadcrumbs[] = array('name' => $eachmenu['title']); |
|
| 110 | + break; |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -116,51 +116,51 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | //$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), $target_module->getVar('mid'), false, XOOPS_BLOCK_VISIBLE); |
| 118 | 118 | } else { |
| 119 | - $xoopsTpl->assign(array( 'xoops_pagetitle' => _CPHOME )) ; |
|
| 119 | + $xoopsTpl->assign(array('xoops_pagetitle' => _CPHOME)); |
|
| 120 | 120 | $xoops_breadcrumbs = array( |
| 121 | 121 | array( |
| 122 | - 'url' => XOOPS_URL.'/admin.php' , |
|
| 123 | - 'name' => _CPHOME , |
|
| 122 | + 'url' => XOOPS_URL.'/admin.php', |
|
| 123 | + 'name' => _CPHOME, |
|
| 124 | 124 | ) |
| 125 | - ) ; |
|
| 125 | + ); |
|
| 126 | 126 | } |
| 127 | 127 | } else { |
| 128 | - exit ; |
|
| 128 | + exit; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // get block_arr |
| 132 | - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; |
|
| 133 | - $sql = "SELECT DISTINCT gperm_itemid FROM ".$db->prefix('group_permission')." WHERE gperm_name = 'block_read' AND gperm_modid = 1 AND gperm_groupid IN (".implode(',', $xoopsUser->getGroups()).")" ; |
|
| 132 | + $db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 133 | + $sql = "SELECT DISTINCT gperm_itemid FROM ".$db->prefix('group_permission')." WHERE gperm_name = 'block_read' AND gperm_modid = 1 AND gperm_groupid IN (".implode(',', $xoopsUser->getGroups()).")"; |
|
| 134 | 134 | $result = $db->query($sql); |
| 135 | 135 | |
| 136 | 136 | $blockids = array(); |
| 137 | 137 | while (list($blockid) = $db->fetchRow($result)) { |
| 138 | - $blockids[] = intval($blockid) ; |
|
| 138 | + $blockids[] = intval($blockid); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - global $block_arr , $i ; // for piCal :-) |
|
| 142 | - $block_arr = array() ; |
|
| 141 | + global $block_arr, $i; // for piCal :-) |
|
| 142 | + $block_arr = array(); |
|
| 143 | 143 | if (!empty($blockids)) { |
| 144 | - $sql = 'SELECT b.* FROM '.$db->prefix('newblocks').' b, '.$db->prefix('block_module_link').' m WHERE m.block_id=b.bid AND b.isactive=1 AND b.visible=1 AND m.module_id='.intval($altsysModuleId).' AND b.bid IN ('.implode(',', $blockids).') ORDER BY b.weight,b.bid' ; |
|
| 144 | + $sql = 'SELECT b.* FROM '.$db->prefix('newblocks').' b, '.$db->prefix('block_module_link').' m WHERE m.block_id=b.bid AND b.isactive=1 AND b.visible=1 AND m.module_id='.intval($altsysModuleId).' AND b.bid IN ('.implode(',', $blockids).') ORDER BY b.weight,b.bid'; |
|
| 145 | 145 | $result = $db->query($sql); |
| 146 | 146 | while ($myrow = $db->fetchArray($result)) { |
| 147 | 147 | |
| 148 | 148 | //HACK by domifara |
| 149 | 149 | if (defined('XOOPS_CUBE_LEGACY')) { |
| 150 | - $block =& $handler->create(false) ; |
|
| 150 | + $block = & $handler->create(false); |
|
| 151 | 151 | $block->assignVars($myrow); |
| 152 | 152 | } else { |
| 153 | - $block = new XoopsBlock($myrow) ; |
|
| 153 | + $block = new XoopsBlock($myrow); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - $block_arr[ $myrow['bid'] ] = $block ; |
|
| 156 | + $block_arr[$myrow['bid']] = $block; |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - $adminmenublock_exists = false ; |
|
| 160 | + $adminmenublock_exists = false; |
|
| 161 | 161 | foreach (array_keys($block_arr) as $i) { |
| 162 | 162 | if ($block_arr[$i]->getVar('show_func') == 'b_altsys_admin_menu_show') { |
| 163 | - $adminmenublock_exists = true ; |
|
| 163 | + $adminmenublock_exists = true; |
|
| 164 | 164 | } |
| 165 | 165 | $bcachetime = $block_arr[$i]->getVar('bcachetime'); |
| 166 | 166 | if (empty($bcachetime)) { |
@@ -241,15 +241,15 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // FALLBACK inserting admin_menu_block in admin side |
| 244 | - if (! $adminmenublock_exists) { |
|
| 245 | - require_once XOOPS_ROOT_PATH.'/modules/altsys/blocks/blocks.php' ; |
|
| 246 | - $admin_menu_block = array( b_altsys_admin_menu_show(array( 'altsys' )) ) ; |
|
| 247 | - $admin_menu_block[0]['title'] = 'Admin Menu' ; |
|
| 248 | - $lblocks = $xoopsTpl->get_template_vars('xoops_lblocks') ; |
|
| 249 | - if (! is_array($lblocks)) { |
|
| 250 | - $lblocks = array() ; |
|
| 244 | + if (!$adminmenublock_exists) { |
|
| 245 | + require_once XOOPS_ROOT_PATH.'/modules/altsys/blocks/blocks.php'; |
|
| 246 | + $admin_menu_block = array(b_altsys_admin_menu_show(array('altsys'))); |
|
| 247 | + $admin_menu_block[0]['title'] = 'Admin Menu'; |
|
| 248 | + $lblocks = $xoopsTpl->get_template_vars('xoops_lblocks'); |
|
| 249 | + if (!is_array($lblocks)) { |
|
| 250 | + $lblocks = array(); |
|
| 251 | 251 | } |
| 252 | - $xoopsTpl->assign('xoops_lblocks', array_merge($admin_menu_block, $lblocks)) ; |
|
| 252 | + $xoopsTpl->assign('xoops_lblocks', array_merge($admin_menu_block, $lblocks)); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | //unset($block_arr); |