@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @file config/config.inc.php |
8 | 8 | * @author NAVER ([email protected]) |
9 | 9 | */ |
10 | -if(version_compare(PHP_VERSION, '5.4.0', '<')) |
|
10 | +if (version_compare(PHP_VERSION, '5.4.0', '<')) |
|
11 | 11 | { |
12 | 12 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING); |
13 | 13 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING ^ E_STRICT); |
17 | 17 | } |
18 | 18 | |
19 | -if(!defined('__XE__')) |
|
19 | +if (!defined('__XE__')) |
|
20 | 20 | { |
21 | 21 | exit(); |
22 | 22 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | ini_set('session.use_only_cookies', 0); |
54 | 54 | |
55 | 55 | |
56 | -if(file_exists(_XE_PATH_ . 'config/package.inc.php')) |
|
56 | +if (file_exists(_XE_PATH_.'config/package.inc.php')) |
|
57 | 57 | { |
58 | - require _XE_PATH_ . 'config/package.inc.php'; |
|
58 | + require _XE_PATH_.'config/package.inc.php'; |
|
59 | 59 | } |
60 | 60 | else |
61 | 61 | { |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | * define('__ENABLE_PHPUNIT_TEST__', 0); |
98 | 98 | * define('__PROXY_SERVER__', 'http://domain:port/path'); |
99 | 99 | */ |
100 | -if(file_exists(_XE_PATH_ . 'config/config.user.inc.php')) |
|
100 | +if (file_exists(_XE_PATH_.'config/config.user.inc.php')) |
|
101 | 101 | { |
102 | - require _XE_PATH_ . 'config/config.user.inc.php'; |
|
102 | + require _XE_PATH_.'config/config.user.inc.php'; |
|
103 | 103 | } |
104 | 104 | |
105 | -if(!defined('__DEBUG__')) |
|
105 | +if (!defined('__DEBUG__')) |
|
106 | 106 | { |
107 | 107 | /** |
108 | 108 | * output debug message(bit value) |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | define('__DEBUG__', 0); |
118 | 118 | } |
119 | 119 | |
120 | -if(!defined('__DEBUG_OUTPUT__')) |
|
120 | +if (!defined('__DEBUG_OUTPUT__')) |
|
121 | 121 | { |
122 | 122 | /** |
123 | 123 | * output location of debug message |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | define('__DEBUG_OUTPUT__', 0); |
132 | 132 | } |
133 | 133 | |
134 | -if(!defined('__DEBUG_PROTECT__')) |
|
134 | +if (!defined('__DEBUG_PROTECT__')) |
|
135 | 135 | { |
136 | 136 | /** |
137 | 137 | * output comments of the firePHP console and browser |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | define('__DEBUG_PROTECT__', 1); |
145 | 145 | } |
146 | 146 | |
147 | -if(!defined('__DEBUG_PROTECT_IP__')) |
|
147 | +if (!defined('__DEBUG_PROTECT_IP__')) |
|
148 | 148 | { |
149 | 149 | /** |
150 | 150 | * Set a ip address to allow debug |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | define('__DEBUG_PROTECT_IP__', '127.0.0.1'); |
153 | 153 | } |
154 | 154 | |
155 | -if(!defined('__DEBUG_DB_OUTPUT__')) |
|
155 | +if (!defined('__DEBUG_DB_OUTPUT__')) |
|
156 | 156 | { |
157 | 157 | /** |
158 | 158 | * DB error message definition |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | define('__DEBUG_DB_OUTPUT__', 0); |
166 | 166 | } |
167 | 167 | |
168 | -if(!defined('__LOG_SLOW_QUERY__')) |
|
168 | +if (!defined('__LOG_SLOW_QUERY__')) |
|
169 | 169 | { |
170 | 170 | /** |
171 | 171 | * Query log for only timeout query among DB queries |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | define('__LOG_SLOW_QUERY__', 0); |
180 | 180 | } |
181 | 181 | |
182 | -if(!defined('__LOG_SLOW_TRIGGER__')) |
|
182 | +if (!defined('__LOG_SLOW_TRIGGER__')) |
|
183 | 183 | { |
184 | 184 | /** |
185 | 185 | * Trigger excute time log |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | define('__LOG_SLOW_TRIGGER__', 0); |
194 | 194 | } |
195 | 195 | |
196 | -if(!defined('__LOG_SLOW_ADDON__')) |
|
196 | +if (!defined('__LOG_SLOW_ADDON__')) |
|
197 | 197 | { |
198 | 198 | /** |
199 | 199 | * Addon excute time log |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | define('__LOG_SLOW_ADDON__', 0); |
208 | 208 | } |
209 | 209 | |
210 | -if(!defined('__LOG_SLOW_WIDGET__')) |
|
210 | +if (!defined('__LOG_SLOW_WIDGET__')) |
|
211 | 211 | { |
212 | 212 | /** |
213 | 213 | * Widget excute time log |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | define('__LOG_SLOW_WIDGET__', 0); |
222 | 222 | } |
223 | 223 | |
224 | -if(!defined('__DEBUG_QUERY__')) |
|
224 | +if (!defined('__DEBUG_QUERY__')) |
|
225 | 225 | { |
226 | 226 | /** |
227 | 227 | * Leave DB query information |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | define('__DEBUG_QUERY__', 0); |
235 | 235 | } |
236 | 236 | |
237 | -if(!defined('__OB_GZHANDLER_ENABLE__')) |
|
237 | +if (!defined('__OB_GZHANDLER_ENABLE__')) |
|
238 | 238 | { |
239 | 239 | /** |
240 | 240 | * option to enable/disable a compression feature using ob_gzhandler |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | define('__OB_GZHANDLER_ENABLE__', 1); |
249 | 249 | } |
250 | 250 | |
251 | -if(!defined('__ENABLE_PHPUNIT_TEST__')) |
|
251 | +if (!defined('__ENABLE_PHPUNIT_TEST__')) |
|
252 | 252 | { |
253 | 253 | /** |
254 | 254 | * decide to use/not use the php unit test (Path/tests/index.php) |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | define('__ENABLE_PHPUNIT_TEST__', 0); |
262 | 262 | } |
263 | 263 | |
264 | -if(!defined('__PROXY_SERVER__')) |
|
264 | +if (!defined('__PROXY_SERVER__')) |
|
265 | 265 | { |
266 | 266 | /** |
267 | 267 | * __PROXY_SERVER__ has server information to request to the external through the target server |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | define('__PROXY_SERVER__', NULL); |
271 | 271 | } |
272 | 272 | |
273 | -if(!defined('__ERROR_LOG__')) |
|
273 | +if (!defined('__ERROR_LOG__')) |
|
274 | 274 | { |
275 | 275 | /** |
276 | 276 | * __ERROR_LOG__ 는 PHP의 에러로그를 출력하는 기능입니다. 개발시 워닝에러이상의 에러부터 잡기 시작합니다. |
@@ -282,25 +282,25 @@ discard block |
||
282 | 282 | } |
283 | 283 | |
284 | 284 | // Require specific files when using Firebug console output |
285 | -if((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
285 | +if ((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
286 | 286 | { |
287 | - require _XE_PATH_ . 'libs/FirePHPCore/FirePHP.class.php'; |
|
287 | + require _XE_PATH_.'libs/FirePHPCore/FirePHP.class.php'; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | // Set Timezone as server time |
291 | -if(version_compare(PHP_VERSION, '5.3.0') >= 0) |
|
291 | +if (version_compare(PHP_VERSION, '5.3.0') >= 0) |
|
292 | 292 | { |
293 | 293 | date_default_timezone_set(@date_default_timezone_get()); |
294 | 294 | } |
295 | 295 | |
296 | 296 | // Require a function-defined-file for simple use |
297 | -require(_XE_PATH_ . 'config/func.inc.php'); |
|
297 | +require(_XE_PATH_.'config/func.inc.php'); |
|
298 | 298 | |
299 | -if(__DEBUG__) { |
|
299 | +if (__DEBUG__) { |
|
300 | 300 | define('__StartTime__', getMicroTime()); |
301 | 301 | } |
302 | 302 | |
303 | -if(__DEBUG__) { |
|
303 | +if (__DEBUG__) { |
|
304 | 304 | $GLOBALS['__elapsed_class_load__'] = 0; |
305 | 305 | } |
306 | 306 | |
@@ -402,38 +402,38 @@ discard block |
||
402 | 402 | |
403 | 403 | function __xe_autoload($class_name) |
404 | 404 | { |
405 | - if(__DEBUG__) { |
|
405 | + if (__DEBUG__) { |
|
406 | 406 | $time_at = getMicroTime(); |
407 | 407 | } |
408 | 408 | |
409 | - if(isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)])) |
|
409 | + if (isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)])) |
|
410 | 410 | { |
411 | - require _XE_PATH_ . $GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]; |
|
411 | + require _XE_PATH_.$GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]; |
|
412 | 412 | } |
413 | - elseif(preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) |
|
413 | + elseif (preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) |
|
414 | 414 | { |
415 | 415 | $candidate_filename = array(); |
416 | - $candidate_filename[] = 'modules/' . $matches[1] . '/' . $matches[1]; |
|
417 | - if(isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin'; |
|
416 | + $candidate_filename[] = 'modules/'.$matches[1].'/'.$matches[1]; |
|
417 | + if (isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin'; |
|
418 | 418 | $candidate_filename[] = (isset($matches[3]) && $matches[3]) ? strtolower($matches[3]) : 'class'; |
419 | 419 | $candidate_filename[] = 'php'; |
420 | 420 | |
421 | 421 | $candidate_filename = implode('.', $candidate_filename); |
422 | 422 | |
423 | - if(file_exists(_XE_PATH_ . $candidate_filename)) |
|
423 | + if (file_exists(_XE_PATH_.$candidate_filename)) |
|
424 | 424 | { |
425 | - require _XE_PATH_ . $candidate_filename; |
|
425 | + require _XE_PATH_.$candidate_filename; |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | |
429 | - if(__DEBUG__) { |
|
429 | + if (__DEBUG__) { |
|
430 | 430 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $time_at; |
431 | 431 | } |
432 | 432 | } |
433 | 433 | spl_autoload_register('__xe_autoload'); |
434 | 434 | |
435 | -if(file_exists(_XE_PATH_ . '/vendor/autoload.php')) { |
|
436 | - require _XE_PATH_ . '/vendor/autoload.php'; |
|
435 | +if (file_exists(_XE_PATH_.'/vendor/autoload.php')) { |
|
436 | + require _XE_PATH_.'/vendor/autoload.php'; |
|
437 | 437 | } |
438 | 438 | /* End of file config.inc.php */ |
439 | 439 | /* Location: ./config/config.inc.php */ |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $point = $config->signup_point; |
32 | 32 | // Increase the point |
33 | 33 | $cur_point += $point; |
34 | - $this->setPoint($member_srl,$cur_point, 'signup'); |
|
34 | + $this->setPoint($member_srl, $cur_point, 'signup'); |
|
35 | 35 | |
36 | 36 | return new Object(); |
37 | 37 | } |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | function triggerAfterLogin(&$obj) |
43 | 43 | { |
44 | 44 | $member_srl = $obj->member_srl; |
45 | - if(!$member_srl) return new Object(); |
|
45 | + if (!$member_srl) return new Object(); |
|
46 | 46 | // If the last login is not today, give the points |
47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new Object(); |
|
47 | + if (substr($obj->last_login, 0, 8) == date("Ymd")) return new Object(); |
|
48 | 48 | // Get the point module information |
49 | 49 | $oModuleModel = getModel('module'); |
50 | 50 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $point = $config->login_point; |
56 | 56 | // Increase the point |
57 | 57 | $cur_point += $point; |
58 | - $this->setPoint($member_srl,$cur_point); |
|
58 | + $this->setPoint($member_srl, $cur_point); |
|
59 | 59 | |
60 | 60 | return new Object(); |
61 | 61 | } |
@@ -66,30 +66,30 @@ discard block |
||
66 | 66 | function triggerInsertDocument(&$obj) |
67 | 67 | { |
68 | 68 | $oDocumentModel = getModel('document'); |
69 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
69 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
70 | 70 | { |
71 | 71 | $module_srl = $obj->module_srl; |
72 | 72 | $member_srl = $obj->member_srl; |
73 | - if(!$module_srl || !$member_srl) return new Object(); |
|
73 | + if (!$module_srl || !$member_srl) return new Object(); |
|
74 | 74 | // The fix to disable giving points for saving the document temporarily |
75 | - if($module_srl == $member_srl) return new Object(); |
|
75 | + if ($module_srl == $member_srl) return new Object(); |
|
76 | 76 | // Get the point module information |
77 | 77 | $oModuleModel = getModel('module'); |
78 | 78 | $config = $oModuleModel->getModuleConfig('point'); |
79 | - $module_config = $oModuleModel->getModulePartConfig('point',$module_srl); |
|
79 | + $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
|
80 | 80 | // Get the points of the member |
81 | 81 | $oPointModel = getModel('point'); |
82 | 82 | $cur_point = $oPointModel->getPoint($member_srl, true); |
83 | 83 | |
84 | 84 | $point = $module_config['insert_document']; |
85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
85 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
86 | 86 | $cur_point += $point; |
87 | 87 | // Add points for attaching a file |
88 | 88 | $point = $module_config['upload_file']; |
89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
89 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
91 | 91 | // Increase the point |
92 | - $this->setPoint($member_srl,$cur_point); |
|
92 | + $this->setPoint($member_srl, $cur_point); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return new Object(); |
@@ -106,24 +106,24 @@ discard block |
||
106 | 106 | $oDocument = $oDocumentModel->getDocument($document_srl); |
107 | 107 | |
108 | 108 | // if status is TEMP or PUBLIC... give not point, only status is empty |
109 | - if($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
109 | + if ($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
110 | 110 | { |
111 | 111 | $oModuleModel = getModel('module'); |
112 | 112 | |
113 | 113 | // Get the point module information |
114 | 114 | $config = $oModuleModel->getModuleConfig('point'); |
115 | - $module_config = $oModuleModel->getModulePartConfig('point',$obj->module_srl); |
|
115 | + $module_config = $oModuleModel->getModulePartConfig('point', $obj->module_srl); |
|
116 | 116 | // Get the points of the member |
117 | 117 | $oPointModel = getModel('point'); |
118 | 118 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
119 | 119 | |
120 | 120 | $point = $module_config['insert_document']; |
121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
121 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
122 | 122 | $cur_point += $point; |
123 | 123 | // Add points for attaching a file |
124 | 124 | $point = $module_config['upload_file']; |
125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
125 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
127 | 127 | // Increase the point |
128 | 128 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
129 | 129 | } |
@@ -141,42 +141,42 @@ discard block |
||
141 | 141 | |
142 | 142 | $oDocumentModel = getModel('document'); |
143 | 143 | $oDocument = $oDocumentModel->getDocument($document_srl); |
144 | - if(!$oDocument->isExists()) return new Object(); |
|
144 | + if (!$oDocument->isExists()) return new Object(); |
|
145 | 145 | // Get the point module information |
146 | 146 | $oModuleModel = getModel('module'); |
147 | 147 | $config = $oModuleModel->getModuleConfig('point'); |
148 | - $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
|
148 | + $module_config = $oModuleModel->getModulePartConfig('point', $oDocument->get('module_srl')); |
|
149 | 149 | // The process related to clearing the post comments |
150 | 150 | $comment_point = $module_config['insert_comment']; |
151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
151 | + if (strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
152 | 152 | // If there are comment points, attempt to deduct |
153 | - if($comment_point>0) return new Object(); |
|
153 | + if ($comment_point > 0) return new Object(); |
|
154 | 154 | // Get all the comments related to this post |
155 | 155 | $cp_args = new stdClass(); |
156 | 156 | $cp_args->document_srl = $document_srl; |
157 | 157 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
158 | 158 | // Return if there is no object |
159 | - if(!$output->data) return new Object(); |
|
159 | + if (!$output->data) return new Object(); |
|
160 | 160 | // Organize the member number |
161 | 161 | $member_srls = array(); |
162 | 162 | $cnt = count($output->data); |
163 | - for($i=0;$i<$cnt;$i++) |
|
163 | + for ($i = 0; $i < $cnt; $i++) |
|
164 | 164 | { |
165 | - if($output->data[$i]->member_srl<1) continue; |
|
165 | + if ($output->data[$i]->member_srl < 1) continue; |
|
166 | 166 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
167 | 167 | } |
168 | 168 | // Remove the member number who has written the original post |
169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | - if(!count($member_srls)) return new Object(); |
|
169 | + if ($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | + if (!count($member_srls)) return new Object(); |
|
171 | 171 | // Remove all the points for each member |
172 | 172 | $oPointModel = getModel('point'); |
173 | 173 | // Get the points |
174 | 174 | $point = $module_config['download_file']; |
175 | - foreach($member_srls as $member_srl => $cnt) |
|
175 | + foreach ($member_srls as $member_srl => $cnt) |
|
176 | 176 | { |
177 | 177 | $cur_point = $oPointModel->getPoint($member_srl, true); |
178 | 178 | $cur_point -= $cnt * $comment_point; |
179 | - $this->setPoint($member_srl,$cur_point); |
|
179 | + $this->setPoint($member_srl, $cur_point); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | return new Object(); |
@@ -189,15 +189,15 @@ discard block |
||
189 | 189 | { |
190 | 190 | $oDocumentModel = getModel('document'); |
191 | 191 | |
192 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
192 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
193 | 193 | { |
194 | 194 | $module_srl = $obj->module_srl; |
195 | 195 | $member_srl = $obj->member_srl; |
196 | 196 | // The process related to clearing the post object |
197 | - if(!$module_srl || !$member_srl) return new Object(); |
|
197 | + if (!$module_srl || !$member_srl) return new Object(); |
|
198 | 198 | // Run only when logged in |
199 | 199 | $logged_info = Context::get('logged_info'); |
200 | - if(!$logged_info->member_srl) return new Object(); |
|
200 | + if (!$logged_info->member_srl) return new Object(); |
|
201 | 201 | // Get the points of the member |
202 | 202 | $oPointModel = getModel('point'); |
203 | 203 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
208 | 208 | |
209 | 209 | $point = $module_config['insert_document']; |
210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
210 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
211 | 211 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
212 | - if($point < 0) return new Object(); |
|
212 | + if ($point < 0) return new Object(); |
|
213 | 213 | $cur_point -= $point; |
214 | 214 | // Add points related to deleting an attachment |
215 | 215 | $point = $module_config['upload_file']; |
216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
216 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | + if ($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
218 | 218 | // Increase the point |
219 | - $this->setPoint($member_srl,$cur_point); |
|
219 | + $this->setPoint($member_srl, $cur_point); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | return new Object(); |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | { |
230 | 230 | $module_srl = $obj->module_srl; |
231 | 231 | $member_srl = $obj->member_srl; |
232 | - if(!$module_srl || !$member_srl) return new Object(); |
|
232 | + if (!$module_srl || !$member_srl) return new Object(); |
|
233 | 233 | // Do not increase the points if the member is the author of the post |
234 | 234 | $document_srl = $obj->document_srl; |
235 | 235 | $oDocumentModel = getModel('document'); |
236 | 236 | $oDocument = $oDocumentModel->getDocument($document_srl); |
237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object(); |
|
237 | + if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new Object(); |
|
238 | 238 | // Get the point module information |
239 | 239 | $oModuleModel = getModel('module'); |
240 | 240 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | $cur_point = $oPointModel->getPoint($member_srl, true); |
245 | 245 | |
246 | 246 | $point = $module_config['insert_comment']; |
247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
247 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
248 | 248 | // Increase the point |
249 | 249 | $cur_point += $point; |
250 | - $this->setPoint($member_srl,$cur_point); |
|
250 | + $this->setPoint($member_srl, $cur_point); |
|
251 | 251 | |
252 | 252 | return new Object(); |
253 | 253 | } |
@@ -264,11 +264,11 @@ discard block |
||
264 | 264 | $module_srl = $obj->module_srl; |
265 | 265 | $member_srl = abs($obj->member_srl); |
266 | 266 | $document_srl = $obj->document_srl; |
267 | - if(!$module_srl || !$member_srl) return new Object(); |
|
267 | + if (!$module_srl || !$member_srl) return new Object(); |
|
268 | 268 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
269 | 269 | $oDocument = $oDocumentModel->getDocument($document_srl); |
270 | - if(!$oDocument->isExists()) return new Object(); |
|
271 | - if($oDocument->get('member_srl')==$member_srl) return new Object(); |
|
270 | + if (!$oDocument->isExists()) return new Object(); |
|
271 | + if ($oDocument->get('member_srl') == $member_srl) return new Object(); |
|
272 | 272 | // Get the point module information |
273 | 273 | $config = $oModuleModel->getModuleConfig('point'); |
274 | 274 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | $cur_point = $oPointModel->getPoint($member_srl, true); |
277 | 277 | |
278 | 278 | $point = $module_config['insert_comment']; |
279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
279 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
280 | 280 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
281 | - if($point < 0) return new Object(); |
|
281 | + if ($point < 0) return new Object(); |
|
282 | 282 | // Increase the point |
283 | 283 | $cur_point -= $point; |
284 | - $this->setPoint($member_srl,$cur_point); |
|
284 | + $this->setPoint($member_srl, $cur_point); |
|
285 | 285 | |
286 | 286 | return new Object(); |
287 | 287 | } |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | */ |
302 | 302 | function triggerDeleteFile(&$obj) |
303 | 303 | { |
304 | - if($obj->isvalid != 'Y') return new Object(); |
|
304 | + if ($obj->isvalid != 'Y') return new Object(); |
|
305 | 305 | |
306 | 306 | $module_srl = $obj->module_srl; |
307 | 307 | $member_srl = $obj->member_srl; |
308 | - if(!$module_srl || !$member_srl) return new Object(); |
|
308 | + if (!$module_srl || !$member_srl) return new Object(); |
|
309 | 309 | // Get the point module information |
310 | 310 | $oModuleModel = getModel('module'); |
311 | 311 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | $cur_point = $oPointModel->getPoint($member_srl, true); |
316 | 316 | |
317 | 317 | $point = $module_config['upload_file']; |
318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
318 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
319 | 319 | // Increase the point |
320 | 320 | $cur_point -= $point; |
321 | - $this->setPoint($member_srl,$cur_point); |
|
321 | + $this->setPoint($member_srl, $cur_point); |
|
322 | 322 | |
323 | 323 | return new Object(); |
324 | 324 | } |
@@ -331,17 +331,17 @@ discard block |
||
331 | 331 | $logged_info = Context::get('logged_info'); |
332 | 332 | $member_srl = $logged_info->member_srl; |
333 | 333 | $module_srl = $obj->module_srl; |
334 | - if(!$module_srl) return new Object(); |
|
334 | + if (!$module_srl) return new Object(); |
|
335 | 335 | // Pass if it is your file |
336 | - if(abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
336 | + if (abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
337 | 337 | |
338 | 338 | $oModuleModel = getModel('module'); |
339 | 339 | $config = $oModuleModel->getModuleConfig('point'); |
340 | 340 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
341 | 341 | // If it is set not to allow downloading for non-logged in users, do not permit |
342 | - if(!Context::get('is_logged')) |
|
342 | + if (!Context::get('is_logged')) |
|
343 | 343 | { |
344 | - if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1,'msg_not_permitted_download'); |
|
344 | + if ($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1, 'msg_not_permitted_download'); |
|
345 | 345 | else return new Object(); |
346 | 346 | } |
347 | 347 | // Get the points of the member |
@@ -349,9 +349,9 @@ discard block |
||
349 | 349 | $cur_point = $oPointModel->getPoint($member_srl, true); |
350 | 350 | // Get the points |
351 | 351 | $point = $module_config['download_file']; |
352 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
352 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
353 | 353 | // If points are less than 0, and if downloading a file is not allowed in this case, give an errors |
354 | - if($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1,'msg_cannot_download'); |
|
354 | + if ($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1, 'msg_cannot_download'); |
|
355 | 355 | |
356 | 356 | return new Object(); |
357 | 357 | } |
@@ -363,12 +363,12 @@ discard block |
||
363 | 363 | { |
364 | 364 | // Run only when logged in |
365 | 365 | $logged_info = Context::get('logged_info'); |
366 | - if(!$logged_info->member_srl) return new Object(); |
|
366 | + if (!$logged_info->member_srl) return new Object(); |
|
367 | 367 | $module_srl = $obj->module_srl; |
368 | 368 | $member_srl = $logged_info->member_srl; |
369 | - if(!$module_srl) return new Object(); |
|
369 | + if (!$module_srl) return new Object(); |
|
370 | 370 | // Pass if it is your file |
371 | - if(abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
371 | + if (abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
372 | 372 | // Get the point module information |
373 | 373 | $oModuleModel = getModel('module'); |
374 | 374 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | $cur_point = $oPointModel->getPoint($member_srl, true); |
379 | 379 | // Get the points |
380 | 380 | $point = $module_config['download_file']; |
381 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
381 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
382 | 382 | // Increase the point |
383 | 383 | $cur_point += $point; |
384 | - $this->setPoint($member_srl,$cur_point); |
|
384 | + $this->setPoint($member_srl, $cur_point); |
|
385 | 385 | |
386 | 386 | return new Object(); |
387 | 387 | } |
@@ -400,22 +400,22 @@ discard block |
||
400 | 400 | // Get the original author number |
401 | 401 | $target_member_srl = abs($obj->get('member_srl')); |
402 | 402 | // Pass without increasing the hits if the viewer is the same as the author |
403 | - if($target_member_srl == $member_srl) return new Object(); |
|
403 | + if ($target_member_srl == $member_srl) return new Object(); |
|
404 | 404 | // Get the point information for each module |
405 | 405 | $config = $oModuleModel->getModuleConfig('point'); |
406 | 406 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
407 | 407 | // Get hits points |
408 | 408 | $point = $module_config['read_document']; |
409 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
409 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
410 | 410 | // Pass if there are no requested points |
411 | - if(!$point) return new Object(); |
|
411 | + if (!$point) return new Object(); |
|
412 | 412 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
413 | - if($member_srl) |
|
413 | + if ($member_srl) |
|
414 | 414 | { |
415 | 415 | $args->member_srl = $member_srl; |
416 | 416 | $args->document_srl = $obj->document_srl; |
417 | 417 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
418 | - if($output->data->count) return new Object(); |
|
418 | + if ($output->data->count) return new Object(); |
|
419 | 419 | $cur_point = $oPointModel->getPoint($member_srl, true); |
420 | 420 | } |
421 | 421 | else |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | $config = $oModuleModel->getModuleConfig('point'); |
427 | 427 | // When the requested points are negative, compared it with the current point |
428 | 428 | $_SESSION['banned_document'][$obj->document_srl] = false; |
429 | - if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point) |
|
429 | + if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point) |
|
430 | 430 | { |
431 | 431 | $message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point); |
432 | 432 | $obj->add('content', $message); |
@@ -434,14 +434,14 @@ discard block |
||
434 | 434 | return new Object(-1, $message); |
435 | 435 | } |
436 | 436 | // If not logged in, pass |
437 | - if(!$logged_info->member_srl) return new Object(); |
|
437 | + if (!$logged_info->member_srl) return new Object(); |
|
438 | 438 | // Pass, if there are no requested points |
439 | - if(!$point) return new Object(); |
|
439 | + if (!$point) return new Object(); |
|
440 | 440 | // If the read record is missing, leave it |
441 | 441 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
442 | 442 | // Increase the point |
443 | 443 | $cur_point += $point; |
444 | - $this->setPoint($member_srl,$cur_point); |
|
444 | + $this->setPoint($member_srl, $cur_point); |
|
445 | 445 | |
446 | 446 | return new Object(); |
447 | 447 | } |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | { |
454 | 454 | $module_srl = $obj->module_srl; |
455 | 455 | $member_srl = $obj->member_srl; |
456 | - if(!$module_srl || !$member_srl) return new Object(); |
|
456 | + if (!$module_srl || !$member_srl) return new Object(); |
|
457 | 457 | |
458 | 458 | $oModuleModel = getModel('module'); |
459 | 459 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -462,21 +462,21 @@ discard block |
||
462 | 462 | $oPointModel = getModel('point'); |
463 | 463 | $cur_point = $oPointModel->getPoint($member_srl, true); |
464 | 464 | |
465 | - if( $obj->point > 0 ) |
|
465 | + if ($obj->point > 0) |
|
466 | 466 | { |
467 | 467 | $point = $module_config['voted']; |
468 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
468 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
469 | 469 | } |
470 | 470 | else |
471 | 471 | { |
472 | 472 | $point = $module_config['blamed']; |
473 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
473 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
474 | 474 | } |
475 | 475 | |
476 | - if(!$point) return new Object(); |
|
476 | + if (!$point) return new Object(); |
|
477 | 477 | // Increase the point |
478 | 478 | $cur_point += $point; |
479 | - $this->setPoint($member_srl,$cur_point); |
|
479 | + $this->setPoint($member_srl, $cur_point); |
|
480 | 480 | |
481 | 481 | return new Object(); |
482 | 482 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | { |
489 | 489 | $member_srl = abs($member_srl); |
490 | 490 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
491 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
491 | + if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update'; |
|
492 | 492 | |
493 | 493 | // Get configuration information |
494 | 494 | $oMemberModel = getModel('member'); |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $args->member_srl = $member_srl; |
506 | 506 | $args->point = $current_point; |
507 | 507 | |
508 | - switch($mode) |
|
508 | + switch ($mode) |
|
509 | 509 | { |
510 | 510 | case 'add' : |
511 | 511 | $args->point += $point; |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | $args->point = $point; |
519 | 519 | break; |
520 | 520 | } |
521 | - if($args->point < 0) $args->point = 0; |
|
521 | + if ($args->point < 0) $args->point = 0; |
|
522 | 522 | $point = $args->point; |
523 | 523 | |
524 | 524 | // Call a trigger (before) |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $trigger_obj->current_level = $current_level; |
530 | 530 | $trigger_obj->set_point = $point; |
531 | 531 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj); |
532 | - if(!$trigger_output->toBool()) |
|
532 | + if (!$trigger_output->toBool()) |
|
533 | 533 | { |
534 | 534 | return $trigger_output; |
535 | 535 | } |
@@ -540,19 +540,19 @@ discard block |
||
540 | 540 | |
541 | 541 | // If there are points, update, if no, insert |
542 | 542 | $oPointModel = getModel('point'); |
543 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
543 | + if ($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
544 | 544 | else executeQuery("point.insertPoint", $args); |
545 | 545 | |
546 | 546 | // Get a new level |
547 | 547 | $level = $oPointModel->getLevel($point, $config->level_step); |
548 | 548 | |
549 | 549 | // If existing level and a new one are different attempt to set a point group |
550 | - if($level != $current_level) |
|
550 | + if ($level != $current_level) |
|
551 | 551 | { |
552 | 552 | // Check if the level, for which the current points are prepared, is calculate and set the correct group |
553 | 553 | $point_group = $config->point_group; |
554 | 554 | // If the point group exists |
555 | - if($point_group && is_array($point_group) && count($point_group) ) |
|
555 | + if ($point_group && is_array($point_group) && count($point_group)) |
|
556 | 556 | { |
557 | 557 | // Get the default group |
558 | 558 | $default_group = $oMemberModel->getDefaultGroup(); |
@@ -562,29 +562,29 @@ discard block |
||
562 | 562 | |
563 | 563 | asort($point_group); |
564 | 564 | // Reset group after initialization |
565 | - if($config->group_reset != 'N') |
|
565 | + if ($config->group_reset != 'N') |
|
566 | 566 | { |
567 | 567 | // If the new level is in the right group |
568 | - if(in_array($level, $point_group)) |
|
568 | + if (in_array($level, $point_group)) |
|
569 | 569 | { |
570 | 570 | // Delete all groups except the one which the current level belongs to |
571 | - foreach($point_group as $group_srl => $target_level) |
|
571 | + foreach ($point_group as $group_srl => $target_level) |
|
572 | 572 | { |
573 | 573 | $del_group_list[] = $group_srl; |
574 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
574 | + if ($target_level == $level) $new_group_list[] = $group_srl; |
|
575 | 575 | } |
576 | 576 | } |
577 | 577 | // Otherwise, in case the level is reduced, add the recent group |
578 | 578 | else |
579 | 579 | { |
580 | 580 | $i = $level; |
581 | - while($i > 0) |
|
581 | + while ($i > 0) |
|
582 | 582 | { |
583 | - if(in_array($i, $point_group)) |
|
583 | + if (in_array($i, $point_group)) |
|
584 | 584 | { |
585 | - foreach($point_group as $group_srl => $target_level) |
|
585 | + foreach ($point_group as $group_srl => $target_level) |
|
586 | 586 | { |
587 | - if($target_level == $i) |
|
587 | + if ($target_level == $i) |
|
588 | 588 | { |
589 | 589 | $new_group_list[] = $group_srl; |
590 | 590 | } |
@@ -595,9 +595,9 @@ discard block |
||
595 | 595 | } |
596 | 596 | } |
597 | 597 | // Delete the group of a level which is higher than the current level |
598 | - foreach($point_group as $group_srl => $target_level) |
|
598 | + foreach ($point_group as $group_srl => $target_level) |
|
599 | 599 | { |
600 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
600 | + if ($target_level > $level) $del_group_list[] = $group_srl; |
|
601 | 601 | } |
602 | 602 | $del_group_list[] = $default_group->group_srl; |
603 | 603 | } |
@@ -605,16 +605,16 @@ discard block |
||
605 | 605 | else |
606 | 606 | { |
607 | 607 | // Check until the current level by rotating setting the configurations of the point groups |
608 | - foreach($point_group as $group_srl => $target_level) |
|
608 | + foreach ($point_group as $group_srl => $target_level) |
|
609 | 609 | { |
610 | 610 | $del_group_list[] = $group_srl; |
611 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
611 | + if ($target_level <= $level) $new_group_list[] = $group_srl; |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | // If there is no a new group, granted the default group |
615 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
615 | + if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
616 | 616 | // Remove linkage group |
617 | - if($del_group_list && count($del_group_list)) |
|
617 | + if ($del_group_list && count($del_group_list)) |
|
618 | 618 | { |
619 | 619 | $del_group_args = new stdClass; |
620 | 620 | $del_group_args->member_srl = $member_srl; |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | $del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args); |
623 | 623 | } |
624 | 624 | // Grant a new group |
625 | - foreach($new_group_list as $group_srl) |
|
625 | + foreach ($new_group_list as $group_srl) |
|
626 | 626 | { |
627 | 627 | $new_group_args = new stdClass; |
628 | 628 | $new_group_args->member_srl = $member_srl; |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | $trigger_obj->del_group_list = $del_group_list; |
638 | 638 | $trigger_obj->new_level = $level; |
639 | 639 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj); |
640 | - if(!$trigger_output->toBool()) |
|
640 | + if (!$trigger_output->toBool()) |
|
641 | 641 | { |
642 | 642 | $oDB->rollback(); |
643 | 643 | return $trigger_output; |
@@ -653,17 +653,17 @@ discard block |
||
653 | 653 | FileHandler::writeFile($cache_filename, $point); |
654 | 654 | |
655 | 655 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
656 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
656 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
657 | 657 | { |
658 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
658 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
659 | 659 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
660 | 660 | $oCacheHandler->delete($cache_key); |
661 | 661 | } |
662 | 662 | |
663 | 663 | $oCacheHandler = CacheHandler::getInstance('object'); |
664 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
664 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
665 | 665 | { |
666 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
666 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
667 | 667 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
668 | 668 | $oCacheHandler->delete($cache_key); |
669 | 669 | } |
@@ -677,9 +677,9 @@ discard block |
||
677 | 677 | $pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl); |
678 | 678 | |
679 | 679 | $oModuleController = getController('module'); |
680 | - if(is_array($obj->moduleSrlList)) |
|
680 | + if (is_array($obj->moduleSrlList)) |
|
681 | 681 | { |
682 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
682 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
683 | 683 | { |
684 | 684 | $oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig); |
685 | 685 | } |
@@ -42,9 +42,13 @@ discard block |
||
42 | 42 | function triggerAfterLogin(&$obj) |
43 | 43 | { |
44 | 44 | $member_srl = $obj->member_srl; |
45 | - if(!$member_srl) return new Object(); |
|
45 | + if(!$member_srl) { |
|
46 | + return new Object(); |
|
47 | + } |
|
46 | 48 | // If the last login is not today, give the points |
47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new Object(); |
|
49 | + if(substr($obj->last_login,0,8)==date("Ymd")) { |
|
50 | + return new Object(); |
|
51 | + } |
|
48 | 52 | // Get the point module information |
49 | 53 | $oModuleModel = getModel('module'); |
50 | 54 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -70,9 +74,13 @@ discard block |
||
70 | 74 | { |
71 | 75 | $module_srl = $obj->module_srl; |
72 | 76 | $member_srl = $obj->member_srl; |
73 | - if(!$module_srl || !$member_srl) return new Object(); |
|
77 | + if(!$module_srl || !$member_srl) { |
|
78 | + return new Object(); |
|
79 | + } |
|
74 | 80 | // The fix to disable giving points for saving the document temporarily |
75 | - if($module_srl == $member_srl) return new Object(); |
|
81 | + if($module_srl == $member_srl) { |
|
82 | + return new Object(); |
|
83 | + } |
|
76 | 84 | // Get the point module information |
77 | 85 | $oModuleModel = getModel('module'); |
78 | 86 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -82,12 +90,18 @@ discard block |
||
82 | 90 | $cur_point = $oPointModel->getPoint($member_srl, true); |
83 | 91 | |
84 | 92 | $point = $module_config['insert_document']; |
85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
93 | + if(strlen($point) == 0 && !is_int($point)) { |
|
94 | + $point = $config->insert_document; |
|
95 | + } |
|
86 | 96 | $cur_point += $point; |
87 | 97 | // Add points for attaching a file |
88 | 98 | $point = $module_config['upload_file']; |
89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
99 | + if(strlen($point) == 0 && !is_int($point)) { |
|
100 | + $point = $config->upload_file; |
|
101 | + } |
|
102 | + if($obj->uploaded_count) { |
|
103 | + $cur_point += $point * $obj->uploaded_count; |
|
104 | + } |
|
91 | 105 | // Increase the point |
92 | 106 | $this->setPoint($member_srl,$cur_point); |
93 | 107 | } |
@@ -118,12 +132,18 @@ discard block |
||
118 | 132 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
119 | 133 | |
120 | 134 | $point = $module_config['insert_document']; |
121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
135 | + if(strlen($point) == 0 && !is_int($point)) { |
|
136 | + $point = $config->insert_document; |
|
137 | + } |
|
122 | 138 | $cur_point += $point; |
123 | 139 | // Add points for attaching a file |
124 | 140 | $point = $module_config['upload_file']; |
125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
141 | + if(strlen($point) == 0 && !is_int($point)) { |
|
142 | + $point = $config->upload_file; |
|
143 | + } |
|
144 | + if($obj->uploaded_count) { |
|
145 | + $cur_point += $point * $obj->uploaded_count; |
|
146 | + } |
|
127 | 147 | // Increase the point |
128 | 148 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
129 | 149 | } |
@@ -141,33 +161,47 @@ discard block |
||
141 | 161 | |
142 | 162 | $oDocumentModel = getModel('document'); |
143 | 163 | $oDocument = $oDocumentModel->getDocument($document_srl); |
144 | - if(!$oDocument->isExists()) return new Object(); |
|
164 | + if(!$oDocument->isExists()) { |
|
165 | + return new Object(); |
|
166 | + } |
|
145 | 167 | // Get the point module information |
146 | 168 | $oModuleModel = getModel('module'); |
147 | 169 | $config = $oModuleModel->getModuleConfig('point'); |
148 | 170 | $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
149 | 171 | // The process related to clearing the post comments |
150 | 172 | $comment_point = $module_config['insert_comment']; |
151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
173 | + if(strlen($comment_point) == 0 && !is_int($comment_point)) { |
|
174 | + $comment_point = $config->insert_comment; |
|
175 | + } |
|
152 | 176 | // If there are comment points, attempt to deduct |
153 | - if($comment_point>0) return new Object(); |
|
177 | + if($comment_point>0) { |
|
178 | + return new Object(); |
|
179 | + } |
|
154 | 180 | // Get all the comments related to this post |
155 | 181 | $cp_args = new stdClass(); |
156 | 182 | $cp_args->document_srl = $document_srl; |
157 | 183 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
158 | 184 | // Return if there is no object |
159 | - if(!$output->data) return new Object(); |
|
185 | + if(!$output->data) { |
|
186 | + return new Object(); |
|
187 | + } |
|
160 | 188 | // Organize the member number |
161 | 189 | $member_srls = array(); |
162 | 190 | $cnt = count($output->data); |
163 | 191 | for($i=0;$i<$cnt;$i++) |
164 | 192 | { |
165 | - if($output->data[$i]->member_srl<1) continue; |
|
193 | + if($output->data[$i]->member_srl<1) { |
|
194 | + continue; |
|
195 | + } |
|
166 | 196 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
167 | 197 | } |
168 | 198 | // Remove the member number who has written the original post |
169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | - if(!count($member_srls)) return new Object(); |
|
199 | + if($member_srl) { |
|
200 | + unset($member_srls[abs($member_srl)]); |
|
201 | + } |
|
202 | + if(!count($member_srls)) { |
|
203 | + return new Object(); |
|
204 | + } |
|
171 | 205 | // Remove all the points for each member |
172 | 206 | $oPointModel = getModel('point'); |
173 | 207 | // Get the points |
@@ -194,10 +228,14 @@ discard block |
||
194 | 228 | $module_srl = $obj->module_srl; |
195 | 229 | $member_srl = $obj->member_srl; |
196 | 230 | // The process related to clearing the post object |
197 | - if(!$module_srl || !$member_srl) return new Object(); |
|
231 | + if(!$module_srl || !$member_srl) { |
|
232 | + return new Object(); |
|
233 | + } |
|
198 | 234 | // Run only when logged in |
199 | 235 | $logged_info = Context::get('logged_info'); |
200 | - if(!$logged_info->member_srl) return new Object(); |
|
236 | + if(!$logged_info->member_srl) { |
|
237 | + return new Object(); |
|
238 | + } |
|
201 | 239 | // Get the points of the member |
202 | 240 | $oPointModel = getModel('point'); |
203 | 241 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,14 +245,22 @@ discard block |
||
207 | 245 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
208 | 246 | |
209 | 247 | $point = $module_config['insert_document']; |
210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
248 | + if(strlen($point) == 0 && !is_int($point)) { |
|
249 | + $point = $config->insert_document; |
|
250 | + } |
|
211 | 251 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
212 | - if($point < 0) return new Object(); |
|
252 | + if($point < 0) { |
|
253 | + return new Object(); |
|
254 | + } |
|
213 | 255 | $cur_point -= $point; |
214 | 256 | // Add points related to deleting an attachment |
215 | 257 | $point = $module_config['upload_file']; |
216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
258 | + if(strlen($point) == 0 && !is_int($point)) { |
|
259 | + $point = $config->upload_file; |
|
260 | + } |
|
261 | + if($obj->uploaded_count) { |
|
262 | + $cur_point -= $point * $obj->uploaded_count; |
|
263 | + } |
|
218 | 264 | // Increase the point |
219 | 265 | $this->setPoint($member_srl,$cur_point); |
220 | 266 | } |
@@ -229,12 +275,16 @@ discard block |
||
229 | 275 | { |
230 | 276 | $module_srl = $obj->module_srl; |
231 | 277 | $member_srl = $obj->member_srl; |
232 | - if(!$module_srl || !$member_srl) return new Object(); |
|
278 | + if(!$module_srl || !$member_srl) { |
|
279 | + return new Object(); |
|
280 | + } |
|
233 | 281 | // Do not increase the points if the member is the author of the post |
234 | 282 | $document_srl = $obj->document_srl; |
235 | 283 | $oDocumentModel = getModel('document'); |
236 | 284 | $oDocument = $oDocumentModel->getDocument($document_srl); |
237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object(); |
|
285 | + if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) { |
|
286 | + return new Object(); |
|
287 | + } |
|
238 | 288 | // Get the point module information |
239 | 289 | $oModuleModel = getModel('module'); |
240 | 290 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,7 +294,9 @@ discard block |
||
244 | 294 | $cur_point = $oPointModel->getPoint($member_srl, true); |
245 | 295 | |
246 | 296 | $point = $module_config['insert_comment']; |
247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
297 | + if(strlen($point) == 0 && !is_int($point)) { |
|
298 | + $point = $config->insert_comment; |
|
299 | + } |
|
248 | 300 | // Increase the point |
249 | 301 | $cur_point += $point; |
250 | 302 | $this->setPoint($member_srl,$cur_point); |
@@ -264,11 +316,17 @@ discard block |
||
264 | 316 | $module_srl = $obj->module_srl; |
265 | 317 | $member_srl = abs($obj->member_srl); |
266 | 318 | $document_srl = $obj->document_srl; |
267 | - if(!$module_srl || !$member_srl) return new Object(); |
|
319 | + if(!$module_srl || !$member_srl) { |
|
320 | + return new Object(); |
|
321 | + } |
|
268 | 322 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
269 | 323 | $oDocument = $oDocumentModel->getDocument($document_srl); |
270 | - if(!$oDocument->isExists()) return new Object(); |
|
271 | - if($oDocument->get('member_srl')==$member_srl) return new Object(); |
|
324 | + if(!$oDocument->isExists()) { |
|
325 | + return new Object(); |
|
326 | + } |
|
327 | + if($oDocument->get('member_srl')==$member_srl) { |
|
328 | + return new Object(); |
|
329 | + } |
|
272 | 330 | // Get the point module information |
273 | 331 | $config = $oModuleModel->getModuleConfig('point'); |
274 | 332 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,9 +334,13 @@ discard block |
||
276 | 334 | $cur_point = $oPointModel->getPoint($member_srl, true); |
277 | 335 | |
278 | 336 | $point = $module_config['insert_comment']; |
279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
337 | + if(strlen($point) == 0 && !is_int($point)) { |
|
338 | + $point = $config->insert_comment; |
|
339 | + } |
|
280 | 340 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
281 | - if($point < 0) return new Object(); |
|
341 | + if($point < 0) { |
|
342 | + return new Object(); |
|
343 | + } |
|
282 | 344 | // Increase the point |
283 | 345 | $cur_point -= $point; |
284 | 346 | $this->setPoint($member_srl,$cur_point); |
@@ -301,11 +363,15 @@ discard block |
||
301 | 363 | */ |
302 | 364 | function triggerDeleteFile(&$obj) |
303 | 365 | { |
304 | - if($obj->isvalid != 'Y') return new Object(); |
|
366 | + if($obj->isvalid != 'Y') { |
|
367 | + return new Object(); |
|
368 | + } |
|
305 | 369 | |
306 | 370 | $module_srl = $obj->module_srl; |
307 | 371 | $member_srl = $obj->member_srl; |
308 | - if(!$module_srl || !$member_srl) return new Object(); |
|
372 | + if(!$module_srl || !$member_srl) { |
|
373 | + return new Object(); |
|
374 | + } |
|
309 | 375 | // Get the point module information |
310 | 376 | $oModuleModel = getModel('module'); |
311 | 377 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,7 +381,9 @@ discard block |
||
315 | 381 | $cur_point = $oPointModel->getPoint($member_srl, true); |
316 | 382 | |
317 | 383 | $point = $module_config['upload_file']; |
318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
384 | + if(strlen($point) == 0 && !is_int($point)) { |
|
385 | + $point = $config->upload_file; |
|
386 | + } |
|
319 | 387 | // Increase the point |
320 | 388 | $cur_point -= $point; |
321 | 389 | $this->setPoint($member_srl,$cur_point); |
@@ -331,9 +399,13 @@ discard block |
||
331 | 399 | $logged_info = Context::get('logged_info'); |
332 | 400 | $member_srl = $logged_info->member_srl; |
333 | 401 | $module_srl = $obj->module_srl; |
334 | - if(!$module_srl) return new Object(); |
|
402 | + if(!$module_srl) { |
|
403 | + return new Object(); |
|
404 | + } |
|
335 | 405 | // Pass if it is your file |
336 | - if(abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
406 | + if(abs($obj->member_srl) == abs($member_srl)) { |
|
407 | + return new Object(); |
|
408 | + } |
|
337 | 409 | |
338 | 410 | $oModuleModel = getModel('module'); |
339 | 411 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -341,17 +413,24 @@ discard block |
||
341 | 413 | // If it is set not to allow downloading for non-logged in users, do not permit |
342 | 414 | if(!Context::get('is_logged')) |
343 | 415 | { |
344 | - if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1,'msg_not_permitted_download'); |
|
345 | - else return new Object(); |
|
416 | + if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) { |
|
417 | + return new Object(-1,'msg_not_permitted_download'); |
|
418 | + } else { |
|
419 | + return new Object(); |
|
420 | + } |
|
346 | 421 | } |
347 | 422 | // Get the points of the member |
348 | 423 | $oPointModel = getModel('point'); |
349 | 424 | $cur_point = $oPointModel->getPoint($member_srl, true); |
350 | 425 | // Get the points |
351 | 426 | $point = $module_config['download_file']; |
352 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
427 | + if(strlen($point) == 0 && !is_int($point)) { |
|
428 | + $point = $config->download_file; |
|
429 | + } |
|
353 | 430 | // If points are less than 0, and if downloading a file is not allowed in this case, give an errors |
354 | - if($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1,'msg_cannot_download'); |
|
431 | + if($cur_point + $point < 0 && $config->disable_download == 'Y') { |
|
432 | + return new Object(-1,'msg_cannot_download'); |
|
433 | + } |
|
355 | 434 | |
356 | 435 | return new Object(); |
357 | 436 | } |
@@ -363,12 +442,18 @@ discard block |
||
363 | 442 | { |
364 | 443 | // Run only when logged in |
365 | 444 | $logged_info = Context::get('logged_info'); |
366 | - if(!$logged_info->member_srl) return new Object(); |
|
445 | + if(!$logged_info->member_srl) { |
|
446 | + return new Object(); |
|
447 | + } |
|
367 | 448 | $module_srl = $obj->module_srl; |
368 | 449 | $member_srl = $logged_info->member_srl; |
369 | - if(!$module_srl) return new Object(); |
|
450 | + if(!$module_srl) { |
|
451 | + return new Object(); |
|
452 | + } |
|
370 | 453 | // Pass if it is your file |
371 | - if(abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
454 | + if(abs($obj->member_srl) == abs($member_srl)) { |
|
455 | + return new Object(); |
|
456 | + } |
|
372 | 457 | // Get the point module information |
373 | 458 | $oModuleModel = getModel('module'); |
374 | 459 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -378,7 +463,9 @@ discard block |
||
378 | 463 | $cur_point = $oPointModel->getPoint($member_srl, true); |
379 | 464 | // Get the points |
380 | 465 | $point = $module_config['download_file']; |
381 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
466 | + if(strlen($point) == 0 && !is_int($point)) { |
|
467 | + $point = $config->download_file; |
|
468 | + } |
|
382 | 469 | // Increase the point |
383 | 470 | $cur_point += $point; |
384 | 471 | $this->setPoint($member_srl,$cur_point); |
@@ -400,25 +487,32 @@ discard block |
||
400 | 487 | // Get the original author number |
401 | 488 | $target_member_srl = abs($obj->get('member_srl')); |
402 | 489 | // Pass without increasing the hits if the viewer is the same as the author |
403 | - if($target_member_srl == $member_srl) return new Object(); |
|
490 | + if($target_member_srl == $member_srl) { |
|
491 | + return new Object(); |
|
492 | + } |
|
404 | 493 | // Get the point information for each module |
405 | 494 | $config = $oModuleModel->getModuleConfig('point'); |
406 | 495 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
407 | 496 | // Get hits points |
408 | 497 | $point = $module_config['read_document']; |
409 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
498 | + if(strlen($point) == 0 && !is_int($point)) { |
|
499 | + $point = $config->read_document; |
|
500 | + } |
|
410 | 501 | // Pass if there are no requested points |
411 | - if(!$point) return new Object(); |
|
502 | + if(!$point) { |
|
503 | + return new Object(); |
|
504 | + } |
|
412 | 505 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
413 | 506 | if($member_srl) |
414 | 507 | { |
415 | 508 | $args->member_srl = $member_srl; |
416 | 509 | $args->document_srl = $obj->document_srl; |
417 | 510 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
418 | - if($output->data->count) return new Object(); |
|
511 | + if($output->data->count) { |
|
512 | + return new Object(); |
|
513 | + } |
|
419 | 514 | $cur_point = $oPointModel->getPoint($member_srl, true); |
420 | - } |
|
421 | - else |
|
515 | + } else |
|
422 | 516 | { |
423 | 517 | $cur_point = 0; |
424 | 518 | } |
@@ -434,9 +528,13 @@ discard block |
||
434 | 528 | return new Object(-1, $message); |
435 | 529 | } |
436 | 530 | // If not logged in, pass |
437 | - if(!$logged_info->member_srl) return new Object(); |
|
531 | + if(!$logged_info->member_srl) { |
|
532 | + return new Object(); |
|
533 | + } |
|
438 | 534 | // Pass, if there are no requested points |
439 | - if(!$point) return new Object(); |
|
535 | + if(!$point) { |
|
536 | + return new Object(); |
|
537 | + } |
|
440 | 538 | // If the read record is missing, leave it |
441 | 539 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
442 | 540 | // Increase the point |
@@ -453,7 +551,9 @@ discard block |
||
453 | 551 | { |
454 | 552 | $module_srl = $obj->module_srl; |
455 | 553 | $member_srl = $obj->member_srl; |
456 | - if(!$module_srl || !$member_srl) return new Object(); |
|
554 | + if(!$module_srl || !$member_srl) { |
|
555 | + return new Object(); |
|
556 | + } |
|
457 | 557 | |
458 | 558 | $oModuleModel = getModel('module'); |
459 | 559 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -465,15 +565,20 @@ discard block |
||
465 | 565 | if( $obj->point > 0 ) |
466 | 566 | { |
467 | 567 | $point = $module_config['voted']; |
468 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
469 | - } |
|
470 | - else |
|
568 | + if(strlen($point) == 0 && !is_int($point)) { |
|
569 | + $point = $config->voted; |
|
570 | + } |
|
571 | + } else |
|
471 | 572 | { |
472 | 573 | $point = $module_config['blamed']; |
473 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
574 | + if(strlen($point) == 0 && !is_int($point)) { |
|
575 | + $point = $config->blamed; |
|
576 | + } |
|
474 | 577 | } |
475 | 578 | |
476 | - if(!$point) return new Object(); |
|
579 | + if(!$point) { |
|
580 | + return new Object(); |
|
581 | + } |
|
477 | 582 | // Increase the point |
478 | 583 | $cur_point += $point; |
479 | 584 | $this->setPoint($member_srl,$cur_point); |
@@ -488,7 +593,9 @@ discard block |
||
488 | 593 | { |
489 | 594 | $member_srl = abs($member_srl); |
490 | 595 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
491 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
596 | + if(!$mode || !in_array($mode,$mode_arr)) { |
|
597 | + $mode = 'update'; |
|
598 | + } |
|
492 | 599 | |
493 | 600 | // Get configuration information |
494 | 601 | $oMemberModel = getModel('member'); |
@@ -518,7 +625,9 @@ discard block |
||
518 | 625 | $args->point = $point; |
519 | 626 | break; |
520 | 627 | } |
521 | - if($args->point < 0) $args->point = 0; |
|
628 | + if($args->point < 0) { |
|
629 | + $args->point = 0; |
|
630 | + } |
|
522 | 631 | $point = $args->point; |
523 | 632 | |
524 | 633 | // Call a trigger (before) |
@@ -540,8 +649,11 @@ discard block |
||
540 | 649 | |
541 | 650 | // If there are points, update, if no, insert |
542 | 651 | $oPointModel = getModel('point'); |
543 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
544 | - else executeQuery("point.insertPoint", $args); |
|
652 | + if($oPointModel->isExistsPoint($member_srl)) { |
|
653 | + executeQuery("point.updatePoint", $args); |
|
654 | + } else { |
|
655 | + executeQuery("point.insertPoint", $args); |
|
656 | + } |
|
545 | 657 | |
546 | 658 | // Get a new level |
547 | 659 | $level = $oPointModel->getLevel($point, $config->level_step); |
@@ -571,7 +683,9 @@ discard block |
||
571 | 683 | foreach($point_group as $group_srl => $target_level) |
572 | 684 | { |
573 | 685 | $del_group_list[] = $group_srl; |
574 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
686 | + if($target_level == $level) { |
|
687 | + $new_group_list[] = $group_srl; |
|
688 | + } |
|
575 | 689 | } |
576 | 690 | } |
577 | 691 | // Otherwise, in case the level is reduced, add the recent group |
@@ -597,7 +711,9 @@ discard block |
||
597 | 711 | // Delete the group of a level which is higher than the current level |
598 | 712 | foreach($point_group as $group_srl => $target_level) |
599 | 713 | { |
600 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
714 | + if($target_level > $level) { |
|
715 | + $del_group_list[] = $group_srl; |
|
716 | + } |
|
601 | 717 | } |
602 | 718 | $del_group_list[] = $default_group->group_srl; |
603 | 719 | } |
@@ -608,11 +724,15 @@ discard block |
||
608 | 724 | foreach($point_group as $group_srl => $target_level) |
609 | 725 | { |
610 | 726 | $del_group_list[] = $group_srl; |
611 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
727 | + if($target_level <= $level) { |
|
728 | + $new_group_list[] = $group_srl; |
|
729 | + } |
|
612 | 730 | } |
613 | 731 | } |
614 | 732 | // If there is no a new group, granted the default group |
615 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
733 | + if(!$new_group_list[0]) { |
|
734 | + $new_group_list[0] = $default_group->group_srl; |
|
735 | + } |
|
616 | 736 | // Remove linkage group |
617 | 737 | if($del_group_list && count($del_group_list)) |
618 | 738 | { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function getInstance() |
25 | 25 | { |
26 | - if(!$GLOBALS['__CacheFile__']) |
|
26 | + if (!$GLOBALS['__CacheFile__']) |
|
27 | 27 | { |
28 | 28 | $GLOBALS['__CacheFile__'] = new CacheFile(); |
29 | 29 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function CacheFile() |
39 | 39 | { |
40 | - $this->cache_dir = _XE_PATH_ . $this->cache_dir; |
|
40 | + $this->cache_dir = _XE_PATH_.$this->cache_dir; |
|
41 | 41 | FileHandler::makeDir($this->cache_dir); |
42 | 42 | } |
43 | 43 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function getCacheFileName($key) |
51 | 51 | { |
52 | - return $this->cache_dir . str_replace(':', DIRECTORY_SEPARATOR, $key) . '.php'; |
|
52 | + return $this->cache_dir.str_replace(':', DIRECTORY_SEPARATOR, $key).'.php'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $content = array(); |
77 | 77 | $content[] = '<?php'; |
78 | 78 | $content[] = 'if(!defined(\'__XE__\')) { exit(); }'; |
79 | - $content[] = 'return \'' . addslashes(serialize($obj)) . '\';'; |
|
79 | + $content[] = 'return \''.addslashes(serialize($obj)).'\';'; |
|
80 | 80 | FileHandler::writeFile($cache_file, implode(PHP_EOL, $content)); |
81 | - if(function_exists('opcache_invalidate')) |
|
81 | + if (function_exists('opcache_invalidate')) |
|
82 | 82 | { |
83 | 83 | @opcache_invalidate($cache_file, true); |
84 | 84 | } |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | { |
96 | 96 | $cache_file = $this->getCacheFileName($key); |
97 | 97 | |
98 | - if(file_exists($cache_file)) |
|
98 | + if (file_exists($cache_file)) |
|
99 | 99 | { |
100 | - if($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
100 | + if ($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
101 | 101 | { |
102 | 102 | FileHandler::removeFile($cache_file); |
103 | 103 | return false; |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function get($key, $modified_time = 0) |
120 | 120 | { |
121 | - if(!$cache_file = FileHandler::exists($this->getCacheFileName($key))) |
|
121 | + if (!$cache_file = FileHandler::exists($this->getCacheFileName($key))) |
|
122 | 122 | { |
123 | 123 | return false; |
124 | 124 | } |
125 | 125 | |
126 | - if($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
126 | + if ($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
127 | 127 | { |
128 | 128 | FileHandler::removeFile($cache_file); |
129 | 129 | return false; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | function _delete($_key) |
144 | 144 | { |
145 | 145 | $cache_file = $this->getCacheFileName($_key); |
146 | - if(function_exists('opcache_invalidate')) |
|
146 | + if (function_exists('opcache_invalidate')) |
|
147 | 147 | { |
148 | 148 | @opcache_invalidate($cache_file, true); |
149 | 149 | } |
@@ -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 Object(-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 Object(-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 Object(-1, 'msg_unwritable_directory'); |
412 | 412 | $output->add('path', FileHandler::getRealPath($check_path)); |
@@ -71,8 +71,7 @@ discard block |
||
71 | 71 | if($type == 'P') |
72 | 72 | { |
73 | 73 | $category_srl = $this->layout_category_srl; |
74 | - } |
|
75 | - else |
|
74 | + } else |
|
76 | 75 | { |
77 | 76 | $category_srl = $this->mobile_layout_category_srl; |
78 | 77 | } |
@@ -103,8 +102,7 @@ discard block |
||
103 | 102 | if($type == 'P') |
104 | 103 | { |
105 | 104 | $category_srl = $this->module_skin_category_srl; |
106 | - } |
|
107 | - else |
|
105 | + } else |
|
108 | 106 | { |
109 | 107 | $category_srl = $this->module_mobile_skin_category_srl; |
110 | 108 | } |
@@ -121,13 +119,11 @@ discard block |
||
121 | 119 | if($type == 'menu') |
122 | 120 | { |
123 | 121 | $params["act"] = "getResourceapiMenuPackageList"; |
124 | - } |
|
125 | - elseif($type == 'skin') |
|
122 | + } elseif($type == 'skin') |
|
126 | 123 | { |
127 | 124 | $params["act"] = "getResourceapiSkinPackageList"; |
128 | 125 | $params['parent_program'] = $parent_program; |
129 | - } |
|
130 | - else |
|
126 | + } else |
|
131 | 127 | { |
132 | 128 | $params["act"] = "getResourceapiPackagelist"; |
133 | 129 | } |
@@ -172,15 +168,13 @@ discard block |
||
172 | 168 | if($output->toBool()==TRUE) |
173 | 169 | { |
174 | 170 | $is_authed = 1; |
175 | - } |
|
176 | - else |
|
171 | + } else |
|
177 | 172 | { |
178 | 173 | $ftp_info = Context::getFTPInfo(); |
179 | 174 | if(!$ftp_info->ftp_root_path) |
180 | 175 | { |
181 | 176 | $is_authed = -1; |
182 | - } |
|
183 | - else |
|
177 | + } else |
|
184 | 178 | { |
185 | 179 | $is_authed = (int) isset($_SESSION['ftp_password']); |
186 | 180 | } |
@@ -216,8 +210,7 @@ discard block |
||
216 | 210 | if($packageInfo->type == 'core') |
217 | 211 | { |
218 | 212 | $title = 'XpressEngine'; |
219 | - } |
|
220 | - else |
|
213 | + } else |
|
221 | 214 | { |
222 | 215 | $configFile = $oModel->getConfigFilePath($packageInfo->type); |
223 | 216 | $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path) . $configFile); |
@@ -238,8 +231,7 @@ discard block |
||
238 | 231 | $type = "layout"; |
239 | 232 | } |
240 | 233 | $title = $xmlDoc->{$type}->title->body; |
241 | - } |
|
242 | - else |
|
234 | + } else |
|
243 | 235 | { |
244 | 236 | $pathInfo = explode('/', $package->path); |
245 | 237 | $title = $pathInfo[count($pathInfo) - 1]; |
@@ -303,8 +295,7 @@ discard block |
||
303 | 295 | { |
304 | 296 | $package->depends[$key]->installed = FALSE; |
305 | 297 | $package->package_srl .= "," . $dep->package_srl; |
306 | - } |
|
307 | - else |
|
298 | + } else |
|
308 | 299 | { |
309 | 300 | $package->depends[$key]->installed = TRUE; |
310 | 301 | $package->depends[$key]->cur_version = $packages[$dep->package_srl]->current_version; |
@@ -318,8 +309,7 @@ discard block |
||
318 | 309 | $package->contain_core = TRUE; |
319 | 310 | $package->contain_core_version = $dep->version; |
320 | 311 | } |
321 | - } |
|
322 | - else |
|
312 | + } else |
|
323 | 313 | { |
324 | 314 | $package->need_update = FALSE; |
325 | 315 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | static $member_config; |
28 | 28 | |
29 | - if($member_config) |
|
29 | + if ($member_config) |
|
30 | 30 | { |
31 | 31 | return $member_config; |
32 | 32 | } |
@@ -35,42 +35,42 @@ discard block |
||
35 | 35 | $oModuleModel = getModel('module'); |
36 | 36 | $config = $oModuleModel->getModuleConfig('member'); |
37 | 37 | |
38 | - if(!$config->signupForm || !is_array($config->signupForm)) |
|
38 | + if (!$config->signupForm || !is_array($config->signupForm)) |
|
39 | 39 | { |
40 | 40 | $oMemberAdminController = getAdminController('member'); |
41 | 41 | $identifier = ($config->identifier) ? $config->identifier : 'email_address'; |
42 | 42 | $config->signupForm = $oMemberAdminController->createSignupForm($identifier); |
43 | 43 | } |
44 | 44 | //for multi language |
45 | - foreach($config->signupForm AS $key=>$value) |
|
45 | + foreach ($config->signupForm AS $key=>$value) |
|
46 | 46 | { |
47 | 47 | $config->signupForm[$key]->title = ($value->isDefaultForm) ? Context::getLang($value->name) : $value->title; |
48 | - if($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y'; |
|
49 | - if($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N'; |
|
48 | + if ($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y'; |
|
49 | + if ($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N'; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // Get terms of user |
53 | 53 | $config->agreement = memberModel::_getAgreement(); |
54 | 54 | |
55 | - if(!$config->webmaster_name) $config->webmaster_name = 'webmaster'; |
|
56 | - if(!$config->image_name_max_width) $config->image_name_max_width = 90; |
|
57 | - if(!$config->image_name_max_height) $config->image_name_max_height = 20; |
|
58 | - if(!$config->image_mark_max_width) $config->image_mark_max_width = 20; |
|
59 | - if(!$config->image_mark_max_height) $config->image_mark_max_height = 20; |
|
60 | - if(!$config->profile_image_max_width) $config->profile_image_max_width = 90; |
|
61 | - if(!$config->profile_image_max_height) $config->profile_image_max_height = 90; |
|
62 | - if(!$config->skin) $config->skin = 'default'; |
|
63 | - if(!$config->colorset) $config->colorset = 'white'; |
|
64 | - if(!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor'; |
|
65 | - if(!$config->group_image_mark) $config->group_image_mark = "N"; |
|
55 | + if (!$config->webmaster_name) $config->webmaster_name = 'webmaster'; |
|
56 | + if (!$config->image_name_max_width) $config->image_name_max_width = 90; |
|
57 | + if (!$config->image_name_max_height) $config->image_name_max_height = 20; |
|
58 | + if (!$config->image_mark_max_width) $config->image_mark_max_width = 20; |
|
59 | + if (!$config->image_mark_max_height) $config->image_mark_max_height = 20; |
|
60 | + if (!$config->profile_image_max_width) $config->profile_image_max_width = 90; |
|
61 | + if (!$config->profile_image_max_height) $config->profile_image_max_height = 90; |
|
62 | + if (!$config->skin) $config->skin = 'default'; |
|
63 | + if (!$config->colorset) $config->colorset = 'white'; |
|
64 | + if (!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor'; |
|
65 | + if (!$config->group_image_mark) $config->group_image_mark = "N"; |
|
66 | 66 | |
67 | - if(!$config->identifier) $config->identifier = 'user_id'; |
|
67 | + if (!$config->identifier) $config->identifier = 'user_id'; |
|
68 | 68 | |
69 | - if(!$config->max_error_count) $config->max_error_count = 10; |
|
70 | - if(!$config->max_error_count_time) $config->max_error_count_time = 300; |
|
69 | + if (!$config->max_error_count) $config->max_error_count = 10; |
|
70 | + if (!$config->max_error_count_time) $config->max_error_count_time = 300; |
|
71 | 71 | |
72 | - if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor'; |
|
73 | - if(!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono'; |
|
72 | + if (!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor'; |
|
73 | + if (!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono'; |
|
74 | 74 | |
75 | 75 | $member_config = $config; |
76 | 76 | |
@@ -79,24 +79,24 @@ discard block |
||
79 | 79 | |
80 | 80 | function _getAgreement() |
81 | 81 | { |
82 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt'; |
|
83 | - if(is_readable($agreement_file)) |
|
82 | + $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.Context::get('lang_type').'.txt'; |
|
83 | + if (is_readable($agreement_file)) |
|
84 | 84 | { |
85 | 85 | return FileHandler::readFile($agreement_file); |
86 | 86 | } |
87 | 87 | |
88 | 88 | $db_info = Context::getDBInfo(); |
89 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . $db_info->lang_type . '.txt'; |
|
90 | - if(is_readable($agreement_file)) |
|
89 | + $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.$db_info->lang_type.'.txt'; |
|
90 | + if (is_readable($agreement_file)) |
|
91 | 91 | { |
92 | 92 | return FileHandler::readFile($agreement_file); |
93 | 93 | } |
94 | 94 | |
95 | 95 | $lang_selected = Context::loadLangSelected(); |
96 | - foreach($lang_selected as $key => $val) |
|
96 | + foreach ($lang_selected as $key => $val) |
|
97 | 97 | { |
98 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . $key . '.txt'; |
|
99 | - if(is_readable($agreement_file)) |
|
98 | + $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.$key.'.txt'; |
|
99 | + if (is_readable($agreement_file)) |
|
100 | 100 | { |
101 | 101 | return FileHandler::readFile($agreement_file); |
102 | 102 | } |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | $logged_info = Context::get('logged_info'); |
117 | 117 | $act = Context::get('cur_act'); |
118 | 118 | // When click user's own nickname |
119 | - if($member_srl == $logged_info->member_srl) $member_info = $logged_info; |
|
119 | + if ($member_srl == $logged_info->member_srl) $member_info = $logged_info; |
|
120 | 120 | // When click other's nickname |
121 | 121 | else $member_info = $this->getMemberInfoByMemberSrl($member_srl); |
122 | 122 | |
123 | 123 | $member_srl = $member_info->member_srl; |
124 | - if(!$member_srl) return; |
|
124 | + if (!$member_srl) return; |
|
125 | 125 | // List variables |
126 | 126 | $user_id = $member_info->user_id; |
127 | 127 | $user_name = $member_info->user_name; |
@@ -130,18 +130,18 @@ discard block |
||
130 | 130 | |
131 | 131 | $oMemberController = getController('member'); |
132 | 132 | // Display member information (Don't display to non-logged user) |
133 | - if($logged_info->member_srl) |
|
133 | + if ($logged_info->member_srl) |
|
134 | 134 | { |
135 | - $url = getUrl('','mid',$mid,'act','dispMemberInfo','member_srl',$member_srl); |
|
136 | - $oMemberController->addMemberPopupMenu($url,'cmd_view_member_info',$icon_path,'self'); |
|
135 | + $url = getUrl('', 'mid', $mid, 'act', 'dispMemberInfo', 'member_srl', $member_srl); |
|
136 | + $oMemberController->addMemberPopupMenu($url, 'cmd_view_member_info', $icon_path, 'self'); |
|
137 | 137 | } |
138 | 138 | // When click other's nickname |
139 | - if($member_srl != $logged_info->member_srl && $logged_info->member_srl) |
|
139 | + if ($member_srl != $logged_info->member_srl && $logged_info->member_srl) |
|
140 | 140 | { |
141 | 141 | // Get email config |
142 | - foreach($this->module_config->signupForm as $field) |
|
142 | + foreach ($this->module_config->signupForm as $field) |
|
143 | 143 | { |
144 | - if($field->name == 'email_address') |
|
144 | + if ($field->name == 'email_address') |
|
145 | 145 | { |
146 | 146 | $email_config = $field; |
147 | 147 | break; |
@@ -149,36 +149,36 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | // Send an email only if email address is public |
152 | - if(($logged_info->is_admin == 'Y' || $email_config->isPublic == 'Y') && $member_info->email_address) |
|
152 | + if (($logged_info->is_admin == 'Y' || $email_config->isPublic == 'Y') && $member_info->email_address) |
|
153 | 153 | { |
154 | 154 | $url = 'mailto:'.htmlspecialchars($member_info->email_address, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
155 | - $oMemberController->addMemberPopupMenu($url,'cmd_send_email',$icon_path); |
|
155 | + $oMemberController->addMemberPopupMenu($url, 'cmd_send_email', $icon_path); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | // View homepage info |
159 | - if($member_info->homepage) |
|
159 | + if ($member_info->homepage) |
|
160 | 160 | $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank'); |
161 | 161 | // View blog info |
162 | - if($member_info->blog) |
|
162 | + if ($member_info->blog) |
|
163 | 163 | $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'blog', '', 'blank'); |
164 | 164 | // Call a trigger (after) |
165 | 165 | ModuleHandler::triggerCall('member.getMemberMenu', 'after', $null); |
166 | 166 | // Display a menu for editting member info to a top administrator |
167 | - if($logged_info->is_admin == 'Y') |
|
167 | + if ($logged_info->is_admin == 'Y') |
|
168 | 168 | { |
169 | - $url = getUrl('','module','admin','act','dispMemberAdminInsert','member_srl',$member_srl); |
|
170 | - $oMemberController->addMemberPopupMenu($url,'cmd_manage_member_info',$icon_path,'MemberModifyInfo'); |
|
169 | + $url = getUrl('', 'module', 'admin', 'act', 'dispMemberAdminInsert', 'member_srl', $member_srl); |
|
170 | + $oMemberController->addMemberPopupMenu($url, 'cmd_manage_member_info', $icon_path, 'MemberModifyInfo'); |
|
171 | 171 | |
172 | - $url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','member_srl','search_keyword',$member_srl); |
|
173 | - $oMemberController->addMemberPopupMenu($url,'cmd_trace_document',$icon_path,'TraceMemberDocument'); |
|
172 | + $url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'member_srl', 'search_keyword', $member_srl); |
|
173 | + $oMemberController->addMemberPopupMenu($url, 'cmd_trace_document', $icon_path, 'TraceMemberDocument'); |
|
174 | 174 | |
175 | - $url = getUrl('','module','admin','act','dispCommentAdminList','search_target','member_srl','search_keyword',$member_srl); |
|
176 | - $oMemberController->addMemberPopupMenu($url,'cmd_trace_comment',$icon_path,'TraceMemberComment'); |
|
175 | + $url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'member_srl', 'search_keyword', $member_srl); |
|
176 | + $oMemberController->addMemberPopupMenu($url, 'cmd_trace_comment', $icon_path, 'TraceMemberComment'); |
|
177 | 177 | } |
178 | 178 | // Change a language of pop-up menu |
179 | 179 | $menus = Context::get('member_popup_menu_list'); |
180 | 180 | $menus_count = count($menus); |
181 | - for($i=0;$i<$menus_count;$i++) |
|
181 | + for ($i = 0; $i < $menus_count; $i++) |
|
182 | 182 | { |
183 | 183 | $menus[$i]->str = Context::getLang($menus[$i]->str); |
184 | 184 | } |
@@ -190,16 +190,16 @@ discard block |
||
190 | 190 | * @brief Check if logged-in |
191 | 191 | */ |
192 | 192 | function isLogged() { |
193 | - if($_SESSION['is_logged']) |
|
193 | + if ($_SESSION['is_logged']) |
|
194 | 194 | { |
195 | - if(Mobile::isFromMobilePhone()) |
|
195 | + if (Mobile::isFromMobilePhone()) |
|
196 | 196 | { |
197 | 197 | return true; |
198 | 198 | } |
199 | - elseif(filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
199 | + elseif (filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
200 | 200 | { |
201 | 201 | // IPv6: require same /48 |
202 | - if(strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0) |
|
202 | + if (strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0) |
|
203 | 203 | { |
204 | 204 | return true; |
205 | 205 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | else |
208 | 208 | { |
209 | 209 | // IPv4: require same /24 |
210 | - if(ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8) |
|
210 | + if (ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8) |
|
211 | 211 | { |
212 | 212 | return true; |
213 | 213 | } |
@@ -224,23 +224,23 @@ discard block |
||
224 | 224 | function getLoggedInfo() |
225 | 225 | { |
226 | 226 | // Return session info if session info is requested and the user is logged-in |
227 | - if($this->isLogged()) |
|
227 | + if ($this->isLogged()) |
|
228 | 228 | { |
229 | 229 | $logged_info = Context::get('logged_info'); |
230 | 230 | // Admin/Group list defined depending on site_module_info |
231 | 231 | $site_module_info = Context::get('site_module_info'); |
232 | - if($site_module_info->site_srl) |
|
232 | + if ($site_module_info->site_srl) |
|
233 | 233 | { |
234 | 234 | $logged_info->group_list = $this->getMemberGroups($logged_info->member_srl, $site_module_info->site_srl); |
235 | 235 | // Add is_site_admin bool variable into logged_info if site_administrator is |
236 | 236 | $oModuleModel = getModel('module'); |
237 | - if($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true; |
|
237 | + if ($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true; |
|
238 | 238 | else $logged_info->is_site_admin = false; |
239 | 239 | } |
240 | 240 | else |
241 | 241 | { |
242 | 242 | // Register a default group if the site doesn't have a member group |
243 | - if(count($logged_info->group_list) === 0) |
|
243 | + if (count($logged_info->group_list) === 0) |
|
244 | 244 | { |
245 | 245 | $default_group = $this->getDefaultGroup(0); |
246 | 246 | $oMemberController = getController('member'); |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | */ |
264 | 264 | function getMemberInfoByUserID($user_id, $columnList = array()) |
265 | 265 | { |
266 | - if(!$user_id) return; |
|
266 | + if (!$user_id) return; |
|
267 | 267 | |
268 | 268 | $args = new stdClass; |
269 | 269 | $args->user_id = $user_id; |
270 | 270 | $output = executeQuery('member.getMemberInfo', $args); |
271 | - if(!$output->toBool()) return $output; |
|
272 | - if(!$output->data) return; |
|
271 | + if (!$output->toBool()) return $output; |
|
272 | + if (!$output->data) return; |
|
273 | 273 | |
274 | 274 | $member_info = $this->arrangeMemberInfo($output->data); |
275 | 275 | |
@@ -281,12 +281,12 @@ discard block |
||
281 | 281 | */ |
282 | 282 | function getMemberInfoByEmailAddress($email_address) |
283 | 283 | { |
284 | - if(!$email_address) return; |
|
284 | + if (!$email_address) return; |
|
285 | 285 | |
286 | 286 | $args = new stdClass(); |
287 | 287 | |
288 | - $db_info = Context::getDBInfo (); |
|
289 | - if($db_info->master_db['db_type'] == "cubrid") |
|
288 | + $db_info = Context::getDBInfo(); |
|
289 | + if ($db_info->master_db['db_type'] == "cubrid") |
|
290 | 290 | { |
291 | 291 | $args->email_address = strtolower($email_address); |
292 | 292 | $output = executeQuery('member.getMemberInfoByEmailAddressForCubrid', $args); |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | $output = executeQuery('member.getMemberInfoByEmailAddress', $args); |
298 | 298 | } |
299 | 299 | |
300 | - if(!$output->toBool()) return $output; |
|
301 | - if(!$output->data) return; |
|
300 | + if (!$output->toBool()) return $output; |
|
301 | + if (!$output->data) return; |
|
302 | 302 | |
303 | 303 | $member_info = $this->arrangeMemberInfo($output->data); |
304 | 304 | return $member_info; |
@@ -309,36 +309,36 @@ discard block |
||
309 | 309 | */ |
310 | 310 | function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array()) |
311 | 311 | { |
312 | - if(!$member_srl) return; |
|
312 | + if (!$member_srl) return; |
|
313 | 313 | |
314 | 314 | //columnList size zero... get full member info |
315 | - if(!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0) |
|
315 | + if (!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0) |
|
316 | 316 | { |
317 | 317 | $GLOBALS['__member_info__'][$member_srl] = false; |
318 | 318 | |
319 | 319 | $oCacheHandler = CacheHandler::getInstance('object'); |
320 | - if($oCacheHandler->isSupport()) |
|
320 | + if ($oCacheHandler->isSupport()) |
|
321 | 321 | { |
322 | 322 | $columnList = array(); |
323 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
323 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
324 | 324 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
325 | 325 | $GLOBALS['__member_info__'][$member_srl] = $oCacheHandler->get($cache_key); |
326 | 326 | } |
327 | 327 | |
328 | - if($GLOBALS['__member_info__'][$member_srl] === false) |
|
328 | + if ($GLOBALS['__member_info__'][$member_srl] === false) |
|
329 | 329 | { |
330 | 330 | $args = new stdClass(); |
331 | 331 | $args->member_srl = $member_srl; |
332 | 332 | $output = executeQuery('member.getMemberInfoByMemberSrl', $args, $columnList); |
333 | - if(!$output->data) |
|
333 | + if (!$output->data) |
|
334 | 334 | { |
335 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass); |
|
335 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass); |
|
336 | 336 | return; |
337 | 337 | } |
338 | 338 | $this->arrangeMemberInfo($output->data, $site_srl); |
339 | 339 | |
340 | 340 | //insert in cache |
341 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]); |
|
341 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]); |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | */ |
351 | 351 | function arrangeMemberInfo($info, $site_srl = 0) |
352 | 352 | { |
353 | - if(!$GLOBALS['__member_info__'][$info->member_srl]) |
|
353 | + if (!$GLOBALS['__member_info__'][$info->member_srl]) |
|
354 | 354 | { |
355 | 355 | $oModuleModel = getModel('module'); |
356 | 356 | $config = $oModuleModel->getModuleConfig('member'); |
@@ -359,25 +359,25 @@ discard block |
||
359 | 359 | $info->profile_image = $this->getProfileImage($info->member_srl); |
360 | 360 | $info->image_name = $this->getImageName($info->member_srl); |
361 | 361 | $info->image_mark = $this->getImageMark($info->member_srl); |
362 | - if($config->group_image_mark=='Y') |
|
362 | + if ($config->group_image_mark == 'Y') |
|
363 | 363 | { |
364 | - $info->group_mark = $this->getGroupImageMark($info->member_srl,$site_srl); |
|
364 | + $info->group_mark = $this->getGroupImageMark($info->member_srl, $site_srl); |
|
365 | 365 | } |
366 | 366 | $info->signature = $this->getSignature($info->member_srl); |
367 | 367 | $info->group_list = $this->getMemberGroups($info->member_srl, $site_srl); |
368 | 368 | |
369 | 369 | $extra_vars = unserialize($info->extra_vars); |
370 | 370 | unset($info->extra_vars); |
371 | - if($extra_vars) |
|
371 | + if ($extra_vars) |
|
372 | 372 | { |
373 | - foreach($extra_vars as $key => $val) |
|
373 | + foreach ($extra_vars as $key => $val) |
|
374 | 374 | { |
375 | - if(!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val); |
|
376 | - if(!$info->{$key}) $info->{$key} = $val; |
|
375 | + if (!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val); |
|
376 | + if (!$info->{$key}) $info->{$key} = $val; |
|
377 | 377 | } |
378 | 378 | } |
379 | 379 | |
380 | - if(strlen($info->find_account_answer) == 32 && preg_match('/[a-zA-Z0-9]+/', $info->find_account_answer)) |
|
380 | + if (strlen($info->find_account_answer) == 32 && preg_match('/[a-zA-Z0-9]+/', $info->find_account_answer)) |
|
381 | 381 | { |
382 | 382 | $info->find_account_answer = null; |
383 | 383 | } |
@@ -389,13 +389,13 @@ discard block |
||
389 | 389 | $info->homepage = strip_tags($info->homepage); |
390 | 390 | $info->blog = strip_tags($info->blog); |
391 | 391 | |
392 | - if($extra_vars) |
|
392 | + if ($extra_vars) |
|
393 | 393 | { |
394 | - foreach($extra_vars as $key => $val) |
|
394 | + foreach ($extra_vars as $key => $val) |
|
395 | 395 | { |
396 | - if(is_array($val)) |
|
396 | + if (is_array($val)) |
|
397 | 397 | { |
398 | - $oSecurity->encodeHTML($key . '.'); |
|
398 | + $oSecurity->encodeHTML($key.'.'); |
|
399 | 399 | } |
400 | 400 | else |
401 | 401 | { |
@@ -406,12 +406,12 @@ discard block |
||
406 | 406 | |
407 | 407 | // Check format. |
408 | 408 | $oValidator = new Validator(); |
409 | - if(!$oValidator->applyRule('url', $info->homepage)) |
|
409 | + if (!$oValidator->applyRule('url', $info->homepage)) |
|
410 | 410 | { |
411 | 411 | $info->homepage = ''; |
412 | 412 | } |
413 | 413 | |
414 | - if(!$oValidator->applyRule('url', $info->blog)) |
|
414 | + if (!$oValidator->applyRule('url', $info->blog)) |
|
415 | 415 | { |
416 | 416 | $info->blog = ''; |
417 | 417 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | */ |
461 | 461 | function getLoggedMemberSrl() |
462 | 462 | { |
463 | - if(!$this->isLogged()) return; |
|
463 | + if (!$this->isLogged()) return; |
|
464 | 464 | return $_SESSION['member_srl']; |
465 | 465 | } |
466 | 466 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | */ |
470 | 470 | function getLoggedUserID() |
471 | 471 | { |
472 | - if(!$this->isLogged()) return; |
|
472 | + if (!$this->isLogged()) return; |
|
473 | 473 | $logged_info = Context::get('logged_info'); |
474 | 474 | return $logged_info->user_id; |
475 | 475 | } |
@@ -484,16 +484,16 @@ discard block |
||
484 | 484 | // cache controll |
485 | 485 | $group_list = false; |
486 | 486 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
487 | - if($oCacheHandler->isSupport()) |
|
487 | + if ($oCacheHandler->isSupport()) |
|
488 | 488 | { |
489 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_'.$site_srl; |
|
489 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_'.$site_srl; |
|
490 | 490 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
491 | 491 | $group_list = $oCacheHandler->get($cache_key); |
492 | 492 | } |
493 | 493 | |
494 | - if(!$member_groups[$member_srl][$site_srl] || $force_reload) |
|
494 | + if (!$member_groups[$member_srl][$site_srl] || $force_reload) |
|
495 | 495 | { |
496 | - if($group_list === false) |
|
496 | + if ($group_list === false) |
|
497 | 497 | { |
498 | 498 | $args = new stdClass(); |
499 | 499 | $args->member_srl = $member_srl; |
@@ -501,11 +501,11 @@ discard block |
||
501 | 501 | $output = executeQueryArray('member.getMemberGroups', $args); |
502 | 502 | $group_list = $output->data; |
503 | 503 | //insert in cache |
504 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
504 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
505 | 505 | } |
506 | - if(!$group_list) return array(); |
|
506 | + if (!$group_list) return array(); |
|
507 | 507 | |
508 | - foreach($group_list as $group) |
|
508 | + foreach ($group_list as $group) |
|
509 | 509 | { |
510 | 510 | $result[$group->group_srl] = $group->title; |
511 | 511 | } |
@@ -519,14 +519,14 @@ discard block |
||
519 | 519 | */ |
520 | 520 | function getMembersGroups($member_srls, $site_srl = 0) |
521 | 521 | { |
522 | - $args->member_srls = implode(',',$member_srls); |
|
522 | + $args->member_srls = implode(',', $member_srls); |
|
523 | 523 | $args->site_srl = $site_srl; |
524 | 524 | $args->sort_index = 'list_order'; |
525 | 525 | $output = executeQueryArray('member.getMembersGroups', $args); |
526 | - if(!$output->data) return array(); |
|
526 | + if (!$output->data) return array(); |
|
527 | 527 | |
528 | 528 | $result = array(); |
529 | - foreach($output->data as $key=>$val) |
|
529 | + foreach ($output->data as $key=>$val) |
|
530 | 530 | { |
531 | 531 | $result[$val->member_srl][] = $val->title; |
532 | 532 | } |
@@ -540,21 +540,21 @@ discard block |
||
540 | 540 | { |
541 | 541 | $default_group = false; |
542 | 542 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
543 | - if($oCacheHandler->isSupport()) |
|
543 | + if ($oCacheHandler->isSupport()) |
|
544 | 544 | { |
545 | 545 | $columnList = array(); |
546 | - $object_key = 'default_group_' . $site_srl; |
|
546 | + $object_key = 'default_group_'.$site_srl; |
|
547 | 547 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
548 | 548 | $default_group = $oCacheHandler->get($cache_key); |
549 | 549 | } |
550 | 550 | |
551 | - if($default_group === false) |
|
551 | + if ($default_group === false) |
|
552 | 552 | { |
553 | 553 | $args = new stdClass(); |
554 | 554 | $args->site_srl = $site_srl; |
555 | 555 | $output = executeQuery('member.getDefaultGroup', $args, $columnList); |
556 | 556 | $default_group = $output->data; |
557 | - if($oCacheHandler->isSupport()) |
|
557 | + if ($oCacheHandler->isSupport()) |
|
558 | 558 | { |
559 | 559 | $oCacheHandler->put($cache_key, $default_group); |
560 | 560 | } |
@@ -588,25 +588,25 @@ discard block |
||
588 | 588 | */ |
589 | 589 | function getGroups($site_srl = 0) |
590 | 590 | { |
591 | - if(!$GLOBALS['__group_info__'][$site_srl]) |
|
591 | + if (!$GLOBALS['__group_info__'][$site_srl]) |
|
592 | 592 | { |
593 | 593 | $result = array(); |
594 | 594 | |
595 | - if(!isset($site_srl)) |
|
595 | + if (!isset($site_srl)) |
|
596 | 596 | { |
597 | 597 | $site_srl = 0; |
598 | 598 | } |
599 | 599 | |
600 | 600 | $group_list = false; |
601 | 601 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
602 | - if($oCacheHandler->isSupport()) |
|
602 | + if ($oCacheHandler->isSupport()) |
|
603 | 603 | { |
604 | 604 | $object_key = 'member_groups:site_'.$site_srl; |
605 | 605 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
606 | 606 | $group_list = $oCacheHandler->get($cache_key); |
607 | 607 | } |
608 | 608 | |
609 | - if($group_list === false) |
|
609 | + if ($group_list === false) |
|
610 | 610 | { |
611 | 611 | $args = new stdClass(); |
612 | 612 | $args->site_srl = $site_srl; |
@@ -615,16 +615,16 @@ discard block |
||
615 | 615 | $output = executeQueryArray('member.getGroups', $args); |
616 | 616 | $group_list = $output->data; |
617 | 617 | //insert in cache |
618 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
618 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
619 | 619 | } |
620 | 620 | |
621 | - if(!$group_list) |
|
621 | + if (!$group_list) |
|
622 | 622 | { |
623 | 623 | return array(); |
624 | 624 | } |
625 | 625 | |
626 | 626 | |
627 | - foreach($group_list as $val) |
|
627 | + foreach ($group_list as $val) |
|
628 | 628 | { |
629 | 629 | $result[$val->group_srl] = $val; |
630 | 630 | } |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | // Set to ignore if a super administrator. |
656 | 656 | $logged_info = Context::get('logged_info'); |
657 | 657 | |
658 | - if(!$this->join_form_list) |
|
658 | + if (!$this->join_form_list) |
|
659 | 659 | { |
660 | 660 | // Argument setting to sort list_order column |
661 | 661 | $args = new stdClass(); |
@@ -663,11 +663,11 @@ discard block |
||
663 | 663 | $output = executeQuery('member.getJoinFormList', $args); |
664 | 664 | // NULL if output data deosn't exist |
665 | 665 | $join_form_list = $output->data; |
666 | - if(!$join_form_list) return NULL; |
|
666 | + if (!$join_form_list) return NULL; |
|
667 | 667 | // Need to unserialize because serialized array is inserted into DB in case of default_value |
668 | - if(!is_array($join_form_list)) $join_form_list = array($join_form_list); |
|
668 | + if (!is_array($join_form_list)) $join_form_list = array($join_form_list); |
|
669 | 669 | $join_form_count = count($join_form_list); |
670 | - for($i=0;$i<$join_form_count;$i++) |
|
670 | + for ($i = 0; $i < $join_form_count; $i++) |
|
671 | 671 | { |
672 | 672 | $join_form_list[$i]->column_name = strtolower($join_form_list[$i]->column_name); |
673 | 673 | |
@@ -679,10 +679,10 @@ discard block |
||
679 | 679 | // Add language variable |
680 | 680 | $lang->extend_vars[$column_name] = $column_title; |
681 | 681 | // unserialize if the data type if checkbox, select and so on |
682 | - if(in_array($column_type, array('checkbox','select','radio'))) |
|
682 | + if (in_array($column_type, array('checkbox', 'select', 'radio'))) |
|
683 | 683 | { |
684 | 684 | $join_form_list[$i]->default_value = unserialize($default_value); |
685 | - if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = ''; |
|
685 | + if (!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = ''; |
|
686 | 686 | } |
687 | 687 | else |
688 | 688 | { |
@@ -694,16 +694,16 @@ discard block |
||
694 | 694 | $this->join_form_list = $list; |
695 | 695 | } |
696 | 696 | // Get object style if the filter_response is true |
697 | - if($filter_response && count($this->join_form_list)) |
|
697 | + if ($filter_response && count($this->join_form_list)) |
|
698 | 698 | { |
699 | - foreach($this->join_form_list as $key => $val) |
|
699 | + foreach ($this->join_form_list as $key => $val) |
|
700 | 700 | { |
701 | - if($val->is_active != 'Y') continue; |
|
701 | + if ($val->is_active != 'Y') continue; |
|
702 | 702 | unset($obj); |
703 | 703 | $obj->type = $val->column_type; |
704 | 704 | $obj->name = $val->column_name; |
705 | 705 | $obj->lang = $val->column_title; |
706 | - if($logged_info->is_admin != 'Y') $obj->required = $val->required=='Y'?true:false; |
|
706 | + if ($logged_info->is_admin != 'Y') $obj->required = $val->required == 'Y' ? true : false; |
|
707 | 707 | else $obj->required = false; |
708 | 708 | $filter_output[] = $obj; |
709 | 709 | |
@@ -730,15 +730,15 @@ discard block |
||
730 | 730 | $args->sort_index = "list_order"; |
731 | 731 | $output = executeQueryArray('member.getJoinFormList', $args); |
732 | 732 | |
733 | - if(!$output->toBool()) |
|
733 | + if (!$output->toBool()) |
|
734 | 734 | { |
735 | 735 | return array(); |
736 | 736 | } |
737 | 737 | |
738 | 738 | $joinFormList = array(); |
739 | - foreach($output->data as $val) |
|
739 | + foreach ($output->data as $val) |
|
740 | 740 | { |
741 | - if($val->is_active != 'Y') |
|
741 | + if ($val->is_active != 'Y') |
|
742 | 742 | { |
743 | 743 | continue; |
744 | 744 | } |
@@ -755,20 +755,20 @@ discard block |
||
755 | 755 | function getCombineJoinForm($member_info) |
756 | 756 | { |
757 | 757 | $extend_form_list = $this->getJoinFormlist(); |
758 | - if(!$extend_form_list) return; |
|
758 | + if (!$extend_form_list) return; |
|
759 | 759 | // Member info is open only to an administrator and him/herself when is_private is true. |
760 | 760 | $logged_info = Context::get('logged_info'); |
761 | 761 | |
762 | - foreach($extend_form_list as $srl => $item) |
|
762 | + foreach ($extend_form_list as $srl => $item) |
|
763 | 763 | { |
764 | 764 | $column_name = $item->column_name; |
765 | 765 | $value = $member_info->{$column_name}; |
766 | 766 | |
767 | 767 | // Change values depening on the type of extend form |
768 | - switch($item->column_type) |
|
768 | + switch ($item->column_type) |
|
769 | 769 | { |
770 | 770 | case 'checkbox' : |
771 | - if($value && !is_array($value)) $value = array($value); |
|
771 | + if ($value && !is_array($value)) $value = array($value); |
|
772 | 772 | break; |
773 | 773 | case 'text' : |
774 | 774 | case 'homepage' : |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | |
783 | 783 | $extend_form_list[$srl]->value = $value; |
784 | 784 | |
785 | - if($member_info->{'open_'.$column_name}=='Y') $extend_form_list[$srl]->is_opened = true; |
|
785 | + if ($member_info->{'open_'.$column_name} == 'Y') $extend_form_list[$srl]->is_opened = true; |
|
786 | 786 | else $extend_form_list[$srl]->is_opened = false; |
787 | 787 | } |
788 | 788 | return $extend_form_list; |
@@ -796,12 +796,12 @@ discard block |
||
796 | 796 | $args->member_join_form_srl = $member_join_form_srl; |
797 | 797 | $output = executeQuery('member.getJoinForm', $args); |
798 | 798 | $join_form = $output->data; |
799 | - if(!$join_form) return NULL; |
|
799 | + if (!$join_form) return NULL; |
|
800 | 800 | |
801 | 801 | $column_type = $join_form->column_type; |
802 | 802 | $default_value = $join_form->default_value; |
803 | 803 | |
804 | - if(in_array($column_type, array('checkbox','select','radio'))) |
|
804 | + if (in_array($column_type, array('checkbox', 'select', 'radio'))) |
|
805 | 805 | { |
806 | 806 | $join_form->default_value = unserialize($default_value); |
807 | 807 | } |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | */ |
819 | 819 | function getDeniedIDList() |
820 | 820 | { |
821 | - if(!$this->denied_id_list) |
|
821 | + if (!$this->denied_id_list) |
|
822 | 822 | { |
823 | 823 | $args->sort_index = "list_order"; |
824 | 824 | $args->page = Context::get('page'); |
@@ -834,14 +834,14 @@ discard block |
||
834 | 834 | function getDeniedIDs() |
835 | 835 | { |
836 | 836 | $output = executeQueryArray('member.getDeniedIDs'); |
837 | - if(!$output->toBool()) return array(); |
|
837 | + if (!$output->toBool()) return array(); |
|
838 | 838 | return $output->data; |
839 | 839 | } |
840 | 840 | |
841 | 841 | function getDeniedNickNames() |
842 | 842 | { |
843 | 843 | $output = executeQueryArray('member.getDeniedNickNames'); |
844 | - if(!$output->toBool()) |
|
844 | + if (!$output->toBool()) |
|
845 | 845 | { |
846 | 846 | return array(); |
847 | 847 | } |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | $args = new stdClass(); |
858 | 858 | $args->user_id = $user_id; |
859 | 859 | $output = executeQuery('member.chkDeniedID', $args); |
860 | - if($output->data->count) return true; |
|
860 | + if ($output->data->count) return true; |
|
861 | 861 | return false; |
862 | 862 | } |
863 | 863 | |
@@ -869,8 +869,8 @@ discard block |
||
869 | 869 | $args = new stdClass(); |
870 | 870 | $args->nick_name = $nickName; |
871 | 871 | $output = executeQuery('member.chkDeniedNickName', $args); |
872 | - if($output->data->count) return true; |
|
873 | - if(!$output->toBool()) |
|
872 | + if ($output->data->count) return true; |
|
873 | + if (!$output->toBool()) |
|
874 | 874 | { |
875 | 875 | return true; |
876 | 876 | } |
@@ -881,20 +881,20 @@ discard block |
||
881 | 881 | */ |
882 | 882 | function getProfileImage($member_srl) |
883 | 883 | { |
884 | - if(!isset($GLOBALS['__member_info__']['profile_image'][$member_srl])) |
|
884 | + if (!isset($GLOBALS['__member_info__']['profile_image'][$member_srl])) |
|
885 | 885 | { |
886 | 886 | $GLOBALS['__member_info__']['profile_image'][$member_srl] = null; |
887 | - $exts = array('gif','jpg','png'); |
|
888 | - for($i=0;$i<3;$i++) |
|
887 | + $exts = array('gif', 'jpg', 'png'); |
|
888 | + for ($i = 0; $i < 3; $i++) |
|
889 | 889 | { |
890 | 890 | $image_name_file = sprintf('files/member_extra_info/profile_image/%s%d.%s', getNumberingPath($member_srl), $member_srl, $exts[$i]); |
891 | - if(file_exists($image_name_file)) |
|
891 | + if (file_exists($image_name_file)) |
|
892 | 892 | { |
893 | 893 | list($width, $height, $type, $attrs) = getimagesize($image_name_file); |
894 | 894 | $info = new stdClass(); |
895 | 895 | $info->width = $width; |
896 | 896 | $info->height = $height; |
897 | - $info->src = Context::getRequestUri().$image_name_file . '?' . date('YmdHis', filemtime($image_name_file)); |
|
897 | + $info->src = Context::getRequestUri().$image_name_file.'?'.date('YmdHis', filemtime($image_name_file)); |
|
898 | 898 | $info->file = './'.$image_name_file; |
899 | 899 | $GLOBALS['__member_info__']['profile_image'][$member_srl] = $info; |
900 | 900 | break; |
@@ -910,16 +910,16 @@ discard block |
||
910 | 910 | */ |
911 | 911 | function getImageName($member_srl) |
912 | 912 | { |
913 | - if(!isset($GLOBALS['__member_info__']['image_name'][$member_srl])) |
|
913 | + if (!isset($GLOBALS['__member_info__']['image_name'][$member_srl])) |
|
914 | 914 | { |
915 | 915 | $image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl); |
916 | - if(file_exists($image_name_file)) |
|
916 | + if (file_exists($image_name_file)) |
|
917 | 917 | { |
918 | 918 | list($width, $height, $type, $attrs) = getimagesize($image_name_file); |
919 | 919 | $info = new stdClass; |
920 | 920 | $info->width = $width; |
921 | 921 | $info->height = $height; |
922 | - $info->src = Context::getRequestUri().$image_name_file. '?' . date('YmdHis', filemtime($image_name_file)); |
|
922 | + $info->src = Context::getRequestUri().$image_name_file.'?'.date('YmdHis', filemtime($image_name_file)); |
|
923 | 923 | $info->file = './'.$image_name_file; |
924 | 924 | $GLOBALS['__member_info__']['image_name'][$member_srl] = $info; |
925 | 925 | } |
@@ -933,15 +933,15 @@ discard block |
||
933 | 933 | */ |
934 | 934 | function getImageMark($member_srl) |
935 | 935 | { |
936 | - if(!isset($GLOBALS['__member_info__']['image_mark'][$member_srl])) |
|
936 | + if (!isset($GLOBALS['__member_info__']['image_mark'][$member_srl])) |
|
937 | 937 | { |
938 | 938 | $image_mark_file = sprintf('files/member_extra_info/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl); |
939 | - if(file_exists($image_mark_file)) |
|
939 | + if (file_exists($image_mark_file)) |
|
940 | 940 | { |
941 | 941 | list($width, $height, $type, $attrs) = getimagesize($image_mark_file); |
942 | 942 | $info->width = $width; |
943 | 943 | $info->height = $height; |
944 | - $info->src = Context::getRequestUri().$image_mark_file . '?' . date('YmdHis', filemtime($image_mark_file)); |
|
944 | + $info->src = Context::getRequestUri().$image_mark_file.'?'.date('YmdHis', filemtime($image_mark_file)); |
|
945 | 945 | $info->file = './'.$image_mark_file; |
946 | 946 | $GLOBALS['__member_info__']['image_mark'][$member_srl] = $info; |
947 | 947 | } |
@@ -955,27 +955,27 @@ discard block |
||
955 | 955 | /** |
956 | 956 | * @brief Get the image mark of the group |
957 | 957 | */ |
958 | - function getGroupImageMark($member_srl,$site_srl=0) |
|
958 | + function getGroupImageMark($member_srl, $site_srl = 0) |
|
959 | 959 | { |
960 | - if(!isset($GLOBALS['__member_info__']['group_image_mark'][$member_srl])) |
|
960 | + if (!isset($GLOBALS['__member_info__']['group_image_mark'][$member_srl])) |
|
961 | 961 | { |
962 | 962 | $oModuleModel = getModel('module'); |
963 | 963 | $config = $oModuleModel->getModuleConfig('member'); |
964 | - if($config->group_image_mark!='Y') |
|
964 | + if ($config->group_image_mark != 'Y') |
|
965 | 965 | { |
966 | 966 | return null; |
967 | 967 | } |
968 | - $member_group = $this->getMemberGroups($member_srl,$site_srl); |
|
968 | + $member_group = $this->getMemberGroups($member_srl, $site_srl); |
|
969 | 969 | $groups_info = $this->getGroups($site_srl); |
970 | - if(count($member_group) > 0 && is_array($member_group)) |
|
970 | + if (count($member_group) > 0 && is_array($member_group)) |
|
971 | 971 | { |
972 | 972 | $memberGroups = array_keys($member_group); |
973 | 973 | |
974 | - foreach($groups_info as $group_srl=>$group_info) |
|
974 | + foreach ($groups_info as $group_srl=>$group_info) |
|
975 | 975 | { |
976 | - if(in_array($group_srl, $memberGroups)) |
|
976 | + if (in_array($group_srl, $memberGroups)) |
|
977 | 977 | { |
978 | - if($group_info->image_mark) |
|
978 | + if ($group_info->image_mark) |
|
979 | 979 | { |
980 | 980 | $info = new stdClass(); |
981 | 981 | $info->title = $group_info->title; |
@@ -999,10 +999,10 @@ discard block |
||
999 | 999 | */ |
1000 | 1000 | function getSignature($member_srl) |
1001 | 1001 | { |
1002 | - if(!isset($GLOBALS['__member_info__']['signature'][$member_srl])) |
|
1002 | + if (!isset($GLOBALS['__member_info__']['signature'][$member_srl])) |
|
1003 | 1003 | { |
1004 | 1004 | $filename = sprintf('files/member_extra_info/signature/%s%d.signature.php', getNumberingPath($member_srl), $member_srl); |
1005 | - if(file_exists($filename)) |
|
1005 | + if (file_exists($filename)) |
|
1006 | 1006 | { |
1007 | 1007 | $buff = FileHandler::readFile($filename); |
1008 | 1008 | $signature = preg_replace('/<\?.*\?>/', '', $buff); |
@@ -1020,10 +1020,10 @@ discard block |
||
1020 | 1020 | * @param int $member_srl Set this to member_srl when comparing a member's password (optional) |
1021 | 1021 | * @return bool |
1022 | 1022 | */ |
1023 | - function isValidPassword($hashed_password, $password_text, $member_srl=null) |
|
1023 | + function isValidPassword($hashed_password, $password_text, $member_srl = null) |
|
1024 | 1024 | { |
1025 | 1025 | // False if no password in entered |
1026 | - if(!$password_text) |
|
1026 | + if (!$password_text) |
|
1027 | 1027 | { |
1028 | 1028 | return false; |
1029 | 1029 | } |
@@ -1032,31 +1032,31 @@ discard block |
||
1032 | 1032 | $oPassword = new Password(); |
1033 | 1033 | $current_algorithm = $oPassword->checkAlgorithm($hashed_password); |
1034 | 1034 | $match = $oPassword->checkPassword($password_text, $hashed_password, $current_algorithm); |
1035 | - if(!$match) |
|
1035 | + if (!$match) |
|
1036 | 1036 | { |
1037 | 1037 | return false; |
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | // Update the encryption method if necessary |
1041 | 1041 | $config = $this->getMemberConfig(); |
1042 | - if($member_srl > 0 && $config->password_hashing_auto_upgrade != 'N') |
|
1042 | + if ($member_srl > 0 && $config->password_hashing_auto_upgrade != 'N') |
|
1043 | 1043 | { |
1044 | 1044 | $need_upgrade = false; |
1045 | 1045 | |
1046 | - if(!$need_upgrade) |
|
1046 | + if (!$need_upgrade) |
|
1047 | 1047 | { |
1048 | 1048 | $required_algorithm = $oPassword->getCurrentlySelectedAlgorithm(); |
1049 | - if($required_algorithm !== $current_algorithm) $need_upgrade = true; |
|
1049 | + if ($required_algorithm !== $current_algorithm) $need_upgrade = true; |
|
1050 | 1050 | } |
1051 | 1051 | |
1052 | - if(!$need_upgrade) |
|
1052 | + if (!$need_upgrade) |
|
1053 | 1053 | { |
1054 | 1054 | $required_work_factor = $oPassword->getWorkFactor(); |
1055 | 1055 | $current_work_factor = $oPassword->checkWorkFactor($hashed_password); |
1056 | - if($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true; |
|
1056 | + if ($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true; |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | - if($need_upgrade === true) |
|
1059 | + if ($need_upgrade === true) |
|
1060 | 1060 | { |
1061 | 1061 | $args = new stdClass(); |
1062 | 1062 | $args->member_srl = $member_srl; |
@@ -1084,27 +1084,27 @@ discard block |
||
1084 | 1084 | function checkPasswordStrength($password, $strength) |
1085 | 1085 | { |
1086 | 1086 | $logged_info = Context::get('logged_info'); |
1087 | - if($logged_info->is_admin == 'Y') return true; |
|
1087 | + if ($logged_info->is_admin == 'Y') return true; |
|
1088 | 1088 | |
1089 | - if($strength == NULL) |
|
1089 | + if ($strength == NULL) |
|
1090 | 1090 | { |
1091 | 1091 | $config = $this->getMemberConfig(); |
1092 | - $strength = $config->password_strength?$config->password_strength:'normal'; |
|
1092 | + $strength = $config->password_strength ? $config->password_strength : 'normal'; |
|
1093 | 1093 | } |
1094 | 1094 | |
1095 | 1095 | $length = strlen($password); |
1096 | 1096 | |
1097 | 1097 | switch ($strength) { |
1098 | 1098 | case 'high': |
1099 | - if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false; |
|
1099 | + if ($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false; |
|
1100 | 1100 | /* no break */ |
1101 | 1101 | |
1102 | 1102 | case 'normal': |
1103 | - if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false; |
|
1103 | + if ($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false; |
|
1104 | 1104 | break; |
1105 | 1105 | |
1106 | 1106 | case 'low': |
1107 | - if($length < 4) return false; |
|
1107 | + if ($length < 4) return false; |
|
1108 | 1108 | break; |
1109 | 1109 | } |
1110 | 1110 | |
@@ -1115,11 +1115,11 @@ discard block |
||
1115 | 1115 | { |
1116 | 1116 | $groupSrl = 0; |
1117 | 1117 | $output = $this->getGroups($site_srl); |
1118 | - if(is_array($output)) |
|
1118 | + if (is_array($output)) |
|
1119 | 1119 | { |
1120 | - foreach($output AS $key=>$value) |
|
1120 | + foreach ($output AS $key=>$value) |
|
1121 | 1121 | { |
1122 | - if($value->is_admin == 'Y') |
|
1122 | + if ($value->is_admin == 'Y') |
|
1123 | 1123 | { |
1124 | 1124 | $groupSrl = $value->group_srl; |
1125 | 1125 | break; |
@@ -45,32 +45,68 @@ discard block |
||
45 | 45 | foreach($config->signupForm AS $key=>$value) |
46 | 46 | { |
47 | 47 | $config->signupForm[$key]->title = ($value->isDefaultForm) ? Context::getLang($value->name) : $value->title; |
48 | - if($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y'; |
|
49 | - if($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N'; |
|
48 | + if($config->signupForm[$key]->isPublic != 'N') { |
|
49 | + $config->signupForm[$key]->isPublic = 'Y'; |
|
50 | + } |
|
51 | + if($value->name == 'find_account_question') { |
|
52 | + $config->signupForm[$key]->isPublic = 'N'; |
|
53 | + } |
|
50 | 54 | } |
51 | 55 | |
52 | 56 | // Get terms of user |
53 | 57 | $config->agreement = memberModel::_getAgreement(); |
54 | 58 | |
55 | - if(!$config->webmaster_name) $config->webmaster_name = 'webmaster'; |
|
56 | - if(!$config->image_name_max_width) $config->image_name_max_width = 90; |
|
57 | - if(!$config->image_name_max_height) $config->image_name_max_height = 20; |
|
58 | - if(!$config->image_mark_max_width) $config->image_mark_max_width = 20; |
|
59 | - if(!$config->image_mark_max_height) $config->image_mark_max_height = 20; |
|
60 | - if(!$config->profile_image_max_width) $config->profile_image_max_width = 90; |
|
61 | - if(!$config->profile_image_max_height) $config->profile_image_max_height = 90; |
|
62 | - if(!$config->skin) $config->skin = 'default'; |
|
63 | - if(!$config->colorset) $config->colorset = 'white'; |
|
64 | - if(!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor'; |
|
65 | - if(!$config->group_image_mark) $config->group_image_mark = "N"; |
|
59 | + if(!$config->webmaster_name) { |
|
60 | + $config->webmaster_name = 'webmaster'; |
|
61 | + } |
|
62 | + if(!$config->image_name_max_width) { |
|
63 | + $config->image_name_max_width = 90; |
|
64 | + } |
|
65 | + if(!$config->image_name_max_height) { |
|
66 | + $config->image_name_max_height = 20; |
|
67 | + } |
|
68 | + if(!$config->image_mark_max_width) { |
|
69 | + $config->image_mark_max_width = 20; |
|
70 | + } |
|
71 | + if(!$config->image_mark_max_height) { |
|
72 | + $config->image_mark_max_height = 20; |
|
73 | + } |
|
74 | + if(!$config->profile_image_max_width) { |
|
75 | + $config->profile_image_max_width = 90; |
|
76 | + } |
|
77 | + if(!$config->profile_image_max_height) { |
|
78 | + $config->profile_image_max_height = 90; |
|
79 | + } |
|
80 | + if(!$config->skin) { |
|
81 | + $config->skin = 'default'; |
|
82 | + } |
|
83 | + if(!$config->colorset) { |
|
84 | + $config->colorset = 'white'; |
|
85 | + } |
|
86 | + if(!$config->editor_skin || $config->editor_skin == 'default') { |
|
87 | + $config->editor_skin = 'ckeditor'; |
|
88 | + } |
|
89 | + if(!$config->group_image_mark) { |
|
90 | + $config->group_image_mark = "N"; |
|
91 | + } |
|
66 | 92 | |
67 | - if(!$config->identifier) $config->identifier = 'user_id'; |
|
93 | + if(!$config->identifier) { |
|
94 | + $config->identifier = 'user_id'; |
|
95 | + } |
|
68 | 96 | |
69 | - if(!$config->max_error_count) $config->max_error_count = 10; |
|
70 | - if(!$config->max_error_count_time) $config->max_error_count_time = 300; |
|
97 | + if(!$config->max_error_count) { |
|
98 | + $config->max_error_count = 10; |
|
99 | + } |
|
100 | + if(!$config->max_error_count_time) { |
|
101 | + $config->max_error_count_time = 300; |
|
102 | + } |
|
71 | 103 | |
72 | - if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor'; |
|
73 | - if(!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono'; |
|
104 | + if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') { |
|
105 | + $config->signature_editor_skin = 'ckeditor'; |
|
106 | + } |
|
107 | + if(!$config->sel_editor_colorset) { |
|
108 | + $config->sel_editor_colorset = 'moono'; |
|
109 | + } |
|
74 | 110 | |
75 | 111 | $member_config = $config; |
76 | 112 | |
@@ -116,12 +152,18 @@ discard block |
||
116 | 152 | $logged_info = Context::get('logged_info'); |
117 | 153 | $act = Context::get('cur_act'); |
118 | 154 | // When click user's own nickname |
119 | - if($member_srl == $logged_info->member_srl) $member_info = $logged_info; |
|
155 | + if($member_srl == $logged_info->member_srl) { |
|
156 | + $member_info = $logged_info; |
|
157 | + } |
|
120 | 158 | // When click other's nickname |
121 | - else $member_info = $this->getMemberInfoByMemberSrl($member_srl); |
|
159 | + else { |
|
160 | + $member_info = $this->getMemberInfoByMemberSrl($member_srl); |
|
161 | + } |
|
122 | 162 | |
123 | 163 | $member_srl = $member_info->member_srl; |
124 | - if(!$member_srl) return; |
|
164 | + if(!$member_srl) { |
|
165 | + return; |
|
166 | + } |
|
125 | 167 | // List variables |
126 | 168 | $user_id = $member_info->user_id; |
127 | 169 | $user_name = $member_info->user_name; |
@@ -156,11 +198,13 @@ discard block |
||
156 | 198 | } |
157 | 199 | } |
158 | 200 | // View homepage info |
159 | - if($member_info->homepage) |
|
160 | - $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank'); |
|
201 | + if($member_info->homepage) { |
|
202 | + $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank'); |
|
203 | + } |
|
161 | 204 | // View blog info |
162 | - if($member_info->blog) |
|
163 | - $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'blog', '', 'blank'); |
|
205 | + if($member_info->blog) { |
|
206 | + $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'blog', '', 'blank'); |
|
207 | + } |
|
164 | 208 | // Call a trigger (after) |
165 | 209 | ModuleHandler::triggerCall('member.getMemberMenu', 'after', $null); |
166 | 210 | // Display a menu for editting member info to a top administrator |
@@ -195,16 +239,14 @@ discard block |
||
195 | 239 | if(Mobile::isFromMobilePhone()) |
196 | 240 | { |
197 | 241 | return true; |
198 | - } |
|
199 | - elseif(filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
242 | + } elseif(filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
200 | 243 | { |
201 | 244 | // IPv6: require same /48 |
202 | 245 | if(strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0) |
203 | 246 | { |
204 | 247 | return true; |
205 | 248 | } |
206 | - } |
|
207 | - else |
|
249 | + } else |
|
208 | 250 | { |
209 | 251 | // IPv4: require same /24 |
210 | 252 | if(ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8) |
@@ -234,10 +276,12 @@ discard block |
||
234 | 276 | $logged_info->group_list = $this->getMemberGroups($logged_info->member_srl, $site_module_info->site_srl); |
235 | 277 | // Add is_site_admin bool variable into logged_info if site_administrator is |
236 | 278 | $oModuleModel = getModel('module'); |
237 | - if($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true; |
|
238 | - else $logged_info->is_site_admin = false; |
|
239 | - } |
|
240 | - else |
|
279 | + if($oModuleModel->isSiteAdmin($logged_info)) { |
|
280 | + $logged_info->is_site_admin = true; |
|
281 | + } else { |
|
282 | + $logged_info->is_site_admin = false; |
|
283 | + } |
|
284 | + } else |
|
241 | 285 | { |
242 | 286 | // Register a default group if the site doesn't have a member group |
243 | 287 | if(count($logged_info->group_list) === 0) |
@@ -263,13 +307,19 @@ discard block |
||
263 | 307 | */ |
264 | 308 | function getMemberInfoByUserID($user_id, $columnList = array()) |
265 | 309 | { |
266 | - if(!$user_id) return; |
|
310 | + if(!$user_id) { |
|
311 | + return; |
|
312 | + } |
|
267 | 313 | |
268 | 314 | $args = new stdClass; |
269 | 315 | $args->user_id = $user_id; |
270 | 316 | $output = executeQuery('member.getMemberInfo', $args); |
271 | - if(!$output->toBool()) return $output; |
|
272 | - if(!$output->data) return; |
|
317 | + if(!$output->toBool()) { |
|
318 | + return $output; |
|
319 | + } |
|
320 | + if(!$output->data) { |
|
321 | + return; |
|
322 | + } |
|
273 | 323 | |
274 | 324 | $member_info = $this->arrangeMemberInfo($output->data); |
275 | 325 | |
@@ -281,7 +331,9 @@ discard block |
||
281 | 331 | */ |
282 | 332 | function getMemberInfoByEmailAddress($email_address) |
283 | 333 | { |
284 | - if(!$email_address) return; |
|
334 | + if(!$email_address) { |
|
335 | + return; |
|
336 | + } |
|
285 | 337 | |
286 | 338 | $args = new stdClass(); |
287 | 339 | |
@@ -290,15 +342,18 @@ discard block |
||
290 | 342 | { |
291 | 343 | $args->email_address = strtolower($email_address); |
292 | 344 | $output = executeQuery('member.getMemberInfoByEmailAddressForCubrid', $args); |
293 | - } |
|
294 | - else |
|
345 | + } else |
|
295 | 346 | { |
296 | 347 | $args->email_address = $email_address; |
297 | 348 | $output = executeQuery('member.getMemberInfoByEmailAddress', $args); |
298 | 349 | } |
299 | 350 | |
300 | - if(!$output->toBool()) return $output; |
|
301 | - if(!$output->data) return; |
|
351 | + if(!$output->toBool()) { |
|
352 | + return $output; |
|
353 | + } |
|
354 | + if(!$output->data) { |
|
355 | + return; |
|
356 | + } |
|
302 | 357 | |
303 | 358 | $member_info = $this->arrangeMemberInfo($output->data); |
304 | 359 | return $member_info; |
@@ -309,7 +364,9 @@ discard block |
||
309 | 364 | */ |
310 | 365 | function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array()) |
311 | 366 | { |
312 | - if(!$member_srl) return; |
|
367 | + if(!$member_srl) { |
|
368 | + return; |
|
369 | + } |
|
313 | 370 | |
314 | 371 | //columnList size zero... get full member info |
315 | 372 | if(!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0) |
@@ -332,13 +389,17 @@ discard block |
||
332 | 389 | $output = executeQuery('member.getMemberInfoByMemberSrl', $args, $columnList); |
333 | 390 | if(!$output->data) |
334 | 391 | { |
335 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass); |
|
392 | + if($oCacheHandler->isSupport()) { |
|
393 | + $oCacheHandler->put($cache_key, new stdClass); |
|
394 | + } |
|
336 | 395 | return; |
337 | 396 | } |
338 | 397 | $this->arrangeMemberInfo($output->data, $site_srl); |
339 | 398 | |
340 | 399 | //insert in cache |
341 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]); |
|
400 | + if($oCacheHandler->isSupport()) { |
|
401 | + $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]); |
|
402 | + } |
|
342 | 403 | } |
343 | 404 | } |
344 | 405 | |
@@ -372,8 +433,12 @@ discard block |
||
372 | 433 | { |
373 | 434 | foreach($extra_vars as $key => $val) |
374 | 435 | { |
375 | - if(!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val); |
|
376 | - if(!$info->{$key}) $info->{$key} = $val; |
|
436 | + if(!is_array($val) && strpos($val, '|@|') !== FALSE) { |
|
437 | + $val = explode('|@|', $val); |
|
438 | + } |
|
439 | + if(!$info->{$key}) { |
|
440 | + $info->{$key} = $val; |
|
441 | + } |
|
377 | 442 | } |
378 | 443 | } |
379 | 444 | |
@@ -396,8 +461,7 @@ discard block |
||
396 | 461 | if(is_array($val)) |
397 | 462 | { |
398 | 463 | $oSecurity->encodeHTML($key . '.'); |
399 | - } |
|
400 | - else |
|
464 | + } else |
|
401 | 465 | { |
402 | 466 | $oSecurity->encodeHTML($key); |
403 | 467 | } |
@@ -460,7 +524,9 @@ discard block |
||
460 | 524 | */ |
461 | 525 | function getLoggedMemberSrl() |
462 | 526 | { |
463 | - if(!$this->isLogged()) return; |
|
527 | + if(!$this->isLogged()) { |
|
528 | + return; |
|
529 | + } |
|
464 | 530 | return $_SESSION['member_srl']; |
465 | 531 | } |
466 | 532 | |
@@ -469,7 +535,9 @@ discard block |
||
469 | 535 | */ |
470 | 536 | function getLoggedUserID() |
471 | 537 | { |
472 | - if(!$this->isLogged()) return; |
|
538 | + if(!$this->isLogged()) { |
|
539 | + return; |
|
540 | + } |
|
473 | 541 | $logged_info = Context::get('logged_info'); |
474 | 542 | return $logged_info->user_id; |
475 | 543 | } |
@@ -501,9 +569,13 @@ discard block |
||
501 | 569 | $output = executeQueryArray('member.getMemberGroups', $args); |
502 | 570 | $group_list = $output->data; |
503 | 571 | //insert in cache |
504 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
572 | + if($oCacheHandler->isSupport()) { |
|
573 | + $oCacheHandler->put($cache_key, $group_list); |
|
574 | + } |
|
575 | + } |
|
576 | + if(!$group_list) { |
|
577 | + return array(); |
|
505 | 578 | } |
506 | - if(!$group_list) return array(); |
|
507 | 579 | |
508 | 580 | foreach($group_list as $group) |
509 | 581 | { |
@@ -523,7 +595,9 @@ discard block |
||
523 | 595 | $args->site_srl = $site_srl; |
524 | 596 | $args->sort_index = 'list_order'; |
525 | 597 | $output = executeQueryArray('member.getMembersGroups', $args); |
526 | - if(!$output->data) return array(); |
|
598 | + if(!$output->data) { |
|
599 | + return array(); |
|
600 | + } |
|
527 | 601 | |
528 | 602 | $result = array(); |
529 | 603 | foreach($output->data as $key=>$val) |
@@ -615,7 +689,9 @@ discard block |
||
615 | 689 | $output = executeQueryArray('member.getGroups', $args); |
616 | 690 | $group_list = $output->data; |
617 | 691 | //insert in cache |
618 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
692 | + if($oCacheHandler->isSupport()) { |
|
693 | + $oCacheHandler->put($cache_key, $group_list); |
|
694 | + } |
|
619 | 695 | } |
620 | 696 | |
621 | 697 | if(!$group_list) |
@@ -663,9 +739,13 @@ discard block |
||
663 | 739 | $output = executeQuery('member.getJoinFormList', $args); |
664 | 740 | // NULL if output data deosn't exist |
665 | 741 | $join_form_list = $output->data; |
666 | - if(!$join_form_list) return NULL; |
|
742 | + if(!$join_form_list) { |
|
743 | + return NULL; |
|
744 | + } |
|
667 | 745 | // Need to unserialize because serialized array is inserted into DB in case of default_value |
668 | - if(!is_array($join_form_list)) $join_form_list = array($join_form_list); |
|
746 | + if(!is_array($join_form_list)) { |
|
747 | + $join_form_list = array($join_form_list); |
|
748 | + } |
|
669 | 749 | $join_form_count = count($join_form_list); |
670 | 750 | for($i=0;$i<$join_form_count;$i++) |
671 | 751 | { |
@@ -682,9 +762,10 @@ discard block |
||
682 | 762 | if(in_array($column_type, array('checkbox','select','radio'))) |
683 | 763 | { |
684 | 764 | $join_form_list[$i]->default_value = unserialize($default_value); |
685 | - if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = ''; |
|
686 | - } |
|
687 | - else |
|
765 | + if(!$join_form_list[$i]->default_value[0]) { |
|
766 | + $join_form_list[$i]->default_value = ''; |
|
767 | + } |
|
768 | + } else |
|
688 | 769 | { |
689 | 770 | $join_form_list[$i]->default_value = ''; |
690 | 771 | } |
@@ -698,13 +779,18 @@ discard block |
||
698 | 779 | { |
699 | 780 | foreach($this->join_form_list as $key => $val) |
700 | 781 | { |
701 | - if($val->is_active != 'Y') continue; |
|
782 | + if($val->is_active != 'Y') { |
|
783 | + continue; |
|
784 | + } |
|
702 | 785 | unset($obj); |
703 | 786 | $obj->type = $val->column_type; |
704 | 787 | $obj->name = $val->column_name; |
705 | 788 | $obj->lang = $val->column_title; |
706 | - if($logged_info->is_admin != 'Y') $obj->required = $val->required=='Y'?true:false; |
|
707 | - else $obj->required = false; |
|
789 | + if($logged_info->is_admin != 'Y') { |
|
790 | + $obj->required = $val->required=='Y'?true:false; |
|
791 | + } else { |
|
792 | + $obj->required = false; |
|
793 | + } |
|
708 | 794 | $filter_output[] = $obj; |
709 | 795 | |
710 | 796 | unset($open_obj); |
@@ -755,7 +841,9 @@ discard block |
||
755 | 841 | function getCombineJoinForm($member_info) |
756 | 842 | { |
757 | 843 | $extend_form_list = $this->getJoinFormlist(); |
758 | - if(!$extend_form_list) return; |
|
844 | + if(!$extend_form_list) { |
|
845 | + return; |
|
846 | + } |
|
759 | 847 | // Member info is open only to an administrator and him/herself when is_private is true. |
760 | 848 | $logged_info = Context::get('logged_info'); |
761 | 849 | |
@@ -768,7 +856,9 @@ discard block |
||
768 | 856 | switch($item->column_type) |
769 | 857 | { |
770 | 858 | case 'checkbox' : |
771 | - if($value && !is_array($value)) $value = array($value); |
|
859 | + if($value && !is_array($value)) { |
|
860 | + $value = array($value); |
|
861 | + } |
|
772 | 862 | break; |
773 | 863 | case 'text' : |
774 | 864 | case 'homepage' : |
@@ -782,8 +872,11 @@ discard block |
||
782 | 872 | |
783 | 873 | $extend_form_list[$srl]->value = $value; |
784 | 874 | |
785 | - if($member_info->{'open_'.$column_name}=='Y') $extend_form_list[$srl]->is_opened = true; |
|
786 | - else $extend_form_list[$srl]->is_opened = false; |
|
875 | + if($member_info->{'open_'.$column_name}=='Y') { |
|
876 | + $extend_form_list[$srl]->is_opened = true; |
|
877 | + } else { |
|
878 | + $extend_form_list[$srl]->is_opened = false; |
|
879 | + } |
|
787 | 880 | } |
788 | 881 | return $extend_form_list; |
789 | 882 | } |
@@ -796,7 +889,9 @@ discard block |
||
796 | 889 | $args->member_join_form_srl = $member_join_form_srl; |
797 | 890 | $output = executeQuery('member.getJoinForm', $args); |
798 | 891 | $join_form = $output->data; |
799 | - if(!$join_form) return NULL; |
|
892 | + if(!$join_form) { |
|
893 | + return NULL; |
|
894 | + } |
|
800 | 895 | |
801 | 896 | $column_type = $join_form->column_type; |
802 | 897 | $default_value = $join_form->default_value; |
@@ -804,8 +899,7 @@ discard block |
||
804 | 899 | if(in_array($column_type, array('checkbox','select','radio'))) |
805 | 900 | { |
806 | 901 | $join_form->default_value = unserialize($default_value); |
807 | - } |
|
808 | - else |
|
902 | + } else |
|
809 | 903 | { |
810 | 904 | $join_form->default_value = ''; |
811 | 905 | } |
@@ -834,7 +928,9 @@ discard block |
||
834 | 928 | function getDeniedIDs() |
835 | 929 | { |
836 | 930 | $output = executeQueryArray('member.getDeniedIDs'); |
837 | - if(!$output->toBool()) return array(); |
|
931 | + if(!$output->toBool()) { |
|
932 | + return array(); |
|
933 | + } |
|
838 | 934 | return $output->data; |
839 | 935 | } |
840 | 936 | |
@@ -857,7 +953,9 @@ discard block |
||
857 | 953 | $args = new stdClass(); |
858 | 954 | $args->user_id = $user_id; |
859 | 955 | $output = executeQuery('member.chkDeniedID', $args); |
860 | - if($output->data->count) return true; |
|
956 | + if($output->data->count) { |
|
957 | + return true; |
|
958 | + } |
|
861 | 959 | return false; |
862 | 960 | } |
863 | 961 | |
@@ -869,7 +967,9 @@ discard block |
||
869 | 967 | $args = new stdClass(); |
870 | 968 | $args->nick_name = $nickName; |
871 | 969 | $output = executeQuery('member.chkDeniedNickName', $args); |
872 | - if($output->data->count) return true; |
|
970 | + if($output->data->count) { |
|
971 | + return true; |
|
972 | + } |
|
873 | 973 | if(!$output->toBool()) |
874 | 974 | { |
875 | 975 | return true; |
@@ -922,8 +1022,9 @@ discard block |
||
922 | 1022 | $info->src = Context::getRequestUri().$image_name_file. '?' . date('YmdHis', filemtime($image_name_file)); |
923 | 1023 | $info->file = './'.$image_name_file; |
924 | 1024 | $GLOBALS['__member_info__']['image_name'][$member_srl] = $info; |
1025 | + } else { |
|
1026 | + $GLOBALS['__member_info__']['image_name'][$member_srl] = null; |
|
925 | 1027 | } |
926 | - else $GLOBALS['__member_info__']['image_name'][$member_srl] = null; |
|
927 | 1028 | } |
928 | 1029 | return $GLOBALS['__member_info__']['image_name'][$member_srl]; |
929 | 1030 | } |
@@ -944,8 +1045,9 @@ discard block |
||
944 | 1045 | $info->src = Context::getRequestUri().$image_mark_file . '?' . date('YmdHis', filemtime($image_mark_file)); |
945 | 1046 | $info->file = './'.$image_mark_file; |
946 | 1047 | $GLOBALS['__member_info__']['image_mark'][$member_srl] = $info; |
1048 | + } else { |
|
1049 | + $GLOBALS['__member_info__']['image_mark'][$member_srl] = null; |
|
947 | 1050 | } |
948 | - else $GLOBALS['__member_info__']['image_mark'][$member_srl] = null; |
|
949 | 1051 | } |
950 | 1052 | |
951 | 1053 | return $GLOBALS['__member_info__']['image_mark'][$member_srl]; |
@@ -987,9 +1089,13 @@ discard block |
||
987 | 1089 | } |
988 | 1090 | } |
989 | 1091 | } |
990 | - if (!$info) $GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N'; |
|
1092 | + if (!$info) { |
|
1093 | + $GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N'; |
|
1094 | + } |
|
1095 | + } |
|
1096 | + if ($GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N') { |
|
1097 | + return null; |
|
991 | 1098 | } |
992 | - if ($GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N') return null; |
|
993 | 1099 | |
994 | 1100 | return $GLOBALS['__member_info__']['group_image_mark'][$member_srl]; |
995 | 1101 | } |
@@ -1007,8 +1113,9 @@ discard block |
||
1007 | 1113 | $buff = FileHandler::readFile($filename); |
1008 | 1114 | $signature = preg_replace('/<\?.*\?>/', '', $buff); |
1009 | 1115 | $GLOBALS['__member_info__']['signature'][$member_srl] = $signature; |
1116 | + } else { |
|
1117 | + $GLOBALS['__member_info__']['signature'][$member_srl] = null; |
|
1010 | 1118 | } |
1011 | - else $GLOBALS['__member_info__']['signature'][$member_srl] = null; |
|
1012 | 1119 | } |
1013 | 1120 | return $GLOBALS['__member_info__']['signature'][$member_srl]; |
1014 | 1121 | } |
@@ -1046,14 +1153,18 @@ discard block |
||
1046 | 1153 | if(!$need_upgrade) |
1047 | 1154 | { |
1048 | 1155 | $required_algorithm = $oPassword->getCurrentlySelectedAlgorithm(); |
1049 | - if($required_algorithm !== $current_algorithm) $need_upgrade = true; |
|
1156 | + if($required_algorithm !== $current_algorithm) { |
|
1157 | + $need_upgrade = true; |
|
1158 | + } |
|
1050 | 1159 | } |
1051 | 1160 | |
1052 | 1161 | if(!$need_upgrade) |
1053 | 1162 | { |
1054 | 1163 | $required_work_factor = $oPassword->getWorkFactor(); |
1055 | 1164 | $current_work_factor = $oPassword->checkWorkFactor($hashed_password); |
1056 | - if($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true; |
|
1165 | + if($current_work_factor !== false && $required_work_factor > $current_work_factor) { |
|
1166 | + $need_upgrade = true; |
|
1167 | + } |
|
1057 | 1168 | } |
1058 | 1169 | |
1059 | 1170 | if($need_upgrade === true) |
@@ -1084,7 +1195,9 @@ discard block |
||
1084 | 1195 | function checkPasswordStrength($password, $strength) |
1085 | 1196 | { |
1086 | 1197 | $logged_info = Context::get('logged_info'); |
1087 | - if($logged_info->is_admin == 'Y') return true; |
|
1198 | + if($logged_info->is_admin == 'Y') { |
|
1199 | + return true; |
|
1200 | + } |
|
1088 | 1201 | |
1089 | 1202 | if($strength == NULL) |
1090 | 1203 | { |
@@ -1096,15 +1209,21 @@ discard block |
||
1096 | 1209 | |
1097 | 1210 | switch ($strength) { |
1098 | 1211 | case 'high': |
1099 | - if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false; |
|
1212 | + if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) { |
|
1213 | + return false; |
|
1214 | + } |
|
1100 | 1215 | /* no break */ |
1101 | 1216 | |
1102 | 1217 | case 'normal': |
1103 | - if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false; |
|
1218 | + if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) { |
|
1219 | + return false; |
|
1220 | + } |
|
1104 | 1221 | break; |
1105 | 1222 | |
1106 | 1223 | case 'low': |
1107 | - if($length < 4) return false; |
|
1224 | + if($length < 4) { |
|
1225 | + return false; |
|
1226 | + } |
|
1108 | 1227 | break; |
1109 | 1228 | } |
1110 | 1229 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | class board extends ModuleObject |
11 | 11 | { |
12 | - var $search_option = array('title_content','title','content','comment','user_name','nick_name','user_id','tag'); ///< 검색 옵션 |
|
12 | + var $search_option = array('title_content', 'title', 'content', 'comment', 'user_name', 'nick_name', 'user_id', 'tag'); ///< 검색 옵션 |
|
13 | 13 | |
14 | 14 | var $order_target = array('list_order', 'update_order', 'regdate', 'voted_count', 'blamed_count', 'readed_count', 'comment_count', 'title', 'nick_name', 'user_name', 'user_id'); // 정렬 옵션 |
15 | 15 | |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function board() |
27 | 27 | { |
28 | - if(!Context::isInstalled()) return; |
|
28 | + if (!Context::isInstalled()) return; |
|
29 | 29 | |
30 | - if(!Context::isExistsSSLAction('dispBoardWrite') && Context::getSslStatus() == 'optional') |
|
30 | + if (!Context::isExistsSSLAction('dispBoardWrite') && Context::getSslStatus() == 'optional') |
|
31 | 31 | { |
32 | 32 | $ssl_actions = array('dispBoardWrite', 'dispBoardWriteComment', 'dispBoardReplyComment', 'dispBoardModifyComment', 'dispBoardDelete', 'dispBoardDeleteComment', 'procBoardInsertDocument', 'procBoardDeleteDocument', 'procBoardInsertComment', 'procBoardDeleteComment', 'procBoardVerificationPassword'); |
33 | 33 | Context::addSSLActions($ssl_actions); |
34 | 34 | } |
35 | - if(!Context::isExistsSSLAction('dispTempSavedList') && Context::getSslStatus() == 'optional') |
|
35 | + if (!Context::isExistsSSLAction('dispTempSavedList') && Context::getSslStatus() == 'optional') |
|
36 | 36 | { |
37 | 37 | Context::addSSLAction('dispTempSavedList'); |
38 | 38 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $args = new stdClass; |
55 | 55 | $args->site_srl = 0; |
56 | 56 | $output = executeQuery('module.getSite', $args); |
57 | - if(!$output->data->index_module_srl) |
|
57 | + if (!$output->data->index_module_srl) |
|
58 | 58 | { |
59 | 59 | $args->mid = 'board'; |
60 | 60 | $args->module = 'board'; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $args->site_srl = 0; |
64 | 64 | $output = $oModuleController->insertModule($args); |
65 | 65 | |
66 | - if($output->toBool()) |
|
66 | + if ($output->toBool()) |
|
67 | 67 | { |
68 | 68 | $module_srl = $output->get('module_srl'); |
69 | 69 | |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | $oModuleModel = getModel('module'); |
88 | 88 | |
89 | 89 | // 2007. 10. 17 get the member menu trigger |
90 | - if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) return true; |
|
90 | + if (!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) return true; |
|
91 | 91 | |
92 | 92 | // 2011. 09. 20 when add new menu in sitemap, custom menu add |
93 | - if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) return true; |
|
93 | + if (!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) return true; |
|
94 | 94 | return false; |
95 | 95 | } |
96 | 96 | |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | $oModuleController = getController('module'); |
104 | 104 | |
105 | 105 | // 2007. 10. 17 check the member menu trigger, if it is not existed then insert |
106 | - if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) |
|
106 | + if (!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) |
|
107 | 107 | { |
108 | 108 | $oModuleController->insertTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after'); |
109 | 109 | } |
110 | 110 | |
111 | 111 | // 2011. 09. 20 when add new menu in sitemap, custom menu add |
112 | - if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) |
|
112 | + if (!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) |
|
113 | 113 | { |
114 | 114 | $oModuleController->insertTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after'); |
115 | 115 | } |
@@ -120,12 +120,12 @@ discard block |
||
120 | 120 | function moduleUninstall() |
121 | 121 | { |
122 | 122 | $output = executeQueryArray("board.getAllBoard"); |
123 | - if(!$output->data) return new Object(); |
|
123 | + if (!$output->data) return new Object(); |
|
124 | 124 | @set_time_limit(0); |
125 | 125 | |
126 | 126 | $oModuleController = getController('module'); |
127 | 127 | |
128 | - foreach($output->data as $board) |
|
128 | + foreach ($output->data as $board) |
|
129 | 129 | { |
130 | 130 | $oModuleController->deleteModule($board->module_srl); |
131 | 131 | } |
@@ -29,24 +29,24 @@ discard block |
||
29 | 29 | $mid = Context::get('mid'); |
30 | 30 | $editor_sequence = Context::get('editor_sequence'); |
31 | 31 | $upload_target_srl = Context::get('upload_target_srl'); |
32 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
32 | + if (!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
33 | 33 | |
34 | - if($upload_target_srl) |
|
34 | + if ($upload_target_srl) |
|
35 | 35 | { |
36 | 36 | $tmp_files = $this->getFiles($upload_target_srl); |
37 | 37 | $file_count = count($tmp_files); |
38 | 38 | |
39 | - for($i=0;$i<$file_count;$i++) |
|
39 | + for ($i = 0; $i < $file_count; $i++) |
|
40 | 40 | { |
41 | 41 | $file_info = $tmp_files[$i]; |
42 | - if(!$file_info->file_srl) continue; |
|
42 | + if (!$file_info->file_srl) continue; |
|
43 | 43 | |
44 | 44 | $obj = new stdClass; |
45 | 45 | $obj->file_srl = $file_info->file_srl; |
46 | 46 | $obj->source_filename = $file_info->source_filename; |
47 | 47 | $obj->file_size = $file_info->file_size; |
48 | 48 | $obj->disp_file_size = FileHandler::filesize($file_info->file_size); |
49 | - if($file_info->direct_download=='N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); |
|
49 | + if ($file_info->direct_download == 'N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); |
|
50 | 50 | else $obj->download_url = str_replace('./', '', $file_info->uploaded_filename); |
51 | 51 | $obj->direct_download = $file_info->direct_download; |
52 | 52 | $obj->cover_image = ($file_info->cover_image === 'Y') ? true : false; |
@@ -66,17 +66,17 @@ discard block |
||
66 | 66 | //$config = $oModuleModel->getModuleInfoByMid($mid); //perhaps config varialbles not used |
67 | 67 | |
68 | 68 | $file_config = $this->getUploadConfig(); |
69 | - $left_size = $file_config->allowed_attach_size*1024*1024 - $attached_size; |
|
69 | + $left_size = $file_config->allowed_attach_size * 1024 * 1024 - $attached_size; |
|
70 | 70 | // Settings of required information |
71 | 71 | $attached_size = FileHandler::filesize($attached_size); |
72 | - $allowed_attach_size = FileHandler::filesize($file_config->allowed_attach_size*1024*1024); |
|
73 | - $allowed_filesize = FileHandler::filesize($file_config->allowed_filesize*1024*1024); |
|
72 | + $allowed_attach_size = FileHandler::filesize($file_config->allowed_attach_size * 1024 * 1024); |
|
73 | + $allowed_filesize = FileHandler::filesize($file_config->allowed_filesize * 1024 * 1024); |
|
74 | 74 | $allowed_filetypes = $file_config->allowed_filetypes; |
75 | - $this->add("files",$files); |
|
76 | - $this->add("editor_sequence",$editor_sequence); |
|
77 | - $this->add("upload_target_srl",$upload_target_srl); |
|
78 | - $this->add("upload_status",$upload_status); |
|
79 | - $this->add("left_size",$left_size); |
|
75 | + $this->add("files", $files); |
|
76 | + $this->add("editor_sequence", $editor_sequence); |
|
77 | + $this->add("upload_target_srl", $upload_target_srl); |
|
78 | + $this->add("upload_status", $upload_status); |
|
79 | + $this->add("left_size", $left_size); |
|
80 | 80 | $this->add('attached_size', $attached_size); |
81 | 81 | $this->add('allowed_attach_size', $allowed_attach_size); |
82 | 82 | $this->add('allowed_filesize', $allowed_filesize); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $args = new stdClass(); |
95 | 95 | $args->upload_target_srl = $upload_target_srl; |
96 | 96 | $output = executeQuery('file.getFilesCount', $args); |
97 | - return (int)$output->data->count; |
|
97 | + return (int) $output->data->count; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param string $sid |
105 | 105 | * @return string Returns a url |
106 | 106 | */ |
107 | - function getDownloadUrl($file_srl, $sid, $module_srl="") |
|
107 | + function getDownloadUrl($file_srl, $sid, $module_srl = "") |
|
108 | 108 | { |
109 | 109 | return sprintf('?module=%s&act=%s&file_srl=%s&sid=%s&module_srl=%s', 'file', 'procFileDownload', $file_srl, $sid, $module_srl); |
110 | 110 | } |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | |
123 | 123 | $file_module_config = $oModuleModel->getModuleConfig('file'); |
124 | 124 | |
125 | - if($module_srl) $file_config = $oModuleModel->getModulePartConfig('file',$module_srl); |
|
126 | - if(!$file_config) $file_config = $file_module_config; |
|
125 | + if ($module_srl) $file_config = $oModuleModel->getModulePartConfig('file', $module_srl); |
|
126 | + if (!$file_config) $file_config = $file_module_config; |
|
127 | 127 | |
128 | 128 | $config = new stdClass(); |
129 | 129 | |
130 | - if($file_config) |
|
130 | + if ($file_config) |
|
131 | 131 | { |
132 | 132 | $config->allowed_filesize = $file_config->allowed_filesize; |
133 | 133 | $config->allowed_attach_size = $file_config->allowed_attach_size; |
@@ -138,31 +138,31 @@ discard block |
||
138 | 138 | $config->allow_outlink_format = $file_config->allow_outlink_format; |
139 | 139 | } |
140 | 140 | // Property for all files comes first than each property |
141 | - if(!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize; |
|
142 | - if(!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size; |
|
143 | - if(!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes; |
|
144 | - if(!$config->allow_outlink) $config->allow_outlink = $file_module_config->allow_outlink; |
|
145 | - if(!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site; |
|
146 | - if(!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format; |
|
147 | - if(!$config->download_grant) $config->download_grant = $file_module_config->download_grant; |
|
141 | + if (!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize; |
|
142 | + if (!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size; |
|
143 | + if (!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes; |
|
144 | + if (!$config->allow_outlink) $config->allow_outlink = $file_module_config->allow_outlink; |
|
145 | + if (!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site; |
|
146 | + if (!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format; |
|
147 | + if (!$config->download_grant) $config->download_grant = $file_module_config->download_grant; |
|
148 | 148 | // Default setting if not exists |
149 | - if(!$config->allowed_filesize) $config->allowed_filesize = '2'; |
|
150 | - if(!$config->allowed_attach_size) $config->allowed_attach_size = '3'; |
|
151 | - if(!$config->allowed_filetypes) $config->allowed_filetypes = '*.*'; |
|
152 | - if(!$config->allow_outlink) $config->allow_outlink = 'Y'; |
|
153 | - if(!$config->download_grant) $config->download_grant = array(); |
|
149 | + if (!$config->allowed_filesize) $config->allowed_filesize = '2'; |
|
150 | + if (!$config->allowed_attach_size) $config->allowed_attach_size = '3'; |
|
151 | + if (!$config->allowed_filetypes) $config->allowed_filetypes = '*.*'; |
|
152 | + if (!$config->allow_outlink) $config->allow_outlink = 'Y'; |
|
153 | + if (!$config->download_grant) $config->download_grant = array(); |
|
154 | 154 | |
155 | 155 | $size = ini_get('upload_max_filesize'); |
156 | 156 | $unit = strtolower($size[strlen($size) - 1]); |
157 | - $size = (float)$size; |
|
158 | - if($unit == 'g') $size *= 1024; |
|
159 | - if($unit == 'k') $size /= 1024; |
|
157 | + $size = (float) $size; |
|
158 | + if ($unit == 'g') $size *= 1024; |
|
159 | + if ($unit == 'k') $size /= 1024; |
|
160 | 160 | |
161 | - if($config->allowed_filesize > $size) |
|
161 | + if ($config->allowed_filesize > $size) |
|
162 | 162 | { |
163 | 163 | $config->allowed_filesize = $size; |
164 | 164 | } |
165 | - if($config->allowed_attach_size > $size) |
|
165 | + if ($config->allowed_attach_size > $size) |
|
166 | 166 | { |
167 | 167 | $config->allowed_attach_size = $size; |
168 | 168 | } |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | $args = new stdClass(); |
183 | 183 | $args->file_srl = $file_srl; |
184 | 184 | $output = executeQueryArray('file.getFile', $args, $columnList); |
185 | - if(!$output->toBool()) return $output; |
|
185 | + if (!$output->toBool()) return $output; |
|
186 | 186 | |
187 | 187 | // old version compatibility |
188 | - if(count($output->data) == 1) |
|
188 | + if (count($output->data) == 1) |
|
189 | 189 | { |
190 | 190 | $file = $output->data[0]; |
191 | 191 | $file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl); |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | { |
197 | 197 | $fileList = array(); |
198 | 198 | |
199 | - if(is_array($output->data)) |
|
199 | + if (is_array($output->data)) |
|
200 | 200 | { |
201 | - foreach($output->data as $key=>$value) |
|
201 | + foreach ($output->data as $key=>$value) |
|
202 | 202 | { |
203 | 203 | $file = $value; |
204 | 204 | $file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl); |
@@ -222,16 +222,16 @@ discard block |
||
222 | 222 | $args = new stdClass(); |
223 | 223 | $args->upload_target_srl = $upload_target_srl; |
224 | 224 | $args->sort_index = $sortIndex; |
225 | - if($ckValid) $args->isvalid = 'Y'; |
|
225 | + if ($ckValid) $args->isvalid = 'Y'; |
|
226 | 226 | $output = executeQuery('file.getFiles', $args, $columnList); |
227 | - if(!$output->data) return; |
|
227 | + if (!$output->data) return; |
|
228 | 228 | |
229 | 229 | $file_list = $output->data; |
230 | 230 | |
231 | - if($file_list && !is_array($file_list)) $file_list = array($file_list); |
|
231 | + if ($file_list && !is_array($file_list)) $file_list = array($file_list); |
|
232 | 232 | |
233 | 233 | $file_count = count($file_list); |
234 | - for($i=0;$i<$file_count;$i++) |
|
234 | + for ($i = 0; $i < $file_count; $i++) |
|
235 | 235 | { |
236 | 236 | $file = $file_list[$i]; |
237 | 237 | $file->source_filename = stripslashes($file->source_filename); |
@@ -254,14 +254,14 @@ discard block |
||
254 | 254 | |
255 | 255 | $module_srl = Context::get('module_srl'); |
256 | 256 | // Get the current module if module_srl doesn't exist |
257 | - if(!$module_srl) |
|
257 | + if (!$module_srl) |
|
258 | 258 | { |
259 | 259 | $current_module_info = Context::get('current_module_info'); |
260 | 260 | $module_srl = $current_module_info->module_srl; |
261 | 261 | } |
262 | 262 | $file_config = $this->getFileConfig($module_srl); |
263 | 263 | |
264 | - if($logged_info->is_admin == 'Y') |
|
264 | + if ($logged_info->is_admin == 'Y') |
|
265 | 265 | { |
266 | 266 | $iniPostMaxSize = FileHandler::returnbytes(ini_get('post_max_size')); |
267 | 267 | $iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize')); |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | '%s : %s/ %s<br /> %s : %s (%s : %s)', |
288 | 288 | Context::getLang('allowed_attach_size'), |
289 | 289 | FileHandler::filesize($attached_size), |
290 | - FileHandler::filesize($file_config->allowed_attach_size*1024*1024), |
|
290 | + FileHandler::filesize($file_config->allowed_attach_size * 1024 * 1024), |
|
291 | 291 | Context::getLang('allowed_filesize'), |
292 | - FileHandler::filesize($file_config->allowed_filesize*1024*1024), |
|
292 | + FileHandler::filesize($file_config->allowed_filesize * 1024 * 1024), |
|
293 | 293 | Context::getLang('allowed_filetypes'), |
294 | 294 | $file_config->allowed_filetypes |
295 | 295 | ); |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | */ |
317 | 317 | function getFileGrant($file_info, $member_info) |
318 | 318 | { |
319 | - if(!$file_info) return null; |
|
319 | + if (!$file_info) return null; |
|
320 | 320 | |
321 | - if($_SESSION['__XE_UPLOADING_FILES_INFO__'][$file_info->file_srl]) |
|
321 | + if ($_SESSION['__XE_UPLOADING_FILES_INFO__'][$file_info->file_srl]) |
|
322 | 322 | { |
323 | 323 | $file_grant->is_deletable = true; |
324 | 324 | return $file_grant; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | $oDocumentModel = getModel('document'); |
331 | 331 | $oDocument = $oDocumentModel->getDocument($file_info->upload_target_srl); |
332 | - if($oDocument->isExists()) $document_grant = $oDocument->isGranted(); |
|
332 | + if ($oDocument->isExists()) $document_grant = $oDocument->isGranted(); |
|
333 | 333 | |
334 | 334 | $file_grant->is_deletable = ($document_grant || $member_info->is_admin == 'Y' || $member_info->member_srl == $file_info->member_srl || $grant->manager); |
335 | 335 |
@@ -29,7 +29,9 @@ discard block |
||
29 | 29 | $mid = Context::get('mid'); |
30 | 30 | $editor_sequence = Context::get('editor_sequence'); |
31 | 31 | $upload_target_srl = Context::get('upload_target_srl'); |
32 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
32 | + if(!$upload_target_srl) { |
|
33 | + $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
34 | + } |
|
33 | 35 | |
34 | 36 | if($upload_target_srl) |
35 | 37 | { |
@@ -39,22 +41,26 @@ discard block |
||
39 | 41 | for($i=0;$i<$file_count;$i++) |
40 | 42 | { |
41 | 43 | $file_info = $tmp_files[$i]; |
42 | - if(!$file_info->file_srl) continue; |
|
44 | + if(!$file_info->file_srl) { |
|
45 | + continue; |
|
46 | + } |
|
43 | 47 | |
44 | 48 | $obj = new stdClass; |
45 | 49 | $obj->file_srl = $file_info->file_srl; |
46 | 50 | $obj->source_filename = $file_info->source_filename; |
47 | 51 | $obj->file_size = $file_info->file_size; |
48 | 52 | $obj->disp_file_size = FileHandler::filesize($file_info->file_size); |
49 | - if($file_info->direct_download=='N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); |
|
50 | - else $obj->download_url = str_replace('./', '', $file_info->uploaded_filename); |
|
53 | + if($file_info->direct_download=='N') { |
|
54 | + $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); |
|
55 | + } else { |
|
56 | + $obj->download_url = str_replace('./', '', $file_info->uploaded_filename); |
|
57 | + } |
|
51 | 58 | $obj->direct_download = $file_info->direct_download; |
52 | 59 | $obj->cover_image = ($file_info->cover_image === 'Y') ? true : false; |
53 | 60 | $files[] = $obj; |
54 | 61 | $attached_size += $file_info->file_size; |
55 | 62 | } |
56 | - } |
|
57 | - else |
|
63 | + } else |
|
58 | 64 | { |
59 | 65 | $upload_target_srl = 0; |
60 | 66 | $attached_size = 0; |
@@ -122,8 +128,12 @@ discard block |
||
122 | 128 | |
123 | 129 | $file_module_config = $oModuleModel->getModuleConfig('file'); |
124 | 130 | |
125 | - if($module_srl) $file_config = $oModuleModel->getModulePartConfig('file',$module_srl); |
|
126 | - if(!$file_config) $file_config = $file_module_config; |
|
131 | + if($module_srl) { |
|
132 | + $file_config = $oModuleModel->getModulePartConfig('file',$module_srl); |
|
133 | + } |
|
134 | + if(!$file_config) { |
|
135 | + $file_config = $file_module_config; |
|
136 | + } |
|
127 | 137 | |
128 | 138 | $config = new stdClass(); |
129 | 139 | |
@@ -138,25 +148,53 @@ discard block |
||
138 | 148 | $config->allow_outlink_format = $file_config->allow_outlink_format; |
139 | 149 | } |
140 | 150 | // Property for all files comes first than each property |
141 | - if(!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize; |
|
142 | - if(!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size; |
|
143 | - if(!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes; |
|
144 | - if(!$config->allow_outlink) $config->allow_outlink = $file_module_config->allow_outlink; |
|
145 | - if(!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site; |
|
146 | - if(!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format; |
|
147 | - if(!$config->download_grant) $config->download_grant = $file_module_config->download_grant; |
|
151 | + if(!$config->allowed_filesize) { |
|
152 | + $config->allowed_filesize = $file_module_config->allowed_filesize; |
|
153 | + } |
|
154 | + if(!$config->allowed_attach_size) { |
|
155 | + $config->allowed_attach_size = $file_module_config->allowed_attach_size; |
|
156 | + } |
|
157 | + if(!$config->allowed_filetypes) { |
|
158 | + $config->allowed_filetypes = $file_module_config->allowed_filetypes; |
|
159 | + } |
|
160 | + if(!$config->allow_outlink) { |
|
161 | + $config->allow_outlink = $file_module_config->allow_outlink; |
|
162 | + } |
|
163 | + if(!$config->allow_outlink_site) { |
|
164 | + $config->allow_outlink_site = $file_module_config->allow_outlink_site; |
|
165 | + } |
|
166 | + if(!$config->allow_outlink_format) { |
|
167 | + $config->allow_outlink_format = $file_module_config->allow_outlink_format; |
|
168 | + } |
|
169 | + if(!$config->download_grant) { |
|
170 | + $config->download_grant = $file_module_config->download_grant; |
|
171 | + } |
|
148 | 172 | // Default setting if not exists |
149 | - if(!$config->allowed_filesize) $config->allowed_filesize = '2'; |
|
150 | - if(!$config->allowed_attach_size) $config->allowed_attach_size = '3'; |
|
151 | - if(!$config->allowed_filetypes) $config->allowed_filetypes = '*.*'; |
|
152 | - if(!$config->allow_outlink) $config->allow_outlink = 'Y'; |
|
153 | - if(!$config->download_grant) $config->download_grant = array(); |
|
173 | + if(!$config->allowed_filesize) { |
|
174 | + $config->allowed_filesize = '2'; |
|
175 | + } |
|
176 | + if(!$config->allowed_attach_size) { |
|
177 | + $config->allowed_attach_size = '3'; |
|
178 | + } |
|
179 | + if(!$config->allowed_filetypes) { |
|
180 | + $config->allowed_filetypes = '*.*'; |
|
181 | + } |
|
182 | + if(!$config->allow_outlink) { |
|
183 | + $config->allow_outlink = 'Y'; |
|
184 | + } |
|
185 | + if(!$config->download_grant) { |
|
186 | + $config->download_grant = array(); |
|
187 | + } |
|
154 | 188 | |
155 | 189 | $size = ini_get('upload_max_filesize'); |
156 | 190 | $unit = strtolower($size[strlen($size) - 1]); |
157 | 191 | $size = (float)$size; |
158 | - if($unit == 'g') $size *= 1024; |
|
159 | - if($unit == 'k') $size /= 1024; |
|
192 | + if($unit == 'g') { |
|
193 | + $size *= 1024; |
|
194 | + } |
|
195 | + if($unit == 'k') { |
|
196 | + $size /= 1024; |
|
197 | + } |
|
160 | 198 | |
161 | 199 | if($config->allowed_filesize > $size) |
162 | 200 | { |
@@ -182,7 +220,9 @@ discard block |
||
182 | 220 | $args = new stdClass(); |
183 | 221 | $args->file_srl = $file_srl; |
184 | 222 | $output = executeQueryArray('file.getFile', $args, $columnList); |
185 | - if(!$output->toBool()) return $output; |
|
223 | + if(!$output->toBool()) { |
|
224 | + return $output; |
|
225 | + } |
|
186 | 226 | |
187 | 227 | // old version compatibility |
188 | 228 | if(count($output->data) == 1) |
@@ -191,8 +231,7 @@ discard block |
||
191 | 231 | $file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl); |
192 | 232 | |
193 | 233 | return $file; |
194 | - } |
|
195 | - else |
|
234 | + } else |
|
196 | 235 | { |
197 | 236 | $fileList = array(); |
198 | 237 | |
@@ -222,13 +261,19 @@ discard block |
||
222 | 261 | $args = new stdClass(); |
223 | 262 | $args->upload_target_srl = $upload_target_srl; |
224 | 263 | $args->sort_index = $sortIndex; |
225 | - if($ckValid) $args->isvalid = 'Y'; |
|
264 | + if($ckValid) { |
|
265 | + $args->isvalid = 'Y'; |
|
266 | + } |
|
226 | 267 | $output = executeQuery('file.getFiles', $args, $columnList); |
227 | - if(!$output->data) return; |
|
268 | + if(!$output->data) { |
|
269 | + return; |
|
270 | + } |
|
228 | 271 | |
229 | 272 | $file_list = $output->data; |
230 | 273 | |
231 | - if($file_list && !is_array($file_list)) $file_list = array($file_list); |
|
274 | + if($file_list && !is_array($file_list)) { |
|
275 | + $file_list = array($file_list); |
|
276 | + } |
|
232 | 277 | |
233 | 278 | $file_count = count($file_list); |
234 | 279 | for($i=0;$i<$file_count;$i++) |
@@ -316,7 +361,9 @@ discard block |
||
316 | 361 | */ |
317 | 362 | function getFileGrant($file_info, $member_info) |
318 | 363 | { |
319 | - if(!$file_info) return null; |
|
364 | + if(!$file_info) { |
|
365 | + return null; |
|
366 | + } |
|
320 | 367 | |
321 | 368 | if($_SESSION['__XE_UPLOADING_FILES_INFO__'][$file_info->file_srl]) |
322 | 369 | { |
@@ -329,7 +376,9 @@ discard block |
||
329 | 376 | |
330 | 377 | $oDocumentModel = getModel('document'); |
331 | 378 | $oDocument = $oDocumentModel->getDocument($file_info->upload_target_srl); |
332 | - if($oDocument->isExists()) $document_grant = $oDocument->isGranted(); |
|
379 | + if($oDocument->isExists()) { |
|
380 | + $document_grant = $oDocument->isGranted(); |
|
381 | + } |
|
333 | 382 | |
334 | 383 | $file_grant->is_deletable = ($document_grant || $member_info->is_admin == 'Y' || $member_info->member_srl == $file_info->member_srl || $grant->manager); |
335 | 384 |
@@ -10,32 +10,32 @@ discard block |
||
10 | 10 | $oSecurity = new Security(); |
11 | 11 | $oSecurity->encodeHTML('document_srl', 'comment_srl', 'vid', 'mid', 'page', 'category', 'search_target', 'search_keyword', 'sort_index', 'order_type', 'trackback_srl'); |
12 | 12 | |
13 | - if($this->module_info->list_count) $this->list_count = $this->module_info->list_count; |
|
14 | - if($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; |
|
15 | - if($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; |
|
16 | - if($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
17 | - if($this->module_info->page_count) $this->page_count = $this->module_info->page_count; |
|
18 | - if($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; |
|
13 | + if ($this->module_info->list_count) $this->list_count = $this->module_info->list_count; |
|
14 | + if ($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; |
|
15 | + if ($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; |
|
16 | + if ($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
17 | + if ($this->module_info->page_count) $this->page_count = $this->module_info->page_count; |
|
18 | + if ($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; |
|
19 | 19 | $this->except_notice = $this->module_info->except_notice == 'N' ? false : true; |
20 | 20 | |
21 | 21 | // $this->_getStatusNameListecret option backward compatibility |
22 | 22 | $oDocumentModel = getModel('document'); |
23 | 23 | |
24 | 24 | $statusList = $this->_getStatusNameList($oDocumentModel); |
25 | - if(isset($statusList['SECRET'])) |
|
25 | + if (isset($statusList['SECRET'])) |
|
26 | 26 | { |
27 | 27 | $this->module_info->secret = 'Y'; |
28 | 28 | } |
29 | 29 | |
30 | 30 | // use_category <=1.5.x, hide_category >=1.7.x |
31 | 31 | $count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl)); |
32 | - if($count_category) |
|
32 | + if ($count_category) |
|
33 | 33 | { |
34 | - if($this->module_info->hide_category) |
|
34 | + if ($this->module_info->hide_category) |
|
35 | 35 | { |
36 | 36 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
37 | 37 | } |
38 | - else if($this->module_info->use_category) |
|
38 | + else if ($this->module_info->use_category) |
|
39 | 39 | { |
40 | 40 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
41 | 41 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * check the consultation function, if the user is admin then swich off consultation function |
56 | 56 | * if the user is not logged, then disppear write document/write comment./ view document |
57 | 57 | **/ |
58 | - if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
58 | + if ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
59 | 59 | { |
60 | 60 | $this->consultation = true; |
61 | - if(!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; |
|
61 | + if (!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; |
|
62 | 62 | } else { |
63 | 63 | $this->consultation = false; |
64 | 64 | } |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | $extra_keys = $oDocumentModel->getExtraKeys($this->module_info->module_srl); |
68 | 68 | Context::set('extra_keys', $extra_keys); |
69 | 69 | |
70 | - $template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin); |
|
71 | - if(!is_dir($template_path)||!$this->module_info->mskin) |
|
70 | + $template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin); |
|
71 | + if (!is_dir($template_path) || !$this->module_info->mskin) |
|
72 | 72 | { |
73 | 73 | $this->module_info->mskin = 'default'; |
74 | - $template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin); |
|
74 | + $template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin); |
|
75 | 75 | } |
76 | 76 | $this->setTemplatePath($template_path); |
77 | 77 | Context::addJsFilter($this->module_path.'tpl/filter', 'input_password.xml'); |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | function getBoardCommentPage() |
88 | 88 | { |
89 | 89 | $document_srl = Context::get('document_srl'); |
90 | - $oDocumentModel =& getModel('document'); |
|
91 | - if(!$document_srl) |
|
90 | + $oDocumentModel = & getModel('document'); |
|
91 | + if (!$document_srl) |
|
92 | 92 | { |
93 | 93 | return new Object(-1, "msg_invalid_request"); |
94 | 94 | } |
95 | 95 | $oDocument = $oDocumentModel->getDocument($document_srl); |
96 | - if(!$oDocument->isExists()) |
|
96 | + if (!$oDocument->isExists()) |
|
97 | 97 | { |
98 | 98 | return new Object(-1, "msg_invalid_request"); |
99 | 99 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | function dispBoardMessage($msg_code) |
107 | 107 | { |
108 | 108 | $msg = Context::getLang($msg_code); |
109 | - $oMessageObject = &ModuleHandler::getModuleInstance('message','mobile'); |
|
109 | + $oMessageObject = &ModuleHandler::getModuleInstance('message', 'mobile'); |
|
110 | 110 | $oMessageObject->setError(-1); |
111 | 111 | $oMessageObject->setMessage($msg); |
112 | 112 | $oMessageObject->dispMessage(); |
@@ -10,12 +10,24 @@ discard block |
||
10 | 10 | $oSecurity = new Security(); |
11 | 11 | $oSecurity->encodeHTML('document_srl', 'comment_srl', 'vid', 'mid', 'page', 'category', 'search_target', 'search_keyword', 'sort_index', 'order_type', 'trackback_srl'); |
12 | 12 | |
13 | - if($this->module_info->list_count) $this->list_count = $this->module_info->list_count; |
|
14 | - if($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; |
|
15 | - if($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; |
|
16 | - if($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
17 | - if($this->module_info->page_count) $this->page_count = $this->module_info->page_count; |
|
18 | - if($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; |
|
13 | + if($this->module_info->list_count) { |
|
14 | + $this->list_count = $this->module_info->list_count; |
|
15 | + } |
|
16 | + if($this->module_info->mobile_list_count) { |
|
17 | + $this->list_count = $this->module_info->mobile_list_count; |
|
18 | + } |
|
19 | + if($this->module_info->search_list_count) { |
|
20 | + $this->search_list_count = $this->module_info->search_list_count; |
|
21 | + } |
|
22 | + if($this->module_info->mobile_search_list_count) { |
|
23 | + $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
24 | + } |
|
25 | + if($this->module_info->page_count) { |
|
26 | + $this->page_count = $this->module_info->page_count; |
|
27 | + } |
|
28 | + if($this->module_info->mobile_page_count) { |
|
29 | + $this->page_count = $this->module_info->mobile_page_count; |
|
30 | + } |
|
19 | 31 | $this->except_notice = $this->module_info->except_notice == 'N' ? false : true; |
20 | 32 | |
21 | 33 | // $this->_getStatusNameListecret option backward compatibility |
@@ -34,18 +46,15 @@ discard block |
||
34 | 46 | if($this->module_info->hide_category) |
35 | 47 | { |
36 | 48 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
37 | - } |
|
38 | - else if($this->module_info->use_category) |
|
49 | + } else if($this->module_info->use_category) |
|
39 | 50 | { |
40 | 51 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
41 | - } |
|
42 | - else |
|
52 | + } else |
|
43 | 53 | { |
44 | 54 | $this->module_info->hide_category = 'N'; |
45 | 55 | $this->module_info->use_category = 'Y'; |
46 | 56 | } |
47 | - } |
|
48 | - else |
|
57 | + } else |
|
49 | 58 | { |
50 | 59 | $this->module_info->hide_category = 'Y'; |
51 | 60 | $this->module_info->use_category = 'N'; |
@@ -58,7 +67,9 @@ discard block |
||
58 | 67 | if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
59 | 68 | { |
60 | 69 | $this->consultation = true; |
61 | - if(!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; |
|
70 | + if(!Context::get('is_logged')) { |
|
71 | + $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; |
|
72 | + } |
|
62 | 73 | } else { |
63 | 74 | $this->consultation = false; |
64 | 75 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function getDocumentExtraVarsFromDB($documentSrls) |
37 | 37 | { |
38 | - if(!is_array($documentSrls) || count($documentSrls) == 0) |
|
38 | + if (!is_array($documentSrls) || count($documentSrls) == 0) |
|
39 | 39 | { |
40 | 40 | return new Object(-1, 'msg_invalid_request'); |
41 | 41 | } |
@@ -56,52 +56,52 @@ discard block |
||
56 | 56 | $_document_list = &$GLOBALS['XE_DOCUMENT_LIST']; |
57 | 57 | |
58 | 58 | // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings |
59 | - if(count($_document_list) <= 0) return; |
|
59 | + if (count($_document_list) <= 0) return; |
|
60 | 60 | |
61 | 61 | // Find all called the document object variable has been set extension |
62 | 62 | $document_srls = array(); |
63 | - foreach($_document_list as $key => $val) |
|
63 | + foreach ($_document_list as $key => $val) |
|
64 | 64 | { |
65 | - if(!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
65 | + if (!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
66 | 66 | $checked_documents[$val->document_srl] = true; |
67 | 67 | $document_srls[] = $val->document_srl; |
68 | 68 | } |
69 | 69 | // If the document number, return detected |
70 | - if(!count($document_srls)) return; |
|
70 | + if (!count($document_srls)) return; |
|
71 | 71 | // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable |
72 | 72 | //$obj->document_srl = implode(',',$document_srls); |
73 | 73 | $output = $this->getDocumentExtraVarsFromDB($document_srls); |
74 | - if($output->toBool() && $output->data) |
|
74 | + if ($output->toBool() && $output->data) |
|
75 | 75 | { |
76 | - foreach($output->data as $key => $val) |
|
76 | + foreach ($output->data as $key => $val) |
|
77 | 77 | { |
78 | - if(!isset($val->value)) continue; |
|
79 | - if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
78 | + if (!isset($val->value)) continue; |
|
79 | + if (!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
80 | 80 | $extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value); |
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | 84 | $user_lang_code = Context::getLangType(); |
85 | - for($i=0,$c=count($document_srls);$i<$c;$i++) |
|
85 | + for ($i = 0, $c = count($document_srls); $i < $c; $i++) |
|
86 | 86 | { |
87 | 87 | $document_srl = $document_srls[$i]; |
88 | 88 | unset($vars); |
89 | 89 | |
90 | - if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
90 | + if (!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
91 | 91 | $module_srl = $_document_list[$document_srl]->get('module_srl'); |
92 | 92 | $extra_keys = $this->getExtraKeys($module_srl); |
93 | 93 | $vars = $extra_vars[$document_srl]; |
94 | 94 | $document_lang_code = $_document_list[$document_srl]->get('lang_code'); |
95 | 95 | // Expand the variable processing |
96 | - if(count($extra_keys)) |
|
96 | + if (count($extra_keys)) |
|
97 | 97 | { |
98 | - foreach($extra_keys as $idx => $key) |
|
98 | + foreach ($extra_keys as $idx => $key) |
|
99 | 99 | { |
100 | 100 | $extra_keys[$idx] = clone($key); |
101 | 101 | $val = $vars[$idx]; |
102 | - if(isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
103 | - else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
104 | - else if(isset($val[0])) $v = $val[0]; |
|
102 | + if (isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
103 | + else if (isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
104 | + else if (isset($val[0])) $v = $val[0]; |
|
105 | 105 | else $v = null; |
106 | 106 | $extra_keys[$idx]->value = $v; |
107 | 107 | } |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | $evars = new ExtraVar($module_srl); |
112 | 112 | $evars->setExtraVarKeys($extra_keys); |
113 | 113 | // Title Processing |
114 | - if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
114 | + if ($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title', $vars[-1][$user_lang_code]); |
|
115 | 115 | // Information processing |
116 | - if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
116 | + if ($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content', $vars[-2][$user_lang_code]); |
|
117 | 117 | |
118 | - if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code]) |
|
118 | + if ($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code]) |
|
119 | 119 | { |
120 | 120 | unset($checked_documents[$document_srl]); |
121 | 121 | } |
@@ -132,17 +132,17 @@ discard block |
||
132 | 132 | * @param array $columnList |
133 | 133 | * @return documentItem |
134 | 134 | */ |
135 | - function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
135 | + function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
136 | 136 | { |
137 | - if(!$document_srl) return new documentItem(); |
|
137 | + if (!$document_srl) return new documentItem(); |
|
138 | 138 | |
139 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
139 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
140 | 140 | { |
141 | 141 | $oDocument = new documentItem($document_srl, $load_extra_vars, $columnList); |
142 | 142 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
143 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
143 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
144 | 144 | } |
145 | - if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
145 | + if ($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
146 | 146 | |
147 | 147 | return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
148 | 148 | } |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | * @param array $columnList |
156 | 156 | * @return array value type is documentItem |
157 | 157 | */ |
158 | - function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
158 | + function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
159 | 159 | { |
160 | - if(is_array($document_srls)) |
|
160 | + if (is_array($document_srls)) |
|
161 | 161 | { |
162 | 162 | $list_count = count($document_srls); |
163 | - $document_srls = implode(',',$document_srls); |
|
163 | + $document_srls = implode(',', $document_srls); |
|
164 | 164 | } |
165 | 165 | else |
166 | 166 | { |
@@ -173,33 +173,33 @@ discard block |
||
173 | 173 | |
174 | 174 | $output = executeQuery('document.getDocuments', $args, $columnList); |
175 | 175 | $document_list = $output->data; |
176 | - if(!$document_list) return; |
|
177 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
176 | + if (!$document_list) return; |
|
177 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
178 | 178 | |
179 | 179 | $document_count = count($document_list); |
180 | - foreach($document_list as $key => $attribute) |
|
180 | + foreach ($document_list as $key => $attribute) |
|
181 | 181 | { |
182 | 182 | $document_srl = $attribute->document_srl; |
183 | - if(!$document_srl) continue; |
|
183 | + if (!$document_srl) continue; |
|
184 | 184 | |
185 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
185 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
186 | 186 | { |
187 | 187 | $oDocument = null; |
188 | 188 | $oDocument = new documentItem(); |
189 | 189 | $oDocument->setAttribute($attribute, false); |
190 | - if($is_admin) $oDocument->setGrant(); |
|
190 | + if ($is_admin) $oDocument->setGrant(); |
|
191 | 191 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
192 | 192 | } |
193 | 193 | |
194 | 194 | $result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
195 | 195 | } |
196 | 196 | |
197 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
197 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
198 | 198 | |
199 | 199 | $output = null; |
200 | - if(count($result)) |
|
200 | + if (count($result)) |
|
201 | 201 | { |
202 | - foreach($result as $document_srl => $val) |
|
202 | + foreach ($result as $document_srl => $val) |
|
203 | 203 | { |
204 | 204 | $output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
205 | 205 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param array $columnList |
217 | 217 | * @return Object |
218 | 218 | */ |
219 | - function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array()) |
|
219 | + function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array()) |
|
220 | 220 | { |
221 | 221 | $sort_check = $this->_setSortIndex($obj, $load_extra_vars); |
222 | 222 | $obj->sort_index = $sort_check->sort_index; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // Call trigger (before) |
227 | 227 | // This trigger can be used to set an alternative output using a different search method |
228 | 228 | $output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj); |
229 | - if($output instanceof Object && !$output->toBool()) |
|
229 | + if ($output instanceof Object && !$output->toBool()) |
|
230 | 230 | { |
231 | 231 | return $output; |
232 | 232 | } |
@@ -243,10 +243,10 @@ discard block |
||
243 | 243 | $output = $obj->use_alternate_output; |
244 | 244 | unset($obj->use_alternate_output); |
245 | 245 | } |
246 | - elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
246 | + elseif ($sort_check->isExtraVars && substr_count($obj->search_target, 'extra_vars')) |
|
247 | 247 | { |
248 | 248 | $query_id = 'document.getDocumentListWithinExtraVarsExtraSort'; |
249 | - $args->sort_index = str_replace('documents.','',$args->sort_index); |
|
249 | + $args->sort_index = str_replace('documents.', '', $args->sort_index); |
|
250 | 250 | $output = executeQueryArray($query_id, $args); |
251 | 251 | } |
252 | 252 | elseif ($sort_check->isExtraVars) |
@@ -258,16 +258,16 @@ discard block |
||
258 | 258 | // document.getDocumentList query execution |
259 | 259 | // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because |
260 | 260 | $groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1); |
261 | - if(isset($groupByQuery[$query_id])) |
|
261 | + if (isset($groupByQuery[$query_id])) |
|
262 | 262 | { |
263 | 263 | $group_args = clone($args); |
264 | 264 | $group_args->sort_index = 'documents.'.$args->sort_index; |
265 | 265 | $output = executeQueryArray($query_id, $group_args); |
266 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
266 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
267 | 267 | |
268 | - foreach($output->data as $key => $val) |
|
268 | + foreach ($output->data as $key => $val) |
|
269 | 269 | { |
270 | - if($val->document_srl) $target_srls[] = $val->document_srl; |
|
270 | + if ($val->document_srl) $target_srls[] = $val->document_srl; |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | $page_navigation = $output->page_navigation; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $virtual_number = $keys[0]; |
276 | 276 | |
277 | 277 | $target_args = new stdClass(); |
278 | - $target_args->document_srls = implode(',',$target_srls); |
|
278 | + $target_args->document_srls = implode(',', $target_srls); |
|
279 | 279 | $target_args->list_order = $args->sort_index; |
280 | 280 | $target_args->order_type = $args->order_type; |
281 | 281 | $target_args->list_count = $args->list_count; |
@@ -292,35 +292,35 @@ discard block |
||
292 | 292 | } |
293 | 293 | } |
294 | 294 | // Return if no result or an error occurs |
295 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
295 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
296 | 296 | $idx = 0; |
297 | 297 | $data = $output->data; |
298 | 298 | unset($output->data); |
299 | 299 | |
300 | - if(!isset($virtual_number)) |
|
300 | + if (!isset($virtual_number)) |
|
301 | 301 | { |
302 | 302 | $keys = array_keys($data); |
303 | 303 | $virtual_number = $keys[0]; |
304 | 304 | } |
305 | 305 | |
306 | - if($except_notice) |
|
306 | + if ($except_notice) |
|
307 | 307 | { |
308 | - foreach($data as $key => $attribute) |
|
308 | + foreach ($data as $key => $attribute) |
|
309 | 309 | { |
310 | - if($attribute->is_notice == 'Y') $virtual_number --; |
|
310 | + if ($attribute->is_notice == 'Y') $virtual_number--; |
|
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
314 | - foreach($data as $key => $attribute) |
|
314 | + foreach ($data as $key => $attribute) |
|
315 | 315 | { |
316 | - if($except_notice && $attribute->is_notice == 'Y') continue; |
|
316 | + if ($except_notice && $attribute->is_notice == 'Y') continue; |
|
317 | 317 | $document_srl = $attribute->document_srl; |
318 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
318 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
319 | 319 | { |
320 | 320 | $oDocument = null; |
321 | 321 | $oDocument = new documentItem(); |
322 | 322 | $oDocument->setAttribute($attribute, false); |
323 | - if($is_admin) $oDocument->setGrant(); |
|
323 | + if ($is_admin) $oDocument->setGrant(); |
|
324 | 324 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
325 | 325 | } |
326 | 326 | |
@@ -328,11 +328,11 @@ discard block |
||
328 | 328 | $virtual_number--; |
329 | 329 | } |
330 | 330 | |
331 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
331 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
332 | 332 | |
333 | - if(count($output->data)) |
|
333 | + if (count($output->data)) |
|
334 | 334 | { |
335 | - foreach($output->data as $number => $document) |
|
335 | + foreach ($output->data as $number => $document) |
|
336 | 336 | { |
337 | 337 | $output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl]; |
338 | 338 | } |
@@ -354,16 +354,16 @@ discard block |
||
354 | 354 | { |
355 | 355 | $args = new stdClass(); |
356 | 356 | $args->module_srl = $obj->module_srl; |
357 | - $args->category_srl= $obj->category_srl; |
|
357 | + $args->category_srl = $obj->category_srl; |
|
358 | 358 | $output = executeQueryArray('document.getNoticeList', $args, $columnList); |
359 | - if(!$output->toBool()||!$output->data) return; |
|
359 | + if (!$output->toBool() || !$output->data) return; |
|
360 | 360 | |
361 | - foreach($output->data as $key => $val) |
|
361 | + foreach ($output->data as $key => $val) |
|
362 | 362 | { |
363 | 363 | $document_srl = $val->document_srl; |
364 | - if(!$document_srl) continue; |
|
364 | + if (!$document_srl) continue; |
|
365 | 365 | |
366 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
366 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
367 | 367 | { |
368 | 368 | $oDocument = null; |
369 | 369 | $oDocument = new documentItem(); |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | } |
375 | 375 | $this->setToAllDocumentExtraVars(); |
376 | 376 | |
377 | - foreach($result->data as $document_srl => $val) |
|
377 | + foreach ($result->data as $document_srl => $val) |
|
378 | 378 | { |
379 | 379 | $result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
380 | 380 | } |
@@ -390,20 +390,20 @@ discard block |
||
390 | 390 | */ |
391 | 391 | function getExtraKeys($module_srl) |
392 | 392 | { |
393 | - if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
393 | + if (!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
394 | 394 | { |
395 | 395 | $keys = false; |
396 | 396 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
397 | - if($oCacheHandler->isSupport()) |
|
397 | + if ($oCacheHandler->isSupport()) |
|
398 | 398 | { |
399 | - $object_key = 'module_document_extra_keys:' . $module_srl; |
|
399 | + $object_key = 'module_document_extra_keys:'.$module_srl; |
|
400 | 400 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
401 | 401 | $keys = $oCacheHandler->get($cache_key); |
402 | 402 | } |
403 | 403 | |
404 | 404 | $oExtraVar = ExtraVar::getInstance($module_srl); |
405 | 405 | |
406 | - if($keys === false) |
|
406 | + if ($keys === false) |
|
407 | 407 | { |
408 | 408 | $obj = new stdClass(); |
409 | 409 | $obj->module_srl = $module_srl; |
@@ -413,13 +413,13 @@ discard block |
||
413 | 413 | |
414 | 414 | // correcting index order |
415 | 415 | $isFixed = FALSE; |
416 | - if(is_array($output->data)) |
|
416 | + if (is_array($output->data)) |
|
417 | 417 | { |
418 | 418 | $prevIdx = 0; |
419 | - foreach($output->data as $no => $value) |
|
419 | + foreach ($output->data as $no => $value) |
|
420 | 420 | { |
421 | 421 | // case first |
422 | - if($prevIdx == 0 && $value->idx != 1) |
|
422 | + if ($prevIdx == 0 && $value->idx != 1) |
|
423 | 423 | { |
424 | 424 | $args = new stdClass(); |
425 | 425 | $args->module_srl = $module_srl; |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | } |
434 | 434 | |
435 | 435 | // case others |
436 | - if($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
436 | + if ($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
437 | 437 | { |
438 | 438 | $args = new stdClass(); |
439 | 439 | $args->module_srl = $module_srl; |
@@ -450,16 +450,16 @@ discard block |
||
450 | 450 | } |
451 | 451 | } |
452 | 452 | |
453 | - if($isFixed) |
|
453 | + if ($isFixed) |
|
454 | 454 | { |
455 | 455 | $output = executeQueryArray('document.getDocumentExtraKeys', $obj); |
456 | 456 | } |
457 | 457 | |
458 | 458 | $oExtraVar->setExtraVarKeys($output->data); |
459 | 459 | $keys = $oExtraVar->getExtraVars(); |
460 | - if(!$keys) $keys = array(); |
|
460 | + if (!$keys) $keys = array(); |
|
461 | 461 | |
462 | - if($oCacheHandler->isSupport()) |
|
462 | + if ($oCacheHandler->isSupport()) |
|
463 | 463 | { |
464 | 464 | $oCacheHandler->put($cache_key, $keys); |
465 | 465 | } |
@@ -480,14 +480,14 @@ discard block |
||
480 | 480 | */ |
481 | 481 | function getExtraVars($module_srl, $document_srl) |
482 | 482 | { |
483 | - if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
483 | + if (!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
484 | 484 | { |
485 | 485 | // Extended to extract the values of variables set |
486 | 486 | $oDocument = $this->getDocument($document_srl, false); |
487 | 487 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
488 | 488 | $this->setToAllDocumentExtraVars(); |
489 | 489 | } |
490 | - if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
490 | + if (is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
491 | 491 | return $GLOBALS['XE_EXTRA_VARS'][$document_srl]; |
492 | 492 | } |
493 | 493 | |
@@ -510,71 +510,71 @@ discard block |
||
510 | 510 | |
511 | 511 | $oDocumentController = getController('document'); |
512 | 512 | // Members must be a possible feature |
513 | - if($logged_info->member_srl) |
|
513 | + if ($logged_info->member_srl) |
|
514 | 514 | { |
515 | 515 | $oDocumentModel = getModel('document'); |
516 | 516 | $columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress'); |
517 | 517 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
518 | 518 | $module_srl = $oDocument->get('module_srl'); |
519 | 519 | $member_srl = $oDocument->get('member_srl'); |
520 | - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
520 | + if (!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
521 | 521 | |
522 | 522 | $oModuleModel = getModel('module'); |
523 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
524 | - if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl) |
|
523 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
524 | + if ($document_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) |
|
525 | 525 | { |
526 | 526 | // Add a Referral Button |
527 | 527 | $url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl); |
528 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript'); |
|
528 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote', '', 'javascript'); |
|
529 | 529 | } |
530 | 530 | |
531 | - if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl) |
|
531 | + if ($document_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) |
|
532 | 532 | { |
533 | 533 | // Add button to negative |
534 | - $url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
535 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript'); |
|
534 | + $url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
535 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote_down', '', 'javascript'); |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | // Adding Report |
539 | 539 | $url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl); |
540 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript'); |
|
540 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_declare', '', 'javascript'); |
|
541 | 541 | |
542 | 542 | // Add Bookmark button |
543 | 543 | $url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl); |
544 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript'); |
|
544 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_scrap', '', 'javascript'); |
|
545 | 545 | } |
546 | 546 | // Add print button |
547 | - $url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl); |
|
548 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument'); |
|
547 | + $url = getUrl('', 'module', 'document', 'act', 'dispDocumentPrint', 'document_srl', $document_srl); |
|
548 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_print', '', 'printDocument'); |
|
549 | 549 | // Call a trigger (after) |
550 | 550 | ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list); |
551 | - if($this->grant->manager) |
|
551 | + if ($this->grant->manager) |
|
552 | 552 | { |
553 | 553 | $str_confirm = Context::getLang('confirm_move'); |
554 | 554 | $url = sprintf("if(!confirm('%s')) return; var params = new Array(); params['document_srl']='%s'; params['mid']=current_mid;params['cur_url']=current_url; exec_xml('document', 'procDocumentAdminMoveToTrash', params)", $str_confirm, $document_srl); |
555 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript'); |
|
555 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_trash', '', 'javascript'); |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | // If you are managing to find posts by ip |
559 | - if($logged_info->is_admin == 'Y') |
|
559 | + if ($logged_info->is_admin == 'Y') |
|
560 | 560 | { |
561 | 561 | $oDocumentModel = getModel('document'); |
562 | - $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
562 | + $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
563 | 563 | |
564 | - if($oDocument->isExists()) |
|
564 | + if ($oDocument->isExists()) |
|
565 | 565 | { |
566 | 566 | // Find a post equivalent to ip address |
567 | - $url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress()); |
|
568 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress'); |
|
567 | + $url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oDocument->getIpAddress()); |
|
568 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress'); |
|
569 | 569 | |
570 | 570 | $url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress()); |
571 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript'); |
|
571 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript'); |
|
572 | 572 | } |
573 | 573 | } |
574 | 574 | // Changing the language of pop-up menu |
575 | 575 | $menus = Context::get('document_popup_menu_list'); |
576 | 576 | $menus_count = count($menus); |
577 | - for($i=0;$i<$menus_count;$i++) |
|
577 | + for ($i = 0; $i < $menus_count; $i++) |
|
578 | 578 | { |
579 | 579 | $menus[$i]->str = Context::getLang($menus[$i]->str); |
580 | 580 | } |
@@ -590,13 +590,13 @@ discard block |
||
590 | 590 | */ |
591 | 591 | function getDocumentCount($module_srl, $search_obj = NULL) |
592 | 592 | { |
593 | - if(is_null($search_obj)) $search_obj = new stdClass(); |
|
593 | + if (is_null($search_obj)) $search_obj = new stdClass(); |
|
594 | 594 | $search_obj->module_srl = $module_srl; |
595 | 595 | |
596 | 596 | $output = executeQuery('document.getDocumentCount', $search_obj); |
597 | 597 | // Return total number of |
598 | 598 | $total_count = $output->data->count; |
599 | - return (int)$total_count; |
|
599 | + return (int) $total_count; |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | /** |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | function getDocumentCountByGroupStatus($search_obj = NULL) |
608 | 608 | { |
609 | 609 | $output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj); |
610 | - if(!$output->toBool()) return array(); |
|
610 | + if (!$output->toBool()) return array(); |
|
611 | 611 | |
612 | 612 | return $output->data; |
613 | 613 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | $output = executeQuery('document.getDocumentExtraVarsCount', $args); |
627 | 627 | // Return total number of |
628 | 628 | $total_count = $output->data->count; |
629 | - return (int)$total_count; |
|
629 | + return (int) $total_count; |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | /** |
@@ -643,17 +643,17 @@ discard block |
||
643 | 643 | |
644 | 644 | $this->_setSearchOption($opt, $args, $query_id, $use_division); |
645 | 645 | |
646 | - if($sort_check->isExtraVars) |
|
646 | + if ($sort_check->isExtraVars) |
|
647 | 647 | { |
648 | 648 | return 1; |
649 | 649 | } |
650 | 650 | else |
651 | 651 | { |
652 | - if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
652 | + if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
653 | 653 | { |
654 | - if($args->order_type === 'desc') |
|
654 | + if ($args->order_type === 'desc') |
|
655 | 655 | { |
656 | - $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
656 | + $args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
657 | 657 | } |
658 | 658 | else |
659 | 659 | { |
@@ -667,9 +667,9 @@ discard block |
||
667 | 667 | } |
668 | 668 | |
669 | 669 | // Guhanhu total number of the article search page |
670 | - $output = executeQuery($query_id . 'Page', $args); |
|
670 | + $output = executeQuery($query_id.'Page', $args); |
|
671 | 671 | $count = $output->data->count; |
672 | - $page = (int)(($count-1)/$opt->list_count)+1; |
|
672 | + $page = (int) (($count - 1) / $opt->list_count) + 1; |
|
673 | 673 | return $page; |
674 | 674 | } |
675 | 675 | |
@@ -681,16 +681,16 @@ discard block |
||
681 | 681 | */ |
682 | 682 | function getCategory($category_srl, $columnList = array()) |
683 | 683 | { |
684 | - $args =new stdClass(); |
|
684 | + $args = new stdClass(); |
|
685 | 685 | $args->category_srl = $category_srl; |
686 | 686 | $output = executeQuery('document.getCategory', $args, $columnList); |
687 | 687 | |
688 | 688 | $node = $output->data; |
689 | - if(!$node) return; |
|
689 | + if (!$node) return; |
|
690 | 690 | |
691 | - if($node->group_srls) |
|
691 | + if ($node->group_srls) |
|
692 | 692 | { |
693 | - $group_srls = explode(',',$node->group_srls); |
|
693 | + $group_srls = explode(',', $node->group_srls); |
|
694 | 694 | unset($node->group_srls); |
695 | 695 | $node->group_srls = $group_srls; |
696 | 696 | } |
@@ -711,8 +711,8 @@ discard block |
||
711 | 711 | { |
712 | 712 | $args = new stdClass(); |
713 | 713 | $args->category_srl = $category_srl; |
714 | - $output = executeQuery('document.getChildCategoryCount',$args); |
|
715 | - if($output->data->count > 0) return true; |
|
714 | + $output = executeQuery('document.getChildCategoryCount', $args); |
|
715 | + if ($output->data->count > 0) return true; |
|
716 | 716 | return false; |
717 | 717 | } |
718 | 718 | |
@@ -728,10 +728,10 @@ discard block |
||
728 | 728 | // Category of the target module file swollen |
729 | 729 | $filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl); |
730 | 730 | // If the target file to the cache file regeneration category |
731 | - if(!file_exists($filename)) |
|
731 | + if (!file_exists($filename)) |
|
732 | 732 | { |
733 | 733 | $oDocumentController = getController('document'); |
734 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
734 | + if (!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | include($filename); |
@@ -751,10 +751,10 @@ discard block |
||
751 | 751 | */ |
752 | 752 | function _arrangeCategory(&$document_category, $list, $depth) |
753 | 753 | { |
754 | - if(!count($list)) return; |
|
754 | + if (!count($list)) return; |
|
755 | 755 | $idx = 0; |
756 | 756 | $list_order = array(); |
757 | - foreach($list as $key => $val) |
|
757 | + foreach ($list as $key => $val) |
|
758 | 758 | { |
759 | 759 | $obj = new stdClass; |
760 | 760 | $obj->mid = $val['mid']; |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | $obj->parent_srl = $val['parent_srl']; |
764 | 764 | $obj->title = $obj->text = $val['text']; |
765 | 765 | $obj->description = $val['description']; |
766 | - $obj->expand = $val['expand']=='Y'?true:false; |
|
766 | + $obj->expand = $val['expand'] == 'Y' ? true : false; |
|
767 | 767 | $obj->color = $val['color']; |
768 | 768 | $obj->document_count = $val['document_count']; |
769 | 769 | $obj->depth = $depth; |
@@ -771,26 +771,26 @@ discard block |
||
771 | 771 | $obj->childs = array(); |
772 | 772 | $obj->grant = $val['grant']; |
773 | 773 | |
774 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
774 | + if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
775 | 775 | else $selected = false; |
776 | 776 | |
777 | 777 | $obj->selected = $selected; |
778 | 778 | |
779 | 779 | $list_order[$idx++] = $obj->category_srl; |
780 | 780 | // If you have a parent category of child nodes apply data |
781 | - if($obj->parent_srl) |
|
781 | + if ($obj->parent_srl) |
|
782 | 782 | { |
783 | 783 | $parent_srl = $obj->parent_srl; |
784 | 784 | $document_count = $obj->document_count; |
785 | 785 | $expand = $obj->expand; |
786 | - if($selected) $expand = true; |
|
786 | + if ($selected) $expand = true; |
|
787 | 787 | |
788 | - while($parent_srl) |
|
788 | + while ($parent_srl) |
|
789 | 789 | { |
790 | 790 | $document_category[$parent_srl]->document_count += $document_count; |
791 | 791 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
792 | 792 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
793 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
793 | + if ($expand) $document_category[$parent_srl]->expand = $expand; |
|
794 | 794 | |
795 | 795 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
796 | 796 | } |
@@ -798,10 +798,10 @@ discard block |
||
798 | 798 | |
799 | 799 | $document_category[$key] = $obj; |
800 | 800 | |
801 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
801 | + if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1); |
|
802 | 802 | } |
803 | 803 | $document_category[$list_order[0]]->first = true; |
804 | - $document_category[$list_order[count($list_order)-1]]->last = true; |
|
804 | + $document_category[$list_order[count($list_order) - 1]]->last = true; |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | /** |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | $args->module_srl = $module_srl; |
817 | 817 | $args->category_srl = $category_srl; |
818 | 818 | $output = executeQuery('document.getCategoryDocumentCount', $args); |
819 | - return (int)$output->data->count; |
|
819 | + return (int) $output->data->count; |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | /** |
@@ -826,8 +826,8 @@ discard block |
||
826 | 826 | */ |
827 | 827 | function getCategoryXmlFile($module_srl) |
828 | 828 | { |
829 | - $xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl); |
|
830 | - if(!file_exists($xml_file)) |
|
829 | + $xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl); |
|
830 | + if (!file_exists($xml_file)) |
|
831 | 831 | { |
832 | 832 | $oDocumentController = getController('document'); |
833 | 833 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -842,8 +842,8 @@ discard block |
||
842 | 842 | */ |
843 | 843 | function getCategoryPhpFile($module_srl) |
844 | 844 | { |
845 | - $php_file = sprintf('files/cache/document_category/%s.php',$module_srl); |
|
846 | - if(!file_exists($php_file)) |
|
845 | + $php_file = sprintf('files/cache/document_category/%s.php', $module_srl); |
|
846 | + if (!file_exists($php_file)) |
|
847 | 847 | { |
848 | 848 | $oDocumentController = getController('document'); |
849 | 849 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | */ |
859 | 859 | function getMonthlyArchivedList($obj) |
860 | 860 | { |
861 | - if($obj->mid) |
|
861 | + if ($obj->mid) |
|
862 | 862 | { |
863 | 863 | $oModuleModel = getModel('module'); |
864 | 864 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -866,13 +866,13 @@ discard block |
||
866 | 866 | } |
867 | 867 | // Module_srl passed the array may be a check whether the array |
868 | 868 | $args = new stdClass; |
869 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
869 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
870 | 870 | else $args->module_srl = $obj->module_srl; |
871 | 871 | |
872 | 872 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
873 | - if(!$output->toBool()||!$output->data) return $output; |
|
873 | + if (!$output->toBool() || !$output->data) return $output; |
|
874 | 874 | |
875 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
875 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
876 | 876 | |
877 | 877 | return $output; |
878 | 878 | } |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | */ |
885 | 885 | function getDailyArchivedList($obj) |
886 | 886 | { |
887 | - if($obj->mid) |
|
887 | + if ($obj->mid) |
|
888 | 888 | { |
889 | 889 | $oModuleModel = getModel('module'); |
890 | 890 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -892,14 +892,14 @@ discard block |
||
892 | 892 | } |
893 | 893 | // Module_srl passed the array may be a check whether the array |
894 | 894 | $args = new stdClass; |
895 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
895 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
896 | 896 | else $args->module_srl = $obj->module_srl; |
897 | 897 | $args->regdate = $obj->regdate; |
898 | 898 | |
899 | 899 | $output = executeQuery('document.getDailyArchivedList', $args); |
900 | - if(!$output->toBool()) return $output; |
|
900 | + if (!$output->toBool()) return $output; |
|
901 | 901 | |
902 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
902 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
903 | 903 | |
904 | 904 | return $output; |
905 | 905 | } |
@@ -910,17 +910,17 @@ discard block |
||
910 | 910 | */ |
911 | 911 | function getDocumentCategories() |
912 | 912 | { |
913 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
913 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
914 | 914 | $module_srl = Context::get('module_srl'); |
915 | - $categories= $this->getCategoryList($module_srl); |
|
915 | + $categories = $this->getCategoryList($module_srl); |
|
916 | 916 | $lang = Context::get('lang'); |
917 | 917 | // No additional category |
918 | 918 | $output = "0,0,{$lang->none_category}\n"; |
919 | - if($categories) |
|
919 | + if ($categories) |
|
920 | 920 | { |
921 | - foreach($categories as $category_srl => $category) |
|
921 | + foreach ($categories as $category_srl => $category) |
|
922 | 922 | { |
923 | - $output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title); |
|
923 | + $output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title); |
|
924 | 924 | } |
925 | 925 | } |
926 | 926 | $this->add('categories', $output); |
@@ -932,13 +932,13 @@ discard block |
||
932 | 932 | */ |
933 | 933 | function getDocumentConfig() |
934 | 934 | { |
935 | - if(!$GLOBALS['__document_config__']) |
|
935 | + if (!$GLOBALS['__document_config__']) |
|
936 | 936 | { |
937 | 937 | $oModuleModel = getModel('module'); |
938 | 938 | $config = $oModuleModel->getModuleConfig('document'); |
939 | 939 | |
940 | - if(!$config) $config = new stdClass(); |
|
941 | - if(!$config->thumbnail_type) $config->thumbnail_type = 'crop'; |
|
940 | + if (!$config) $config = new stdClass(); |
|
941 | + if (!$config->thumbnail_type) $config->thumbnail_type = 'crop'; |
|
942 | 942 | $GLOBALS['__document_config__'] = $config; |
943 | 943 | } |
944 | 944 | return $GLOBALS['__document_config__']; |
@@ -1003,11 +1003,11 @@ discard block |
||
1003 | 1003 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
1004 | 1004 | // Check permissions |
1005 | 1005 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
1006 | - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); |
|
1006 | + if (!$grant->manager) return new Object(-1, 'msg_not_permitted'); |
|
1007 | 1007 | |
1008 | 1008 | $category_srl = Context::get('category_srl'); |
1009 | 1009 | $category_info = $this->getCategory($category_srl); |
1010 | - if(!$category_info) |
|
1010 | + if (!$category_info) |
|
1011 | 1011 | { |
1012 | 1012 | return new Object(-1, 'msg_invalid_request'); |
1013 | 1013 | } |
@@ -1023,14 +1023,14 @@ discard block |
||
1023 | 1023 | */ |
1024 | 1024 | function getDocumentSrlByAlias($mid, $alias) |
1025 | 1025 | { |
1026 | - if(!$mid || !$alias) return null; |
|
1026 | + if (!$mid || !$alias) return null; |
|
1027 | 1027 | $site_module_info = Context::get('site_module_info'); |
1028 | 1028 | $args = new stdClass; |
1029 | 1029 | $args->mid = $mid; |
1030 | 1030 | $args->alias_title = $alias; |
1031 | 1031 | $args->site_srl = $site_module_info->site_srl; |
1032 | 1032 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
1033 | - if(!$output->data) return null; |
|
1033 | + if (!$output->data) return null; |
|
1034 | 1034 | else return $output->data->document_srl; |
1035 | 1035 | } |
1036 | 1036 | |
@@ -1042,15 +1042,15 @@ discard block |
||
1042 | 1042 | */ |
1043 | 1043 | function getDocumentSrlByTitle($module_srl, $title) |
1044 | 1044 | { |
1045 | - if(!$module_srl || !$title) return null; |
|
1045 | + if (!$module_srl || !$title) return null; |
|
1046 | 1046 | $args = new stdClass; |
1047 | 1047 | $args->module_srl = $module_srl; |
1048 | 1048 | $args->title = $title; |
1049 | 1049 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
1050 | - if(!$output->data) return null; |
|
1050 | + if (!$output->data) return null; |
|
1051 | 1051 | else |
1052 | 1052 | { |
1053 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
1053 | + if (is_array($output->data)) return $output->data[0]->document_srl; |
|
1054 | 1054 | return $output->data->document_srl; |
1055 | 1055 | } |
1056 | 1056 | } |
@@ -1062,12 +1062,12 @@ discard block |
||
1062 | 1062 | */ |
1063 | 1063 | function getAlias($document_srl) |
1064 | 1064 | { |
1065 | - if(!$document_srl) return null; |
|
1065 | + if (!$document_srl) return null; |
|
1066 | 1066 | $args = new stdClass; |
1067 | 1067 | $args->document_srl = $document_srl; |
1068 | 1068 | $output = executeQueryArray('document.getAliases', $args); |
1069 | 1069 | |
1070 | - if(!$output->data) return null; |
|
1070 | + if (!$output->data) return null; |
|
1071 | 1071 | else return $output->data[0]->alias_title; |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1110,32 +1110,32 @@ discard block |
||
1110 | 1110 | { |
1111 | 1111 | // Variable check |
1112 | 1112 | $args = new stdClass; |
1113 | - $args->category_srl = $obj->category_srl?$obj->category_srl:null; |
|
1113 | + $args->category_srl = $obj->category_srl ? $obj->category_srl : null; |
|
1114 | 1114 | $args->sort_index = $obj->sort_index; |
1115 | - $args->order_type = $obj->order_type?$obj->order_type:'desc'; |
|
1116 | - $args->page = $obj->page?$obj->page:1; |
|
1117 | - $args->list_count = $obj->list_count?$obj->list_count:20; |
|
1118 | - $args->page_count = $obj->page_count?$obj->page_count:10; |
|
1115 | + $args->order_type = $obj->order_type ? $obj->order_type : 'desc'; |
|
1116 | + $args->page = $obj->page ? $obj->page : 1; |
|
1117 | + $args->list_count = $obj->list_count ? $obj->list_count : 20; |
|
1118 | + $args->page_count = $obj->page_count ? $obj->page_count : 10; |
|
1119 | 1119 | // Search options |
1120 | 1120 | $search_target = $obj->search_target; |
1121 | 1121 | $search_keyword = $obj->search_keyword; |
1122 | - if($search_target && $search_keyword) |
|
1122 | + if ($search_target && $search_keyword) |
|
1123 | 1123 | { |
1124 | - switch($search_target) |
|
1124 | + switch ($search_target) |
|
1125 | 1125 | { |
1126 | 1126 | case 'title' : |
1127 | 1127 | case 'content' : |
1128 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1128 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1129 | 1129 | $args->{"s_".$search_target} = $search_keyword; |
1130 | 1130 | $use_division = true; |
1131 | 1131 | break; |
1132 | 1132 | case 'title_content' : |
1133 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1133 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1134 | 1134 | $args->s_title = $search_keyword; |
1135 | 1135 | $args->s_content = $search_keyword; |
1136 | 1136 | break; |
1137 | 1137 | case 'user_id' : |
1138 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1138 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1139 | 1139 | $args->s_user_id = $search_keyword; |
1140 | 1140 | $args->sort_index = 'documents.'.$args->sort_index; |
1141 | 1141 | break; |
@@ -1143,13 +1143,13 @@ discard block |
||
1143 | 1143 | case 'nick_name' : |
1144 | 1144 | case 'email_address' : |
1145 | 1145 | case 'homepage' : |
1146 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1146 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1147 | 1147 | $args->{"s_".$search_target} = $search_keyword; |
1148 | 1148 | break; |
1149 | 1149 | case 'is_notice' : |
1150 | 1150 | case 'is_secret' : |
1151 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
1152 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1151 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
1152 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1153 | 1153 | break; |
1154 | 1154 | case 'member_srl' : |
1155 | 1155 | case 'readed_count' : |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | case 'comment_count' : |
1159 | 1159 | case 'trackback_count' : |
1160 | 1160 | case 'uploaded_count' : |
1161 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
1161 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
1162 | 1162 | break; |
1163 | 1163 | case 'regdate' : |
1164 | 1164 | case 'last_update' : |
@@ -1170,9 +1170,9 @@ discard block |
||
1170 | 1170 | } |
1171 | 1171 | |
1172 | 1172 | $output = executeQueryArray('document.getTrashList', $args); |
1173 | - if($output->data) |
|
1173 | + if ($output->data) |
|
1174 | 1174 | { |
1175 | - foreach($output->data as $key => $attribute) |
|
1175 | + foreach ($output->data as $key => $attribute) |
|
1176 | 1176 | { |
1177 | 1177 | $oDocument = null; |
1178 | 1178 | $oDocument = new documentItem(); |
@@ -1191,46 +1191,46 @@ discard block |
||
1191 | 1191 | { |
1192 | 1192 | $args = new stdClass; |
1193 | 1193 | $document_srl = Context::get('document_srl'); |
1194 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
1194 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
1195 | 1195 | |
1196 | 1196 | $point = Context::get('point'); |
1197 | - if($point != -1) $point = 1; |
|
1197 | + if ($point != -1) $point = 1; |
|
1198 | 1198 | |
1199 | 1199 | $oDocumentModel = getModel('document'); |
1200 | 1200 | $columnList = array('document_srl', 'module_srl'); |
1201 | 1201 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
1202 | 1202 | $module_srl = $oDocument->get('module_srl'); |
1203 | - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
1203 | + if (!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
1204 | 1204 | |
1205 | 1205 | $oModuleModel = getModel('module'); |
1206 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
1207 | - if($point == -1) |
|
1206 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
1207 | + if ($point == -1) |
|
1208 | 1208 | { |
1209 | - if($document_config->use_vote_down!='S') return new Object(-1, 'msg_invalid_request'); |
|
1209 | + if ($document_config->use_vote_down != 'S') return new Object(-1, 'msg_invalid_request'); |
|
1210 | 1210 | $args->below_point = 0; |
1211 | 1211 | } |
1212 | 1212 | else |
1213 | 1213 | { |
1214 | - if($document_config->use_vote_up!='S') return new Object(-1, 'msg_invalid_request'); |
|
1214 | + if ($document_config->use_vote_up != 'S') return new Object(-1, 'msg_invalid_request'); |
|
1215 | 1215 | $args->more_point = 0; |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | $args->document_srl = $document_srl; |
1219 | 1219 | |
1220 | - $output = executeQueryArray('document.getVotedMemberList',$args); |
|
1221 | - if(!$output->toBool()) return $output; |
|
1220 | + $output = executeQueryArray('document.getVotedMemberList', $args); |
|
1221 | + if (!$output->toBool()) return $output; |
|
1222 | 1222 | |
1223 | 1223 | $oMemberModel = getModel('member'); |
1224 | - if($output->data) |
|
1224 | + if ($output->data) |
|
1225 | 1225 | { |
1226 | - foreach($output->data as $k => $d) |
|
1226 | + foreach ($output->data as $k => $d) |
|
1227 | 1227 | { |
1228 | 1228 | $profile_image = $oMemberModel->getProfileImage($d->member_srl); |
1229 | 1229 | $output->data[$k]->src = $profile_image->src; |
1230 | 1230 | } |
1231 | 1231 | } |
1232 | 1232 | |
1233 | - $this->add('voted_member_list',$output->data); |
|
1233 | + $this->add('voted_member_list', $output->data); |
|
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | /** |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | function getStatusNameList() |
1241 | 1241 | { |
1242 | 1242 | global $lang; |
1243 | - if(!isset($lang->status_name_list)) |
|
1243 | + if (!isset($lang->status_name_list)) |
|
1244 | 1244 | return array_flip($this->getStatusList()); |
1245 | 1245 | else return $lang->status_name_list; |
1246 | 1246 | } |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | { |
1256 | 1256 | $sortIndex = $obj->sort_index; |
1257 | 1257 | $isExtraVars = false; |
1258 | - if(!in_array($sortIndex, array('list_order','regdate','last_update','update_order','readed_count','voted_count','blamed_count','comment_count','trackback_count','uploaded_count','title','category_srl'))) |
|
1258 | + if (!in_array($sortIndex, array('list_order', 'regdate', 'last_update', 'update_order', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count', 'uploaded_count', 'title', 'category_srl'))) |
|
1259 | 1259 | { |
1260 | 1260 | // get module_srl extra_vars list |
1261 | 1261 | if ($load_extra_vars) |
@@ -1270,11 +1270,11 @@ discard block |
||
1270 | 1270 | else |
1271 | 1271 | { |
1272 | 1272 | $check_array = array(); |
1273 | - foreach($extra_output->data as $val) |
|
1273 | + foreach ($extra_output->data as $val) |
|
1274 | 1274 | { |
1275 | 1275 | $check_array[] = $val->eid; |
1276 | 1276 | } |
1277 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
1277 | + if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
1278 | 1278 | else $isExtraVars = true; |
1279 | 1279 | } |
1280 | 1280 | } |
@@ -1302,13 +1302,13 @@ discard block |
||
1302 | 1302 | { |
1303 | 1303 | // Variable check |
1304 | 1304 | $args = new stdClass(); |
1305 | - $args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null; |
|
1305 | + $args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null; |
|
1306 | 1306 | $args->order_type = $searchOpt->order_type; |
1307 | - $args->page = $searchOpt->page?$searchOpt->page:1; |
|
1308 | - $args->list_count = $searchOpt->list_count?$searchOpt->list_count:20; |
|
1309 | - $args->page_count = $searchOpt->page_count?$searchOpt->page_count:10; |
|
1310 | - $args->start_date = $searchOpt->start_date?$searchOpt->start_date:null; |
|
1311 | - $args->end_date = $searchOpt->end_date?$searchOpt->end_date:null; |
|
1307 | + $args->page = $searchOpt->page ? $searchOpt->page : 1; |
|
1308 | + $args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20; |
|
1309 | + $args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10; |
|
1310 | + $args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null; |
|
1311 | + $args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null; |
|
1312 | 1312 | $args->member_srl = $searchOpt->member_srl; |
1313 | 1313 | |
1314 | 1314 | $logged_info = Context::get('logged_info'); |
@@ -1317,10 +1317,10 @@ discard block |
||
1317 | 1317 | |
1318 | 1318 | // Check the target and sequence alignment |
1319 | 1319 | $orderType = array('desc' => 1, 'asc' => 1); |
1320 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
1320 | + if (!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
1321 | 1321 | |
1322 | 1322 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
1323 | - if($searchOpt->mid) |
|
1323 | + if ($searchOpt->mid) |
|
1324 | 1324 | { |
1325 | 1325 | $oModuleModel = getModel('module'); |
1326 | 1326 | $args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -1328,30 +1328,30 @@ discard block |
||
1328 | 1328 | } |
1329 | 1329 | |
1330 | 1330 | // Module_srl passed the array may be a check whether the array |
1331 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
1331 | + if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
1332 | 1332 | else $args->module_srl = $searchOpt->module_srl; |
1333 | 1333 | |
1334 | 1334 | // Except for the test module_srl |
1335 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
1335 | + if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
1336 | 1336 | else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
1337 | 1337 | |
1338 | 1338 | // only admin document list, temp document showing |
1339 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
1339 | + if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
1340 | 1340 | else |
1341 | 1341 | { |
1342 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
1342 | + if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
1343 | 1343 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
1344 | 1344 | else |
1345 | 1345 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
1346 | 1346 | } |
1347 | 1347 | |
1348 | 1348 | // Category is selected, further sub-categories until all conditions |
1349 | - if($args->category_srl) |
|
1349 | + if ($args->category_srl) |
|
1350 | 1350 | { |
1351 | 1351 | $category_list = $this->getCategoryList($args->module_srl); |
1352 | 1352 | $category_info = $category_list[$args->category_srl]; |
1353 | 1353 | $category_info->childs[] = $args->category_srl; |
1354 | - $args->category_srl = implode(',',$category_info->childs); |
|
1354 | + $args->category_srl = implode(',', $category_info->childs); |
|
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | // Used to specify the default query id (based on several search options to query id modified) |
@@ -1364,24 +1364,24 @@ discard block |
||
1364 | 1364 | $search_target = $searchOpt->search_target; |
1365 | 1365 | $search_keyword = $searchOpt->search_keyword; |
1366 | 1366 | |
1367 | - if($search_target && $search_keyword) |
|
1367 | + if ($search_target && $search_keyword) |
|
1368 | 1368 | { |
1369 | - switch($search_target) |
|
1369 | + switch ($search_target) |
|
1370 | 1370 | { |
1371 | 1371 | case 'title' : |
1372 | 1372 | case 'content' : |
1373 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1373 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1374 | 1374 | $args->{"s_".$search_target} = $search_keyword; |
1375 | 1375 | $use_division = true; |
1376 | 1376 | break; |
1377 | 1377 | case 'title_content' : |
1378 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1378 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1379 | 1379 | $args->s_title = $search_keyword; |
1380 | 1380 | $args->s_content = $search_keyword; |
1381 | 1381 | $use_division = true; |
1382 | 1382 | break; |
1383 | 1383 | case 'user_id' : |
1384 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1384 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1385 | 1385 | $args->s_user_id = $search_keyword; |
1386 | 1386 | $args->sort_index = 'documents.'.$args->sort_index; |
1387 | 1387 | break; |
@@ -1389,18 +1389,18 @@ discard block |
||
1389 | 1389 | case 'nick_name' : |
1390 | 1390 | case 'email_address' : |
1391 | 1391 | case 'homepage' : |
1392 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1392 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1393 | 1393 | $args->{"s_".$search_target} = $search_keyword; |
1394 | 1394 | break; |
1395 | 1395 | case 'is_notice' : |
1396 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
1397 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
1396 | + if ($search_keyword == 'N') $args->{"s_".$search_target} = 'N'; |
|
1397 | + elseif ($search_keyword == 'Y') $args->{"s_".$search_target} = 'Y'; |
|
1398 | 1398 | else $args->{"s_".$search_target} = ''; |
1399 | 1399 | break; |
1400 | 1400 | case 'is_secret' : |
1401 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
1402 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1403 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
1401 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
1402 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1403 | + elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
1404 | 1404 | break; |
1405 | 1405 | case 'member_srl' : |
1406 | 1406 | case 'readed_count' : |
@@ -1408,10 +1408,10 @@ discard block |
||
1408 | 1408 | case 'comment_count' : |
1409 | 1409 | case 'trackback_count' : |
1410 | 1410 | case 'uploaded_count' : |
1411 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
1411 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
1412 | 1412 | break; |
1413 | 1413 | case 'blamed_count' : |
1414 | - $args->{"s_".$search_target} = (int)$search_keyword * -1; |
|
1414 | + $args->{"s_".$search_target} = (int) $search_keyword * -1; |
|
1415 | 1415 | break; |
1416 | 1416 | case 'regdate' : |
1417 | 1417 | case 'last_update' : |
@@ -1424,7 +1424,7 @@ discard block |
||
1424 | 1424 | $use_division = true; |
1425 | 1425 | break; |
1426 | 1426 | case 'tag' : |
1427 | - $args->s_tags = str_replace(' ','%',$search_keyword); |
|
1427 | + $args->s_tags = str_replace(' ', '%', $search_keyword); |
|
1428 | 1428 | $query_id = 'document.getDocumentListWithinTag'; |
1429 | 1429 | break; |
1430 | 1430 | case 'extra_vars': |
@@ -1432,9 +1432,9 @@ discard block |
||
1432 | 1432 | $query_id = 'document.getDocumentListWithinExtraVars'; |
1433 | 1433 | break; |
1434 | 1434 | default : |
1435 | - if(strpos($search_target,'extra_vars')!==false) { |
|
1435 | + if (strpos($search_target, 'extra_vars') !== false) { |
|
1436 | 1436 | $args->var_idx = substr($search_target, strlen('extra_vars')); |
1437 | - $args->var_value = str_replace(' ','%',$search_keyword); |
|
1437 | + $args->var_value = str_replace(' ', '%', $search_keyword); |
|
1438 | 1438 | $args->sort_index = 'documents.'.$args->sort_index; |
1439 | 1439 | $query_id = 'document.getDocumentListWithExtraVars'; |
1440 | 1440 | } |
@@ -1451,18 +1451,18 @@ discard block |
||
1451 | 1451 | /** |
1452 | 1452 | * list_order asc sort of division that can be used only when |
1453 | 1453 | */ |
1454 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
1454 | + if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
1455 | 1455 | |
1456 | 1456 | /** |
1457 | 1457 | * If it is true, use_division changed to use the document division |
1458 | 1458 | */ |
1459 | - if($use_division) |
|
1459 | + if ($use_division) |
|
1460 | 1460 | { |
1461 | 1461 | // Division begins |
1462 | - $division = (int)Context::get('division'); |
|
1462 | + $division = (int) Context::get('division'); |
|
1463 | 1463 | |
1464 | 1464 | // order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan |
1465 | - if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
1465 | + if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
1466 | 1466 | { |
1467 | 1467 | $listSqlID = 'document.getDocumentListUseIndex'; |
1468 | 1468 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
@@ -1474,7 +1474,7 @@ discard block |
||
1474 | 1474 | } |
1475 | 1475 | |
1476 | 1476 | // If you do not value the best division top |
1477 | - if(!$division) |
|
1477 | + if (!$division) |
|
1478 | 1478 | { |
1479 | 1479 | $division_args = new stdClass(); |
1480 | 1480 | $division_args->module_srl = $args->module_srl; |
@@ -1485,7 +1485,7 @@ discard block |
||
1485 | 1485 | $division_args->statusList = $args->statusList; |
1486 | 1486 | |
1487 | 1487 | $output = executeQuery($divisionSqlID, $division_args, array('list_order')); |
1488 | - if($output->data) |
|
1488 | + if ($output->data) |
|
1489 | 1489 | { |
1490 | 1490 | $item = array_pop($output->data); |
1491 | 1491 | $division = $item->list_order; |
@@ -1494,10 +1494,10 @@ discard block |
||
1494 | 1494 | } |
1495 | 1495 | |
1496 | 1496 | // The last division |
1497 | - $last_division = (int)Context::get('last_division'); |
|
1497 | + $last_division = (int) Context::get('last_division'); |
|
1498 | 1498 | |
1499 | 1499 | // Division after division from the 5000 value of the specified Wanted |
1500 | - if(!$last_division) |
|
1500 | + if (!$last_division) |
|
1501 | 1501 | { |
1502 | 1502 | $last_division_args = new stdClass(); |
1503 | 1503 | $last_division_args->module_srl = $args->module_srl; |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | $last_division_args->page = 5001; |
1510 | 1510 | |
1511 | 1511 | $output = executeQuery($divisionSqlID, $last_division_args, array('list_order')); |
1512 | - if($output->data) |
|
1512 | + if ($output->data) |
|
1513 | 1513 | { |
1514 | 1514 | $item = array_pop($output->data); |
1515 | 1515 | $last_division = $item->list_order; |
@@ -1517,14 +1517,14 @@ discard block |
||
1517 | 1517 | } |
1518 | 1518 | |
1519 | 1519 | // Make sure that after last_division article |
1520 | - if($last_division) |
|
1520 | + if ($last_division) |
|
1521 | 1521 | { |
1522 | 1522 | $last_division_args = new stdClass(); |
1523 | 1523 | $last_division_args->module_srl = $args->module_srl; |
1524 | 1524 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
1525 | 1525 | $last_division_args->list_order = $last_division; |
1526 | 1526 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
1527 | - if($output->data->count<1) $last_division = null; |
|
1527 | + if ($output->data->count < 1) $last_division = null; |
|
1528 | 1528 | } |
1529 | 1529 | |
1530 | 1530 | $args->division = $division; |
@@ -1557,7 +1557,7 @@ discard block |
||
1557 | 1557 | * @param int $count |
1558 | 1558 | * @return object |
1559 | 1559 | */ |
1560 | - function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 ) |
|
1560 | + function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0) |
|
1561 | 1561 | { |
1562 | 1562 | $args = new stdClass(); |
1563 | 1563 | $args->member_srl = $member_srl; |
@@ -1565,8 +1565,8 @@ discard block |
||
1565 | 1565 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
1566 | 1566 | $document_list = $output->data; |
1567 | 1567 | |
1568 | - if(!$document_list) return array(); |
|
1569 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
1568 | + if (!$document_list) return array(); |
|
1569 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
1570 | 1570 | |
1571 | 1571 | return $document_list; |
1572 | 1572 | } |
@@ -56,18 +56,24 @@ discard block |
||
56 | 56 | $_document_list = &$GLOBALS['XE_DOCUMENT_LIST']; |
57 | 57 | |
58 | 58 | // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings |
59 | - if(count($_document_list) <= 0) return; |
|
59 | + if(count($_document_list) <= 0) { |
|
60 | + return; |
|
61 | + } |
|
60 | 62 | |
61 | 63 | // Find all called the document object variable has been set extension |
62 | 64 | $document_srls = array(); |
63 | 65 | foreach($_document_list as $key => $val) |
64 | 66 | { |
65 | - if(!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
67 | + if(!$val->document_srl || $checked_documents[$val->document_srl]) { |
|
68 | + continue; |
|
69 | + } |
|
66 | 70 | $checked_documents[$val->document_srl] = true; |
67 | 71 | $document_srls[] = $val->document_srl; |
68 | 72 | } |
69 | 73 | // If the document number, return detected |
70 | - if(!count($document_srls)) return; |
|
74 | + if(!count($document_srls)) { |
|
75 | + return; |
|
76 | + } |
|
71 | 77 | // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable |
72 | 78 | //$obj->document_srl = implode(',',$document_srls); |
73 | 79 | $output = $this->getDocumentExtraVarsFromDB($document_srls); |
@@ -75,8 +81,12 @@ discard block |
||
75 | 81 | { |
76 | 82 | foreach($output->data as $key => $val) |
77 | 83 | { |
78 | - if(!isset($val->value)) continue; |
|
79 | - if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
84 | + if(!isset($val->value)) { |
|
85 | + continue; |
|
86 | + } |
|
87 | + if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) { |
|
88 | + $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
89 | + } |
|
80 | 90 | $extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value); |
81 | 91 | } |
82 | 92 | } |
@@ -87,7 +97,9 @@ discard block |
||
87 | 97 | $document_srl = $document_srls[$i]; |
88 | 98 | unset($vars); |
89 | 99 | |
90 | - if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
100 | + if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) { |
|
101 | + continue; |
|
102 | + } |
|
91 | 103 | $module_srl = $_document_list[$document_srl]->get('module_srl'); |
92 | 104 | $extra_keys = $this->getExtraKeys($module_srl); |
93 | 105 | $vars = $extra_vars[$document_srl]; |
@@ -99,10 +111,15 @@ discard block |
||
99 | 111 | { |
100 | 112 | $extra_keys[$idx] = clone($key); |
101 | 113 | $val = $vars[$idx]; |
102 | - if(isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
103 | - else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
104 | - else if(isset($val[0])) $v = $val[0]; |
|
105 | - else $v = null; |
|
114 | + if(isset($val[$user_lang_code])) { |
|
115 | + $v = $val[$user_lang_code]; |
|
116 | + } else if(isset($val[$document_lang_code])) { |
|
117 | + $v = $val[$document_lang_code]; |
|
118 | + } else if(isset($val[0])) { |
|
119 | + $v = $val[0]; |
|
120 | + } else { |
|
121 | + $v = null; |
|
122 | + } |
|
106 | 123 | $extra_keys[$idx]->value = $v; |
107 | 124 | } |
108 | 125 | } |
@@ -111,9 +128,13 @@ discard block |
||
111 | 128 | $evars = new ExtraVar($module_srl); |
112 | 129 | $evars->setExtraVarKeys($extra_keys); |
113 | 130 | // Title Processing |
114 | - if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
131 | + if($vars[-1][$user_lang_code]) { |
|
132 | + $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
133 | + } |
|
115 | 134 | // Information processing |
116 | - if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
135 | + if($vars[-2][$user_lang_code]) { |
|
136 | + $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
137 | + } |
|
117 | 138 | |
118 | 139 | if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code]) |
119 | 140 | { |
@@ -134,15 +155,21 @@ discard block |
||
134 | 155 | */ |
135 | 156 | function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
136 | 157 | { |
137 | - if(!$document_srl) return new documentItem(); |
|
158 | + if(!$document_srl) { |
|
159 | + return new documentItem(); |
|
160 | + } |
|
138 | 161 | |
139 | 162 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
140 | 163 | { |
141 | 164 | $oDocument = new documentItem($document_srl, $load_extra_vars, $columnList); |
142 | 165 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
143 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
166 | + if($load_extra_vars) { |
|
167 | + $this->setToAllDocumentExtraVars(); |
|
168 | + } |
|
169 | + } |
|
170 | + if($is_admin) { |
|
171 | + $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
144 | 172 | } |
145 | - if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
146 | 173 | |
147 | 174 | return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
148 | 175 | } |
@@ -161,8 +188,7 @@ discard block |
||
161 | 188 | { |
162 | 189 | $list_count = count($document_srls); |
163 | 190 | $document_srls = implode(',',$document_srls); |
164 | - } |
|
165 | - else |
|
191 | + } else |
|
166 | 192 | { |
167 | 193 | $list_count = 1; |
168 | 194 | } |
@@ -173,28 +199,38 @@ discard block |
||
173 | 199 | |
174 | 200 | $output = executeQuery('document.getDocuments', $args, $columnList); |
175 | 201 | $document_list = $output->data; |
176 | - if(!$document_list) return; |
|
177 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
202 | + if(!$document_list) { |
|
203 | + return; |
|
204 | + } |
|
205 | + if(!is_array($document_list)) { |
|
206 | + $document_list = array($document_list); |
|
207 | + } |
|
178 | 208 | |
179 | 209 | $document_count = count($document_list); |
180 | 210 | foreach($document_list as $key => $attribute) |
181 | 211 | { |
182 | 212 | $document_srl = $attribute->document_srl; |
183 | - if(!$document_srl) continue; |
|
213 | + if(!$document_srl) { |
|
214 | + continue; |
|
215 | + } |
|
184 | 216 | |
185 | 217 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
186 | 218 | { |
187 | 219 | $oDocument = null; |
188 | 220 | $oDocument = new documentItem(); |
189 | 221 | $oDocument->setAttribute($attribute, false); |
190 | - if($is_admin) $oDocument->setGrant(); |
|
222 | + if($is_admin) { |
|
223 | + $oDocument->setGrant(); |
|
224 | + } |
|
191 | 225 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
192 | 226 | } |
193 | 227 | |
194 | 228 | $result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
195 | 229 | } |
196 | 230 | |
197 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
231 | + if($load_extra_vars) { |
|
232 | + $this->setToAllDocumentExtraVars(); |
|
233 | + } |
|
198 | 234 | |
199 | 235 | $output = null; |
200 | 236 | if(count($result)) |
@@ -242,18 +278,15 @@ discard block |
||
242 | 278 | { |
243 | 279 | $output = $obj->use_alternate_output; |
244 | 280 | unset($obj->use_alternate_output); |
245 | - } |
|
246 | - elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
281 | + } elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
247 | 282 | { |
248 | 283 | $query_id = 'document.getDocumentListWithinExtraVarsExtraSort'; |
249 | 284 | $args->sort_index = str_replace('documents.','',$args->sort_index); |
250 | 285 | $output = executeQueryArray($query_id, $args); |
251 | - } |
|
252 | - elseif ($sort_check->isExtraVars) |
|
286 | + } elseif ($sort_check->isExtraVars) |
|
253 | 287 | { |
254 | 288 | $output = executeQueryArray($query_id, $args); |
255 | - } |
|
256 | - else |
|
289 | + } else |
|
257 | 290 | { |
258 | 291 | // document.getDocumentList query execution |
259 | 292 | // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because |
@@ -263,11 +296,15 @@ discard block |
||
263 | 296 | $group_args = clone($args); |
264 | 297 | $group_args->sort_index = 'documents.'.$args->sort_index; |
265 | 298 | $output = executeQueryArray($query_id, $group_args); |
266 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
299 | + if(!$output->toBool()||!count($output->data)) { |
|
300 | + return $output; |
|
301 | + } |
|
267 | 302 | |
268 | 303 | foreach($output->data as $key => $val) |
269 | 304 | { |
270 | - if($val->document_srl) $target_srls[] = $val->document_srl; |
|
305 | + if($val->document_srl) { |
|
306 | + $target_srls[] = $val->document_srl; |
|
307 | + } |
|
271 | 308 | } |
272 | 309 | |
273 | 310 | $page_navigation = $output->page_navigation; |
@@ -285,14 +322,15 @@ discard block |
||
285 | 322 | $output->total_count = $page_navigation->total_count; |
286 | 323 | $output->total_page = $page_navigation->total_page; |
287 | 324 | $output->page = $page_navigation->cur_page; |
288 | - } |
|
289 | - else |
|
325 | + } else |
|
290 | 326 | { |
291 | 327 | $output = executeQueryArray($query_id, $args, $columnList); |
292 | 328 | } |
293 | 329 | } |
294 | 330 | // Return if no result or an error occurs |
295 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
331 | + if(!$output->toBool()||!count($output->data)) { |
|
332 | + return $output; |
|
333 | + } |
|
296 | 334 | $idx = 0; |
297 | 335 | $data = $output->data; |
298 | 336 | unset($output->data); |
@@ -307,20 +345,26 @@ discard block |
||
307 | 345 | { |
308 | 346 | foreach($data as $key => $attribute) |
309 | 347 | { |
310 | - if($attribute->is_notice == 'Y') $virtual_number --; |
|
348 | + if($attribute->is_notice == 'Y') { |
|
349 | + $virtual_number --; |
|
350 | + } |
|
311 | 351 | } |
312 | 352 | } |
313 | 353 | |
314 | 354 | foreach($data as $key => $attribute) |
315 | 355 | { |
316 | - if($except_notice && $attribute->is_notice == 'Y') continue; |
|
356 | + if($except_notice && $attribute->is_notice == 'Y') { |
|
357 | + continue; |
|
358 | + } |
|
317 | 359 | $document_srl = $attribute->document_srl; |
318 | 360 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
319 | 361 | { |
320 | 362 | $oDocument = null; |
321 | 363 | $oDocument = new documentItem(); |
322 | 364 | $oDocument->setAttribute($attribute, false); |
323 | - if($is_admin) $oDocument->setGrant(); |
|
365 | + if($is_admin) { |
|
366 | + $oDocument->setGrant(); |
|
367 | + } |
|
324 | 368 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
325 | 369 | } |
326 | 370 | |
@@ -328,7 +372,9 @@ discard block |
||
328 | 372 | $virtual_number--; |
329 | 373 | } |
330 | 374 | |
331 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
375 | + if($load_extra_vars) { |
|
376 | + $this->setToAllDocumentExtraVars(); |
|
377 | + } |
|
332 | 378 | |
333 | 379 | if(count($output->data)) |
334 | 380 | { |
@@ -356,12 +402,16 @@ discard block |
||
356 | 402 | $args->module_srl = $obj->module_srl; |
357 | 403 | $args->category_srl= $obj->category_srl; |
358 | 404 | $output = executeQueryArray('document.getNoticeList', $args, $columnList); |
359 | - if(!$output->toBool()||!$output->data) return; |
|
405 | + if(!$output->toBool()||!$output->data) { |
|
406 | + return; |
|
407 | + } |
|
360 | 408 | |
361 | 409 | foreach($output->data as $key => $val) |
362 | 410 | { |
363 | 411 | $document_srl = $val->document_srl; |
364 | - if(!$document_srl) continue; |
|
412 | + if(!$document_srl) { |
|
413 | + continue; |
|
414 | + } |
|
365 | 415 | |
366 | 416 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
367 | 417 | { |
@@ -457,7 +507,9 @@ discard block |
||
457 | 507 | |
458 | 508 | $oExtraVar->setExtraVarKeys($output->data); |
459 | 509 | $keys = $oExtraVar->getExtraVars(); |
460 | - if(!$keys) $keys = array(); |
|
510 | + if(!$keys) { |
|
511 | + $keys = array(); |
|
512 | + } |
|
461 | 513 | |
462 | 514 | if($oCacheHandler->isSupport()) |
463 | 515 | { |
@@ -487,7 +539,9 @@ discard block |
||
487 | 539 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
488 | 540 | $this->setToAllDocumentExtraVars(); |
489 | 541 | } |
490 | - if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
542 | + if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) { |
|
543 | + ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
544 | + } |
|
491 | 545 | return $GLOBALS['XE_EXTRA_VARS'][$document_srl]; |
492 | 546 | } |
493 | 547 | |
@@ -517,7 +571,9 @@ discard block |
||
517 | 571 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
518 | 572 | $module_srl = $oDocument->get('module_srl'); |
519 | 573 | $member_srl = $oDocument->get('member_srl'); |
520 | - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
574 | + if(!$module_srl) { |
|
575 | + return new Object(-1, 'msg_invalid_request'); |
|
576 | + } |
|
521 | 577 | |
522 | 578 | $oModuleModel = getModel('module'); |
523 | 579 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
@@ -590,7 +646,9 @@ discard block |
||
590 | 646 | */ |
591 | 647 | function getDocumentCount($module_srl, $search_obj = NULL) |
592 | 648 | { |
593 | - if(is_null($search_obj)) $search_obj = new stdClass(); |
|
649 | + if(is_null($search_obj)) { |
|
650 | + $search_obj = new stdClass(); |
|
651 | + } |
|
594 | 652 | $search_obj->module_srl = $module_srl; |
595 | 653 | |
596 | 654 | $output = executeQuery('document.getDocumentCount', $search_obj); |
@@ -607,7 +665,9 @@ discard block |
||
607 | 665 | function getDocumentCountByGroupStatus($search_obj = NULL) |
608 | 666 | { |
609 | 667 | $output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj); |
610 | - if(!$output->toBool()) return array(); |
|
668 | + if(!$output->toBool()) { |
|
669 | + return array(); |
|
670 | + } |
|
611 | 671 | |
612 | 672 | return $output->data; |
613 | 673 | } |
@@ -646,21 +706,18 @@ discard block |
||
646 | 706 | if($sort_check->isExtraVars) |
647 | 707 | { |
648 | 708 | return 1; |
649 | - } |
|
650 | - else |
|
709 | + } else |
|
651 | 710 | { |
652 | 711 | if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
653 | 712 | { |
654 | 713 | if($args->order_type === 'desc') |
655 | 714 | { |
656 | 715 | $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
657 | - } |
|
658 | - else |
|
716 | + } else |
|
659 | 717 | { |
660 | 718 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
661 | 719 | } |
662 | - } |
|
663 | - else |
|
720 | + } else |
|
664 | 721 | { |
665 | 722 | return 1; |
666 | 723 | } |
@@ -686,15 +743,16 @@ discard block |
||
686 | 743 | $output = executeQuery('document.getCategory', $args, $columnList); |
687 | 744 | |
688 | 745 | $node = $output->data; |
689 | - if(!$node) return; |
|
746 | + if(!$node) { |
|
747 | + return; |
|
748 | + } |
|
690 | 749 | |
691 | 750 | if($node->group_srls) |
692 | 751 | { |
693 | 752 | $group_srls = explode(',',$node->group_srls); |
694 | 753 | unset($node->group_srls); |
695 | 754 | $node->group_srls = $group_srls; |
696 | - } |
|
697 | - else |
|
755 | + } else |
|
698 | 756 | { |
699 | 757 | unset($node->group_srls); |
700 | 758 | $node->group_srls = array(); |
@@ -712,7 +770,9 @@ discard block |
||
712 | 770 | $args = new stdClass(); |
713 | 771 | $args->category_srl = $category_srl; |
714 | 772 | $output = executeQuery('document.getChildCategoryCount',$args); |
715 | - if($output->data->count > 0) return true; |
|
773 | + if($output->data->count > 0) { |
|
774 | + return true; |
|
775 | + } |
|
716 | 776 | return false; |
717 | 777 | } |
718 | 778 | |
@@ -731,7 +791,9 @@ discard block |
||
731 | 791 | if(!file_exists($filename)) |
732 | 792 | { |
733 | 793 | $oDocumentController = getController('document'); |
734 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
794 | + if(!$oDocumentController->makeCategoryFile($module_srl)) { |
|
795 | + return array(); |
|
796 | + } |
|
735 | 797 | } |
736 | 798 | |
737 | 799 | include($filename); |
@@ -751,7 +813,9 @@ discard block |
||
751 | 813 | */ |
752 | 814 | function _arrangeCategory(&$document_category, $list, $depth) |
753 | 815 | { |
754 | - if(!count($list)) return; |
|
816 | + if(!count($list)) { |
|
817 | + return; |
|
818 | + } |
|
755 | 819 | $idx = 0; |
756 | 820 | $list_order = array(); |
757 | 821 | foreach($list as $key => $val) |
@@ -771,8 +835,11 @@ discard block |
||
771 | 835 | $obj->childs = array(); |
772 | 836 | $obj->grant = $val['grant']; |
773 | 837 | |
774 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
775 | - else $selected = false; |
|
838 | + if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) { |
|
839 | + $selected = true; |
|
840 | + } else { |
|
841 | + $selected = false; |
|
842 | + } |
|
776 | 843 | |
777 | 844 | $obj->selected = $selected; |
778 | 845 | |
@@ -783,14 +850,18 @@ discard block |
||
783 | 850 | $parent_srl = $obj->parent_srl; |
784 | 851 | $document_count = $obj->document_count; |
785 | 852 | $expand = $obj->expand; |
786 | - if($selected) $expand = true; |
|
853 | + if($selected) { |
|
854 | + $expand = true; |
|
855 | + } |
|
787 | 856 | |
788 | 857 | while($parent_srl) |
789 | 858 | { |
790 | 859 | $document_category[$parent_srl]->document_count += $document_count; |
791 | 860 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
792 | 861 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
793 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
862 | + if($expand) { |
|
863 | + $document_category[$parent_srl]->expand = $expand; |
|
864 | + } |
|
794 | 865 | |
795 | 866 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
796 | 867 | } |
@@ -798,7 +869,9 @@ discard block |
||
798 | 869 | |
799 | 870 | $document_category[$key] = $obj; |
800 | 871 | |
801 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
872 | + if(count($val['list'])) { |
|
873 | + $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
874 | + } |
|
802 | 875 | } |
803 | 876 | $document_category[$list_order[0]]->first = true; |
804 | 877 | $document_category[$list_order[count($list_order)-1]]->last = true; |
@@ -866,13 +939,20 @@ discard block |
||
866 | 939 | } |
867 | 940 | // Module_srl passed the array may be a check whether the array |
868 | 941 | $args = new stdClass; |
869 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
870 | - else $args->module_srl = $obj->module_srl; |
|
942 | + if(is_array($obj->module_srl)) { |
|
943 | + $args->module_srl = implode(',', $obj->module_srl); |
|
944 | + } else { |
|
945 | + $args->module_srl = $obj->module_srl; |
|
946 | + } |
|
871 | 947 | |
872 | 948 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
873 | - if(!$output->toBool()||!$output->data) return $output; |
|
949 | + if(!$output->toBool()||!$output->data) { |
|
950 | + return $output; |
|
951 | + } |
|
874 | 952 | |
875 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
953 | + if(!is_array($output->data)) { |
|
954 | + $output->data = array($output->data); |
|
955 | + } |
|
876 | 956 | |
877 | 957 | return $output; |
878 | 958 | } |
@@ -892,14 +972,21 @@ discard block |
||
892 | 972 | } |
893 | 973 | // Module_srl passed the array may be a check whether the array |
894 | 974 | $args = new stdClass; |
895 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
896 | - else $args->module_srl = $obj->module_srl; |
|
975 | + if(is_array($obj->module_srl)) { |
|
976 | + $args->module_srl = implode(',', $obj->module_srl); |
|
977 | + } else { |
|
978 | + $args->module_srl = $obj->module_srl; |
|
979 | + } |
|
897 | 980 | $args->regdate = $obj->regdate; |
898 | 981 | |
899 | 982 | $output = executeQuery('document.getDailyArchivedList', $args); |
900 | - if(!$output->toBool()) return $output; |
|
983 | + if(!$output->toBool()) { |
|
984 | + return $output; |
|
985 | + } |
|
901 | 986 | |
902 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
987 | + if(!is_array($output->data)) { |
|
988 | + $output->data = array($output->data); |
|
989 | + } |
|
903 | 990 | |
904 | 991 | return $output; |
905 | 992 | } |
@@ -910,7 +997,9 @@ discard block |
||
910 | 997 | */ |
911 | 998 | function getDocumentCategories() |
912 | 999 | { |
913 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
1000 | + if(!Context::get('is_logged')) { |
|
1001 | + return new Object(-1,'msg_not_permitted'); |
|
1002 | + } |
|
914 | 1003 | $module_srl = Context::get('module_srl'); |
915 | 1004 | $categories= $this->getCategoryList($module_srl); |
916 | 1005 | $lang = Context::get('lang'); |
@@ -937,8 +1026,12 @@ discard block |
||
937 | 1026 | $oModuleModel = getModel('module'); |
938 | 1027 | $config = $oModuleModel->getModuleConfig('document'); |
939 | 1028 | |
940 | - if(!$config) $config = new stdClass(); |
|
941 | - if(!$config->thumbnail_type) $config->thumbnail_type = 'crop'; |
|
1029 | + if(!$config) { |
|
1030 | + $config = new stdClass(); |
|
1031 | + } |
|
1032 | + if(!$config->thumbnail_type) { |
|
1033 | + $config->thumbnail_type = 'crop'; |
|
1034 | + } |
|
942 | 1035 | $GLOBALS['__document_config__'] = $config; |
943 | 1036 | } |
944 | 1037 | return $GLOBALS['__document_config__']; |
@@ -1003,7 +1096,9 @@ discard block |
||
1003 | 1096 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
1004 | 1097 | // Check permissions |
1005 | 1098 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
1006 | - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); |
|
1099 | + if(!$grant->manager) { |
|
1100 | + return new Object(-1,'msg_not_permitted'); |
|
1101 | + } |
|
1007 | 1102 | |
1008 | 1103 | $category_srl = Context::get('category_srl'); |
1009 | 1104 | $category_info = $this->getCategory($category_srl); |
@@ -1023,15 +1118,20 @@ discard block |
||
1023 | 1118 | */ |
1024 | 1119 | function getDocumentSrlByAlias($mid, $alias) |
1025 | 1120 | { |
1026 | - if(!$mid || !$alias) return null; |
|
1121 | + if(!$mid || !$alias) { |
|
1122 | + return null; |
|
1123 | + } |
|
1027 | 1124 | $site_module_info = Context::get('site_module_info'); |
1028 | 1125 | $args = new stdClass; |
1029 | 1126 | $args->mid = $mid; |
1030 | 1127 | $args->alias_title = $alias; |
1031 | 1128 | $args->site_srl = $site_module_info->site_srl; |
1032 | 1129 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
1033 | - if(!$output->data) return null; |
|
1034 | - else return $output->data->document_srl; |
|
1130 | + if(!$output->data) { |
|
1131 | + return null; |
|
1132 | + } else { |
|
1133 | + return $output->data->document_srl; |
|
1134 | + } |
|
1035 | 1135 | } |
1036 | 1136 | |
1037 | 1137 | /** |
@@ -1042,15 +1142,20 @@ discard block |
||
1042 | 1142 | */ |
1043 | 1143 | function getDocumentSrlByTitle($module_srl, $title) |
1044 | 1144 | { |
1045 | - if(!$module_srl || !$title) return null; |
|
1145 | + if(!$module_srl || !$title) { |
|
1146 | + return null; |
|
1147 | + } |
|
1046 | 1148 | $args = new stdClass; |
1047 | 1149 | $args->module_srl = $module_srl; |
1048 | 1150 | $args->title = $title; |
1049 | 1151 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
1050 | - if(!$output->data) return null; |
|
1051 | - else |
|
1152 | + if(!$output->data) { |
|
1153 | + return null; |
|
1154 | + } else |
|
1052 | 1155 | { |
1053 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
1156 | + if(is_array($output->data)) { |
|
1157 | + return $output->data[0]->document_srl; |
|
1158 | + } |
|
1054 | 1159 | return $output->data->document_srl; |
1055 | 1160 | } |
1056 | 1161 | } |
@@ -1062,13 +1167,18 @@ discard block |
||
1062 | 1167 | */ |
1063 | 1168 | function getAlias($document_srl) |
1064 | 1169 | { |
1065 | - if(!$document_srl) return null; |
|
1170 | + if(!$document_srl) { |
|
1171 | + return null; |
|
1172 | + } |
|
1066 | 1173 | $args = new stdClass; |
1067 | 1174 | $args->document_srl = $document_srl; |
1068 | 1175 | $output = executeQueryArray('document.getAliases', $args); |
1069 | 1176 | |
1070 | - if(!$output->data) return null; |
|
1071 | - else return $output->data[0]->alias_title; |
|
1177 | + if(!$output->data) { |
|
1178 | + return null; |
|
1179 | + } else { |
|
1180 | + return $output->data[0]->alias_title; |
|
1181 | + } |
|
1072 | 1182 | } |
1073 | 1183 | |
1074 | 1184 | /** |
@@ -1125,17 +1235,23 @@ discard block |
||
1125 | 1235 | { |
1126 | 1236 | case 'title' : |
1127 | 1237 | case 'content' : |
1128 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1238 | + if($search_keyword) { |
|
1239 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1240 | + } |
|
1129 | 1241 | $args->{"s_".$search_target} = $search_keyword; |
1130 | 1242 | $use_division = true; |
1131 | 1243 | break; |
1132 | 1244 | case 'title_content' : |
1133 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1245 | + if($search_keyword) { |
|
1246 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1247 | + } |
|
1134 | 1248 | $args->s_title = $search_keyword; |
1135 | 1249 | $args->s_content = $search_keyword; |
1136 | 1250 | break; |
1137 | 1251 | case 'user_id' : |
1138 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1252 | + if($search_keyword) { |
|
1253 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1254 | + } |
|
1139 | 1255 | $args->s_user_id = $search_keyword; |
1140 | 1256 | $args->sort_index = 'documents.'.$args->sort_index; |
1141 | 1257 | break; |
@@ -1143,13 +1259,18 @@ discard block |
||
1143 | 1259 | case 'nick_name' : |
1144 | 1260 | case 'email_address' : |
1145 | 1261 | case 'homepage' : |
1146 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1262 | + if($search_keyword) { |
|
1263 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1264 | + } |
|
1147 | 1265 | $args->{"s_".$search_target} = $search_keyword; |
1148 | 1266 | break; |
1149 | 1267 | case 'is_notice' : |
1150 | 1268 | case 'is_secret' : |
1151 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
1152 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1269 | + if($search_keyword=='N') { |
|
1270 | + $args->statusList = array($this->getConfigStatus('public')); |
|
1271 | + } elseif($search_keyword=='Y') { |
|
1272 | + $args->statusList = array($this->getConfigStatus('secret')); |
|
1273 | + } |
|
1153 | 1274 | break; |
1154 | 1275 | case 'member_srl' : |
1155 | 1276 | case 'readed_count' : |
@@ -1191,34 +1312,45 @@ discard block |
||
1191 | 1312 | { |
1192 | 1313 | $args = new stdClass; |
1193 | 1314 | $document_srl = Context::get('document_srl'); |
1194 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
1315 | + if(!$document_srl) { |
|
1316 | + return new Object(-1,'msg_invalid_request'); |
|
1317 | + } |
|
1195 | 1318 | |
1196 | 1319 | $point = Context::get('point'); |
1197 | - if($point != -1) $point = 1; |
|
1320 | + if($point != -1) { |
|
1321 | + $point = 1; |
|
1322 | + } |
|
1198 | 1323 | |
1199 | 1324 | $oDocumentModel = getModel('document'); |
1200 | 1325 | $columnList = array('document_srl', 'module_srl'); |
1201 | 1326 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
1202 | 1327 | $module_srl = $oDocument->get('module_srl'); |
1203 | - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
1328 | + if(!$module_srl) { |
|
1329 | + return new Object(-1, 'msg_invalid_request'); |
|
1330 | + } |
|
1204 | 1331 | |
1205 | 1332 | $oModuleModel = getModel('module'); |
1206 | 1333 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
1207 | 1334 | if($point == -1) |
1208 | 1335 | { |
1209 | - if($document_config->use_vote_down!='S') return new Object(-1, 'msg_invalid_request'); |
|
1336 | + if($document_config->use_vote_down!='S') { |
|
1337 | + return new Object(-1, 'msg_invalid_request'); |
|
1338 | + } |
|
1210 | 1339 | $args->below_point = 0; |
1211 | - } |
|
1212 | - else |
|
1340 | + } else |
|
1213 | 1341 | { |
1214 | - if($document_config->use_vote_up!='S') return new Object(-1, 'msg_invalid_request'); |
|
1342 | + if($document_config->use_vote_up!='S') { |
|
1343 | + return new Object(-1, 'msg_invalid_request'); |
|
1344 | + } |
|
1215 | 1345 | $args->more_point = 0; |
1216 | 1346 | } |
1217 | 1347 | |
1218 | 1348 | $args->document_srl = $document_srl; |
1219 | 1349 | |
1220 | 1350 | $output = executeQueryArray('document.getVotedMemberList',$args); |
1221 | - if(!$output->toBool()) return $output; |
|
1351 | + if(!$output->toBool()) { |
|
1352 | + return $output; |
|
1353 | + } |
|
1222 | 1354 | |
1223 | 1355 | $oMemberModel = getModel('member'); |
1224 | 1356 | if($output->data) |
@@ -1240,9 +1372,11 @@ discard block |
||
1240 | 1372 | function getStatusNameList() |
1241 | 1373 | { |
1242 | 1374 | global $lang; |
1243 | - if(!isset($lang->status_name_list)) |
|
1244 | - return array_flip($this->getStatusList()); |
|
1245 | - else return $lang->status_name_list; |
|
1375 | + if(!isset($lang->status_name_list)) { |
|
1376 | + return array_flip($this->getStatusList()); |
|
1377 | + } else { |
|
1378 | + return $lang->status_name_list; |
|
1379 | + } |
|
1246 | 1380 | } |
1247 | 1381 | |
1248 | 1382 | /** |
@@ -1266,20 +1400,22 @@ discard block |
||
1266 | 1400 | if (!$extra_output->data || !$extra_output->toBool()) |
1267 | 1401 | { |
1268 | 1402 | $sortIndex = 'list_order'; |
1269 | - } |
|
1270 | - else |
|
1403 | + } else |
|
1271 | 1404 | { |
1272 | 1405 | $check_array = array(); |
1273 | 1406 | foreach($extra_output->data as $val) |
1274 | 1407 | { |
1275 | 1408 | $check_array[] = $val->eid; |
1276 | 1409 | } |
1277 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
1278 | - else $isExtraVars = true; |
|
1410 | + if(!in_array($sortIndex, $check_array)) { |
|
1411 | + $sortIndex = 'list_order'; |
|
1412 | + } else { |
|
1413 | + $isExtraVars = true; |
|
1414 | + } |
|
1279 | 1415 | } |
1416 | + } else { |
|
1417 | + $sortIndex = 'list_order'; |
|
1280 | 1418 | } |
1281 | - else |
|
1282 | - $sortIndex = 'list_order'; |
|
1283 | 1419 | } |
1284 | 1420 | $returnObj = new stdClass(); |
1285 | 1421 | $returnObj->sort_index = $sortIndex; |
@@ -1317,7 +1453,9 @@ discard block |
||
1317 | 1453 | |
1318 | 1454 | // Check the target and sequence alignment |
1319 | 1455 | $orderType = array('desc' => 1, 'asc' => 1); |
1320 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
1456 | + if(!isset($orderType[$args->order_type])) { |
|
1457 | + $args->order_type = 'asc'; |
|
1458 | + } |
|
1321 | 1459 | |
1322 | 1460 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
1323 | 1461 | if($searchOpt->mid) |
@@ -1328,21 +1466,29 @@ discard block |
||
1328 | 1466 | } |
1329 | 1467 | |
1330 | 1468 | // Module_srl passed the array may be a check whether the array |
1331 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
1332 | - else $args->module_srl = $searchOpt->module_srl; |
|
1469 | + if(is_array($searchOpt->module_srl)) { |
|
1470 | + $args->module_srl = implode(',', $searchOpt->module_srl); |
|
1471 | + } else { |
|
1472 | + $args->module_srl = $searchOpt->module_srl; |
|
1473 | + } |
|
1333 | 1474 | |
1334 | 1475 | // Except for the test module_srl |
1335 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
1336 | - else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
|
1476 | + if(is_array($searchOpt->exclude_module_srl)) { |
|
1477 | + $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
1478 | + } else { |
|
1479 | + $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
|
1480 | + } |
|
1337 | 1481 | |
1338 | 1482 | // only admin document list, temp document showing |
1339 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
1340 | - else |
|
1483 | + if($searchOpt->statusList) { |
|
1484 | + $args->statusList = $searchOpt->statusList; |
|
1485 | + } else |
|
1341 | 1486 | { |
1342 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
1343 | - $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
|
1344 | - else |
|
1345 | - $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
|
1487 | + if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) { |
|
1488 | + $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
|
1489 | + } else { |
|
1490 | + $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
|
1491 | + } |
|
1346 | 1492 | } |
1347 | 1493 | |
1348 | 1494 | // Category is selected, further sub-categories until all conditions |
@@ -1370,18 +1516,24 @@ discard block |
||
1370 | 1516 | { |
1371 | 1517 | case 'title' : |
1372 | 1518 | case 'content' : |
1373 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1519 | + if($search_keyword) { |
|
1520 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1521 | + } |
|
1374 | 1522 | $args->{"s_".$search_target} = $search_keyword; |
1375 | 1523 | $use_division = true; |
1376 | 1524 | break; |
1377 | 1525 | case 'title_content' : |
1378 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1526 | + if($search_keyword) { |
|
1527 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1528 | + } |
|
1379 | 1529 | $args->s_title = $search_keyword; |
1380 | 1530 | $args->s_content = $search_keyword; |
1381 | 1531 | $use_division = true; |
1382 | 1532 | break; |
1383 | 1533 | case 'user_id' : |
1384 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1534 | + if($search_keyword) { |
|
1535 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1536 | + } |
|
1385 | 1537 | $args->s_user_id = $search_keyword; |
1386 | 1538 | $args->sort_index = 'documents.'.$args->sort_index; |
1387 | 1539 | break; |
@@ -1389,18 +1541,28 @@ discard block |
||
1389 | 1541 | case 'nick_name' : |
1390 | 1542 | case 'email_address' : |
1391 | 1543 | case 'homepage' : |
1392 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1544 | + if($search_keyword) { |
|
1545 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1546 | + } |
|
1393 | 1547 | $args->{"s_".$search_target} = $search_keyword; |
1394 | 1548 | break; |
1395 | 1549 | case 'is_notice' : |
1396 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
1397 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
1398 | - else $args->{"s_".$search_target} = ''; |
|
1550 | + if($search_keyword=='N') { |
|
1551 | + $args->{"s_".$search_target} = 'N'; |
|
1552 | + } elseif($search_keyword=='Y') { |
|
1553 | + $args->{"s_".$search_target} = 'Y'; |
|
1554 | + } else { |
|
1555 | + $args->{"s_".$search_target} = ''; |
|
1556 | + } |
|
1399 | 1557 | break; |
1400 | 1558 | case 'is_secret' : |
1401 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
1402 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1403 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
1559 | + if($search_keyword=='N') { |
|
1560 | + $args->statusList = array($this->getConfigStatus('public')); |
|
1561 | + } elseif($search_keyword=='Y') { |
|
1562 | + $args->statusList = array($this->getConfigStatus('secret')); |
|
1563 | + } elseif($search_keyword=='temp') { |
|
1564 | + $args->statusList = array($this->getConfigStatus('temp')); |
|
1565 | + } |
|
1404 | 1566 | break; |
1405 | 1567 | case 'member_srl' : |
1406 | 1568 | case 'readed_count' : |
@@ -1445,13 +1607,14 @@ discard block |
||
1445 | 1607 | if ($searchOpt->isExtraVars) |
1446 | 1608 | { |
1447 | 1609 | $query_id = 'document.getDocumentListExtraSort'; |
1448 | - } |
|
1449 | - else |
|
1610 | + } else |
|
1450 | 1611 | { |
1451 | 1612 | /** |
1452 | 1613 | * list_order asc sort of division that can be used only when |
1453 | 1614 | */ |
1454 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
1615 | + if($args->sort_index != 'list_order' || $args->order_type != 'asc') { |
|
1616 | + $use_division = false; |
|
1617 | + } |
|
1455 | 1618 | |
1456 | 1619 | /** |
1457 | 1620 | * If it is true, use_division changed to use the document division |
@@ -1466,8 +1629,7 @@ discard block |
||
1466 | 1629 | { |
1467 | 1630 | $listSqlID = 'document.getDocumentListUseIndex'; |
1468 | 1631 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
1469 | - } |
|
1470 | - else |
|
1632 | + } else |
|
1471 | 1633 | { |
1472 | 1634 | $listSqlID = 'document.getDocumentList'; |
1473 | 1635 | $divisionSqlID = 'document.getDocumentDivision'; |
@@ -1524,7 +1686,9 @@ discard block |
||
1524 | 1686 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
1525 | 1687 | $last_division_args->list_order = $last_division; |
1526 | 1688 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
1527 | - if($output->data->count<1) $last_division = null; |
|
1689 | + if($output->data->count<1) { |
|
1690 | + $last_division = null; |
|
1691 | + } |
|
1528 | 1692 | } |
1529 | 1693 | |
1530 | 1694 | $args->division = $division; |
@@ -1565,8 +1729,12 @@ discard block |
||
1565 | 1729 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
1566 | 1730 | $document_list = $output->data; |
1567 | 1731 | |
1568 | - if(!$document_list) return array(); |
|
1569 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
1732 | + if(!$document_list) { |
|
1733 | + return array(); |
|
1734 | + } |
|
1735 | + if(!is_array($document_list)) { |
|
1736 | + $document_list = array($document_list); |
|
1737 | + } |
|
1570 | 1738 | |
1571 | 1739 | return $document_list; |
1572 | 1740 | } |