@@ -21,8 +21,8 @@ |
||
21 | 21 | |
22 | 22 | |
23 | 23 | if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { |
24 | - include_once XOOPS_ROOT_PATH . "/class/template.php"; |
|
25 | - $xoopsTpl = new XoopsTpl(); |
|
24 | + include_once XOOPS_ROOT_PATH . "/class/template.php"; |
|
25 | + $xoopsTpl = new XoopsTpl(); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | IF (!@ include_once XOOPS_ROOT_PATH . "/Frameworks/art/functions.admin.php"): |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | |
22 | 22 | |
23 | 23 | if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { |
24 | - include_once XOOPS_ROOT_PATH . "/class/template.php"; |
|
24 | + include_once XOOPS_ROOT_PATH."/class/template.php"; |
|
25 | 25 | $xoopsTpl = new XoopsTpl(); |
26 | 26 | } |
27 | 27 | |
28 | -IF (!@ include_once XOOPS_ROOT_PATH . "/Frameworks/art/functions.admin.php"): |
|
28 | +IF (!@ include_once XOOPS_ROOT_PATH."/Frameworks/art/functions.admin.php"): |
|
29 | 29 | |
30 | 30 | |
31 | 31 | function loadModuleAdminMenu($currentoption, $breadcrumb = "") |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | $breadcrumb = empty($breadcrumb) ? $adminmenu[$currentoption]["title"] : $breadcrumb; |
38 | - $module_link = XOOPS_URL . "/modules/" . $GLOBALS["xoopsModule"]->getVar("dirname") . "/"; |
|
39 | - $image_link = XOOPS_URL . "/modules/" . $GLOBALS["xoopsModule"]->getVar("dirname") . "/images"; |
|
38 | + $module_link = XOOPS_URL."/modules/".$GLOBALS["xoopsModule"]->getVar("dirname")."/"; |
|
39 | + $image_link = XOOPS_URL."/modules/".$GLOBALS["xoopsModule"]->getVar("dirname")."/images"; |
|
40 | 40 | |
41 | - $adminmenu_text =' |
|
41 | + $adminmenu_text = ' |
|
42 | 42 | <style type="text/css"> |
43 | 43 | <!-- |
44 | 44 | #buttontop { float:left; width:100%; background: #e7e7e7; font-size:93%; line-height:normal; border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; margin: 0;} |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | <table style="width: 100%; padding: 0; " cellspacing="0"> |
62 | 62 | <tr> |
63 | 63 | <td style="width: 70%; font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;"> |
64 | - <a href="../index.php">' . $GLOBALS["xoopsModule"]->getVar("name") . '</a> |
|
64 | + <a href="../index.php">' . $GLOBALS["xoopsModule"]->getVar("name").'</a> |
|
65 | 65 | </td> |
66 | 66 | <td style="width: 30%; font-size: 10px; text-align: right; color: #2F5376; padding: 0 6px; line-height: 18px;"> |
67 | - <strong>' . $GLOBALS["xoopsModule"]->getVar("name") . '</strong> ' . $breadcrumb . ' |
|
67 | + <strong>' . $GLOBALS["xoopsModule"]->getVar("name").'</strong> '.$breadcrumb.' |
|
68 | 68 | </td> |
69 | 69 | </tr> |
70 | 70 | </table> |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | <ul> |
74 | 74 | '; |
75 | 75 | foreach (array_keys($adminmenu) as $key) { |
76 | - $adminmenu_text .= (($currentoption == $key) ? '<li class="current">' : '<li>') . '<a href="' . $module_link . $adminmenu[$key]["link"] . '"><span>' . $adminmenu[$key]["title"] . '</span></a></li>'; |
|
76 | + $adminmenu_text .= (($currentoption == $key) ? '<li class="current">' : '<li>').'<a href="'.$module_link.$adminmenu[$key]["link"].'"><span>'.$adminmenu[$key]["title"].'</span></a></li>'; |
|
77 | 77 | } |
78 | - $adminmenu_text .= '<li><a href="' . XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $GLOBALS["xoopsModule"]->getVar("mid") . '"><span>' . _PREFERENCES . '</span></a></li>'; |
|
78 | + $adminmenu_text .= '<li><a href="'.XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$GLOBALS["xoopsModule"]->getVar("mid").'"><span>'._PREFERENCES.'</span></a></li>'; |
|
79 | 79 | $adminmenu_text .= ' |
80 | 80 | </ul> |
81 | 81 | </div> |
@@ -26,25 +26,25 @@ discard block |
||
26 | 26 | switch($op) { |
27 | 27 | default: |
28 | 28 | case "list": |
29 | - $module_handler =& xoops_gethandler('module'); |
|
29 | + $module_handler =& xoops_gethandler('module'); |
|
30 | 30 | $criteria = new Criteria('isactive', 1); |
31 | 31 | $generator_list = $module_handler->getList($criteria); |
32 | - $fields = array("bid","mid","name","title","desciption","bcachetime","bcachemodel","last_modified"); |
|
33 | - $blockscall_data = $blockscall_handler->getAll(null,$fields,false,false); |
|
34 | - $cachetime = array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK, '2592000' => _MONTH); |
|
35 | - $cachemodel = array( '0' => _AM_TOOLS_BC_GLOBAL, '1' => _AM_TOOLS_BC_GROUP, '2' => _AM_TOOLS_BC_USER); |
|
36 | - foreach ($blockscall_data as $k=>$v){ |
|
37 | - $blockscall_data[$k]['mname'] = $generator_list[$v['mid']]; |
|
38 | - $blockscall_data[$k]['bcachetime'] = $cachetime[$v['bcachetime']]; |
|
39 | - $blockscall_data[$k]['bcachemodel'] = $cachemodel[$v['bcachemodel']]; |
|
40 | - $blockscall_data[$k]['last_modified'] = formatTimestamp($v['last_modified']); |
|
41 | - } |
|
42 | - $template_main = "tools_admin_blockscall.html"; |
|
43 | - $xoopsTpl->assign("bc_data",$blockscall_data); |
|
44 | - break; |
|
32 | + $fields = array("bid","mid","name","title","desciption","bcachetime","bcachemodel","last_modified"); |
|
33 | + $blockscall_data = $blockscall_handler->getAll(null,$fields,false,false); |
|
34 | + $cachetime = array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK, '2592000' => _MONTH); |
|
35 | + $cachemodel = array( '0' => _AM_TOOLS_BC_GLOBAL, '1' => _AM_TOOLS_BC_GROUP, '2' => _AM_TOOLS_BC_USER); |
|
36 | + foreach ($blockscall_data as $k=>$v){ |
|
37 | + $blockscall_data[$k]['mname'] = $generator_list[$v['mid']]; |
|
38 | + $blockscall_data[$k]['bcachetime'] = $cachetime[$v['bcachetime']]; |
|
39 | + $blockscall_data[$k]['bcachemodel'] = $cachemodel[$v['bcachemodel']]; |
|
40 | + $blockscall_data[$k]['last_modified'] = formatTimestamp($v['last_modified']); |
|
41 | + } |
|
42 | + $template_main = "tools_admin_blockscall.html"; |
|
43 | + $xoopsTpl->assign("bc_data",$blockscall_data); |
|
44 | + break; |
|
45 | 45 | case "new": |
46 | 46 | // Modules for blocks to be visible in |
47 | - $module_handler =& xoops_gethandler('module'); |
|
47 | + $module_handler =& xoops_gethandler('module'); |
|
48 | 48 | $criteria = new Criteria('isactive', 1); |
49 | 49 | $generator_list = $module_handler->getList($criteria); |
50 | 50 | unset($criteria); |
@@ -55,42 +55,42 @@ discard block |
||
55 | 55 | //get blocks |
56 | 56 | $criteria = new CriteriaCompo(new Criteria("mid",0,"!=")); |
57 | 57 | if($selgen != -1){ |
58 | - $criteria->add(new Criteria("mid",$selgen)); |
|
58 | + $criteria->add(new Criteria("mid",$selgen)); |
|
59 | + } |
|
60 | + $fields = array("bid","mid","name","title"); |
|
61 | + $blocks_handler = xoops_getmodulehandler("xoopsblock"); |
|
62 | + $blocks_array = $blocks_handler->getAll($criteria,$fields,false ,false); |
|
63 | + foreach ($blocks_array as $k=>$v){ |
|
64 | + $blocks_array[$k]['mname'] = $generator_list[$v['mid']]; |
|
59 | 65 | } |
60 | - $fields = array("bid","mid","name","title"); |
|
61 | - $blocks_handler = xoops_getmodulehandler("xoopsblock"); |
|
62 | - $blocks_array = $blocks_handler->getAll($criteria,$fields,false ,false); |
|
63 | - foreach ($blocks_array as $k=>$v){ |
|
64 | - $blocks_array[$k]['mname'] = $generator_list[$v['mid']]; |
|
65 | - } |
|
66 | - unset($criteria); |
|
66 | + unset($criteria); |
|
67 | 67 | |
68 | 68 | $xoopsTpl->assign("selgen",$selgen); |
69 | - $xoopsTpl->assign("modules",$generator_list); |
|
70 | - $xoopsTpl->assign("blocks",$blocks_array); |
|
71 | - $template_main = "tools_admin_blockscall_new.html"; |
|
72 | - break; |
|
69 | + $xoopsTpl->assign("modules",$generator_list); |
|
70 | + $xoopsTpl->assign("blocks",$blocks_array); |
|
71 | + $template_main = "tools_admin_blockscall_new.html"; |
|
72 | + break; |
|
73 | 73 | |
74 | 74 | case "create": |
75 | 75 | |
76 | - $blocks_handler = xoops_getmodulehandler("xoopsblock"); |
|
77 | - $block_obj = $blocks_handler->get($_GET['bid']); |
|
78 | - $o_block = $block_obj->getValues(); |
|
76 | + $blocks_handler = xoops_getmodulehandler("xoopsblock"); |
|
77 | + $block_obj = $blocks_handler->get($_GET['bid']); |
|
78 | + $o_block = $block_obj->getValues(); |
|
79 | 79 | |
80 | 80 | if ($o_block['template'] != '') { |
81 | - $tplfile_handler =& xoops_gethandler('tplfile'); |
|
82 | - $btemplate = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $o_block['bid'],'','',true); |
|
83 | - if (count($btemplate) > 0) { |
|
84 | - $tpl_source = $btemplate[0]->getVar('tpl_source','n'); |
|
85 | - } else { |
|
86 | - $btemplate2 = $tplfile_handler->find('default', 'block', $o_block['bid'],'','',true); |
|
87 | - if (count($btemplate2) > 0) { |
|
88 | - $tpl_source = $btemplate2[0]->getVar('tpl_source','n'); |
|
89 | - } |
|
90 | - } |
|
81 | + $tplfile_handler =& xoops_gethandler('tplfile'); |
|
82 | + $btemplate = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $o_block['bid'],'','',true); |
|
83 | + if (count($btemplate) > 0) { |
|
84 | + $tpl_source = $btemplate[0]->getVar('tpl_source','n'); |
|
85 | + } else { |
|
86 | + $btemplate2 = $tplfile_handler->find('default', 'block', $o_block['bid'],'','',true); |
|
87 | + if (count($btemplate2) > 0) { |
|
88 | + $tpl_source = $btemplate2[0]->getVar('tpl_source','n'); |
|
89 | + } |
|
90 | + } |
|
91 | 91 | } |
92 | 92 | |
93 | - $blockscall_obj =& $blockscall_handler->create(); |
|
93 | + $blockscall_obj =& $blockscall_handler->create(); |
|
94 | 94 | $blockscall_obj->setVar('bid', $o_block['bid']); |
95 | 95 | $blockscall_obj->setVar('mid', $o_block['mid']); |
96 | 96 | $blockscall_obj->setVar('options', $o_block['options']); |
@@ -109,98 +109,98 @@ discard block |
||
109 | 109 | redirect_header("blockscall.php?op=edit&bid={$blockscall_obj->getVar('bid')}", 3, sprintf(_AM_TOOLS_BC_CREATESUCCESS, $blockscall_obj->getVar('name'))); |
110 | 110 | } |
111 | 111 | |
112 | - break; |
|
112 | + break; |
|
113 | 113 | |
114 | 114 | case "edit": |
115 | 115 | |
116 | - $blockscall_obj = $blockscall_handler->get($_GET['bid']); |
|
117 | - $block_data = $blockscall_obj->getValues(null,'n'); |
|
118 | - $block_data['edit_form'] = $blockscall_obj->getOptions(); |
|
116 | + $blockscall_obj = $blockscall_handler->get($_GET['bid']); |
|
117 | + $block_data = $blockscall_obj->getValues(null,'n'); |
|
118 | + $block_data['edit_form'] = $blockscall_obj->getOptions(); |
|
119 | 119 | |
120 | - $blockoption = !empty($block_data['options']) ? "options=\"{$block_data['options']}\"" :""; |
|
121 | - $cachetime = $block_data['bcachetime'] !=0 ? " cachetime=".$block_data['bcachetime'] : ""; |
|
122 | - if ($cachetime){ |
|
123 | - switch ($block_data['bcachemodel']) { |
|
124 | - case 0: |
|
125 | - $cachemodel = " cachemodel=global"; |
|
126 | - break; |
|
127 | - case 1: |
|
128 | - $cachemodel = " cachemodel=\$xoopsUser->getGroups()"; |
|
129 | - break; |
|
130 | - case 2: |
|
131 | - $cachemodel = " cachemodel=\$xoopsUser"; |
|
132 | - break; |
|
133 | - } |
|
134 | - }else { |
|
135 | - $cachemodel =""; |
|
136 | - } |
|
120 | + $blockoption = !empty($block_data['options']) ? "options=\"{$block_data['options']}\"" :""; |
|
121 | + $cachetime = $block_data['bcachetime'] !=0 ? " cachetime=".$block_data['bcachetime'] : ""; |
|
122 | + if ($cachetime){ |
|
123 | + switch ($block_data['bcachemodel']) { |
|
124 | + case 0: |
|
125 | + $cachemodel = " cachemodel=global"; |
|
126 | + break; |
|
127 | + case 1: |
|
128 | + $cachemodel = " cachemodel=\$xoopsUser->getGroups()"; |
|
129 | + break; |
|
130 | + case 2: |
|
131 | + $cachemodel = " cachemodel=\$xoopsUser"; |
|
132 | + break; |
|
133 | + } |
|
134 | + }else { |
|
135 | + $cachemodel =""; |
|
136 | + } |
|
137 | 137 | |
138 | - $xoblktpl =<<<EOF |
|
138 | + $xoblktpl =<<<EOF |
|
139 | 139 | <{xoBlkTpl module="{$block_data['dirname']}" file="{$block_data['func_file']}" show_func="{$block_data['show_func']}" {$blockoption}$cachetime$cachemodel}> |
140 | 140 | {$block_data['tpl_content']} |
141 | 141 | <{/xoBlkTpl}> |
142 | 142 | EOF; |
143 | - $xoblk =<<<EOF |
|
143 | + $xoblk =<<<EOF |
|
144 | 144 | <{xoBlk module="{$block_data['dirname']}" file="{$block_data['func_file']}" show_func="{$block_data['show_func']}" $blockoption template="{$block_data['template']}"$cachetime$cachemodel}> |
145 | 145 | EOF; |
146 | 146 | |
147 | - include "../include/blockform.php"; |
|
147 | + include "../include/blockform.php"; |
|
148 | 148 | |
149 | - $xoopsTpl->assign("xoblktpl",$xoblktpl); |
|
150 | - $xoopsTpl->assign("xoblk",$xoblk); |
|
149 | + $xoopsTpl->assign("xoblktpl",$xoblktpl); |
|
150 | + $xoopsTpl->assign("xoblk",$xoblk); |
|
151 | 151 | |
152 | - $template_main = "tools_admin_blockscall_edit.html"; |
|
152 | + $template_main = "tools_admin_blockscall_edit.html"; |
|
153 | 153 | |
154 | - break; |
|
154 | + break; |
|
155 | 155 | |
156 | 156 | case "save": |
157 | - $blockscall_obj =& $blockscall_handler->get($_REQUEST['bid']); |
|
158 | - if (isset($_REQUEST['save']) && $_REQUEST['save']=="blk"){ |
|
159 | - if (isset($_REQUEST['options'])) { |
|
160 | - $options = $_REQUEST['options']; |
|
161 | - $options_count = count($options); |
|
162 | - if ($options_count > 0) { |
|
163 | - //Convert array values to comma-separated |
|
164 | - for ( $i = 0; $i < $options_count; $i++ ) { |
|
165 | - if (is_array($options[$i])) { |
|
166 | - $options[$i] = implode(',', $options[$i]); |
|
167 | - } |
|
168 | - } |
|
169 | - $options = implode('|', $options); |
|
170 | - $blockscall_obj->setVar('options', $options); |
|
171 | - } |
|
172 | - } |
|
173 | - $blockscall_obj->setVar('desciption', $_REQUEST['desc']); |
|
174 | - $blockscall_obj->setVar('bcachetime', $_REQUEST['bcachetime']); |
|
175 | - $blockscall_obj->setVar('bcachemodel', $_REQUEST['bcachemodel']); |
|
176 | - }elseif(isset($_REQUEST['save']) && $_REQUEST['save']=="tpl") { |
|
177 | - $blockscall_obj->setVar('tpl_content', $_REQUEST['tpl_content']); |
|
178 | - }else { |
|
179 | - exit(); |
|
180 | - } |
|
157 | + $blockscall_obj =& $blockscall_handler->get($_REQUEST['bid']); |
|
158 | + if (isset($_REQUEST['save']) && $_REQUEST['save']=="blk"){ |
|
159 | + if (isset($_REQUEST['options'])) { |
|
160 | + $options = $_REQUEST['options']; |
|
161 | + $options_count = count($options); |
|
162 | + if ($options_count > 0) { |
|
163 | + //Convert array values to comma-separated |
|
164 | + for ( $i = 0; $i < $options_count; $i++ ) { |
|
165 | + if (is_array($options[$i])) { |
|
166 | + $options[$i] = implode(',', $options[$i]); |
|
167 | + } |
|
168 | + } |
|
169 | + $options = implode('|', $options); |
|
170 | + $blockscall_obj->setVar('options', $options); |
|
171 | + } |
|
172 | + } |
|
173 | + $blockscall_obj->setVar('desciption', $_REQUEST['desc']); |
|
174 | + $blockscall_obj->setVar('bcachetime', $_REQUEST['bcachetime']); |
|
175 | + $blockscall_obj->setVar('bcachemodel', $_REQUEST['bcachemodel']); |
|
176 | + }elseif(isset($_REQUEST['save']) && $_REQUEST['save']=="tpl") { |
|
177 | + $blockscall_obj->setVar('tpl_content', $_REQUEST['tpl_content']); |
|
178 | + }else { |
|
179 | + exit(); |
|
180 | + } |
|
181 | 181 | |
182 | 182 | |
183 | 183 | $blockscall_obj->setVar('last_modified', time()); |
184 | 184 | if ($blockscall_handler->insert($blockscall_obj)) { |
185 | 185 | redirect_header("blockscall.php?op=edit&bid={$blockscall_obj->getVar('bid')}", 3, sprintf(_AM_TOOLS_BC_SAVEDSUCCESS, $blockscall_obj->getVar('name'))); |
186 | 186 | } |
187 | - break; |
|
187 | + break; |
|
188 | 188 | |
189 | 189 | case "edittpl": |
190 | - $blockscall_obj =& $blockscall_handler->get($_REQUEST['bid']); |
|
191 | - $block_data = $blockscall_obj->getValues(null,'n'); |
|
192 | - include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; |
|
193 | - $form = new XoopsThemeForm(_AM_TOOLS_BC_EDITTPL, 'form', 'blockscall.php', "post", true); |
|
194 | - $form->addElement(new XoopsFormLabel(_AM_TOOLS_BC_BLOCK,$block_data['name'])); |
|
195 | - $form->addElement(new XoopsFormTextArea(_AM_TOOLS_BC_TPLSOURCES,"tpl_content",$block_data['tpl_content'],10,80)); |
|
196 | - $form->addElement(new XoopsFormHidden('bid', $block_data['bid'])); |
|
197 | - $form->addElement(new XoopsFormHidden('op', 'save')); |
|
198 | - $form->addElement(new XoopsFormHidden('save', 'tpl')); |
|
199 | - $button_tray = new XoopsFormElementTray('', ' '); |
|
200 | - $button_tray->addElement(new XoopsFormButton('', 'submitblock', _SUBMIT, "submit")); |
|
201 | - $form->addElement($button_tray); |
|
202 | - $form->display(); |
|
203 | - break; |
|
190 | + $blockscall_obj =& $blockscall_handler->get($_REQUEST['bid']); |
|
191 | + $block_data = $blockscall_obj->getValues(null,'n'); |
|
192 | + include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; |
|
193 | + $form = new XoopsThemeForm(_AM_TOOLS_BC_EDITTPL, 'form', 'blockscall.php', "post", true); |
|
194 | + $form->addElement(new XoopsFormLabel(_AM_TOOLS_BC_BLOCK,$block_data['name'])); |
|
195 | + $form->addElement(new XoopsFormTextArea(_AM_TOOLS_BC_TPLSOURCES,"tpl_content",$block_data['tpl_content'],10,80)); |
|
196 | + $form->addElement(new XoopsFormHidden('bid', $block_data['bid'])); |
|
197 | + $form->addElement(new XoopsFormHidden('op', 'save')); |
|
198 | + $form->addElement(new XoopsFormHidden('save', 'tpl')); |
|
199 | + $button_tray = new XoopsFormElementTray('', ' '); |
|
200 | + $button_tray->addElement(new XoopsFormButton('', 'submitblock', _SUBMIT, "submit")); |
|
201 | + $form->addElement($button_tray); |
|
202 | + $form->display(); |
|
203 | + break; |
|
204 | 204 | |
205 | 205 | case "delete": |
206 | 206 | $blockscall_obj =& $blockscall_handler->get($_REQUEST['bid']); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } else { |
217 | 217 | xoops_confirm(array('ok' => 1, 'id' => $_REQUEST['bid'], 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_TOOLS_BC_RUSUREDEL, $blockscall_obj->getVar('name'))); |
218 | 218 | } |
219 | - break; |
|
219 | + break; |
|
220 | 220 | } |
221 | 221 | $css = '<link rel="stylesheet" type="text/css" media="all" href="' . XOOPS_URL . '/modules/tools/templates/style.css" />'; |
222 | 222 | $xoopsTpl->assign('css', $css); |
@@ -23,51 +23,51 @@ discard block |
||
23 | 23 | |
24 | 24 | $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : 'list'; |
25 | 25 | $blockscall_handler = xoops_getmodulehandler("blockscall"); |
26 | -switch($op) { |
|
26 | +switch ($op) { |
|
27 | 27 | default: |
28 | 28 | case "list": |
29 | - $module_handler =& xoops_gethandler('module'); |
|
29 | + $module_handler = & xoops_gethandler('module'); |
|
30 | 30 | $criteria = new Criteria('isactive', 1); |
31 | 31 | $generator_list = $module_handler->getList($criteria); |
32 | - $fields = array("bid","mid","name","title","desciption","bcachetime","bcachemodel","last_modified"); |
|
33 | - $blockscall_data = $blockscall_handler->getAll(null,$fields,false,false); |
|
32 | + $fields = array("bid", "mid", "name", "title", "desciption", "bcachetime", "bcachemodel", "last_modified"); |
|
33 | + $blockscall_data = $blockscall_handler->getAll(null, $fields, false, false); |
|
34 | 34 | $cachetime = array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK, '2592000' => _MONTH); |
35 | - $cachemodel = array( '0' => _AM_TOOLS_BC_GLOBAL, '1' => _AM_TOOLS_BC_GROUP, '2' => _AM_TOOLS_BC_USER); |
|
36 | - foreach ($blockscall_data as $k=>$v){ |
|
35 | + $cachemodel = array('0' => _AM_TOOLS_BC_GLOBAL, '1' => _AM_TOOLS_BC_GROUP, '2' => _AM_TOOLS_BC_USER); |
|
36 | + foreach ($blockscall_data as $k=>$v) { |
|
37 | 37 | $blockscall_data[$k]['mname'] = $generator_list[$v['mid']]; |
38 | 38 | $blockscall_data[$k]['bcachetime'] = $cachetime[$v['bcachetime']]; |
39 | 39 | $blockscall_data[$k]['bcachemodel'] = $cachemodel[$v['bcachemodel']]; |
40 | 40 | $blockscall_data[$k]['last_modified'] = formatTimestamp($v['last_modified']); |
41 | 41 | } |
42 | 42 | $template_main = "tools_admin_blockscall.html"; |
43 | - $xoopsTpl->assign("bc_data",$blockscall_data); |
|
43 | + $xoopsTpl->assign("bc_data", $blockscall_data); |
|
44 | 44 | break; |
45 | 45 | case "new": |
46 | 46 | // Modules for blocks to be visible in |
47 | - $module_handler =& xoops_gethandler('module'); |
|
47 | + $module_handler = & xoops_gethandler('module'); |
|
48 | 48 | $criteria = new Criteria('isactive', 1); |
49 | 49 | $generator_list = $module_handler->getList($criteria); |
50 | 50 | unset($criteria); |
51 | 51 | $generator_list[-1] = _AM_TOOLS_BC_ALLTYPES; |
52 | 52 | ksort($generator_list); |
53 | - $selgen = isset($_GET['selgen']) ? intval($_GET['selgen']) : -1 ; |
|
53 | + $selgen = isset($_GET['selgen']) ? intval($_GET['selgen']) : -1; |
|
54 | 54 | |
55 | 55 | //get blocks |
56 | - $criteria = new CriteriaCompo(new Criteria("mid",0,"!=")); |
|
57 | - if($selgen != -1){ |
|
58 | - $criteria->add(new Criteria("mid",$selgen)); |
|
56 | + $criteria = new CriteriaCompo(new Criteria("mid", 0, "!=")); |
|
57 | + if ($selgen != -1) { |
|
58 | + $criteria->add(new Criteria("mid", $selgen)); |
|
59 | 59 | } |
60 | - $fields = array("bid","mid","name","title"); |
|
60 | + $fields = array("bid", "mid", "name", "title"); |
|
61 | 61 | $blocks_handler = xoops_getmodulehandler("xoopsblock"); |
62 | - $blocks_array = $blocks_handler->getAll($criteria,$fields,false ,false); |
|
63 | - foreach ($blocks_array as $k=>$v){ |
|
62 | + $blocks_array = $blocks_handler->getAll($criteria, $fields, false, false); |
|
63 | + foreach ($blocks_array as $k=>$v) { |
|
64 | 64 | $blocks_array[$k]['mname'] = $generator_list[$v['mid']]; |
65 | 65 | } |
66 | 66 | unset($criteria); |
67 | 67 | |
68 | - $xoopsTpl->assign("selgen",$selgen); |
|
69 | - $xoopsTpl->assign("modules",$generator_list); |
|
70 | - $xoopsTpl->assign("blocks",$blocks_array); |
|
68 | + $xoopsTpl->assign("selgen", $selgen); |
|
69 | + $xoopsTpl->assign("modules", $generator_list); |
|
70 | + $xoopsTpl->assign("blocks", $blocks_array); |
|
71 | 71 | $template_main = "tools_admin_blockscall_new.html"; |
72 | 72 | break; |
73 | 73 | |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | $o_block = $block_obj->getValues(); |
79 | 79 | |
80 | 80 | if ($o_block['template'] != '') { |
81 | - $tplfile_handler =& xoops_gethandler('tplfile'); |
|
82 | - $btemplate = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $o_block['bid'],'','',true); |
|
81 | + $tplfile_handler = & xoops_gethandler('tplfile'); |
|
82 | + $btemplate = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $o_block['bid'], '', '', true); |
|
83 | 83 | if (count($btemplate) > 0) { |
84 | - $tpl_source = $btemplate[0]->getVar('tpl_source','n'); |
|
84 | + $tpl_source = $btemplate[0]->getVar('tpl_source', 'n'); |
|
85 | 85 | } else { |
86 | - $btemplate2 = $tplfile_handler->find('default', 'block', $o_block['bid'],'','',true); |
|
86 | + $btemplate2 = $tplfile_handler->find('default', 'block', $o_block['bid'], '', '', true); |
|
87 | 87 | if (count($btemplate2) > 0) { |
88 | - $tpl_source = $btemplate2[0]->getVar('tpl_source','n'); |
|
88 | + $tpl_source = $btemplate2[0]->getVar('tpl_source', 'n'); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | - $blockscall_obj =& $blockscall_handler->create(); |
|
93 | + $blockscall_obj = & $blockscall_handler->create(); |
|
94 | 94 | $blockscall_obj->setVar('bid', $o_block['bid']); |
95 | 95 | $blockscall_obj->setVar('mid', $o_block['mid']); |
96 | 96 | $blockscall_obj->setVar('options', $o_block['options']); |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | case "edit": |
115 | 115 | |
116 | 116 | $blockscall_obj = $blockscall_handler->get($_GET['bid']); |
117 | - $block_data = $blockscall_obj->getValues(null,'n'); |
|
117 | + $block_data = $blockscall_obj->getValues(null, 'n'); |
|
118 | 118 | $block_data['edit_form'] = $blockscall_obj->getOptions(); |
119 | 119 | |
120 | - $blockoption = !empty($block_data['options']) ? "options=\"{$block_data['options']}\"" :""; |
|
121 | - $cachetime = $block_data['bcachetime'] !=0 ? " cachetime=".$block_data['bcachetime'] : ""; |
|
122 | - if ($cachetime){ |
|
120 | + $blockoption = !empty($block_data['options']) ? "options=\"{$block_data['options']}\"" : ""; |
|
121 | + $cachetime = $block_data['bcachetime'] != 0 ? " cachetime=".$block_data['bcachetime'] : ""; |
|
122 | + if ($cachetime) { |
|
123 | 123 | switch ($block_data['bcachemodel']) { |
124 | 124 | case 0: |
125 | 125 | $cachemodel = " cachemodel=global"; |
@@ -131,37 +131,37 @@ discard block |
||
131 | 131 | $cachemodel = " cachemodel=\$xoopsUser"; |
132 | 132 | break; |
133 | 133 | } |
134 | - }else { |
|
135 | - $cachemodel =""; |
|
134 | + } else { |
|
135 | + $cachemodel = ""; |
|
136 | 136 | } |
137 | 137 | |
138 | - $xoblktpl =<<<EOF |
|
138 | + $xoblktpl = <<<EOF |
|
139 | 139 | <{xoBlkTpl module="{$block_data['dirname']}" file="{$block_data['func_file']}" show_func="{$block_data['show_func']}" {$blockoption}$cachetime$cachemodel}> |
140 | 140 | {$block_data['tpl_content']} |
141 | 141 | <{/xoBlkTpl}> |
142 | 142 | EOF; |
143 | - $xoblk =<<<EOF |
|
143 | + $xoblk = <<<EOF |
|
144 | 144 | <{xoBlk module="{$block_data['dirname']}" file="{$block_data['func_file']}" show_func="{$block_data['show_func']}" $blockoption template="{$block_data['template']}"$cachetime$cachemodel}> |
145 | 145 | EOF; |
146 | 146 | |
147 | 147 | include "../include/blockform.php"; |
148 | 148 | |
149 | - $xoopsTpl->assign("xoblktpl",$xoblktpl); |
|
150 | - $xoopsTpl->assign("xoblk",$xoblk); |
|
149 | + $xoopsTpl->assign("xoblktpl", $xoblktpl); |
|
150 | + $xoopsTpl->assign("xoblk", $xoblk); |
|
151 | 151 | |
152 | 152 | $template_main = "tools_admin_blockscall_edit.html"; |
153 | 153 | |
154 | 154 | break; |
155 | 155 | |
156 | 156 | case "save": |
157 | - $blockscall_obj =& $blockscall_handler->get($_REQUEST['bid']); |
|
158 | - if (isset($_REQUEST['save']) && $_REQUEST['save']=="blk"){ |
|
157 | + $blockscall_obj = & $blockscall_handler->get($_REQUEST['bid']); |
|
158 | + if (isset($_REQUEST['save']) && $_REQUEST['save'] == "blk") { |
|
159 | 159 | if (isset($_REQUEST['options'])) { |
160 | 160 | $options = $_REQUEST['options']; |
161 | 161 | $options_count = count($options); |
162 | 162 | if ($options_count > 0) { |
163 | 163 | //Convert array values to comma-separated |
164 | - for ( $i = 0; $i < $options_count; $i++ ) { |
|
164 | + for ($i = 0; $i < $options_count; $i++) { |
|
165 | 165 | if (is_array($options[$i])) { |
166 | 166 | $options[$i] = implode(',', $options[$i]); |
167 | 167 | } |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | $blockscall_obj->setVar('desciption', $_REQUEST['desc']); |
174 | 174 | $blockscall_obj->setVar('bcachetime', $_REQUEST['bcachetime']); |
175 | 175 | $blockscall_obj->setVar('bcachemodel', $_REQUEST['bcachemodel']); |
176 | - }elseif(isset($_REQUEST['save']) && $_REQUEST['save']=="tpl") { |
|
176 | + }elseif (isset($_REQUEST['save']) && $_REQUEST['save'] == "tpl") { |
|
177 | 177 | $blockscall_obj->setVar('tpl_content', $_REQUEST['tpl_content']); |
178 | - }else { |
|
178 | + } else { |
|
179 | 179 | exit(); |
180 | 180 | } |
181 | 181 | |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | break; |
188 | 188 | |
189 | 189 | case "edittpl": |
190 | - $blockscall_obj =& $blockscall_handler->get($_REQUEST['bid']); |
|
191 | - $block_data = $blockscall_obj->getValues(null,'n'); |
|
190 | + $blockscall_obj = & $blockscall_handler->get($_REQUEST['bid']); |
|
191 | + $block_data = $blockscall_obj->getValues(null, 'n'); |
|
192 | 192 | include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; |
193 | 193 | $form = new XoopsThemeForm(_AM_TOOLS_BC_EDITTPL, 'form', 'blockscall.php', "post", true); |
194 | - $form->addElement(new XoopsFormLabel(_AM_TOOLS_BC_BLOCK,$block_data['name'])); |
|
195 | - $form->addElement(new XoopsFormTextArea(_AM_TOOLS_BC_TPLSOURCES,"tpl_content",$block_data['tpl_content'],10,80)); |
|
194 | + $form->addElement(new XoopsFormLabel(_AM_TOOLS_BC_BLOCK, $block_data['name'])); |
|
195 | + $form->addElement(new XoopsFormTextArea(_AM_TOOLS_BC_TPLSOURCES, "tpl_content", $block_data['tpl_content'], 10, 80)); |
|
196 | 196 | $form->addElement(new XoopsFormHidden('bid', $block_data['bid'])); |
197 | 197 | $form->addElement(new XoopsFormHidden('op', 'save')); |
198 | 198 | $form->addElement(new XoopsFormHidden('save', 'tpl')); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | break; |
204 | 204 | |
205 | 205 | case "delete": |
206 | - $blockscall_obj =& $blockscall_handler->get($_REQUEST['bid']); |
|
206 | + $blockscall_obj = & $blockscall_handler->get($_REQUEST['bid']); |
|
207 | 207 | if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { |
208 | 208 | if (!$GLOBALS['xoopsSecurity']->check()) { |
209 | 209 | redirect_header('blockscall.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | break; |
220 | 220 | } |
221 | -$css = '<link rel="stylesheet" type="text/css" media="all" href="' . XOOPS_URL . '/modules/tools/templates/style.css" />'; |
|
221 | +$css = '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/tools/templates/style.css" />'; |
|
222 | 222 | $xoopsTpl->assign('css', $css); |
223 | 223 | include 'footer.php' |
224 | 224 | ?> |
225 | 225 | \ No newline at end of file |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $cachemodel = " cachemodel=\$xoopsUser"; |
132 | 132 | break; |
133 | 133 | } |
134 | - }else { |
|
134 | + } else { |
|
135 | 135 | $cachemodel =""; |
136 | 136 | } |
137 | 137 | |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | $blockscall_obj->setVar('desciption', $_REQUEST['desc']); |
174 | 174 | $blockscall_obj->setVar('bcachetime', $_REQUEST['bcachetime']); |
175 | 175 | $blockscall_obj->setVar('bcachemodel', $_REQUEST['bcachemodel']); |
176 | - }elseif(isset($_REQUEST['save']) && $_REQUEST['save']=="tpl") { |
|
176 | + } elseif(isset($_REQUEST['save']) && $_REQUEST['save']=="tpl") { |
|
177 | 177 | $blockscall_obj->setVar('tpl_content', $_REQUEST['tpl_content']); |
178 | - }else { |
|
178 | + } else { |
|
179 | 179 | exit(); |
180 | 180 | } |
181 | 181 |
@@ -26,28 +26,28 @@ discard block |
||
26 | 26 | switch($op) { |
27 | 27 | default: |
28 | 28 | case "index": |
29 | - include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; |
|
30 | - $form = new XoopsThemeForm(_MI_TOOLS_INDEX,"updatecache","index.php","post",true); |
|
31 | - $form->addElement(new XoopsFormLabel(_AM_TOOLS_TIP,_AM_TOOLS_TIPS)); |
|
32 | - $checkbox_options = array( |
|
33 | - "updatexoopscache"=>_AM_TOOLS_UPDATEXOOPSCACHE, |
|
34 | - "updatesmartycache"=>_AM_TOOLS_UPDATESMARTYCACHE, |
|
35 | - "updatesmartycompile"=>_AM_TOOLS_UPDATESMARTYCOMPILE |
|
36 | - ); |
|
37 | - $checkbox = new XoopsFormCheckBox(_AM_TOOLS_OPTIONS,"options",array_keys($checkbox_options)); |
|
38 | - $checkbox->addOptionArray($checkbox_options); |
|
39 | - $form->addElement($checkbox); |
|
40 | - $form->addElement(new XoopsFormHidden("op","updatecache")); |
|
41 | - $form->addElement(new XoopsFormHidden("step","1")); |
|
42 | - $form->addElement(new XoopsFormButton("","submit",_SUBMIT,"submit")); |
|
43 | - $form->display(); |
|
44 | - break; |
|
29 | + include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; |
|
30 | + $form = new XoopsThemeForm(_MI_TOOLS_INDEX,"updatecache","index.php","post",true); |
|
31 | + $form->addElement(new XoopsFormLabel(_AM_TOOLS_TIP,_AM_TOOLS_TIPS)); |
|
32 | + $checkbox_options = array( |
|
33 | + "updatexoopscache"=>_AM_TOOLS_UPDATEXOOPSCACHE, |
|
34 | + "updatesmartycache"=>_AM_TOOLS_UPDATESMARTYCACHE, |
|
35 | + "updatesmartycompile"=>_AM_TOOLS_UPDATESMARTYCOMPILE |
|
36 | + ); |
|
37 | + $checkbox = new XoopsFormCheckBox(_AM_TOOLS_OPTIONS,"options",array_keys($checkbox_options)); |
|
38 | + $checkbox->addOptionArray($checkbox_options); |
|
39 | + $form->addElement($checkbox); |
|
40 | + $form->addElement(new XoopsFormHidden("op","updatecache")); |
|
41 | + $form->addElement(new XoopsFormHidden("step","1")); |
|
42 | + $form->addElement(new XoopsFormButton("","submit",_SUBMIT,"submit")); |
|
43 | + $form->display(); |
|
44 | + break; |
|
45 | 45 | case "updatecache": |
46 | - if($_REQUEST['step'] == 1){ |
|
47 | - $options = implode('_', $_REQUEST['options']); |
|
48 | - $url = XOOPS_URL."/modules/tools/admin/index.php?op=updatecache&step=2&options={$options}"; |
|
49 | - $updating = _AM_TOOLS_UPDATING; |
|
50 | - $msg = <<<EOF |
|
46 | + if($_REQUEST['step'] == 1){ |
|
47 | + $options = implode('_', $_REQUEST['options']); |
|
48 | + $url = XOOPS_URL."/modules/tools/admin/index.php?op=updatecache&step=2&options={$options}"; |
|
49 | + $updating = _AM_TOOLS_UPDATING; |
|
50 | + $msg = <<<EOF |
|
51 | 51 | <div class="loading" style="text-align:center"> |
52 | 52 | <img src="../images/loader.gif" /> |
53 | 53 | <p>{$updating}</P> |
@@ -61,41 +61,41 @@ discard block |
||
61 | 61 | EOF; |
62 | 62 | |
63 | 63 | echo $msg; |
64 | - }elseif ($_REQUEST['step'] == 2) { |
|
65 | - $options = explode("_",$_REQUEST['options']); |
|
66 | - foreach ($options as $k){ |
|
67 | - if ($k === 'updatexoopscache'){ |
|
68 | - $d = XOOPS_VAR_PATH . '/caches/xoops_cache'; |
|
69 | - updatecache($d,"php"); |
|
70 | - updatecache($d,"html"); |
|
71 | - updatecache($d,"tmp"); |
|
72 | - } |
|
73 | - if ($k === 'updatesmartycache'){ |
|
74 | - $d = XOOPS_VAR_PATH . '/caches/smarty_cache'; |
|
75 | - updatecache($d,"html"); |
|
76 | - updatecache($d,"tmp"); |
|
77 | - } |
|
78 | - if ($k === 'updatesmartycompile'){ |
|
79 | - $d = XOOPS_VAR_PATH . '/caches/smarty_compile'; |
|
80 | - updatecache($d,"php"); |
|
81 | - } |
|
82 | - } |
|
64 | + }elseif ($_REQUEST['step'] == 2) { |
|
65 | + $options = explode("_",$_REQUEST['options']); |
|
66 | + foreach ($options as $k){ |
|
67 | + if ($k === 'updatexoopscache'){ |
|
68 | + $d = XOOPS_VAR_PATH . '/caches/xoops_cache'; |
|
69 | + updatecache($d,"php"); |
|
70 | + updatecache($d,"html"); |
|
71 | + updatecache($d,"tmp"); |
|
72 | + } |
|
73 | + if ($k === 'updatesmartycache'){ |
|
74 | + $d = XOOPS_VAR_PATH . '/caches/smarty_cache'; |
|
75 | + updatecache($d,"html"); |
|
76 | + updatecache($d,"tmp"); |
|
77 | + } |
|
78 | + if ($k === 'updatesmartycompile'){ |
|
79 | + $d = XOOPS_VAR_PATH . '/caches/smarty_compile'; |
|
80 | + updatecache($d,"php"); |
|
81 | + } |
|
82 | + } |
|
83 | 83 | |
84 | - redirect_header('index.php', 3, _AM_TOOLS_UPDATECACHESUCCESS); |
|
85 | - } |
|
84 | + redirect_header('index.php', 3, _AM_TOOLS_UPDATECACHESUCCESS); |
|
85 | + } |
|
86 | 86 | |
87 | - break; |
|
87 | + break; |
|
88 | 88 | |
89 | 89 | } |
90 | 90 | |
91 | 91 | function updatecache($cacheDir,$type){ |
92 | - $d = dir($cacheDir); |
|
93 | - while (false !== ($entry = $d->read())) { |
|
94 | - if(preg_match("/.*\.{$type}$/", $entry)) { |
|
95 | - unlink($cacheDir .'/'.$entry); |
|
96 | - } |
|
97 | - } |
|
98 | - $d->close(); |
|
92 | + $d = dir($cacheDir); |
|
93 | + while (false !== ($entry = $d->read())) { |
|
94 | + if(preg_match("/.*\.{$type}$/", $entry)) { |
|
95 | + unlink($cacheDir .'/'.$entry); |
|
96 | + } |
|
97 | + } |
|
98 | + $d->close(); |
|
99 | 99 | } |
100 | 100 | include 'footer.php'; |
101 | 101 | ?> |
102 | 102 | \ No newline at end of file |
@@ -23,27 +23,27 @@ discard block |
||
23 | 23 | loadModuleAdminMenu(1, ""); |
24 | 24 | |
25 | 25 | $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : 'index'; |
26 | -switch($op) { |
|
26 | +switch ($op) { |
|
27 | 27 | default: |
28 | 28 | case "index": |
29 | 29 | include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; |
30 | - $form = new XoopsThemeForm(_MI_TOOLS_INDEX,"updatecache","index.php","post",true); |
|
31 | - $form->addElement(new XoopsFormLabel(_AM_TOOLS_TIP,_AM_TOOLS_TIPS)); |
|
30 | + $form = new XoopsThemeForm(_MI_TOOLS_INDEX, "updatecache", "index.php", "post", true); |
|
31 | + $form->addElement(new XoopsFormLabel(_AM_TOOLS_TIP, _AM_TOOLS_TIPS)); |
|
32 | 32 | $checkbox_options = array( |
33 | 33 | "updatexoopscache"=>_AM_TOOLS_UPDATEXOOPSCACHE, |
34 | 34 | "updatesmartycache"=>_AM_TOOLS_UPDATESMARTYCACHE, |
35 | 35 | "updatesmartycompile"=>_AM_TOOLS_UPDATESMARTYCOMPILE |
36 | 36 | ); |
37 | - $checkbox = new XoopsFormCheckBox(_AM_TOOLS_OPTIONS,"options",array_keys($checkbox_options)); |
|
37 | + $checkbox = new XoopsFormCheckBox(_AM_TOOLS_OPTIONS, "options", array_keys($checkbox_options)); |
|
38 | 38 | $checkbox->addOptionArray($checkbox_options); |
39 | 39 | $form->addElement($checkbox); |
40 | - $form->addElement(new XoopsFormHidden("op","updatecache")); |
|
41 | - $form->addElement(new XoopsFormHidden("step","1")); |
|
42 | - $form->addElement(new XoopsFormButton("","submit",_SUBMIT,"submit")); |
|
40 | + $form->addElement(new XoopsFormHidden("op", "updatecache")); |
|
41 | + $form->addElement(new XoopsFormHidden("step", "1")); |
|
42 | + $form->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit")); |
|
43 | 43 | $form->display(); |
44 | 44 | break; |
45 | 45 | case "updatecache": |
46 | - if($_REQUEST['step'] == 1){ |
|
46 | + if ($_REQUEST['step'] == 1) { |
|
47 | 47 | $options = implode('_', $_REQUEST['options']); |
48 | 48 | $url = XOOPS_URL."/modules/tools/admin/index.php?op=updatecache&step=2&options={$options}"; |
49 | 49 | $updating = _AM_TOOLS_UPDATING; |
@@ -62,22 +62,22 @@ discard block |
||
62 | 62 | |
63 | 63 | echo $msg; |
64 | 64 | }elseif ($_REQUEST['step'] == 2) { |
65 | - $options = explode("_",$_REQUEST['options']); |
|
66 | - foreach ($options as $k){ |
|
67 | - if ($k === 'updatexoopscache'){ |
|
68 | - $d = XOOPS_VAR_PATH . '/caches/xoops_cache'; |
|
69 | - updatecache($d,"php"); |
|
70 | - updatecache($d,"html"); |
|
71 | - updatecache($d,"tmp"); |
|
65 | + $options = explode("_", $_REQUEST['options']); |
|
66 | + foreach ($options as $k) { |
|
67 | + if ($k === 'updatexoopscache') { |
|
68 | + $d = XOOPS_VAR_PATH.'/caches/xoops_cache'; |
|
69 | + updatecache($d, "php"); |
|
70 | + updatecache($d, "html"); |
|
71 | + updatecache($d, "tmp"); |
|
72 | 72 | } |
73 | - if ($k === 'updatesmartycache'){ |
|
74 | - $d = XOOPS_VAR_PATH . '/caches/smarty_cache'; |
|
75 | - updatecache($d,"html"); |
|
76 | - updatecache($d,"tmp"); |
|
73 | + if ($k === 'updatesmartycache') { |
|
74 | + $d = XOOPS_VAR_PATH.'/caches/smarty_cache'; |
|
75 | + updatecache($d, "html"); |
|
76 | + updatecache($d, "tmp"); |
|
77 | 77 | } |
78 | - if ($k === 'updatesmartycompile'){ |
|
79 | - $d = XOOPS_VAR_PATH . '/caches/smarty_compile'; |
|
80 | - updatecache($d,"php"); |
|
78 | + if ($k === 'updatesmartycompile') { |
|
79 | + $d = XOOPS_VAR_PATH.'/caches/smarty_compile'; |
|
80 | + updatecache($d, "php"); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | } |
90 | 90 | |
91 | -function updatecache($cacheDir,$type){ |
|
91 | +function updatecache($cacheDir, $type) { |
|
92 | 92 | $d = dir($cacheDir); |
93 | 93 | while (false !== ($entry = $d->read())) { |
94 | - if(preg_match("/.*\.{$type}$/", $entry)) { |
|
95 | - unlink($cacheDir .'/'.$entry); |
|
94 | + if (preg_match("/.*\.{$type}$/", $entry)) { |
|
95 | + unlink($cacheDir.'/'.$entry); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | $d->close(); |
@@ -61,7 +61,7 @@ |
||
61 | 61 | EOF; |
62 | 62 | |
63 | 63 | echo $msg; |
64 | - }elseif ($_REQUEST['step'] == 2) { |
|
64 | + } elseif ($_REQUEST['step'] == 2) { |
|
65 | 65 | $options = explode("_",$_REQUEST['options']); |
66 | 66 | foreach ($options as $k){ |
67 | 67 | if ($k === 'updatexoopscache'){ |
@@ -18,54 +18,54 @@ |
||
18 | 18 | */ |
19 | 19 | |
20 | 20 | //menu |
21 | -define("_MI_TOOLS_INDEX","更新缓存"); |
|
22 | -define("_MI_TOOLS_BLOCKS","区块调用"); |
|
21 | +define("_MI_TOOLS_INDEX", "更新缓存"); |
|
22 | +define("_MI_TOOLS_BLOCKS", "区块调用"); |
|
23 | 23 | |
24 | 24 | //update cache |
25 | -define("_AM_TOOLS_UPDATING","更新缓存中请稍后!"); |
|
26 | -define("_AM_TOOLS_TIP","提示:"); |
|
27 | -define("_AM_TOOLS_TIPS","<ul><li>xoops cache:此目录下包括系统参数缓存,模块参数缓存,一些内容缓存.如果对系统或模块进行参数设置后不能正常显示则需要清理;</li><li>smarty cache:内容缓存.如果网站内容较多且大面积使用缓存,更新缓存时间会较长,服务器的负荷会增大;</li><li>smarty compile:模版编译后的文件.如果修改模版后不能正常显示,则需要更新.</li></ul>"); |
|
28 | -define("_AM_TOOLS_OPTIONS","选项"); |
|
29 | -define("_AM_TOOLS_UPDATECACHESUCCESS","缓存更新成功."); |
|
30 | -define("_AM_TOOLS_UPDATEXOOPSCACHE","xoops cache"); |
|
31 | -define("_AM_TOOLS_UPDATESMARTYCACHE","smarty cache"); |
|
32 | -define("_AM_TOOLS_UPDATESMARTYCOMPILE","smarty compile"); |
|
25 | +define("_AM_TOOLS_UPDATING", "更新缓存中请稍后!"); |
|
26 | +define("_AM_TOOLS_TIP", "提示:"); |
|
27 | +define("_AM_TOOLS_TIPS", "<ul><li>xoops cache:此目录下包括系统参数缓存,模块参数缓存,一些内容缓存.如果对系统或模块进行参数设置后不能正常显示则需要清理;</li><li>smarty cache:内容缓存.如果网站内容较多且大面积使用缓存,更新缓存时间会较长,服务器的负荷会增大;</li><li>smarty compile:模版编译后的文件.如果修改模版后不能正常显示,则需要更新.</li></ul>"); |
|
28 | +define("_AM_TOOLS_OPTIONS", "选项"); |
|
29 | +define("_AM_TOOLS_UPDATECACHESUCCESS", "缓存更新成功."); |
|
30 | +define("_AM_TOOLS_UPDATEXOOPSCACHE", "xoops cache"); |
|
31 | +define("_AM_TOOLS_UPDATESMARTYCACHE", "smarty cache"); |
|
32 | +define("_AM_TOOLS_UPDATESMARTYCOMPILE", "smarty compile"); |
|
33 | 33 | |
34 | 34 | //blocks call |
35 | 35 | |
36 | -define("_AM_TOOLS_BC_MANAGE","管理区块"); |
|
37 | -define("_AM_TOOLS_BC_ADDBLOCK","添加区块"); |
|
38 | -define("_AM_TOOLS_BC_EDITBLOCK","编辑区块参数"); |
|
36 | +define("_AM_TOOLS_BC_MANAGE", "管理区块"); |
|
37 | +define("_AM_TOOLS_BC_ADDBLOCK", "添加区块"); |
|
38 | +define("_AM_TOOLS_BC_EDITBLOCK", "编辑区块参数"); |
|
39 | 39 | |
40 | -define("_AM_TOOLS_BC_GLOBAL","常规"); |
|
41 | -define("_AM_TOOLS_BC_GROUP","用户群组"); |
|
42 | -define("_AM_TOOLS_BC_USER","用户"); |
|
40 | +define("_AM_TOOLS_BC_GLOBAL", "常规"); |
|
41 | +define("_AM_TOOLS_BC_GROUP", "用户群组"); |
|
42 | +define("_AM_TOOLS_BC_USER", "用户"); |
|
43 | 43 | |
44 | -define("_AM_TOOLS_BC_ALLTYPES","全部"); |
|
44 | +define("_AM_TOOLS_BC_ALLTYPES", "全部"); |
|
45 | 45 | |
46 | 46 | define("_AM_TOOLS_BC_SAVEDSUCCESS", "%s 保存成功"); |
47 | 47 | define("_AM_TOOLS_BC_DELETEDSUCCESS", "删除成功"); |
48 | 48 | define("_AM_TOOLS_BC_RUSUREDEL", "确定要删除 %s"); |
49 | 49 | define("_AM_TOOLS_BC_CREATESUCCESS", "区块 %s 添加成功"); |
50 | -define("_AM_TOOLS_BC_NOBLOCKS","没有可用区块"); |
|
51 | -define("_AM_TOOLS_BC_NOBLOCKS","没有可用区块"); |
|
50 | +define("_AM_TOOLS_BC_NOBLOCKS", "没有可用区块"); |
|
51 | +define("_AM_TOOLS_BC_NOBLOCKS", "没有可用区块"); |
|
52 | 52 | |
53 | -define("_AM_TOOLS_BC_EDITTPL","编辑模板"); |
|
54 | -define("_AM_TOOLS_BC_BLOCK","区块"); |
|
55 | -define("_AM_TOOLS_BC_TPLSOURCES","模板"); |
|
56 | -define("_AM_TOOLS_BC_NAME","名称"); |
|
57 | -define("_AM_TOOLS_BC_DESCRIPTION","调用说明"); |
|
58 | -define("_AM_TOOLS_BC_CONTENT","内容"); |
|
59 | -define("_AM_TOOLS_BC_OPTIONS","选项"); |
|
60 | -define("_AM_TOOLS_BC_BCACHETIME","缓存时间"); |
|
61 | -define("_AM_TOOLS_BC_BCACHEMODEL","缓存方式"); |
|
62 | -define("_AM_TOOLS_BC_MODULE","所属模块"); |
|
63 | -define("_AM_TOOLS_BC_DATE","修改时间"); |
|
64 | -define("_AM_TOOLS_BC_ACTION","操作"); |
|
65 | -define("_AM_TOOLS_BC_CREATE","创建"); |
|
66 | -define("_AM_TOOLS_BC_TITLE","描述"); |
|
67 | -define("_AM_TOOLS_BC_ENABLEBLOCKS","可用区块"); |
|
68 | -define("_AM_TOOLS_BC_SELECTMODULE","选择模块:"); |
|
69 | -define("_AM_TOOLS_BC_QUICKCALL","直接调用"); |
|
70 | -define("_AM_TOOLS_BC_TPLCALL","模板化调用"); |
|
53 | +define("_AM_TOOLS_BC_EDITTPL", "编辑模板"); |
|
54 | +define("_AM_TOOLS_BC_BLOCK", "区块"); |
|
55 | +define("_AM_TOOLS_BC_TPLSOURCES", "模板"); |
|
56 | +define("_AM_TOOLS_BC_NAME", "名称"); |
|
57 | +define("_AM_TOOLS_BC_DESCRIPTION", "调用说明"); |
|
58 | +define("_AM_TOOLS_BC_CONTENT", "内容"); |
|
59 | +define("_AM_TOOLS_BC_OPTIONS", "选项"); |
|
60 | +define("_AM_TOOLS_BC_BCACHETIME", "缓存时间"); |
|
61 | +define("_AM_TOOLS_BC_BCACHEMODEL", "缓存方式"); |
|
62 | +define("_AM_TOOLS_BC_MODULE", "所属模块"); |
|
63 | +define("_AM_TOOLS_BC_DATE", "修改时间"); |
|
64 | +define("_AM_TOOLS_BC_ACTION", "操作"); |
|
65 | +define("_AM_TOOLS_BC_CREATE", "创建"); |
|
66 | +define("_AM_TOOLS_BC_TITLE", "描述"); |
|
67 | +define("_AM_TOOLS_BC_ENABLEBLOCKS", "可用区块"); |
|
68 | +define("_AM_TOOLS_BC_SELECTMODULE", "选择模块:"); |
|
69 | +define("_AM_TOOLS_BC_QUICKCALL", "直接调用"); |
|
70 | +define("_AM_TOOLS_BC_TPLCALL", "模板化调用"); |
|
71 | 71 | ?> |
72 | 72 | \ No newline at end of file |
@@ -20,7 +20,7 @@ |
||
20 | 20 | define("_MI_TOOLS_NAME", "工具箱"); |
21 | 21 | define("_MI_TOOLS_DESC", "工具模块"); |
22 | 22 | //menu |
23 | -define("_MI_TOOLS_INDEX","更新缓存"); |
|
24 | -define("_MI_TOOLS_BLOCKS","区块调用"); |
|
23 | +define("_MI_TOOLS_INDEX", "更新缓存"); |
|
24 | +define("_MI_TOOLS_BLOCKS", "区块调用"); |
|
25 | 25 | |
26 | 26 | ?> |
27 | 27 | \ No newline at end of file |
@@ -18,51 +18,51 @@ |
||
18 | 18 | */ |
19 | 19 | |
20 | 20 | //menu |
21 | -define("_MI_TOOLS_INDEX","Update cache"); |
|
22 | -define("_MI_TOOLS_BLOCKS","Block callback"); |
|
21 | +define("_MI_TOOLS_INDEX", "Update cache"); |
|
22 | +define("_MI_TOOLS_BLOCKS", "Block callback"); |
|
23 | 23 | //update cache |
24 | -define("_AM_TOOLS_TIP","tips:"); |
|
25 | -define("_AM_TOOLS_TIPS","<ul><li>xoops cache:</li><li>smarty cache:</li><li>smarty compile:</li></ul>"); |
|
26 | -define("_AM_TOOLS_OPTIONS","options"); |
|
27 | -define("_AM_TOOLS_UPDATECACHESUCCESS","Update cache success."); |
|
28 | -define("_AM_TOOLS_UPDATEXOOPSCACHE","update xoops cache"); |
|
29 | -define("_AM_TOOLS_UPDATESMARTYCACHE","update smarty cache"); |
|
30 | -define("_AM_TOOLS_UPDATESMARTYCOMPILE","updates smarty compile"); |
|
24 | +define("_AM_TOOLS_TIP", "tips:"); |
|
25 | +define("_AM_TOOLS_TIPS", "<ul><li>xoops cache:</li><li>smarty cache:</li><li>smarty compile:</li></ul>"); |
|
26 | +define("_AM_TOOLS_OPTIONS", "options"); |
|
27 | +define("_AM_TOOLS_UPDATECACHESUCCESS", "Update cache success."); |
|
28 | +define("_AM_TOOLS_UPDATEXOOPSCACHE", "update xoops cache"); |
|
29 | +define("_AM_TOOLS_UPDATESMARTYCACHE", "update smarty cache"); |
|
30 | +define("_AM_TOOLS_UPDATESMARTYCOMPILE", "updates smarty compile"); |
|
31 | 31 | //blocks call |
32 | 32 | |
33 | -define("_AM_TOOLS_BC_MANAGE","Blocks manager"); |
|
34 | -define("_AM_TOOLS_BC_ADDBLOCK","Add a block"); |
|
35 | -define("_AM_TOOLS_BC_EDITBLOCK","Edit a block"); |
|
33 | +define("_AM_TOOLS_BC_MANAGE", "Blocks manager"); |
|
34 | +define("_AM_TOOLS_BC_ADDBLOCK", "Add a block"); |
|
35 | +define("_AM_TOOLS_BC_EDITBLOCK", "Edit a block"); |
|
36 | 36 | |
37 | -define("_AM_TOOLS_BC_GLOBAL","Normal"); |
|
38 | -define("_AM_TOOLS_BC_GROUP","By group"); |
|
39 | -define("_AM_TOOLS_BC_USER","By user"); |
|
37 | +define("_AM_TOOLS_BC_GLOBAL", "Normal"); |
|
38 | +define("_AM_TOOLS_BC_GROUP", "By group"); |
|
39 | +define("_AM_TOOLS_BC_USER", "By user"); |
|
40 | 40 | |
41 | -define("_AM_TOOLS_BC_ALLTYPES","All"); |
|
41 | +define("_AM_TOOLS_BC_ALLTYPES", "All"); |
|
42 | 42 | |
43 | 43 | define("_AM_TOOLS_BC_SAVEDSUCCESS", "%s Save successful."); |
44 | 44 | define("_AM_TOOLS_BC_DELETEDSUCCESS", "Delete successful."); |
45 | 45 | define("_AM_TOOLS_BC_RUSUREDEL", "Do you sure to delete %s ?"); |
46 | 46 | define("_AM_TOOLS_BC_CREATESUCCESS", "Block %s add successful."); |
47 | -define("_AM_TOOLS_BC_NOBLOCKS","Unavailable block"); |
|
48 | -define("_AM_TOOLS_BC_NOBLOCKS","Unavailable block"); |
|
47 | +define("_AM_TOOLS_BC_NOBLOCKS", "Unavailable block"); |
|
48 | +define("_AM_TOOLS_BC_NOBLOCKS", "Unavailable block"); |
|
49 | 49 | |
50 | -define("_AM_TOOLS_BC_EDITTPL","Edit template"); |
|
51 | -define("_AM_TOOLS_BC_BLOCK","Blocks"); |
|
52 | -define("_AM_TOOLS_BC_TPLSOURCES","Template"); |
|
53 | -define("_AM_TOOLS_BC_NAME","Name"); |
|
54 | -define("_AM_TOOLS_BC_DESCRIPTION","Note"); |
|
55 | -define("_AM_TOOLS_BC_CONTENT","Content"); |
|
56 | -define("_AM_TOOLS_BC_OPTIONS","Options"); |
|
57 | -define("_AM_TOOLS_BC_BCACHETIME","Cache time"); |
|
58 | -define("_AM_TOOLS_BC_BCACHEMODEL","Cache model"); |
|
59 | -define("_AM_TOOLS_BC_MODULE","Module"); |
|
60 | -define("_AM_TOOLS_BC_DATE","Last time"); |
|
61 | -define("_AM_TOOLS_BC_ACTION","Action"); |
|
62 | -define("_AM_TOOLS_BC_CREATE","Create"); |
|
63 | -define("_AM_TOOLS_BC_TITLE","Description"); |
|
64 | -define("_AM_TOOLS_BC_ENABLEBLOCKS","Available block"); |
|
65 | -define("_AM_TOOLS_BC_SELECTMODULE","Select a module:"); |
|
66 | -define("_AM_TOOLS_BC_QUICKCALL","Simple:"); |
|
67 | -define("_AM_TOOLS_BC_TPLCALL","Template format:"); |
|
50 | +define("_AM_TOOLS_BC_EDITTPL", "Edit template"); |
|
51 | +define("_AM_TOOLS_BC_BLOCK", "Blocks"); |
|
52 | +define("_AM_TOOLS_BC_TPLSOURCES", "Template"); |
|
53 | +define("_AM_TOOLS_BC_NAME", "Name"); |
|
54 | +define("_AM_TOOLS_BC_DESCRIPTION", "Note"); |
|
55 | +define("_AM_TOOLS_BC_CONTENT", "Content"); |
|
56 | +define("_AM_TOOLS_BC_OPTIONS", "Options"); |
|
57 | +define("_AM_TOOLS_BC_BCACHETIME", "Cache time"); |
|
58 | +define("_AM_TOOLS_BC_BCACHEMODEL", "Cache model"); |
|
59 | +define("_AM_TOOLS_BC_MODULE", "Module"); |
|
60 | +define("_AM_TOOLS_BC_DATE", "Last time"); |
|
61 | +define("_AM_TOOLS_BC_ACTION", "Action"); |
|
62 | +define("_AM_TOOLS_BC_CREATE", "Create"); |
|
63 | +define("_AM_TOOLS_BC_TITLE", "Description"); |
|
64 | +define("_AM_TOOLS_BC_ENABLEBLOCKS", "Available block"); |
|
65 | +define("_AM_TOOLS_BC_SELECTMODULE", "Select a module:"); |
|
66 | +define("_AM_TOOLS_BC_QUICKCALL", "Simple:"); |
|
67 | +define("_AM_TOOLS_BC_TPLCALL", "Template format:"); |
|
68 | 68 | ?> |
69 | 69 | \ No newline at end of file |
@@ -19,7 +19,7 @@ |
||
19 | 19 | define("_MI_TOOLS_NAME", "Xoops Tools"); |
20 | 20 | define("_MI_TOOLS_DESC", "A tools module for XOOPS"); |
21 | 21 | //menu |
22 | -define("_MI_TOOLS_INDEX","Update cache"); |
|
23 | -define("_MI_TOOLS_BLOCKS","Block callback"); |
|
22 | +define("_MI_TOOLS_INDEX", "Update cache"); |
|
23 | +define("_MI_TOOLS_BLOCKS", "Block callback"); |
|
24 | 24 | |
25 | 25 | ?> |
26 | 26 | \ No newline at end of file |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; |
21 | 21 | $form = new XoopsForm(_EDIT._AM_TOOLS_BC_BLOCK, 'form', 'blockscall.php', "post", true); |
22 | 22 | $form->addElement(new XoopsFormLabel(_AM_TOOLS_BC_NAME, $block_data['name'])); |
23 | -$form->addElement(new XoopsFormText(_AM_TOOLS_BC_DESCRIPTION,"desc",60,255,$block_data['desciption'])); |
|
23 | +$form->addElement(new XoopsFormText(_AM_TOOLS_BC_DESCRIPTION, "desc", 60, 255, $block_data['desciption'])); |
|
24 | 24 | if ($block_data['template'] != '') { |
25 | 25 | $form->addElement(new XoopsFormLabel(_AM_TOOLS_BC_CONTENT, '<a href="blockscall.php?op=edittpl&bid='.$block_data['bid'].'">'._AM_TOOLS_BC_EDITTPL.'</a>')); |
26 | 26 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $form->addElement($cache_select); |
34 | 34 | |
35 | 35 | $cachemodel_select = new XoopsFormSelect(_AM_TOOLS_BC_BCACHEMODEL, 'bcachemodel', $block_data['bcachemodel']); |
36 | -$cachemodel_select->addOptionArray(array( '0' => _AM_TOOLS_BC_GLOBAL, '1' => _AM_TOOLS_BC_GROUP, '2' => _AM_TOOLS_BC_USER)); |
|
36 | +$cachemodel_select->addOptionArray(array('0' => _AM_TOOLS_BC_GLOBAL, '1' => _AM_TOOLS_BC_GROUP, '2' => _AM_TOOLS_BC_USER)); |
|
37 | 37 | $form->addElement($cachemodel_select); |
38 | 38 | |
39 | 39 | $form->addElement(new XoopsFormHidden('bid', $block_data['bid'])); |
@@ -49,16 +49,16 @@ |
||
49 | 49 | /** |
50 | 50 | * Templates |
51 | 51 | */ |
52 | -$modversion['templates'] = array(); |
|
53 | -$modversion['templates'][] = array( |
|
52 | +$modversion['templates'] = array(); |
|
53 | +$modversion['templates'][] = array( |
|
54 | 54 | 'file' => 'tools_admin_blockscall.html', |
55 | 55 | 'description' => '' |
56 | 56 | ); |
57 | -$modversion['templates'][] = array( |
|
57 | +$modversion['templates'][] = array( |
|
58 | 58 | 'file' => 'tools_admin_blockscall_new.html', |
59 | 59 | 'description' => '' |
60 | 60 | ); |
61 | -$modversion['templates'][] = array( |
|
61 | +$modversion['templates'][] = array( |
|
62 | 62 | 'file' => 'tools_admin_blockscall_edit.html', |
63 | 63 | 'description' => '' |
64 | 64 | ); |