@@ -76,20 +76,20 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\language\language $language, \phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, \phpbb\request\request $request, \phpbb\auth\auth $auth, \phpbb\notification\manager $notification, \phpbb\filesystem\filesystem_interface $filesystem, \FastImageSize\FastImageSize $imagesize, \phpbb\files\factory $files_factory, $root_path, $php_ext) |
| 78 | 78 | { |
| 79 | - $this->db = $db; |
|
| 80 | - $this->config = $config; |
|
| 79 | + $this->db = $db; |
|
| 80 | + $this->config = $config; |
|
| 81 | 81 | $this->language = $language; |
| 82 | 82 | $this->template = $template; |
| 83 | 83 | $this->user = $user; |
| 84 | - $this->helper = $helper; |
|
| 85 | - $this->request = $request; |
|
| 84 | + $this->helper = $helper; |
|
| 85 | + $this->request = $request; |
|
| 86 | 86 | $this->auth = $auth; |
| 87 | - $this->notification = $notification; |
|
| 88 | - $this->filesystem = $filesystem; |
|
| 87 | + $this->notification = $notification; |
|
| 88 | + $this->filesystem = $filesystem; |
|
| 89 | 89 | $this->imagesize = $imagesize; |
| 90 | - $this->files_factory = $files_factory; |
|
| 90 | + $this->files_factory = $files_factory; |
|
| 91 | 91 | $this->root_path = $root_path; |
| 92 | - $this->php_ext = $php_ext; |
|
| 92 | + $this->php_ext = $php_ext; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $this->db->sql_transaction('begin'); |
| 107 | 107 | |
| 108 | - $sql = 'INSERT INTO ' . $this->links_table . ' ' . $this->db->sql_build_array('INSERT', $data); |
|
| 108 | + $sql = 'INSERT INTO '.$this->links_table.' '.$this->db->sql_build_array('INSERT', $data); |
|
| 109 | 109 | $this->db->sql_query($sql); |
| 110 | 110 | $notification_data['link_id'] = $this->db->sql_nextid(); |
| 111 | 111 | |
| 112 | 112 | if (!$need_approval || $this->auth->acl_get('a_') || $this->auth->acl_get('m_')) |
| 113 | 113 | { |
| 114 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
| 114 | + $sql = 'UPDATE '.$this->categories_table.' |
|
| 115 | 115 | SET cat_links = cat_links + 1 |
| 116 | 116 | WHERE cat_id = ' . (int) $data['link_cat']; |
| 117 | 117 | $this->db->sql_query($sql); |
@@ -169,14 +169,14 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | $this->db->sql_transaction('begin'); |
| 171 | 171 | |
| 172 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
| 172 | + $sql = 'UPDATE '.$this->categories_table.' |
|
| 173 | 173 | SET cat_links = cat_links - 1 |
| 174 | 174 | WHERE cat_id = ' . (int) $old_cat; |
| 175 | 175 | $this->db->sql_query($sql); |
| 176 | 176 | |
| 177 | 177 | if (!$need_approval) |
| 178 | 178 | { |
| 179 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
| 179 | + $sql = 'UPDATE '.$this->categories_table.' |
|
| 180 | 180 | SET cat_links = cat_links + 1 |
| 181 | 181 | WHERE cat_id = ' . (int) $data['link_cat']; |
| 182 | 182 | $this->db->sql_query($sql); |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | $this->notification->add_notifications($notification_type, $notification_data); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 198 | - SET ' . $this->db->sql_build_array('UPDATE', $data) . ' |
|
| 197 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 198 | + SET ' . $this->db->sql_build_array('UPDATE', $data).' |
|
| 199 | 199 | WHERE link_id = ' . (int) $link_id; |
| 200 | 200 | $this->db->sql_query($sql); |
| 201 | 201 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | ); |
| 222 | 222 | |
| 223 | 223 | $sql = 'SELECT link_banner |
| 224 | - FROM ' . $this->links_table . ' |
|
| 224 | + FROM ' . $this->links_table.' |
|
| 225 | 225 | WHERE '. $this->db->sql_in_set('link_id', $url_array); |
| 226 | 226 | $result = $this->db->sql_query($sql); |
| 227 | 227 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $this->db->sql_query("DELETE FROM $table WHERE ".$this->db->sql_in_set($field, $url_array)); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
| 246 | + $sql = 'UPDATE '.$this->categories_table.' |
|
| 247 | 247 | SET cat_links = cat_links - '.sizeof($url_array).' |
| 248 | 248 | WHERE cat_id = ' . (int) $cat_id; |
| 249 | 249 | $this->db->sql_query($sql); |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | if ($this->request->is_ajax()) |
| 262 | 262 | { |
| 263 | 263 | $sql = 'SELECT cat_links |
| 264 | - FROM ' . $this->categories_table . ' |
|
| 264 | + FROM ' . $this->categories_table.' |
|
| 265 | 265 | WHERE cat_id = ' . (int) $cat_id; |
| 266 | 266 | $result = $this->db->sql_query($sql); |
| 267 | 267 | $data = $this->db->sql_fetchrow($result); |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | public function view($link_id) |
| 289 | 289 | { |
| 290 | 290 | $sql = 'SELECT link_id, link_url |
| 291 | - FROM ' . $this->links_table . ' |
|
| 291 | + FROM ' . $this->links_table.' |
|
| 292 | 292 | WHERE link_id = ' . (int) $link_id; |
| 293 | 293 | $result = $this->db->sql_query($sql); |
| 294 | 294 | $data = $this->db->sql_fetchrow($result); |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | throw new \phpbb\exception\http_exception(404, 'DIR_ERROR_NO_LINKS'); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 301 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 302 | 302 | SET link_view = link_view + 1 |
| 303 | 303 | WHERE link_id = ' . (int) $link_id; |
| 304 | 304 | $this->db->sql_query($sql); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | if ($details['scheme'] == 'https') |
| 324 | 324 | { |
| 325 | 325 | $default_port = 443; |
| 326 | - $hostname = 'tls://' . $details['host']; |
|
| 326 | + $hostname = 'tls://'.$details['host']; |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | if (!isset($details['path'])) |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | $flag_path = $ext_path.'images/flags/'; |
| 382 | 382 | $img_flag = 'no_flag.png'; |
| 383 | 383 | |
| 384 | - if ($this->config['dir_activ_flag'] && !empty($data['link_flag']) && file_exists($flag_path . $data['link_flag'])) |
|
| 384 | + if ($this->config['dir_activ_flag'] && !empty($data['link_flag']) && file_exists($flag_path.$data['link_flag'])) |
|
| 385 | 385 | { |
| 386 | 386 | $img_flag = $data['link_flag']; |
| 387 | 387 | } |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $list = '<select name="vote">'; |
| 424 | 424 | for ($i = 0; $i <= 10; $i++) |
| 425 | 425 | { |
| 426 | - $list .= '<option value="' . $i . '"' . (($i == 5) ? ' selected="selected"' : '') . '>' . $i . '</option>'; |
|
| 426 | + $list .= '<option value="'.$i.'"'.(($i == 5) ? ' selected="selected"' : '').'>'.$i.'</option>'; |
|
| 427 | 427 | } |
| 428 | 428 | $list .= '</select>'; |
| 429 | 429 | |
@@ -461,8 +461,8 @@ discard block |
||
| 461 | 461 | { |
| 462 | 462 | $thumb = $this->thumb_process($data['link_url']); |
| 463 | 463 | |
| 464 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 465 | - SET link_thumb = "' . $this->db->sql_escape($thumb) . '" |
|
| 464 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 465 | + SET link_thumb = "' . $this->db->sql_escape($thumb).'" |
|
| 466 | 466 | WHERE link_id = ' . (int) $data['link_id']; |
| 467 | 467 | $this->db->sql_query($sql); |
| 468 | 468 | |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | $height /= $coef_max; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - return '<img src="' . $img_src . '" width="' . $width . '" height="' . $height . '" alt="'.$data['link_name'].'" title="'.$data['link_name'].'" />'; |
|
| 512 | + return '<img src="'.$img_src.'" width="'.$width.'" height="'.$height.'" alt="'.$data['link_name'].'" title="'.$data['link_name'].'" />'; |
|
| 513 | 513 | } |
| 514 | 514 | return ''; |
| 515 | 515 | } |
@@ -530,12 +530,12 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | $this->db->sql_transaction('begin'); |
| 532 | 532 | |
| 533 | - $sql = 'INSERT INTO ' . $this->votes_table . ' ' . $this->db->sql_build_array('INSERT', $data); |
|
| 533 | + $sql = 'INSERT INTO '.$this->votes_table.' '.$this->db->sql_build_array('INSERT', $data); |
|
| 534 | 534 | $this->db->sql_query($sql); |
| 535 | 535 | |
| 536 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 536 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 537 | 537 | SET link_vote = link_vote + 1, |
| 538 | - link_note = link_note + ' . (int) $data['vote_note'] . ' |
|
| 538 | + link_note = link_note + ' . (int) $data['vote_note'].' |
|
| 539 | 539 | WHERE link_id = ' . (int) $link_id; |
| 540 | 540 | $this->db->sql_query($sql); |
| 541 | 541 | |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | if ($this->request->is_ajax()) |
| 545 | 545 | { |
| 546 | - $sql= 'SELECT link_vote, link_note FROM ' . $this->links_table . ' WHERE link_id = ' . (int) $link_id; |
|
| 546 | + $sql = 'SELECT link_vote, link_note FROM '.$this->links_table.' WHERE link_id = '.(int) $link_id; |
|
| 547 | 547 | $result = $this->db->sql_query($sql); |
| 548 | 548 | $data = $this->db->sql_fetchrow($result); |
| 549 | 549 | |
@@ -577,8 +577,8 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | $details = parse_url($url); |
| 579 | 579 | |
| 580 | - $root_url = $details['scheme'].'://'.$details['host']; |
|
| 581 | - $absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url; |
|
| 580 | + $root_url = $details['scheme'].'://'.$details['host']; |
|
| 581 | + $absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url; |
|
| 582 | 582 | |
| 583 | 583 | if ($this->config['dir_activ_thumb_remote'] && $this->_ascreen_exist($details['scheme'], $details['host'])) |
| 584 | 584 | { |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | $destination = $this->get_banner_path(); |
| 622 | 622 | |
| 623 | 623 | // Can we upload? |
| 624 | - $can_upload = ($this->config['dir_storage_banner'] && $this->filesystem->exists($this->root_path . $destination) && $this->filesystem->is_writable($this->root_path . $destination) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; |
|
| 624 | + $can_upload = ($this->config['dir_storage_banner'] && $this->filesystem->exists($this->root_path.$destination) && $this->filesystem->is_writable($this->root_path.$destination) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; |
|
| 625 | 625 | |
| 626 | 626 | if ($banner && $can_upload) |
| 627 | 627 | { |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | |
| 668 | 668 | $file = $upload->handle_upload('files.types.remote', $banner); |
| 669 | 669 | |
| 670 | - $prefix = unique_id() . '_'; |
|
| 670 | + $prefix = unique_id().'_'; |
|
| 671 | 671 | $file->clean_filename('real', $prefix); |
| 672 | 672 | |
| 673 | 673 | if (sizeof($file->error)) |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | { |
| 699 | 699 | if (!preg_match('#^(http|https|ftp)://#i', $banner)) |
| 700 | 700 | { |
| 701 | - $banner = 'http://' . $banner; |
|
| 701 | + $banner = 'http://'.$banner; |
|
| 702 | 702 | } |
| 703 | 703 | if (!preg_match('#^(http|https|ftp)://(?:(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}|(?:\d{1,3}\.){3,5}\d{1,3}):?([0-9]*?).*?\.(gif|jpg|jpeg|png)$#i', $banner)) |
| 704 | 704 | { |
@@ -729,8 +729,8 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | // Check image type |
| 732 | - $types = \phpbb\files\upload::image_types(); |
|
| 733 | - $extension = strtolower(\phpbb\files\filespec::get_extension($banner)); |
|
| 732 | + $types = \phpbb\files\upload::image_types(); |
|
| 733 | + $extension = strtolower(\phpbb\files\filespec::get_extension($banner)); |
|
| 734 | 734 | |
| 735 | 735 | // Check if this is actually an image |
| 736 | 736 | if ($file_stream = @fopen($banner, 'r')) |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | |
| 851 | 851 | if (file_exists($flag_path.$img_file)) |
| 852 | 852 | { |
| 853 | - $list .= '<option value="' . $img_file . '" ' . (($img_file == $value) ? 'selected="selected"' : '') . '>' . $name . '</option>'; |
|
| 853 | + $list .= '<option value="'.$img_file.'" '.(($img_file == $value) ? 'selected="selected"' : '').'>'.$name.'</option>'; |
|
| 854 | 854 | } |
| 855 | 855 | } |
| 856 | 856 | |
@@ -866,8 +866,8 @@ discard block |
||
| 866 | 866 | { |
| 867 | 867 | if ($this->config['dir_recent_block']) |
| 868 | 868 | { |
| 869 | - $limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns']; |
|
| 870 | - $exclude_array = explode(',', str_replace(' ', '', $this->config['dir_recent_exclude'])); |
|
| 869 | + $limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns']; |
|
| 870 | + $exclude_array = explode(',', str_replace(' ', '', $this->config['dir_recent_exclude'])); |
|
| 871 | 871 | |
| 872 | 872 | $sql_array = array( |
| 873 | 873 | 'SELECT' => 'l.link_id, l.link_cat, l.link_url, l.link_user_id, l.link_comment, l. link_description, l.link_vote, l.link_note, l.link_view, l.link_time, l.link_name, l.link_thumb, u.user_id, u.username, u.user_colour, c.cat_name', |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | if (sizeof($rowset)) |
| 901 | 901 | { |
| 902 | 902 | $this->template->assign_block_vars('block', array( |
| 903 | - 'S_COL_WIDTH' => (100 / $this->config['dir_recent_columns']) . '%', |
|
| 903 | + 'S_COL_WIDTH' => (100 / $this->config['dir_recent_columns']).'%', |
|
| 904 | 904 | )); |
| 905 | 905 | |
| 906 | 906 | foreach ($rowset as $row) |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | 'COUNT' => $row['link_view'], |
| 920 | 920 | 'COMMENT' => $row['link_comment'], |
| 921 | 921 | |
| 922 | - 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $row['link_cat']), |
|
| 922 | + 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$row['link_cat']), |
|
| 923 | 923 | 'U_COMMENT' => $this->helper->route('ernadoo_phpbbdirectory_comment_view_controller', array('link_id' => (int) $row['link_id'])), |
| 924 | 924 | |
| 925 | 925 | 'L_DIR_SEARCH_NB_CLICKS' => $this->language->lang('DIR_SEARCH_NB_CLICKS', (int) $row['link_view']), |