@@ -462,6 +462,9 @@ |
||
| 462 | 462 | } |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | + /** |
|
| 466 | + * @return string |
|
| 467 | + */ |
|
| 465 | 468 | protected function qte_move($attr_row, $action = 'move_up', $steps = 1) |
| 466 | 469 | { |
| 467 | 470 | global $db, $table_prefix; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | global $phpbb_container, $db, $user, $phpbb_log, $template, $cache, $request, $table_prefix, $phpbb_root_path; |
| 28 | 28 | $this->qte = $phpbb_container->get('abdev.qte'); |
| 29 | 29 | |
| 30 | - $ext_root_path = $phpbb_root_path . 'ext/abdev/qte/'; |
|
| 30 | + $ext_root_path = $phpbb_root_path.'ext/abdev/qte/'; |
|
| 31 | 31 | |
| 32 | 32 | $action = $request->variable('action', ''); |
| 33 | 33 | $submit = $request->is_set_post('submit'); |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | if ($attr_id) |
| 149 | 149 | { |
| 150 | - $sql = 'UPDATE ' . $table_prefix . 'topics_attr |
|
| 151 | - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' |
|
| 150 | + $sql = 'UPDATE '.$table_prefix.'topics_attr |
|
| 151 | + SET ' . $db->sql_build_array('UPDATE', $sql_ary).' |
|
| 152 | 152 | WHERE attr_id = ' . (int) $attr_id; |
| 153 | 153 | $db->sql_query($sql); |
| 154 | 154 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | else |
| 158 | 158 | { |
| 159 | 159 | $sql = 'SELECT MAX(right_id) AS right_id |
| 160 | - FROM ' . $table_prefix . 'topics_attr'; |
|
| 160 | + FROM ' . $table_prefix.'topics_attr'; |
|
| 161 | 161 | $result = $db->sql_query($sql); |
| 162 | 162 | $right_id = (int) $db->sql_fetchfield('right_id'); |
| 163 | 163 | $db->sql_freeresult($result); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $sql_ary['left_id'] = ($right_id + 1); |
| 166 | 166 | $sql_ary['right_id'] = ($right_id + 2); |
| 167 | 167 | |
| 168 | - $sql = 'INSERT INTO ' . $table_prefix . 'topics_attr ' . $db->sql_build_array('INSERT', $sql_ary); |
|
| 168 | + $sql = 'INSERT INTO '.$table_prefix.'topics_attr '.$db->sql_build_array('INSERT', $sql_ary); |
|
| 169 | 169 | $db->sql_query($sql); |
| 170 | 170 | |
| 171 | 171 | $message = 'ADDED'; |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $cache->destroy('_attr'); |
| 175 | 175 | |
| 176 | - $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTRIBUTE_' . $message, time(), array($attr_name)); |
|
| 176 | + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTRIBUTE_'.$message, time(), array($attr_name)); |
|
| 177 | 177 | |
| 178 | - trigger_error($user->lang['QTE_' . $message] . adm_back_link($this->u_action)); |
|
| 178 | + trigger_error($user->lang['QTE_'.$message].adm_back_link($this->u_action)); |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | else if ($attr_id) |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $template->assign_vars(array( |
| 224 | 224 | 'S_EDIT' => true, |
| 225 | 225 | |
| 226 | - 'U_ACTION' => $this->u_action . '&action=' . (($action == 'add') ? 'add' : 'edit&id=' . (int) $attr_id), |
|
| 226 | + 'U_ACTION' => $this->u_action.'&action='.(($action == 'add') ? 'add' : 'edit&id='.(int) $attr_id), |
|
| 227 | 227 | 'U_BACK' => $this->u_action, |
| 228 | 228 | 'U_AJAX' => str_replace('&', '&', $this->u_action), |
| 229 | 229 | |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | 'S_TEXT' => $attr_type_state ? true : false, |
| 240 | 240 | 'S_USER_COLOUR' => $attr_user_colour_state ? true : false, |
| 241 | 241 | |
| 242 | - 'ICON_ATTR_AUTH_ADD' => '<img src="' . $ext_root_path . 'adm/images/qte_auth_add.gif" alt="' . $user->lang['QTE_AUTH_ADD'] . '" title="' . $user->lang['QTE_AUTH_ADD'] . '" />', |
|
| 243 | - 'ICON_ATTR_AUTH_REMOVE' => '<img src="' . $ext_root_path . 'adm/images/qte_auth_remove.gif" alt="' . $user->lang['QTE_AUTH_REMOVE'] . '" title="' . $user->lang['QTE_AUTH_REMOVE'] . '" />', |
|
| 242 | + 'ICON_ATTR_AUTH_ADD' => '<img src="'.$ext_root_path.'adm/images/qte_auth_add.gif" alt="'.$user->lang['QTE_AUTH_ADD'].'" title="'.$user->lang['QTE_AUTH_ADD'].'" />', |
|
| 243 | + 'ICON_ATTR_AUTH_REMOVE' => '<img src="'.$ext_root_path.'adm/images/qte_auth_remove.gif" alt="'.$user->lang['QTE_AUTH_REMOVE'].'" title="'.$user->lang['QTE_AUTH_REMOVE'].'" />', |
|
| 244 | 244 | )); |
| 245 | 245 | |
| 246 | 246 | return; |
@@ -253,8 +253,8 @@ discard block |
||
| 253 | 253 | $this->add_auths($set_permissions['attr_auths']); |
| 254 | 254 | |
| 255 | 255 | $template->assign_vars(array( |
| 256 | - 'ICON_ATTR_AUTH_ADD' => '<img src="' . $ext_root_path . 'adm/images/qte_auth_add.gif" alt="' . $user->lang['QTE_AUTH_ADD'] . '" title="' . $user->lang['QTE_AUTH_ADD'] . '" />', |
|
| 257 | - 'ICON_ATTR_AUTH_REMOVE' => '<img src="' . $ext_root_path . 'adm/images/qte_auth_remove.gif" alt="' . $user->lang['QTE_AUTH_REMOVE'] . '" title="' . $user->lang['QTE_AUTH_REMOVE'] . '" />', |
|
| 256 | + 'ICON_ATTR_AUTH_ADD' => '<img src="'.$ext_root_path.'adm/images/qte_auth_add.gif" alt="'.$user->lang['QTE_AUTH_ADD'].'" title="'.$user->lang['QTE_AUTH_ADD'].'" />', |
|
| 257 | + 'ICON_ATTR_AUTH_REMOVE' => '<img src="'.$ext_root_path.'adm/images/qte_auth_remove.gif" alt="'.$user->lang['QTE_AUTH_REMOVE'].'" title="'.$user->lang['QTE_AUTH_REMOVE'].'" />', |
|
| 258 | 258 | )); |
| 259 | 259 | $this->tpl_name = 'acp_attributes_auths'; |
| 260 | 260 | |
@@ -264,13 +264,13 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | if (!$attr_id) |
| 266 | 266 | { |
| 267 | - trigger_error($user->lang['QTE_MUST_SELECT'] . adm_back_link($this->u_action), E_USER_WARNING); |
|
| 267 | + trigger_error($user->lang['QTE_MUST_SELECT'].adm_back_link($this->u_action), E_USER_WARNING); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | if (confirm_box(true)) |
| 271 | 271 | { |
| 272 | 272 | $sql = 'SELECT topic_id, topic_attr_id |
| 273 | - FROM ' . TOPICS_TABLE . ' |
|
| 273 | + FROM ' . TOPICS_TABLE.' |
|
| 274 | 274 | WHERE topic_attr_id = ' . (int) $attr_id; |
| 275 | 275 | $result = $db->sql_query($sql); |
| 276 | 276 | |
@@ -285,14 +285,14 @@ discard block |
||
| 285 | 285 | { |
| 286 | 286 | $fields = array('topic_attr_id' => 0, 'topic_attr_user' => 0, 'topic_attr_time' => 0); |
| 287 | 287 | |
| 288 | - $sql = 'UPDATE ' . TOPICS_TABLE . ' |
|
| 289 | - SET ' . $db->sql_build_array('UPDATE', $fields) . ' |
|
| 288 | + $sql = 'UPDATE '.TOPICS_TABLE.' |
|
| 289 | + SET ' . $db->sql_build_array('UPDATE', $fields).' |
|
| 290 | 290 | WHERE ' . $db->sql_in_set('topic_id', array_map('intval', $topic_id_ary)); |
| 291 | 291 | $db->sql_query($sql); |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | $sql = 'SELECT attr_name |
| 295 | - FROM ' . $table_prefix . 'topics_attr |
|
| 295 | + FROM ' . $table_prefix.'topics_attr |
|
| 296 | 296 | WHERE attr_id = ' . (int) $attr_id; |
| 297 | 297 | $result = $db->sql_query($sql); |
| 298 | 298 | $attr_name = (string) $db->sql_fetchfield('attr_name'); |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTRIBUTE_REMOVED', time(), array($attr_name)); |
| 302 | 302 | |
| 303 | - $sql = 'DELETE FROM ' . $table_prefix . 'topics_attr |
|
| 303 | + $sql = 'DELETE FROM '.$table_prefix.'topics_attr |
|
| 304 | 304 | WHERE attr_id = ' . (int) $attr_id; |
| 305 | 305 | $db->sql_query($sql); |
| 306 | 306 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | } |
| 321 | 321 | else |
| 322 | 322 | { |
| 323 | - trigger_error($user->lang['QTE_REMOVED'] . adm_back_link($this->u_action)); |
|
| 323 | + trigger_error($user->lang['QTE_REMOVED'].adm_back_link($this->u_action)); |
|
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | else |
@@ -340,11 +340,11 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | if (!$attr_id) |
| 342 | 342 | { |
| 343 | - trigger_error($user->lang['QTE_MUST_SELECT'] . adm_back_link($this->u_action), E_USER_WARNING); |
|
| 343 | + trigger_error($user->lang['QTE_MUST_SELECT'].adm_back_link($this->u_action), E_USER_WARNING); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | $sql = 'SELECT * |
| 347 | - FROM ' . $table_prefix . 'topics_attr |
|
| 347 | + FROM ' . $table_prefix.'topics_attr |
|
| 348 | 348 | WHERE attr_id = ' . (int) $attr_id; |
| 349 | 349 | $result = $db->sql_query($sql); |
| 350 | 350 | $row = $db->sql_fetchrow($result); |
@@ -352,13 +352,13 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | if (!$row) |
| 354 | 354 | { |
| 355 | - trigger_error($user->lang['QTE_MUST_SELECT'] . adm_back_link($this->u_action), E_USER_WARNING); |
|
| 355 | + trigger_error($user->lang['QTE_MUST_SELECT'].adm_back_link($this->u_action), E_USER_WARNING); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | $move_attr_name = $this->qte_move($row, $action, 1); |
| 359 | 359 | if ($move_attr_name !== false) |
| 360 | 360 | { |
| 361 | - $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTRIBUTE_' . strtoupper($action), time(), array($move_attr_name)); |
|
| 361 | + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTRIBUTE_'.strtoupper($action), time(), array($move_attr_name)); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | if ($request->is_ajax()) |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | $template->assign_vars(array('U_ACTION' => $this->u_action)); |
| 374 | 374 | |
| 375 | 375 | $sql = 'SELECT topic_attr_id, COUNT(topic_id) AS total_topics |
| 376 | - FROM ' . TOPICS_TABLE . ' |
|
| 376 | + FROM ' . TOPICS_TABLE.' |
|
| 377 | 377 | GROUP BY topic_attr_id'; |
| 378 | 378 | $result = $db->sql_query($sql); |
| 379 | 379 | $stats = array(); |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | $db->sql_freeresult($result); |
| 387 | 387 | |
| 388 | - $sql = 'SELECT * FROM ' . $table_prefix . 'topics_attr ORDER BY left_id'; |
|
| 388 | + $sql = 'SELECT * FROM '.$table_prefix.'topics_attr ORDER BY left_id'; |
|
| 389 | 389 | $result = $db->sql_query($sql); |
| 390 | 390 | |
| 391 | 391 | while ($row = $db->sql_fetchrow($result)) |
@@ -409,10 +409,10 @@ discard block |
||
| 409 | 409 | 'QTE_COUNT' => (int) $attribute_count, |
| 410 | 410 | 'QTE_PER_CENT' => empty($total_topics) ? 0 : round(intval($attribute_count) * 100 / $total_topics), |
| 411 | 411 | |
| 412 | - 'U_EDIT' => $this->u_action . '&action=edit&id=' . $row['attr_id'], |
|
| 413 | - 'U_MOVE_UP' => $this->u_action . '&action=move_up&id=' . $row['attr_id'], |
|
| 414 | - 'U_MOVE_DOWN' => $this->u_action . '&action=move_down&id=' . $row['attr_id'], |
|
| 415 | - 'U_DELETE' => $this->u_action . '&action=delete&id=' . $row['attr_id'], |
|
| 412 | + 'U_EDIT' => $this->u_action.'&action=edit&id='.$row['attr_id'], |
|
| 413 | + 'U_MOVE_UP' => $this->u_action.'&action=move_up&id='.$row['attr_id'], |
|
| 414 | + 'U_MOVE_DOWN' => $this->u_action.'&action=move_down&id='.$row['attr_id'], |
|
| 415 | + 'U_DELETE' => $this->u_action.'&action=delete&id='.$row['attr_id'], |
|
| 416 | 416 | )); |
| 417 | 417 | } |
| 418 | 418 | $db->sql_freeresult($result); |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | { |
| 423 | 423 | global $db, $table_prefix; |
| 424 | 424 | |
| 425 | - $sql = 'SELECT * FROM ' . $table_prefix . 'topics_attr WHERE attr_id = ' . (int) $attr_id; |
|
| 425 | + $sql = 'SELECT * FROM '.$table_prefix.'topics_attr WHERE attr_id = '.(int) $attr_id; |
|
| 426 | 426 | $result = $db->sql_query($sql); |
| 427 | 427 | $attr = $db->sql_fetchrow($result); |
| 428 | 428 | $db->sql_freeresult($result); |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | global $db, $table_prefix; |
| 468 | 468 | |
| 469 | 469 | $sql = 'SELECT attr_id, attr_name, left_id, right_id |
| 470 | - FROM ' . $table_prefix . "topics_attr |
|
| 470 | + FROM ' . $table_prefix."topics_attr |
|
| 471 | 471 | WHERE " . (($action == 'move_up') ? "right_id < {$attr_row['right_id']} ORDER BY right_id DESC" : "left_id > {$attr_row['left_id']} ORDER BY left_id ASC"); |
| 472 | 472 | $result = $db->sql_query_limit($sql, $steps); |
| 473 | 473 | |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | $move_up_right = $target['right_id']; |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | - $sql = 'UPDATE ' . $table_prefix . "topics_attr |
|
| 509 | + $sql = 'UPDATE '.$table_prefix."topics_attr |
|
| 510 | 510 | SET left_id = left_id + CASE |
| 511 | 511 | WHEN left_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} |
| 512 | 512 | ELSE {$diff_down} |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | $s_forum_id_options = ''; |
| 531 | 531 | |
| 532 | 532 | $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id |
| 533 | - FROM ' . FORUMS_TABLE . ' |
|
| 533 | + FROM ' . FORUMS_TABLE.' |
|
| 534 | 534 | ORDER BY left_id ASC'; |
| 535 | 535 | $result = $db->sql_query($sql, 600); |
| 536 | 536 | |
@@ -569,11 +569,11 @@ discard block |
||
| 569 | 569 | { |
| 570 | 570 | $cat_right = max($cat_right, $row['right_id']); |
| 571 | 571 | |
| 572 | - $holding .= '<option value="' . $row['forum_id'] . '"' . (($row['forum_type'] == FORUM_POST) ? ' class="sep"' : ' disabled="disabled"') . $selected . '>' . $padding . $row['forum_name'] . '</option>'; |
|
| 572 | + $holding .= '<option value="'.$row['forum_id'].'"'.(($row['forum_type'] == FORUM_POST) ? ' class="sep"' : ' disabled="disabled"').$selected.'>'.$padding.$row['forum_name'].'</option>'; |
|
| 573 | 573 | } |
| 574 | 574 | else |
| 575 | 575 | { |
| 576 | - $s_forum_id_options .= $holding . '<option value="' . $row['forum_id'] . '"' . (($row['forum_type'] == FORUM_POST) ? ' class="sep"' : ' disabled="disabled"') . $selected . '>' . $padding . $row['forum_name'] . '</option>'; |
|
| 576 | + $s_forum_id_options .= $holding.'<option value="'.$row['forum_id'].'"'.(($row['forum_type'] == FORUM_POST) ? ' class="sep"' : ' disabled="disabled"').$selected.'>'.$padding.$row['forum_name'].'</option>'; |
|
| 577 | 577 | $holding = ''; |
| 578 | 578 | } |
| 579 | 579 | } |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | $template->assign_vars(array( |
| 630 | 630 | 'S_VERSION_UNSTABLE' => true, |
| 631 | 631 | 'S_VERSION_DEV' => true, |
| 632 | - 'VERSION_WARNING' => $user->lang('QTE_DEV_WARNING', $version) . '<br />' . $user->lang['QTE_DEV_WARNING_DEV'], |
|
| 632 | + 'VERSION_WARNING' => $user->lang('QTE_DEV_WARNING', $version).'<br />'.$user->lang['QTE_DEV_WARNING_DEV'], |
|
| 633 | 633 | )); |
| 634 | 634 | } |
| 635 | 635 | else if (stripos($version, '-a') !== false) |
@@ -14,11 +14,11 @@ |
||
| 14 | 14 | |
| 15 | 15 | class ext extends \phpbb\extension\base |
| 16 | 16 | { |
| 17 | - const VERSION = '2.0.0-a2-dev'; |
|
| 17 | + const VERSION = '2.0.0-a2-dev'; |
|
| 18 | 18 | |
| 19 | - public function is_enableable() |
|
| 20 | - { |
|
| 21 | - $config = $this->container->get('config'); |
|
| 22 | - return phpbb_version_compare($config['version'], '3.1.3-RC1', '>='); |
|
| 23 | - } |
|
| 19 | + public function is_enableable() |
|
| 20 | + { |
|
| 21 | + $config = $this->container->get('config'); |
|
| 22 | + return phpbb_version_compare($config['version'], '3.1.3-RC1', '>='); |
|
| 23 | + } |
|
| 24 | 24 | } |
| 25 | 25 | \ No newline at end of file |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | public function delete_user($event) |
| 76 | 76 | { |
| 77 | - $sql = 'UPDATE ' . TOPICS_TABLE . ' |
|
| 78 | - SET topic_attr_user = ' . ANONYMOUS . ' |
|
| 77 | + $sql = 'UPDATE '.TOPICS_TABLE.' |
|
| 78 | + SET topic_attr_user = ' . ANONYMOUS.' |
|
| 79 | 79 | WHERE topic_attr_user = ' . (int) $event['user_ids']; |
| 80 | 80 | $this->db->sql_query($sql); |
| 81 | 81 | } |
@@ -193,8 +193,8 @@ discard block |
||
| 193 | 193 | $attr['attr_auths'][0]['forums_ids'][] = $event['forum_data']['forum_id']; |
| 194 | 194 | $sql_ary = array('attr_auths' => json_encode($attr['attr_auths'])); |
| 195 | 195 | |
| 196 | - $sql = 'UPDATE ' . $this->table_prefix . 'topics_attr |
|
| 197 | - SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' |
|
| 196 | + $sql = 'UPDATE '.$this->table_prefix.'topics_attr |
|
| 197 | + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary).' |
|
| 198 | 198 | WHERE attr_id = ' . (int) $attr['attr_id']; |
| 199 | 199 | $this->db->sql_query($sql); |
| 200 | 200 | } |
@@ -197,7 +197,7 @@ |
||
| 197 | 197 | $attr_name, |
| 198 | 198 | ); |
| 199 | 199 | |
| 200 | - $this->log->add('mod', $this->user->data['user_id'], $this->user->ip, 'MCP_ATTRIBUTE_' . ($event['data']['attr_id'] == \abdev\qte\qte::REMOVE ? 'REMOVED' : 'UPDATED'), time(), $log_data); |
|
| 200 | + $this->log->add('mod', $this->user->data['user_id'], $this->user->ip, 'MCP_ATTRIBUTE_'.($event['data']['attr_id'] == \abdev\qte\qte::REMOVE ? 'REMOVED' : 'UPDATED'), time(), $log_data); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | if (($this->attr = $this->cache->get('_attr')) === false) |
| 76 | 76 | { |
| 77 | 77 | $sql = 'SELECT * |
| 78 | - FROM ' . $this->table_prefix . 'topics_attr |
|
| 78 | + FROM ' . $this->table_prefix.'topics_attr |
|
| 79 | 79 | ORDER BY left_id ASC'; |
| 80 | 80 | $result = $this->db->sql_query($sql); |
| 81 | 81 | |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | if (!empty($topic_list)) |
| 107 | 107 | { |
| 108 | 108 | $sql = 'SELECT u.user_id, u.username, u.user_colour |
| 109 | - FROM ' . USERS_TABLE . ' u |
|
| 110 | - LEFT JOIN ' . TOPICS_TABLE . ' t ON (u.user_id = t.topic_attr_user) |
|
| 111 | - WHERE ' . $this->db->sql_in_set('t.topic_id', array_map('intval', $topic_list)) . ' |
|
| 109 | + FROM ' . USERS_TABLE.' u |
|
| 110 | + LEFT JOIN ' . TOPICS_TABLE.' t ON (u.user_id = t.topic_attr_user) |
|
| 111 | + WHERE ' . $this->db->sql_in_set('t.topic_id', array_map('intval', $topic_list)).' |
|
| 112 | 112 | AND t.topic_attr_user <> ' . ANONYMOUS; |
| 113 | 113 | $result = $this->db->sql_query($sql); |
| 114 | 114 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | public function get_users_by_user_id($user_id) |
| 128 | 128 | { |
| 129 | 129 | $sql = 'SELECT user_id, username, user_colour |
| 130 | - FROM ' . USERS_TABLE . ' |
|
| 130 | + FROM ' . USERS_TABLE.' |
|
| 131 | 131 | WHERE user_id = ' . (int) $user_id; |
| 132 | 132 | $result = $this->db->sql_query($sql); |
| 133 | 133 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | public function get_attr_name_by_id($attr_id) |
| 147 | 147 | { |
| 148 | 148 | $sql = 'SELECT attr_name |
| 149 | - FROM ' . $this->table_prefix . 'topics_attr |
|
| 149 | + FROM ' . $this->table_prefix.'topics_attr |
|
| 150 | 150 | WHERE attr_id = ' . (int) $attr_id; |
| 151 | 151 | $result = $this->db->sql_query($sql); |
| 152 | 152 | $attr_name = (string) $this->db->sql_fetchfield('attr_name'); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | // include that file ! |
| 166 | 166 | if (!function_exists('group_memberships')) |
| 167 | 167 | { |
| 168 | - include $this->root_path . 'includes/functions_user.' . $this->php_ext; |
|
| 168 | + include $this->root_path.'includes/functions_user.'.$this->php_ext; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | // load language |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | 'S_QTE_EMPTY' => (empty($attribute_id) || ($attribute_id == -1) || ($attribute_id == -2)), |
| 273 | 273 | 'S_QTE_SELECTED' => ($show_remove && ($attribute_id == -1)), |
| 274 | 274 | |
| 275 | - 'L_QTE_SELECT' => $this->user->lang['QTE_ATTRIBUTE_' . (!empty($attribute_id) ? ($show_remove ? 'REMOVE' : 'RESTRICT') : 'ADD')], |
|
| 275 | + 'L_QTE_SELECT' => $this->user->lang['QTE_ATTRIBUTE_'.(!empty($attribute_id) ? ($show_remove ? 'REMOVE' : 'RESTRICT') : 'ADD')], |
|
| 276 | 276 | )); |
| 277 | 277 | } |
| 278 | 278 | } |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | $attribute_name = str_replace(array('%mod%', '%date%'), array($attribute_username, $attribute_date), $this->attr_lng_key($this->attr[$attribute_id]['attr_name'])); |
| 522 | 522 | |
| 523 | - return !$this->attr[$attribute_id]['attr_type'] ? '<span' . $attribute_colour . '>' . $attribute_name . '</span>' : $this->attr_img_key($this->attr[$attribute_id]['attr_img'], $attribute_name); |
|
| 523 | + return !$this->attr[$attribute_id]['attr_type'] ? '<span'.$attribute_colour.'>'.$attribute_name.'</span>' : $this->attr_img_key($this->attr[$attribute_id]['attr_img'], $attribute_name); |
|
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | |
@@ -577,13 +577,13 @@ discard block |
||
| 577 | 577 | ); |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | - $sql = 'UPDATE ' . TOPICS_TABLE . ' |
|
| 581 | - SET ' . $this->db->sql_build_array('UPDATE', $fields) . ' |
|
| 580 | + $sql = 'UPDATE '.TOPICS_TABLE.' |
|
| 581 | + SET ' . $this->db->sql_build_array('UPDATE', $fields).' |
|
| 582 | 582 | WHERE topic_id = ' . (int) $topic_id; |
| 583 | 583 | $this->db->sql_query($sql); |
| 584 | 584 | |
| 585 | 585 | $sql = 'SELECT topic_id |
| 586 | - FROM ' . TOPICS_TABLE . ' |
|
| 586 | + FROM ' . TOPICS_TABLE.' |
|
| 587 | 587 | WHERE topic_moved_id = ' . (int) $topic_id; |
| 588 | 588 | $result = $this->db->sql_query($sql); |
| 589 | 589 | $shadow_topic_id = (int) $this->db->sql_fetchfield('topic_id'); |
@@ -591,8 +591,8 @@ discard block |
||
| 591 | 591 | |
| 592 | 592 | if (!empty($shadow_topic_id)) |
| 593 | 593 | { |
| 594 | - $sql = 'UPDATE ' . TOPICS_TABLE . ' |
|
| 595 | - SET ' . $this->db->sql_build_array('UPDATE', $fields) . ' |
|
| 594 | + $sql = 'UPDATE '.TOPICS_TABLE.' |
|
| 595 | + SET ' . $this->db->sql_build_array('UPDATE', $fields).' |
|
| 596 | 596 | WHERE topic_id = ' . $shadow_topic_id; |
| 597 | 597 | $this->db->sql_query($sql); |
| 598 | 598 | } |
@@ -604,8 +604,8 @@ discard block |
||
| 604 | 604 | $this->user->add_lang('posting'); |
| 605 | 605 | $this->user->add_lang_ext('abdev/qte', 'attributes'); |
| 606 | 606 | |
| 607 | - $message = $this->user->lang['QTE_ATTRIBUTE_' . ($attribute_id == -1 ? 'REMOVED' : (empty($topic_attribute) ? 'ADDED' : 'UPDATED'))] . '<br /><br />' . sprintf($this->user->lang['VIEW_MESSAGE'], '<a href="' . $meta_url . '">', '</a>'); |
|
| 608 | - $message .= '<br /><br />' . sprintf($this->user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$this->root_path}viewforum.$this->php_ext", 'f=' . $forum_id) . '">', '</a>'); |
|
| 607 | + $message = $this->user->lang['QTE_ATTRIBUTE_'.($attribute_id == -1 ? 'REMOVED' : (empty($topic_attribute) ? 'ADDED' : 'UPDATED'))].'<br /><br />'.sprintf($this->user->lang['VIEW_MESSAGE'], '<a href="'.$meta_url.'">', '</a>'); |
|
| 608 | + $message .= '<br /><br />'.sprintf($this->user->lang['RETURN_FORUM'], '<a href="'.append_sid("{$this->root_path}viewforum.$this->php_ext", 'f='.$forum_id).'">', '</a>'); |
|
| 609 | 609 | |
| 610 | 610 | trigger_error($message); |
| 611 | 611 | } |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | $current_time = time(); |
| 630 | 630 | |
| 631 | 631 | $sql = 'SELECT topic_id, forum_id, topic_title, topic_attr_id |
| 632 | - FROM ' . TOPICS_TABLE . ' |
|
| 632 | + FROM ' . TOPICS_TABLE.' |
|
| 633 | 633 | WHERE ' . $this->db->sql_in_set('topic_id', array_map('intval', $topic_ids)); |
| 634 | 634 | $result = $this->db->sql_query($sql); |
| 635 | 635 | |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | 'topic_id' => $row['topic_id'], |
| 643 | 643 | $row['topic_title'], |
| 644 | 644 | ); |
| 645 | - $this->log->add('mod', $this->user->data['user_id'], $this->user->ip, 'MCP_ATTRIBUTE_' . $message, $current_time, $additional_data); |
|
| 645 | + $this->log->add('mod', $this->user->data['user_id'], $this->user->ip, 'MCP_ATTRIBUTE_'.$message, $current_time, $additional_data); |
|
| 646 | 646 | } |
| 647 | 647 | $this->db->sql_freeresult($result); |
| 648 | 648 | |
@@ -663,13 +663,13 @@ discard block |
||
| 663 | 663 | ); |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | - $sql = 'UPDATE ' . TOPICS_TABLE . ' |
|
| 667 | - SET ' . $this->db->sql_build_array('UPDATE', $fields) . ' |
|
| 666 | + $sql = 'UPDATE '.TOPICS_TABLE.' |
|
| 667 | + SET ' . $this->db->sql_build_array('UPDATE', $fields).' |
|
| 668 | 668 | WHERE ' . $this->db->sql_in_set('topic_id', array_map('intval', $topic_ids)); |
| 669 | 669 | $this->db->sql_query($sql); |
| 670 | 670 | |
| 671 | 671 | $sql = 'SELECT topic_id |
| 672 | - FROM ' . TOPICS_TABLE . ' |
|
| 672 | + FROM ' . TOPICS_TABLE.' |
|
| 673 | 673 | WHERE ' . $this->db->sql_in_set('topic_moved_id', array_map('intval', $topic_ids)); |
| 674 | 674 | $result = $this->db->sql_query($sql); |
| 675 | 675 | |
@@ -682,8 +682,8 @@ discard block |
||
| 682 | 682 | |
| 683 | 683 | if (sizeof($shadow_topic_ids)) |
| 684 | 684 | { |
| 685 | - $sql = 'UPDATE ' . TOPICS_TABLE . ' |
|
| 686 | - SET ' . $this->db->sql_build_array('UPDATE', $fields) . ' |
|
| 685 | + $sql = 'UPDATE '.TOPICS_TABLE.' |
|
| 686 | + SET ' . $this->db->sql_build_array('UPDATE', $fields).' |
|
| 687 | 687 | WHERE ' . $this->db->sql_in_set('topic_id', array_map('intval', $shadow_topic_ids)); |
| 688 | 688 | $this->db->sql_query($sql); |
| 689 | 689 | } |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | $redirect = $this->request->variable('redirect', $this->user->data['session_page']); |
| 692 | 692 | |
| 693 | 693 | meta_refresh(3, $redirect); |
| 694 | - trigger_error($this->user->lang['QTE_TOPIC' . (sizeof($topic_ids) == 1 ? '' : 'S') . '_ATTRIBUTE_' . $message] . '<br /><br />' . sprintf($this->user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); |
|
| 694 | + trigger_error($this->user->lang['QTE_TOPIC'.(sizeof($topic_ids) == 1 ? '' : 'S').'_ATTRIBUTE_'.$message].'<br /><br />'.sprintf($this->user->lang['RETURN_PAGE'], '<a href="'.$redirect.'">', '</a>')); |
|
| 695 | 695 | |
| 696 | 696 | return; |
| 697 | 697 | } |
@@ -704,12 +704,12 @@ discard block |
||
| 704 | 704 | // borrowed function from "ACP Announcement Centre" mod |
| 705 | 705 | public function qte_group_select($group_ids, $exclude_ids = array(), $manage_founder = false) |
| 706 | 706 | { |
| 707 | - $exclude_sql = ($exclude_ids !== false && sizeof($exclude_ids)) ? 'WHERE ' . $this->db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : ''; |
|
| 708 | - $sql_and = !$this->config['coppa_enable'] ? ($exclude_sql ? ' AND ' : ' WHERE ') . "group_name <> 'REGISTERED_COPPA'" : ''; |
|
| 709 | - $sql_founder = ($manage_founder !== false) ? (($exclude_sql || $sql_and) ? ' AND ' : ' WHERE ') . 'group_founder_manage = ' . (int) $manage_founder : ''; |
|
| 707 | + $exclude_sql = ($exclude_ids !== false && sizeof($exclude_ids)) ? 'WHERE '.$this->db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : ''; |
|
| 708 | + $sql_and = !$this->config['coppa_enable'] ? ($exclude_sql ? ' AND ' : ' WHERE ')."group_name <> 'REGISTERED_COPPA'" : ''; |
|
| 709 | + $sql_founder = ($manage_founder !== false) ? (($exclude_sql || $sql_and) ? ' AND ' : ' WHERE ').'group_founder_manage = '.(int) $manage_founder : ''; |
|
| 710 | 710 | |
| 711 | 711 | $sql = 'SELECT group_id, group_name, group_type |
| 712 | - FROM ' . GROUPS_TABLE . " |
|
| 712 | + FROM ' . GROUPS_TABLE." |
|
| 713 | 713 | $exclude_sql |
| 714 | 714 | $sql_and |
| 715 | 715 | $sql_founder |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | while ($row = $this->db->sql_fetchrow($result)) |
| 721 | 721 | { |
| 722 | 722 | $selected = in_array($row['group_id'], $group_ids) ? ' selected="selected"' : ''; |
| 723 | - $s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '"' . $selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $this->user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; |
|
| 723 | + $s_group_options .= '<option'.(($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '').' value="'.$row['group_id'].'"'.$selected.'>'.(($row['group_type'] == GROUP_SPECIAL) ? $this->user->lang['G_'.$row['group_name']] : $row['group_name']).'</option>'; |
|
| 724 | 724 | } |
| 725 | 725 | $this->db->sql_freeresult($result); |
| 726 | 726 | |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | // borrowed from "Categories Hierarchy" : used to check if a image key exists |
| 740 | 740 | public function attr_img_key($key, $alt) |
| 741 | 741 | { |
| 742 | - return empty($key) ? '' : (preg_match('#^[a-z0-9_-]+$#i', $key) ? $this->user->img($key, $alt) : '<img src="' . (preg_match('#^(ht|f)tp[s]?\://#i', $key) ? $key : $this->root_path . $key) . '" alt="' . $alt . '" title="' . $alt . '" />'); |
|
| 742 | + return empty($key) ? '' : (preg_match('#^[a-z0-9_-]+$#i', $key) ? $this->user->img($key, $alt) : '<img src="'.(preg_match('#^(ht|f)tp[s]?\://#i', $key) ? $key : $this->root_path.$key).'" alt="'.$alt.'" title="'.$alt.'" />'); |
|
| 743 | 743 | } |
| 744 | 744 | |
| 745 | 745 | public function attr_colour($a_name, $a_colour) |
@@ -750,6 +750,6 @@ discard block |
||
| 750 | 750 | $a_name .= '-qte'; |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | - return ' class="qte-attr ' . $a_name . '"' . (!empty($a_colour) ? ' style="color:#' . $a_colour . '; font-weight:bold;"' : ''); |
|
| 753 | + return ' class="qte-attr '.$a_name.'"'.(!empty($a_colour) ? ' style="color:#'.$a_colour.'; font-weight:bold;"' : ''); |
|
| 754 | 754 | } |
| 755 | 755 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | return array( |
| 37 | 37 | 'update_columns' => array( |
| 38 | - $this->table_prefix . 'topics_attr' => array( |
|
| 38 | + $this->table_prefix.'topics_attr' => array( |
|
| 39 | 39 | array('attr_desc', array('VCHAR:60', '')), |
| 40 | 40 | ), |
| 41 | 41 | ), |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | return array( |
| 48 | 48 | 'update_columns' => array( |
| 49 | - $this->table_prefix . 'topics_attr' => array( |
|
| 49 | + $this->table_prefix.'topics_attr' => array( |
|
| 50 | 50 | array('attr_desc', array('VCHAR', '')), |
| 51 | 51 | ), |
| 52 | 52 | ), |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | return array( |
| 37 | 37 | 'drop_columns' => array( |
| 38 | - $this->table_prefix . 'topics_attr' => array( |
|
| 38 | + $this->table_prefix.'topics_attr' => array( |
|
| 39 | 39 | 'allowed_forums', |
| 40 | 40 | 'allowed_groups', |
| 41 | 41 | ), |
| 42 | 42 | ), |
| 43 | 43 | 'add_columns' => array( |
| 44 | - $this->table_prefix . 'topics_attr' => array( |
|
| 44 | + $this->table_prefix.'topics_attr' => array( |
|
| 45 | 45 | 'attr_desc' => array('VCHAR', ''), |
| 46 | 46 | 'attr_auths' => array('MTEXT', ''), |
| 47 | 47 | ), |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | return array( |
| 55 | 55 | 'add_columns' => array( |
| 56 | - $this->table_prefix . 'topics_attr' => array( |
|
| 56 | + $this->table_prefix.'topics_attr' => array( |
|
| 57 | 57 | 'allowed_forums' => array('TEXT', ''), |
| 58 | 58 | 'allowed_groups' => array('TEXT', ''), |
| 59 | 59 | ), |
| 60 | 60 | ), |
| 61 | 61 | 'drop_columns' => array( |
| 62 | - $this->table_prefix . 'topics_attr' => array( |
|
| 62 | + $this->table_prefix.'topics_attr' => array( |
|
| 63 | 63 | 'attr_desc', |
| 64 | 64 | 'attr_auths', |
| 65 | 65 | ), |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | return array( |
| 43 | 43 | 'add_tables' => array( |
| 44 | - $this->table_prefix . 'topics_attr' => array( |
|
| 44 | + $this->table_prefix.'topics_attr' => array( |
|
| 45 | 45 | 'COLUMNS' => array( |
| 46 | 46 | 'attr_id' => array('UINT', NULL, 'auto_increment'), |
| 47 | 47 | 'attr_type' => array('BOOL', 0), |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | return array( |
| 74 | 74 | 'drop_tables' => array( |
| 75 | - $this->table_prefix . 'topics_attr', |
|
| 75 | + $this->table_prefix.'topics_attr', |
|
| 76 | 76 | ), |
| 77 | 77 | 'drop_columns' => array( |
| 78 | 78 | TOPICS_TABLE => array( |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | 'add_tables' => array( |
| 44 | 44 | $this->table_prefix . 'topics_attr' => array( |
| 45 | 45 | 'COLUMNS' => array( |
| 46 | - 'attr_id' => array('UINT', NULL, 'auto_increment'), |
|
| 46 | + 'attr_id' => array('UINT', null, 'auto_increment'), |
|
| 47 | 47 | 'attr_type' => array('BOOL', 0), |
| 48 | 48 | 'attr_name' => array('VCHAR', ''), |
| 49 | 49 | 'left_id' => array('UINT', 0), |