@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return BaseObject output document list |
30 | 30 | */ |
31 | - function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20) |
|
31 | + function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page = 1, $list_count = 20) |
|
32 | 32 | { |
33 | - if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list); |
|
33 | + if (is_array($module_srls_list)) $module_srls_list = implode(',', $module_srls_list); |
|
34 | 34 | |
35 | 35 | $args = new stdClass(); |
36 | - if($target == 'exclude') |
|
36 | + if ($target == 'exclude') |
|
37 | 37 | { |
38 | 38 | $module_srls_list .= ',0'; // exclude 'trash' |
39 | 39 | if ($module_srls_list{0} == ',') $module_srls_list = substr($module_srls_list, 1); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $args->sort_index = 'list_order'; |
54 | 54 | $args->order_type = 'asc'; |
55 | 55 | $args->statusList = array('PUBLIC'); |
56 | - if(!$args->module_srl) unset($args->module_srl); |
|
56 | + if (!$args->module_srl) unset($args->module_srl); |
|
57 | 57 | // Get a list of documents |
58 | 58 | $oDocumentModel = getModel('document'); |
59 | 59 | |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @return BaseObject output comment list |
73 | 73 | */ |
74 | - function getComments($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) |
|
74 | + function getComments($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20) |
|
75 | 75 | { |
76 | 76 | $args = new stdClass(); |
77 | 77 | |
78 | - if(is_array($module_srls_list)) |
|
78 | + if (is_array($module_srls_list)) |
|
79 | 79 | { |
80 | - if (count($module_srls_list) > 0) $module_srls = implode(',',$module_srls_list); |
|
80 | + if (count($module_srls_list) > 0) $module_srls = implode(',', $module_srls_list); |
|
81 | 81 | } |
82 | 82 | else |
83 | 83 | { |
84 | - if($module_srls_list) |
|
84 | + if ($module_srls_list) |
|
85 | 85 | { |
86 | 86 | $module_srls = $module_srls_list; |
87 | 87 | } |
88 | 88 | } |
89 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
89 | + if ($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
90 | 90 | else $args->module_srl = $module_srls; |
91 | 91 | |
92 | 92 | $args->page = $page; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // Get a list of documents |
100 | 100 | $oCommentModel = getModel('comment'); |
101 | 101 | $output = $oCommentModel->getTotalCommentList($args); |
102 | - if(!$output->toBool()|| !$output->data) return $output; |
|
102 | + if (!$output->toBool() || !$output->data) return $output; |
|
103 | 103 | return $output; |
104 | 104 | } |
105 | 105 | |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return BaseObject output trackback list |
117 | 117 | */ |
118 | - function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20) |
|
118 | + function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page = 1, $list_count = 20) |
|
119 | 119 | { |
120 | 120 | $oTrackbackModel = getAdminModel('trackback'); |
121 | - if(!$oTrackbackModel) return new BaseObject(); |
|
121 | + if (!$oTrackbackModel) return new BaseObject(); |
|
122 | 122 | $args = new stdClass(); |
123 | 123 | |
124 | - if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); |
|
124 | + if (is_array($module_srls_list)) $module_srls = implode(',', $module_srls_list); |
|
125 | 125 | else $module_srls = $module_srls_list; |
126 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
126 | + if ($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
127 | 127 | else $args->module_srl = $module_srls; |
128 | 128 | $args->page = $page; |
129 | 129 | $args->list_count = $list_count; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $args->order_type = 'asc'; |
135 | 135 | // Get a list of documents |
136 | 136 | $output = $oTrackbackModel->getTotalTrackbackList($args); |
137 | - if(!$output->toBool()|| !$output->data) return $output; |
|
137 | + if (!$output->toBool() || !$output->data) return $output; |
|
138 | 138 | return $output; |
139 | 139 | } |
140 | 140 | |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | { |
155 | 155 | $args = new stdClass(); |
156 | 156 | |
157 | - if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); |
|
157 | + if (is_array($module_srls_list)) $module_srls = implode(',', $module_srls_list); |
|
158 | 158 | else $module_srls = $module_srls_list; |
159 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
159 | + if ($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
160 | 160 | else $args->module_srl = $module_srls; |
161 | 161 | $args->page = $page; |
162 | 162 | $args->list_count = $list_count; |
@@ -166,32 +166,32 @@ discard block |
||
166 | 166 | $args->sort_index = 'files.file_srl'; |
167 | 167 | $args->order_type = 'desc'; |
168 | 168 | $args->isvalid = 'Y'; |
169 | - $args->direct_download = $direct_download=='Y'?'Y':'N'; |
|
169 | + $args->direct_download = $direct_download == 'Y' ? 'Y' : 'N'; |
|
170 | 170 | // Get a list of documents |
171 | 171 | $oFileAdminModel = getAdminModel('file'); |
172 | 172 | $output = $oFileAdminModel->getFileList($args); |
173 | - if(!$output->toBool() || !$output->data) return $output; |
|
173 | + if (!$output->toBool() || !$output->data) return $output; |
|
174 | 174 | |
175 | 175 | $list = array(); |
176 | - foreach($output->data as $key => $val) |
|
176 | + foreach ($output->data as $key => $val) |
|
177 | 177 | { |
178 | 178 | $obj = new stdClass; |
179 | 179 | $obj->filename = $val->source_filename; |
180 | 180 | $obj->download_count = $val->download_count; |
181 | - if(substr($val->download_url,0,2)=='./') $val->download_url = substr($val->download_url,2); |
|
181 | + if (substr($val->download_url, 0, 2) == './') $val->download_url = substr($val->download_url, 2); |
|
182 | 182 | $obj->download_url = Context::getRequestUri().$val->download_url; |
183 | 183 | $obj->target_srl = $val->upload_target_srl; |
184 | 184 | $obj->file_size = $val->file_size; |
185 | 185 | // Images |
186 | - if(preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename)) |
|
186 | + if (preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename)) |
|
187 | 187 | { |
188 | 188 | $obj->type = 'image'; |
189 | 189 | |
190 | - $thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($val->file_srl, 3)); |
|
191 | - if(!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path); |
|
190 | + $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($val->file_srl, 3)); |
|
191 | + if (!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path); |
|
192 | 192 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, 120, 120, 'crop'); |
193 | 193 | $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
194 | - if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop'); |
|
194 | + if (!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop'); |
|
195 | 195 | $obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 120, 120); |
196 | 196 | } |
197 | 197 | else |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | |
208 | 208 | $oDocumentModel = getModel('document'); |
209 | 209 | $document_list = $oDocumentModel->getDocuments($target_list); |
210 | - if($document_list) foreach($document_list as $key => $val) |
|
210 | + if ($document_list) foreach ($document_list as $key => $val) |
|
211 | 211 | { |
212 | - foreach($output->data as $k => $v) |
|
212 | + foreach ($output->data as $k => $v) |
|
213 | 213 | { |
214 | - if($v->target_srl== $val->document_srl) |
|
214 | + if ($v->target_srl == $val->document_srl) |
|
215 | 215 | { |
216 | 216 | $output->data[$k]->url = $val->getPermanentUrl(); |
217 | 217 | $output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i"); |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | |
223 | 223 | $oCommentModel = getModel('comment'); |
224 | 224 | $comment_list = $oCommentModel->getComments($target_list); |
225 | - if($comment_list) foreach($comment_list as $key => $val) |
|
225 | + if ($comment_list) foreach ($comment_list as $key => $val) |
|
226 | 226 | { |
227 | - foreach($output->data as $k => $v) |
|
227 | + foreach ($output->data as $k => $v) |
|
228 | 228 | { |
229 | - if($v->target_srl== $val->comment_srl) |
|
229 | + if ($v->target_srl == $val->comment_srl) |
|
230 | 230 | { |
231 | 231 | $output->data[$k]->url = $val->getPermanentUrl(); |
232 | 232 | $output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i"); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @return BaseObject |
251 | 251 | */ |
252 | - function getImages($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) |
|
252 | + function getImages($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20) |
|
253 | 253 | { |
254 | 254 | return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count); |
255 | 255 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @return BaseObject |
267 | 267 | */ |
268 | - function getFiles($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) |
|
268 | + function getFiles($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20) |
|
269 | 269 | { |
270 | 270 | return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, 'N'); |
271 | 271 | } |
@@ -30,16 +30,19 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20) |
32 | 32 | { |
33 | - if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list); |
|
33 | + if(is_array($module_srls_list)) { |
|
34 | + $module_srls_list = implode(',',$module_srls_list); |
|
35 | + } |
|
34 | 36 | |
35 | 37 | $args = new stdClass(); |
36 | 38 | if($target == 'exclude') |
37 | 39 | { |
38 | 40 | $module_srls_list .= ',0'; // exclude 'trash' |
39 | - if ($module_srls_list{0} == ',') $module_srls_list = substr($module_srls_list, 1); |
|
41 | + if ($module_srls_list{0} == ',') { |
|
42 | + $module_srls_list = substr($module_srls_list, 1); |
|
43 | + } |
|
40 | 44 | $args->exclude_module_srl = $module_srls_list; |
41 | - } |
|
42 | - else |
|
45 | + } else |
|
43 | 46 | { |
44 | 47 | $args->module_srl = $module_srls_list; |
45 | 48 | $args->exclude_module_srl = '0'; // exclude 'trash' |
@@ -53,7 +56,9 @@ discard block |
||
53 | 56 | $args->sort_index = 'list_order'; |
54 | 57 | $args->order_type = 'asc'; |
55 | 58 | $args->statusList = array('PUBLIC'); |
56 | - if(!$args->module_srl) unset($args->module_srl); |
|
59 | + if(!$args->module_srl) { |
|
60 | + unset($args->module_srl); |
|
61 | + } |
|
57 | 62 | // Get a list of documents |
58 | 63 | $oDocumentModel = getModel('document'); |
59 | 64 | |
@@ -77,17 +82,21 @@ discard block |
||
77 | 82 | |
78 | 83 | if(is_array($module_srls_list)) |
79 | 84 | { |
80 | - if (count($module_srls_list) > 0) $module_srls = implode(',',$module_srls_list); |
|
81 | - } |
|
82 | - else |
|
85 | + if (count($module_srls_list) > 0) { |
|
86 | + $module_srls = implode(',',$module_srls_list); |
|
87 | + } |
|
88 | + } else |
|
83 | 89 | { |
84 | 90 | if($module_srls_list) |
85 | 91 | { |
86 | 92 | $module_srls = $module_srls_list; |
87 | 93 | } |
88 | 94 | } |
89 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
90 | - else $args->module_srl = $module_srls; |
|
95 | + if($target == 'exclude') { |
|
96 | + $args->exclude_module_srl = $module_srls; |
|
97 | + } else { |
|
98 | + $args->module_srl = $module_srls; |
|
99 | + } |
|
91 | 100 | |
92 | 101 | $args->page = $page; |
93 | 102 | $args->list_count = $list_count; |
@@ -99,7 +108,9 @@ discard block |
||
99 | 108 | // Get a list of documents |
100 | 109 | $oCommentModel = getModel('comment'); |
101 | 110 | $output = $oCommentModel->getTotalCommentList($args); |
102 | - if(!$output->toBool()|| !$output->data) return $output; |
|
111 | + if(!$output->toBool()|| !$output->data) { |
|
112 | + return $output; |
|
113 | + } |
|
103 | 114 | return $output; |
104 | 115 | } |
105 | 116 | |
@@ -118,13 +129,21 @@ discard block |
||
118 | 129 | function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20) |
119 | 130 | { |
120 | 131 | $oTrackbackModel = getAdminModel('trackback'); |
121 | - if(!$oTrackbackModel) return new BaseObject(); |
|
132 | + if(!$oTrackbackModel) { |
|
133 | + return new BaseObject(); |
|
134 | + } |
|
122 | 135 | $args = new stdClass(); |
123 | 136 | |
124 | - if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); |
|
125 | - else $module_srls = $module_srls_list; |
|
126 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
127 | - else $args->module_srl = $module_srls; |
|
137 | + if(is_array($module_srls_list)) { |
|
138 | + $module_srls = implode(',',$module_srls_list); |
|
139 | + } else { |
|
140 | + $module_srls = $module_srls_list; |
|
141 | + } |
|
142 | + if($target == 'exclude') { |
|
143 | + $args->exclude_module_srl = $module_srls; |
|
144 | + } else { |
|
145 | + $args->module_srl = $module_srls; |
|
146 | + } |
|
128 | 147 | $args->page = $page; |
129 | 148 | $args->list_count = $list_count; |
130 | 149 | $args->page_count = 10; |
@@ -134,7 +153,9 @@ discard block |
||
134 | 153 | $args->order_type = 'asc'; |
135 | 154 | // Get a list of documents |
136 | 155 | $output = $oTrackbackModel->getTotalTrackbackList($args); |
137 | - if(!$output->toBool()|| !$output->data) return $output; |
|
156 | + if(!$output->toBool()|| !$output->data) { |
|
157 | + return $output; |
|
158 | + } |
|
138 | 159 | return $output; |
139 | 160 | } |
140 | 161 | |
@@ -154,10 +175,16 @@ discard block |
||
154 | 175 | { |
155 | 176 | $args = new stdClass(); |
156 | 177 | |
157 | - if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); |
|
158 | - else $module_srls = $module_srls_list; |
|
159 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
160 | - else $args->module_srl = $module_srls; |
|
178 | + if(is_array($module_srls_list)) { |
|
179 | + $module_srls = implode(',',$module_srls_list); |
|
180 | + } else { |
|
181 | + $module_srls = $module_srls_list; |
|
182 | + } |
|
183 | + if($target == 'exclude') { |
|
184 | + $args->exclude_module_srl = $module_srls; |
|
185 | + } else { |
|
186 | + $args->module_srl = $module_srls; |
|
187 | + } |
|
161 | 188 | $args->page = $page; |
162 | 189 | $args->list_count = $list_count; |
163 | 190 | $args->page_count = 10; |
@@ -170,7 +197,9 @@ discard block |
||
170 | 197 | // Get a list of documents |
171 | 198 | $oFileAdminModel = getAdminModel('file'); |
172 | 199 | $output = $oFileAdminModel->getFileList($args); |
173 | - if(!$output->toBool() || !$output->data) return $output; |
|
200 | + if(!$output->toBool() || !$output->data) { |
|
201 | + return $output; |
|
202 | + } |
|
174 | 203 | |
175 | 204 | $list = array(); |
176 | 205 | foreach($output->data as $key => $val) |
@@ -178,7 +207,9 @@ discard block |
||
178 | 207 | $obj = new stdClass; |
179 | 208 | $obj->filename = $val->source_filename; |
180 | 209 | $obj->download_count = $val->download_count; |
181 | - if(substr($val->download_url,0,2)=='./') $val->download_url = substr($val->download_url,2); |
|
210 | + if(substr($val->download_url,0,2)=='./') { |
|
211 | + $val->download_url = substr($val->download_url,2); |
|
212 | + } |
|
182 | 213 | $obj->download_url = Context::getRequestUri().$val->download_url; |
183 | 214 | $obj->target_srl = $val->upload_target_srl; |
184 | 215 | $obj->file_size = $val->file_size; |
@@ -188,13 +219,16 @@ discard block |
||
188 | 219 | $obj->type = 'image'; |
189 | 220 | |
190 | 221 | $thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($val->file_srl, 3)); |
191 | - if(!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path); |
|
222 | + if(!is_dir($thumbnail_path)) { |
|
223 | + FileHandler::makeDir($thumbnail_path); |
|
224 | + } |
|
192 | 225 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, 120, 120, 'crop'); |
193 | 226 | $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
194 | - if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop'); |
|
227 | + if(!file_exists($thumbnail_file)) { |
|
228 | + FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop'); |
|
229 | + } |
|
195 | 230 | $obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 120, 120); |
196 | - } |
|
197 | - else |
|
231 | + } else |
|
198 | 232 | { |
199 | 233 | $obj->type = 'binary'; |
200 | 234 | $obj->src = ''; |
@@ -207,13 +241,15 @@ discard block |
||
207 | 241 | |
208 | 242 | $oDocumentModel = getModel('document'); |
209 | 243 | $document_list = $oDocumentModel->getDocuments($target_list); |
210 | - if($document_list) foreach($document_list as $key => $val) |
|
244 | + if($document_list) { |
|
245 | + foreach($document_list as $key => $val) |
|
211 | 246 | { |
212 | 247 | foreach($output->data as $k => $v) |
213 | 248 | { |
214 | 249 | if($v->target_srl== $val->document_srl) |
215 | 250 | { |
216 | 251 | $output->data[$k]->url = $val->getPermanentUrl(); |
252 | + } |
|
217 | 253 | $output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i"); |
218 | 254 | $output->data[$k]->nick_name = $val->getNickName(); |
219 | 255 | } |
@@ -222,13 +258,15 @@ discard block |
||
222 | 258 | |
223 | 259 | $oCommentModel = getModel('comment'); |
224 | 260 | $comment_list = $oCommentModel->getComments($target_list); |
225 | - if($comment_list) foreach($comment_list as $key => $val) |
|
261 | + if($comment_list) { |
|
262 | + foreach($comment_list as $key => $val) |
|
226 | 263 | { |
227 | 264 | foreach($output->data as $k => $v) |
228 | 265 | { |
229 | 266 | if($v->target_srl== $val->comment_srl) |
230 | 267 | { |
231 | 268 | $output->data[$k]->url = $val->getPermanentUrl(); |
269 | + } |
|
232 | 270 | $output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i"); |
233 | 271 | $output->data[$k]->nick_name = $val->getNickName(); |
234 | 272 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
4 | +require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Module installer |
@@ -78,17 +78,17 @@ discard block |
||
78 | 78 | { |
79 | 79 | $oModel = getModel('autoinstall'); |
80 | 80 | $type = $oModel->getTypeFromPath($this->package->path); |
81 | - if($type == "module") |
|
81 | + if ($type == "module") |
|
82 | 82 | { |
83 | 83 | $output = $this->uninstallModule(); |
84 | - if(!$output->toBool()) |
|
84 | + if (!$output->toBool()) |
|
85 | 85 | { |
86 | 86 | return $output; |
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | 90 | $output = $this->_connect(); |
91 | - if(!$output->toBool()) |
|
91 | + if (!$output->toBool()) |
|
92 | 92 | { |
93 | 93 | return $output; |
94 | 94 | } |
@@ -116,19 +116,19 @@ discard block |
||
116 | 116 | */ |
117 | 117 | function _download() |
118 | 118 | { |
119 | - if($this->package->path == ".") |
|
119 | + if ($this->package->path == ".") |
|
120 | 120 | { |
121 | - $this->download_file = $this->temp_dir . "xe.tar"; |
|
121 | + $this->download_file = $this->temp_dir."xe.tar"; |
|
122 | 122 | $this->target_path = ""; |
123 | 123 | $this->download_path = $this->temp_dir; |
124 | 124 | } |
125 | 125 | else |
126 | 126 | { |
127 | 127 | $subpath = trim(substr($this->package->path, 2), '/'); |
128 | - $this->download_file = $this->temp_dir . $subpath . ".tar"; |
|
128 | + $this->download_file = $this->temp_dir.$subpath.".tar"; |
|
129 | 129 | $subpatharr = explode("/", $subpath); |
130 | 130 | array_pop($subpatharr); |
131 | - $this->download_path = $this->temp_dir . implode("/", $subpatharr); |
|
131 | + $this->download_path = $this->temp_dir.implode("/", $subpatharr); |
|
132 | 132 | $this->target_path = implode("/", $subpatharr); |
133 | 133 | } |
134 | 134 | |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | $path_array = explode("/", $this->package->path); |
153 | 153 | $target_name = array_pop($path_array); |
154 | 154 | $oModule = getModule($target_name, "class"); |
155 | - if(!$oModule) |
|
155 | + if (!$oModule) |
|
156 | 156 | { |
157 | 157 | return new BaseObject(-1, 'msg_invalid_request'); |
158 | 158 | } |
159 | - if(!method_exists($oModule, "moduleUninstall")) |
|
159 | + if (!method_exists($oModule, "moduleUninstall")) |
|
160 | 160 | { |
161 | 161 | return new BaseObject(-1, 'msg_invalid_request'); |
162 | 162 | } |
163 | 163 | |
164 | 164 | $output = $oModule->moduleUninstall(); |
165 | - if(is_subclass_of($output, 'BaseObject') && !$output->toBool()) |
|
165 | + if (is_subclass_of($output, 'BaseObject') && !$output->toBool()) |
|
166 | 166 | { |
167 | 167 | return $output; |
168 | 168 | } |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | $schema_dir = sprintf('%s/schemas/', $this->package->path); |
171 | 171 | $schema_files = FileHandler::readDir($schema_dir); |
172 | 172 | $oDB = DB::getInstance(); |
173 | - if(is_array($schema_files)) |
|
173 | + if (is_array($schema_files)) |
|
174 | 174 | { |
175 | - foreach($schema_files as $file) |
|
175 | + foreach ($schema_files as $file) |
|
176 | 176 | { |
177 | 177 | $filename_arr = explode(".", $file); |
178 | 178 | $filename = array_shift($filename_arr); |
@@ -192,26 +192,26 @@ discard block |
||
192 | 192 | function installModule() |
193 | 193 | { |
194 | 194 | $path = $this->package->path; |
195 | - if($path != ".") |
|
195 | + if ($path != ".") |
|
196 | 196 | { |
197 | 197 | $path_array = explode("/", $path); |
198 | 198 | $target_name = array_pop($path_array); |
199 | 199 | $type = substr(array_pop($path_array), 0, -1); |
200 | 200 | } |
201 | 201 | |
202 | - if($type == "module") |
|
202 | + if ($type == "module") |
|
203 | 203 | { |
204 | 204 | $oModuleModel = getModel('module'); |
205 | 205 | $oInstallController = getController('install'); |
206 | 206 | $module_path = ModuleHandler::getModulePath($target_name); |
207 | - if($oModuleModel->checkNeedInstall($target_name)) |
|
207 | + if ($oModuleModel->checkNeedInstall($target_name)) |
|
208 | 208 | { |
209 | 209 | $oInstallController->installModule($target_name, $module_path); |
210 | 210 | } |
211 | - if($oModuleModel->checkNeedUpdate($target_name)) |
|
211 | + if ($oModuleModel->checkNeedUpdate($target_name)) |
|
212 | 212 | { |
213 | 213 | $oModule = getModule($target_name, 'class'); |
214 | - if(method_exists($oModule, 'moduleUpdate')) |
|
214 | + if (method_exists($oModule, 'moduleUpdate')) |
|
215 | 215 | { |
216 | 216 | $oModule->moduleUpdate(); |
217 | 217 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $this->_download(); |
232 | 232 | $file_list = $this->_unPack(); |
233 | 233 | $output = $this->_copyDir($file_list); |
234 | - if(!$output->toBool()) |
|
234 | + if (!$output->toBool()) |
|
235 | 235 | { |
236 | 236 | FileHandler::removeDir($this->temp_dir); |
237 | 237 | return $output; |
@@ -249,18 +249,18 @@ discard block |
||
249 | 249 | */ |
250 | 250 | function _unPack() |
251 | 251 | { |
252 | - require_once(_XE_PATH_ . 'libs/tar.class.php'); |
|
252 | + require_once(_XE_PATH_.'libs/tar.class.php'); |
|
253 | 253 | |
254 | 254 | $oTar = new tar(); |
255 | 255 | $oTar->openTAR($this->download_file); |
256 | 256 | |
257 | 257 | $_files = $oTar->files; |
258 | 258 | $file_list = array(); |
259 | - if(is_array($_files)) |
|
259 | + if (is_array($_files)) |
|
260 | 260 | { |
261 | - foreach($_files as $key => $info) |
|
261 | + foreach ($_files as $key => $info) |
|
262 | 262 | { |
263 | - FileHandler::writeFile($this->download_path . "/" . $info['name'], $info['file']); |
|
263 | + FileHandler::writeFile($this->download_path."/".$info['name'], $info['file']); |
|
264 | 264 | $file_list[] = $info['name']; |
265 | 265 | } |
266 | 266 | } |
@@ -278,22 +278,22 @@ discard block |
||
278 | 278 | $real_path = FileHandler::getRealPath($path); |
279 | 279 | $oDir = dir($path); |
280 | 280 | $files = array(); |
281 | - while($file = $oDir->read()) |
|
281 | + while ($file = $oDir->read()) |
|
282 | 282 | { |
283 | - if($file == "." || $file == "..") |
|
283 | + if ($file == "." || $file == "..") |
|
284 | 284 | { |
285 | 285 | continue; |
286 | 286 | } |
287 | 287 | $files[] = $file; |
288 | 288 | } |
289 | 289 | |
290 | - foreach($files as $file) |
|
290 | + foreach ($files as $file) |
|
291 | 291 | { |
292 | - $file_path = $path . "/" . $file; |
|
293 | - if(is_dir(FileHandler::getRealPath($file_path))) |
|
292 | + $file_path = $path."/".$file; |
|
293 | + if (is_dir(FileHandler::getRealPath($file_path))) |
|
294 | 294 | { |
295 | 295 | $output = $this->_removeDir($file_path); |
296 | - if(!$output->toBool()) |
|
296 | + if (!$output->toBool()) |
|
297 | 297 | { |
298 | 298 | return $output; |
299 | 299 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | else |
302 | 302 | { |
303 | 303 | $output = $this->_removeFile($file_path); |
304 | - if(!$output->toBool()) |
|
304 | + if (!$output->toBool()) |
|
305 | 305 | { |
306 | 306 | return $output; |
307 | 307 | } |
@@ -357,17 +357,17 @@ discard block |
||
357 | 357 | */ |
358 | 358 | function _connect() |
359 | 359 | { |
360 | - if(!function_exists('ssh2_connect')) |
|
360 | + if (!function_exists('ssh2_connect')) |
|
361 | 361 | { |
362 | 362 | return new BaseObject(-1, 'msg_sftp_not_supported'); |
363 | 363 | } |
364 | 364 | |
365 | - if(!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y') |
|
365 | + if (!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y') |
|
366 | 366 | { |
367 | 367 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
368 | 368 | } |
369 | 369 | |
370 | - if($this->ftp_info->ftp_host) |
|
370 | + if ($this->ftp_info->ftp_host) |
|
371 | 371 | { |
372 | 372 | $ftp_host = $this->ftp_info->ftp_host; |
373 | 373 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $ftp_host = "127.0.0.1"; |
377 | 377 | } |
378 | 378 | $this->connection = ssh2_connect($ftp_host, $this->ftp_info->ftp_port); |
379 | - if(!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password)) |
|
379 | + if (!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password)) |
|
380 | 380 | { |
381 | 381 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
382 | 382 | } |
@@ -403,13 +403,13 @@ discard block |
||
403 | 403 | */ |
404 | 404 | function _removeFile($path) |
405 | 405 | { |
406 | - if(substr($path, 0, 2) == "./") |
|
406 | + if (substr($path, 0, 2) == "./") |
|
407 | 407 | { |
408 | 408 | $path = substr($path, 2); |
409 | 409 | } |
410 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
410 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
411 | 411 | |
412 | - if(!@ssh2_sftp_unlink($this->sftp, $target_path)) |
|
412 | + if (!@ssh2_sftp_unlink($this->sftp, $target_path)) |
|
413 | 413 | { |
414 | 414 | return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path)); |
415 | 415 | } |
@@ -424,13 +424,13 @@ discard block |
||
424 | 424 | */ |
425 | 425 | function _removeDir_real($path) |
426 | 426 | { |
427 | - if(substr($path, 0, 2) == "./") |
|
427 | + if (substr($path, 0, 2) == "./") |
|
428 | 428 | { |
429 | 429 | $path = substr($path, 2); |
430 | 430 | } |
431 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
431 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
432 | 432 | |
433 | - if(!@ssh2_sftp_rmdir($this->sftp, $target_path)) |
|
433 | + if (!@ssh2_sftp_rmdir($this->sftp, $target_path)) |
|
434 | 434 | { |
435 | 435 | return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path)); |
436 | 436 | } |
@@ -445,36 +445,36 @@ discard block |
||
445 | 445 | */ |
446 | 446 | function _copyDir(&$file_list) |
447 | 447 | { |
448 | - if(!$this->ftp_password) |
|
448 | + if (!$this->ftp_password) |
|
449 | 449 | { |
450 | 450 | return new BaseObject(-1, 'msg_ftp_password_input'); |
451 | 451 | } |
452 | 452 | |
453 | 453 | $output = $this->_connect(); |
454 | - if(!$output->toBool()) |
|
454 | + if (!$output->toBool()) |
|
455 | 455 | { |
456 | 456 | return $output; |
457 | 457 | } |
458 | - $target_dir = $this->ftp_info->ftp_root_path . $this->target_path; |
|
458 | + $target_dir = $this->ftp_info->ftp_root_path.$this->target_path; |
|
459 | 459 | |
460 | - if(is_array($file_list)) |
|
460 | + if (is_array($file_list)) |
|
461 | 461 | { |
462 | - foreach($file_list as $k => $file) |
|
462 | + foreach ($file_list as $k => $file) |
|
463 | 463 | { |
464 | 464 | $org_file = $file; |
465 | - if($this->package->path == ".") |
|
465 | + if ($this->package->path == ".") |
|
466 | 466 | { |
467 | 467 | $file = substr($file, 3); |
468 | 468 | } |
469 | - $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file); |
|
470 | - $pathname = dirname($target_dir . "/" . $file); |
|
469 | + $path = FileHandler::getRealPath("./".$this->target_path."/".$file); |
|
470 | + $pathname = dirname($target_dir."/".$file); |
|
471 | 471 | |
472 | - if(!file_exists(FileHandler::getRealPath($real_path))) |
|
472 | + if (!file_exists(FileHandler::getRealPath($real_path))) |
|
473 | 473 | { |
474 | 474 | ssh2_sftp_mkdir($this->sftp, $pathname, 0755, TRUE); |
475 | 475 | } |
476 | 476 | |
477 | - ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path . "/" . $org_file), $target_dir . "/" . $file); |
|
477 | + ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path."/".$org_file), $target_dir."/".$file); |
|
478 | 478 | } |
479 | 479 | } |
480 | 480 | return new BaseObject(); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | */ |
521 | 521 | function _connect() |
522 | 522 | { |
523 | - if($this->ftp_info->ftp_host) |
|
523 | + if ($this->ftp_info->ftp_host) |
|
524 | 524 | { |
525 | 525 | $ftp_host = $this->ftp_info->ftp_host; |
526 | 526 | } |
@@ -530,20 +530,20 @@ discard block |
||
530 | 530 | } |
531 | 531 | |
532 | 532 | $this->connection = ftp_connect($ftp_host, $this->ftp_info->ftp_port); |
533 | - if(!$this->connection) |
|
533 | + if (!$this->connection) |
|
534 | 534 | { |
535 | 535 | return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
536 | 536 | } |
537 | 537 | |
538 | 538 | $login_result = @ftp_login($this->connection, $this->ftp_info->ftp_user, $this->ftp_password); |
539 | - if(!$login_result) |
|
539 | + if (!$login_result) |
|
540 | 540 | { |
541 | 541 | $this->_close(); |
542 | 542 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
543 | 543 | } |
544 | 544 | |
545 | 545 | $_SESSION['ftp_password'] = $this->ftp_password; |
546 | - if($this->ftp_info->ftp_pasv != "N") |
|
546 | + if ($this->ftp_info->ftp_pasv != "N") |
|
547 | 547 | { |
548 | 548 | ftp_pasv($this->connection, TRUE); |
549 | 549 | } |
@@ -558,15 +558,15 @@ discard block |
||
558 | 558 | */ |
559 | 559 | function _removeFile($path) |
560 | 560 | { |
561 | - if(substr($path, 0, 2) == "./") |
|
561 | + if (substr($path, 0, 2) == "./") |
|
562 | 562 | { |
563 | 563 | $path = substr($path, 2); |
564 | 564 | } |
565 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
565 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
566 | 566 | |
567 | - if(!@ftp_delete($this->connection, $target_path)) |
|
567 | + if (!@ftp_delete($this->connection, $target_path)) |
|
568 | 568 | { |
569 | - return new BaseObject(-1, "failed to delete file " . $path); |
|
569 | + return new BaseObject(-1, "failed to delete file ".$path); |
|
570 | 570 | } |
571 | 571 | return new BaseObject(); |
572 | 572 | } |
@@ -579,15 +579,15 @@ discard block |
||
579 | 579 | */ |
580 | 580 | function _removeDir_real($path) |
581 | 581 | { |
582 | - if(substr($path, 0, 2) == "./") |
|
582 | + if (substr($path, 0, 2) == "./") |
|
583 | 583 | { |
584 | 584 | $path = substr($path, 2); |
585 | 585 | } |
586 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
586 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
587 | 587 | |
588 | - if(!@ftp_rmdir($this->connection, $target_path)) |
|
588 | + if (!@ftp_rmdir($this->connection, $target_path)) |
|
589 | 589 | { |
590 | - return new BaseObject(-1, "failed to delete directory " . $path); |
|
590 | + return new BaseObject(-1, "failed to delete directory ".$path); |
|
591 | 591 | } |
592 | 592 | return new BaseObject(); |
593 | 593 | } |
@@ -610,73 +610,73 @@ discard block |
||
610 | 610 | */ |
611 | 611 | function _copyDir(&$file_list) |
612 | 612 | { |
613 | - if(!$this->ftp_password) |
|
613 | + if (!$this->ftp_password) |
|
614 | 614 | { |
615 | 615 | return new BaseObject(-1, 'msg_ftp_password_input'); |
616 | 616 | } |
617 | 617 | |
618 | 618 | $output = $this->_connect(); |
619 | - if(!$output->toBool()) |
|
619 | + if (!$output->toBool()) |
|
620 | 620 | { |
621 | 621 | return $output; |
622 | 622 | } |
623 | 623 | |
624 | - if(!$this->target_path) |
|
624 | + if (!$this->target_path) |
|
625 | 625 | { |
626 | 626 | $this->target_path = '.'; |
627 | 627 | } |
628 | - if(substr($this->download_path, -1) == '/') |
|
628 | + if (substr($this->download_path, -1) == '/') |
|
629 | 629 | { |
630 | 630 | $this->download_path = substr($this->download_path, 0, -1); |
631 | 631 | } |
632 | - $target_dir = $this->ftp_info->ftp_root_path . $this->target_path; |
|
632 | + $target_dir = $this->ftp_info->ftp_root_path.$this->target_path; |
|
633 | 633 | |
634 | - if(is_array($file_list)) |
|
634 | + if (is_array($file_list)) |
|
635 | 635 | { |
636 | - foreach($file_list as $k => $file) |
|
636 | + foreach ($file_list as $k => $file) |
|
637 | 637 | { |
638 | - if(!$file) |
|
638 | + if (!$file) |
|
639 | 639 | { |
640 | 640 | continue; |
641 | 641 | } |
642 | 642 | $org_file = $file; |
643 | - if($this->package->path == ".") |
|
643 | + if ($this->package->path == ".") |
|
644 | 644 | { |
645 | 645 | $file = substr($file, 3); |
646 | 646 | } |
647 | - $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file); |
|
648 | - $path_list = explode('/', dirname($this->target_path . "/" . $file)); |
|
647 | + $path = FileHandler::getRealPath("./".$this->target_path."/".$file); |
|
648 | + $path_list = explode('/', dirname($this->target_path."/".$file)); |
|
649 | 649 | |
650 | 650 | $real_path = "./"; |
651 | 651 | $ftp_path = $this->ftp_info->ftp_root_path; |
652 | 652 | |
653 | - for($i = 0; $i < count($path_list); $i++) |
|
653 | + for ($i = 0; $i < count($path_list); $i++) |
|
654 | 654 | { |
655 | - if($path_list == "") |
|
655 | + if ($path_list == "") |
|
656 | 656 | { |
657 | 657 | continue; |
658 | 658 | } |
659 | - $real_path .= $path_list[$i] . "/"; |
|
660 | - $ftp_path .= $path_list[$i] . "/"; |
|
661 | - if(!file_exists(FileHandler::getRealPath($real_path))) |
|
659 | + $real_path .= $path_list[$i]."/"; |
|
660 | + $ftp_path .= $path_list[$i]."/"; |
|
661 | + if (!file_exists(FileHandler::getRealPath($real_path))) |
|
662 | 662 | { |
663 | - if(!@ftp_mkdir($this->connection, $ftp_path)) |
|
663 | + if (!@ftp_mkdir($this->connection, $ftp_path)) |
|
664 | 664 | { |
665 | 665 | return new BaseObject(-1, "msg_make_directory_failed"); |
666 | 666 | } |
667 | 667 | |
668 | - if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') |
|
668 | + if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') |
|
669 | 669 | { |
670 | - if(function_exists('ftp_chmod')) |
|
670 | + if (function_exists('ftp_chmod')) |
|
671 | 671 | { |
672 | - if(!ftp_chmod($this->connection, 0755, $ftp_path)) |
|
672 | + if (!ftp_chmod($this->connection, 0755, $ftp_path)) |
|
673 | 673 | { |
674 | 674 | return new BaseObject(-1, "msg_permission_adjust_failed"); |
675 | 675 | } |
676 | 676 | } |
677 | 677 | else |
678 | 678 | { |
679 | - if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path)) |
|
679 | + if (!ftp_site($this->connection, "CHMOD 755 ".$ftp_path)) |
|
680 | 680 | { |
681 | 681 | return new BaseObject(-1, "msg_permission_adjust_failed"); |
682 | 682 | } |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | } |
685 | 685 | } |
686 | 686 | } |
687 | - if(!ftp_put($this->connection, $target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file), FTP_BINARY)) |
|
687 | + if (!ftp_put($this->connection, $target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file), FTP_BINARY)) |
|
688 | 688 | { |
689 | 689 | return new BaseObject(-1, "msg_ftp_upload_failed"); |
690 | 690 | } |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | */ |
734 | 734 | function _connect() |
735 | 735 | { |
736 | - if($this->ftp_info->ftp_host) |
|
736 | + if ($this->ftp_info->ftp_host) |
|
737 | 737 | { |
738 | 738 | $ftp_host = $this->ftp_info->ftp_host; |
739 | 739 | } |
@@ -743,11 +743,11 @@ discard block |
||
743 | 743 | } |
744 | 744 | |
745 | 745 | $this->oFtp = new ftp(); |
746 | - if(!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port)) |
|
746 | + if (!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port)) |
|
747 | 747 | { |
748 | 748 | return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
749 | 749 | } |
750 | - if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password)) |
|
750 | + if (!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password)) |
|
751 | 751 | { |
752 | 752 | $this->_close(); |
753 | 753 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
@@ -764,13 +764,13 @@ discard block |
||
764 | 764 | */ |
765 | 765 | function _removeFile($path) |
766 | 766 | { |
767 | - if(substr($path, 0, 2) == "./") |
|
767 | + if (substr($path, 0, 2) == "./") |
|
768 | 768 | { |
769 | 769 | $path = substr($path, 2); |
770 | 770 | } |
771 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
771 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
772 | 772 | |
773 | - if(!$this->oFtp->ftp_delete($target_path)) |
|
773 | + if (!$this->oFtp->ftp_delete($target_path)) |
|
774 | 774 | { |
775 | 775 | return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path)); |
776 | 776 | } |
@@ -784,13 +784,13 @@ discard block |
||
784 | 784 | */ |
785 | 785 | function _removeDir_real($path) |
786 | 786 | { |
787 | - if(substr($path, 0, 2) == "./") |
|
787 | + if (substr($path, 0, 2) == "./") |
|
788 | 788 | { |
789 | 789 | $path = substr($path, 2); |
790 | 790 | } |
791 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
791 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
792 | 792 | |
793 | - if(!$this->oFtp->ftp_rmdir($target_path)) |
|
793 | + if (!$this->oFtp->ftp_rmdir($target_path)) |
|
794 | 794 | { |
795 | 795 | return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path)); |
796 | 796 | } |
@@ -815,50 +815,50 @@ discard block |
||
815 | 815 | */ |
816 | 816 | function _copyDir(&$file_list) |
817 | 817 | { |
818 | - if(!$this->ftp_password) |
|
818 | + if (!$this->ftp_password) |
|
819 | 819 | { |
820 | 820 | return new BaseObject(-1, 'msg_ftp_password_input'); |
821 | 821 | } |
822 | 822 | |
823 | 823 | $output = $this->_connect(); |
824 | - if(!$output->toBool()) |
|
824 | + if (!$output->toBool()) |
|
825 | 825 | { |
826 | 826 | return $output; |
827 | 827 | } |
828 | 828 | |
829 | 829 | $oFtp = &$this->oFtp; |
830 | - $target_dir = $this->ftp_info->ftp_root_path . $this->target_path; |
|
830 | + $target_dir = $this->ftp_info->ftp_root_path.$this->target_path; |
|
831 | 831 | |
832 | - if(is_array($file_list)) |
|
832 | + if (is_array($file_list)) |
|
833 | 833 | { |
834 | - foreach($file_list as $k => $file) |
|
834 | + foreach ($file_list as $k => $file) |
|
835 | 835 | { |
836 | 836 | $org_file = $file; |
837 | - if($this->package->path == ".") |
|
837 | + if ($this->package->path == ".") |
|
838 | 838 | { |
839 | 839 | $file = substr($file, 3); |
840 | 840 | } |
841 | - $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file); |
|
842 | - $path_list = explode('/', dirname($this->target_path . "/" . $file)); |
|
841 | + $path = FileHandler::getRealPath("./".$this->target_path."/".$file); |
|
842 | + $path_list = explode('/', dirname($this->target_path."/".$file)); |
|
843 | 843 | |
844 | 844 | $real_path = "./"; |
845 | 845 | $ftp_path = $this->ftp_info->ftp_root_path; |
846 | 846 | |
847 | - for($i = 0; $i < count($path_list); $i++) |
|
847 | + for ($i = 0; $i < count($path_list); $i++) |
|
848 | 848 | { |
849 | - if($path_list == "") |
|
849 | + if ($path_list == "") |
|
850 | 850 | { |
851 | 851 | continue; |
852 | 852 | } |
853 | - $real_path .= $path_list[$i] . "/"; |
|
854 | - $ftp_path .= $path_list[$i] . "/"; |
|
855 | - if(!file_exists(FileHandler::getRealPath($real_path))) |
|
853 | + $real_path .= $path_list[$i]."/"; |
|
854 | + $ftp_path .= $path_list[$i]."/"; |
|
855 | + if (!file_exists(FileHandler::getRealPath($real_path))) |
|
856 | 856 | { |
857 | 857 | $oFtp->ftp_mkdir($ftp_path); |
858 | - $oFtp->ftp_site("CHMOD 755 " . $ftp_path); |
|
858 | + $oFtp->ftp_site("CHMOD 755 ".$ftp_path); |
|
859 | 859 | } |
860 | 860 | } |
861 | - $oFtp->ftp_put($target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file)); |
|
861 | + $oFtp->ftp_put($target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file)); |
|
862 | 862 | } |
863 | 863 | } |
864 | 864 | |
@@ -903,13 +903,13 @@ discard block |
||
903 | 903 | */ |
904 | 904 | function _removeFile($path) |
905 | 905 | { |
906 | - if(substr($path, 0, 2) == "./") |
|
906 | + if (substr($path, 0, 2) == "./") |
|
907 | 907 | { |
908 | 908 | $path = substr($path, 2); |
909 | 909 | } |
910 | 910 | $target_path = FileHandler::getRealPath($path); |
911 | 911 | |
912 | - if(!FileHandler::removeFile($target_path)) |
|
912 | + if (!FileHandler::removeFile($target_path)) |
|
913 | 913 | { |
914 | 914 | return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path)); |
915 | 915 | } |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | */ |
924 | 924 | function _removeDir_real($path) |
925 | 925 | { |
926 | - if(substr($path, 0, 2) == "./") |
|
926 | + if (substr($path, 0, 2) == "./") |
|
927 | 927 | { |
928 | 928 | $path = substr($path, 2); |
929 | 929 | } |
@@ -952,38 +952,38 @@ discard block |
||
952 | 952 | function _copyDir(&$file_list) |
953 | 953 | { |
954 | 954 | $output = $this->_connect(); |
955 | - if(!$output->toBool()) |
|
955 | + if (!$output->toBool()) |
|
956 | 956 | { |
957 | 957 | return $output; |
958 | 958 | } |
959 | 959 | $target_dir = $this->target_path; |
960 | 960 | |
961 | - if(is_array($file_list)) |
|
961 | + if (is_array($file_list)) |
|
962 | 962 | { |
963 | - foreach($file_list as $k => $file) |
|
963 | + foreach ($file_list as $k => $file) |
|
964 | 964 | { |
965 | 965 | $org_file = $file; |
966 | - if($this->package->path == ".") |
|
966 | + if ($this->package->path == ".") |
|
967 | 967 | { |
968 | 968 | $file = substr($file, 3); |
969 | 969 | } |
970 | - $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file); |
|
971 | - $path_list = explode('/', dirname($this->target_path . "/" . $file)); |
|
970 | + $path = FileHandler::getRealPath("./".$this->target_path."/".$file); |
|
971 | + $path_list = explode('/', dirname($this->target_path."/".$file)); |
|
972 | 972 | $real_path = "./"; |
973 | 973 | |
974 | - for($i = 0; $i < count($path_list); $i++) |
|
974 | + for ($i = 0; $i < count($path_list); $i++) |
|
975 | 975 | { |
976 | - if($path_list == "") |
|
976 | + if ($path_list == "") |
|
977 | 977 | { |
978 | 978 | continue; |
979 | 979 | } |
980 | - $real_path .= $path_list[$i] . "/"; |
|
981 | - if(!file_exists(FileHandler::getRealPath($real_path))) |
|
980 | + $real_path .= $path_list[$i]."/"; |
|
981 | + if (!file_exists(FileHandler::getRealPath($real_path))) |
|
982 | 982 | { |
983 | 983 | FileHandler::makeDir($real_path); |
984 | 984 | } |
985 | 985 | } |
986 | - FileHandler::copyFile( FileHandler::getRealPath($this->download_path . "/" . $org_file), FileHandler::getRealPath("./" . $target_dir . '/' . $file)); |
|
986 | + FileHandler::copyFile(FileHandler::getRealPath($this->download_path."/".$org_file), FileHandler::getRealPath("./".$target_dir.'/'.$file)); |
|
987 | 987 | } |
988 | 988 | } |
989 | 989 |
@@ -121,8 +121,7 @@ discard block |
||
121 | 121 | $this->download_file = $this->temp_dir . "xe.tar"; |
122 | 122 | $this->target_path = ""; |
123 | 123 | $this->download_path = $this->temp_dir; |
124 | - } |
|
125 | - else |
|
124 | + } else |
|
126 | 125 | { |
127 | 126 | $subpath = trim(substr($this->package->path, 2), '/'); |
128 | 127 | $this->download_file = $this->temp_dir . $subpath . ".tar"; |
@@ -297,8 +296,7 @@ discard block |
||
297 | 296 | { |
298 | 297 | return $output; |
299 | 298 | } |
300 | - } |
|
301 | - else |
|
299 | + } else |
|
302 | 300 | { |
303 | 301 | $output = $this->_removeFile($file_path); |
304 | 302 | if(!$output->toBool()) |
@@ -370,8 +368,7 @@ discard block |
||
370 | 368 | if($this->ftp_info->ftp_host) |
371 | 369 | { |
372 | 370 | $ftp_host = $this->ftp_info->ftp_host; |
373 | - } |
|
374 | - else |
|
371 | + } else |
|
375 | 372 | { |
376 | 373 | $ftp_host = "127.0.0.1"; |
377 | 374 | } |
@@ -523,8 +520,7 @@ discard block |
||
523 | 520 | if($this->ftp_info->ftp_host) |
524 | 521 | { |
525 | 522 | $ftp_host = $this->ftp_info->ftp_host; |
526 | - } |
|
527 | - else |
|
523 | + } else |
|
528 | 524 | { |
529 | 525 | $ftp_host = "127.0.0.1"; |
530 | 526 | } |
@@ -673,8 +669,7 @@ discard block |
||
673 | 669 | { |
674 | 670 | return new BaseObject(-1, "msg_permission_adjust_failed"); |
675 | 671 | } |
676 | - } |
|
677 | - else |
|
672 | + } else |
|
678 | 673 | { |
679 | 674 | if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path)) |
680 | 675 | { |
@@ -736,8 +731,7 @@ discard block |
||
736 | 731 | if($this->ftp_info->ftp_host) |
737 | 732 | { |
738 | 733 | $ftp_host = $this->ftp_info->ftp_host; |
739 | - } |
|
740 | - else |
|
734 | + } else |
|
741 | 735 | { |
742 | 736 | $ftp_host = "127.0.0.1"; |
743 | 737 | } |
@@ -19,19 +19,19 @@ discard block |
||
19 | 19 | function preProcParam(&$order_target, &$order_type, &$page) |
20 | 20 | { |
21 | 21 | $order_target_array = array('newest' => 1, 'download' => 1, 'popular' => 1); |
22 | - if(!isset($order_target_array[$order_target])) |
|
22 | + if (!isset($order_target_array[$order_target])) |
|
23 | 23 | { |
24 | 24 | $order_target = 'newest'; |
25 | 25 | } |
26 | 26 | |
27 | 27 | $order_type_array = array('asc' => 1, 'desc' => 1); |
28 | - if(!isset($order_type_array[$order_type])) |
|
28 | + if (!isset($order_type_array[$order_type])) |
|
29 | 29 | { |
30 | 30 | $order_type = 'desc'; |
31 | 31 | } |
32 | 32 | |
33 | 33 | $page = (int) $page; |
34 | - if($page < 1) |
|
34 | + if ($page < 1) |
|
35 | 35 | { |
36 | 36 | $page = 1; |
37 | 37 | } |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | |
64 | 64 | $type_array = array('M' => 1, 'P' => 1); |
65 | 65 | $type = Context::get('type'); |
66 | - if(!isset($type_array[$type])) |
|
66 | + if (!isset($type_array[$type])) |
|
67 | 67 | { |
68 | 68 | $type = 'P'; |
69 | 69 | } |
70 | 70 | |
71 | - if($type == 'P') |
|
71 | + if ($type == 'P') |
|
72 | 72 | { |
73 | 73 | $category_srl = $this->layout_category_srl; |
74 | 74 | } |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | |
96 | 96 | $type_array = array('M' => 1, 'P' => 1); |
97 | 97 | $type = Context::get('type'); |
98 | - if(!isset($type_array[$type])) |
|
98 | + if (!isset($type_array[$type])) |
|
99 | 99 | { |
100 | 100 | $type = 'P'; |
101 | 101 | } |
102 | 102 | |
103 | - if($type == 'P') |
|
103 | + if ($type == 'P') |
|
104 | 104 | { |
105 | 105 | $category_srl = $this->module_skin_category_srl; |
106 | 106 | } |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function getPackageList($type, $order_target = 'newest', $order_type = 'desc', $page = '1', $search_keyword = NULL, $category_srl = NULL, $parent_program = NULL) |
120 | 120 | { |
121 | - if($type == 'menu') |
|
121 | + if ($type == 'menu') |
|
122 | 122 | { |
123 | 123 | $params["act"] = "getResourceapiMenuPackageList"; |
124 | 124 | } |
125 | - elseif($type == 'skin') |
|
125 | + elseif ($type == 'skin') |
|
126 | 126 | { |
127 | 127 | $params["act"] = "getResourceapiSkinPackageList"; |
128 | 128 | $params['parent_program'] = $parent_program; |
@@ -137,18 +137,18 @@ discard block |
||
137 | 137 | $params["order_type"] = $order_type; |
138 | 138 | $params["page"] = $page; |
139 | 139 | |
140 | - if($category_srl) |
|
140 | + if ($category_srl) |
|
141 | 141 | { |
142 | 142 | $params["category_srl"] = $category_srl; |
143 | 143 | } |
144 | 144 | |
145 | - if($search_keyword) |
|
145 | + if ($search_keyword) |
|
146 | 146 | { |
147 | 147 | $params["search_keyword"] = $search_keyword; |
148 | 148 | } |
149 | 149 | |
150 | 150 | $xmlDoc = XmlGenerater::getXmlDoc($params); |
151 | - if($xmlDoc && $xmlDoc->response->packagelist->item) |
|
151 | + if ($xmlDoc && $xmlDoc->response->packagelist->item) |
|
152 | 152 | { |
153 | 153 | $item_list = $oAdminView->rearranges($xmlDoc->response->packagelist->item); |
154 | 154 | $this->add('item_list', $item_list); |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | |
170 | 170 | $is_authed = 0; |
171 | 171 | $output = $oAdminModel->checkUseDirectModuleInstall($package); |
172 | - if($output->toBool()==TRUE) |
|
172 | + if ($output->toBool() == TRUE) |
|
173 | 173 | { |
174 | 174 | $is_authed = 1; |
175 | 175 | } |
176 | 176 | else |
177 | 177 | { |
178 | 178 | $ftp_info = Context::getFTPInfo(); |
179 | - if(!$ftp_info->ftp_root_path) |
|
179 | + if (!$ftp_info->ftp_root_path) |
|
180 | 180 | { |
181 | 181 | $is_authed = -1; |
182 | 182 | } |
@@ -196,14 +196,14 @@ discard block |
||
196 | 196 | { |
197 | 197 | $oModel = getModel('autoinstall'); |
198 | 198 | $output = executeQueryArray('autoinstall.getNeedUpdate'); |
199 | - if(!is_array($output->data)) |
|
199 | + if (!is_array($output->data)) |
|
200 | 200 | { |
201 | 201 | return NULL; |
202 | 202 | } |
203 | 203 | |
204 | 204 | $result = array(); |
205 | 205 | $xml = new XmlParser(); |
206 | - foreach($output->data as $package) |
|
206 | + foreach ($output->data as $package) |
|
207 | 207 | { |
208 | 208 | $packageSrl = $package->package_srl; |
209 | 209 | |
@@ -213,27 +213,27 @@ discard block |
||
213 | 213 | $packageInfo->type = $oModel->getTypeFromPath($package->path); |
214 | 214 | $packageInfo->url = $oModel->getUpdateUrlByPackageSrl($package->package_srl); |
215 | 215 | |
216 | - if($packageInfo->type == 'core') |
|
216 | + if ($packageInfo->type == 'core') |
|
217 | 217 | { |
218 | 218 | $title = 'XpressEngine'; |
219 | 219 | } |
220 | 220 | else |
221 | 221 | { |
222 | 222 | $configFile = $oModel->getConfigFilePath($packageInfo->type); |
223 | - $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path) . $configFile); |
|
223 | + $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path).$configFile); |
|
224 | 224 | |
225 | - if($xmlDoc) |
|
225 | + if ($xmlDoc) |
|
226 | 226 | { |
227 | 227 | $type = $packageInfo->type; |
228 | - if($type == "drcomponent") |
|
228 | + if ($type == "drcomponent") |
|
229 | 229 | { |
230 | 230 | $type = "component"; |
231 | 231 | } |
232 | - if($type == "style" || $type == "m.skin") |
|
232 | + if ($type == "style" || $type == "m.skin") |
|
233 | 233 | { |
234 | 234 | $type = "skin"; |
235 | 235 | } |
236 | - if($type == "m.layout") |
|
236 | + if ($type == "m.layout") |
|
237 | 237 | { |
238 | 238 | $type = "layout"; |
239 | 239 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $oModel = getModel('autoinstall'); |
268 | 268 | |
269 | 269 | $targetpackages = array(); |
270 | - if($xmlDoc) |
|
270 | + if ($xmlDoc) |
|
271 | 271 | { |
272 | 272 | $xmlPackage = $xmlDoc->response->package; |
273 | 273 | $package = new stdClass(); |
@@ -276,15 +276,15 @@ discard block |
||
276 | 276 | $package->package_description = $xmlPackage->package_description->body; |
277 | 277 | $package->version = $xmlPackage->version->body; |
278 | 278 | $package->path = $xmlPackage->path->body; |
279 | - if($xmlPackage->depends) |
|
279 | + if ($xmlPackage->depends) |
|
280 | 280 | { |
281 | - if(!is_array($xmlPackage->depends->item)) |
|
281 | + if (!is_array($xmlPackage->depends->item)) |
|
282 | 282 | { |
283 | 283 | $xmlPackage->depends->item = array($xmlPackage->depends->item); |
284 | 284 | } |
285 | 285 | |
286 | 286 | $package->depends = array(); |
287 | - foreach($xmlPackage->depends->item as $item) |
|
287 | + foreach ($xmlPackage->depends->item as $item) |
|
288 | 288 | { |
289 | 289 | $dep_item = new stdClass(); |
290 | 290 | $dep_item->package_srl = $item->package_srl->body; |
@@ -297,23 +297,23 @@ discard block |
||
297 | 297 | |
298 | 298 | $packages = $oModel->getInstalledPackages(array_keys($targetpackages)); |
299 | 299 | $package->deplist = ""; |
300 | - foreach($package->depends as $key => $dep) |
|
300 | + foreach ($package->depends as $key => $dep) |
|
301 | 301 | { |
302 | - if(!$packages[$dep->package_srl]) |
|
302 | + if (!$packages[$dep->package_srl]) |
|
303 | 303 | { |
304 | 304 | $package->depends[$key]->installed = FALSE; |
305 | - $package->package_srl .= "," . $dep->package_srl; |
|
305 | + $package->package_srl .= ",".$dep->package_srl; |
|
306 | 306 | } |
307 | 307 | else |
308 | 308 | { |
309 | 309 | $package->depends[$key]->installed = TRUE; |
310 | 310 | $package->depends[$key]->cur_version = $packages[$dep->package_srl]->current_version; |
311 | - if(version_compare($dep->version, $packages[$dep->package_srl]->current_version, ">")) |
|
311 | + if (version_compare($dep->version, $packages[$dep->package_srl]->current_version, ">")) |
|
312 | 312 | { |
313 | 313 | $package->depends[$key]->need_update = TRUE; |
314 | - $package->package_srl .= "," . $dep->package_srl; |
|
314 | + $package->package_srl .= ",".$dep->package_srl; |
|
315 | 315 | |
316 | - if($dep->path === '.') |
|
316 | + if ($dep->path === '.') |
|
317 | 317 | { |
318 | 318 | $package->contain_core = TRUE; |
319 | 319 | $package->contain_core_version = $dep->version; |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | } |
329 | 329 | |
330 | 330 | $installedPackage = $oModel->getInstalledPackage($packageSrl); |
331 | - if($installedPackage) |
|
331 | + if ($installedPackage) |
|
332 | 332 | { |
333 | 333 | $package->installed = TRUE; |
334 | 334 | $package->cur_version = $installedPackage->current_version; |
335 | 335 | $package->need_update = version_compare($package->version, $installedPackage->current_version, ">"); |
336 | 336 | } |
337 | 337 | |
338 | - if($package->path === '.') |
|
338 | + if ($package->path === '.') |
|
339 | 339 | { |
340 | 340 | $package->contain_core = TRUE; |
341 | 341 | $package->contain_core_version = $package->version; |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | public function getAutoInstallAdminInstallInfo() |
352 | 352 | { |
353 | 353 | $packageSrl = Context::get('package_srl'); |
354 | - if(!$packageSrl) |
|
354 | + if (!$packageSrl) |
|
355 | 355 | { |
356 | 356 | return new BaseObject(-1, 'msg_invalid_request'); |
357 | 357 | } |
@@ -365,23 +365,23 @@ discard block |
||
365 | 365 | $directModuleInstall = TRUE; |
366 | 366 | $arrUnwritableDir = array(); |
367 | 367 | $output = $this->isWritableDir($package->path); |
368 | - if($output->toBool()==FALSE) |
|
368 | + if ($output->toBool() == FALSE) |
|
369 | 369 | { |
370 | 370 | $directModuleInstall = FALSE; |
371 | 371 | $arrUnwritableDir[] = $output->get('path'); |
372 | 372 | } |
373 | 373 | |
374 | - foreach($package->depends as $dep) |
|
374 | + foreach ($package->depends as $dep) |
|
375 | 375 | { |
376 | 376 | $output = $this->isWritableDir($dep->path); |
377 | - if($output->toBool()==FALSE) |
|
377 | + if ($output->toBool() == FALSE) |
|
378 | 378 | { |
379 | 379 | $directModuleInstall = FALSE; |
380 | 380 | $arrUnwritableDir[] = $output->get('path'); |
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
384 | - if($directModuleInstall==FALSE) |
|
384 | + if ($directModuleInstall == FALSE) |
|
385 | 385 | { |
386 | 386 | $output = new BaseObject(-1, 'msg_direct_inall_invalid'); |
387 | 387 | $output->add('path', $arrUnwritableDir); |
@@ -396,17 +396,17 @@ discard block |
||
396 | 396 | $path_list = explode('/', dirname($path)); |
397 | 397 | $real_path = './'; |
398 | 398 | |
399 | - while($path_list) |
|
399 | + while ($path_list) |
|
400 | 400 | { |
401 | - $check_path = realpath($real_path . implode('/', $path_list)); |
|
402 | - if(FileHandler::isDir($check_path)) |
|
401 | + $check_path = realpath($real_path.implode('/', $path_list)); |
|
402 | + if (FileHandler::isDir($check_path)) |
|
403 | 403 | { |
404 | 404 | break; |
405 | 405 | } |
406 | 406 | array_pop($path_list); |
407 | 407 | } |
408 | 408 | |
409 | - if(FileHandler::isWritableDir($check_path)==FALSE) |
|
409 | + if (FileHandler::isWritableDir($check_path) == FALSE) |
|
410 | 410 | { |
411 | 411 | $output = new BaseObject(-1, 'msg_unwritable_directory'); |
412 | 412 | $output->add('path', FileHandler::getRealPath($check_path)); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | function session() |
17 | 17 | { |
18 | - if(Context::isInstalled()) $this->session_started= true; |
|
18 | + if (Context::isInstalled()) $this->session_started = true; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | function moduleInstall() |
25 | 25 | { |
26 | 26 | $oDB = &DB::getInstance(); |
27 | - $oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid")); |
|
27 | + $oDB->addIndex("session", "idx_session_update_mid", array("member_srl", "last_update", "cur_mid")); |
|
28 | 28 | |
29 | 29 | return new BaseObject(); |
30 | 30 | } |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | $oModuleModel = getModel('module'); |
39 | 39 | $oModuleController = getController('module'); |
40 | 40 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
41 | - if($oModuleModel->needUpdate($version_update_id)) |
|
41 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
42 | 42 | { |
43 | - if(!$oDB->isTableExists('session')) return true; |
|
44 | - if(!$oDB->isColumnExists("session","cur_mid")) return true; |
|
45 | - if(!$oDB->isIndexExists("session","idx_session_update_mid")) return true; |
|
43 | + if (!$oDB->isTableExists('session')) return true; |
|
44 | + if (!$oDB->isColumnExists("session", "cur_mid")) return true; |
|
45 | + if (!$oDB->isIndexExists("session", "idx_session_update_mid")) return true; |
|
46 | 46 | |
47 | 47 | $oModuleController->insertUpdatedLog($version_update_id); |
48 | 48 | } |
@@ -59,19 +59,19 @@ discard block |
||
59 | 59 | $oModuleModel = getModel('module'); |
60 | 60 | $oModuleController = getController('module'); |
61 | 61 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
62 | - if($oModuleModel->needUpdate($version_update_id)) |
|
62 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
63 | 63 | { |
64 | - if(!$oDB->isTableExists('session')) |
|
64 | + if (!$oDB->isTableExists('session')) |
|
65 | 65 | { |
66 | 66 | $oDB->createTableByXmlFile($this->module_path.'schemas/session.xml'); |
67 | 67 | } |
68 | - if(!$oDB->isColumnExists("session","cur_mid")) |
|
68 | + if (!$oDB->isColumnExists("session", "cur_mid")) |
|
69 | 69 | { |
70 | - $oDB->addColumn('session',"cur_mid","varchar",128); |
|
70 | + $oDB->addColumn('session', "cur_mid", "varchar", 128); |
|
71 | 71 | } |
72 | - if(!$oDB->isIndexExists("session","idx_session_update_mid")) |
|
72 | + if (!$oDB->isIndexExists("session", "idx_session_update_mid")) |
|
73 | 73 | { |
74 | - $oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid")); |
|
74 | + $oDB->addIndex("session", "idx_session_update_mid", array("member_srl", "last_update", "cur_mid")); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $oModuleController->insertUpdatedLog($version_update_id); |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function unSerializeSession($val) |
87 | 87 | { |
88 | - $vars = preg_split('/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/', $val,-1,PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
|
89 | - for($i=0; $vars[$i]; $i++) $result[$vars[$i++]] = unserialize($vars[$i]); |
|
88 | + $vars = preg_split('/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/', $val, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
|
89 | + for ($i = 0; $vars[$i]; $i++) $result[$vars[$i++]] = unserialize($vars[$i]); |
|
90 | 90 | return $result; |
91 | 91 | } |
92 | 92 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | */ |
96 | 96 | function serializeSession($data) |
97 | 97 | { |
98 | - if(!count($data)) return; |
|
98 | + if (!count($data)) return; |
|
99 | 99 | |
100 | 100 | $str = ''; |
101 | - foreach($data as $key => $val) $str .= $key.'|'.serialize($val); |
|
102 | - return substr($str, 0, strlen($str)-1).'}'; |
|
101 | + foreach ($data as $key => $val) $str .= $key.'|'.serialize($val); |
|
102 | + return substr($str, 0, strlen($str) - 1).'}'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $this->filename = $filename; |
100 | 100 | |
101 | 101 | $this->startTag = $startTag; |
102 | - if($endTag) $this->endTag = $endTag; |
|
102 | + if ($endTag) $this->endTag = $endTag; |
|
103 | 103 | $this->itemStartTag = $itemTag; |
104 | 104 | $this->itemEndTag = $itemEndTag; |
105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->cache_path = './files/cache/importer/'.$this->key; |
109 | 109 | $this->cache_index_file = $this->cache_path.'/index'; |
110 | 110 | |
111 | - if(!is_dir($this->cache_path)) FileHandler::makeDir($this->cache_path); |
|
111 | + if (!is_dir($this->cache_path)) FileHandler::makeDir($this->cache_path); |
|
112 | 112 | |
113 | 113 | return $this->openFile(); |
114 | 114 | } |
@@ -120,55 +120,55 @@ discard block |
||
120 | 120 | function openFile() |
121 | 121 | { |
122 | 122 | FileHandler::removeFile($this->cache_index_file); |
123 | - $this->index_fd = fopen($this->cache_index_file,"a"); |
|
123 | + $this->index_fd = fopen($this->cache_index_file, "a"); |
|
124 | 124 | // If local file |
125 | - if(strncasecmp('http://', $this->filename, 7) !== 0) |
|
125 | + if (strncasecmp('http://', $this->filename, 7) !== 0) |
|
126 | 126 | { |
127 | - if(!file_exists($this->filename)) return new BaseObject(-1,'msg_no_xml_file'); |
|
128 | - $this->fd = fopen($this->filename,"r"); |
|
127 | + if (!file_exists($this->filename)) return new BaseObject(-1, 'msg_no_xml_file'); |
|
128 | + $this->fd = fopen($this->filename, "r"); |
|
129 | 129 | // If remote file |
130 | 130 | } |
131 | 131 | else |
132 | 132 | { |
133 | 133 | $url_info = parse_url($this->filename); |
134 | - if(!$url_info['port']) $url_info['port'] = 80; |
|
135 | - if(!$url_info['path']) $url_info['path'] = '/'; |
|
134 | + if (!$url_info['port']) $url_info['port'] = 80; |
|
135 | + if (!$url_info['path']) $url_info['path'] = '/'; |
|
136 | 136 | |
137 | 137 | $this->fd = @fsockopen($url_info['host'], $url_info['port']); |
138 | - if(!$this->fd) return new BaseObject(-1,'msg_no_xml_file'); |
|
138 | + if (!$this->fd) return new BaseObject(-1, 'msg_no_xml_file'); |
|
139 | 139 | // If the file name contains Korean, do urlencode(iconv required) |
140 | 140 | $path = $url_info['path']; |
141 | - if(preg_match('/[\xEA-\xED][\x80-\xFF]{2}/', $path)&&function_exists('iconv')) |
|
141 | + if (preg_match('/[\xEA-\xED][\x80-\xFF]{2}/', $path) && function_exists('iconv')) |
|
142 | 142 | { |
143 | - $path_list = explode('/',$path); |
|
143 | + $path_list = explode('/', $path); |
|
144 | 144 | $cnt = count($path_list); |
145 | - $filename = $path_list[$cnt-1]; |
|
146 | - $filename = urlencode(iconv("UTF-8","EUC-KR",$filename)); |
|
147 | - $path_list[$cnt-1] = $filename; |
|
148 | - $path = implode('/',$path_list); |
|
145 | + $filename = $path_list[$cnt - 1]; |
|
146 | + $filename = urlencode(iconv("UTF-8", "EUC-KR", $filename)); |
|
147 | + $path_list[$cnt - 1] = $filename; |
|
148 | + $path = implode('/', $path_list); |
|
149 | 149 | $url_info['path'] = $path; |
150 | 150 | } |
151 | 151 | |
152 | 152 | $header = sprintf("GET %s?%s HTTP/1.0\r\nHost: %s\r\nReferer: %s://%s\r\nConnection: Close\r\n\r\n", $url_info['path'], $url_info['query'], $url_info['host'], $url_info['scheme'], $url_info['host']); |
153 | 153 | @fwrite($this->fd, $header); |
154 | 154 | $buff = ''; |
155 | - while(!feof($this->fd)) |
|
155 | + while (!feof($this->fd)) |
|
156 | 156 | { |
157 | 157 | $buff .= $str = fgets($this->fd, 1024); |
158 | - if(!trim($str)) break; |
|
158 | + if (!trim($str)) break; |
|
159 | 159 | } |
160 | - if(preg_match('/404 Not Found/i',$buff)) return new BaseObject(-1,'msg_no_xml_file'); |
|
160 | + if (preg_match('/404 Not Found/i', $buff)) return new BaseObject(-1, 'msg_no_xml_file'); |
|
161 | 161 | } |
162 | 162 | |
163 | - if($this->startTag) |
|
163 | + if ($this->startTag) |
|
164 | 164 | { |
165 | - while(!feof($this->fd)) |
|
165 | + while (!feof($this->fd)) |
|
166 | 166 | { |
167 | 167 | $str = fgets($this->fd, 1024); |
168 | 168 | $pos = strpos($str, $this->startTag); |
169 | - if($pos !== false) |
|
169 | + if ($pos !== false) |
|
170 | 170 | { |
171 | - $this->buff = substr($this->buff, $pos+strlen($this->startTag)); |
|
171 | + $this->buff = substr($this->buff, $pos + strlen($this->startTag)); |
|
172 | 172 | $this->isStarted = true; |
173 | 173 | $this->isFinished = false; |
174 | 174 | break; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | { |
209 | 209 | FileHandler::removeDir($this->cache_path.$this->key); |
210 | 210 | $this->index = 0; |
211 | - while(!$this->isFinished()) |
|
211 | + while (!$this->isFinished()) |
|
212 | 212 | { |
213 | 213 | $this->getItem(); |
214 | 214 | } |
@@ -224,14 +224,14 @@ discard block |
||
224 | 224 | |
225 | 225 | $filename = sprintf('%s/%s', $this->cache_path, $filename); |
226 | 226 | |
227 | - $index_fd = fopen($this->cache_index_file,"r"); |
|
228 | - $fd = fopen($filename,'w'); |
|
227 | + $index_fd = fopen($this->cache_index_file, "r"); |
|
228 | + $fd = fopen($filename, 'w'); |
|
229 | 229 | |
230 | 230 | fwrite($fd, '<items>'); |
231 | - while(!feof($index_fd)) |
|
231 | + while (!feof($index_fd)) |
|
232 | 232 | { |
233 | - $target_file = trim(fgets($index_fd,1024)); |
|
234 | - if(!file_exists($target_file)) continue; |
|
233 | + $target_file = trim(fgets($index_fd, 1024)); |
|
234 | + if (!file_exists($target_file)) continue; |
|
235 | 235 | $buff = FileHandler::readFile($target_file); |
236 | 236 | fwrite($fd, FileHandler::readFile($target_file)); |
237 | 237 | |
@@ -247,21 +247,21 @@ discard block |
||
247 | 247 | */ |
248 | 248 | function getItem() |
249 | 249 | { |
250 | - if($this->isFinished()) return; |
|
250 | + if ($this->isFinished()) return; |
|
251 | 251 | |
252 | - while(!feof($this->fd)) |
|
252 | + while (!feof($this->fd)) |
|
253 | 253 | { |
254 | 254 | $startPos = strpos($this->buff, $this->itemStartTag); |
255 | - if($startPos !== false) |
|
255 | + if ($startPos !== false) |
|
256 | 256 | { |
257 | 257 | $this->buff = substr($this->buff, $startPos); |
258 | - $this->buff = preg_replace("/\>/",">\r\n",$this->buff,1); |
|
258 | + $this->buff = preg_replace("/\>/", ">\r\n", $this->buff, 1); |
|
259 | 259 | break; |
260 | 260 | } |
261 | - elseif($this->endTag) |
|
261 | + elseif ($this->endTag) |
|
262 | 262 | { |
263 | 263 | $endPos = strpos($this->buff, $this->endTag); |
264 | - if($endPos !== false) |
|
264 | + if ($endPos !== false) |
|
265 | 265 | { |
266 | 266 | $this->closeFile(); |
267 | 267 | return; |
@@ -271,21 +271,21 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | $startPos = strpos($this->buff, $this->itemStartTag); |
274 | - if($startPos === false) |
|
274 | + if ($startPos === false) |
|
275 | 275 | { |
276 | 276 | $this->closeFile(); |
277 | 277 | return; |
278 | 278 | } |
279 | 279 | |
280 | - $filename = sprintf('%s/%s.xml',$this->cache_path, $this->index++); |
|
280 | + $filename = sprintf('%s/%s.xml', $this->cache_path, $this->index++); |
|
281 | 281 | fwrite($this->index_fd, $filename."\r\n"); |
282 | 282 | |
283 | - $fd = fopen($filename,'w'); |
|
283 | + $fd = fopen($filename, 'w'); |
|
284 | 284 | |
285 | - while(!feof($this->fd)) |
|
285 | + while (!feof($this->fd)) |
|
286 | 286 | { |
287 | 287 | $endPos = strpos($this->buff, $this->itemEndTag); |
288 | - if($endPos !== false) |
|
288 | + if ($endPos !== false) |
|
289 | 289 | { |
290 | 290 | $endPos += strlen($this->itemEndTag); |
291 | 291 | $buff = substr($this->buff, 0, $endPos); |
@@ -99,7 +99,9 @@ discard block |
||
99 | 99 | $this->filename = $filename; |
100 | 100 | |
101 | 101 | $this->startTag = $startTag; |
102 | - if($endTag) $this->endTag = $endTag; |
|
102 | + if($endTag) { |
|
103 | + $this->endTag = $endTag; |
|
104 | + } |
|
103 | 105 | $this->itemStartTag = $itemTag; |
104 | 106 | $this->itemEndTag = $itemEndTag; |
105 | 107 | |
@@ -108,7 +110,9 @@ discard block |
||
108 | 110 | $this->cache_path = './files/cache/importer/'.$this->key; |
109 | 111 | $this->cache_index_file = $this->cache_path.'/index'; |
110 | 112 | |
111 | - if(!is_dir($this->cache_path)) FileHandler::makeDir($this->cache_path); |
|
113 | + if(!is_dir($this->cache_path)) { |
|
114 | + FileHandler::makeDir($this->cache_path); |
|
115 | + } |
|
112 | 116 | |
113 | 117 | return $this->openFile(); |
114 | 118 | } |
@@ -124,18 +128,25 @@ discard block |
||
124 | 128 | // If local file |
125 | 129 | if(strncasecmp('http://', $this->filename, 7) !== 0) |
126 | 130 | { |
127 | - if(!file_exists($this->filename)) return new BaseObject(-1,'msg_no_xml_file'); |
|
131 | + if(!file_exists($this->filename)) { |
|
132 | + return new BaseObject(-1,'msg_no_xml_file'); |
|
133 | + } |
|
128 | 134 | $this->fd = fopen($this->filename,"r"); |
129 | 135 | // If remote file |
130 | - } |
|
131 | - else |
|
136 | + } else |
|
132 | 137 | { |
133 | 138 | $url_info = parse_url($this->filename); |
134 | - if(!$url_info['port']) $url_info['port'] = 80; |
|
135 | - if(!$url_info['path']) $url_info['path'] = '/'; |
|
139 | + if(!$url_info['port']) { |
|
140 | + $url_info['port'] = 80; |
|
141 | + } |
|
142 | + if(!$url_info['path']) { |
|
143 | + $url_info['path'] = '/'; |
|
144 | + } |
|
136 | 145 | |
137 | 146 | $this->fd = @fsockopen($url_info['host'], $url_info['port']); |
138 | - if(!$this->fd) return new BaseObject(-1,'msg_no_xml_file'); |
|
147 | + if(!$this->fd) { |
|
148 | + return new BaseObject(-1,'msg_no_xml_file'); |
|
149 | + } |
|
139 | 150 | // If the file name contains Korean, do urlencode(iconv required) |
140 | 151 | $path = $url_info['path']; |
141 | 152 | if(preg_match('/[\xEA-\xED][\x80-\xFF]{2}/', $path)&&function_exists('iconv')) |
@@ -155,9 +166,13 @@ discard block |
||
155 | 166 | while(!feof($this->fd)) |
156 | 167 | { |
157 | 168 | $buff .= $str = fgets($this->fd, 1024); |
158 | - if(!trim($str)) break; |
|
169 | + if(!trim($str)) { |
|
170 | + break; |
|
171 | + } |
|
172 | + } |
|
173 | + if(preg_match('/404 Not Found/i',$buff)) { |
|
174 | + return new BaseObject(-1,'msg_no_xml_file'); |
|
159 | 175 | } |
160 | - if(preg_match('/404 Not Found/i',$buff)) return new BaseObject(-1,'msg_no_xml_file'); |
|
161 | 176 | } |
162 | 177 | |
163 | 178 | if($this->startTag) |
@@ -174,8 +189,7 @@ discard block |
||
174 | 189 | break; |
175 | 190 | } |
176 | 191 | } |
177 | - } |
|
178 | - else |
|
192 | + } else |
|
179 | 193 | { |
180 | 194 | $this->isStarted = true; |
181 | 195 | $this->isFinished = false; |
@@ -231,7 +245,9 @@ discard block |
||
231 | 245 | while(!feof($index_fd)) |
232 | 246 | { |
233 | 247 | $target_file = trim(fgets($index_fd,1024)); |
234 | - if(!file_exists($target_file)) continue; |
|
248 | + if(!file_exists($target_file)) { |
|
249 | + continue; |
|
250 | + } |
|
235 | 251 | $buff = FileHandler::readFile($target_file); |
236 | 252 | fwrite($fd, FileHandler::readFile($target_file)); |
237 | 253 | |
@@ -247,7 +263,9 @@ discard block |
||
247 | 263 | */ |
248 | 264 | function getItem() |
249 | 265 | { |
250 | - if($this->isFinished()) return; |
|
266 | + if($this->isFinished()) { |
|
267 | + return; |
|
268 | + } |
|
251 | 269 | |
252 | 270 | while(!feof($this->fd)) |
253 | 271 | { |
@@ -257,8 +275,7 @@ discard block |
||
257 | 275 | $this->buff = substr($this->buff, $startPos); |
258 | 276 | $this->buff = preg_replace("/\>/",">\r\n",$this->buff,1); |
259 | 277 | break; |
260 | - } |
|
261 | - elseif($this->endTag) |
|
278 | + } elseif($this->endTag) |
|
262 | 279 | { |
263 | 280 | $endPos = strpos($this->buff, $this->endTag); |
264 | 281 | if($endPos !== false) |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | Context::set('module_srl',''); |
30 | 30 | $this->act = 'list'; |
31 | - } |
|
32 | - else |
|
31 | + } else |
|
33 | 32 | { |
34 | 33 | ModuleModel::syncModuleToSite($module_info); |
35 | 34 | $this->module_info = $module_info; |
@@ -62,7 +61,9 @@ discard block |
||
62 | 61 | $search_target_list = array('s_mid','s_browser_title'); |
63 | 62 | $search_target = Context::get('search_target'); |
64 | 63 | $search_keyword = Context::get('search_keyword'); |
65 | - if(in_array($search_target,$search_target_list) && $search_keyword) $args->{$search_target} = $search_keyword; |
|
64 | + if(in_array($search_target,$search_target_list) && $search_keyword) { |
|
65 | + $args->{$search_target} = $search_keyword; |
|
66 | + } |
|
66 | 67 | |
67 | 68 | $output = executeQuery('page.getPageList', $args); |
68 | 69 | $oModuleModel = getModel('module'); |
@@ -101,7 +102,9 @@ discard block |
||
101 | 102 | $module_srl = Context::get('module_srl'); |
102 | 103 | $module_info = Context::get('module_info'); |
103 | 104 | // If you do not value module_srl just showing the index page |
104 | - if(!$module_srl) return $this->dispPageAdminContent(); |
|
105 | + if(!$module_srl) { |
|
106 | + return $this->dispPageAdminContent(); |
|
107 | + } |
|
105 | 108 | // If the layout is destined to add layout information haejum (layout_title, layout) |
106 | 109 | if($module_info->layout_srl) |
107 | 110 | { |
@@ -183,8 +186,7 @@ discard block |
||
183 | 186 | $oPageMobile->module_info->mskin = $oModuleModel->getModuleDefaultSkin('page', 'M'); |
184 | 187 | } |
185 | 188 | $page_content = $oPageMobile->{$method}(); |
186 | - } |
|
187 | - else |
|
189 | + } else |
|
188 | 190 | { |
189 | 191 | return new BaseObject(-1, sprintf('%s method is not exists', $method)); |
190 | 192 | } |
@@ -202,8 +204,7 @@ discard block |
||
202 | 204 | if ($this->module_info->page_type == 'WIDGET') |
203 | 205 | { |
204 | 206 | $this->_setWidgetTypeContentModify(true); |
205 | - } |
|
206 | - else if ($this->module_info->page_type == 'ARTICLE') |
|
207 | + } else if ($this->module_info->page_type == 'ARTICLE') |
|
207 | 208 | { |
208 | 209 | $this->_setArticleTypeContentModify(true); |
209 | 210 | } |
@@ -220,8 +221,7 @@ discard block |
||
220 | 221 | if ($this->module_info->page_type == 'WIDGET') |
221 | 222 | { |
222 | 223 | $this->_setWidgetTypeContentModify(); |
223 | - } |
|
224 | - else if ($this->module_info->page_type == 'ARTICLE') |
|
224 | + } else if ($this->module_info->page_type == 'ARTICLE') |
|
225 | 225 | { |
226 | 226 | $this->_setArticleTypeContentModify(); |
227 | 227 | } |
@@ -233,13 +233,16 @@ discard block |
||
233 | 233 | if($isMobile) |
234 | 234 | { |
235 | 235 | $content = Context::get('mcontent'); |
236 | - if(!$content) $content = $this->module_info->mcontent; |
|
236 | + if(!$content) { |
|
237 | + $content = $this->module_info->mcontent; |
|
238 | + } |
|
237 | 239 | $templateFile = 'page_mobile_content_modify'; |
238 | - } |
|
239 | - else |
|
240 | + } else |
|
240 | 241 | { |
241 | 242 | $content = Context::get('content'); |
242 | - if(!$content) $content = $this->module_info->content; |
|
243 | + if(!$content) { |
|
244 | + $content = $this->module_info->content; |
|
245 | + } |
|
243 | 246 | $templateFile = 'page_content_modify'; |
244 | 247 | } |
245 | 248 | |
@@ -271,8 +274,7 @@ discard block |
||
271 | 274 | { |
272 | 275 | Context::set('isMobile', 'Y'); |
273 | 276 | $target = 'mdocument_srl'; |
274 | - } |
|
275 | - else |
|
277 | + } else |
|
276 | 278 | { |
277 | 279 | Context::set('isMobile', 'N'); |
278 | 280 | $target = 'document_srl'; |
@@ -283,14 +285,12 @@ discard block |
||
283 | 285 | $document_srl = $this->module_info->{$target}; |
284 | 286 | $oDocument->setDocument($document_srl); |
285 | 287 | Context::set('document_srl', $document_srl); |
286 | - } |
|
287 | - else if(Context::get('document_srl')) |
|
288 | + } else if(Context::get('document_srl')) |
|
288 | 289 | { |
289 | 290 | $document_srl = Context::get('document_srl'); |
290 | 291 | $oDocument->setDocument($document_srl); |
291 | 292 | Context::set('document_srl', $document_srl); |
292 | - } |
|
293 | - else |
|
293 | + } else |
|
294 | 294 | { |
295 | 295 | $oDocument->add('module_srl', $this->module_info->module_srl); |
296 | 296 | } |
@@ -307,7 +307,9 @@ discard block |
||
307 | 307 | function dispPageAdminDelete() |
308 | 308 | { |
309 | 309 | $module_srl = Context::get('module_srl'); |
310 | - if(!$module_srl) return $this->dispContent(); |
|
310 | + if(!$module_srl) { |
|
311 | + return $this->dispContent(); |
|
312 | + } |
|
311 | 313 | |
312 | 314 | $oModuleModel = getModel('module'); |
313 | 315 | $columnList = array('module_srl', 'module', 'mid'); |
@@ -22,18 +22,18 @@ discard block |
||
22 | 22 | // Get a template path (page in the administrative template tpl putting together) |
23 | 23 | $this->setTemplatePath($this->module_path.'tpl'); |
24 | 24 | |
25 | - switch($this->module_info->page_type) |
|
25 | + switch ($this->module_info->page_type) |
|
26 | 26 | { |
27 | 27 | case 'WIDGET' : |
28 | 28 | { |
29 | 29 | $this->cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus()); |
30 | - $this->interval = (int)($this->module_info->page_caching_interval); |
|
30 | + $this->interval = (int) ($this->module_info->page_caching_interval); |
|
31 | 31 | break; |
32 | 32 | } |
33 | 33 | case 'OUTSIDE' : |
34 | 34 | { |
35 | 35 | $this->cache_file = sprintf("%sfiles/cache/opage/%d.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getSslStatus()); |
36 | - $this->interval = (int)($this->module_info->page_caching_interval); |
|
36 | + $this->interval = (int) ($this->module_info->page_caching_interval); |
|
37 | 37 | $this->path = $this->module_info->path; |
38 | 38 | break; |
39 | 39 | } |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | function dispPageIndex() |
47 | 47 | { |
48 | 48 | // Variables used in the template Context:: set() |
49 | - if($this->module_srl) Context::set('module_srl',$this->module_srl); |
|
49 | + if ($this->module_srl) Context::set('module_srl', $this->module_srl); |
|
50 | 50 | |
51 | 51 | $page_type_name = strtolower($this->module_info->page_type); |
52 | - $method = '_get' . ucfirst($page_type_name) . 'Content'; |
|
53 | - if(method_exists($this, $method)) $page_content = $this->{$method}(); |
|
52 | + $method = '_get'.ucfirst($page_type_name).'Content'; |
|
53 | + if (method_exists($this, $method)) $page_content = $this->{$method}(); |
|
54 | 54 | else return new BaseObject(-1, sprintf('%s method is not exists', $method)); |
55 | 55 | |
56 | 56 | Context::set('module_info', $this->module_info); |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | |
62 | 62 | function _getWidgetContent() |
63 | 63 | { |
64 | - if($this->interval>0) |
|
64 | + if ($this->interval > 0) |
|
65 | 65 | { |
66 | - if(!file_exists($this->cache_file)) $mtime = 0; |
|
66 | + if (!file_exists($this->cache_file)) $mtime = 0; |
|
67 | 67 | else $mtime = filemtime($this->cache_file); |
68 | 68 | |
69 | - if($mtime + $this->interval*60 > $_SERVER['REQUEST_TIME']) |
|
69 | + if ($mtime + $this->interval * 60 > $_SERVER['REQUEST_TIME']) |
|
70 | 70 | { |
71 | 71 | $page_content = FileHandler::readFile($this->cache_file); |
72 | 72 | $page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | else |
82 | 82 | { |
83 | - if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file); |
|
83 | + if (file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file); |
|
84 | 84 | $page_content = $this->module_info->content; |
85 | 85 | } |
86 | 86 | return $page_content; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $oDocumentModel = getModel('document'); |
94 | 94 | $oDocument = $oDocumentModel->getDocument(0, true); |
95 | 95 | |
96 | - if($this->module_info->document_srl) |
|
96 | + if ($this->module_info->document_srl) |
|
97 | 97 | { |
98 | 98 | $document_srl = $this->module_info->document_srl; |
99 | 99 | $oDocument->setDocument($document_srl); |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | function _getOutsideContent() |
119 | 119 | { |
120 | 120 | // check if it is http or internal file |
121 | - if($this->path) |
|
121 | + if ($this->path) |
|
122 | 122 | { |
123 | - if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); |
|
123 | + if (preg_match("/^([a-z]+):\/\//i", $this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); |
|
124 | 124 | else $content = $this->executeFile($this->path, $this->interval, $this->cache_file); |
125 | 125 | } |
126 | 126 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | function getHtmlPage($path, $caching_interval, $cache_file) |
134 | 134 | { |
135 | 135 | // Verify cache |
136 | - if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > $_SERVER['REQUEST_TIME']) |
|
136 | + if ($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval * 60 > $_SERVER['REQUEST_TIME']) |
|
137 | 137 | { |
138 | 138 | $content = FileHandler::readFile($cache_file); |
139 | 139 | } |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | $content = $buff->content; |
155 | 155 | // Extract a title |
156 | 156 | $title = $oPageController->getTitle($content); |
157 | - if($title) Context::setBrowserTitle($title); |
|
157 | + if ($title) Context::setBrowserTitle($title); |
|
158 | 158 | // Extract header script |
159 | 159 | $head_script = $oPageController->getHeadScript($content); |
160 | - if($head_script) Context::addHtmlHeader($head_script); |
|
160 | + if ($head_script) Context::addHtmlHeader($head_script); |
|
161 | 161 | // Extract content from the body |
162 | 162 | $body_script = $oPageController->getBodyScript($content); |
163 | - if(!$body_script) $body_script = $content; |
|
163 | + if (!$body_script) $body_script = $content; |
|
164 | 164 | |
165 | 165 | return $content; |
166 | 166 | } |
@@ -171,32 +171,32 @@ discard block |
||
171 | 171 | function executeFile($target_file, $caching_interval, $cache_file) |
172 | 172 | { |
173 | 173 | // Cancel if the file doesn't exist |
174 | - if(!file_exists(FileHandler::getRealPath($target_file))) return; |
|
174 | + if (!file_exists(FileHandler::getRealPath($target_file))) return; |
|
175 | 175 | |
176 | 176 | // Get a path and filename |
177 | - $tmp_path = explode('/',$cache_file); |
|
178 | - $filename = $tmp_path[count($tmp_path)-1]; |
|
179 | - $filepath = preg_replace('/'.$filename."$/i","",$cache_file); |
|
177 | + $tmp_path = explode('/', $cache_file); |
|
178 | + $filename = $tmp_path[count($tmp_path) - 1]; |
|
179 | + $filepath = preg_replace('/'.$filename."$/i", "", $cache_file); |
|
180 | 180 | $cache_file = FileHandler::getRealPath($cache_file); |
181 | 181 | |
182 | 182 | $level = ob_get_level(); |
183 | 183 | // Verify cache |
184 | - if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file)<filemtime($target_file)) |
|
184 | + if ($caching_interval < 1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval * 60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file) < filemtime($target_file)) |
|
185 | 185 | { |
186 | - if(file_exists($cache_file)) FileHandler::removeFile($cache_file); |
|
186 | + if (file_exists($cache_file)) FileHandler::removeFile($cache_file); |
|
187 | 187 | |
188 | 188 | // Read a target file and get content |
189 | 189 | ob_start(); |
190 | 190 | include(FileHandler::getRealPath($target_file)); |
191 | 191 | $content = ob_get_clean(); |
192 | 192 | // Replace relative path to the absolute path |
193 | - $this->path = str_replace('\\', '/', realpath(dirname($target_file))) . '/'; |
|
194 | - $content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is',array($this,'_replacePath'),$content); |
|
195 | - $content = preg_replace_callback('/(<!--%import\()(\")([^"]+)(\")/is',array($this,'_replacePath'),$content); |
|
193 | + $this->path = str_replace('\\', '/', realpath(dirname($target_file))).'/'; |
|
194 | + $content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is', array($this, '_replacePath'), $content); |
|
195 | + $content = preg_replace_callback('/(<!--%import\()(\")([^"]+)(\")/is', array($this, '_replacePath'), $content); |
|
196 | 196 | |
197 | 197 | FileHandler::writeFile($cache_file, $content); |
198 | 198 | // Include and then Return the result |
199 | - if(!file_exists($cache_file)) return; |
|
199 | + if (!file_exists($cache_file)) return; |
|
200 | 200 | // Attempt to compile |
201 | 201 | $oTemplate = &TemplateHandler::getInstance(); |
202 | 202 | $script = $oTemplate->compileDirect($filepath, $filename); |
@@ -223,20 +223,20 @@ discard block |
||
223 | 223 | $val = trim($matches[3]); |
224 | 224 | // Pass if the path is external or starts with /, #, { characters |
225 | 225 | // /=absolute path, #=hash in a page, {=Template syntax |
226 | - if(strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i',$val)) |
|
226 | + if (strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i', $val)) |
|
227 | 227 | { |
228 | 228 | return $matches[0]; |
229 | 229 | // In case of .. , get a path |
230 | 230 | } |
231 | - else if(strncasecmp('..', $val, 2) === 0) |
|
231 | + else if (strncasecmp('..', $val, 2) === 0) |
|
232 | 232 | { |
233 | 233 | $p = Context::pathToUrl($this->path); |
234 | - return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); |
|
234 | + return sprintf("%s%s%s%s", $matches[1], $matches[2], $p.$val, $matches[4]); |
|
235 | 235 | } |
236 | 236 | |
237 | - if(strncasecmp('..', $val, 2) === 0) $val = substr($val,2); |
|
237 | + if (strncasecmp('..', $val, 2) === 0) $val = substr($val, 2); |
|
238 | 238 | $p = Context::pathToUrl($this->path); |
239 | - $path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); |
|
239 | + $path = sprintf("%s%s%s%s", $matches[1], $matches[2], $p.$val, $matches[4]); |
|
240 | 240 | |
241 | 241 | return $path; |
242 | 242 | } |
@@ -46,12 +46,17 @@ discard block |
||
46 | 46 | function dispPageIndex() |
47 | 47 | { |
48 | 48 | // Variables used in the template Context:: set() |
49 | - if($this->module_srl) Context::set('module_srl',$this->module_srl); |
|
49 | + if($this->module_srl) { |
|
50 | + Context::set('module_srl',$this->module_srl); |
|
51 | + } |
|
50 | 52 | |
51 | 53 | $page_type_name = strtolower($this->module_info->page_type); |
52 | 54 | $method = '_get' . ucfirst($page_type_name) . 'Content'; |
53 | - if(method_exists($this, $method)) $page_content = $this->{$method}(); |
|
54 | - else return new BaseObject(-1, sprintf('%s method is not exists', $method)); |
|
55 | + if(method_exists($this, $method)) { |
|
56 | + $page_content = $this->{$method}(); |
|
57 | + } else { |
|
58 | + return new BaseObject(-1, sprintf('%s method is not exists', $method)); |
|
59 | + } |
|
55 | 60 | |
56 | 61 | Context::set('module_info', $this->module_info); |
57 | 62 | Context::set('page_content', $page_content); |
@@ -63,24 +68,27 @@ discard block |
||
63 | 68 | { |
64 | 69 | if($this->interval>0) |
65 | 70 | { |
66 | - if(!file_exists($this->cache_file)) $mtime = 0; |
|
67 | - else $mtime = filemtime($this->cache_file); |
|
71 | + if(!file_exists($this->cache_file)) { |
|
72 | + $mtime = 0; |
|
73 | + } else { |
|
74 | + $mtime = filemtime($this->cache_file); |
|
75 | + } |
|
68 | 76 | |
69 | 77 | if($mtime + $this->interval*60 > $_SERVER['REQUEST_TIME']) |
70 | 78 | { |
71 | 79 | $page_content = FileHandler::readFile($this->cache_file); |
72 | 80 | $page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content); |
73 | - } |
|
74 | - else |
|
81 | + } else |
|
75 | 82 | { |
76 | 83 | $oWidgetController = getController('widget'); |
77 | 84 | $page_content = $oWidgetController->transWidgetCode($this->module_info->content); |
78 | 85 | FileHandler::writeFile($this->cache_file, $page_content); |
79 | 86 | } |
80 | - } |
|
81 | - else |
|
87 | + } else |
|
82 | 88 | { |
83 | - if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file); |
|
89 | + if(file_exists($this->cache_file)) { |
|
90 | + FileHandler::removeFile($this->cache_file); |
|
91 | + } |
|
84 | 92 | $page_content = $this->module_info->content; |
85 | 93 | } |
86 | 94 | return $page_content; |
@@ -104,8 +112,7 @@ discard block |
||
104 | 112 | if ($this->module_info->skin) |
105 | 113 | { |
106 | 114 | $templatePath = (sprintf($this->module_path.'skins/%s', $this->module_info->skin)); |
107 | - } |
|
108 | - else |
|
115 | + } else |
|
109 | 116 | { |
110 | 117 | $templatePath = ($this->module_path.'skins/default'); |
111 | 118 | } |
@@ -120,8 +127,11 @@ discard block |
||
120 | 127 | // check if it is http or internal file |
121 | 128 | if($this->path) |
122 | 129 | { |
123 | - if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); |
|
124 | - else $content = $this->executeFile($this->path, $this->interval, $this->cache_file); |
|
130 | + if(preg_match("/^([a-z]+):\/\//i",$this->path)) { |
|
131 | + $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); |
|
132 | + } else { |
|
133 | + $content = $this->executeFile($this->path, $this->interval, $this->cache_file); |
|
134 | + } |
|
125 | 135 | } |
126 | 136 | |
127 | 137 | return $content; |
@@ -136,8 +146,7 @@ discard block |
||
136 | 146 | if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > $_SERVER['REQUEST_TIME']) |
137 | 147 | { |
138 | 148 | $content = FileHandler::readFile($cache_file); |
139 | - } |
|
140 | - else |
|
149 | + } else |
|
141 | 150 | { |
142 | 151 | FileHandler::getRemoteFile($path, $cache_file); |
143 | 152 | $content = FileHandler::readFile($cache_file); |
@@ -154,13 +163,19 @@ discard block |
||
154 | 163 | $content = $buff->content; |
155 | 164 | // Extract a title |
156 | 165 | $title = $oPageController->getTitle($content); |
157 | - if($title) Context::setBrowserTitle($title); |
|
166 | + if($title) { |
|
167 | + Context::setBrowserTitle($title); |
|
168 | + } |
|
158 | 169 | // Extract header script |
159 | 170 | $head_script = $oPageController->getHeadScript($content); |
160 | - if($head_script) Context::addHtmlHeader($head_script); |
|
171 | + if($head_script) { |
|
172 | + Context::addHtmlHeader($head_script); |
|
173 | + } |
|
161 | 174 | // Extract content from the body |
162 | 175 | $body_script = $oPageController->getBodyScript($content); |
163 | - if(!$body_script) $body_script = $content; |
|
176 | + if(!$body_script) { |
|
177 | + $body_script = $content; |
|
178 | + } |
|
164 | 179 | |
165 | 180 | return $content; |
166 | 181 | } |
@@ -171,7 +186,9 @@ discard block |
||
171 | 186 | function executeFile($target_file, $caching_interval, $cache_file) |
172 | 187 | { |
173 | 188 | // Cancel if the file doesn't exist |
174 | - if(!file_exists(FileHandler::getRealPath($target_file))) return; |
|
189 | + if(!file_exists(FileHandler::getRealPath($target_file))) { |
|
190 | + return; |
|
191 | + } |
|
175 | 192 | |
176 | 193 | // Get a path and filename |
177 | 194 | $tmp_path = explode('/',$cache_file); |
@@ -183,7 +200,9 @@ discard block |
||
183 | 200 | // Verify cache |
184 | 201 | if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file)<filemtime($target_file)) |
185 | 202 | { |
186 | - if(file_exists($cache_file)) FileHandler::removeFile($cache_file); |
|
203 | + if(file_exists($cache_file)) { |
|
204 | + FileHandler::removeFile($cache_file); |
|
205 | + } |
|
187 | 206 | |
188 | 207 | // Read a target file and get content |
189 | 208 | ob_start(); |
@@ -196,7 +215,9 @@ discard block |
||
196 | 215 | |
197 | 216 | FileHandler::writeFile($cache_file, $content); |
198 | 217 | // Include and then Return the result |
199 | - if(!file_exists($cache_file)) return; |
|
218 | + if(!file_exists($cache_file)) { |
|
219 | + return; |
|
220 | + } |
|
200 | 221 | // Attempt to compile |
201 | 222 | $oTemplate = &TemplateHandler::getInstance(); |
202 | 223 | $script = $oTemplate->compileDirect($filepath, $filename); |
@@ -227,14 +248,15 @@ discard block |
||
227 | 248 | { |
228 | 249 | return $matches[0]; |
229 | 250 | // In case of .. , get a path |
230 | - } |
|
231 | - else if(strncasecmp('..', $val, 2) === 0) |
|
251 | + } else if(strncasecmp('..', $val, 2) === 0) |
|
232 | 252 | { |
233 | 253 | $p = Context::pathToUrl($this->path); |
234 | 254 | return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); |
235 | 255 | } |
236 | 256 | |
237 | - if(strncasecmp('..', $val, 2) === 0) $val = substr($val,2); |
|
257 | + if(strncasecmp('..', $val, 2) === 0) { |
|
258 | + $val = substr($val,2); |
|
259 | + } |
|
238 | 260 | $p = Context::pathToUrl($this->path); |
239 | 261 | $path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); |
240 | 262 |
@@ -25,24 +25,24 @@ discard block |
||
25 | 25 | // Set board module |
26 | 26 | $args = Context::getRequestVars(); |
27 | 27 | $args->module = 'page'; |
28 | - $args->mid = $args->page_name; //because if mid is empty in context, set start page mid |
|
28 | + $args->mid = $args->page_name; //because if mid is empty in context, set start page mid |
|
29 | 29 | $args->path = (!$args->path) ? '' : $args->path; |
30 | 30 | $args->mpath = (!$args->mpath) ? '' : $args->mpath; |
31 | 31 | unset($args->page_name); |
32 | 32 | |
33 | - if($args->use_mobile != 'Y') $args->use_mobile = ''; |
|
33 | + if ($args->use_mobile != 'Y') $args->use_mobile = ''; |
|
34 | 34 | // Check if an original module exists by using module_srl |
35 | - if($args->module_srl) |
|
35 | + if ($args->module_srl) |
|
36 | 36 | { |
37 | 37 | $columnList = array('module_srl'); |
38 | 38 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList); |
39 | - if($module_info->module_srl != $args->module_srl) |
|
39 | + if ($module_info->module_srl != $args->module_srl) |
|
40 | 40 | { |
41 | 41 | unset($args->module_srl); |
42 | 42 | } |
43 | 43 | else |
44 | 44 | { |
45 | - foreach($args as $key=>$val) |
|
45 | + foreach ($args as $key=>$val) |
|
46 | 46 | { |
47 | 47 | $module_info->{$key} = $val; |
48 | 48 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | } |
77 | 77 | // Insert/update depending on module_srl |
78 | - if(!$args->module_srl) |
|
78 | + if (!$args->module_srl) |
|
79 | 79 | { |
80 | 80 | $output = $oModuleController->insertModule($args); |
81 | 81 | $msg_code = 'success_registed'; |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | $msg_code = 'success_updated'; |
87 | 87 | } |
88 | 88 | |
89 | - if(!$output->toBool()) return $output; |
|
89 | + if (!$output->toBool()) return $output; |
|
90 | 90 | |
91 | 91 | $this->add("page", Context::get('page')); |
92 | - $this->add('module_srl',$output->get('module_srl')); |
|
92 | + $this->add('module_srl', $output->get('module_srl')); |
|
93 | 93 | $this->setMessage($msg_code); |
94 | 94 | |
95 | 95 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'module_srl', $output->get('module_srl'), 'act', 'dispPageAdminInfo'); |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | |
107 | 107 | function putDocumentsInPageToArray($target, &$array) |
108 | 108 | { |
109 | - if(!$target) return; |
|
109 | + if (!$target) return; |
|
110 | 110 | preg_match_all('!<img hasContent="true" ([^>]+)!is', $target, $matches); |
111 | 111 | $pattern = '!document_srl="(\d+)"!'; |
112 | - foreach($matches[1] as $match) |
|
112 | + foreach ($matches[1] as $match) |
|
113 | 113 | { |
114 | 114 | $match2 = null; |
115 | 115 | preg_match($pattern, $match, $match2); |
116 | - if(count($match2)) |
|
116 | + if (count($match2)) |
|
117 | 117 | { |
118 | - $array[(int)$match2[1]] = 1; |
|
118 | + $array[(int) $match2[1]] = 1; |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -127,20 +127,20 @@ discard block |
||
127 | 127 | { |
128 | 128 | $module_srl = Context::get('module_srl'); |
129 | 129 | $content = Context::get('content'); |
130 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
130 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
131 | 131 | $mcontent = Context::get('mcontent'); |
132 | 132 | $type = Context::get('type'); |
133 | 133 | // Guhaeom won information page |
134 | 134 | $oModuleModel = getModel('module'); |
135 | 135 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
136 | - if($type == "mobile") |
|
136 | + if ($type == "mobile") |
|
137 | 137 | { |
138 | - if(!$mcontent) $mcontent = ''; |
|
138 | + if (!$mcontent) $mcontent = ''; |
|
139 | 139 | $module_info->mcontent = $mcontent; |
140 | 140 | } |
141 | 141 | else |
142 | 142 | { |
143 | - if(!isset($content)) $content =''; |
|
143 | + if (!isset($content)) $content = ''; |
|
144 | 144 | $module_info->content = $content; |
145 | 145 | } |
146 | 146 | |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | $obj->module_srl = $module_srl; |
155 | 155 | $obj->list_count = 99999999; |
156 | 156 | $output = $oDocumentModel->getDocumentList($obj); |
157 | - if(count($output->data)) |
|
157 | + if (count($output->data)) |
|
158 | 158 | { |
159 | - foreach($output->data as $document) |
|
159 | + foreach ($output->data as $document) |
|
160 | 160 | { |
161 | - if($document_srls[$document->document_srl]) continue; |
|
161 | + if ($document_srls[$document->document_srl]) continue; |
|
162 | 162 | $oDocumentController->deleteDocument($document->document_srl, true); |
163 | 163 | } |
164 | 164 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $oModuleController = getController('module'); |
167 | 167 | // Save |
168 | 168 | $output = $oModuleController->updateModule($module_info); |
169 | - if(!$output->toBool()) return $output; |
|
169 | + if (!$output->toBool()) return $output; |
|
170 | 170 | // On the page, change the validity status of the attached file |
171 | 171 | $oFileController = getController('file'); |
172 | 172 | $oFileController->setFilesValid($module_info->module_srl); |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | // Get an original |
190 | 190 | $oModuleController = getController('module'); |
191 | 191 | $output = $oModuleController->deleteModule($module_srl); |
192 | - if(!$output->toBool()) return $output; |
|
192 | + if (!$output->toBool()) return $output; |
|
193 | 193 | |
194 | - $this->add('module','page'); |
|
195 | - $this->add('page',Context::get('page')); |
|
194 | + $this->add('module', 'page'); |
|
195 | + $this->add('page', Context::get('page')); |
|
196 | 196 | $this->setMessage('success_deleted'); |
197 | 197 | |
198 | 198 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPageAdminContent'); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $args = Context::getRequestVars(); |
209 | 209 | // Insert by creating the module Controller object |
210 | 210 | $oModuleController = getController('module'); |
211 | - $output = $oModuleController->insertModuleConfig('page',$args); |
|
211 | + $output = $oModuleController->insertModuleConfig('page', $args); |
|
212 | 212 | return $output; |
213 | 213 | } |
214 | 214 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $file_srl = Context::get('file_srl'); |
240 | 240 | // Create the controller object file class |
241 | 241 | $oFileController = getController('file'); |
242 | - if($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager); |
|
242 | + if ($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager); |
|
243 | 243 | // Attachment to the output of the list, java script |
244 | 244 | $oFileController->printUploadedFileList($upload_target_srl); |
245 | 245 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | { |
252 | 252 | $module_srl = Context::get('module_srl'); |
253 | 253 | |
254 | - if(!$module_srl) return; |
|
254 | + if (!$module_srl) return; |
|
255 | 255 | |
256 | 256 | $oModuleModel = getModel('module'); |
257 | 257 | $columnList = array('module_srl', 'content'); |
@@ -263,29 +263,29 @@ discard block |
||
263 | 263 | $oWidgetController = getController('widget'); |
264 | 264 | $oWidgetController->recompileWidget($content); |
265 | 265 | |
266 | - if($module_info->page_type == 'WIDGET') |
|
266 | + if ($module_info->page_type == 'WIDGET') |
|
267 | 267 | { |
268 | - $path = _XE_PATH_ . 'files/cache/page/'; |
|
269 | - $cache_files = FileHandler::readDir($path, '/^' . $module_info->module_srl . '\./'); |
|
270 | - foreach($cache_files as $file_name) |
|
268 | + $path = _XE_PATH_.'files/cache/page/'; |
|
269 | + $cache_files = FileHandler::readDir($path, '/^'.$module_info->module_srl.'\./'); |
|
270 | + foreach ($cache_files as $file_name) |
|
271 | 271 | { |
272 | - FileHandler::removeFile($path . $module_info->module_srl . '.' . $file_name); |
|
272 | + FileHandler::removeFile($path.$module_info->module_srl.'.'.$file_name); |
|
273 | 273 | } |
274 | 274 | } |
275 | - else if($module_info->page_type == 'OUTSIDE') |
|
275 | + else if ($module_info->page_type == 'OUTSIDE') |
|
276 | 276 | { |
277 | - $path = _XE_PATH_ . 'files/cache/page/'; |
|
278 | - $cache_files = FileHandler::readDir($path, '/^' . $module_info->module_srl . './'); |
|
279 | - foreach($cache_files as $file_name) |
|
277 | + $path = _XE_PATH_.'files/cache/page/'; |
|
278 | + $cache_files = FileHandler::readDir($path, '/^'.$module_info->module_srl.'./'); |
|
279 | + foreach ($cache_files as $file_name) |
|
280 | 280 | { |
281 | - FileHandler::removeFile($path . $module_info->module_srl . '.' . $file_name); |
|
281 | + FileHandler::removeFile($path.$module_info->module_srl.'.'.$file_name); |
|
282 | 282 | } |
283 | 283 | } |
284 | 284 | |
285 | 285 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
286 | - if($oCacheHandler->isSupport()) |
|
286 | + if ($oCacheHandler->isSupport()) |
|
287 | 287 | { |
288 | - $object_key = 'mid_info:' . $module_info->module_srl; |
|
288 | + $object_key = 'mid_info:'.$module_info->module_srl; |
|
289 | 289 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
290 | 290 | $oCacheHandler->delete($cache_key); |
291 | 291 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $oModuleModel = getModel('module'); |
302 | 302 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
303 | 303 | |
304 | - if(!$grant->manager) |
|
304 | + if (!$grant->manager) |
|
305 | 305 | { |
306 | 306 | return new BaseObject(-1, 'msg_not_permitted'); |
307 | 307 | } |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | $obj->is_notice = 'N'; |
312 | 312 | |
313 | 313 | settype($obj->title, "string"); |
314 | - if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...'); |
|
314 | + if ($obj->title == '') $obj->title = cut_str(strip_tags($obj->content), 20, '...'); |
|
315 | 315 | //그래도 없으면 Untitled |
316 | - if($obj->title == '') $obj->title = 'Untitled'; |
|
316 | + if ($obj->title == '') $obj->title = 'Untitled'; |
|
317 | 317 | |
318 | 318 | $document_srl = $obj->document_srl; |
319 | 319 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $target = ($obj->ismobile == 'Y') ? 'mdocument_srl' : 'document_srl'; |
325 | 325 | |
326 | 326 | // 이미 존재하는 경우 수정 |
327 | - if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
327 | + if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
328 | 328 | { |
329 | 329 | $output = $oDocumentController->updateDocument($oDocument, $obj); |
330 | 330 | $msg_code = 'success_updated'; |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $document_srl = $output->get('document_srl'); |
338 | 338 | } |
339 | 339 | |
340 | - if(!isset($this->module_info->{$target}) || (isset($this->module_info->{$target}) && $this->module_info->{$target} !== $document_srl)) |
|
340 | + if (!isset($this->module_info->{$target}) || (isset($this->module_info->{$target}) && $this->module_info->{$target} !== $document_srl)) |
|
341 | 341 | { |
342 | 342 | $oModuleController = getController('module'); |
343 | 343 | $this->module_info->{$target} = $document_srl; |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | } |
346 | 346 | |
347 | 347 | // 오류 발생시 멈춤 |
348 | - if(!$output->toBool()) return $output; |
|
348 | + if (!$output->toBool()) return $output; |
|
349 | 349 | |
350 | 350 | // 결과를 리턴 |
351 | 351 | $this->add('mid', Context::get('mid')); |
@@ -30,7 +30,9 @@ discard block |
||
30 | 30 | $args->mpath = (!$args->mpath) ? '' : $args->mpath; |
31 | 31 | unset($args->page_name); |
32 | 32 | |
33 | - if($args->use_mobile != 'Y') $args->use_mobile = ''; |
|
33 | + if($args->use_mobile != 'Y') { |
|
34 | + $args->use_mobile = ''; |
|
35 | + } |
|
34 | 36 | // Check if an original module exists by using module_srl |
35 | 37 | if($args->module_srl) |
36 | 38 | { |
@@ -39,8 +41,7 @@ discard block |
||
39 | 41 | if($module_info->module_srl != $args->module_srl) |
40 | 42 | { |
41 | 43 | unset($args->module_srl); |
42 | - } |
|
43 | - else |
|
44 | + } else |
|
44 | 45 | { |
45 | 46 | foreach($args as $key=>$val) |
46 | 47 | { |
@@ -79,14 +80,15 @@ discard block |
||
79 | 80 | { |
80 | 81 | $output = $oModuleController->insertModule($args); |
81 | 82 | $msg_code = 'success_registed'; |
82 | - } |
|
83 | - else |
|
83 | + } else |
|
84 | 84 | { |
85 | 85 | $output = $oModuleController->updateModule($args); |
86 | 86 | $msg_code = 'success_updated'; |
87 | 87 | } |
88 | 88 | |
89 | - if(!$output->toBool()) return $output; |
|
89 | + if(!$output->toBool()) { |
|
90 | + return $output; |
|
91 | + } |
|
90 | 92 | |
91 | 93 | $this->add("page", Context::get('page')); |
92 | 94 | $this->add('module_srl',$output->get('module_srl')); |
@@ -106,7 +108,9 @@ discard block |
||
106 | 108 | |
107 | 109 | function putDocumentsInPageToArray($target, &$array) |
108 | 110 | { |
109 | - if(!$target) return; |
|
111 | + if(!$target) { |
|
112 | + return; |
|
113 | + } |
|
110 | 114 | preg_match_all('!<img hasContent="true" ([^>]+)!is', $target, $matches); |
111 | 115 | $pattern = '!document_srl="(\d+)"!'; |
112 | 116 | foreach($matches[1] as $match) |
@@ -127,7 +131,9 @@ discard block |
||
127 | 131 | { |
128 | 132 | $module_srl = Context::get('module_srl'); |
129 | 133 | $content = Context::get('content'); |
130 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
134 | + if(!$module_srl) { |
|
135 | + return new BaseObject(-1,'msg_invalid_request'); |
|
136 | + } |
|
131 | 137 | $mcontent = Context::get('mcontent'); |
132 | 138 | $type = Context::get('type'); |
133 | 139 | // Guhaeom won information page |
@@ -135,12 +141,15 @@ discard block |
||
135 | 141 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
136 | 142 | if($type == "mobile") |
137 | 143 | { |
138 | - if(!$mcontent) $mcontent = ''; |
|
144 | + if(!$mcontent) { |
|
145 | + $mcontent = ''; |
|
146 | + } |
|
139 | 147 | $module_info->mcontent = $mcontent; |
140 | - } |
|
141 | - else |
|
148 | + } else |
|
142 | 149 | { |
143 | - if(!isset($content)) $content =''; |
|
150 | + if(!isset($content)) { |
|
151 | + $content =''; |
|
152 | + } |
|
144 | 153 | $module_info->content = $content; |
145 | 154 | } |
146 | 155 | |
@@ -158,7 +167,9 @@ discard block |
||
158 | 167 | { |
159 | 168 | foreach($output->data as $document) |
160 | 169 | { |
161 | - if($document_srls[$document->document_srl]) continue; |
|
170 | + if($document_srls[$document->document_srl]) { |
|
171 | + continue; |
|
172 | + } |
|
162 | 173 | $oDocumentController->deleteDocument($document->document_srl, true); |
163 | 174 | } |
164 | 175 | } |
@@ -166,7 +177,9 @@ discard block |
||
166 | 177 | $oModuleController = getController('module'); |
167 | 178 | // Save |
168 | 179 | $output = $oModuleController->updateModule($module_info); |
169 | - if(!$output->toBool()) return $output; |
|
180 | + if(!$output->toBool()) { |
|
181 | + return $output; |
|
182 | + } |
|
170 | 183 | // On the page, change the validity status of the attached file |
171 | 184 | $oFileController = getController('file'); |
172 | 185 | $oFileController->setFilesValid($module_info->module_srl); |
@@ -189,7 +202,9 @@ discard block |
||
189 | 202 | // Get an original |
190 | 203 | $oModuleController = getController('module'); |
191 | 204 | $output = $oModuleController->deleteModule($module_srl); |
192 | - if(!$output->toBool()) return $output; |
|
205 | + if(!$output->toBool()) { |
|
206 | + return $output; |
|
207 | + } |
|
193 | 208 | |
194 | 209 | $this->add('module','page'); |
195 | 210 | $this->add('page',Context::get('page')); |
@@ -239,7 +254,9 @@ discard block |
||
239 | 254 | $file_srl = Context::get('file_srl'); |
240 | 255 | // Create the controller object file class |
241 | 256 | $oFileController = getController('file'); |
242 | - if($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager); |
|
257 | + if($file_srl) { |
|
258 | + $output = $oFileController->deleteFile($file_srl, $this->grant->manager); |
|
259 | + } |
|
243 | 260 | // Attachment to the output of the list, java script |
244 | 261 | $oFileController->printUploadedFileList($upload_target_srl); |
245 | 262 | } |
@@ -251,7 +268,9 @@ discard block |
||
251 | 268 | { |
252 | 269 | $module_srl = Context::get('module_srl'); |
253 | 270 | |
254 | - if(!$module_srl) return; |
|
271 | + if(!$module_srl) { |
|
272 | + return; |
|
273 | + } |
|
255 | 274 | |
256 | 275 | $oModuleModel = getModel('module'); |
257 | 276 | $columnList = array('module_srl', 'content'); |
@@ -271,8 +290,7 @@ discard block |
||
271 | 290 | { |
272 | 291 | FileHandler::removeFile($path . $module_info->module_srl . '.' . $file_name); |
273 | 292 | } |
274 | - } |
|
275 | - else if($module_info->page_type == 'OUTSIDE') |
|
293 | + } else if($module_info->page_type == 'OUTSIDE') |
|
276 | 294 | { |
277 | 295 | $path = _XE_PATH_ . 'files/cache/page/'; |
278 | 296 | $cache_files = FileHandler::readDir($path, '/^' . $module_info->module_srl . './'); |
@@ -311,9 +329,13 @@ discard block |
||
311 | 329 | $obj->is_notice = 'N'; |
312 | 330 | |
313 | 331 | settype($obj->title, "string"); |
314 | - if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...'); |
|
332 | + if($obj->title == '') { |
|
333 | + $obj->title = cut_str(strip_tags($obj->content),20,'...'); |
|
334 | + } |
|
315 | 335 | //그래도 없으면 Untitled |
316 | - if($obj->title == '') $obj->title = 'Untitled'; |
|
336 | + if($obj->title == '') { |
|
337 | + $obj->title = 'Untitled'; |
|
338 | + } |
|
317 | 339 | |
318 | 340 | $document_srl = $obj->document_srl; |
319 | 341 | |
@@ -328,8 +350,7 @@ discard block |
||
328 | 350 | { |
329 | 351 | $output = $oDocumentController->updateDocument($oDocument, $obj); |
330 | 352 | $msg_code = 'success_updated'; |
331 | - } |
|
332 | - else |
|
353 | + } else |
|
333 | 354 | { |
334 | 355 | // 그렇지 않으면 신규 등록 |
335 | 356 | $output = $oDocumentController->insertDocument($obj, $bAnonymous); |
@@ -345,7 +366,9 @@ discard block |
||
345 | 366 | } |
346 | 367 | |
347 | 368 | // 오류 발생시 멈춤 |
348 | - if(!$output->toBool()) return $output; |
|
369 | + if(!$output->toBool()) { |
|
370 | + return $output; |
|
371 | + } |
|
349 | 372 | |
350 | 373 | // 결과를 리턴 |
351 | 374 | $this->add('mid', Context::get('mid')); |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | $oModuleModel = getModel('module'); |
27 | 27 | $oModuleController = getController('module'); |
28 | 28 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
29 | - if($oModuleModel->needUpdate($version_update_id)) |
|
29 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
30 | 30 | { |
31 | 31 | $output = executeQuery('page.pageTypeOpageCheck'); |
32 | - if($output->toBool() && $output->data) return true; |
|
32 | + if ($output->toBool() && $output->data) return true; |
|
33 | 33 | |
34 | 34 | $output = executeQuery('page.pageTypeNullCheck'); |
35 | - if($output->toBool() && $output->data) return true; |
|
35 | + if ($output->toBool() && $output->data) return true; |
|
36 | 36 | |
37 | 37 | $oModuleController->insertUpdatedLog($version_update_id); |
38 | 38 | } |
@@ -48,44 +48,44 @@ discard block |
||
48 | 48 | $oModuleModel = getModel('module'); |
49 | 49 | $oModuleController = getController('module'); |
50 | 50 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
51 | - if($oModuleModel->needUpdate($version_update_id)) |
|
51 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
52 | 52 | { |
53 | 53 | $args = new stdClass; |
54 | 54 | // opage module instance update |
55 | 55 | $output = executeQueryArray('page.pageTypeOpageCheck'); |
56 | - if($output->toBool() && count($output->data) > 0) |
|
56 | + if ($output->toBool() && count($output->data) > 0) |
|
57 | 57 | { |
58 | - foreach($output->data as $val) |
|
58 | + foreach ($output->data as $val) |
|
59 | 59 | { |
60 | 60 | $args->module_srl = $val->module_srl; |
61 | 61 | $args->name = 'page_type'; |
62 | - $args->value= 'OUTSIDE'; |
|
62 | + $args->value = 'OUTSIDE'; |
|
63 | 63 | $in_out = executeQuery('page.insertPageType', $args); |
64 | 64 | } |
65 | 65 | $output = executeQuery('page.updateAllOpage'); |
66 | - if(!$output->toBool()) return $output; |
|
66 | + if (!$output->toBool()) return $output; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | // old page module instance update |
70 | 70 | $output = executeQueryArray('page.pageTypeNullCheck'); |
71 | 71 | $skin_update_srls = array(); |
72 | - if($output->toBool() && $output->data) |
|
72 | + if ($output->toBool() && $output->data) |
|
73 | 73 | { |
74 | - foreach($output->data as $val) |
|
74 | + foreach ($output->data as $val) |
|
75 | 75 | { |
76 | 76 | $args->module_srl = $val->module_srl; |
77 | 77 | $args->name = 'page_type'; |
78 | - $args->value= 'WIDGET'; |
|
78 | + $args->value = 'WIDGET'; |
|
79 | 79 | $in_out = executeQuery('page.insertPageType', $args); |
80 | 80 | |
81 | 81 | $skin_update_srls[] = $val->module_srl; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | - if(count($skin_update_srls)>0) |
|
85 | + if (count($skin_update_srls) > 0) |
|
86 | 86 | { |
87 | 87 | $skin_args = new stdClass; |
88 | - $skin_args->module_srls = implode(',',$skin_update_srls); |
|
88 | + $skin_args->module_srls = implode(',', $skin_update_srls); |
|
89 | 89 | $skin_args->is_skin_fix = "Y"; |
90 | 90 | $ouput = executeQuery('page.updateSkinFix', $skin_args); |
91 | 91 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $oModuleController->insertUpdatedLog($version_update_id); |
94 | 94 | } |
95 | 95 | |
96 | - return new BaseObject(0,'success_updated'); |
|
96 | + return new BaseObject(0, 'success_updated'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |