| @@ -87,19 +87,19 @@ discard block | ||
| 87 | 87 | */ | 
| 88 | 88 | 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\captcha\factory $captcha_factory, \ernadoo\phpbbdirectory\core\categorie $categorie, \ernadoo\phpbbdirectory\core\link $link, $root_path, $php_ext) | 
| 89 | 89 |  	{ | 
| 90 | - $this->db = $db; | |
| 91 | - $this->config = $config; | |
| 90 | + $this->db = $db; | |
| 91 | + $this->config = $config; | |
| 92 | 92 | $this->language = $language; | 
| 93 | 93 | $this->template = $template; | 
| 94 | 94 | $this->user = $user; | 
| 95 | - $this->helper = $helper; | |
| 96 | - $this->request = $request; | |
| 95 | + $this->helper = $helper; | |
| 96 | + $this->request = $request; | |
| 97 | 97 | $this->auth = $auth; | 
| 98 | - $this->captcha_factory = $captcha_factory; | |
| 98 | + $this->captcha_factory = $captcha_factory; | |
| 99 | 99 | $this->categorie = $categorie; | 
| 100 | 100 | $this->link = $link; | 
| 101 | 101 | $this->root_path = $root_path; | 
| 102 | - $this->php_ext = $php_ext; | |
| 102 | + $this->php_ext = $php_ext; | |
| 103 | 103 | |
| 104 | 104 |  		$language->add_lang('directory', 'ernadoo/phpbbdirectory'); | 
| 105 | 105 | |
| @@ -119,12 +119,12 @@ discard block | ||
| 119 | 119 |  	{ | 
| 120 | 120 |  		if ($this->request->is_set_post('cancel')) | 
| 121 | 121 |  		{ | 
| 122 | -			$redirect = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); | |
| 122 | +			$redirect = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); | |
| 123 | 123 | redirect($redirect); | 
| 124 | 124 | } | 
| 125 | 125 | |
| 126 | 126 | $sql = 'SELECT link_user_id | 
| 127 | - FROM ' . $this->links_table . ' | |
| 127 | + FROM ' . $this->links_table.' | |
| 128 | 128 | WHERE link_id = ' . (int) $link_id; | 
| 129 | 129 | $result = $this->db->sql_query($sql); | 
| 130 | 130 | $link_data = $this->db->sql_fetchrow($result); | 
| @@ -145,9 +145,9 @@ discard block | ||
| 145 | 145 |  		{ | 
| 146 | 146 | $this->link->del($cat_id, $link_id); | 
| 147 | 147 | |
| 148 | -			$meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); | |
| 148 | +			$meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); | |
| 149 | 149 | meta_refresh(3, $meta_info); | 
| 150 | -			$message = $this->language->lang('DIR_DELETE_OK') . '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_DIR', '<a href="' . $this->helper->route('ernadoo_phpbbdirectory_base_controller') . '">', '</a>') . '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="' . $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id) . '">', '</a>'); | |
| 150 | +			$message = $this->language->lang('DIR_DELETE_OK').'<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_DIR', '<a href="'.$this->helper->route('ernadoo_phpbbdirectory_base_controller').'">', '</a>').'<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="'.$this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id).'">', '</a>'); | |
| 151 | 151 | return $this->helper->message($message); | 
| 152 | 152 | } | 
| 153 | 153 | else | 
| @@ -167,7 +167,7 @@ discard block | ||
| 167 | 167 | public function edit_link($cat_id, $link_id) | 
| 168 | 168 |  	{ | 
| 169 | 169 | $sql = 'SELECT link_id, link_uid, link_user_id, link_flags, link_bitfield, link_cat, link_url, link_description, link_guest_email, link_name, link_rss, link_back, link_banner, link_flag, link_cat, link_time | 
| 170 | - FROM ' . $this->links_table . ' | |
| 170 | + FROM ' . $this->links_table.' | |
| 171 | 171 | WHERE link_id = ' . (int) $link_id; | 
| 172 | 172 | $result = $this->db->sql_query($sql); | 
| 173 | 173 | $link_data = $this->db->sql_fetchrow($result); | 
| @@ -188,7 +188,7 @@ discard block | ||
| 188 | 188 |  		$cat_id		= $this->request->variable('id', $cat_id); | 
| 189 | 189 |  		$submit		= $this->request->is_set_post('submit') ? true : false; | 
| 190 | 190 |  		$refresh	= $this->request->is_set_post('refresh_vc') ? true : false; | 
| 191 | -		$title		= $this->language->lang('DIR_EDIT_SITE'); | |
| 191 | +		$title = $this->language->lang('DIR_EDIT_SITE'); | |
| 192 | 192 | |
| 193 | 193 |  		$this->template->assign_block_vars('dir_navlinks', array( | 
| 194 | 194 | 'FORUM_NAME' => $title, | 
| @@ -212,15 +212,15 @@ discard block | ||
| 212 | 212 | 'old_banner' => $link_data['link_banner'], | 
| 213 | 213 | ); | 
| 214 | 214 | |
| 215 | - $site_description = generate_text_for_edit($link_data['link_description'], $link_data['link_uid'], $link_data['link_flags']); | |
| 216 | -			$link_data['link_banner'] 	= (preg_match('/^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/|www\.).+/si', $link_data['link_banner'])) ? $link_data['link_banner'] : ''; | |
| 215 | + $site_description = generate_text_for_edit($link_data['link_description'], $link_data['link_uid'], $link_data['link_flags']); | |
| 216 | +			$link_data['link_banner'] = (preg_match('/^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/|www\.).+/si', $link_data['link_banner'])) ? $link_data['link_banner'] : ''; | |
| 217 | 217 | |
| 218 | - $this->url = $link_data['link_url']; | |
| 219 | - $this->site_name = $link_data['link_name']; | |
| 218 | + $this->url = $link_data['link_url']; | |
| 219 | + $this->site_name = $link_data['link_name']; | |
| 220 | 220 | $this->description = $site_description['text']; | 
| 221 | 221 | $this->guest_email = $link_data['link_guest_email']; | 
| 222 | - $this->rss = $link_data['link_rss']; | |
| 223 | - $this->banner = $link_data['link_banner']; | |
| 222 | + $this->rss = $link_data['link_rss']; | |
| 223 | + $this->banner = $link_data['link_banner']; | |
| 224 | 224 | $this->back = $link_data['link_back']; | 
| 225 | 225 | $this->flag = $link_data['link_flag']; | 
| 226 | 226 | } | 
| @@ -247,7 +247,7 @@ discard block | ||
| 247 | 247 |  		$cat_id		= $this->request->variable('id', $cat_id); | 
| 248 | 248 |  		$submit		= $this->request->is_set_post('submit') ? true : false; | 
| 249 | 249 |  		$refresh	= $this->request->is_set_post('refresh_vc') ? true : false; | 
| 250 | -		$title		= $this->language->lang('DIR_NEW_SITE'); | |
| 250 | +		$title = $this->language->lang('DIR_NEW_SITE'); | |
| 251 | 251 | |
| 252 | 252 |  		$this->template->assign_block_vars('dir_navlinks', array( | 
| 253 | 253 | 'FORUM_NAME' => $title, | 
| @@ -311,7 +311,7 @@ discard block | ||
| 311 | 311 | |
| 312 | 312 | // We check if user had already vot for this website. | 
| 313 | 313 | $sql = 'SELECT vote_link_id | 
| 314 | - FROM ' . $this->votes_table . ' | |
| 314 | + FROM ' . $this->votes_table.' | |
| 315 | 315 |  			WHERE ' . $this->db->sql_build_array('SELECT', $data); | 
| 316 | 316 | $result = $this->db->sql_query($sql); | 
| 317 | 317 | $data = $this->db->sql_fetchrow($result); | 
| @@ -323,9 +323,9 @@ discard block | ||
| 323 | 323 | |
| 324 | 324 |  		$this->link->add_vote($link_id, $this->request->variable('vote', 0)); | 
| 325 | 325 | |
| 326 | -		$meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); | |
| 326 | +		$meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); | |
| 327 | 327 | meta_refresh(3, $meta_info); | 
| 328 | -		$message = $this->language->lang('DIR_VOTE_OK') . '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="' . $meta_info . '">', '</a>'); | |
| 328 | +		$message = $this->language->lang('DIR_VOTE_OK').'<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="'.$meta_info.'">', '</a>'); | |
| 329 | 329 | return $this->helper->message($message); | 
| 330 | 330 | } | 
| 331 | 331 | |
| @@ -350,18 +350,18 @@ discard block | ||
| 350 | 350 |  			return $this->helper->message('FORM_INVALID'); | 
| 351 | 351 | } | 
| 352 | 352 | |
| 353 | -		$this->url			= $this->request->variable('url', ''); | |
| 354 | -		$this->site_name	= $this->request->variable('site_name', '', true); | |
| 353 | +		$this->url = $this->request->variable('url', ''); | |
| 354 | +		$this->site_name = $this->request->variable('site_name', '', true); | |
| 355 | 355 |  		$this->description	= $this->request->variable('description', '', true); | 
| 356 | 356 |  		$this->guest_email	= $this->request->variable('guest_email', ''); | 
| 357 | -		$this->rss			= $this->request->variable('rss', ''); | |
| 358 | -		$this->banner 		= $this->request->variable('banner', ''); | |
| 357 | +		$this->rss = $this->request->variable('rss', ''); | |
| 358 | +		$this->banner = $this->request->variable('banner', ''); | |
| 359 | 359 |  		$this->back			= $this->request->variable('back', ''); | 
| 360 | 360 |  		$this->flag 		= $this->request->variable('flag', ''); | 
| 361 | 361 | |
| 362 | 362 |  		if (!function_exists('validate_data')) | 
| 363 | 363 |  		{ | 
| 364 | - include($this->root_path . 'includes/functions_user.' . $this->php_ext); | |
| 364 | + include($this->root_path.'includes/functions_user.'.$this->php_ext); | |
| 365 | 365 | } | 
| 366 | 366 | |
| 367 | 367 | // We define variables to check | 
| @@ -384,17 +384,17 @@ discard block | ||
| 384 | 384 | 'site_name' => array( | 
| 385 | 385 |  				array('string', false, 1, 100)), | 
| 386 | 386 | 'website' => array( | 
| 387 | -				array('string',	false, 12, 255), | |
| 388 | -				array('match',	true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), | |
| 387 | +				array('string', false, 12, 255), | |
| 388 | +				array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), | |
| 389 | 389 | 'description' => array( | 
| 390 | 390 |  				array('string', !$this->categorie->data['cat_must_describe'], 1, $this->config['dir_length_describe'])), | 
| 391 | 391 | 'rss' => array( | 
| 392 | 392 |  				array('string', true, 12, 255), | 
| 393 | -				array('match',	empty($this->rss), '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), | |
| 393 | +				array('match', empty($this->rss), '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), | |
| 394 | 394 | 'banner' => array( | 
| 395 | 395 |  				array('string', true, 5, 255)), | 
| 396 | 396 | 'back' => array( | 
| 397 | -				array('string',	!$this->categorie->data['cat_link_back'], 12, 255), | |
| 397 | +				array('string', !$this->categorie->data['cat_link_back'], 12, 255), | |
| 398 | 398 | array(array($this->link, 'link_back'), true)), | 
| 399 | 399 | 'cat' => array( | 
| 400 | 400 |  				array('num', '', 1)) | 
| @@ -440,8 +440,8 @@ discard block | ||
| 440 | 440 | // Still no errors?? So let's go! | 
| 441 | 441 | if (!$error) | 
| 442 | 442 |  		{ | 
| 443 | -			$this->banner	= (!$this->banner && !$this->request->is_set_post('delete_banner')) ? $this->request->variable('old_banner', '') : $this->banner; | |
| 444 | - $this->url = $this->link->clean_url($this->url); | |
| 443 | +			$this->banner = (!$this->banner && !$this->request->is_set_post('delete_banner')) ? $this->request->variable('old_banner', '') : $this->banner; | |
| 444 | + $this->url = $this->link->clean_url($this->url); | |
| 445 | 445 | |
| 446 | 446 | $data_edit = array( | 
| 447 | 447 | 'link_user_id' => $this->link_user_id, | 
| @@ -486,10 +486,10 @@ discard block | ||
| 486 | 486 | $this->link->add($data_add, $need_approval); | 
| 487 | 487 | } | 
| 488 | 488 | |
| 489 | -			$meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); | |
| 489 | +			$meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); | |
| 490 | 490 | meta_refresh(3, $meta_info); | 
| 491 | 491 |  			$message	= ($need_approval) ? $this->language->lang('DIR_'.strtoupper($mode).'_SITE_ACTIVE') : $this->language->lang('DIR_'.strtoupper($mode).'_SITE_OK'); | 
| 492 | -			$message	= $message . '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_DIR', '<a href="' . $this->helper->route('ernadoo_phpbbdirectory_base_controller') . '">', '</a>') . '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="' . $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id) . '">', '</a>'); | |
| 492 | +			$message	= $message.'<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_DIR', '<a href="'.$this->helper->route('ernadoo_phpbbdirectory_base_controller').'">', '</a>').'<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="'.$this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id).'">', '</a>'); | |
| 493 | 493 | return $this->helper->message($message); | 
| 494 | 494 | } | 
| 495 | 495 | else | 
| @@ -518,10 +518,10 @@ discard block | ||
| 518 | 518 |  	{ | 
| 519 | 519 |  		if (!function_exists('file_gc')) | 
| 520 | 520 |  		{ | 
| 521 | - include($this->root_path . 'includes/functions_download.' . $this->php_ext); | |
| 521 | + include($this->root_path.'includes/functions_download.'.$this->php_ext); | |
| 522 | 522 | } | 
| 523 | 523 | |
| 524 | - $file_path = $this->root_path . $this->get_banner_path($banner_img); | |
| 524 | + $file_path = $this->root_path.$this->get_banner_path($banner_img); | |
| 525 | 525 | |
| 526 | 526 | if ((@file_exists($file_path) && @is_readable($file_path))) | 
| 527 | 527 |  		{ | 
| @@ -573,7 +573,7 @@ discard block | ||
| 573 | 573 | |
| 574 | 574 |  		if (!function_exists('display_custom_bbcodes')) | 
| 575 | 575 |  		{ | 
| 576 | - include($this->root_path . 'includes/functions_display.' . $this->php_ext); | |
| 576 | + include($this->root_path.'includes/functions_display.'.$this->php_ext); | |
| 577 | 577 | } | 
| 578 | 578 | display_custom_bbcodes(); | 
| 579 | 579 |  		add_form_key('dir_form'); | 
| @@ -582,17 +582,17 @@ discard block | ||
| 582 | 582 | $flag_path = $ext_path.'images/flags/'; | 
| 583 | 583 | |
| 584 | 584 | $s_guest = (!$this->user->data['is_registered'] || !empty($this->guest_email)); | 
| 585 | - $s_rss = $this->config['dir_activ_rss']; | |
| 586 | - $s_banner = $this->config['dir_activ_banner']; | |
| 585 | + $s_rss = $this->config['dir_activ_rss']; | |
| 586 | + $s_banner = $this->config['dir_activ_banner']; | |
| 587 | 587 | $s_back = $this->categorie->data['cat_link_back']; | 
| 588 | 588 | $s_flag = $this->config['dir_activ_flag']; | 
| 589 | 589 | |
| 590 | 590 | $this->template->assign_vars(array( | 
| 591 | -			'BBCODE_STATUS'			=> ($this->config['allow_bbcode']) 	? $this->language->lang('BBCODE_IS_ON', '<a href="' . append_sid($this->root_path."faq.$this->php_ext", 'mode=bbcode') . '">', '</a>') : $this->language->lang('BBCODE_IS_OFF', '<a href="' . append_sid($this->root_path."faq.$this->php_ext", 'mode=bbcode') . '">', '</a>'), | |
| 592 | -			'IMG_STATUS'			=> ($this->config['allow_bbcode'])	? $this->language->lang('IMAGES_ARE_ON') : $this->language->lang('IMAGES_ARE_OFF'), | |
| 591 | +			'BBCODE_STATUS'			=> ($this->config['allow_bbcode']) ? $this->language->lang('BBCODE_IS_ON', '<a href="'.append_sid($this->root_path."faq.$this->php_ext", 'mode=bbcode').'">', '</a>') : $this->language->lang('BBCODE_IS_OFF', '<a href="'.append_sid($this->root_path."faq.$this->php_ext", 'mode=bbcode').'">', '</a>'), | |
| 592 | +			'IMG_STATUS'			=> ($this->config['allow_bbcode']) ? $this->language->lang('IMAGES_ARE_ON') : $this->language->lang('IMAGES_ARE_OFF'), | |
| 593 | 593 |  			'SMILIES_STATUS'		=> ($this->config['allow_smilies']) ? $this->language->lang('SMILIES_ARE_ON') : $this->language->lang('SMILIES_ARE_OFF'), | 
| 594 | 594 |  			'URL_STATUS'			=> ($this->config['allow_post_links']) ? $this->language->lang('URL_IS_ON') : $this->language->lang('URL_IS_OFF'), | 
| 595 | -			'FLASH_STATUS'			=> ($this->config['allow_bbcode'] && $this->config['allow_post_flash'])	? $this->language->lang('FLASH_IS_ON') : $this->language->lang('FLASH_IS_OFF'), | |
| 595 | +			'FLASH_STATUS'			=> ($this->config['allow_bbcode'] && $this->config['allow_post_flash']) ? $this->language->lang('FLASH_IS_ON') : $this->language->lang('FLASH_IS_OFF'), | |
| 596 | 596 | |
| 597 | 597 | 'L_TITLE' => $title, | 
| 598 | 598 |  			'L_DIR_DESCRIPTION_EXP'	=> $this->language->lang('DIR_DESCRIPTION_EXP', $this->config['dir_length_describe']), | 
| @@ -60,13 +60,13 @@ discard block | ||
| 60 | 60 | */ | 
| 61 | 61 | 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\cron\manager $cron) | 
| 62 | 62 |  	{ | 
| 63 | - $this->db = $db; | |
| 64 | - $this->config = $config; | |
| 63 | + $this->db = $db; | |
| 64 | + $this->config = $config; | |
| 65 | 65 | $this->language = $language; | 
| 66 | 66 | $this->template = $template; | 
| 67 | 67 | $this->user = $user; | 
| 68 | - $this->helper = $helper; | |
| 69 | - $this->request = $request; | |
| 68 | + $this->helper = $helper; | |
| 69 | + $this->request = $request; | |
| 70 | 70 | $this->auth = $auth; | 
| 71 | 71 | $this->cron = $cron; | 
| 72 | 72 | } | 
| @@ -90,7 +90,7 @@ discard block | ||
| 90 | 90 | public function make_cat_jumpbox() | 
| 91 | 91 |  	{ | 
| 92 | 92 | $sql = 'SELECT cat_id, cat_name, parent_id, left_id, right_id | 
| 93 | - FROM ' . $this->categories_table . ' | |
| 93 | + FROM ' . $this->categories_table.' | |
| 94 | 94 | ORDER BY left_id ASC'; | 
| 95 | 95 | $result = $this->db->sql_query($sql); | 
| 96 | 96 | |
| @@ -119,7 +119,7 @@ discard block | ||
| 119 | 119 | 'FORUM_ID' => $row['cat_id'], | 
| 120 | 120 | 'FORUM_NAME' => $row['cat_name'], | 
| 121 | 121 | 'S_FORUM_COUNT' => $iteration, | 
| 122 | -				'LINK'			=> $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $row['cat_id']), | |
| 122 | +				'LINK'			=> $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$row['cat_id']), | |
| 123 | 123 | )); | 
| 124 | 124 | |
| 125 | 125 | for ($i = 0; $i < $padding; $i++) | 
| @@ -151,7 +151,7 @@ discard block | ||
| 151 | 151 | |
| 152 | 152 | // This query is identical to the jumpbox one | 
| 153 | 153 | $sql = 'SELECT cat_id, cat_name, parent_id, left_id, right_id | 
| 154 | - FROM ' . $this->categories_table . ' | |
| 154 | + FROM ' . $this->categories_table.' | |
| 155 | 155 | ORDER BY left_id ASC'; | 
| 156 | 156 | $result = $this->db->sql_query($sql); | 
| 157 | 157 | |
| @@ -181,7 +181,7 @@ discard block | ||
| 181 | 181 | } | 
| 182 | 182 | |
| 183 | 183 | $selected = (($row['cat_id'] == $select_id) ? ' selected="selected"' : ''); | 
| 184 | - $cat_list .= '<option value="' . $row['cat_id'] . '"' . (($disabled) ? ' disabled="disabled" class="disabled-option"' : $selected) . '>' . $padding . $row['cat_name'] . '</option>'; | |
| 184 | + $cat_list .= '<option value="'.$row['cat_id'].'"'.(($disabled) ? ' disabled="disabled" class="disabled-option"' : $selected).'>'.$padding.$row['cat_name'].'</option>'; | |
| 185 | 185 | } | 
| 186 | 186 | $this->db->sql_freeresult($result); | 
| 187 | 187 | unset($padding_store); | 
| @@ -196,7 +196,7 @@ discard block | ||
| 196 | 196 | */ | 
| 197 | 197 | public function display() | 
| 198 | 198 |  	{ | 
| 199 | - $cat_rows = $subcats = array(); | |
| 199 | + $cat_rows = $subcats = array(); | |
| 200 | 200 | $parent_id = $visible_cats = 0; | 
| 201 | 201 | |
| 202 | 202 | $sql_array = array( | 
| @@ -214,7 +214,7 @@ discard block | ||
| 214 | 214 | else | 
| 215 | 215 |  		{ | 
| 216 | 216 | $root_data = $this->data; | 
| 217 | - $sql_where = 'left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id']; | |
| 217 | + $sql_where = 'left_id > '.$root_data['left_id'].' AND left_id < '.$root_data['right_id']; | |
| 218 | 218 | } | 
| 219 | 219 | |
| 220 | 220 |  		$sql = $this->db->sql_build_query('SELECT', array( | 
| @@ -261,12 +261,12 @@ discard block | ||
| 261 | 261 |  			{ | 
| 262 | 262 | foreach ($subcats[$dir_cat_id] as $subcat_id => $subcat_row) | 
| 263 | 263 |  				{ | 
| 264 | - $row['cat_links'] = ($row['cat_count_all']) ? ($row['cat_links']+$subcat_row['links']) : $row['cat_links']; | |
| 264 | + $row['cat_links'] = ($row['cat_count_all']) ? ($row['cat_links'] + $subcat_row['links']) : $row['cat_links']; | |
| 265 | 265 | |
| 266 | 266 | if ($subcat_row['display'] && $subcat_row['parent_id'] == $dir_cat_id) | 
| 267 | 267 |  					{ | 
| 268 | 268 | $subcats_list[] = array( | 
| 269 | -							'link'		=> $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $subcat_id), | |
| 269 | +							'link'		=> $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$subcat_id), | |
| 270 | 270 | 'name' => $subcat_row['name'], | 
| 271 | 271 | 'links' => $subcat_row['links'] | 
| 272 | 272 | ); | 
| @@ -284,7 +284,7 @@ discard block | ||
| 284 | 284 | 'CAT_LINKS' => $row['cat_links'], | 
| 285 | 285 |  				'CAT_IMG'				=> $this->get_img_path('icons', $row['cat_icon']), | 
| 286 | 286 | |
| 287 | -				'U_CAT'					=> $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $row['cat_id']), | |
| 287 | +				'U_CAT'					=> $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$row['cat_id']), | |
| 288 | 288 | )); | 
| 289 | 289 | |
| 290 | 290 | // Assign subcats loop for style authors | 
| @@ -316,7 +316,7 @@ discard block | ||
| 316 | 316 | if ($task->is_ready()) | 
| 317 | 317 |  			{ | 
| 318 | 318 | $url = $task->get_url(); | 
| 319 | -				$this->template->assign_var('RUN_CRON_TASK', '<img src="' . $url . '" width="1" height="1" alt="" />'); | |
| 319 | +				$this->template->assign_var('RUN_CRON_TASK', '<img src="'.$url.'" width="1" height="1" alt="" />'); | |
| 320 | 320 | } | 
| 321 | 321 | } | 
| 322 | 322 | } | 
| @@ -338,10 +338,10 @@ discard block | ||
| 338 | 338 | 'LEFT_JOIN' => array( | 
| 339 | 339 | array( | 
| 340 | 340 | 'FROM' => array($this->watch_table => 'w'), | 
| 341 | - 'ON' => 'c.cat_id = w.cat_id AND w.user_id = ' . (int) $this->user->data['user_id'] | |
| 341 | + 'ON' => 'c.cat_id = w.cat_id AND w.user_id = '.(int) $this->user->data['user_id'] | |
| 342 | 342 | ), | 
| 343 | 343 | ), | 
| 344 | - 'WHERE' => 'c.cat_id = ' . (int) $cat_id | |
| 344 | + 'WHERE' => 'c.cat_id = '.(int) $cat_id | |
| 345 | 345 | ); | 
| 346 | 346 |  			$sql = $this->db->sql_build_query('SELECT', $sql_array); | 
| 347 | 347 | $result = $this->db->sql_query($sql); | 
| @@ -378,8 +378,8 @@ discard block | ||
| 378 | 378 |  				$this->template->assign_block_vars('dir_navlinks', array( | 
| 379 | 379 | 'FORUM_NAME' => $parent_data['cat_name'], | 
| 380 | 380 | 'FORUM_ID' => $parent_cat_id, | 
| 381 | - 'MICRODATA' => $microdata_attr . '="' . $parent_cat_id . '"', | |
| 382 | -					'U_VIEW_FORUM'	=> $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $parent_cat_id), | |
| 381 | + 'MICRODATA' => $microdata_attr.'="'.$parent_cat_id.'"', | |
| 382 | +					'U_VIEW_FORUM'	=> $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$parent_cat_id), | |
| 383 | 383 | )); | 
| 384 | 384 | } | 
| 385 | 385 | } | 
| @@ -387,8 +387,8 @@ discard block | ||
| 387 | 387 |  		$this->template->assign_block_vars('dir_navlinks', array( | 
| 388 | 388 | 'FORUM_NAME' => $dir_cat_data['cat_name'], | 
| 389 | 389 | 'FORUM_ID' => $dir_cat_data['cat_id'], | 
| 390 | - 'MICRODATA' => $microdata_attr . '="' . $dir_cat_data['cat_id'] . '"', | |
| 391 | -			'U_VIEW_FORUM'	=> $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $dir_cat_data['cat_id']), | |
| 390 | + 'MICRODATA' => $microdata_attr.'="'.$dir_cat_data['cat_id'].'"', | |
| 391 | +			'U_VIEW_FORUM'	=> $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$dir_cat_data['cat_id']), | |
| 392 | 392 | )); | 
| 393 | 393 | |
| 394 | 394 | return; | 
| @@ -444,17 +444,17 @@ discard block | ||
| 444 | 444 |  			{ | 
| 445 | 445 | if ($mode == 'unwatch') | 
| 446 | 446 |  				{ | 
| 447 | - $sql = 'DELETE FROM ' . $this->watch_table . " | |
| 447 | + $sql = 'DELETE FROM '.$this->watch_table." | |
| 448 | 448 | WHERE cat_id = $cat_id | 
| 449 | 449 | AND user_id = $user_id"; | 
| 450 | 450 | $this->db->sql_query($sql); | 
| 451 | 451 | |
| 452 | -					$redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); | |
| 452 | +					$redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); | |
| 453 | 453 |  					$message = $this->language->lang('DIR_NOT_WATCHING_CAT'); | 
| 454 | 454 | |
| 455 | 455 | if (!$this->request->is_ajax()) | 
| 456 | 456 |  					{ | 
| 457 | -						$message .= '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="' . $redirect_url . '">', '</a>'); | |
| 457 | +						$message .= '<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="'.$redirect_url.'">', '</a>'); | |
| 458 | 458 | } | 
| 459 | 459 | |
| 460 | 460 | meta_refresh(3, $redirect_url); | 
| @@ -466,8 +466,8 @@ discard block | ||
| 466 | 466 | |
| 467 | 467 | if ($notify_status != NOTIFY_YES) | 
| 468 | 468 |  					{ | 
| 469 | - $sql = 'UPDATE ' . $this->watch_table . ' | |
| 470 | - SET notify_status = ' . NOTIFY_YES . " | |
| 469 | + $sql = 'UPDATE '.$this->watch_table.' | |
| 470 | + SET notify_status = ' . NOTIFY_YES." | |
| 471 | 471 | WHERE cat_id = $cat_id | 
| 472 | 472 | AND user_id = $user_id"; | 
| 473 | 473 | $this->db->sql_query($sql); | 
| @@ -478,16 +478,16 @@ discard block | ||
| 478 | 478 |  			{ | 
| 479 | 479 | if ($mode == 'watch') | 
| 480 | 480 |  				{ | 
| 481 | - $sql = 'INSERT INTO ' . $this->watch_table . " (user_id, cat_id, notify_status) | |
| 482 | - VALUES ($user_id, $cat_id, " . NOTIFY_YES . ')'; | |
| 481 | + $sql = 'INSERT INTO '.$this->watch_table." (user_id, cat_id, notify_status) | |
| 482 | + VALUES ($user_id, $cat_id, ".NOTIFY_YES.')'; | |
| 483 | 483 | $this->db->sql_query($sql); | 
| 484 | 484 | |
| 485 | -					$redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); | |
| 485 | +					$redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); | |
| 486 | 486 |  					$message = $this->language->lang('DIR_ARE_WATCHING_CAT'); | 
| 487 | 487 | |
| 488 | 488 | if (!$this->request->is_ajax()) | 
| 489 | 489 |  					{ | 
| 490 | -						$message .= '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="' . $redirect_url . '">', '</a>'); | |
| 490 | +						$message .= '<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="'.$redirect_url.'">', '</a>'); | |
| 491 | 491 | } | 
| 492 | 492 | |
| 493 | 493 | meta_refresh(3, $redirect_url); | 
| @@ -507,10 +507,10 @@ discard block | ||
| 507 | 507 | |
| 508 | 508 | if ($can_watch) | 
| 509 | 509 |  		{ | 
| 510 | -			$s_watching['link'] 		= $this->helper->route('ernadoo_phpbbdirectory_suscribe_controller', array('cat_id' => $cat_id, 'mode' => (($is_watching) ? 'unwatch' : 'watch'))); | |
| 510 | +			$s_watching['link'] = $this->helper->route('ernadoo_phpbbdirectory_suscribe_controller', array('cat_id' => $cat_id, 'mode' => (($is_watching) ? 'unwatch' : 'watch'))); | |
| 511 | 511 |  			$s_watching['link_toggle'] 	= $this->helper->route('ernadoo_phpbbdirectory_suscribe_controller', array('cat_id' => $cat_id, 'mode' => ((!$is_watching) ? 'unwatch' : 'watch'))); | 
| 512 | - $s_watching['title'] = $this->language->lang((($is_watching) ? 'DIR_STOP' : 'DIR_START') . '_WATCHING_CAT'); | |
| 513 | - $s_watching['title_toggle'] = $this->language->lang(((!$is_watching) ? 'DIR_STOP' : 'DIR_START') . '_WATCHING_CAT'); | |
| 512 | + $s_watching['title'] = $this->language->lang((($is_watching) ? 'DIR_STOP' : 'DIR_START').'_WATCHING_CAT'); | |
| 513 | + $s_watching['title_toggle'] = $this->language->lang(((!$is_watching) ? 'DIR_STOP' : 'DIR_START').'_WATCHING_CAT'); | |
| 514 | 514 | $s_watching['is_watching'] = $is_watching; | 
| 515 | 515 | } | 
| 516 | 516 | |
| @@ -530,7 +530,7 @@ discard block | ||
| 530 | 530 |  		$categories_table = $phpbb_container->getParameter('tables.dir.categories'); | 
| 531 | 531 | |
| 532 | 532 | $sql = 'SELECT cat_name | 
| 533 | - FROM ' . $categories_table . ' | |
| 533 | + FROM ' . $categories_table.' | |
| 534 | 534 | WHERE cat_id = ' . (int) $cat_id; | 
| 535 | 535 | $result = $db->sql_query($sql); | 
| 536 | 536 | $row = $db->sql_fetchrow($result); | 
| @@ -46,18 +46,18 @@ discard block | ||
| 46 | 46 | public $data = array(); | 
| 47 | 47 | |
| 48 | 48 | /** | 
| 49 | - * Constructor | |
| 50 | - * | |
| 51 | - * @param \phpbb\db\driver\driver_interface $db Database object | |
| 52 | - * @param \phpbb\config\config $config Config object | |
| 53 | - * @param \phpbb\language\language $language Language object | |
| 54 | - * @param \phpbb\template\template $template Template object | |
| 55 | - * @param \phpbb\user $user User object | |
| 56 | - * @param \phpbb\controller\helper $helper Controller helper object | |
| 57 | - * @param \phpbb\request\request $request Request object | |
| 58 | - * @param \phpbb\auth\auth $auth Auth object | |
| 59 | - * @param \phpbb\cron\manager $cron Cron object | |
| 60 | - */ | |
| 49 | + * Constructor | |
| 50 | + * | |
| 51 | + * @param \phpbb\db\driver\driver_interface $db Database object | |
| 52 | + * @param \phpbb\config\config $config Config object | |
| 53 | + * @param \phpbb\language\language $language Language object | |
| 54 | + * @param \phpbb\template\template $template Template object | |
| 55 | + * @param \phpbb\user $user User object | |
| 56 | + * @param \phpbb\controller\helper $helper Controller helper object | |
| 57 | + * @param \phpbb\request\request $request Request object | |
| 58 | + * @param \phpbb\auth\auth $auth Auth object | |
| 59 | + * @param \phpbb\cron\manager $cron Cron object | |
| 60 | + */ | |
| 61 | 61 | 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\cron\manager $cron) | 
| 62 | 62 |  	{ | 
| 63 | 63 | $this->db = $db; | 
| @@ -72,21 +72,21 @@ discard block | ||
| 72 | 72 | } | 
| 73 | 73 | |
| 74 | 74 | /** | 
| 75 | - * Function for get approval setting | |
| 76 | - * used in edit mode for test the setting of new category's link | |
| 77 | - * | |
| 78 | - * @return bool | |
| 79 | - */ | |
| 75 | + * Function for get approval setting | |
| 76 | + * used in edit mode for test the setting of new category's link | |
| 77 | + * | |
| 78 | + * @return bool | |
| 79 | + */ | |
| 80 | 80 | public function need_approval() | 
| 81 | 81 |  	{ | 
| 82 | 82 | return (bool) $this->data['cat_validate']; | 
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | 85 | /** | 
| 86 | - * Generate Jumpbox | |
| 87 | - * | |
| 88 | - * @return null | |
| 89 | - */ | |
| 86 | + * Generate Jumpbox | |
| 87 | + * | |
| 88 | + * @return null | |
| 89 | + */ | |
| 90 | 90 | public function make_cat_jumpbox() | 
| 91 | 91 |  	{ | 
| 92 | 92 | $sql = 'SELECT cat_id, cat_name, parent_id, left_id, right_id | 
| @@ -139,12 +139,12 @@ discard block | ||
| 139 | 139 | } | 
| 140 | 140 | |
| 141 | 141 | /** | 
| 142 | - * Generate a list of directory's categories | |
| 143 | - * | |
| 144 | - * @param int $select_id Selected category | |
| 145 | - * @param array $ignore_id Array of ignored categories | |
| 146 | - * @return string $cat_list html code | |
| 147 | - */ | |
| 142 | + * Generate a list of directory's categories | |
| 143 | + * | |
| 144 | + * @param int $select_id Selected category | |
| 145 | + * @param array $ignore_id Array of ignored categories | |
| 146 | + * @return string $cat_list html code | |
| 147 | + */ | |
| 148 | 148 | public function make_cat_select($select_id = 0, $ignore_id = array()) | 
| 149 | 149 |  	{ | 
| 150 | 150 | $ignore_id = is_array($ignore_id) ? $ignore_id : array($ignore_id); | 
| @@ -190,10 +190,10 @@ discard block | ||
| 190 | 190 | } | 
| 191 | 191 | |
| 192 | 192 | /** | 
| 193 | - * Display cat or subcat | |
| 194 | - * | |
| 195 | - * @return null | |
| 196 | - */ | |
| 193 | + * Display cat or subcat | |
| 194 | + * | |
| 195 | + * @return null | |
| 196 | + */ | |
| 197 | 197 | public function display() | 
| 198 | 198 |  	{ | 
| 199 | 199 | $cat_rows = $subcats = array(); | 
| @@ -322,11 +322,11 @@ discard block | ||
| 322 | 322 | } | 
| 323 | 323 | |
| 324 | 324 | /** | 
| 325 | - * Get informations about a cat or subcat | |
| 326 | - * | |
| 327 | - * @param int $cat_id The category ID | |
| 328 | - * @return null|false | |
| 329 | - */ | |
| 325 | + * Get informations about a cat or subcat | |
| 326 | + * | |
| 327 | + * @param int $cat_id The category ID | |
| 328 | + * @return null|false | |
| 329 | + */ | |
| 330 | 330 | public function get($cat_id = 0) | 
| 331 | 331 |  	{ | 
| 332 | 332 | if ($cat_id) | 
| @@ -354,11 +354,11 @@ discard block | ||
| 354 | 354 | } | 
| 355 | 355 | |
| 356 | 356 | /** | 
| 357 | - * Create category navigation links for given category, create parent | |
| 358 | - * list if currently null, assign basic category info to template | |
| 359 | - * | |
| 360 | - * @param array $dir_cat_data | |
| 361 | - */ | |
| 357 | + * Create category navigation links for given category, create parent | |
| 358 | + * list if currently null, assign basic category info to template | |
| 359 | + * | |
| 360 | + * @param array $dir_cat_data | |
| 361 | + */ | |
| 362 | 362 | public function generate_dir_nav(&$dir_cat_data) | 
| 363 | 363 |  	{ | 
| 364 | 364 | global $phpbb_container; | 
| @@ -395,12 +395,12 @@ discard block | ||
| 395 | 395 | } | 
| 396 | 396 | |
| 397 | 397 | /** | 
| 398 | - * Return good key language | |
| 399 | - * | |
| 400 | - * @param bool $validate True if approbation needed before publication | |
| 401 | - * @return string Information about approval, depends on user auth level | |
| 402 | - * @throws \phpbb\exception\runtime_exception | |
| 403 | - */ | |
| 398 | + * Return good key language | |
| 399 | + * | |
| 400 | + * @param bool $validate True if approbation needed before publication | |
| 401 | + * @return string Information about approval, depends on user auth level | |
| 402 | + * @throws \phpbb\exception\runtime_exception | |
| 403 | + */ | |
| 404 | 404 | public function dir_submit_type($validate) | 
| 405 | 405 |  	{ | 
| 406 | 406 | if ($validate) | 
| @@ -421,15 +421,15 @@ discard block | ||
| 421 | 421 | } | 
| 422 | 422 | |
| 423 | 423 | /** | 
| 424 | - * Category watching common code | |
| 425 | - * | |
| 426 | - * @param string $mode Watch or unwatch a category | |
| 427 | - * @param array $s_watching An empty array, passed by reference | |
| 428 | - * @param int $user_id The user ID | |
| 429 | - * @param int $cat_id The category ID | |
| 430 | - * @param string $notify_status User is watching the category? | |
| 431 | - * @return null|string | |
| 432 | - */ | |
| 424 | + * Category watching common code | |
| 425 | + * | |
| 426 | + * @param string $mode Watch or unwatch a category | |
| 427 | + * @param array $s_watching An empty array, passed by reference | |
| 428 | + * @param int $user_id The user ID | |
| 429 | + * @param int $cat_id The category ID | |
| 430 | + * @param string $notify_status User is watching the category? | |
| 431 | + * @return null|string | |
| 432 | + */ | |
| 433 | 433 | public function watch_categorie($mode, &$s_watching, $user_id, $cat_id, $notify_status) | 
| 434 | 434 |  	{ | 
| 435 | 435 | // Is user watching this thread? | 
| @@ -515,11 +515,11 @@ discard block | ||
| 515 | 515 | } | 
| 516 | 516 | |
| 517 | 517 | /** | 
| 518 | - * Return Category name | |
| 519 | - * | |
| 520 | - * @param int $cat_id The category ID | |
| 521 | - * @return string The category name | |
| 522 | - */ | |
| 518 | + * Return Category name | |
| 519 | + * | |
| 520 | + * @param int $cat_id The category ID | |
| 521 | + * @return string The category name | |
| 522 | + */ | |
| 523 | 523 | static public function getname($cat_id) | 
| 524 | 524 |  	{ | 
| 525 | 525 | global $db, $phpbb_container; | 
| @@ -57,23 +57,23 @@ discard block | ||
| 57 | 57 | protected $php_ext; | 
| 58 | 58 | |
| 59 | 59 | /** | 
| 60 | - * Constructor | |
| 61 | - * | |
| 62 | - * @param \phpbb\db\driver\driver_interface $db Database object | |
| 63 | - * @param \phpbb\config\config $config Config object | |
| 64 | - * @param \phpbb\language\language $language Language object | |
| 65 | - * @param \phpbb\template\template $template Template object | |
| 66 | - * @param \phpbb\user $user User object | |
| 67 | - * @param \phpbb\controller\helper $helper Controller helper object | |
| 68 | - * @param \phpbb\request\request $request Request object | |
| 69 | - * @param \phpbb\auth\auth $auth Auth object | |
| 70 | - * @param \phpbb\notification\manager $notification Notification object | |
| 71 | - * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB filesystem helper | |
| 72 | - * @param \FastImageSize\FastImageSize $imagesize FastImageSize class | |
| 73 | - * @param \phpbb\files\upload $files_upload Upload object | |
| 74 | - * @param string $root_path phpBB root path | |
| 75 | - * @param string $php_ext phpEx | |
| 76 | - */ | |
| 60 | + * Constructor | |
| 61 | + * | |
| 62 | + * @param \phpbb\db\driver\driver_interface $db Database object | |
| 63 | + * @param \phpbb\config\config $config Config object | |
| 64 | + * @param \phpbb\language\language $language Language object | |
| 65 | + * @param \phpbb\template\template $template Template object | |
| 66 | + * @param \phpbb\user $user User object | |
| 67 | + * @param \phpbb\controller\helper $helper Controller helper object | |
| 68 | + * @param \phpbb\request\request $request Request object | |
| 69 | + * @param \phpbb\auth\auth $auth Auth object | |
| 70 | + * @param \phpbb\notification\manager $notification Notification object | |
| 71 | + * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB filesystem helper | |
| 72 | + * @param \FastImageSize\FastImageSize $imagesize FastImageSize class | |
| 73 | + * @param \phpbb\files\upload $files_upload Upload object | |
| 74 | + * @param string $root_path phpBB root path | |
| 75 | + * @param string $php_ext phpEx | |
| 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\upload $files_upload, $root_path, $php_ext) | 
| 78 | 78 |  	{ | 
| 79 | 79 | $this->db = $db; | 
| @@ -93,12 +93,12 @@ discard block | ||
| 93 | 93 | } | 
| 94 | 94 | |
| 95 | 95 | /** | 
| 96 | - * Add a link into db | |
| 97 | - * | |
| 98 | - * @param array $data Contains all data to insert in db | |
| 99 | - * @param bool $need_approval Links needs to be approved? | |
| 100 | - * @return null | |
| 101 | - */ | |
| 96 | + * Add a link into db | |
| 97 | + * | |
| 98 | + * @param array $data Contains all data to insert in db | |
| 99 | + * @param bool $need_approval Links needs to be approved? | |
| 100 | + * @return null | |
| 101 | + */ | |
| 102 | 102 | public function add($data, $need_approval) | 
| 103 | 103 |  	{ | 
| 104 | 104 | $notification_data = array(); | 
| @@ -143,13 +143,13 @@ discard block | ||
| 143 | 143 | } | 
| 144 | 144 | |
| 145 | 145 | /** | 
| 146 | - * Edit a link of the db | |
| 147 | - * | |
| 148 | - * @param array $data Contains all data to edit in db | |
| 149 | - * @param int $link_id is link's id, for WHERE clause | |
| 150 | - * @param bool $need_approval Links needs to be approved? | |
| 151 | - * @return null | |
| 152 | - */ | |
| 146 | + * Edit a link of the db | |
| 147 | + * | |
| 148 | + * @param array $data Contains all data to edit in db | |
| 149 | + * @param int $link_id is link's id, for WHERE clause | |
| 150 | + * @param bool $need_approval Links needs to be approved? | |
| 151 | + * @return null | |
| 152 | + */ | |
| 153 | 153 | public function edit($data, $link_id, $need_approval) | 
| 154 | 154 |  	{ | 
| 155 | 155 | $notification_data = array( | 
| @@ -201,12 +201,12 @@ discard block | ||
| 201 | 201 | } | 
| 202 | 202 | |
| 203 | 203 | /** | 
| 204 | - * Delete a link of the db | |
| 205 | - * | |
| 206 | - * @param int $cat_id The category ID | |
| 207 | - * @param mixed $link_id Link's id, for WHERE clause | |
| 208 | - * @return null | |
| 209 | - */ | |
| 204 | + * Delete a link of the db | |
| 205 | + * | |
| 206 | + * @param int $cat_id The category ID | |
| 207 | + * @param mixed $link_id Link's id, for WHERE clause | |
| 208 | + * @return null | |
| 209 | + */ | |
| 210 | 210 | public function del($cat_id, $link_id) | 
| 211 | 211 |  	{ | 
| 212 | 212 |  		$this->db->sql_transaction('begin'); | 
| @@ -279,12 +279,12 @@ discard block | ||
| 279 | 279 | } | 
| 280 | 280 | |
| 281 | 281 | /** | 
| 282 | - * Increments link view counter | |
| 283 | - * | |
| 284 | - * @param int $link_id Link's id, for WHERE clause | |
| 285 | - * @return null | |
| 286 | - * @throws \phpbb\exception\http_exception | |
| 287 | - */ | |
| 282 | + * Increments link view counter | |
| 283 | + * | |
| 284 | + * @param int $link_id Link's id, for WHERE clause | |
| 285 | + * @return null | |
| 286 | + * @throws \phpbb\exception\http_exception | |
| 287 | + */ | |
| 288 | 288 | public function view($link_id) | 
| 289 | 289 |  	{ | 
| 290 | 290 | $sql = 'SELECT link_id, link_url | 
| @@ -308,11 +308,11 @@ discard block | ||
| 308 | 308 | } | 
| 309 | 309 | |
| 310 | 310 | /** | 
| 311 | - * Verify that an URL exist before add into db | |
| 312 | - * | |
| 313 | - * @param string $url The URL to check | |
| 314 | - * @return bool True if url is reachable, else false. | |
| 315 | - */ | |
| 311 | + * Verify that an URL exist before add into db | |
| 312 | + * | |
| 313 | + * @param string $url The URL to check | |
| 314 | + * @return bool True if url is reachable, else false. | |
| 315 | + */ | |
| 316 | 316 | public function checkurl($url) | 
| 317 | 317 |  	{ | 
| 318 | 318 | $details = parse_url($url); | 
| @@ -351,11 +351,11 @@ discard block | ||
| 351 | 351 | } | 
| 352 | 352 | |
| 353 | 353 | /** | 
| 354 | - * Delete the final '/', if no path | |
| 355 | - * | |
| 356 | - * @param string $url URL to clean | |
| 357 | - * @return string $url The correct string. | |
| 358 | - */ | |
| 354 | + * Delete the final '/', if no path | |
| 355 | + * | |
| 356 | + * @param string $url URL to clean | |
| 357 | + * @return string $url The correct string. | |
| 358 | + */ | |
| 359 | 359 | public function clean_url($url) | 
| 360 | 360 |  	{ | 
| 361 | 361 | $details = parse_url($url); | 
| @@ -368,11 +368,11 @@ discard block | ||
| 368 | 368 | } | 
| 369 | 369 | |
| 370 | 370 | /** | 
| 371 | - * Display a flag | |
| 372 | - * | |
| 373 | - * @param array $data Link's data from db | |
| 374 | - * @return string Flag path. | |
| 375 | - */ | |
| 371 | + * Display a flag | |
| 372 | + * | |
| 373 | + * @param array $data Link's data from db | |
| 374 | + * @return string Flag path. | |
| 375 | + */ | |
| 376 | 376 | public function display_flag($data) | 
| 377 | 377 |  	{ | 
| 378 | 378 | global $phpbb_extension_manager; | 
| @@ -390,13 +390,13 @@ discard block | ||
| 390 | 390 | } | 
| 391 | 391 | |
| 392 | 392 | /** | 
| 393 | - * Calculate the link's note | |
| 394 | - * | |
| 395 | - * @param int $total_note Sum of all link's notes | |
| 396 | - * @param int $nb_vote Number of votes | |
| 397 | - * @param bool $votes_status Votes are enable in this category? | |
| 398 | - * @return string $note The calculated note. | |
| 399 | - */ | |
| 393 | + * Calculate the link's note | |
| 394 | + * | |
| 395 | + * @param int $total_note Sum of all link's notes | |
| 396 | + * @param int $nb_vote Number of votes | |
| 397 | + * @param bool $votes_status Votes are enable in this category? | |
| 398 | + * @return string $note The calculated note. | |
| 399 | + */ | |
| 400 | 400 | public function display_note($total_note, $nb_vote, $votes_status) | 
| 401 | 401 |  	{ | 
| 402 | 402 | if (!$votes_status) | 
| @@ -411,11 +411,11 @@ discard block | ||
| 411 | 411 | } | 
| 412 | 412 | |
| 413 | 413 | /** | 
| 414 | - * Display the vote form for auth users | |
| 415 | - * | |
| 416 | - * @param array $data Link's data from db | |
| 417 | - * @return null|string Html combo list or nothing if votes are not available. | |
| 418 | - */ | |
| 414 | + * Display the vote form for auth users | |
| 415 | + * | |
| 416 | + * @param array $data Link's data from db | |
| 417 | + * @return null|string Html combo list or nothing if votes are not available. | |
| 418 | + */ | |
| 419 | 419 | public function display_vote($data) | 
| 420 | 420 |  	{ | 
| 421 | 421 |  		if ($this->user->data['is_registered'] && $this->auth->acl_get('u_vote_dir') && empty($data['vote_user_id'])) | 
| @@ -432,11 +432,11 @@ discard block | ||
| 432 | 432 | } | 
| 433 | 433 | |
| 434 | 434 | /** | 
| 435 | - * Display the RSS icon | |
| 436 | - * | |
| 437 | - * @param array $data Link's data from db | |
| 438 | - * @return null|string RSS feed URL or nothing. | |
| 439 | - */ | |
| 435 | + * Display the RSS icon | |
| 436 | + * | |
| 437 | + * @param array $data Link's data from db | |
| 438 | + * @return null|string RSS feed URL or nothing. | |
| 439 | + */ | |
| 440 | 440 | public function display_rss($data) | 
| 441 | 441 |  	{ | 
| 442 | 442 | if ($this->config['dir_activ_rss'] && !empty($data['link_rss'])) | 
| @@ -446,13 +446,13 @@ discard block | ||
| 446 | 446 | } | 
| 447 | 447 | |
| 448 | 448 | /** | 
| 449 | - * Display link's thumb if thumb service enabled. | |
| 450 | - * if thumb don't exists in db or if a new service was choosen in acp | |
| 451 | - * thumb is research | |
| 452 | - * | |
| 453 | - * @param array $data Link's data from db | |
| 454 | - * @return string|null Thumb or null. | |
| 455 | - */ | |
| 449 | + * Display link's thumb if thumb service enabled. | |
| 450 | + * if thumb don't exists in db or if a new service was choosen in acp | |
| 451 | + * thumb is research | |
| 452 | + * | |
| 453 | + * @param array $data Link's data from db | |
| 454 | + * @return string|null Thumb or null. | |
| 455 | + */ | |
| 456 | 456 | public function display_thumb($data) | 
| 457 | 457 |  	{ | 
| 458 | 458 | if ($this->config['dir_activ_thumb']) | 
| @@ -473,11 +473,11 @@ discard block | ||
| 473 | 473 | } | 
| 474 | 474 | |
| 475 | 475 | /** | 
| 476 | - * Display and resize a banner | |
| 477 | - * | |
| 478 | - * @param array $data link's data from db | |
| 479 | - * @return string $s_banner html code. | |
| 480 | - */ | |
| 476 | + * Display and resize a banner | |
| 477 | + * | |
| 478 | + * @param array $data link's data from db | |
| 479 | + * @return string $s_banner html code. | |
| 480 | + */ | |
| 481 | 481 | public function display_bann($data) | 
| 482 | 482 |  	{ | 
| 483 | 483 | if (!empty($data['link_banner'])) | 
| @@ -515,12 +515,12 @@ discard block | ||
| 515 | 515 | } | 
| 516 | 516 | |
| 517 | 517 | /** | 
| 518 | - * Add a vote in db, for a specifi link | |
| 519 | - * | |
| 520 | - * @param int $link_id Link_id from db | |
| 521 | - * @param int $note Note submeted | |
| 522 | - * @return null | |
| 523 | - */ | |
| 518 | + * Add a vote in db, for a specifi link | |
| 519 | + * | |
| 520 | + * @param int $link_id Link_id from db | |
| 521 | + * @param int $note Note submeted | |
| 522 | + * @return null | |
| 523 | + */ | |
| 524 | 524 | public function add_vote($link_id, $note) | 
| 525 | 525 |  	{ | 
| 526 | 526 | $data = array( | 
| @@ -564,11 +564,11 @@ discard block | ||
| 564 | 564 | } | 
| 565 | 565 | |
| 566 | 566 | /** | 
| 567 | - * Search an appropriate thumb for url | |
| 568 | - * | |
| 569 | - * @param string $url Link's url | |
| 570 | - * @return string The thumb url | |
| 571 | - */ | |
| 567 | + * Search an appropriate thumb for url | |
| 568 | + * | |
| 569 | + * @param string $url Link's url | |
| 570 | + * @return string The thumb url | |
| 571 | + */ | |
| 572 | 572 | public function thumb_process($url) | 
| 573 | 573 |  	{ | 
| 574 | 574 | if (!$this->config['dir_activ_thumb']) | 
| @@ -589,12 +589,12 @@ discard block | ||
| 589 | 589 | } | 
| 590 | 590 | |
| 591 | 591 | /** | 
| 592 | - * Check if ascreen thumb exists | |
| 593 | - * | |
| 594 | - * @param string $protocol The protocol | |
| 595 | - * @param string $host The hostname | |
| 596 | - * @return bool True if ascreen file exixts, else false | |
| 597 | - */ | |
| 592 | + * Check if ascreen thumb exists | |
| 593 | + * | |
| 594 | + * @param string $protocol The protocol | |
| 595 | + * @param string $host The hostname | |
| 596 | + * @return bool True if ascreen file exixts, else false | |
| 597 | + */ | |
| 598 | 598 | private function _ascreen_exist($protocol, $host) | 
| 599 | 599 |  	{ | 
| 600 | 600 | if (($thumb_info = $this->imagesize->getImageSize($protocol.'://'.$host.'/ascreen.jpg')) !== false) | 
| @@ -609,12 +609,12 @@ discard block | ||
| 609 | 609 | } | 
| 610 | 610 | |
| 611 | 611 | /** | 
| 612 | - * Primary work on banner, can edit, copy or check a banner | |
| 613 | - * | |
| 614 | - * @param string $banner The banner's remote url | |
| 615 | - * @param array $error The array error, passed by reference | |
| 616 | - * @return null | |
| 617 | - */ | |
| 612 | + * Primary work on banner, can edit, copy or check a banner | |
| 613 | + * | |
| 614 | + * @param string $banner The banner's remote url | |
| 615 | + * @param array $error The array error, passed by reference | |
| 616 | + * @return null | |
| 617 | + */ | |
| 618 | 618 | public function banner_process(&$banner, &$error) | 
| 619 | 619 |  	{ | 
| 620 | 620 |  		$old_banner = $this->request->variable('old_banner', ''); | 
| @@ -650,13 +650,13 @@ discard block | ||
| 650 | 650 | } | 
| 651 | 651 | |
| 652 | 652 | /** | 
| 653 | - * Copy a remonte banner to server. | |
| 654 | - * called by banner_process() | |
| 655 | - * | |
| 656 | - * @param string $banner The banner's remote url | |
| 657 | - * @param array $error The array error, passed by reference | |
| 658 | - * @return false|string String if no errors, else false | |
| 659 | - */ | |
| 653 | + * Copy a remonte banner to server. | |
| 654 | + * called by banner_process() | |
| 655 | + * | |
| 656 | + * @param string $banner The banner's remote url | |
| 657 | + * @param array $error The array error, passed by reference | |
| 658 | + * @return false|string String if no errors, else false | |
| 659 | + */ | |
| 660 | 660 | private function _banner_upload($banner, &$error) | 
| 661 | 661 |  	{ | 
| 662 | 662 | /** @var \phpbb\files\upload $upload */ | 
| @@ -688,13 +688,13 @@ discard block | ||
| 688 | 688 | } | 
| 689 | 689 | |
| 690 | 690 | /** | 
| 691 | - * Check than remote banner exists | |
| 692 | - * called by banner_process() | |
| 693 | - * | |
| 694 | - * @param string $banner The banner's remote url | |
| 695 | - * @param array $error The array error, passed by reference | |
| 696 | - * @return false|string String if no errors, else false | |
| 697 | - */ | |
| 691 | + * Check than remote banner exists | |
| 692 | + * called by banner_process() | |
| 693 | + * | |
| 694 | + * @param string $banner The banner's remote url | |
| 695 | + * @param array $error The array error, passed by reference | |
| 696 | + * @return false|string String if no errors, else false | |
| 697 | + */ | |
| 698 | 698 | private function _banner_remote($banner, &$error) | 
| 699 | 699 |  	{ | 
| 700 | 700 |  		if (!preg_match('#^(http|https|ftp)://#i', $banner)) | 
| @@ -802,11 +802,11 @@ discard block | ||
| 802 | 802 | } | 
| 803 | 803 | |
| 804 | 804 | /** | 
| 805 | - * Delete a banner from server | |
| 806 | - * | |
| 807 | - * @param string $file The file's name | |
| 808 | - * @return bool True if delete success, else false | |
| 809 | - */ | |
| 805 | + * Delete a banner from server | |
| 806 | + * | |
| 807 | + * @param string $file The file's name | |
| 808 | + * @return bool True if delete success, else false | |
| 809 | + */ | |
| 810 | 810 | private function _banner_delete($file) | 
| 811 | 811 |  	{ | 
| 812 | 812 | $old_banner = $this->root_path . $this->get_banner_path($file); | 
| @@ -821,12 +821,12 @@ discard block | ||
| 821 | 821 | } | 
| 822 | 822 | |
| 823 | 823 | /** | 
| 824 | - * List flags | |
| 825 | - * | |
| 826 | - * @param string $flag_path The flag directory path | |
| 827 | - * @param string $value Selected flag | |
| 828 | - * @return string $list Html code | |
| 829 | - */ | |
| 824 | + * List flags | |
| 825 | + * | |
| 826 | + * @param string $flag_path The flag directory path | |
| 827 | + * @param string $value Selected flag | |
| 828 | + * @return string $list Html code | |
| 829 | + */ | |
| 830 | 830 | public function get_dir_flag_list($flag_path, $value) | 
| 831 | 831 |  	{ | 
| 832 | 832 | $list = ''; | 
| @@ -861,10 +861,10 @@ discard block | ||
| 861 | 861 | } | 
| 862 | 862 | |
| 863 | 863 | /** | 
| 864 | - * Display recents links added | |
| 865 | - * | |
| 866 | - * @return null | |
| 867 | - */ | |
| 864 | + * Display recents links added | |
| 865 | + * | |
| 866 | + * @return null | |
| 867 | + */ | |
| 868 | 868 | public function recents() | 
| 869 | 869 |  	{ | 
| 870 | 870 | if ($this->config['dir_recent_block']) | 
| @@ -941,13 +941,13 @@ discard block | ||
| 941 | 941 | } | 
| 942 | 942 | |
| 943 | 943 | /** | 
| 944 | - * Validate back link | |
| 945 | - * | |
| 946 | - * @param string $remote_url Page URL contains the backlink | |
| 947 | - * @param bool $optional Link back is optional in this category? | |
| 948 | - * @param bool $cron This methos is called by con process? | |
| 949 | - * @return false|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) | |
| 950 | - */ | |
| 944 | + * Validate back link | |
| 945 | + * | |
| 946 | + * @param string $remote_url Page URL contains the backlink | |
| 947 | + * @param bool $optional Link back is optional in this category? | |
| 948 | + * @param bool $cron This methos is called by con process? | |
| 949 | + * @return false|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) | |
| 950 | + */ | |
| 951 | 951 | public function validate_link_back($remote_url, $optional, $cron = false) | 
| 952 | 952 |  	{ | 
| 953 | 953 | if (!$cron) | 
| @@ -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\upload $files_upload, $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 | 87 | $this->notification = $notification; | 
| 88 | - $this->filesystem = $filesystem; | |
| 88 | + $this->filesystem = $filesystem; | |
| 89 | 89 | $this->imagesize = $imagesize; | 
| 90 | 90 | $this->files_upload = $files_upload; | 
| 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 | |
| @@ -229,7 +229,7 @@ discard block | ||
| 229 | 229 |  		{ | 
| 230 | 230 |  			if ($row['link_banner'] && !preg_match('/^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/|www\.).+/si', $row['link_banner'])) | 
| 231 | 231 |  			{ | 
| 232 | - $banner_img = $this->root_path . $this->get_banner_path(basename($row['link_banner'])); | |
| 232 | + $banner_img = $this->root_path.$this->get_banner_path(basename($row['link_banner'])); | |
| 233 | 233 | |
| 234 | 234 | if (file_exists($banner_img)) | 
| 235 | 235 |  				{ | 
| @@ -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 - '.count($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 | } | 
| @@ -531,12 +531,12 @@ discard block | ||
| 531 | 531 | |
| 532 | 532 |  		$this->db->sql_transaction('begin'); | 
| 533 | 533 | |
| 534 | -		$sql = 'INSERT INTO ' . $this->votes_table . ' ' . $this->db->sql_build_array('INSERT', $data); | |
| 534 | +		$sql = 'INSERT INTO '.$this->votes_table.' '.$this->db->sql_build_array('INSERT', $data); | |
| 535 | 535 | $this->db->sql_query($sql); | 
| 536 | 536 | |
| 537 | - $sql = 'UPDATE ' . $this->links_table . ' | |
| 537 | + $sql = 'UPDATE '.$this->links_table.' | |
| 538 | 538 | SET link_vote = link_vote + 1, | 
| 539 | - link_note = link_note + ' . (int) $data['vote_note'] . ' | |
| 539 | + link_note = link_note + ' . (int) $data['vote_note'].' | |
| 540 | 540 | WHERE link_id = ' . (int) $link_id; | 
| 541 | 541 | $this->db->sql_query($sql); | 
| 542 | 542 | |
| @@ -544,7 +544,7 @@ discard block | ||
| 544 | 544 | |
| 545 | 545 | if ($this->request->is_ajax()) | 
| 546 | 546 |  		{ | 
| 547 | - $sql= 'SELECT link_vote, link_note FROM ' . $this->links_table . ' WHERE link_id = ' . (int) $link_id; | |
| 547 | + $sql = 'SELECT link_vote, link_note FROM '.$this->links_table.' WHERE link_id = '.(int) $link_id; | |
| 548 | 548 | $result = $this->db->sql_query($sql); | 
| 549 | 549 | $data = $this->db->sql_fetchrow($result); | 
| 550 | 550 | |
| @@ -578,8 +578,8 @@ discard block | ||
| 578 | 578 | |
| 579 | 579 | $details = parse_url($url); | 
| 580 | 580 | |
| 581 | - $root_url = $details['scheme'].'://'.$details['host']; | |
| 582 | - $absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url; | |
| 581 | + $root_url = $details['scheme'].'://'.$details['host']; | |
| 582 | + $absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url; | |
| 583 | 583 | |
| 584 | 584 | if ($this->config['dir_activ_thumb_remote'] && $this->_ascreen_exist($details['scheme'], $details['host'])) | 
| 585 | 585 |  		{ | 
| @@ -619,7 +619,7 @@ discard block | ||
| 619 | 619 |  	{ | 
| 620 | 620 |  		$old_banner = $this->request->variable('old_banner', ''); | 
| 621 | 621 | |
| 622 | - $destination = $this->root_path . $this->get_banner_path(); | |
| 622 | + $destination = $this->root_path.$this->get_banner_path(); | |
| 623 | 623 | |
| 624 | 624 | // Can we upload? | 
| 625 | 625 |  		$can_upload = ($this->config['dir_storage_banner'] && $this->filesystem->exists($destination) && $this->filesystem->is_writable($destination) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; | 
| @@ -668,7 +668,7 @@ discard block | ||
| 668 | 668 | |
| 669 | 669 |  		$file = $upload->handle_upload('files.types.remote', $banner); | 
| 670 | 670 | |
| 671 | - $prefix = unique_id() . '_'; | |
| 671 | + $prefix = unique_id().'_'; | |
| 672 | 672 |  		$file->clean_filename('real', $prefix); | 
| 673 | 673 | |
| 674 | 674 | if (count($file->error)) | 
| @@ -699,7 +699,7 @@ discard block | ||
| 699 | 699 |  	{ | 
| 700 | 700 |  		if (!preg_match('#^(http|https|ftp)://#i', $banner)) | 
| 701 | 701 |  		{ | 
| 702 | - $banner = 'http://' . $banner; | |
| 702 | + $banner = 'http://'.$banner; | |
| 703 | 703 | } | 
| 704 | 704 |  		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)) | 
| 705 | 705 |  		{ | 
| @@ -730,8 +730,8 @@ discard block | ||
| 730 | 730 | } | 
| 731 | 731 | |
| 732 | 732 | // Check image type | 
| 733 | - $types = \phpbb\files\upload::image_types(); | |
| 734 | - $extension = strtolower(\phpbb\files\filespec::get_extension($banner)); | |
| 733 | + $types = \phpbb\files\upload::image_types(); | |
| 734 | + $extension = strtolower(\phpbb\files\filespec::get_extension($banner)); | |
| 735 | 735 | |
| 736 | 736 | // Check if this is actually an image | 
| 737 | 737 | if ($file_stream = @fopen($banner, 'r')) | 
| @@ -809,7 +809,7 @@ discard block | ||
| 809 | 809 | */ | 
| 810 | 810 | private function _banner_delete($file) | 
| 811 | 811 |  	{ | 
| 812 | - $old_banner = $this->root_path . $this->get_banner_path($file); | |
| 812 | + $old_banner = $this->root_path.$this->get_banner_path($file); | |
| 813 | 813 | |
| 814 | 814 | if (file_exists($old_banner)) | 
| 815 | 815 |  		{ | 
| @@ -853,7 +853,7 @@ discard block | ||
| 853 | 853 | |
| 854 | 854 | if (file_exists($flag_path.$img_file)) | 
| 855 | 855 |  			{ | 
| 856 | - $list .= '<option value="' . $img_file . '" ' . (($img_file == $value) ? 'selected="selected"' : '') . '>' . $name . '</option>'; | |
| 856 | + $list .= '<option value="'.$img_file.'" '.(($img_file == $value) ? 'selected="selected"' : '').'>'.$name.'</option>'; | |
| 857 | 857 | } | 
| 858 | 858 | } | 
| 859 | 859 | |
| @@ -869,8 +869,8 @@ discard block | ||
| 869 | 869 |  	{ | 
| 870 | 870 | if ($this->config['dir_recent_block']) | 
| 871 | 871 |  		{ | 
| 872 | - $limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns']; | |
| 873 | -			$exclude_array	= array_filter(explode(',', str_replace(' ', '', $this->config['dir_recent_exclude']))); | |
| 872 | + $limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns']; | |
| 873 | +			$exclude_array = array_filter(explode(',', str_replace(' ', '', $this->config['dir_recent_exclude']))); | |
| 874 | 874 | |
| 875 | 875 | $sql_array = array( | 
| 876 | 876 | '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', | 
| @@ -886,7 +886,7 @@ discard block | ||
| 886 | 886 | 'ON' => 'l.link_cat = c.cat_id' | 
| 887 | 887 | ) | 
| 888 | 888 | ), | 
| 889 | -				'WHERE'		=> 'l.link_active = 1' . (count($exclude_array) ? ' AND ' . $this->db->sql_in_set('l.link_cat', $exclude_array, true) : ''), | |
| 889 | +				'WHERE'		=> 'l.link_active = 1'.(count($exclude_array) ? ' AND '.$this->db->sql_in_set('l.link_cat', $exclude_array, true) : ''), | |
| 890 | 890 | 'ORDER_BY' => 'l.link_time DESC, l.link_id DESC'); | 
| 891 | 891 | |
| 892 | 892 |  			$sql = $this->db->sql_build_query('SELECT', $sql_array); | 
| @@ -903,7 +903,7 @@ discard block | ||
| 903 | 903 | if (count($rowset)) | 
| 904 | 904 |  			{ | 
| 905 | 905 |  				$this->template->assign_block_vars('block', array( | 
| 906 | - 'S_COL_WIDTH' => (100 / $this->config['dir_recent_columns']) . '%', | |
| 906 | + 'S_COL_WIDTH' => (100 / $this->config['dir_recent_columns']).'%', | |
| 907 | 907 | )); | 
| 908 | 908 | |
| 909 | 909 | foreach ($rowset as $row) | 
| @@ -922,7 +922,7 @@ discard block | ||
| 922 | 922 | 'COUNT' => $row['link_view'], | 
| 923 | 923 | 'COMMENT' => $row['link_comment'], | 
| 924 | 924 | |
| 925 | -						'U_CAT'                   => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $row['link_cat']), | |
| 925 | +						'U_CAT'                   => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$row['link_cat']), | |
| 926 | 926 |  						'U_COMMENT'               => $this->helper->route('ernadoo_phpbbdirectory_comment_view_controller', array('link_id' => (int) $row['link_id'])), | 
| 927 | 927 | |
| 928 | 928 |  						'L_DIR_SEARCH_NB_CLICKS'	=> $this->language->lang('DIR_SEARCH_NB_CLICKS', (int) $row['link_view']), | 
| @@ -52,14 +52,14 @@ discard block | ||
| 52 | 52 | */ | 
| 53 | 53 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\log\log $phpbb_log, \phpbb\user $user, \phpbb\notification\manager $notification, \ernadoo\phpbbdirectory\core\link $link, $root_path, $php_ext) | 
| 54 | 54 |  	{ | 
| 55 | - $this->db = $db; | |
| 56 | - $this->config = $config; | |
| 57 | - $this->phpbb_log = $phpbb_log; | |
| 55 | + $this->db = $db; | |
| 56 | + $this->config = $config; | |
| 57 | + $this->phpbb_log = $phpbb_log; | |
| 58 | 58 | $this->user = $user; | 
| 59 | - $this->notification = $notification; | |
| 59 | + $this->notification = $notification; | |
| 60 | 60 | $this->link = $link; | 
| 61 | - $this->root_path = $root_path; | |
| 62 | - $this->php_ext = $php_ext; | |
| 61 | + $this->root_path = $root_path; | |
| 62 | + $this->php_ext = $php_ext; | |
| 63 | 63 | } | 
| 64 | 64 | |
| 65 | 65 | /** | 
| @@ -71,7 +71,7 @@ discard block | ||
| 71 | 71 | public function auto_check($cat_data) | 
| 72 | 72 |  	{ | 
| 73 | 73 | $sql = 'SELECT cat_name | 
| 74 | - FROM ' . $this->categories_table . ' | |
| 74 | + FROM ' . $this->categories_table.' | |
| 75 | 75 | WHERE cat_id = ' . (int) $cat_data['cat_id']; | 
| 76 | 76 | $result = $this->db->sql_query($sql); | 
| 77 | 77 | $row = $this->db->sql_fetchrow($result); | 
| @@ -83,9 +83,9 @@ discard block | ||
| 83 | 83 | |
| 84 | 84 | $this->_check($cat_data['cat_id'], $cat_data['cat_cron_nb_check'], $next_prune); | 
| 85 | 85 | |
| 86 | - $sql = 'UPDATE ' . $this->categories_table . " | |
| 86 | + $sql = 'UPDATE '.$this->categories_table." | |
| 87 | 87 | SET cat_cron_next = $next_prune | 
| 88 | - WHERE cat_id = " . (int) $cat_data['cat_id']; | |
| 88 | + WHERE cat_id = ".(int) $cat_data['cat_id']; | |
| 89 | 89 | $this->db->sql_query($sql); | 
| 90 | 90 | |
| 91 | 91 |  			$this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_DIR_AUTO_PRUNE', time(), array($row['cat_name'])); | 
| @@ -103,7 +103,7 @@ discard block | ||
| 103 | 103 | public function get_cat($cat_id) | 
| 104 | 104 |  	{ | 
| 105 | 105 | $sql = 'SELECT cat_id, cat_cron_enable, cat_cron_next, cat_cron_freq, cat_cron_nb_check | 
| 106 | - FROM ' . $this->categories_table . ' | |
| 106 | + FROM ' . $this->categories_table.' | |
| 107 | 107 | WHERE cat_id = ' . (int) $cat_id; | 
| 108 | 108 | $result = $this->db->sql_query($sql); | 
| 109 | 109 | $row = $this->db->sql_fetchrow($result); | 
| @@ -138,7 +138,7 @@ discard block | ||
| 138 | 138 | 'ON' => 'l.link_user_id = u.user_id' | 
| 139 | 139 | ) | 
| 140 | 140 | ), | 
| 141 | - 'WHERE' => "l.link_back <> '' AND l.link_active = 1 AND l.link_cat = " . (int) $cat_id); | |
| 141 | + 'WHERE' => "l.link_back <> '' AND l.link_active = 1 AND l.link_cat = ".(int) $cat_id); | |
| 142 | 142 | |
| 143 | 143 |  			$sql = $this->db->sql_build_query('SELECT', $sql_array); | 
| 144 | 144 | $result = $this->db->sql_query($sql); | 
| @@ -147,7 +147,7 @@ discard block | ||
| 147 | 147 |  			{ | 
| 148 | 148 | if ($this->link->validate_link_back($row['link_back'], false, true) !== false) | 
| 149 | 149 |  				{ | 
| 150 | - if (!$nb_check || ($row['link_nb_check']+1) >= $nb_check) | |
| 150 | + if (!$nb_check || ($row['link_nb_check'] + 1) >= $nb_check) | |
| 151 | 151 |  					{ | 
| 152 | 152 | $del_array[] = $row['link_id']; | 
| 153 | 153 | } | 
| @@ -181,7 +181,7 @@ discard block | ||
| 181 | 181 |  	{ | 
| 182 | 182 |  		if (!class_exists('messenger')) | 
| 183 | 183 |  		{ | 
| 184 | - include($this->root_path . 'includes/functions_messenger.' . $this->php_ext); | |
| 184 | + include($this->root_path.'includes/functions_messenger.'.$this->php_ext); | |
| 185 | 185 | } | 
| 186 | 186 | |
| 187 | 187 | $messenger = new \messenger(false); | 
| @@ -190,7 +190,7 @@ discard block | ||
| 190 | 190 | // We need to define it, because we use user->format_date below | 
| 191 | 191 | $this->user->timezone = new \DateTimeZone($this->config['board_timezone']); | 
| 192 | 192 | |
| 193 | - $sql = 'UPDATE ' . $this->links_table . ' | |
| 193 | + $sql = 'UPDATE '.$this->links_table.' | |
| 194 | 194 | SET link_nb_check = link_nb_check + 1 | 
| 195 | 195 |  			WHERE ' . $this->db->sql_in_set('link_id', array_keys($u_array)); | 
| 196 | 196 | $this->db->sql_query($sql); |