@@ -76,83 +76,83 @@ |
||
| 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 | 77 | $title = '' ; // GIJ |
| 78 | 78 | switch ($config[$i]->getVar('conf_formtype')) { |
| 79 | - case 'textarea': |
|
| 80 | - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
| 81 | - if ($config[$i]->getVar('conf_valuetype') == 'array') { |
|
| 82 | - // this is exceptional.. only when value type is arrayneed a smarter way for this |
|
| 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); |
|
| 84 | - } else { |
|
| 85 | - $ele = new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput()), 5, 50); |
|
| 86 | - } |
|
| 87 | - break; |
|
| 88 | - case 'select': |
|
| 89 | - case 'radio': |
|
| 90 | - if ($config[$i]->getVar('conf_formtype') === 'select') { |
|
| 91 | - $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
|
| 92 | - $addBr = ''; |
|
| 93 | - } else { |
|
| 94 | - $ele = new XoopsFormRadio($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
|
| 95 | - $addBr = '<br />'; |
|
| 96 | - } |
|
| 97 | - $options = $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); |
|
| 98 | - $opcount = count($options); |
|
| 99 | - for ($j = 0; $j < $opcount; $j++) { |
|
| 100 | - $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); |
|
| 101 | - $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); |
|
| 102 | - $ele->addOption($optval, $optkey.$addBr); |
|
| 103 | - } |
|
| 104 | - break; |
|
| 105 | - case 'select_multi': |
|
| 106 | - case 'checkbox': |
|
| 107 | - if ($config[$i]->getVar('conf_formtype') === 'select_multi') { |
|
| 108 | - $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true); |
|
| 109 | - $addBr = ''; |
|
| 110 | - } else { |
|
| 111 | - $ele = new XoopsFormCheckBox($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
|
| 112 | - $addBr = '<br />'; |
|
| 113 | - } |
|
| 114 | - $options = $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); |
|
| 115 | - $opcount = count($options); |
|
| 116 | - for ($j = 0; $j < $opcount; $j++) { |
|
| 117 | - $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); |
|
| 118 | - $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); |
|
| 79 | + case 'textarea': |
|
| 80 | + (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
| 81 | + if ($config[$i]->getVar('conf_valuetype') == 'array') { |
|
| 82 | + // this is exceptional.. only when value type is arrayneed a smarter way for this |
|
| 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); |
|
| 84 | + } else { |
|
| 85 | + $ele = new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput()), 5, 50); |
|
| 86 | + } |
|
| 87 | + break; |
|
| 88 | + case 'select': |
|
| 89 | + case 'radio': |
|
| 90 | + if ($config[$i]->getVar('conf_formtype') === 'select') { |
|
| 91 | + $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
|
| 92 | + $addBr = ''; |
|
| 93 | + } else { |
|
| 94 | + $ele = new XoopsFormRadio($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
|
| 95 | + $addBr = '<br />'; |
|
| 96 | + } |
|
| 97 | + $options = $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); |
|
| 98 | + $opcount = count($options); |
|
| 99 | + for ($j = 0; $j < $opcount; $j++) { |
|
| 100 | + $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); |
|
| 101 | + $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); |
|
| 102 | + $ele->addOption($optval, $optkey.$addBr); |
|
| 103 | + } |
|
| 104 | + break; |
|
| 105 | + case 'select_multi': |
|
| 106 | + case 'checkbox': |
|
| 107 | + if ($config[$i]->getVar('conf_formtype') === 'select_multi') { |
|
| 108 | + $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true); |
|
| 109 | + $addBr = ''; |
|
| 110 | + } else { |
|
| 111 | + $ele = new XoopsFormCheckBox($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
|
| 112 | + $addBr = '<br />'; |
|
| 113 | + } |
|
| 114 | + $options = $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); |
|
| 115 | + $opcount = count($options); |
|
| 116 | + for ($j = 0; $j < $opcount; $j++) { |
|
| 117 | + $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); |
|
| 118 | + $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); |
|
| 119 | 119 | |
| 120 | - $ele->addOption($optval, $optkey.$addBr); |
|
| 121 | - } |
|
| 122 | - break; |
|
| 123 | - case 'yesno': |
|
| 124 | - $ele = new XoopsFormRadioYN($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), _YES, _NO); |
|
| 125 | - break; |
|
| 126 | - case 'group': |
|
| 127 | - include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 128 | - $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false); |
|
| 129 | - break; |
|
| 130 | - case 'group_multi': |
|
| 131 | - include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 132 | - $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true); |
|
| 133 | - break; |
|
| 134 | - case 'group_checkbox': |
|
| 135 | - include_once __DIR__.'/include/formcheckboxgroup.php'; |
|
| 136 | - $ele = new AltsysFormCheckboxGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput()); |
|
| 137 | - break; |
|
| 138 | - // RMV-NOTIFY: added 'user' and 'user_multi' |
|
| 139 | - case 'user': |
|
| 140 | - include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 141 | - $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false); |
|
| 142 | - break; |
|
| 143 | - case 'user_multi': |
|
| 144 | - include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 145 | - $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true); |
|
| 146 | - break; |
|
| 147 | - case 'password': |
|
| 148 | - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
| 149 | - $ele = new XoopsFormPassword($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput())); |
|
| 150 | - break; |
|
| 151 | - case 'textbox': |
|
| 152 | - default: |
|
| 153 | - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
| 154 | - $ele = new XoopsFormText($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput())); |
|
| 155 | - break; |
|
| 120 | + $ele->addOption($optval, $optkey.$addBr); |
|
| 121 | + } |
|
| 122 | + break; |
|
| 123 | + case 'yesno': |
|
| 124 | + $ele = new XoopsFormRadioYN($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), _YES, _NO); |
|
| 125 | + break; |
|
| 126 | + case 'group': |
|
| 127 | + include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 128 | + $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false); |
|
| 129 | + break; |
|
| 130 | + case 'group_multi': |
|
| 131 | + include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 132 | + $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true); |
|
| 133 | + break; |
|
| 134 | + case 'group_checkbox': |
|
| 135 | + include_once __DIR__.'/include/formcheckboxgroup.php'; |
|
| 136 | + $ele = new AltsysFormCheckboxGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput()); |
|
| 137 | + break; |
|
| 138 | + // RMV-NOTIFY: added 'user' and 'user_multi' |
|
| 139 | + case 'user': |
|
| 140 | + include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 141 | + $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false); |
|
| 142 | + break; |
|
| 143 | + case 'user_multi': |
|
| 144 | + include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 145 | + $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true); |
|
| 146 | + break; |
|
| 147 | + case 'password': |
|
| 148 | + (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
| 149 | + $ele = new XoopsFormPassword($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput())); |
|
| 150 | + break; |
|
| 151 | + case 'textbox': |
|
| 152 | + default: |
|
| 153 | + (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
| 154 | + $ele = new XoopsFormText($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput())); |
|
| 155 | + break; |
|
| 156 | 156 | } |
| 157 | 157 | $hidden = new XoopsFormHidden('conf_ids[]', $config[$i]->getVar('conf_id')); |
| 158 | 158 | $ele_tray = new XoopsFormElementTray($title4tray, '') ; |
@@ -5,33 +5,33 @@ discard block |
||
| 5 | 5 | // GIJOE <http://www.peak.ne.jp/> // |
| 6 | 6 | // ------------------------------------------------------------------------- // |
| 7 | 7 | |
| 8 | -require_once __DIR__.'/class/AltsysBreadcrumbs.class.php' ; |
|
| 9 | -include_once __DIR__.'/include/gtickets.php' ; |
|
| 10 | -include_once __DIR__.'/include/altsys_functions.php' ; |
|
| 8 | +require_once __DIR__.'/class/AltsysBreadcrumbs.class.php'; |
|
| 9 | +include_once __DIR__.'/include/gtickets.php'; |
|
| 10 | +include_once __DIR__.'/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 | 19 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
| 20 | -(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance() ; |
|
| 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 | 29 | $config_handler = xoops_getHandler('config'); |
| 30 | - $mod = $xoopsModule->mid() ; |
|
| 30 | + $mod = $xoopsModule->mid(); |
|
| 31 | 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'); |
@@ -39,30 +39,30 @@ discard block |
||
| 39 | 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,9 +72,9 @@ 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 | 80 | (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
@@ -155,25 +155,25 @@ discard block |
||
| 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, $ele, $hidden); |
| 163 | 163 | } |
| 164 | 164 | // $button_tray->addElement(new XoopsFormHidden('op', 'save')); |
| 165 | - $xoopsGTicket->addTicketXoopsFormElement($button_tray, __LINE__, 1800, 'mypreferences') ; |
|
| 165 | + $xoopsGTicket->addTicketXoopsFormElement($button_tray, __LINE__, 1800, 'mypreferences'); |
|
| 166 | 166 | $button_tray->addElement(new XoopsFormButton('', 'button', _GO, 'submit')); |
| 167 | - $form->addElement($button_tray) ; |
|
| 167 | + $form->addElement($button_tray); |
|
| 168 | 168 | xoops_cp_header(); |
| 169 | 169 | |
| 170 | 170 | // GIJ patch start |
| 171 | - altsys_include_mymenu() ; |
|
| 172 | - $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
| 171 | + altsys_include_mymenu(); |
|
| 172 | + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); |
|
| 173 | 173 | if ($breadcrumbsObj->hasPaths()) { |
| 174 | - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mypreferences', _PREFERENCES) ; |
|
| 174 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mypreferences', _PREFERENCES); |
|
| 175 | 175 | } |
| 176 | - echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>".$module->getVar('name').' '._PREFERENCES."</h3>\n" ; |
|
| 176 | + echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>".$module->getVar('name').' '._PREFERENCES."</h3>\n"; |
|
| 177 | 177 | // GIJ patch end |
| 178 | 178 | |
| 179 | 179 | $form->display(); |
@@ -185,10 +185,10 @@ discard block |
||
| 185 | 185 | //if ( !admin_refcheck("/modules/$admin_mydirname/admin/") ) { |
| 186 | 186 | // exit('Invalid referer'); |
| 187 | 187 | //} |
| 188 | - if (! $xoopsGTicket->check(true, 'mypreferences')) { |
|
| 188 | + if (!$xoopsGTicket->check(true, 'mypreferences')) { |
|
| 189 | 189 | redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); |
| 190 | 190 | } |
| 191 | - require_once XOOPS_ROOT_PATH.'/class/template.php' ; |
|
| 191 | + require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
| 192 | 192 | $xoopsTpl = new XoopsTpl(); |
| 193 | 193 | //HACK by domifara for new XOOPS and XCL etc. |
| 194 | 194 | //old xoops |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | if ($count > 0) { |
| 210 | 210 | for ($i = 0; $i < $count; $i++) { |
| 211 | 211 | $config = $config_handler->getConfig($conf_ids[$i]); |
| 212 | - $new_value =& $_POST[$config->getVar('conf_name')]; |
|
| 212 | + $new_value = & $_POST[$config->getVar('conf_name')]; |
|
| 213 | 213 | if (is_array($new_value) || $new_value != $config->getVar('conf_value')) { |
| 214 | 214 | // if language has been changed |
| 215 | 215 | if (!$lang_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'language') { |
@@ -238,13 +238,13 @@ discard block |
||
| 238 | 238 | // generate compiled files for the new theme |
| 239 | 239 | // block files only for now.. |
| 240 | 240 | $tplfile_handler = xoops_getHandler('tplfile'); |
| 241 | - $dtemplates =& $tplfile_handler->find('default', 'block'); |
|
| 241 | + $dtemplates = & $tplfile_handler->find('default', 'block'); |
|
| 242 | 242 | $dcount = count($dtemplates); |
| 243 | 243 | |
| 244 | 244 | // need to do this to pass to xoops_template_touch function |
| 245 | 245 | $GLOBALS['xoopsConfig']['template_set'] = $newtplset; |
| 246 | 246 | |
| 247 | - altsys_clear_templates_c() ; |
|
| 247 | + altsys_clear_templates_c(); |
|
| 248 | 248 | |
| 249 | 249 | /* for ($i = 0; $i < $dcount; $i++) { |
| 250 | 250 | $found =& $tplfile_handler->find($newtplset, 'block', $dtemplates[$i]->getVar('tpl_refid'), null); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | // generate image cache files from image binary data, save them under cache/ |
| 261 | 261 | $image_handler = xoops_getHandler('imagesetimg'); |
| 262 | - $imagefiles =& $image_handler->getObjects(new Criteria('tplset_name', $newtplset), true); |
|
| 262 | + $imagefiles = & $image_handler->getObjects(new Criteria('tplset_name', $newtplset), true); |
|
| 263 | 263 | foreach (array_keys($imagefiles) as $i) { |
| 264 | 264 | if (!$fp = fopen(XOOPS_CACHE_PATH.'/'.$newtplset.'_'.$imagefiles[$i]->getVar('imgsetimg_file'), 'wb')) { |
| 265 | 265 | } else { |
@@ -272,9 +272,9 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | // add read permission for the start module to all groups |
| 275 | - if (!$startmod_updated && $new_value != '--' && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'startpage') { |
|
| 275 | + if (!$startmod_updated && $new_value != '--' && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'startpage') { |
|
| 276 | 276 | $member_handler = xoops_getHandler('member'); |
| 277 | - $groups =& $member_handler->getGroupList(); |
|
| 277 | + $groups = & $member_handler->getGroupList(); |
|
| 278 | 278 | $moduleperm_handler = xoops_getHandler('groupperm'); |
| 279 | 279 | $module_handler = xoops_getHandler('module'); |
| 280 | 280 | $module = $module_handler->getByDirname($new_value); |
@@ -293,5 +293,5 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - redirect_header('index.php?mode=admin&lib=altsys&page=mypreferences', 2, _MD_A_MYPREFERENCES_UPDATED) ; |
|
| 296 | + redirect_header('index.php?mode=admin&lib=altsys&page=mypreferences', 2, _MD_A_MYPREFERENCES_UPDATED); |
|
| 297 | 297 | } |
@@ -1,15 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! defined('XOOPS_ROOT_PATH')) { |
|
| 4 | - exit ; |
|
| 3 | +if (!defined('XOOPS_ROOT_PATH')) { |
|
| 4 | + exit; |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if (! defined('XOOPS_TRUST_PATH') || XOOPS_TRUST_PATH == '') { |
|
| 8 | - header('Location: '.XOOPS_URL.'/modules/altsys/setup_xoops_trust_path.php') ; |
|
| 9 | - exit ; |
|
| 7 | +if (!defined('XOOPS_TRUST_PATH') || XOOPS_TRUST_PATH == '') { |
|
| 8 | + header('Location: '.XOOPS_URL.'/modules/altsys/setup_xoops_trust_path.php'); |
|
| 9 | + exit; |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -define('ALTSYS_MYLANGUAGE_ROOT_PATH', XOOPS_ROOT_PATH . '/my_language'); |
|
| 12 | +define('ALTSYS_MYLANGUAGE_ROOT_PATH', XOOPS_ROOT_PATH.'/my_language'); |
|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | class SetupAltsysLangMgr extends XCube_ActionFilter |
@@ -26,23 +26,23 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
| 29 | -require_once XOOPS_ROOT_PATH . '/core/XCube_LanguageManager.class.php'; |
|
| 30 | -require_once XOOPS_ROOT_PATH . '/modules/legacy/kernel/Legacy_LanguageManager.class.php'; |
|
| 29 | +require_once XOOPS_ROOT_PATH.'/core/XCube_LanguageManager.class.php'; |
|
| 30 | +require_once XOOPS_ROOT_PATH.'/modules/legacy/kernel/Legacy_LanguageManager.class.php'; |
|
| 31 | 31 | |
| 32 | 32 | class AltsysLangMgr_LanguageManager extends Legacy_LanguageManager |
| 33 | 33 | { |
| 34 | - public $langman = null ; |
|
| 35 | - public $theme_lang_checked = false ; |
|
| 34 | + public $langman = null; |
|
| 35 | + public $theme_lang_checked = false; |
|
| 36 | 36 | |
| 37 | 37 | public function prepare() |
| 38 | 38 | { |
| 39 | - $langmanpath = XOOPS_TRUST_PATH.'/libs/altsys/class/D3LanguageManager.class.php' ; |
|
| 40 | - if (! file_exists($langmanpath)) { |
|
| 41 | - die('install the latest altsys') ; |
|
| 39 | + $langmanpath = XOOPS_TRUST_PATH.'/libs/altsys/class/D3LanguageManager.class.php'; |
|
| 40 | + if (!file_exists($langmanpath)) { |
|
| 41 | + die('install the latest altsys'); |
|
| 42 | 42 | } |
| 43 | 43 | require_once $langmanpath; |
| 44 | - $this->langman = D3LanguageManager::getInstance() ; |
|
| 45 | - $this->langman->language = $this->mLanguageName ; |
|
| 44 | + $this->langman = D3LanguageManager::getInstance(); |
|
| 45 | + $this->langman->language = $this->mLanguageName; |
|
| 46 | 46 | |
| 47 | 47 | parent::prepare(); |
| 48 | 48 | } |
@@ -50,40 +50,40 @@ discard block |
||
| 50 | 50 | public function _loadLanguage($dirname, $fileBodyName) |
| 51 | 51 | { |
| 52 | 52 | // read/check once (selected_theme)/language/(lang).php |
| 53 | - if (! $this->theme_lang_checked) { |
|
| 54 | - $root = XCube_Root::getSingleton() ; |
|
| 55 | - if (! empty($root->mContext->mXoopsConfig['theme_set'])) { |
|
| 56 | - $langdir = XOOPS_THEME_PATH.'/'.$root->mContext->mXoopsConfig['theme_set'].'/language' ; |
|
| 53 | + if (!$this->theme_lang_checked) { |
|
| 54 | + $root = XCube_Root::getSingleton(); |
|
| 55 | + if (!empty($root->mContext->mXoopsConfig['theme_set'])) { |
|
| 56 | + $langdir = XOOPS_THEME_PATH.'/'.$root->mContext->mXoopsConfig['theme_set'].'/language'; |
|
| 57 | 57 | if (file_exists($langdir)) { |
| 58 | - $langfile = $langdir.'/'.$this->mLanguageName.'.php' ; |
|
| 59 | - $engfile = $langdir.'/english.php' ; |
|
| 58 | + $langfile = $langdir.'/'.$this->mLanguageName.'.php'; |
|
| 59 | + $engfile = $langdir.'/english.php'; |
|
| 60 | 60 | if (file_exists($langfile)) { |
| 61 | - require_once $langfile ; |
|
| 61 | + require_once $langfile; |
|
| 62 | 62 | } elseif (file_exists($engfile)) { |
| 63 | - require_once $engfile ; |
|
| 63 | + require_once $engfile; |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | - $this->theme_lang_checked = true ; |
|
| 66 | + $this->theme_lang_checked = true; |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // read normal |
| 71 | - $this->langman->read($fileBodyName.'.php', $dirname) ; |
|
| 71 | + $this->langman->read($fileBodyName.'.php', $dirname); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function loadPageTypeMessageCatalog($type) |
| 75 | 75 | { |
| 76 | 76 | // I dare not to use langman... |
| 77 | 77 | if (strpos($type, '.') === false && $this->langman->my_language) { |
| 78 | - $mylang_file = $this->langman->my_language.'/'.$this->mLanguageName.'/'.$type.'.php' ; |
|
| 78 | + $mylang_file = $this->langman->my_language.'/'.$this->mLanguageName.'/'.$type.'.php'; |
|
| 79 | 79 | if (file_exists($mylang_file)) { |
| 80 | - require_once $mylang_file ; |
|
| 80 | + require_once $mylang_file; |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - $original_error_level = error_reporting() ; |
|
| 84 | - error_reporting($original_error_level & ~ E_NOTICE) ; |
|
| 83 | + $original_error_level = error_reporting(); |
|
| 84 | + error_reporting($original_error_level & ~ E_NOTICE); |
|
| 85 | 85 | parent::loadPageTypeMessageCatalog($type); |
| 86 | - error_reporting($original_error_level) ; |
|
| 86 | + error_reporting($original_error_level); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | public function loadGlobalMessageCatalog() |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | /* if (!$this->_loadFile(XOOPS_ROOT_PATH . "/modules/legacy/language/" . $this->mLanguageName . "/global.php")) { |
| 92 | 92 | $this->_loadFile(XOOPS_ROOT_PATH . "/modules/legacy/language/english/global.php"); |
| 93 | 93 | } */ |
| 94 | - $this->_loadLanguage('legacy', 'global') ; |
|
| 94 | + $this->_loadLanguage('legacy', 'global'); |
|
| 95 | 95 | |
| 96 | 96 | // |
| 97 | 97 | // Now, if XOOPS_USE_MULTIBYTES isn't defined, set zero to it. |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // $Id: MyBlocksAdminForXCL21.class.php ,ver 0.0.7.1 2011/01/27 16:10:00 domifara Exp $ |
| 3 | 3 | |
| 4 | -require_once __DIR__.'/MyBlocksAdmin.class.php' ; |
|
| 4 | +require_once __DIR__.'/MyBlocksAdmin.class.php'; |
|
| 5 | 5 | |
| 6 | 6 | class MyBlocksAdminForXCL21 extends MyBlocksAdmin |
| 7 | 7 | { |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | static $instance; |
| 17 | 17 | if (!isset($instance)) { |
| 18 | 18 | $instance = new MyBlocksAdminForXCL21(); |
| 19 | - $instance->construct() ; |
|
| 19 | + $instance->construct(); |
|
| 20 | 20 | } |
| 21 | 21 | return $instance; |
| 22 | 22 | } |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | public function renderCell4BlockOptions($block_data) |
| 28 | 28 | { |
| 29 | 29 | if ($this->target_dirname && substr($this->target_dirname, 0, 1) != '_') { |
| 30 | - $langman = D3LanguageManager::getInstance() ; |
|
| 31 | - $langman->read('admin.php', $this->target_dirname) ; |
|
| 30 | + $langman = D3LanguageManager::getInstance(); |
|
| 31 | + $langman->read('admin.php', $this->target_dirname); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $bid = (int)$block_data['bid']; |
@@ -36,15 +36,15 @@ discard block |
||
| 36 | 36 | //HACK by domifara |
| 37 | 37 | // $block = new XoopsBlock( $bid ) ; |
| 38 | 38 | $handler = xoops_getHandler('block'); |
| 39 | - $block = $handler->create(false) ; |
|
| 40 | - $block->load($bid) ; |
|
| 39 | + $block = $handler->create(false); |
|
| 40 | + $block->load($bid); |
|
| 41 | 41 | |
| 42 | - $legacy_block = Legacy_Utils::createBlockProcedure($block) ; |
|
| 43 | - return $legacy_block->getOptionForm() ; |
|
| 42 | + $legacy_block = Legacy_Utils::createBlockProcedure($block); |
|
| 43 | + return $legacy_block->getOptionForm(); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public function checkFck() |
| 47 | 47 | { |
| 48 | - return (! altsysUtils::isInstalledXclHtmleditor() && file_exists(XOOPS_ROOT_PATH.'/common/fckeditor/fckeditor.js')); |
|
| 48 | + return (!altsysUtils::isInstalledXclHtmleditor() && file_exists(XOOPS_ROOT_PATH.'/common/fckeditor/fckeditor.js')); |
|
| 49 | 49 | } |
| 50 | 50 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | // singleton for xoops_breadcrumbs |
| 4 | 4 | class AltsysBreadcrumbs |
| 5 | 5 | { |
| 6 | - public $paths = array() ; |
|
| 6 | + public $paths = array(); |
|
| 7 | 7 | |
| 8 | 8 | public function __construct() |
| 9 | 9 | { |
@@ -12,29 +12,29 @@ discard block |
||
| 12 | 12 | //function &getInstance() |
| 13 | 13 | public static function &getInstance() |
| 14 | 14 | { |
| 15 | - static $instance ; |
|
| 16 | - if (! isset($instance)) { |
|
| 17 | - $instance = new AltsysBreadcrumbs() ; |
|
| 15 | + static $instance; |
|
| 16 | + if (!isset($instance)) { |
|
| 17 | + $instance = new AltsysBreadcrumbs(); |
|
| 18 | 18 | } |
| 19 | - return $instance ; |
|
| 19 | + return $instance; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function getXoopsBreadcrumbs() |
| 23 | 23 | { |
| 24 | - $ret = array() ; |
|
| 24 | + $ret = array(); |
|
| 25 | 25 | foreach ($this->paths as $val) { |
| 26 | 26 | // delayed language constant |
| 27 | 27 | if (substr($val['name'], 0, 1) == '_' && defined($val['name'])) { |
| 28 | 28 | $ret[] = array( |
| 29 | - 'url' => $val['url'] , |
|
| 29 | + 'url' => $val['url'], |
|
| 30 | 30 | 'name' => constant($val['name']) |
| 31 | - ) ; |
|
| 31 | + ); |
|
| 32 | 32 | } else { |
| 33 | - $ret[] = $val ; |
|
| 33 | + $ret[] = $val; |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | - unset($ret[count($ret) - 1 ]['url']) ; |
|
| 37 | - return $ret ; |
|
| 36 | + unset($ret[count($ret) - 1]['url']); |
|
| 37 | + return $ret; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // all data should be escaped |
@@ -43,19 +43,19 @@ discard block |
||
| 43 | 43 | if (is_array($url_or_path)) { |
| 44 | 44 | if (empty($url_or_path['name'])) { |
| 45 | 45 | // multiple paths |
| 46 | - $this->paths = array_merge($this->paths, $url_or_path) ; |
|
| 46 | + $this->paths = array_merge($this->paths, $url_or_path); |
|
| 47 | 47 | } else { |
| 48 | 48 | // array format (just a path) |
| 49 | - $this->paths[] = $url_or_path ; |
|
| 49 | + $this->paths[] = $url_or_path; |
|
| 50 | 50 | } |
| 51 | 51 | } else { |
| 52 | 52 | // separate format |
| 53 | - $this->paths[] = array( 'url' => $url_or_path , 'name' => $name ) ; |
|
| 53 | + $this->paths[] = array('url' => $url_or_path, 'name' => $name); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function hasPaths() |
| 58 | 58 | { |
| 59 | - return ! empty($this->paths) ; |
|
| 59 | + return !empty($this->paths); |
|
| 60 | 60 | } |
| 61 | 61 | } |
@@ -2,40 +2,40 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class d3utilities |
| 4 | 4 | { |
| 5 | - public $dirname = '' ; // directory name under xoops_trust_path |
|
| 6 | - public $mydirname = '' ; // each directory name under xoops_root_path |
|
| 7 | - public $mid = 0 ; // id of each module instance |
|
| 8 | - public $table = '' ; // table with prefix and dirname |
|
| 9 | - public $primary_key = '' ; // column for primary_key |
|
| 10 | - public $cols = array() ; // settings of each columns |
|
| 11 | - public $form_mode = 'new' ; // 'new','edit' are available |
|
| 12 | - public $page_name = '' ; // controller's name eg) page=(controller) in URI |
|
| 13 | - public $action_base_hiddens = array() ; |
|
| 5 | + public $dirname = ''; // directory name under xoops_trust_path |
|
| 6 | + public $mydirname = ''; // each directory name under xoops_root_path |
|
| 7 | + public $mid = 0; // id of each module instance |
|
| 8 | + public $table = ''; // table with prefix and dirname |
|
| 9 | + public $primary_key = ''; // column for primary_key |
|
| 10 | + public $cols = array(); // settings of each columns |
|
| 11 | + public $form_mode = 'new'; // 'new','edit' are available |
|
| 12 | + public $page_name = ''; // controller's name eg) page=(controller) in URI |
|
| 13 | + public $action_base_hiddens = array(); |
|
| 14 | 14 | |
| 15 | 15 | //HACK by domifara |
| 16 | 16 | // public function D3Utilities( $mydirname , $table_body , $primary_key , $cols , $page_name , $action_base_hiddens ) |
| 17 | 17 | public function __construct($mydirname, $table_body, $primary_key, $cols, $page_name, $action_base_hiddens) |
| 18 | 18 | { |
| 19 | - $db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
| 20 | - |
|
| 21 | - $this->dirname = basename(dirname(__DIR__)) ; |
|
| 22 | - $this->mydirname = $mydirname ; |
|
| 23 | - $this->table = $db->prefix($mydirname ? $mydirname . '_' . $table_body : $table_body) ; |
|
| 24 | - $this->primary_key = $primary_key ; |
|
| 25 | - $this->cols = $cols ; |
|
| 26 | - $module_handler = xoops_getHandler('module') ; |
|
| 27 | - $module = $module_handler->getByDirname($this->mydirname) ; |
|
| 28 | - if (! empty($module)) { |
|
| 19 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 20 | + |
|
| 21 | + $this->dirname = basename(dirname(__DIR__)); |
|
| 22 | + $this->mydirname = $mydirname; |
|
| 23 | + $this->table = $db->prefix($mydirname ? $mydirname.'_'.$table_body : $table_body); |
|
| 24 | + $this->primary_key = $primary_key; |
|
| 25 | + $this->cols = $cols; |
|
| 26 | + $module_handler = xoops_getHandler('module'); |
|
| 27 | + $module = $module_handler->getByDirname($this->mydirname); |
|
| 28 | + if (!empty($module)) { |
|
| 29 | 29 | $this->mid = (int)$module->getVar('mid'); |
| 30 | 30 | } |
| 31 | - $this->page_name = $page_name ; |
|
| 32 | - $this->action_base_hiddens = $action_base_hiddens ; |
|
| 31 | + $this->page_name = $page_name; |
|
| 32 | + $this->action_base_hiddens = $action_base_hiddens; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | public function get_language_constant($name) |
| 37 | 37 | { |
| 38 | - return constant(strtoupper('_MD_A_' . $this->dirname . '_' . $this->page_name . '_' . $name)) ; |
|
| 38 | + return constant(strtoupper('_MD_A_'.$this->dirname.'_'.$this->page_name.'_'.$name)); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -45,22 +45,22 @@ discard block |
||
| 45 | 45 | case 'text': |
| 46 | 46 | case 'blob': |
| 47 | 47 | $length = empty($col['length']) ? 65535 : (int)$col['length']; |
| 48 | - return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'" ; |
|
| 48 | + return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'"; |
|
| 49 | 49 | case 'char': |
| 50 | 50 | case 'varchar': |
| 51 | 51 | case 'string': |
| 52 | 52 | $length = empty($col['length']) ? 255 : (int)$col['length']; |
| 53 | - return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'" ; |
|
| 53 | + return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'"; |
|
| 54 | 54 | case 'int': |
| 55 | 55 | case 'integer': |
| 56 | 56 | $value = (int)$value; |
| 57 | - if (! empty($col['max'])) { |
|
| 58 | - $value = min($value, (int)$col['max']) ; |
|
| 57 | + if (!empty($col['max'])) { |
|
| 58 | + $value = min($value, (int)$col['max']); |
|
| 59 | 59 | } |
| 60 | - if (! empty($col['min'])) { |
|
| 61 | - $value = max($value, (int)$col['min']) ; |
|
| 60 | + if (!empty($col['min'])) { |
|
| 61 | + $value = max($value, (int)$col['min']); |
|
| 62 | 62 | } |
| 63 | - return "`{$col['name']}`=$value" ; |
|
| 63 | + return "`{$col['name']}`=$value"; |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
@@ -68,29 +68,29 @@ discard block |
||
| 68 | 68 | // single update or insert |
| 69 | 69 | public function insert() |
| 70 | 70 | { |
| 71 | - $db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
| 71 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 72 | 72 | |
| 73 | - $id = $this->init_default_values() ; |
|
| 73 | + $id = $this->init_default_values(); |
|
| 74 | 74 | |
| 75 | - $set4sql = '' ; |
|
| 75 | + $set4sql = ''; |
|
| 76 | 76 | foreach ($this->cols as $col) { |
| 77 | 77 | if (empty($col['edit_edit'])) { |
| 78 | - continue ; |
|
| 78 | + continue; |
|
| 79 | 79 | } |
| 80 | 80 | if ($col['name'] == $this->primary_key) { |
| 81 | - continue ; |
|
| 81 | + continue; |
|
| 82 | 82 | } |
| 83 | - $set4sql .= $this->get_set4sql(@$_POST[ $col['name'] ], $col) . ',' ; |
|
| 83 | + $set4sql .= $this->get_set4sql(@$_POST[$col['name']], $col).','; |
|
| 84 | 84 | } |
| 85 | - if (! empty($set4sql)) { |
|
| 85 | + if (!empty($set4sql)) { |
|
| 86 | 86 | if ($id > 0) { |
| 87 | 87 | // UPDATE |
| 88 | - $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key='".addslashes($id)."'") ; |
|
| 89 | - return array( $id , 'update' ) ; |
|
| 88 | + $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key='".addslashes($id)."'"); |
|
| 89 | + return array($id, 'update'); |
|
| 90 | 90 | } else { |
| 91 | 91 | // INSERT |
| 92 | - $db->queryF("INSERT INTO $this->table SET ".substr($set4sql, 0, -1)) ; |
|
| 93 | - return array( $db->getInsertId() , 'insert' ) ; |
|
| 92 | + $db->queryF("INSERT INTO $this->table SET ".substr($set4sql, 0, -1)); |
|
| 93 | + return array($db->getInsertId(), 'insert'); |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -99,156 +99,156 @@ discard block |
||
| 99 | 99 | // multiple update |
| 100 | 100 | public function update() |
| 101 | 101 | { |
| 102 | - $db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
| 102 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 103 | 103 | |
| 104 | 104 | // search appropriate column for getting primary_key |
| 105 | 105 | foreach ($this->cols as $col) { |
| 106 | - if (in_array(@$col['list_edit'], array( 'text', 'textarea', 'hidden' ))) { |
|
| 107 | - $column4key = $col['name'] ; |
|
| 108 | - break ; |
|
| 106 | + if (in_array(@$col['list_edit'], array('text', 'textarea', 'hidden'))) { |
|
| 107 | + $column4key = $col['name']; |
|
| 108 | + break; |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | if (empty($column4key)) { |
| 112 | - $column4key = $this->cols[0]['name'] ; |
|
| 112 | + $column4key = $this->cols[0]['name']; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $ret = array() ; |
|
| 115 | + $ret = array(); |
|
| 116 | 116 | foreach (array_keys($_POST[$column4key]) as $id) { |
| 117 | - $id = (int)$id; // primary_key should be 'integer' |
|
| 118 | - $set4sql = '' ; |
|
| 117 | + $id = (int)$id; // primary_key should be 'integer' |
|
| 118 | + $set4sql = ''; |
|
| 119 | 119 | foreach ($this->cols as $col) { |
| 120 | 120 | if (empty($col['list_edit'])) { |
| 121 | - continue ; |
|
| 121 | + continue; |
|
| 122 | 122 | } |
| 123 | 123 | if ($col['name'] == $this->primary_key) { |
| 124 | - continue ; |
|
| 124 | + continue; |
|
| 125 | 125 | } |
| 126 | - $set4sql .= $this->get_set4sql(@$_POST[ $col['name'] ][$id], $col) . ',' ; |
|
| 126 | + $set4sql .= $this->get_set4sql(@$_POST[$col['name']][$id], $col).','; |
|
| 127 | 127 | } |
| 128 | - if (! empty($set4sql)) { |
|
| 129 | - $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id") ; |
|
| 128 | + if (!empty($set4sql)) { |
|
| 129 | + $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id"); |
|
| 130 | 130 | if ($db->getRowsNum($result) == 1) { |
| 131 | - $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key=$id") ; |
|
| 131 | + $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key=$id"); |
|
| 132 | 132 | if ($db->getAffectedRows() == 1) { |
| 133 | - $ret[ $id ] = $db->fetchArray($result) ; |
|
| 133 | + $ret[$id] = $db->fetchArray($result); |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - return $ret ; |
|
| 139 | + return $ret; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | |
| 143 | 143 | public function delete($delete_comments = false, $delete_notifications = false) |
| 144 | 144 | { |
| 145 | - $db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
| 145 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 146 | 146 | |
| 147 | - $ret = array() ; |
|
| 147 | + $ret = array(); |
|
| 148 | 148 | foreach (array_keys($_POST['admin_main_checkboxes']) as $id) { |
| 149 | - $id = (int)$id; // primary_key should be 'integer' |
|
| 150 | - $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id") ; |
|
| 149 | + $id = (int)$id; // primary_key should be 'integer' |
|
| 150 | + $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id"); |
|
| 151 | 151 | if ($db->getRowsNum($result) == 1) { |
| 152 | - $ret[ $id ] = $db->fetchArray($result) ; |
|
| 152 | + $ret[$id] = $db->fetchArray($result); |
|
| 153 | 153 | |
| 154 | - $db->queryF("DELETE FROM $this->table WHERE $this->primary_key=$id") ; |
|
| 154 | + $db->queryF("DELETE FROM $this->table WHERE $this->primary_key=$id"); |
|
| 155 | 155 | if ($delete_comments) { |
| 156 | 156 | // remove comments |
| 157 | - $db->queryF('DELETE FROM ' . $db->prefix('xoopscomments') . " WHERE com_modid=$this->mid AND com_itemid=$id") ; |
|
| 157 | + $db->queryF('DELETE FROM '.$db->prefix('xoopscomments')." WHERE com_modid=$this->mid AND com_itemid=$id"); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | if ($delete_notifications) { |
| 161 | 161 | // remove notifications |
| 162 | - $db->queryF('DELETE FROM ' . $db->prefix('xoopsnotifications') . " WHERE not_modid=$this->mid AND not_itemid=$id") ; |
|
| 162 | + $db->queryF('DELETE FROM '.$db->prefix('xoopsnotifications')." WHERE not_modid=$this->mid AND not_itemid=$id"); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - return $ret ; |
|
| 167 | + return $ret; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | public function init_default_values() |
| 172 | 172 | { |
| 173 | - $db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
| 173 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 174 | 174 | |
| 175 | 175 | if (@$_GET['id']) { |
| 176 | 176 | $id = (int)$_GET['id']; |
| 177 | - $rs = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id") ; |
|
| 177 | + $rs = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id"); |
|
| 178 | 178 | if ($db->getRowsNum($rs) == 1) { |
| 179 | - $row = $db->fetchArray($rs) ; |
|
| 179 | + $row = $db->fetchArray($rs); |
|
| 180 | 180 | foreach (array_keys($this->cols) as $key) { |
| 181 | 181 | if (empty($this->cols[$key]['edit_show'])) { |
| 182 | - continue ; |
|
| 182 | + continue; |
|
| 183 | 183 | } |
| 184 | - $this->cols[$key]['default_value'] = $row[ $this->cols[$key]['name'] ] ; |
|
| 184 | + $this->cols[$key]['default_value'] = $row[$this->cols[$key]['name']]; |
|
| 185 | 185 | } |
| 186 | - $this->form_mode = 'edit' ; |
|
| 187 | - return $id ; |
|
| 186 | + $this->form_mode = 'edit'; |
|
| 187 | + return $id; |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $this->form_mode = 'new' ; |
|
| 192 | - return 0 ; |
|
| 191 | + $this->form_mode = 'new'; |
|
| 192 | + return 0; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | |
| 196 | 196 | public function get_view_edit() |
| 197 | 197 | { |
| 198 | - $id = $this->init_default_values() ; |
|
| 198 | + $id = $this->init_default_values(); |
|
| 199 | 199 | |
| 200 | - $lines = array() ; |
|
| 200 | + $lines = array(); |
|
| 201 | 201 | foreach ($this->cols as $col) { |
| 202 | 202 | if (empty($col['edit_show'])) { |
| 203 | - continue ; |
|
| 203 | + continue; |
|
| 204 | 204 | } |
| 205 | - if (! isset($col['default_value'])) { |
|
| 205 | + if (!isset($col['default_value'])) { |
|
| 206 | 206 | switch ($col['type']) { |
| 207 | 207 | case 'int': |
| 208 | 208 | case 'integer': |
| 209 | - $col['default_value'] = 0 ; |
|
| 210 | - break ; |
|
| 209 | + $col['default_value'] = 0; |
|
| 210 | + break; |
|
| 211 | 211 | default: |
| 212 | - $col['default_value'] = '' ; |
|
| 213 | - break ; |
|
| 212 | + $col['default_value'] = ''; |
|
| 213 | + break; |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | switch ($col['edit_edit']) { |
| 217 | 217 | case 'checkbox': |
| 218 | - $checked = empty($col['default_value']) ? '' : "checked='checked'" ; |
|
| 219 | - $value = empty($col['checkbox_value']) ? 1 : htmlspecialchars($col['checkbox_value'], ENT_QUOTES) ; |
|
| 218 | + $checked = empty($col['default_value']) ? '' : "checked='checked'"; |
|
| 219 | + $value = empty($col['checkbox_value']) ? 1 : htmlspecialchars($col['checkbox_value'], ENT_QUOTES); |
|
| 220 | 220 | |
| 221 | - $lines[ $col['name'] ] = "<input type='checkbox' name='{$col['name']}' value='$value' $checked />" ; |
|
| 222 | - break ; |
|
| 221 | + $lines[$col['name']] = "<input type='checkbox' name='{$col['name']}' value='$value' $checked />"; |
|
| 222 | + break; |
|
| 223 | 223 | case 'text': |
| 224 | 224 | default: |
| 225 | 225 | $size = empty($col['edit_size']) ? 32 : (int)$col['edit_size']; |
| 226 | 226 | $length = empty($col['length']) ? 255 : (int)$col['length']; |
| 227 | - $lines[ $col['name'] ] = "<input type='text' name='{$col['name']}' size='$size' maxlength='$length' value='".htmlspecialchars($col['default_value'], ENT_QUOTES)."' />" ; |
|
| 228 | - break ; |
|
| 227 | + $lines[$col['name']] = "<input type='text' name='{$col['name']}' size='$size' maxlength='$length' value='".htmlspecialchars($col['default_value'], ENT_QUOTES)."' />"; |
|
| 228 | + break; |
|
| 229 | 229 | case false: |
| 230 | - $lines[ $col['name'] ] = htmlspecialchars($col['default_value'], ENT_QUOTES) ; |
|
| 231 | - break ; |
|
| 230 | + $lines[$col['name']] = htmlspecialchars($col['default_value'], ENT_QUOTES); |
|
| 231 | + break; |
|
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - return array( $id , $lines ) ; |
|
| 235 | + return array($id, $lines); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | |
| 239 | 239 | public function get_control_form($controllers) |
| 240 | 240 | { |
| 241 | - $hiddens = '' ; |
|
| 241 | + $hiddens = ''; |
|
| 242 | 242 | foreach ($this->action_base_hiddens as $key => $val) { |
| 243 | - $key4disp = htmlspecialchars($key, ENT_QUOTES) ; |
|
| 244 | - $val4disp = htmlspecialchars($val, ENT_QUOTES) ; |
|
| 245 | - $hiddens .= "<input type='hidden' name='$key4disp' value='$val4disp' />\n" ; |
|
| 243 | + $key4disp = htmlspecialchars($key, ENT_QUOTES); |
|
| 244 | + $val4disp = htmlspecialchars($val, ENT_QUOTES); |
|
| 245 | + $hiddens .= "<input type='hidden' name='$key4disp' value='$val4disp' />\n"; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - $controllers_html = '' ; |
|
| 248 | + $controllers_html = ''; |
|
| 249 | 249 | foreach ($controllers as $type => $body) { |
| 250 | 250 | if ($type == 'num') { |
| 251 | - $controllers_html .= $this->get_select('num', $body, $GLOBALS['num']) ; |
|
| 251 | + $controllers_html .= $this->get_select('num', $body, $GLOBALS['num']); |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
@@ -262,13 +262,13 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | public function get_select($name, $options, $current_value) |
| 264 | 264 | { |
| 265 | - $ret = "<select name='".htmlspecialchars($name, ENT_QUOTES)."'>\n" ; |
|
| 265 | + $ret = "<select name='".htmlspecialchars($name, ENT_QUOTES)."'>\n"; |
|
| 266 | 266 | foreach ($options as $key => $val) { |
| 267 | 267 | $selected = $val == $current_value ? "selected='selected'" : ''; |
| 268 | - $ret .= "<option value='".htmlspecialchars($key, ENT_QUOTES)."' $selected>".htmlspecialchars($val, ENT_QUOTES)."</option>\n" ; |
|
| 268 | + $ret .= "<option value='".htmlspecialchars($key, ENT_QUOTES)."' $selected>".htmlspecialchars($val, ENT_QUOTES)."</option>\n"; |
|
| 269 | 269 | } |
| 270 | - $ret .= "</select>\n" ; |
|
| 270 | + $ret .= "</select>\n"; |
|
| 271 | 271 | |
| 272 | - return $ret ; |
|
| 272 | + return $ret; |
|
| 273 | 273 | } |
| 274 | 274 | } |
@@ -46,42 +46,42 @@ discard block |
||
| 46 | 46 | $scoln = 'disabled'; |
| 47 | 47 | } else { |
| 48 | 48 | switch ($side) { |
| 49 | - case XOOPS_SIDEBLOCK_LEFT: |
|
| 50 | - $ssel0 = " checked='checked'"; |
|
| 51 | - $scol0 = 'selected'; |
|
| 52 | - break ; |
|
| 53 | - case XOOPS_SIDEBLOCK_RIGHT: |
|
| 54 | - $ssel1 = " checked='checked'"; |
|
| 55 | - $scol1 = 'selected'; |
|
| 56 | - break ; |
|
| 57 | - case XOOPS_CENTERBLOCK_LEFT: |
|
| 58 | - $ssel3 = " checked='checked'"; |
|
| 59 | - $scol3 = 'selected'; |
|
| 60 | - break ; |
|
| 61 | - case XOOPS_CENTERBLOCK_RIGHT: |
|
| 62 | - $ssel4 = " checked='checked'"; |
|
| 63 | - $scol4 = 'selected'; |
|
| 64 | - break ; |
|
| 65 | - case XOOPS_CENTERBLOCK_CENTER: |
|
| 66 | - $ssel5 = " checked='checked'"; |
|
| 67 | - $scol5 = 'selected'; |
|
| 68 | - break ; |
|
| 69 | - case XOOPS_CENTERBLOCK_BOTTOMLEFT: |
|
| 70 | - $ssel7 = " checked='checked'"; |
|
| 71 | - $scol7 = 'selected'; |
|
| 72 | - break ; |
|
| 73 | - case XOOPS_CENTERBLOCK_BOTTOMRIGHT: |
|
| 74 | - $ssel8 = " checked='checked'"; |
|
| 75 | - $scol8 = 'selected'; |
|
| 76 | - break ; |
|
| 77 | - case XOOPS_CENTERBLOCK_BOTTOM: |
|
| 78 | - $ssel9 = " checked='checked'"; |
|
| 79 | - $scol9 = 'selected'; |
|
| 80 | - break ; |
|
| 81 | - default: |
|
| 82 | - $value4extra_side = $side ; |
|
| 83 | - $stextbox = 'selected'; |
|
| 84 | - break ; |
|
| 49 | + case XOOPS_SIDEBLOCK_LEFT: |
|
| 50 | + $ssel0 = " checked='checked'"; |
|
| 51 | + $scol0 = 'selected'; |
|
| 52 | + break ; |
|
| 53 | + case XOOPS_SIDEBLOCK_RIGHT: |
|
| 54 | + $ssel1 = " checked='checked'"; |
|
| 55 | + $scol1 = 'selected'; |
|
| 56 | + break ; |
|
| 57 | + case XOOPS_CENTERBLOCK_LEFT: |
|
| 58 | + $ssel3 = " checked='checked'"; |
|
| 59 | + $scol3 = 'selected'; |
|
| 60 | + break ; |
|
| 61 | + case XOOPS_CENTERBLOCK_RIGHT: |
|
| 62 | + $ssel4 = " checked='checked'"; |
|
| 63 | + $scol4 = 'selected'; |
|
| 64 | + break ; |
|
| 65 | + case XOOPS_CENTERBLOCK_CENTER: |
|
| 66 | + $ssel5 = " checked='checked'"; |
|
| 67 | + $scol5 = 'selected'; |
|
| 68 | + break ; |
|
| 69 | + case XOOPS_CENTERBLOCK_BOTTOMLEFT: |
|
| 70 | + $ssel7 = " checked='checked'"; |
|
| 71 | + $scol7 = 'selected'; |
|
| 72 | + break ; |
|
| 73 | + case XOOPS_CENTERBLOCK_BOTTOMRIGHT: |
|
| 74 | + $ssel8 = " checked='checked'"; |
|
| 75 | + $scol8 = 'selected'; |
|
| 76 | + break ; |
|
| 77 | + case XOOPS_CENTERBLOCK_BOTTOM: |
|
| 78 | + $ssel9 = " checked='checked'"; |
|
| 79 | + $scol9 = 'selected'; |
|
| 80 | + break ; |
|
| 81 | + default: |
|
| 82 | + $value4extra_side = $side ; |
|
| 83 | + $stextbox = 'selected'; |
|
| 84 | + break ; |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -165,31 +165,31 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | switch ($mode) { |
| 168 | - case 'clone': |
|
| 169 | - $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM ; |
|
| 170 | - $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE ; |
|
| 171 | - $next_op = 'clone_ok' ; |
|
| 172 | - // breadcrumbs |
|
| 173 | - $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
| 174 | - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM) ; |
|
| 175 | - break ; |
|
| 176 | - case 'new': |
|
| 177 | - $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM ; |
|
| 178 | - $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW ; |
|
| 179 | - $next_op = 'new_ok' ; |
|
| 180 | - // breadcrumbs |
|
| 181 | - $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
| 182 | - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM) ; |
|
| 183 | - break ; |
|
| 184 | - case 'edit': |
|
| 185 | - default: |
|
| 186 | - $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM ; |
|
| 187 | - $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT ; |
|
| 188 | - $next_op = 'edit_ok' ; |
|
| 189 | - // breadcrumbs |
|
| 190 | - $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
| 191 | - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM) ; |
|
| 192 | - break ; |
|
| 168 | + case 'clone': |
|
| 169 | + $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM ; |
|
| 170 | + $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE ; |
|
| 171 | + $next_op = 'clone_ok' ; |
|
| 172 | + // breadcrumbs |
|
| 173 | + $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
| 174 | + $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM) ; |
|
| 175 | + break ; |
|
| 176 | + case 'new': |
|
| 177 | + $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM ; |
|
| 178 | + $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW ; |
|
| 179 | + $next_op = 'new_ok' ; |
|
| 180 | + // breadcrumbs |
|
| 181 | + $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
| 182 | + $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM) ; |
|
| 183 | + break ; |
|
| 184 | + case 'edit': |
|
| 185 | + default: |
|
| 186 | + $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM ; |
|
| 187 | + $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT ; |
|
| 188 | + $next_op = 'edit_ok' ; |
|
| 189 | + // breadcrumbs |
|
| 190 | + $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
| 191 | + $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM) ; |
|
| 192 | + break ; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | $is_custom = in_array($block->getVar('block_type'), array( 'C', 'E' )) ? true : false ; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once __DIR__.'/MyBlocksAdmin.class.php' ; |
|
| 3 | +require_once __DIR__.'/MyBlocksAdmin.class.php'; |
|
| 4 | 4 | |
| 5 | 5 | class MyBlocksAdminForX25 extends MyBlocksAdmin |
| 6 | 6 | { |
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | public function construct() |
| 13 | 13 | { |
| 14 | - parent::construct() ; |
|
| 14 | + parent::construct(); |
|
| 15 | 15 | |
| 16 | - @include_once XOOPS_ROOT_PATH.'/modules/system/language/'.$this->lang.'/admin/blocksadmin.php' ; |
|
| 16 | + @include_once XOOPS_ROOT_PATH.'/modules/system/language/'.$this->lang.'/admin/blocksadmin.php'; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | //HACK by domifara for php5.3+ |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | static $instance; |
| 24 | 24 | if (!isset($instance)) { |
| 25 | 25 | $instance = new MyBlocksAdminForX25(); |
| 26 | - $instance->construct() ; |
|
| 26 | + $instance->construct(); |
|
| 27 | 27 | } |
| 28 | 28 | return $instance; |
| 29 | 29 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $sseln = $ssel0 = $ssel1 = $ssel3 = $ssel4 = $ssel5 = $ssel7 = $ssel8 = $ssel9 = ''; |
| 40 | 40 | $scoln = $scol0 = $scol1 = $scol3 = $scol4 = $scol5 = $scol7 = $scol8 = $scol9 = 'unselected'; |
| 41 | 41 | $stextbox = 'unselected'; |
| 42 | - $value4extra_side = '' ; |
|
| 42 | + $value4extra_side = ''; |
|
| 43 | 43 | |
| 44 | 44 | if ($visible != 1) { |
| 45 | 45 | $sseln = " checked='checked'"; |
@@ -49,39 +49,39 @@ discard block |
||
| 49 | 49 | case XOOPS_SIDEBLOCK_LEFT: |
| 50 | 50 | $ssel0 = " checked='checked'"; |
| 51 | 51 | $scol0 = 'selected'; |
| 52 | - break ; |
|
| 52 | + break; |
|
| 53 | 53 | case XOOPS_SIDEBLOCK_RIGHT: |
| 54 | 54 | $ssel1 = " checked='checked'"; |
| 55 | 55 | $scol1 = 'selected'; |
| 56 | - break ; |
|
| 56 | + break; |
|
| 57 | 57 | case XOOPS_CENTERBLOCK_LEFT: |
| 58 | 58 | $ssel3 = " checked='checked'"; |
| 59 | 59 | $scol3 = 'selected'; |
| 60 | - break ; |
|
| 60 | + break; |
|
| 61 | 61 | case XOOPS_CENTERBLOCK_RIGHT: |
| 62 | 62 | $ssel4 = " checked='checked'"; |
| 63 | 63 | $scol4 = 'selected'; |
| 64 | - break ; |
|
| 64 | + break; |
|
| 65 | 65 | case XOOPS_CENTERBLOCK_CENTER: |
| 66 | 66 | $ssel5 = " checked='checked'"; |
| 67 | 67 | $scol5 = 'selected'; |
| 68 | - break ; |
|
| 68 | + break; |
|
| 69 | 69 | case XOOPS_CENTERBLOCK_BOTTOMLEFT: |
| 70 | 70 | $ssel7 = " checked='checked'"; |
| 71 | 71 | $scol7 = 'selected'; |
| 72 | - break ; |
|
| 72 | + break; |
|
| 73 | 73 | case XOOPS_CENTERBLOCK_BOTTOMRIGHT: |
| 74 | 74 | $ssel8 = " checked='checked'"; |
| 75 | 75 | $scol8 = 'selected'; |
| 76 | - break ; |
|
| 76 | + break; |
|
| 77 | 77 | case XOOPS_CENTERBLOCK_BOTTOM: |
| 78 | 78 | $ssel9 = " checked='checked'"; |
| 79 | 79 | $scol9 = 'selected'; |
| 80 | - break ; |
|
| 80 | + break; |
|
| 81 | 81 | default: |
| 82 | - $value4extra_side = $side ; |
|
| 82 | + $value4extra_side = $side; |
|
| 83 | 83 | $stextbox = 'selected'; |
| 84 | - break ; |
|
| 84 | + break; |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | <div class='blockposition $scoln'> |
| 143 | 143 | <input type='radio' name='sides[$bid]' value='-1' class='blockposition' $sseln onclick='document.getElementById(\"extra_side_$bid\").value=-1;' /> |
| 144 | 144 | </div> |
| 145 | - <div style='float:"._GLOBAL_LEFT.";'>"._NONE . '</div> |
|
| 145 | + <div style='float:"._GLOBAL_LEFT.";'>"._NONE.'</div> |
|
| 146 | 146 | </td> |
| 147 | 147 | </tr> |
| 148 | 148 | </table> |
@@ -154,53 +154,53 @@ discard block |
||
| 154 | 154 | $bid = (int)$bid; |
| 155 | 155 | |
| 156 | 156 | //HACK by domifara |
| 157 | - $block = new XoopsBlock($bid) ; |
|
| 157 | + $block = new XoopsBlock($bid); |
|
| 158 | 158 | |
| 159 | - if (! $block->getVar('bid')) { |
|
| 159 | + if (!$block->getVar('bid')) { |
|
| 160 | 160 | // new defaults |
| 161 | - $bid = 0 ; |
|
| 162 | - $mode = 'new' ; |
|
| 163 | - $block->setVar('mid', 0) ; |
|
| 164 | - $block->setVar('block_type', 'C') ; |
|
| 161 | + $bid = 0; |
|
| 162 | + $mode = 'new'; |
|
| 163 | + $block->setVar('mid', 0); |
|
| 164 | + $block->setVar('block_type', 'C'); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | switch ($mode) { |
| 168 | 168 | case 'clone': |
| 169 | - $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM ; |
|
| 170 | - $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE ; |
|
| 171 | - $next_op = 'clone_ok' ; |
|
| 169 | + $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM; |
|
| 170 | + $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE; |
|
| 171 | + $next_op = 'clone_ok'; |
|
| 172 | 172 | // breadcrumbs |
| 173 | - $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
| 174 | - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM) ; |
|
| 175 | - break ; |
|
| 173 | + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); |
|
| 174 | + $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM); |
|
| 175 | + break; |
|
| 176 | 176 | case 'new': |
| 177 | - $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM ; |
|
| 178 | - $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW ; |
|
| 179 | - $next_op = 'new_ok' ; |
|
| 177 | + $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM; |
|
| 178 | + $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW; |
|
| 179 | + $next_op = 'new_ok'; |
|
| 180 | 180 | // breadcrumbs |
| 181 | - $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
| 182 | - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM) ; |
|
| 183 | - break ; |
|
| 181 | + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); |
|
| 182 | + $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM); |
|
| 183 | + break; |
|
| 184 | 184 | case 'edit': |
| 185 | 185 | default: |
| 186 | - $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM ; |
|
| 187 | - $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT ; |
|
| 188 | - $next_op = 'edit_ok' ; |
|
| 186 | + $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM; |
|
| 187 | + $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT; |
|
| 188 | + $next_op = 'edit_ok'; |
|
| 189 | 189 | // breadcrumbs |
| 190 | - $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
| 191 | - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM) ; |
|
| 192 | - break ; |
|
| 190 | + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); |
|
| 191 | + $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM); |
|
| 192 | + break; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $is_custom = in_array($block->getVar('block_type'), array( 'C', 'E' )) ? true : false ; |
|
| 196 | - $block_template =& $block->getVar('template', 'n') ; |
|
| 197 | - $block_template_tplset = '' ; |
|
| 195 | + $is_custom = in_array($block->getVar('block_type'), array('C', 'E')) ? true : false; |
|
| 196 | + $block_template = & $block->getVar('template', 'n'); |
|
| 197 | + $block_template_tplset = ''; |
|
| 198 | 198 | |
| 199 | - if (! $is_custom && $block_template) { |
|
| 199 | + if (!$is_custom && $block_template) { |
|
| 200 | 200 | // find template of the block |
| 201 | 201 | $tplfile_handler = xoops_getHandler('tplfile'); |
| 202 | - $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template) ; |
|
| 203 | - $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default' ; |
|
| 202 | + $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template); |
|
| 203 | + $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default'; |
|
| 204 | 204 | } |
| 205 | 205 | //HACK by domifara |
| 206 | 206 | /* |
@@ -209,41 +209,41 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | */ |
| 211 | 211 | $block_data = $this->preview_request + array( |
| 212 | - 'bid' => $bid , |
|
| 213 | - 'name' => $block->getVar('name', 'n') , |
|
| 214 | - 'title' => $block->getVar('title', 'n') , |
|
| 212 | + 'bid' => $bid, |
|
| 213 | + 'name' => $block->getVar('name', 'n'), |
|
| 214 | + 'title' => $block->getVar('title', 'n'), |
|
| 215 | 215 | 'weight' => (int)$block->getVar('weight'), |
| 216 | 216 | 'bcachetime' => (int)$block->getVar('bcachetime'), |
| 217 | 217 | 'side' => (int)$block->getVar('side'), |
| 218 | 218 | 'visible' => (int)$block->getVar('visible'), |
| 219 | - 'template' => $block_template , |
|
| 220 | - 'template_tplset' => $block_template_tplset , |
|
| 221 | - 'options' => $block->getVar('options') , |
|
| 222 | - 'content' => $block->getVar('content', 'n') , |
|
| 223 | - 'is_custom' => $is_custom , |
|
| 224 | - 'type' => $block->getVar('block_type') , |
|
| 219 | + 'template' => $block_template, |
|
| 220 | + 'template_tplset' => $block_template_tplset, |
|
| 221 | + 'options' => $block->getVar('options'), |
|
| 222 | + 'content' => $block->getVar('content', 'n'), |
|
| 223 | + 'is_custom' => $is_custom, |
|
| 224 | + 'type' => $block->getVar('block_type'), |
|
| 225 | 225 | 'ctype' => $block->getVar('c_type') |
| 226 | - ) ; |
|
| 226 | + ); |
|
| 227 | 227 | |
| 228 | 228 | $block4assign = array( |
| 229 | - 'name_raw' => $block_data['name'] , |
|
| 230 | - 'title_raw' => $block_data['title'] , |
|
| 231 | - 'content_raw' => $block_data['content'] , |
|
| 232 | - 'cell_position' => $this->renderCell4BlockPosition($block_data) , |
|
| 233 | - 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data) , |
|
| 234 | - 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm($block_data) , |
|
| 235 | - 'cell_options' => $this->renderCell4BlockOptions($block_data) , |
|
| 229 | + 'name_raw' => $block_data['name'], |
|
| 230 | + 'title_raw' => $block_data['title'], |
|
| 231 | + 'content_raw' => $block_data['content'], |
|
| 232 | + 'cell_position' => $this->renderCell4BlockPosition($block_data), |
|
| 233 | + 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data), |
|
| 234 | + 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm($block_data), |
|
| 235 | + 'cell_options' => $this->renderCell4BlockOptions($block_data), |
|
| 236 | 236 | 'content_preview' => $this->previewContent($block_data) |
| 237 | - ) + $block_data ; |
|
| 237 | + ) + $block_data; |
|
| 238 | 238 | |
| 239 | 239 | // display |
| 240 | - require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; |
|
| 241 | - $tpl = new D3Tpl() ; |
|
| 240 | + require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php'; |
|
| 241 | + $tpl = new D3Tpl(); |
|
| 242 | 242 | //dhtml |
| 243 | 243 | include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
| 244 | 244 | |
| 245 | - if ($block_data['ctype']=='H' || empty($block_data['ctype'])) { |
|
| 246 | - $editor_configs=array(); |
|
| 245 | + if ($block_data['ctype'] == 'H' || empty($block_data['ctype'])) { |
|
| 246 | + $editor_configs = array(); |
|
| 247 | 247 | $editor_configs['name'] = 'content_block'; |
| 248 | 248 | $editor_configs['value'] = $block_data['content']; |
| 249 | 249 | $editor_configs['rows'] = 20; |
@@ -253,12 +253,12 @@ discard block |
||
| 253 | 253 | $editor_configs['editor'] = xoops_getModuleOption('blocks_editor', 'system'); |
| 254 | 254 | $form = new XoopsFormEditor('', 'textarea_content', $editor_configs); |
| 255 | 255 | $rendered = $form->render(); |
| 256 | - $tpl->assign('altsys_x25_dhtmltextarea', $rendered) ; |
|
| 256 | + $tpl->assign('altsys_x25_dhtmltextarea', $rendered); |
|
| 257 | 257 | } else { |
| 258 | 258 | $form = new XoopsFormDhtmlTextArea('', 'textarea_content', $block_data['content'], 80, 20); |
| 259 | 259 | $rendered = $form->render(); |
| 260 | - $rendered = '<div id="textarea_content_bbcode_buttons_pre" style="display:block;">'.str_replace(array( '<textarea', '</textarea><br />' ), array( '</div><textarea', '</textarea><div id="textarea_content_bbcode_buttons_post" style="display:block;">' ), $rendered) . '</div>' ; |
|
| 261 | - $tpl->assign('altsys_x25_dhtmltextarea', $rendered) ; |
|
| 260 | + $rendered = '<div id="textarea_content_bbcode_buttons_pre" style="display:block;">'.str_replace(array('<textarea', '</textarea><br />'), array('</div><textarea', '</textarea><div id="textarea_content_bbcode_buttons_post" style="display:block;">'), $rendered).'</div>'; |
|
| 261 | + $tpl->assign('altsys_x25_dhtmltextarea', $rendered); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | $tpl->assign(array( |
@@ -273,91 +273,91 @@ discard block |
||
| 273 | 273 | 'submit_button' => $button_value, |
| 274 | 274 | 'common_fck_installed' => file_exists(XOOPS_ROOT_PATH.'/common/fckeditor/fckeditor.js'), |
| 275 | 275 | 'gticket_hidden' => $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'myblocksadmin') |
| 276 | - )) ; |
|
| 276 | + )); |
|
| 277 | 277 | //HACK by domifara |
| 278 | - $tpl->display('db:altsys_main_myblocksadmin_edit_4x25.html') ; |
|
| 278 | + $tpl->display('db:altsys_main_myblocksadmin_edit_4x25.html'); |
|
| 279 | 279 | |
| 280 | - return ; |
|
| 280 | + return; |
|
| 281 | 281 | } |
| 282 | 282 | public function fetchRequest4Block($bid) |
| 283 | 283 | { |
| 284 | 284 | $bid = (int)$bid; |
| 285 | - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance() ; |
|
| 285 | + (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
| 286 | 286 | |
| 287 | 287 | if (@$_POST['extra_sides'][$bid] > 0) { |
| 288 | 288 | $_POST['sides'][$bid] = (int)$_POST['extra_sides'][$bid]; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | if (@$_POST['sides'][$bid] < 0) { |
| 292 | - $visible = 0 ; |
|
| 293 | - $_POST['sides'][$bid] = -1 ; |
|
| 292 | + $visible = 0; |
|
| 293 | + $_POST['sides'][$bid] = -1; |
|
| 294 | 294 | } else { |
| 295 | - $visible = 1 ; |
|
| 295 | + $visible = 1; |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | return array( |
| 299 | - 'bid' => $bid , |
|
| 299 | + 'bid' => $bid, |
|
| 300 | 300 | 'side' => (int)(@$_POST['sides'][$bid]), |
| 301 | 301 | 'weight' => (int)(@$_POST['weights'][$bid]), |
| 302 | - 'visible' => $visible , |
|
| 303 | - 'title' => $myts->stripSlashesGPC(@$_POST['titles'][$bid]) , |
|
| 304 | - 'content' => $myts->stripSlashesGPC(@$_POST['textarea_content']) , |
|
| 305 | - 'ctype' => preg_replace('/[^A-Z]/', '', @$_POST['ctypes'][$bid]) , |
|
| 302 | + 'visible' => $visible, |
|
| 303 | + 'title' => $myts->stripSlashesGPC(@$_POST['titles'][$bid]), |
|
| 304 | + 'content' => $myts->stripSlashesGPC(@$_POST['textarea_content']), |
|
| 305 | + 'ctype' => preg_replace('/[^A-Z]/', '', @$_POST['ctypes'][$bid]), |
|
| 306 | 306 | 'bcachetime' => (int)(@$_POST['bcachetimes'][$bid]), |
| 307 | - 'bmodule' => is_array(@$_POST['bmodules'][$bid]) ? $_POST['bmodules'][$bid] : array( 0 ) , |
|
| 308 | - 'bgroup' => is_array(@$_POST['bgroups'][$bid]) ? $_POST['bgroups'][$bid] : array() , |
|
| 307 | + 'bmodule' => is_array(@$_POST['bmodules'][$bid]) ? $_POST['bmodules'][$bid] : array(0), |
|
| 308 | + 'bgroup' => is_array(@$_POST['bgroups'][$bid]) ? $_POST['bgroups'][$bid] : array(), |
|
| 309 | 309 | 'options' => is_array(@$_POST['options'][$bid]) ? $_POST['options'][$bid] : array() |
| 310 | - ) ; |
|
| 310 | + ); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | public function previewContent($block_data) |
| 314 | 314 | { |
| 315 | 315 | $bid = (int)$block_data['bid']; |
| 316 | 316 | |
| 317 | - if (! $block_data['is_custom']) { |
|
| 318 | - return '' ; |
|
| 317 | + if (!$block_data['is_custom']) { |
|
| 318 | + return ''; |
|
| 319 | 319 | } |
| 320 | 320 | if (empty($this->preview_request)) { |
| 321 | - return '' ; |
|
| 321 | + return ''; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | //HACK by domifara |
| 325 | 325 | //TODO : need no hook block at this |
| 326 | - $block = new XoopsBlock($bid) ; |
|
| 326 | + $block = new XoopsBlock($bid); |
|
| 327 | 327 | |
| 328 | 328 | if ($block->getVar('mid')) { |
| 329 | - return '' ; |
|
| 329 | + return ''; |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - $block->setVar('title', $block_data['title']) ; |
|
| 333 | - $block->setVar('content', $block_data['content']) ; |
|
| 332 | + $block->setVar('title', $block_data['title']); |
|
| 333 | + $block->setVar('content', $block_data['content']); |
|
| 334 | 334 | |
| 335 | - restore_error_handler() ; |
|
| 336 | - $original_level = error_reporting(E_ALL) ; |
|
| 335 | + restore_error_handler(); |
|
| 336 | + $original_level = error_reporting(E_ALL); |
|
| 337 | 337 | |
| 338 | 338 | // $ret = $block->getContent( 'S' , $block_data['ctype'] ) ; |
| 339 | 339 | |
| 340 | 340 | $c_type = $block_data['ctype']; |
| 341 | 341 | if ($c_type == 'H') { |
| 342 | - $ret = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N')); |
|
| 342 | + $ret = str_replace('{X_SITEURL}', XOOPS_URL.'/', $block->getVar('content', 'N')); |
|
| 343 | 343 | } elseif ($c_type == 'P') { |
| 344 | 344 | ob_start(); |
| 345 | 345 | echo eval($block->getVar('content', 'N')); |
| 346 | 346 | $content = ob_get_contents(); |
| 347 | 347 | ob_end_clean(); |
| 348 | - $ret = str_replace('{X_SITEURL}', XOOPS_URL . '/', $content); |
|
| 348 | + $ret = str_replace('{X_SITEURL}', XOOPS_URL.'/', $content); |
|
| 349 | 349 | } elseif ($c_type == 'S') { |
| 350 | 350 | (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
| 351 | - $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N')); |
|
| 351 | + $content = str_replace('{X_SITEURL}', XOOPS_URL.'/', $block->getVar('content', 'N')); |
|
| 352 | 352 | $ret = $myts->displayTarea($content, 1, 1); |
| 353 | 353 | } else { |
| 354 | 354 | (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
| 355 | - $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N')); |
|
| 355 | + $content = str_replace('{X_SITEURL}', XOOPS_URL.'/', $block->getVar('content', 'N')); |
|
| 356 | 356 | $ret = $myts->displayTarea($content, 1, 0); |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - error_reporting($original_level) ; |
|
| 359 | + error_reporting($original_level); |
|
| 360 | 360 | |
| 361 | - return $ret ; |
|
| 361 | + return $ret; |
|
| 362 | 362 | } |
| 363 | 363 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // notification handler for D3 modules |
| 4 | 4 | |
| 5 | -require_once XOOPS_ROOT_PATH . '/include/notification_functions.php' ; |
|
| 5 | +require_once XOOPS_ROOT_PATH.'/include/notification_functions.php'; |
|
| 6 | 6 | |
| 7 | 7 | class D3NotificationHandler |
| 8 | 8 | { |
@@ -10,59 +10,59 @@ discard block |
||
| 10 | 10 | //function &getInstance( $conn = null ) |
| 11 | 11 | public static function &getInstance($conn = null) |
| 12 | 12 | { |
| 13 | - static $instance ; |
|
| 14 | - if (! isset($instance)) { |
|
| 15 | - $instance = new D3NotificationHandler() ; |
|
| 13 | + static $instance; |
|
| 14 | + if (!isset($instance)) { |
|
| 15 | + $instance = new D3NotificationHandler(); |
|
| 16 | 16 | } |
| 17 | - return $instance ; |
|
| 17 | + return $instance; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | public function getMailTemplateDir($mydirname, $mytrustdirname = '') |
| 22 | 22 | { |
| 23 | - global $xoopsConfig ; |
|
| 23 | + global $xoopsConfig; |
|
| 24 | 24 | |
| 25 | - $mydirpath = XOOPS_ROOT_PATH.'/modules/'.$mydirname ; |
|
| 26 | - $mytrustdirpath = XOOPS_TRUST_PATH.'/modules/'.$mytrustdirname ; |
|
| 27 | - $language = empty($xoopsConfig['language']) ? 'english' : $xoopsConfig['language'] ; |
|
| 25 | + $mydirpath = XOOPS_ROOT_PATH.'/modules/'.$mydirname; |
|
| 26 | + $mytrustdirpath = XOOPS_TRUST_PATH.'/modules/'.$mytrustdirname; |
|
| 27 | + $language = empty($xoopsConfig['language']) ? 'english' : $xoopsConfig['language']; |
|
| 28 | 28 | |
| 29 | 29 | $search_paths = array( |
| 30 | - "$mydirpath/language/$language/mail_template/" , |
|
| 31 | - "$mytrustdirpath/language/$language/mail_template/" , |
|
| 32 | - "$mydirpath/language/english/mail_template/" , |
|
| 30 | + "$mydirpath/language/$language/mail_template/", |
|
| 31 | + "$mytrustdirpath/language/$language/mail_template/", |
|
| 32 | + "$mydirpath/language/english/mail_template/", |
|
| 33 | 33 | "$mytrustdirpath/language/english/mail_template/" |
| 34 | - ) ; |
|
| 34 | + ); |
|
| 35 | 35 | |
| 36 | - $mail_template_dir = "$mytrustdirpath/language/english/mail_template/" ; |
|
| 36 | + $mail_template_dir = "$mytrustdirpath/language/english/mail_template/"; |
|
| 37 | 37 | foreach ($search_paths as $path) { |
| 38 | 38 | if (file_exists($path)) { |
| 39 | - $mail_template_dir = $path ; |
|
| 40 | - break ; |
|
| 39 | + $mail_template_dir = $path; |
|
| 40 | + break; |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - return $mail_template_dir ; |
|
| 44 | + return $mail_template_dir; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
| 48 | - public function triggerEvent($mydirname, $mytrustdirname, $category, $item_id, $event, $extra_tags=array(), $user_list=array(), $omit_user_id=null) |
|
| 48 | + public function triggerEvent($mydirname, $mytrustdirname, $category, $item_id, $event, $extra_tags = array(), $user_list = array(), $omit_user_id = null) |
|
| 49 | 49 | { |
| 50 | - $module_handler = xoops_getHandler('module') ; |
|
| 51 | - $module = $module_handler->getByDirname($mydirname) ; |
|
| 50 | + $module_handler = xoops_getHandler('module'); |
|
| 51 | + $module = $module_handler->getByDirname($mydirname); |
|
| 52 | 52 | |
| 53 | - $notification_handler = xoops_getHandler('notification') ; |
|
| 54 | - $mail_template_dir = $this->getMailTemplateDir($mydirname, $mytrustdirname) ; |
|
| 53 | + $notification_handler = xoops_getHandler('notification'); |
|
| 54 | + $mail_template_dir = $this->getMailTemplateDir($mydirname, $mytrustdirname); |
|
| 55 | 55 | |
| 56 | 56 | // calling a delegate before |
| 57 | 57 | if (class_exists('XCube_DelegateUtils')) { |
| 58 | - $force_return = false ; |
|
| 59 | - XCube_DelegateUtils::raiseEvent('D3NotificationHandler.Trigger', new XCube_Ref($category), new XCube_Ref($event), new XCube_Ref($item_id), new XCube_Ref($extra_tags), new XCube_Ref($module), new XCube_Ref($user_list), new XCube_Ref($omit_user_id), $module->getInfo('notification'), new XCube_Ref($force_return), new XCube_Ref($mail_template_dir), $mydirname, $mytrustdirname) ; |
|
| 58 | + $force_return = false; |
|
| 59 | + XCube_DelegateUtils::raiseEvent('D3NotificationHandler.Trigger', new XCube_Ref($category), new XCube_Ref($event), new XCube_Ref($item_id), new XCube_Ref($extra_tags), new XCube_Ref($module), new XCube_Ref($user_list), new XCube_Ref($omit_user_id), $module->getInfo('notification'), new XCube_Ref($force_return), new XCube_Ref($mail_template_dir), $mydirname, $mytrustdirname); |
|
| 60 | 60 | if ($force_return) { |
| 61 | - return ; |
|
| 61 | + return; |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $mid = $module->getVar('mid') ; |
|
| 65 | + $mid = $module->getVar('mid'); |
|
| 66 | 66 | |
| 67 | 67 | // Check if event is enabled |
| 68 | 68 | $config_handler = xoops_getHandler('config'); |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | if (empty($mod_config['notification_enabled'])) { |
| 71 | 71 | return false; |
| 72 | 72 | } |
| 73 | - $category_info =& notificationCategoryInfo($category, $mid); |
|
| 74 | - $event_info =& notificationEventInfo($category, $event, $mid); |
|
| 73 | + $category_info = & notificationCategoryInfo($category, $mid); |
|
| 74 | + $event_info = & notificationEventInfo($category, $event, $mid); |
|
| 75 | 75 | if (!in_array(notificationGenerateConfig($category_info, $event_info, 'option_name'), $mod_config['notification_events']) && empty($event_info['invisible'])) { |
| 76 | 76 | return false; |
| 77 | 77 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE), 'OR'); |
| 95 | 95 | $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT), 'OR'); |
| 96 | 96 | $criteria->add($mode_criteria); |
| 97 | - $notifications =& $notification_handler->getObjects($criteria); |
|
| 97 | + $notifications = & $notification_handler->getObjects($criteria); |
|
| 98 | 98 | if (empty($notifications)) { |
| 99 | 99 | return; |
| 100 | 100 | } |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | $tags = array(); |
| 104 | 104 | // {X_ITEM_NAME} {X_ITEM_URL} {X_ITEM_TYPE} from lookup_func are disabled |
| 105 | 105 | $tags['X_MODULE'] = $module->getVar('name', 'n'); |
| 106 | - $tags['X_MODULE_URL'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/'; |
|
| 106 | + $tags['X_MODULE_URL'] = XOOPS_URL.'/modules/'.$module->getVar('dirname').'/'; |
|
| 107 | 107 | $tags['X_NOTIFY_CATEGORY'] = $category; |
| 108 | 108 | $tags['X_NOTIFY_EVENT'] = $event; |
| 109 | 109 | |
| 110 | - $template = $event_info['mail_template'] . '.tpl'; |
|
| 110 | + $template = $event_info['mail_template'].'.tpl'; |
|
| 111 | 111 | $subject = $event_info['mail_subject']; |
| 112 | 112 | |
| 113 | 113 | if ($user_list) { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | // user-specific tags |
| 122 | 122 | //$tags['X_UNSUBSCRIBE_URL'] = 'TODO'; |
| 123 | 123 | // TODO: don't show unsubscribe link if it is 'one-time' ?? |
| 124 | - $tags['X_UNSUBSCRIBE_URL'] = XOOPS_URL . '/notifications.php'; |
|
| 124 | + $tags['X_UNSUBSCRIBE_URL'] = XOOPS_URL.'/notifications.php'; |
|
| 125 | 125 | $tags = array_merge($tags, $extra_tags); |
| 126 | 126 | |
| 127 | 127 | $notification->notifyUser($mail_template_dir, $template, $subject, $tags); |
@@ -5,36 +5,36 @@ discard block |
||
| 5 | 5 | // GIJOE <http://www.peak.ne.jp/> // |
| 6 | 6 | // ------------------------------------------------------------------------- // |
| 7 | 7 | |
| 8 | -require_once __DIR__.'/class/AltsysBreadcrumbs.class.php' ; |
|
| 9 | -include_once __DIR__ . '/include/gtickets.php'; |
|
| 10 | -include_once __DIR__.'/include/altsys_functions.php' ; |
|
| 11 | -include_once __DIR__ . '/include/tpls_functions.php'; |
|
| 12 | -include_once __DIR__.'/include/Text_Diff.php' ; |
|
| 13 | -include_once __DIR__.'/include/Text_Diff_Renderer.php' ; |
|
| 14 | -include_once __DIR__.'/include/Text_Diff_Renderer_unified.php' ; |
|
| 8 | +require_once __DIR__.'/class/AltsysBreadcrumbs.class.php'; |
|
| 9 | +include_once __DIR__.'/include/gtickets.php'; |
|
| 10 | +include_once __DIR__.'/include/altsys_functions.php'; |
|
| 11 | +include_once __DIR__.'/include/tpls_functions.php'; |
|
| 12 | +include_once __DIR__.'/include/Text_Diff.php'; |
|
| 13 | +include_once __DIR__.'/include/Text_Diff_Renderer.php'; |
|
| 14 | +include_once __DIR__.'/include/Text_Diff_Renderer_unified.php'; |
|
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | // only groups have 'module_admin' of 'altsys' can do that. |
| 18 | -$module_handler = xoops_getHandler('module') ; |
|
| 19 | -$module = $module_handler->getByDirname('altsys') ; |
|
| 20 | -$moduleperm_handler = xoops_getHandler('groupperm') ; |
|
| 21 | -if (! is_object(@$xoopsUser) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { |
|
| 22 | - die('only admin of altsys can access this area') ; |
|
| 18 | +$module_handler = xoops_getHandler('module'); |
|
| 19 | +$module = $module_handler->getByDirname('altsys'); |
|
| 20 | +$moduleperm_handler = xoops_getHandler('groupperm'); |
|
| 21 | +if (!is_object(@$xoopsUser) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { |
|
| 22 | + die('only admin of altsys can access this area'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | //$xoops_system_path = XOOPS_ROOT_PATH . '/modules/system' ; |
| 26 | 26 | |
| 27 | 27 | // initials |
| 28 | 28 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
| 29 | -(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance() ; |
|
| 29 | +(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
| 30 | 30 | |
| 31 | 31 | // language file |
| 32 | -altsys_include_language_file('mytplsform') ; |
|
| 33 | -altsys_include_language_file('mytplsadmin') ; |
|
| 32 | +altsys_include_language_file('mytplsform'); |
|
| 33 | +altsys_include_language_file('mytplsadmin'); |
|
| 34 | 34 | |
| 35 | 35 | // check $xoopsModule |
| 36 | -if (! is_object($xoopsModule)) { |
|
| 37 | - redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM) ; |
|
| 36 | +if (!is_object($xoopsModule)) { |
|
| 37 | + redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // check access right (needs system_admin of tplset) |
@@ -42,128 +42,128 @@ discard block |
||
| 42 | 42 | //if (!$sysperm_handler->checkRight('system_admin', XOOPS_SYSTEM_TPLSET, $xoopsUser->getGroups())) redirect_header( XOOPS_URL.'/user.php' , 1 , _NOPERM ) ; |
| 43 | 43 | |
| 44 | 44 | // tpl_file from $_GET |
| 45 | -$tpl_tplset = $myts->stripSlashesGPC(@$_GET['tpl_tplset']) ; |
|
| 46 | -if (! $tpl_tplset) { |
|
| 47 | - $tpl_tplset = $xoopsConfig['template_set'] ; |
|
| 45 | +$tpl_tplset = $myts->stripSlashesGPC(@$_GET['tpl_tplset']); |
|
| 46 | +if (!$tpl_tplset) { |
|
| 47 | + $tpl_tplset = $xoopsConfig['template_set']; |
|
| 48 | 48 | } |
| 49 | -$tpl_tplset4sql = addslashes($tpl_tplset) ; |
|
| 49 | +$tpl_tplset4sql = addslashes($tpl_tplset); |
|
| 50 | 50 | |
| 51 | 51 | if (empty($_GET['tpl_file']) || $_GET['tpl_file'] == '_custom') { |
| 52 | - $edit_mode = 'create' ; |
|
| 53 | - $tpl_file = '_custom' ; |
|
| 52 | + $edit_mode = 'create'; |
|
| 53 | + $tpl_file = '_custom'; |
|
| 54 | 54 | $tpl = array( |
| 55 | - 'tpl_id' => 0 , |
|
| 56 | - 'tpl_refid' => 0 , |
|
| 57 | - 'tpl_module' => '_custom' , |
|
| 58 | - 'tpl_tplset' => $tpl_tplset , |
|
| 59 | - 'tpl_file' => '_custom_'.substr(date('YmdHis'), 2, -2).'.html' , |
|
| 60 | - 'tpl_desc' => '' , |
|
| 61 | - 'tpl_lastmodified' => 0 , |
|
| 62 | - 'tpl_lastimported' => 0 , |
|
| 63 | - 'tpl_type' => 'custom' , |
|
| 55 | + 'tpl_id' => 0, |
|
| 56 | + 'tpl_refid' => 0, |
|
| 57 | + 'tpl_module' => '_custom', |
|
| 58 | + 'tpl_tplset' => $tpl_tplset, |
|
| 59 | + 'tpl_file' => '_custom_'.substr(date('YmdHis'), 2, -2).'.html', |
|
| 60 | + 'tpl_desc' => '', |
|
| 61 | + 'tpl_lastmodified' => 0, |
|
| 62 | + 'tpl_lastimported' => 0, |
|
| 63 | + 'tpl_type' => 'custom', |
|
| 64 | 64 | 'tpl_source' => '' |
| 65 | - ) ; |
|
| 65 | + ); |
|
| 66 | 66 | |
| 67 | 67 | // breadcrumbs |
| 68 | - $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
| 69 | - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN') ; |
|
| 70 | - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname=_custom', _MYTPLSADMIN_CUSTOMTEMPLATE) ; |
|
| 71 | - $breadcrumbsObj->appendPath('', '_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE') ; |
|
| 68 | + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); |
|
| 69 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN'); |
|
| 70 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname=_custom', _MYTPLSADMIN_CUSTOMTEMPLATE); |
|
| 71 | + $breadcrumbsObj->appendPath('', '_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE'); |
|
| 72 | 72 | $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE; |
| 73 | 73 | } else { |
| 74 | 74 | // tpl_file from $_GET |
| 75 | - $edit_mode = 'modify' ; |
|
| 76 | - $tpl_file = $myts->stripSlashesGPC(@$_GET['tpl_file']) ; |
|
| 77 | - $tpl_file = str_replace('db:', '', $tpl_file) ; |
|
| 78 | - $tpl_file4sql = addslashes($tpl_file) ; |
|
| 75 | + $edit_mode = 'modify'; |
|
| 76 | + $tpl_file = $myts->stripSlashesGPC(@$_GET['tpl_file']); |
|
| 77 | + $tpl_file = str_replace('db:', '', $tpl_file); |
|
| 78 | + $tpl_file4sql = addslashes($tpl_file); |
|
| 79 | 79 | |
| 80 | 80 | // get information from tplfile table |
| 81 | - $sql = 'SELECT * FROM ' . $db->prefix('tplfile') . ' f NATURAL LEFT JOIN ' . $db->prefix('tplsource') . " s WHERE f.tpl_file='$tpl_file4sql' ORDER BY f.tpl_tplset='$tpl_tplset4sql' DESC,f.tpl_tplset='default' DESC" ; |
|
| 82 | - $tpl = $db->fetchArray($db->query($sql)) ; |
|
| 81 | + $sql = 'SELECT * FROM '.$db->prefix('tplfile').' f NATURAL LEFT JOIN '.$db->prefix('tplsource')." s WHERE f.tpl_file='$tpl_file4sql' ORDER BY f.tpl_tplset='$tpl_tplset4sql' DESC,f.tpl_tplset='default' DESC"; |
|
| 82 | + $tpl = $db->fetchArray($db->query($sql)); |
|
| 83 | 83 | |
| 84 | 84 | // get module info |
| 85 | 85 | if ($tpl['tpl_module'] == '_custom') { |
| 86 | - $target_module = null ; |
|
| 87 | - $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE ; |
|
| 86 | + $target_module = null; |
|
| 87 | + $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE; |
|
| 88 | 88 | } else { |
| 89 | - $module_handler = xoops_getHandler('module') ; |
|
| 90 | - $target_module = $module_handler->getByDirname($tpl['tpl_module']) ; |
|
| 91 | - $target_mname = is_object($target_module) ? $target_module->getVar('name') : '' ; |
|
| 89 | + $module_handler = xoops_getHandler('module'); |
|
| 90 | + $target_module = $module_handler->getByDirname($tpl['tpl_module']); |
|
| 91 | + $target_mname = is_object($target_module) ? $target_module->getVar('name') : ''; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // breadcrumbs |
| 95 | - $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
| 95 | + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); |
|
| 96 | 96 | if ($mydirname != 'altsys' && is_object($target_module)) { |
| 97 | 97 | // mytplsform in each modules |
| 98 | - $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname') ; |
|
| 99 | - $modinfo = $target_module->getInfo() ; |
|
| 100 | - $breadcrumbsObj->appendPath($mod_url.'/'.@$modinfo['adminindex'], $target_mname) ; |
|
| 101 | - $breadcrumbsObj->appendPath($mod_url.'/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', _MD_A_MYTPLSFORM_TPLSADMIN) ; |
|
| 98 | + $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname'); |
|
| 99 | + $modinfo = $target_module->getInfo(); |
|
| 100 | + $breadcrumbsObj->appendPath($mod_url.'/'.@$modinfo['adminindex'], $target_mname); |
|
| 101 | + $breadcrumbsObj->appendPath($mod_url.'/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', _MD_A_MYTPLSFORM_TPLSADMIN); |
|
| 102 | 102 | } else { |
| 103 | 103 | // mytplsform in altsys |
| 104 | - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN') ; |
|
| 105 | - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.htmlspecialchars($tpl['tpl_module']), $target_mname) ; |
|
| 104 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN'); |
|
| 105 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.htmlspecialchars($tpl['tpl_module']), $target_mname); |
|
| 106 | 106 | } |
| 107 | - $breadcrumbsObj->appendPath('', _MD_A_MYTPLSFORM_EDIT) ; |
|
| 107 | + $breadcrumbsObj->appendPath('', _MD_A_MYTPLSFORM_EDIT); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // error in specifying tpl_file |
| 111 | 111 | if (empty($tpl)) { |
| 112 | 112 | if (strncmp($tpl_file, 'file:', 5) === 0) { |
| 113 | - die('Not DB template') ; |
|
| 113 | + die('Not DB template'); |
|
| 114 | 114 | } else { |
| 115 | - die('Invalid tpl_file.') ; |
|
| 115 | + die('Invalid tpl_file.'); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | //****************// |
| 120 | 120 | // TRANSACT stage // |
| 121 | 121 | //****************// |
| 122 | -if (! empty($_POST['do_modifycont']) || ! empty($_POST['do_modify'])) { |
|
| 122 | +if (!empty($_POST['do_modifycont']) || !empty($_POST['do_modify'])) { |
|
| 123 | 123 | // Ticket Check |
| 124 | - if (! $xoopsGTicket->check(true, 'altsys_tplsform')) { |
|
| 124 | + if (!$xoopsGTicket->check(true, 'altsys_tplsform')) { |
|
| 125 | 125 | redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $result = $db->query('SELECT tpl_id FROM ' . $db->prefix('tplfile') . " WHERE tpl_file='$tpl_file4sql' AND tpl_tplset='" . addslashes($tpl['tpl_tplset']) . "'") ; |
|
| 128 | + $result = $db->query('SELECT tpl_id FROM '.$db->prefix('tplfile')." WHERE tpl_file='$tpl_file4sql' AND tpl_tplset='".addslashes($tpl['tpl_tplset'])."'"); |
|
| 129 | 129 | while (list($tpl_id) = $db->fetchRow($result)) { |
| 130 | - $sql = 'UPDATE ' . $db->prefix('tplsource') . " SET tpl_source='" . addslashes($myts->stripSlashesGPC($_POST['tpl_source'])) . "' WHERE tpl_id=$tpl_id" ; |
|
| 131 | - if (! $db->query($sql)) { |
|
| 132 | - die('SQL Error') ; |
|
| 130 | + $sql = 'UPDATE '.$db->prefix('tplsource')." SET tpl_source='".addslashes($myts->stripSlashesGPC($_POST['tpl_source']))."' WHERE tpl_id=$tpl_id"; |
|
| 131 | + if (!$db->query($sql)) { |
|
| 132 | + die('SQL Error'); |
|
| 133 | 133 | } |
| 134 | - $db->query('UPDATE ' . $db->prefix('tplfile') . " SET tpl_lastmodified=UNIX_TIMESTAMP() WHERE tpl_id=$tpl_id") ; |
|
| 135 | - altsys_template_touch($tpl_id) ; |
|
| 134 | + $db->query('UPDATE '.$db->prefix('tplfile')." SET tpl_lastmodified=UNIX_TIMESTAMP() WHERE tpl_id=$tpl_id"); |
|
| 135 | + altsys_template_touch($tpl_id); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | // continue or end ? |
| 139 | - if (! empty($_POST['do_modifycont'])) { |
|
| 140 | - redirect_header('index.php?mode=admin&lib=altsys&page=mytplsform&tpl_file='.$tpl_file.'&tpl_tplset='.$tpl_tplset.'&dirname='.$tpl['tpl_module'].'#altsys_tplsform_top', 1, _MD_A_MYTPLSFORM_UPDATED) ; |
|
| 139 | + if (!empty($_POST['do_modifycont'])) { |
|
| 140 | + redirect_header('index.php?mode=admin&lib=altsys&page=mytplsform&tpl_file='.$tpl_file.'&tpl_tplset='.$tpl_tplset.'&dirname='.$tpl['tpl_module'].'#altsys_tplsform_top', 1, _MD_A_MYTPLSFORM_UPDATED); |
|
| 141 | 141 | } else { |
| 142 | - redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_UPDATED) ; |
|
| 142 | + redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_UPDATED); |
|
| 143 | 143 | } |
| 144 | - exit ; |
|
| 144 | + exit; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | -if (! empty($_POST['do_create'])) { |
|
| 147 | +if (!empty($_POST['do_create'])) { |
|
| 148 | 148 | // Ticket Check |
| 149 | - if (! $xoopsGTicket->check(true, 'altsys_tplsform')) { |
|
| 149 | + if (!$xoopsGTicket->check(true, 'altsys_tplsform')) { |
|
| 150 | 150 | redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $sql = 'INSERT INTO ' . $db->prefix('tplfile') . " SET tpl_file='" . addslashes($myts->stripSlashesGPC($_POST['tpl_file'])) . "',tpl_refid=0,tpl_module='" . addslashes($tpl['tpl_module']) . "',tpl_tplset='" . addslashes($tpl['tpl_tplset']) . "',tpl_lastmodified=UNIX_TIMESTAMP(),tpl_type='" . addslashes($tpl['tpl_type']) . "'" ; |
|
| 154 | - if (! $db->query($sql)) { |
|
| 155 | - die('SQL Error'.__LINE__) ; |
|
| 153 | + $sql = 'INSERT INTO '.$db->prefix('tplfile')." SET tpl_file='".addslashes($myts->stripSlashesGPC($_POST['tpl_file']))."',tpl_refid=0,tpl_module='".addslashes($tpl['tpl_module'])."',tpl_tplset='".addslashes($tpl['tpl_tplset'])."',tpl_lastmodified=UNIX_TIMESTAMP(),tpl_type='".addslashes($tpl['tpl_type'])."'"; |
|
| 154 | + if (!$db->query($sql)) { |
|
| 155 | + die('SQL Error'.__LINE__); |
|
| 156 | 156 | } |
| 157 | 157 | $tpl_id = (int)$db->getInsertId(); |
| 158 | - $sql = 'INSERT INTO ' . $db->prefix('tplsource') . " SET tpl_id=$tpl_id,tpl_source='" . addslashes($myts->stripSlashesGPC($_POST['tpl_source'])) . "'" ; |
|
| 159 | - if (! $db->query($sql)) { |
|
| 160 | - die('SQL Error'.__LINE__) ; |
|
| 158 | + $sql = 'INSERT INTO '.$db->prefix('tplsource')." SET tpl_id=$tpl_id,tpl_source='".addslashes($myts->stripSlashesGPC($_POST['tpl_source']))."'"; |
|
| 159 | + if (!$db->query($sql)) { |
|
| 160 | + die('SQL Error'.__LINE__); |
|
| 161 | 161 | } |
| 162 | - altsys_template_touch($tpl_id) ; |
|
| 162 | + altsys_template_touch($tpl_id); |
|
| 163 | 163 | |
| 164 | 164 | // continue or end ? |
| 165 | - redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_CREATED) ; |
|
| 166 | - exit ; |
|
| 165 | + redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_CREATED); |
|
| 166 | + exit; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | |
@@ -171,56 +171,56 @@ discard block |
||
| 171 | 171 | //****************// |
| 172 | 172 | // FORM stage // |
| 173 | 173 | //****************// |
| 174 | -xoops_cp_header() ; |
|
| 175 | -$mymenu_fake_uri = 'index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$mydirname ; |
|
| 174 | +xoops_cp_header(); |
|
| 175 | +$mymenu_fake_uri = 'index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$mydirname; |
|
| 176 | 176 | |
| 177 | 177 | // mymenu |
| 178 | -altsys_include_mymenu() ; |
|
| 178 | +altsys_include_mymenu(); |
|
| 179 | 179 | |
| 180 | -echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>"._MD_A_MYTPLSFORM_EDIT . ' : ' . htmlspecialchars($tpl['tpl_type'], ENT_QUOTES) . ' : ' . htmlspecialchars($tpl['tpl_file'], ENT_QUOTES) . ' (' |
|
| 181 | - . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES) . ")</h3>\n" ; |
|
| 180 | +echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>"._MD_A_MYTPLSFORM_EDIT.' : '.htmlspecialchars($tpl['tpl_type'], ENT_QUOTES).' : '.htmlspecialchars($tpl['tpl_file'], ENT_QUOTES).' (' |
|
| 181 | + . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES).")</h3>\n"; |
|
| 182 | 182 | |
| 183 | 183 | |
| 184 | 184 | // diff from file to selected DB template |
| 185 | -$basefilepath = tplsadmin_get_basefilepath($tpl['tpl_module'], $tpl['tpl_type'], $tpl['tpl_file']) ; |
|
| 186 | -$diff_from_file4disp = '' ; |
|
| 185 | +$basefilepath = tplsadmin_get_basefilepath($tpl['tpl_module'], $tpl['tpl_type'], $tpl['tpl_file']); |
|
| 186 | +$diff_from_file4disp = ''; |
|
| 187 | 187 | if (file_exists($basefilepath)) { |
| 188 | - $original_error_level = error_reporting() ; |
|
| 189 | - error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING) ; |
|
| 190 | - $diff = new Text_Diff(file($basefilepath), explode("\n", $tpl['tpl_source'])) ; |
|
| 188 | + $original_error_level = error_reporting(); |
|
| 189 | + error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING); |
|
| 190 | + $diff = new Text_Diff(file($basefilepath), explode("\n", $tpl['tpl_source'])); |
|
| 191 | 191 | $renderer = new Text_Diff_Renderer_unified(); |
| 192 | - $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES) ; |
|
| 192 | + $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES); |
|
| 193 | 193 | foreach (explode("\n", $diff_str) as $line) { |
| 194 | 194 | if (ord($line) == 0x2d) { |
| 195 | - $diff_from_file4disp .= "<span style='color:red;'>".$line."</span>\n" ; |
|
| 195 | + $diff_from_file4disp .= "<span style='color:red;'>".$line."</span>\n"; |
|
| 196 | 196 | } elseif (ord($line) == 0x2b) { |
| 197 | - $diff_from_file4disp .= "<span style='color:blue;'>".$line."</span>\n" ; |
|
| 197 | + $diff_from_file4disp .= "<span style='color:blue;'>".$line."</span>\n"; |
|
| 198 | 198 | } else { |
| 199 | - $diff_from_file4disp .= $line."\n" ; |
|
| 199 | + $diff_from_file4disp .= $line."\n"; |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | - error_reporting($original_error_level) ; |
|
| 202 | + error_reporting($original_error_level); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | // diff from DB-default to selected DB template |
| 206 | -$diff_from_default4disp = '' ; |
|
| 206 | +$diff_from_default4disp = ''; |
|
| 207 | 207 | if ($tpl['tpl_tplset'] != 'default') { |
| 208 | - $original_error_level = error_reporting() ; |
|
| 209 | - error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING) ; |
|
| 210 | - list($default_source) = $db->fetchRow($db->query('SELECT tpl_source FROM ' . $db->prefix('tplfile') . ' NATURAL LEFT JOIN ' . $db->prefix('tplsource') . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes($tpl['tpl_file']) . "' AND tpl_module='" . addslashes($tpl['tpl_module']) . "'")) ; |
|
| 211 | - $diff = new Text_Diff(explode("\n", $default_source), explode("\n", $tpl['tpl_source'])) ; |
|
| 208 | + $original_error_level = error_reporting(); |
|
| 209 | + error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING); |
|
| 210 | + list($default_source) = $db->fetchRow($db->query('SELECT tpl_source FROM '.$db->prefix('tplfile').' NATURAL LEFT JOIN '.$db->prefix('tplsource')." WHERE tpl_tplset='default' AND tpl_file='".addslashes($tpl['tpl_file'])."' AND tpl_module='".addslashes($tpl['tpl_module'])."'")); |
|
| 211 | + $diff = new Text_Diff(explode("\n", $default_source), explode("\n", $tpl['tpl_source'])); |
|
| 212 | 212 | $renderer = new Text_Diff_Renderer_unified(); |
| 213 | - $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES) ; |
|
| 213 | + $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES); |
|
| 214 | 214 | foreach (explode("\n", $diff_str) as $line) { |
| 215 | 215 | if (ord($line) == 0x2d) { |
| 216 | - $diff_from_default4disp .= "<span style='color:red;'>".$line."</span>\n" ; |
|
| 216 | + $diff_from_default4disp .= "<span style='color:red;'>".$line."</span>\n"; |
|
| 217 | 217 | } elseif (ord($line) == 0x2b) { |
| 218 | - $diff_from_default4disp .= "<span style='color:blue;'>".$line."</span>\n" ; |
|
| 218 | + $diff_from_default4disp .= "<span style='color:blue;'>".$line."</span>\n"; |
|
| 219 | 219 | } else { |
| 220 | - $diff_from_default4disp .= $line."\n" ; |
|
| 220 | + $diff_from_default4disp .= $line."\n"; |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | - error_reporting($original_error_level) ; |
|
| 223 | + error_reporting($original_error_level); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | <form name='diff_form' id='diff_form' action='' method='get'>\n" ; |
| 229 | 229 | if ($diff_from_file4disp) { |
| 230 | 230 | echo "<input type='checkbox' name='display_diff2file' value='1' onClick=\"if(this.checked){document.getElementById('diff2file').style.display='block'}else{document.getElementById('diff2file').style.display='none'};\" id='display_diff2file' checked='checked' /> <label for='display_diff2file'>diff from file</label> |
| 231 | - <pre id='diff2file' style='display:block;border:1px solid black;'>$diff_from_file4disp</pre>\n" ; |
|
| 231 | + <pre id='diff2file' style='display:block;border:1px solid black;'>$diff_from_file4disp</pre>\n"; |
|
| 232 | 232 | } |
| 233 | 233 | if ($diff_from_default4disp) { |
| 234 | 234 | echo "<input type='checkbox' name='display_diff2default' value='1' onClick=\"if(this.checked){document.getElementById('diff2default').style.display='block'}else{document.getElementById('diff2default').style.display='none'};\" id='display_diff2default' /> <label for='display_diff2default'>diff from default</label> |
| 235 | - <pre id='diff2default' style='display:none;border:1px solid black;'>$diff_from_default4disp</pre>\n" ; |
|
| 235 | + <pre id='diff2default' style='display:none;border:1px solid black;'>$diff_from_default4disp</pre>\n"; |
|
| 236 | 236 | } |
| 237 | 237 | echo " |
| 238 | 238 | </form>\n" ; |
@@ -240,10 +240,10 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | echo " |
| 242 | 242 | <a name='altsys_tplsform_top' id='altsys_tplsform_top'></a> |
| 243 | -<form name='MainForm' id='altsys_tplsform' action='?mode=admin&lib=altsys&page=mytplsform&tpl_file=".htmlspecialchars($tpl_file, ENT_QUOTES) . '&tpl_tplset=' |
|
| 244 | - . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES) . '&dirname=' . $target_mname . "' method='post'> |
|
| 243 | +<form name='MainForm' id='altsys_tplsform' action='?mode=admin&lib=altsys&page=mytplsform&tpl_file=".htmlspecialchars($tpl_file, ENT_QUOTES).'&tpl_tplset=' |
|
| 244 | + . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES).'&dirname='.$target_mname."' method='post'> |
|
| 245 | 245 | ".$xoopsGTicket->getTicketHtml(__LINE__, 1800, 'altsys_tplsform')." |
| 246 | - <textarea name='tpl_source' id='altsys_tpl_source' wrap='off' style='width:600px;height:400px;'>".htmlspecialchars($tpl['tpl_source'], ENT_QUOTES) . '</textarea> |
|
| 246 | + <textarea name='tpl_source' id='altsys_tpl_source' wrap='off' style='width:600px;height:400px;'>".htmlspecialchars($tpl['tpl_source'], ENT_QUOTES).'</textarea> |
|
| 247 | 247 | <br /> |
| 248 | 248 | '; |
| 249 | 249 | if ($edit_mode == 'create') { |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | echo " |
| 252 | 252 | <label for='tpl_file'>"._MD_A_MYTPLSFORM_LABEL_TPLFILE."</label> |
| 253 | 253 | <input type='text' name='tpl_file' id='tpl_file' value='".htmlspecialchars($tpl['tpl_file'], ENT_QUOTES)."' size='64' /><br /> |
| 254 | - <input type='submit' name='do_create' id='do_create' value='"._MD_A_MYTPLSFORM_BTN_CREATE."' />\n" ; |
|
| 254 | + <input type='submit' name='do_create' id='do_create' value='"._MD_A_MYTPLSFORM_BTN_CREATE."' />\n"; |
|
| 255 | 255 | } else { |
| 256 | 256 | // modify form |
| 257 | 257 | echo " |
@@ -261,4 +261,4 @@ discard block |
||
| 261 | 261 | </form>\n" ; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | -xoops_cp_footer() ; |
|
| 264 | +xoops_cp_footer(); |
|
@@ -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 | 15 | $root = XCube_Root::getSingleton(); |
| 16 | - $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUninstall.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_onuninstall') ; |
|
| 17 | - $ret = array() ; |
|
| 16 | + $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUninstall.'.ucfirst($mydirname).'.Success', 'altsys_message_append_onuninstall'); |
|
| 17 | + $ret = array(); |
|
| 18 | 18 | } else { |
| 19 | - if (! is_array($ret)) { |
|
| 20 | - $ret = array() ; |
|
| 19 | + if (!is_array($ret)) { |
|
| 20 | + $ret = array(); |
|
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - $db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
| 25 | - $mid = $module->getVar('mid') ; |
|
| 24 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 25 | + $mid = $module->getVar('mid'); |
|
| 26 | 26 | |
| 27 | 27 | // TABLES (loading mysql.sql) |
| 28 | - $sql_file_path = __DIR__.'/sql/mysql.sql' ; |
|
| 29 | - $prefix_mod = $db->prefix() . '_' . $mydirname ; |
|
| 28 | + $sql_file_path = __DIR__.'/sql/mysql.sql'; |
|
| 29 | + $prefix_mod = $db->prefix().'_'.$mydirname; |
|
| 30 | 30 | if (file_exists($sql_file_path)) { |
| 31 | - $ret[] = 'SQL file found at <b>' . htmlspecialchars($sql_file_path) . '</b>.<br /> Deleting tables...<br />'; |
|
| 32 | - $sql_lines = file($sql_file_path) ; |
|
| 31 | + $ret[] = 'SQL file found at <b>'.htmlspecialchars($sql_file_path).'</b>.<br /> Deleting tables...<br />'; |
|
| 32 | + $sql_lines = file($sql_file_path); |
|
| 33 | 33 | foreach ($sql_lines as $sql_line) { |
| 34 | 34 | if (preg_match('/^CREATE TABLE \`?([a-zA-Z0-9_-]+)\`? /i', $sql_line, $regs)) { |
| 35 | 35 | $sql = 'DROP TABLE '.addslashes($prefix_mod.'_'.$regs[1]); |
@@ -59,14 +59,14 @@ discard block |
||
| 59 | 59 | unset($templates); */ |
| 60 | 60 | |
| 61 | 61 | |
| 62 | - return true ; |
|
| 62 | + return true; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | function altsys_message_append_onuninstall(&$module_obj, &$log) |
| 66 | 66 | { |
| 67 | 67 | if (is_array(@$GLOBALS['ret'])) { |
| 68 | 68 | foreach ($GLOBALS['ret'] as $message) { |
| 69 | - $log->add(strip_tags($message)) ; |
|
| 69 | + $log->add(strip_tags($message)); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |