@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | function insertTrash($obj) |
19 | 19 | { |
20 | - if(!Context::get('is_logged')) |
|
20 | + if (!Context::get('is_logged')) |
|
21 | 21 | { |
22 | 22 | return new BaseObject(-1, 'msg_not_permitted'); |
23 | 23 | } |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | $oTrashVO = new TrashVO(); |
28 | 28 | $oTrashVO = &$obj; |
29 | 29 | |
30 | - if(!$oTrashVO->getTrashSrl()) $oTrashVO->setTrashSrl(getNextSequence()); |
|
31 | - if(!is_string($oTrashVO->getSerializedObject())) $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject())); |
|
30 | + if (!$oTrashVO->getTrashSrl()) $oTrashVO->setTrashSrl(getNextSequence()); |
|
31 | + if (!is_string($oTrashVO->getSerializedObject())) $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject())); |
|
32 | 32 | $oTrashVO->setIpaddress($_SERVER['REMOTE_ADDR']); |
33 | 33 | $oTrashVO->setRemoverSrl($logged_info->member_srl); |
34 | 34 | $oTrashVO->setRegdate(date('YmdHis')); |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | $tmpTrashSrls = Context::get('cart'); |
50 | 50 | |
51 | 51 | $trashSrls = array(); |
52 | - if($isAll != 'true') |
|
52 | + if ($isAll != 'true') |
|
53 | 53 | { |
54 | - if(is_array($tmpTrashSrls)) $trashSrls = $tmpTrashSrls; |
|
54 | + if (is_array($tmpTrashSrls)) $trashSrls = $tmpTrashSrls; |
|
55 | 55 | else $trashSrls = explode('|@|', $tmpTrashSrls); |
56 | 56 | } |
57 | 57 | |
58 | 58 | //module relation data delete... |
59 | 59 | $output = $this->_relationDataDelete($isAll, $trashSrls); |
60 | - if(!$output->toBool()) return new BaseObject(-1, $output->message); |
|
60 | + if (!$output->toBool()) return new BaseObject(-1, $output->message); |
|
61 | 61 | |
62 | - if(!$this->_emptyTrash($trashSrls)) return new BaseObject(-1, $lang->fail_empty); |
|
62 | + if (!$this->_emptyTrash($trashSrls)) return new BaseObject(-1, $lang->fail_empty); |
|
63 | 63 | |
64 | 64 | $this->setMessage('success_deleted', 'info'); |
65 | 65 | |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | function _relationDataDelete($isAll, &$trashSrls) |
77 | 77 | { |
78 | 78 | $oTrashModel = getModel('trash'); |
79 | - if($isAll == 'true') |
|
79 | + if ($isAll == 'true') |
|
80 | 80 | { |
81 | 81 | $output = $oTrashModel->getTrashAllList(array()); |
82 | - if(!$output->toBool()) |
|
82 | + if (!$output->toBool()) |
|
83 | 83 | { |
84 | 84 | return new BaseObject(-1, $output->message); |
85 | 85 | } |
86 | 86 | |
87 | - if(is_array($output->data)) |
|
87 | + if (is_array($output->data)) |
|
88 | 88 | { |
89 | - foreach($output->data as $value) |
|
89 | + foreach ($output->data as $value) |
|
90 | 90 | { |
91 | 91 | $trashSrls[] = $value->getTrashSrl(); |
92 | 92 | } |
@@ -97,29 +97,29 @@ discard block |
||
97 | 97 | $args = new stdClass(); |
98 | 98 | $args->trashSrl = $trashSrls; |
99 | 99 | $output = $oTrashModel->getTrashList($args); |
100 | - if(!$output->toBool()) |
|
100 | + if (!$output->toBool()) |
|
101 | 101 | { |
102 | 102 | return new BaseObject(-1, $output->message); |
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | - if(is_array($output->data)) |
|
106 | + if (is_array($output->data)) |
|
107 | 107 | { |
108 | - foreach($output->data as $oTrashVO) |
|
108 | + foreach ($output->data as $oTrashVO) |
|
109 | 109 | { |
110 | 110 | //class file check |
111 | 111 | $classPath = ModuleHandler::getModulePath($oTrashVO->getOriginModule()); |
112 | - if(!is_dir(FileHandler::getRealPath($classPath))) return new BaseObject(-1, 'not exist restore module directory'); |
|
112 | + if (!is_dir(FileHandler::getRealPath($classPath))) return new BaseObject(-1, 'not exist restore module directory'); |
|
113 | 113 | |
114 | 114 | $classFile = sprintf('%s%s.admin.controller.php', $classPath, $oTrashVO->getOriginModule()); |
115 | 115 | $classFile = FileHandler::getRealPath($classFile); |
116 | - if(!file_exists($classFile)) return new BaseObject(-1, 'not exist restore module class file'); |
|
116 | + if (!file_exists($classFile)) return new BaseObject(-1, 'not exist restore module class file'); |
|
117 | 117 | |
118 | 118 | $oAdminController = getAdminController($oTrashVO->getOriginModule()); |
119 | - if(!method_exists($oAdminController, 'emptyTrash')) return new BaseObject(-1, 'not exist restore method in module class file'); |
|
119 | + if (!method_exists($oAdminController, 'emptyTrash')) return new BaseObject(-1, 'not exist restore method in module class file'); |
|
120 | 120 | |
121 | 121 | $output2 = $oAdminController->emptyTrash($oTrashVO->getSerializedObject()); |
122 | - if(!$output2->toBool()) return new BaseObject(-1, $output2->message); |
|
122 | + if (!$output2->toBool()) return new BaseObject(-1, $output2->message); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | return new BaseObject(0, $lang->success_deleted); |
@@ -134,33 +134,33 @@ discard block |
||
134 | 134 | global $lang; |
135 | 135 | $trashSrlList = Context::get('cart'); |
136 | 136 | |
137 | - if(is_array($trashSrlList)) |
|
137 | + if (is_array($trashSrlList)) |
|
138 | 138 | { |
139 | 139 | // begin transaction |
140 | 140 | $oDB = &DB::getInstance(); |
141 | 141 | $oDB->begin(); |
142 | 142 | // eache restore method call in each classfile |
143 | - foreach($trashSrlList as $value) |
|
143 | + foreach ($trashSrlList as $value) |
|
144 | 144 | { |
145 | 145 | $oTrashModel = getModel('trash'); |
146 | 146 | $output = $oTrashModel->getTrash($value); |
147 | - if(!$output->toBool()) return new BaseObject(-1, $output->message); |
|
147 | + if (!$output->toBool()) return new BaseObject(-1, $output->message); |
|
148 | 148 | |
149 | 149 | //class file check |
150 | 150 | $classPath = ModuleHandler::getModulePath($output->data->getOriginModule()); |
151 | - if(!is_dir(FileHandler::getRealPath($classPath))) return new BaseObject(-1, 'not exist restore module directory'); |
|
151 | + if (!is_dir(FileHandler::getRealPath($classPath))) return new BaseObject(-1, 'not exist restore module directory'); |
|
152 | 152 | |
153 | 153 | $classFile = sprintf('%s%s.admin.controller.php', $classPath, $output->data->getOriginModule()); |
154 | 154 | $classFile = FileHandler::getRealPath($classFile); |
155 | - if(!file_exists($classFile)) return new BaseObject(-1, 'not exist restore module class file'); |
|
155 | + if (!file_exists($classFile)) return new BaseObject(-1, 'not exist restore module class file'); |
|
156 | 156 | |
157 | 157 | $oAdminController = getAdminController($output->data->getOriginModule()); |
158 | - if(!method_exists($oAdminController, 'restoreTrash')) return new BaseObject(-1, 'not exist restore method in module class file'); |
|
158 | + if (!method_exists($oAdminController, 'restoreTrash')) return new BaseObject(-1, 'not exist restore method in module class file'); |
|
159 | 159 | |
160 | 160 | $originObject = unserialize($output->data->getSerializedObject()); |
161 | 161 | $output = $oAdminController->restoreTrash($originObject); |
162 | 162 | |
163 | - if(!$output->toBool()) |
|
163 | + if (!$output->toBool()) |
|
164 | 164 | { |
165 | 165 | $oDB->rollback(); |
166 | 166 | return new BaseObject(-1, $output->message); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | // restore object delete in trash box |
171 | - if(!$this->_emptyTrash($trashSrlList)) { |
|
171 | + if (!$this->_emptyTrash($trashSrlList)) { |
|
172 | 172 | $oDB->rollback(); |
173 | 173 | return new BaseObject(-1, $lang->fail_empty); |
174 | 174 | } |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | */ |
188 | 188 | function procTrashAdminGetList() |
189 | 189 | { |
190 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
190 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
191 | 191 | $trashSrls = Context::get('trash_srls'); |
192 | - if($trashSrls) $trashSrlList = explode(',', $trashSrls); |
|
192 | + if ($trashSrls) $trashSrlList = explode(',', $trashSrls); |
|
193 | 193 | |
194 | - if(count($trashSrlList) > 0) |
|
194 | + if (count($trashSrlList) > 0) |
|
195 | 195 | { |
196 | 196 | $oTrashModel = getModel('trash'); |
197 | 197 | $args = new stdClass(); |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | */ |
219 | 219 | function _emptyTrash($trashSrls) |
220 | 220 | { |
221 | - if(!is_array($trashSrls)) return false; |
|
221 | + if (!is_array($trashSrls)) return false; |
|
222 | 222 | $args = new stdClass(); |
223 | 223 | $args->trashSrls = $trashSrls; |
224 | 224 | $output = executeQuery('trash.deleteTrash', $args); |
225 | - if(!$output->toBool()) return false; |
|
225 | + if (!$output->toBool()) return false; |
|
226 | 226 | |
227 | 227 | return true; |
228 | 228 | } |
@@ -27,8 +27,12 @@ discard block |
||
27 | 27 | $oTrashVO = new TrashVO(); |
28 | 28 | $oTrashVO = &$obj; |
29 | 29 | |
30 | - if(!$oTrashVO->getTrashSrl()) $oTrashVO->setTrashSrl(getNextSequence()); |
|
31 | - if(!is_string($oTrashVO->getSerializedObject())) $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject())); |
|
30 | + if(!$oTrashVO->getTrashSrl()) { |
|
31 | + $oTrashVO->setTrashSrl(getNextSequence()); |
|
32 | + } |
|
33 | + if(!is_string($oTrashVO->getSerializedObject())) { |
|
34 | + $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject())); |
|
35 | + } |
|
32 | 36 | $oTrashVO->setIpaddress($_SERVER['REMOTE_ADDR']); |
33 | 37 | $oTrashVO->setRemoverSrl($logged_info->member_srl); |
34 | 38 | $oTrashVO->setRegdate(date('YmdHis')); |
@@ -51,15 +55,22 @@ discard block |
||
51 | 55 | $trashSrls = array(); |
52 | 56 | if($isAll != 'true') |
53 | 57 | { |
54 | - if(is_array($tmpTrashSrls)) $trashSrls = $tmpTrashSrls; |
|
55 | - else $trashSrls = explode('|@|', $tmpTrashSrls); |
|
58 | + if(is_array($tmpTrashSrls)) { |
|
59 | + $trashSrls = $tmpTrashSrls; |
|
60 | + } else { |
|
61 | + $trashSrls = explode('|@|', $tmpTrashSrls); |
|
62 | + } |
|
56 | 63 | } |
57 | 64 | |
58 | 65 | //module relation data delete... |
59 | 66 | $output = $this->_relationDataDelete($isAll, $trashSrls); |
60 | - if(!$output->toBool()) return new BaseObject(-1, $output->message); |
|
67 | + if(!$output->toBool()) { |
|
68 | + return new BaseObject(-1, $output->message); |
|
69 | + } |
|
61 | 70 | |
62 | - if(!$this->_emptyTrash($trashSrls)) return new BaseObject(-1, $lang->fail_empty); |
|
71 | + if(!$this->_emptyTrash($trashSrls)) { |
|
72 | + return new BaseObject(-1, $lang->fail_empty); |
|
73 | + } |
|
63 | 74 | |
64 | 75 | $this->setMessage('success_deleted', 'info'); |
65 | 76 | |
@@ -91,8 +102,7 @@ discard block |
||
91 | 102 | $trashSrls[] = $value->getTrashSrl(); |
92 | 103 | } |
93 | 104 | } |
94 | - } |
|
95 | - else |
|
105 | + } else |
|
96 | 106 | { |
97 | 107 | $args = new stdClass(); |
98 | 108 | $args->trashSrl = $trashSrls; |
@@ -109,17 +119,25 @@ discard block |
||
109 | 119 | { |
110 | 120 | //class file check |
111 | 121 | $classPath = ModuleHandler::getModulePath($oTrashVO->getOriginModule()); |
112 | - if(!is_dir(FileHandler::getRealPath($classPath))) return new BaseObject(-1, 'not exist restore module directory'); |
|
122 | + if(!is_dir(FileHandler::getRealPath($classPath))) { |
|
123 | + return new BaseObject(-1, 'not exist restore module directory'); |
|
124 | + } |
|
113 | 125 | |
114 | 126 | $classFile = sprintf('%s%s.admin.controller.php', $classPath, $oTrashVO->getOriginModule()); |
115 | 127 | $classFile = FileHandler::getRealPath($classFile); |
116 | - if(!file_exists($classFile)) return new BaseObject(-1, 'not exist restore module class file'); |
|
128 | + if(!file_exists($classFile)) { |
|
129 | + return new BaseObject(-1, 'not exist restore module class file'); |
|
130 | + } |
|
117 | 131 | |
118 | 132 | $oAdminController = getAdminController($oTrashVO->getOriginModule()); |
119 | - if(!method_exists($oAdminController, 'emptyTrash')) return new BaseObject(-1, 'not exist restore method in module class file'); |
|
133 | + if(!method_exists($oAdminController, 'emptyTrash')) { |
|
134 | + return new BaseObject(-1, 'not exist restore method in module class file'); |
|
135 | + } |
|
120 | 136 | |
121 | 137 | $output2 = $oAdminController->emptyTrash($oTrashVO->getSerializedObject()); |
122 | - if(!$output2->toBool()) return new BaseObject(-1, $output2->message); |
|
138 | + if(!$output2->toBool()) { |
|
139 | + return new BaseObject(-1, $output2->message); |
|
140 | + } |
|
123 | 141 | } |
124 | 142 | } |
125 | 143 | return new BaseObject(0, $lang->success_deleted); |
@@ -144,18 +162,26 @@ discard block |
||
144 | 162 | { |
145 | 163 | $oTrashModel = getModel('trash'); |
146 | 164 | $output = $oTrashModel->getTrash($value); |
147 | - if(!$output->toBool()) return new BaseObject(-1, $output->message); |
|
165 | + if(!$output->toBool()) { |
|
166 | + return new BaseObject(-1, $output->message); |
|
167 | + } |
|
148 | 168 | |
149 | 169 | //class file check |
150 | 170 | $classPath = ModuleHandler::getModulePath($output->data->getOriginModule()); |
151 | - if(!is_dir(FileHandler::getRealPath($classPath))) return new BaseObject(-1, 'not exist restore module directory'); |
|
171 | + if(!is_dir(FileHandler::getRealPath($classPath))) { |
|
172 | + return new BaseObject(-1, 'not exist restore module directory'); |
|
173 | + } |
|
152 | 174 | |
153 | 175 | $classFile = sprintf('%s%s.admin.controller.php', $classPath, $output->data->getOriginModule()); |
154 | 176 | $classFile = FileHandler::getRealPath($classFile); |
155 | - if(!file_exists($classFile)) return new BaseObject(-1, 'not exist restore module class file'); |
|
177 | + if(!file_exists($classFile)) { |
|
178 | + return new BaseObject(-1, 'not exist restore module class file'); |
|
179 | + } |
|
156 | 180 | |
157 | 181 | $oAdminController = getAdminController($output->data->getOriginModule()); |
158 | - if(!method_exists($oAdminController, 'restoreTrash')) return new BaseObject(-1, 'not exist restore method in module class file'); |
|
182 | + if(!method_exists($oAdminController, 'restoreTrash')) { |
|
183 | + return new BaseObject(-1, 'not exist restore method in module class file'); |
|
184 | + } |
|
159 | 185 | |
160 | 186 | $originObject = unserialize($output->data->getSerializedObject()); |
161 | 187 | $output = $oAdminController->restoreTrash($originObject); |
@@ -187,9 +213,13 @@ discard block |
||
187 | 213 | */ |
188 | 214 | function procTrashAdminGetList() |
189 | 215 | { |
190 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
216 | + if(!Context::get('is_logged')) { |
|
217 | + return new BaseObject(-1,'msg_not_permitted'); |
|
218 | + } |
|
191 | 219 | $trashSrls = Context::get('trash_srls'); |
192 | - if($trashSrls) $trashSrlList = explode(',', $trashSrls); |
|
220 | + if($trashSrls) { |
|
221 | + $trashSrlList = explode(',', $trashSrls); |
|
222 | + } |
|
193 | 223 | |
194 | 224 | if(count($trashSrlList) > 0) |
195 | 225 | { |
@@ -198,8 +228,7 @@ discard block |
||
198 | 228 | $args->trashSrl = $trashSrlList; |
199 | 229 | $output = $oTrashModel->getTrashList($args); |
200 | 230 | $trashList = $output->data; |
201 | - } |
|
202 | - else |
|
231 | + } else |
|
203 | 232 | { |
204 | 233 | global $lang; |
205 | 234 | $trashList = array(); |
@@ -218,11 +247,15 @@ discard block |
||
218 | 247 | */ |
219 | 248 | function _emptyTrash($trashSrls) |
220 | 249 | { |
221 | - if(!is_array($trashSrls)) return false; |
|
250 | + if(!is_array($trashSrls)) { |
|
251 | + return false; |
|
252 | + } |
|
222 | 253 | $args = new stdClass(); |
223 | 254 | $args->trashSrls = $trashSrls; |
224 | 255 | $output = executeQuery('trash.deleteTrash', $args); |
225 | - if(!$output->toBool()) return false; |
|
256 | + if(!$output->toBool()) { |
|
257 | + return false; |
|
258 | + } |
|
226 | 259 | |
227 | 260 | return true; |
228 | 261 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | function init() |
18 | 18 | { |
19 | 19 | // 템플릿 경로 지정 (board의 경우 tpl에 관리자용 템플릿 모아놓음) |
20 | - $template_path = sprintf("%stpl/",$this->module_path); |
|
20 | + $template_path = sprintf("%stpl/", $this->module_path); |
|
21 | 21 | $this->setTemplatePath($template_path); |
22 | 22 | } |
23 | 23 | |
@@ -51,20 +51,20 @@ discard block |
||
51 | 51 | $oModuleModel = getModel('module'); |
52 | 52 | $module_list = array(); |
53 | 53 | $mod_srls = array(); |
54 | - foreach($output->data as $oTrashVO) |
|
54 | + foreach ($output->data as $oTrashVO) |
|
55 | 55 | { |
56 | 56 | $mod_srls[] = $oTrashVO->unserializedObject['module_srl']; |
57 | 57 | } |
58 | 58 | $mod_srls = array_unique($mod_srls); |
59 | 59 | // Module List |
60 | 60 | $mod_srls_count = count($mod_srls); |
61 | - if($mod_srls_count) |
|
61 | + if ($mod_srls_count) |
|
62 | 62 | { |
63 | 63 | $columnList = array('module_srl', 'mid', 'browser_title'); |
64 | 64 | $module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList); |
65 | - if($module_output && is_array($module_output)) |
|
65 | + if ($module_output && is_array($module_output)) |
|
66 | 66 | { |
67 | - foreach($module_output as $module) |
|
67 | + foreach ($module_output as $module) |
|
68 | 68 | { |
69 | 69 | $module_list[$module->module_srl] = $module; |
70 | 70 | } |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | |
87 | 87 | $oTrashModel = getModel('trash'); |
88 | 88 | $output = $oTrashModel->getTrash($trash_srl); |
89 | - if(!$output->data->getTrashSrl()) return new BaseObject(-1, 'msg_invalid_request'); |
|
89 | + if (!$output->data->getTrashSrl()) return new BaseObject(-1, 'msg_invalid_request'); |
|
90 | 90 | |
91 | 91 | $originObject = unserialize($output->data->getSerializedObject()); |
92 | - if(is_array($originObject)) $originObject = (object)$originObject; |
|
92 | + if (is_array($originObject)) $originObject = (object) $originObject; |
|
93 | 93 | |
94 | - Context::set('oTrashVO',$output->data); |
|
95 | - Context::set('oOrigin',$originObject); |
|
94 | + Context::set('oTrashVO', $output->data); |
|
95 | + Context::set('oOrigin', $originObject); |
|
96 | 96 | |
97 | 97 | $oMemberModel = &getModel('member'); |
98 | 98 | $remover_info = $oMemberModel->getMemberInfoByMemberSrl($output->data->getRemoverSrl()); |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($originObject->module_srl); |
103 | 103 | Context::set('module_info', $module_info); |
104 | 104 | |
105 | - if($originObject) { |
|
105 | + if ($originObject) { |
|
106 | 106 | $args_extra->module_srl = $originObject->module_srl; |
107 | 107 | $args_extra->document_srl = $originObject->document_srl; |
108 | 108 | $output_extra = executeQueryArray('trash.getDocumentExtraVars', $args_extra); |
109 | - Context::set('oOriginExtraVars',$output_extra->data); |
|
109 | + Context::set('oOriginExtraVars', $output_extra->data); |
|
110 | 110 | } |
111 | 111 | $this->setTemplateFile('trash_view'); |
112 | 112 | } |
@@ -86,10 +86,14 @@ |
||
86 | 86 | |
87 | 87 | $oTrashModel = getModel('trash'); |
88 | 88 | $output = $oTrashModel->getTrash($trash_srl); |
89 | - if(!$output->data->getTrashSrl()) return new BaseObject(-1, 'msg_invalid_request'); |
|
89 | + if(!$output->data->getTrashSrl()) { |
|
90 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
91 | + } |
|
90 | 92 | |
91 | 93 | $originObject = unserialize($output->data->getSerializedObject()); |
92 | - if(is_array($originObject)) $originObject = (object)$originObject; |
|
94 | + if(is_array($originObject)) { |
|
95 | + $originObject = (object)$originObject; |
|
96 | + } |
|
93 | 97 | |
94 | 98 | Context::set('oTrashVO',$output->data); |
95 | 99 | Context::set('oOrigin',$originObject); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | //$oDB = &DB::getInstance(); |
43 | 43 | //$oModuleModel = getModel('module'); |
44 | 44 | |
45 | - return new BaseObject(0,'success_updated'); |
|
45 | + return new BaseObject(0, 'success_updated'); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | /* End of file trash.class.php */ |