@@ -55,9 +55,9 @@ discard block  | 
                                                    ||
| 55 | 55 |  	{ | 
                                                        
| 56 | 56 | if ($full)  | 
                                                        
| 57 | 57 |  		{ | 
                                                        
| 58 | - return generate_board_url() . '/' . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . $this->title_to_url($topic_title) . '-t' . $topic_id . ($start ? '-s' . $start : '') . '.html';  | 
                                                        |
| 58 | + return generate_board_url().'/'.$this->title_to_url($forum_name).'-f'.$forum_id.'/'.$this->title_to_url($topic_title).'-t'.$topic_id.($start ? '-s'.$start : '').'.html';  | 
                                                        |
| 59 | 59 | }  | 
                                                        
| 60 | - return $this->phpbb_root_path . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . $this->title_to_url($topic_title) . '-t' . $topic_id . ($start ? '-s' . $start : '') . '.html';  | 
                                                        |
| 60 | + return $this->phpbb_root_path.$this->title_to_url($forum_name).'-f'.$forum_id.'/'.$this->title_to_url($topic_title).'-t'.$topic_id.($start ? '-s'.$start : '').'.html';  | 
                                                        |
| 61 | 61 | }  | 
                                                        
| 62 | 62 | |
| 63 | 63 | /**  | 
                                                        
@@ -74,9 +74,9 @@ discard block  | 
                                                    ||
| 74 | 74 |  	{ | 
                                                        
| 75 | 75 | if ($full)  | 
                                                        
| 76 | 76 |  		{ | 
                                                        
| 77 | - return generate_board_url() . '/' . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . ($start ? 'index-s' . $start . '.html' : '');  | 
                                                        |
| 77 | + return generate_board_url().'/'.$this->title_to_url($forum_name).'-f'.$forum_id.'/'.($start ? 'index-s'.$start.'.html' : '');  | 
                                                        |
| 78 | 78 | }  | 
                                                        
| 79 | - return $this->phpbb_root_path . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . ($start ? 'index-s' . $start . '.html' : '');  | 
                                                        |
| 79 | + return $this->phpbb_root_path.$this->title_to_url($forum_name).'-f'.$forum_id.'/'.($start ? 'index-s'.$start.'.html' : '');  | 
                                                        |
| 80 | 80 | }  | 
                                                        
| 81 | 81 | |
| 82 | 82 | /**  | 
                                                        
@@ -95,12 +95,12 @@ discard block  | 
                                                    ||
| 95 | 95 |  		{ | 
                                                        
| 96 | 96 | for ($j = 0; $j < $replies + 1; $j += $per_page)  | 
                                                        
| 97 | 97 |  			{ | 
                                                        
| 98 | - $last_post_link = $url . '-s' . $j . '.html';  | 
                                                        |
| 98 | + $last_post_link = $url.'-s'.$j.'.html';  | 
                                                        |
| 99 | 99 | }  | 
                                                        
| 100 | 100 | }  | 
                                                        
| 101 | 101 | else  | 
                                                        
| 102 | 102 |  		{ | 
                                                        
| 103 | - $last_post_link = $url . '.html';  | 
                                                        |
| 103 | + $last_post_link = $url.'.html';  | 
                                                        |
| 104 | 104 | }  | 
                                                        
| 105 | 105 | return $last_post_link;  | 
                                                        
| 106 | 106 | }  | 
                                                        
@@ -139,9 +139,9 @@ discard block  | 
                                                    ||
| 139 | 139 |  	{ | 
                                                        
| 140 | 140 |  		if (!$this->auth->acl_get('m_approve', $forum_id)) | 
                                                        
| 141 | 141 |  		{ | 
                                                        
| 142 | - return (int) $data[$mode . '_approved'];  | 
                                                        |
| 142 | + return (int) $data[$mode.'_approved'];  | 
                                                        |
| 143 | 143 | }  | 
                                                        
| 144 | 144 | |
| 145 | - return (int) $data[$mode . '_approved'] + (int) $data[$mode . '_unapproved'] + (int) $data[$mode . '_softdeleted'];  | 
                                                        |
| 145 | + return (int) $data[$mode.'_approved'] + (int) $data[$mode.'_unapproved'] + (int) $data[$mode.'_softdeleted'];  | 
                                                        |
| 146 | 146 | }  | 
                                                        
| 147 | 147 | }  | 
                                                        
@@ -97,8 +97,7 @@  | 
                                                    ||
| 97 | 97 |  			{ | 
                                                        
| 98 | 98 | $last_post_link = $url . '-s' . $j . '.html';  | 
                                                        
| 99 | 99 | }  | 
                                                        
| 100 | - }  | 
                                                        |
| 101 | - else  | 
                                                        |
| 100 | + } else  | 
                                                        |
| 102 | 101 |  		{ | 
                                                        
| 103 | 102 | $last_post_link = $url . '.html';  | 
                                                        
| 104 | 103 | }  | 
                                                        
@@ -15,140 +15,140 @@  | 
                                                    ||
| 15 | 15 | class base  | 
                                                        
| 16 | 16 |  { | 
                                                        
| 17 | 17 | |
| 18 | - /** @var \phpbb\auth\auth */  | 
                                                        |
| 19 | - protected $auth;  | 
                                                        |
| 18 | + /** @var \phpbb\auth\auth */  | 
                                                        |
| 19 | + protected $auth;  | 
                                                        |
| 20 | 20 | |
| 21 | - /** @var \phpbb\config\config */  | 
                                                        |
| 22 | - protected $config;  | 
                                                        |
| 21 | + /** @var \phpbb\config\config */  | 
                                                        |
| 22 | + protected $config;  | 
                                                        |
| 23 | 23 | |
| 24 | - /** @var string phpbb_root_path */  | 
                                                        |
| 25 | - protected $phpbb_root_path;  | 
                                                        |
| 24 | + /** @var string phpbb_root_path */  | 
                                                        |
| 25 | + protected $phpbb_root_path;  | 
                                                        |
| 26 | 26 | |
| 27 | - /**  | 
                                                        |
| 28 | - * Constructor  | 
                                                        |
| 29 | - *  | 
                                                        |
| 30 | - * @param \phpbb\auth\auth auth Authentication object  | 
                                                        |
| 31 | - * @param \phpbb\config\config $config Config Object  | 
                                                        |
| 32 | - * @param string $phpbb_root_path phpbb_root_path  | 
                                                        |
| 33 | - * @access public  | 
                                                        |
| 34 | - */  | 
                                                        |
| 35 | - public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, $phpbb_root_path)  | 
                                                        |
| 36 | -	{ | 
                                                        |
| 37 | - $this->auth = $auth;  | 
                                                        |
| 38 | - $this->config = $config;  | 
                                                        |
| 39 | - $this->phpbb_root_path = $phpbb_root_path;  | 
                                                        |
| 40 | - }  | 
                                                        |
| 27 | + /**  | 
                                                        |
| 28 | + * Constructor  | 
                                                        |
| 29 | + *  | 
                                                        |
| 30 | + * @param \phpbb\auth\auth auth Authentication object  | 
                                                        |
| 31 | + * @param \phpbb\config\config $config Config Object  | 
                                                        |
| 32 | + * @param string $phpbb_root_path phpbb_root_path  | 
                                                        |
| 33 | + * @access public  | 
                                                        |
| 34 | + */  | 
                                                        |
| 35 | + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, $phpbb_root_path)  | 
                                                        |
| 36 | +    { | 
                                                        |
| 37 | + $this->auth = $auth;  | 
                                                        |
| 38 | + $this->config = $config;  | 
                                                        |
| 39 | + $this->phpbb_root_path = $phpbb_root_path;  | 
                                                        |
| 40 | + }  | 
                                                        |
| 41 | 41 | |
| 42 | - /**  | 
                                                        |
| 43 | - * Generate the SEO link for a topic  | 
                                                        |
| 44 | - *  | 
                                                        |
| 45 | - * @param int $forum_id The ID of the forum  | 
                                                        |
| 46 | - * @param string $forum_name The title of the forum  | 
                                                        |
| 47 | - * @param int $topic_id The ID if the topic  | 
                                                        |
| 48 | - * @param string $topic_title The title of the topic  | 
                                                        |
| 49 | - * @param int $start Optional start parameter  | 
                                                        |
| 50 | - * @param bool $full Return the full URL  | 
                                                        |
| 51 | - * @return string The SEO URL  | 
                                                        |
| 52 | - * @access private  | 
                                                        |
| 53 | - */  | 
                                                        |
| 54 | - public function generate_topic_link($forum_id, $forum_name, $topic_id, $topic_title, $start = 0, $full = false)  | 
                                                        |
| 55 | -	{ | 
                                                        |
| 56 | - if ($full)  | 
                                                        |
| 57 | -		{ | 
                                                        |
| 58 | - return generate_board_url() . '/' . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . $this->title_to_url($topic_title) . '-t' . $topic_id . ($start ? '-s' . $start : '') . '.html';  | 
                                                        |
| 59 | - }  | 
                                                        |
| 60 | - return $this->phpbb_root_path . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . $this->title_to_url($topic_title) . '-t' . $topic_id . ($start ? '-s' . $start : '') . '.html';  | 
                                                        |
| 61 | - }  | 
                                                        |
| 42 | + /**  | 
                                                        |
| 43 | + * Generate the SEO link for a topic  | 
                                                        |
| 44 | + *  | 
                                                        |
| 45 | + * @param int $forum_id The ID of the forum  | 
                                                        |
| 46 | + * @param string $forum_name The title of the forum  | 
                                                        |
| 47 | + * @param int $topic_id The ID if the topic  | 
                                                        |
| 48 | + * @param string $topic_title The title of the topic  | 
                                                        |
| 49 | + * @param int $start Optional start parameter  | 
                                                        |
| 50 | + * @param bool $full Return the full URL  | 
                                                        |
| 51 | + * @return string The SEO URL  | 
                                                        |
| 52 | + * @access private  | 
                                                        |
| 53 | + */  | 
                                                        |
| 54 | + public function generate_topic_link($forum_id, $forum_name, $topic_id, $topic_title, $start = 0, $full = false)  | 
                                                        |
| 55 | +    { | 
                                                        |
| 56 | + if ($full)  | 
                                                        |
| 57 | +        { | 
                                                        |
| 58 | + return generate_board_url() . '/' . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . $this->title_to_url($topic_title) . '-t' . $topic_id . ($start ? '-s' . $start : '') . '.html';  | 
                                                        |
| 59 | + }  | 
                                                        |
| 60 | + return $this->phpbb_root_path . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . $this->title_to_url($topic_title) . '-t' . $topic_id . ($start ? '-s' . $start : '') . '.html';  | 
                                                        |
| 61 | + }  | 
                                                        |
| 62 | 62 | |
| 63 | - /**  | 
                                                        |
| 64 | - * Generate the SEO link for a forum  | 
                                                        |
| 65 | - *  | 
                                                        |
| 66 | - * @param int $forum_id The ID of the forum  | 
                                                        |
| 67 | - * @param string $forum_name The title of the forum  | 
                                                        |
| 68 | - * @param int $start Optional start parameter  | 
                                                        |
| 69 | - * @param bool $full Return the full URL  | 
                                                        |
| 70 | - * @return string The SEO URL  | 
                                                        |
| 71 | - * @access private  | 
                                                        |
| 72 | - */  | 
                                                        |
| 73 | - public function generate_forum_link($forum_id, $forum_name, $start = 0, $full = false)  | 
                                                        |
| 74 | -	{ | 
                                                        |
| 75 | - if ($full)  | 
                                                        |
| 76 | -		{ | 
                                                        |
| 77 | - return generate_board_url() . '/' . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . ($start ? 'index-s' . $start . '.html' : '');  | 
                                                        |
| 78 | - }  | 
                                                        |
| 79 | - return $this->phpbb_root_path . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . ($start ? 'index-s' . $start . '.html' : '');  | 
                                                        |
| 80 | - }  | 
                                                        |
| 63 | + /**  | 
                                                        |
| 64 | + * Generate the SEO link for a forum  | 
                                                        |
| 65 | + *  | 
                                                        |
| 66 | + * @param int $forum_id The ID of the forum  | 
                                                        |
| 67 | + * @param string $forum_name The title of the forum  | 
                                                        |
| 68 | + * @param int $start Optional start parameter  | 
                                                        |
| 69 | + * @param bool $full Return the full URL  | 
                                                        |
| 70 | + * @return string The SEO URL  | 
                                                        |
| 71 | + * @access private  | 
                                                        |
| 72 | + */  | 
                                                        |
| 73 | + public function generate_forum_link($forum_id, $forum_name, $start = 0, $full = false)  | 
                                                        |
| 74 | +    { | 
                                                        |
| 75 | + if ($full)  | 
                                                        |
| 76 | +        { | 
                                                        |
| 77 | + return generate_board_url() . '/' . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . ($start ? 'index-s' . $start . '.html' : '');  | 
                                                        |
| 78 | + }  | 
                                                        |
| 79 | + return $this->phpbb_root_path . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . ($start ? 'index-s' . $start . '.html' : '');  | 
                                                        |
| 80 | + }  | 
                                                        |
| 81 | 81 | |
| 82 | - /**  | 
                                                        |
| 83 | - *  | 
                                                        |
| 84 | - * @global type $_SID  | 
                                                        |
| 85 | - * @param int $replies Replays in the topic  | 
                                                        |
| 86 | - * @param string $url URL oft the topic  | 
                                                        |
| 87 | - * @return string The URL with start included  | 
                                                        |
| 88 | - */  | 
                                                        |
| 89 | - public function generate_lastpost_link($replies, $url)  | 
                                                        |
| 90 | -	{ | 
                                                        |
| 91 | -		$url = str_replace('.html', '', $url); | 
                                                        |
| 92 | - $per_page = ($this->config['posts_per_page'] <= 0) ? 1 : $this->config['posts_per_page'];  | 
                                                        |
| 93 | - $last_post_link = '';  | 
                                                        |
| 94 | - if (($replies + 1) > $per_page)  | 
                                                        |
| 95 | -		{ | 
                                                        |
| 96 | - for ($j = 0; $j < $replies + 1; $j += $per_page)  | 
                                                        |
| 97 | -			{ | 
                                                        |
| 98 | - $last_post_link = $url . '-s' . $j . '.html';  | 
                                                        |
| 99 | - }  | 
                                                        |
| 100 | - }  | 
                                                        |
| 101 | - else  | 
                                                        |
| 102 | -		{ | 
                                                        |
| 103 | - $last_post_link = $url . '.html';  | 
                                                        |
| 104 | - }  | 
                                                        |
| 105 | - return $last_post_link;  | 
                                                        |
| 106 | - }  | 
                                                        |
| 82 | + /**  | 
                                                        |
| 83 | + *  | 
                                                        |
| 84 | + * @global type $_SID  | 
                                                        |
| 85 | + * @param int $replies Replays in the topic  | 
                                                        |
| 86 | + * @param string $url URL oft the topic  | 
                                                        |
| 87 | + * @return string The URL with start included  | 
                                                        |
| 88 | + */  | 
                                                        |
| 89 | + public function generate_lastpost_link($replies, $url)  | 
                                                        |
| 90 | +    { | 
                                                        |
| 91 | +        $url = str_replace('.html', '', $url); | 
                                                        |
| 92 | + $per_page = ($this->config['posts_per_page'] <= 0) ? 1 : $this->config['posts_per_page'];  | 
                                                        |
| 93 | + $last_post_link = '';  | 
                                                        |
| 94 | + if (($replies + 1) > $per_page)  | 
                                                        |
| 95 | +        { | 
                                                        |
| 96 | + for ($j = 0; $j < $replies + 1; $j += $per_page)  | 
                                                        |
| 97 | +            { | 
                                                        |
| 98 | + $last_post_link = $url . '-s' . $j . '.html';  | 
                                                        |
| 99 | + }  | 
                                                        |
| 100 | + }  | 
                                                        |
| 101 | + else  | 
                                                        |
| 102 | +        { | 
                                                        |
| 103 | + $last_post_link = $url . '.html';  | 
                                                        |
| 104 | + }  | 
                                                        |
| 105 | + return $last_post_link;  | 
                                                        |
| 106 | + }  | 
                                                        |
| 107 | 107 | |
| 108 | - /**  | 
                                                        |
| 109 | - * Replace letters to use title in URL  | 
                                                        |
| 110 | - *  | 
                                                        |
| 111 | - * @param string $title The title to use in the URL  | 
                                                        |
| 112 | - * @return string Title to use in URLs  | 
                                                        |
| 113 | - */  | 
                                                        |
| 114 | - public static function title_to_url($title)  | 
                                                        |
| 115 | -	{ | 
                                                        |
| 116 | - $url = strtolower(censor_text(utf8_normalize_nfc(html_entity_decode(strip_tags($title)))));  | 
                                                        |
| 108 | + /**  | 
                                                        |
| 109 | + * Replace letters to use title in URL  | 
                                                        |
| 110 | + *  | 
                                                        |
| 111 | + * @param string $title The title to use in the URL  | 
                                                        |
| 112 | + * @return string Title to use in URLs  | 
                                                        |
| 113 | + */  | 
                                                        |
| 114 | + public static function title_to_url($title)  | 
                                                        |
| 115 | +    { | 
                                                        |
| 116 | + $url = strtolower(censor_text(utf8_normalize_nfc(html_entity_decode(strip_tags($title)))));  | 
                                                        |
| 117 | 117 | |
| 118 | - // Let's replace  | 
                                                        |
| 119 | - $url_search = array(  | 
                                                        |
| 120 | - ' ', 'í', 'ý', 'ß', 'ö', 'ô', 'ó', 'ò', 'ä', 'â', 'à', 'á', 'é', 'è', 'ü', 'ú', 'ù', 'ñ', 'ß', '²', '³', '@', '€', '$',  | 
                                                        |
| 121 | - 'ą', 'ć', 'ę', 'ł', 'ń', 'ó', 'ś', 'ż', 'ź'  | 
                                                        |
| 122 | - );  | 
                                                        |
| 123 | - $url_replace = array(  | 
                                                        |
| 124 | - '-', 'i', 'y', 's', 'oe', 'o', 'o', 'o', 'ae', 'a', 'a', 'a', 'e', 'e', 'ue', 'u', 'u', 'n', 'ss', '2', '3', 'at', 'eur', 'usd',  | 
                                                        |
| 125 | - 'a', 'c', 'e', 'l', 'n', 'o', 's', 'z', 'z'  | 
                                                        |
| 126 | - );  | 
                                                        |
| 127 | - $url = str_replace($url_search, $url_replace, $url);  | 
                                                        |
| 118 | + // Let's replace  | 
                                                        |
| 119 | + $url_search = array(  | 
                                                        |
| 120 | + ' ', 'í', 'ý', 'ß', 'ö', 'ô', 'ó', 'ò', 'ä', 'â', 'à', 'á', 'é', 'è', 'ü', 'ú', 'ù', 'ñ', 'ß', '²', '³', '@', '€', '$',  | 
                                                        |
| 121 | + 'ą', 'ć', 'ę', 'ł', 'ń', 'ó', 'ś', 'ż', 'ź'  | 
                                                        |
| 122 | + );  | 
                                                        |
| 123 | + $url_replace = array(  | 
                                                        |
| 124 | + '-', 'i', 'y', 's', 'oe', 'o', 'o', 'o', 'ae', 'a', 'a', 'a', 'e', 'e', 'ue', 'u', 'u', 'n', 'ss', '2', '3', 'at', 'eur', 'usd',  | 
                                                        |
| 125 | + 'a', 'c', 'e', 'l', 'n', 'o', 's', 'z', 'z'  | 
                                                        |
| 126 | + );  | 
                                                        |
| 127 | + $url = str_replace($url_search, $url_replace, $url);  | 
                                                        |
| 128 | 128 | |
| 129 | -		$url = preg_replace('/[^\w\d]/', '-', $url); | 
                                                        |
| 130 | -		$url = preg_replace('/[-]{2,}/', '-', $url); | 
                                                        |
| 131 | - $url = trim($url, '-');  | 
                                                        |
| 129 | +        $url = preg_replace('/[^\w\d]/', '-', $url); | 
                                                        |
| 130 | +        $url = preg_replace('/[-]{2,}/', '-', $url); | 
                                                        |
| 131 | + $url = trim($url, '-');  | 
                                                        |
| 132 | 132 | |
| 133 | - $url = substr($url, 0, 50); // Max length for a title in URL  | 
                                                        |
| 134 | - return urlencode($url);  | 
                                                        |
| 135 | - }  | 
                                                        |
| 133 | + $url = substr($url, 0, 50); // Max length for a title in URL  | 
                                                        |
| 134 | + return urlencode($url);  | 
                                                        |
| 135 | + }  | 
                                                        |
| 136 | 136 | |
| 137 | - /**  | 
                                                        |
| 138 | - * Get the topics post count or the forums post/topic count based on permissions  | 
                                                        |
| 139 | - *  | 
                                                        |
| 140 | - * @param $mode string One of topic_posts, forum_posts or forum_topics  | 
                                                        |
| 141 | - * @param $data array Array with the topic/forum data to calculate from  | 
                                                        |
| 142 | - * @param $forum_id int The forum id is used for permission checks  | 
                                                        |
| 143 | - * @return int Number of posts/topics the user can see in the topic/forum  | 
                                                        |
| 144 | - */  | 
                                                        |
| 145 | - public function get_count($mode, $data, $forum_id)  | 
                                                        |
| 146 | -	{ | 
                                                        |
| 147 | -		if (!$this->auth->acl_get('m_approve', $forum_id)) | 
                                                        |
| 148 | -		{ | 
                                                        |
| 149 | - return (int) $data[$mode . '_approved'];  | 
                                                        |
| 150 | - }  | 
                                                        |
| 137 | + /**  | 
                                                        |
| 138 | + * Get the topics post count or the forums post/topic count based on permissions  | 
                                                        |
| 139 | + *  | 
                                                        |
| 140 | + * @param $mode string One of topic_posts, forum_posts or forum_topics  | 
                                                        |
| 141 | + * @param $data array Array with the topic/forum data to calculate from  | 
                                                        |
| 142 | + * @param $forum_id int The forum id is used for permission checks  | 
                                                        |
| 143 | + * @return int Number of posts/topics the user can see in the topic/forum  | 
                                                        |
| 144 | + */  | 
                                                        |
| 145 | + public function get_count($mode, $data, $forum_id)  | 
                                                        |
| 146 | +    { | 
                                                        |
| 147 | +        if (!$this->auth->acl_get('m_approve', $forum_id)) | 
                                                        |
| 148 | +        { | 
                                                        |
| 149 | + return (int) $data[$mode . '_approved'];  | 
                                                        |
| 150 | + }  | 
                                                        |
| 151 | 151 | |
| 152 | - return (int) $data[$mode . '_approved'] + (int) $data[$mode . '_unapproved'] + (int) $data[$mode . '_softdeleted'];  | 
                                                        |
| 153 | - }  | 
                                                        |
| 152 | + return (int) $data[$mode . '_approved'] + (int) $data[$mode . '_unapproved'] + (int) $data[$mode . '_softdeleted'];  | 
                                                        |
| 153 | + }  | 
                                                        |
| 154 | 154 | }  | 
                                                        
@@ -71,8 +71,7 @@  | 
                                                    ||
| 71 | 71 | if (isset($row['topic_id']))  | 
                                                        
| 72 | 72 |  			{ | 
                                                        
| 73 | 73 | $url_data[$id]['url'] = $this->base->generate_topic_link($row['forum_id'], $row['forum_name'], $row['topic_id'], $row['topic_title'], $data['start'], true);  | 
                                                        
| 74 | - }  | 
                                                        |
| 75 | - else if (isset($row['forum_id']))  | 
                                                        |
| 74 | + } else if (isset($row['forum_id']))  | 
                                                        |
| 76 | 75 |  			{ | 
                                                        
| 77 | 76 | $url_data[$id]['url'] = $this->base->generate_forum_link($row['forum_id'], $row['forum_name'], $data['start'], true);  | 
                                                        
| 78 | 77 | }  | 
                                                        
@@ -16,133 +16,133 @@  | 
                                                    ||
| 16 | 16 | */  | 
                                                        
| 17 | 17 | class extensions implements EventSubscriberInterface  | 
                                                        
| 18 | 18 |  { | 
                                                        
| 19 | - /** @var \tas2580\seourls\event\base */  | 
                                                        |
| 20 | - protected $base;  | 
                                                        |
| 19 | + /** @var \tas2580\seourls\event\base */  | 
                                                        |
| 20 | + protected $base;  | 
                                                        |
| 21 | 21 | |
| 22 | - /**  | 
                                                        |
| 23 | - * Constructor  | 
                                                        |
| 24 | - *  | 
                                                        |
| 25 | - * @param \tas2580\seourls\event\base $base  | 
                                                        |
| 26 | - * @access public  | 
                                                        |
| 27 | - */  | 
                                                        |
| 28 | - public function __construct(\tas2580\seourls\event\base $base)  | 
                                                        |
| 29 | -	{ | 
                                                        |
| 30 | - $this->base = $base;  | 
                                                        |
| 31 | - }  | 
                                                        |
| 22 | + /**  | 
                                                        |
| 23 | + * Constructor  | 
                                                        |
| 24 | + *  | 
                                                        |
| 25 | + * @param \tas2580\seourls\event\base $base  | 
                                                        |
| 26 | + * @access public  | 
                                                        |
| 27 | + */  | 
                                                        |
| 28 | + public function __construct(\tas2580\seourls\event\base $base)  | 
                                                        |
| 29 | +    { | 
                                                        |
| 30 | + $this->base = $base;  | 
                                                        |
| 31 | + }  | 
                                                        |
| 32 | 32 | |
| 33 | - /**  | 
                                                        |
| 34 | - * Assign functions defined in this class to event listeners in the core  | 
                                                        |
| 35 | - *  | 
                                                        |
| 36 | - * @return array  | 
                                                        |
| 37 | - * @static  | 
                                                        |
| 38 | - * @access public  | 
                                                        |
| 39 | - */  | 
                                                        |
| 40 | - public static function getSubscribedEvents()  | 
                                                        |
| 41 | -	{ | 
                                                        |
| 42 | - return array(  | 
                                                        |
| 43 | - 'rmcgirr83.topfive.sql_pull_topics_data' => 'topfive_sql_pull_topics_data',  | 
                                                        |
| 44 | - 'rmcgirr83.topfive.modify_tpl_ary' => 'topfive_modify_tpl_ary',  | 
                                                        |
| 45 | - 'tas2580.sitemap.modify_before_output' => 'sitemap_modify_before_output',  | 
                                                        |
| 46 | - 'vse.similartopics.modify_topicrow' => 'similartopics_modify_topicrow',  | 
                                                        |
| 47 | - 'paybas.recenttopics.modify_tpl_ary' => 'recenttopics_modify_tpl_ary'  | 
                                                        |
| 48 | - );  | 
                                                        |
| 49 | - }  | 
                                                        |
| 33 | + /**  | 
                                                        |
| 34 | + * Assign functions defined in this class to event listeners in the core  | 
                                                        |
| 35 | + *  | 
                                                        |
| 36 | + * @return array  | 
                                                        |
| 37 | + * @static  | 
                                                        |
| 38 | + * @access public  | 
                                                        |
| 39 | + */  | 
                                                        |
| 40 | + public static function getSubscribedEvents()  | 
                                                        |
| 41 | +    { | 
                                                        |
| 42 | + return array(  | 
                                                        |
| 43 | + 'rmcgirr83.topfive.sql_pull_topics_data' => 'topfive_sql_pull_topics_data',  | 
                                                        |
| 44 | + 'rmcgirr83.topfive.modify_tpl_ary' => 'topfive_modify_tpl_ary',  | 
                                                        |
| 45 | + 'tas2580.sitemap.modify_before_output' => 'sitemap_modify_before_output',  | 
                                                        |
| 46 | + 'vse.similartopics.modify_topicrow' => 'similartopics_modify_topicrow',  | 
                                                        |
| 47 | + 'paybas.recenttopics.modify_tpl_ary' => 'recenttopics_modify_tpl_ary'  | 
                                                        |
| 48 | + );  | 
                                                        |
| 49 | + }  | 
                                                        |
| 50 | 50 | |
| 51 | - public function recenttopics_modify_tpl_ary($event)  | 
                                                        |
| 52 | -	{ | 
                                                        |
| 53 | - $tpl_ary = $event['tpl_ary'];  | 
                                                        |
| 54 | - $u_view_topic = $this->base->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']);  | 
                                                        |
| 55 | - $tpl_ary['U_VIEW_TOPIC'] = append_sid($u_view_topic);  | 
                                                        |
| 56 | - $tpl_ary['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($tpl_ary['REPLIES'], $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 57 | - $tpl_ary['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($event['row']['forum_id'], $event['row']['forum_name']));  | 
                                                        |
| 58 | - $tpl_ary['U_NEWEST_POST'] = $u_view_topic . '?view=unread#unread';  | 
                                                        |
| 51 | + public function recenttopics_modify_tpl_ary($event)  | 
                                                        |
| 52 | +    { | 
                                                        |
| 53 | + $tpl_ary = $event['tpl_ary'];  | 
                                                        |
| 54 | + $u_view_topic = $this->base->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']);  | 
                                                        |
| 55 | + $tpl_ary['U_VIEW_TOPIC'] = append_sid($u_view_topic);  | 
                                                        |
| 56 | + $tpl_ary['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($tpl_ary['REPLIES'], $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 57 | + $tpl_ary['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($event['row']['forum_id'], $event['row']['forum_name']));  | 
                                                        |
| 58 | + $tpl_ary['U_NEWEST_POST'] = $u_view_topic . '?view=unread#unread';  | 
                                                        |
| 59 | 59 | |
| 60 | - $event['tpl_ary'] = $tpl_ary;  | 
                                                        |
| 61 | - }  | 
                                                        |
| 60 | + $event['tpl_ary'] = $tpl_ary;  | 
                                                        |
| 61 | + }  | 
                                                        |
| 62 | 62 | |
| 63 | - /**  | 
                                                        |
| 64 | - * Rewrite URLs in tas2580 Sitemap Extension  | 
                                                        |
| 65 | - *  | 
                                                        |
| 66 | - * @param object $event The event object  | 
                                                        |
| 67 | - * @return null  | 
                                                        |
| 68 | - * @access public  | 
                                                        |
| 69 | - */  | 
                                                        |
| 70 | - public function sitemap_modify_before_output($event)  | 
                                                        |
| 71 | -	{ | 
                                                        |
| 72 | - // Nothing to rewrite in the sitemap index  | 
                                                        |
| 73 | - if ($event['type'] == 'sitemapindex')  | 
                                                        |
| 74 | -		{ | 
                                                        |
| 75 | - return;  | 
                                                        |
| 76 | - }  | 
                                                        |
| 63 | + /**  | 
                                                        |
| 64 | + * Rewrite URLs in tas2580 Sitemap Extension  | 
                                                        |
| 65 | + *  | 
                                                        |
| 66 | + * @param object $event The event object  | 
                                                        |
| 67 | + * @return null  | 
                                                        |
| 68 | + * @access public  | 
                                                        |
| 69 | + */  | 
                                                        |
| 70 | + public function sitemap_modify_before_output($event)  | 
                                                        |
| 71 | +    { | 
                                                        |
| 72 | + // Nothing to rewrite in the sitemap index  | 
                                                        |
| 73 | + if ($event['type'] == 'sitemapindex')  | 
                                                        |
| 74 | +        { | 
                                                        |
| 75 | + return;  | 
                                                        |
| 76 | + }  | 
                                                        |
| 77 | 77 | |
| 78 | - $url_data =$event['url_data'] ;  | 
                                                        |
| 78 | + $url_data =$event['url_data'] ;  | 
                                                        |
| 79 | 79 | |
| 80 | - foreach ($url_data as $id => $data)  | 
                                                        |
| 81 | -		{ | 
                                                        |
| 82 | - $row = $data['row'];  | 
                                                        |
| 83 | - if (isset($row['topic_id']))  | 
                                                        |
| 84 | -			{ | 
                                                        |
| 85 | - $url_data[$id]['url'] = $this->base->generate_topic_link($row['forum_id'], $row['forum_name'], $row['topic_id'], $row['topic_title'], $data['start'], true);  | 
                                                        |
| 86 | - }  | 
                                                        |
| 87 | - else if (isset($row['forum_id']))  | 
                                                        |
| 88 | -			{ | 
                                                        |
| 89 | - $url_data[$id]['url'] = $this->base->generate_forum_link($row['forum_id'], $row['forum_name'], $data['start'], true);  | 
                                                        |
| 90 | - }  | 
                                                        |
| 91 | - }  | 
                                                        |
| 80 | + foreach ($url_data as $id => $data)  | 
                                                        |
| 81 | +        { | 
                                                        |
| 82 | + $row = $data['row'];  | 
                                                        |
| 83 | + if (isset($row['topic_id']))  | 
                                                        |
| 84 | +            { | 
                                                        |
| 85 | + $url_data[$id]['url'] = $this->base->generate_topic_link($row['forum_id'], $row['forum_name'], $row['topic_id'], $row['topic_title'], $data['start'], true);  | 
                                                        |
| 86 | + }  | 
                                                        |
| 87 | + else if (isset($row['forum_id']))  | 
                                                        |
| 88 | +            { | 
                                                        |
| 89 | + $url_data[$id]['url'] = $this->base->generate_forum_link($row['forum_id'], $row['forum_name'], $data['start'], true);  | 
                                                        |
| 90 | + }  | 
                                                        |
| 91 | + }  | 
                                                        |
| 92 | 92 | |
| 93 | - $event['url_data'] = $url_data;  | 
                                                        |
| 94 | - }  | 
                                                        |
| 93 | + $event['url_data'] = $url_data;  | 
                                                        |
| 94 | + }  | 
                                                        |
| 95 | 95 | |
| 96 | - /**  | 
                                                        |
| 97 | - * Rewrite URLs in Similar Topics Extension  | 
                                                        |
| 98 | - *  | 
                                                        |
| 99 | - * @param object $event The event object  | 
                                                        |
| 100 | - * @return null  | 
                                                        |
| 101 | - * @access public  | 
                                                        |
| 102 | - */  | 
                                                        |
| 103 | - public function similartopics_modify_topicrow($event)  | 
                                                        |
| 104 | -	{ | 
                                                        |
| 105 | - $this->forum_title = $event['row']['forum_name'];  | 
                                                        |
| 106 | - $this->forum_id = $event['row']['forum_id'];  | 
                                                        |
| 107 | - $this->topic_title = $event['row']['topic_title'];  | 
                                                        |
| 108 | - $this->topic_id = $event['row']['topic_id'];  | 
                                                        |
| 96 | + /**  | 
                                                        |
| 97 | + * Rewrite URLs in Similar Topics Extension  | 
                                                        |
| 98 | + *  | 
                                                        |
| 99 | + * @param object $event The event object  | 
                                                        |
| 100 | + * @return null  | 
                                                        |
| 101 | + * @access public  | 
                                                        |
| 102 | + */  | 
                                                        |
| 103 | + public function similartopics_modify_topicrow($event)  | 
                                                        |
| 104 | +    { | 
                                                        |
| 105 | + $this->forum_title = $event['row']['forum_name'];  | 
                                                        |
| 106 | + $this->forum_id = $event['row']['forum_id'];  | 
                                                        |
| 107 | + $this->topic_title = $event['row']['topic_title'];  | 
                                                        |
| 108 | + $this->topic_id = $event['row']['topic_id'];  | 
                                                        |
| 109 | 109 | |
| 110 | - $topic_row = $event['topic_row'];  | 
                                                        |
| 111 | - $u_view_topic= $this->base->generate_topic_link($this->forum_id, $this->forum_title, $this->topic_id, $this->topic_title);  | 
                                                        |
| 112 | - $topic_row['U_VIEW_TOPIC'] = append_sid($u_view_topic);  | 
                                                        |
| 113 | - $topic_row['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($this->forum_id, $this->forum_title));  | 
                                                        |
| 114 | - $topic_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($topic_row['TOPIC_REPLIES'], $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 115 | - $event['topic_row'] = $topic_row;  | 
                                                        |
| 116 | - }  | 
                                                        |
| 110 | + $topic_row = $event['topic_row'];  | 
                                                        |
| 111 | + $u_view_topic= $this->base->generate_topic_link($this->forum_id, $this->forum_title, $this->topic_id, $this->topic_title);  | 
                                                        |
| 112 | + $topic_row['U_VIEW_TOPIC'] = append_sid($u_view_topic);  | 
                                                        |
| 113 | + $topic_row['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($this->forum_id, $this->forum_title));  | 
                                                        |
| 114 | + $topic_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($topic_row['TOPIC_REPLIES'], $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 115 | + $event['topic_row'] = $topic_row;  | 
                                                        |
| 116 | + }  | 
                                                        |
| 117 | 117 | |
| 118 | - /**  | 
                                                        |
| 119 | - * Rewrite URLs in Top 5 Extension  | 
                                                        |
| 120 | - *  | 
                                                        |
| 121 | - * @param object $event The event object  | 
                                                        |
| 122 | - * @return null  | 
                                                        |
| 123 | - * @access public  | 
                                                        |
| 124 | - */  | 
                                                        |
| 125 | - public function topfive_sql_pull_topics_data($event)  | 
                                                        |
| 126 | -	{ | 
                                                        |
| 127 | - $sql_array = $event['sql_array'];  | 
                                                        |
| 128 | -		$sql_array['SELECT'] = array_merge($sql_array, array('SELECT' => 'f.forum_name')); | 
                                                        |
| 129 | -		$sql_array['LEFT_JOIN'] = array_merge($sql_array['LEFT_JOIN'], array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'f.forum_id = t.forum_id')); | 
                                                        |
| 130 | - $event['sql_array'] = $sql_array;  | 
                                                        |
| 131 | - }  | 
                                                        |
| 118 | + /**  | 
                                                        |
| 119 | + * Rewrite URLs in Top 5 Extension  | 
                                                        |
| 120 | + *  | 
                                                        |
| 121 | + * @param object $event The event object  | 
                                                        |
| 122 | + * @return null  | 
                                                        |
| 123 | + * @access public  | 
                                                        |
| 124 | + */  | 
                                                        |
| 125 | + public function topfive_sql_pull_topics_data($event)  | 
                                                        |
| 126 | +    { | 
                                                        |
| 127 | + $sql_array = $event['sql_array'];  | 
                                                        |
| 128 | +        $sql_array['SELECT'] = array_merge($sql_array, array('SELECT' => 'f.forum_name')); | 
                                                        |
| 129 | +        $sql_array['LEFT_JOIN'] = array_merge($sql_array['LEFT_JOIN'], array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'f.forum_id = t.forum_id')); | 
                                                        |
| 130 | + $event['sql_array'] = $sql_array;  | 
                                                        |
| 131 | + }  | 
                                                        |
| 132 | 132 | |
| 133 | - /**  | 
                                                        |
| 134 | - * Rewrite URLs in Top 5 Extension  | 
                                                        |
| 135 | - *  | 
                                                        |
| 136 | - * @param object $event The event object  | 
                                                        |
| 137 | - * @return null  | 
                                                        |
| 138 | - * @access public  | 
                                                        |
| 139 | - */  | 
                                                        |
| 140 | - public function topfive_modify_tpl_ary($event)  | 
                                                        |
| 141 | -	{ | 
                                                        |
| 142 | - $tpl_ary = $event['tpl_ary'];  | 
                                                        |
| 143 | -		$replies = $this->base->get_count('topic_posts', $event['row'], $event['row']['forum_id']) - 1; | 
                                                        |
| 144 | - $u_view_topic = $this->base->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']);  | 
                                                        |
| 145 | - $tpl_ary['U_TOPIC'] = append_sid($this->base->generate_lastpost_link($replies, $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 146 | - $event['tpl_ary'] = $tpl_ary;  | 
                                                        |
| 147 | - }  | 
                                                        |
| 133 | + /**  | 
                                                        |
| 134 | + * Rewrite URLs in Top 5 Extension  | 
                                                        |
| 135 | + *  | 
                                                        |
| 136 | + * @param object $event The event object  | 
                                                        |
| 137 | + * @return null  | 
                                                        |
| 138 | + * @access public  | 
                                                        |
| 139 | + */  | 
                                                        |
| 140 | + public function topfive_modify_tpl_ary($event)  | 
                                                        |
| 141 | +    { | 
                                                        |
| 142 | + $tpl_ary = $event['tpl_ary'];  | 
                                                        |
| 143 | +        $replies = $this->base->get_count('topic_posts', $event['row'], $event['row']['forum_id']) - 1; | 
                                                        |
| 144 | + $u_view_topic = $this->base->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']);  | 
                                                        |
| 145 | + $tpl_ary['U_TOPIC'] = append_sid($this->base->generate_lastpost_link($replies, $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 146 | + $event['tpl_ary'] = $tpl_ary;  | 
                                                        |
| 147 | + }  | 
                                                        |
| 148 | 148 | }  | 
                                                        
@@ -53,9 +53,9 @@ discard block  | 
                                                    ||
| 53 | 53 | $tpl_ary = $event['tpl_ary'];  | 
                                                        
| 54 | 54 | $u_view_topic = $this->base->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']);  | 
                                                        
| 55 | 55 | $tpl_ary['U_VIEW_TOPIC'] = append_sid($u_view_topic);  | 
                                                        
| 56 | - $tpl_ary['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($tpl_ary['REPLIES'], $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 56 | + $tpl_ary['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($tpl_ary['REPLIES'], $u_view_topic).'#p'.$event['row']['topic_last_post_id']);  | 
                                                        |
| 57 | 57 | $tpl_ary['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($event['row']['forum_id'], $event['row']['forum_name']));  | 
                                                        
| 58 | - $tpl_ary['U_NEWEST_POST'] = $u_view_topic . '?view=unread#unread';  | 
                                                        |
| 58 | + $tpl_ary['U_NEWEST_POST'] = $u_view_topic.'?view=unread#unread';  | 
                                                        |
| 59 | 59 | |
| 60 | 60 | $event['tpl_ary'] = $tpl_ary;  | 
                                                        
| 61 | 61 | }  | 
                                                        
@@ -75,14 +75,14 @@ discard block  | 
                                                    ||
| 75 | 75 | return;  | 
                                                        
| 76 | 76 | }  | 
                                                        
| 77 | 77 | |
| 78 | - $url_data =$event['url_data'] ;  | 
                                                        |
| 78 | + $url_data = $event['url_data'];  | 
                                                        |
| 79 | 79 | |
| 80 | 80 | foreach ($url_data as $id => $data)  | 
                                                        
| 81 | 81 |  		{ | 
                                                        
| 82 | 82 | $row = $data['row'];  | 
                                                        
| 83 | 83 | if (isset($row['topic_id']))  | 
                                                        
| 84 | 84 |  			{ | 
                                                        
| 85 | - $url_data[$id]['url'] = $this->base->generate_topic_link($row['forum_id'], $row['forum_name'], $row['topic_id'], $row['topic_title'], $data['start'], true);  | 
                                                        |
| 85 | + $url_data[$id]['url'] = $this->base->generate_topic_link($row['forum_id'], $row['forum_name'], $row['topic_id'], $row['topic_title'], $data['start'], true);  | 
                                                        |
| 86 | 86 | }  | 
                                                        
| 87 | 87 | else if (isset($row['forum_id']))  | 
                                                        
| 88 | 88 |  			{ | 
                                                        
@@ -108,10 +108,10 @@ discard block  | 
                                                    ||
| 108 | 108 | $this->topic_id = $event['row']['topic_id'];  | 
                                                        
| 109 | 109 | |
| 110 | 110 | $topic_row = $event['topic_row'];  | 
                                                        
| 111 | - $u_view_topic= $this->base->generate_topic_link($this->forum_id, $this->forum_title, $this->topic_id, $this->topic_title);  | 
                                                        |
| 111 | + $u_view_topic = $this->base->generate_topic_link($this->forum_id, $this->forum_title, $this->topic_id, $this->topic_title);  | 
                                                        |
| 112 | 112 | $topic_row['U_VIEW_TOPIC'] = append_sid($u_view_topic);  | 
                                                        
| 113 | 113 | $topic_row['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($this->forum_id, $this->forum_title));  | 
                                                        
| 114 | - $topic_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($topic_row['TOPIC_REPLIES'], $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 114 | + $topic_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($topic_row['TOPIC_REPLIES'], $u_view_topic).'#p'.$event['row']['topic_last_post_id']);  | 
                                                        |
| 115 | 115 | $event['topic_row'] = $topic_row;  | 
                                                        
| 116 | 116 | }  | 
                                                        
| 117 | 117 | |
@@ -142,7 +142,7 @@ discard block  | 
                                                    ||
| 142 | 142 | $tpl_ary = $event['tpl_ary'];  | 
                                                        
| 143 | 143 |  		$replies = $this->base->get_count('topic_posts', $event['row'], $event['row']['forum_id']) - 1; | 
                                                        
| 144 | 144 | $u_view_topic = $this->base->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']);  | 
                                                        
| 145 | - $tpl_ary['U_TOPIC'] = append_sid($this->base->generate_lastpost_link($replies, $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 145 | + $tpl_ary['U_TOPIC'] = append_sid($this->base->generate_lastpost_link($replies, $u_view_topic).'#p'.$event['row']['topic_last_post_id']);  | 
                                                        |
| 146 | 146 | $event['tpl_ary'] = $tpl_ary;  | 
                                                        
| 147 | 147 | }  | 
                                                        
| 148 | 148 | }  | 
                                                        
@@ -5,16 +5,16 @@  | 
                                                    ||
| 5 | 5 | */  | 
                                                        
| 6 | 6 | class phpbb_functional_test extends \tas2580\seourls\tests\base\functional_test  | 
                                                        
| 7 | 7 |  { | 
                                                        
| 8 | - public function test_version_check()  | 
                                                        |
| 9 | -	{ | 
                                                        |
| 10 | - // Log in to the ACP  | 
                                                        |
| 11 | - $this->login();  | 
                                                        |
| 12 | - $this->admin_login();  | 
                                                        |
| 13 | -		$this->add_lang('acp/extensions'); | 
                                                        |
| 14 | - // Load the Pages extension details  | 
                                                        |
| 15 | -		$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=tas2580%2Fseourls&sid=' . $this->sid); | 
                                                        |
| 16 | - // Assert extension is up to date  | 
                                                        |
| 17 | -		$this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); | 
                                                        |
| 18 | -		$this->assertContains($this->lang('UP_TO_DATE', 'SEO URLs'), $crawler->text()); | 
                                                        |
| 19 | - }  | 
                                                        |
| 8 | + public function test_version_check()  | 
                                                        |
| 9 | +    { | 
                                                        |
| 10 | + // Log in to the ACP  | 
                                                        |
| 11 | + $this->login();  | 
                                                        |
| 12 | + $this->admin_login();  | 
                                                        |
| 13 | +        $this->add_lang('acp/extensions'); | 
                                                        |
| 14 | + // Load the Pages extension details  | 
                                                        |
| 15 | +        $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=tas2580%2Fseourls&sid=' . $this->sid); | 
                                                        |
| 16 | + // Assert extension is up to date  | 
                                                        |
| 17 | +        $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); | 
                                                        |
| 18 | +        $this->assertContains($this->lang('UP_TO_DATE', 'SEO URLs'), $crawler->text()); | 
                                                        |
| 19 | + }  | 
                                                        |
| 20 | 20 | }  | 
                                                        
@@ -12,7 +12,7 @@  | 
                                                    ||
| 12 | 12 | $this->admin_login();  | 
                                                        
| 13 | 13 |  		$this->add_lang('acp/extensions'); | 
                                                        
| 14 | 14 | // Load the Pages extension details  | 
                                                        
| 15 | -		$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=tas2580%2Fseourls&sid=' . $this->sid); | 
                                                        |
| 15 | +		$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=tas2580%2Fseourls&sid='.$this->sid); | 
                                                        |
| 16 | 16 | // Assert extension is up to date  | 
                                                        
| 17 | 17 |  		$this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); | 
                                                        
| 18 | 18 |  		$this->assertContains($this->lang('UP_TO_DATE', 'SEO URLs'), $crawler->text()); | 
                                                        
@@ -256,8 +256,7 @@  | 
                                                    ||
| 256 | 256 | if (!empty($this->topic_data) && isset($param['f']) && isset($param['t']))  | 
                                                        
| 257 | 257 |  		{ | 
                                                        
| 258 | 258 | $event['generate_page_link_override'] = append_sid($this->base->generate_topic_link($this->topic_data['forum_id'], $this->topic_data['forum_name'], $this->topic_data['topic_id'], $this->topic_data['topic_title'], $start));  | 
                                                        
| 259 | - }  | 
                                                        |
| 260 | - else if (!empty($this->forum_data) && isset($param['f']))  | 
                                                        |
| 259 | + } else if (!empty($this->forum_data) && isset($param['f']))  | 
                                                        |
| 261 | 260 |  		{ | 
                                                        
| 262 | 261 | $event['generate_page_link_override'] = append_sid($this->base->generate_forum_link($this->forum_data['forum_id'], $this->forum_data['forum_name'], $start));  | 
                                                        
| 263 | 262 | }  | 
                                                        
@@ -75,7 +75,7 @@ discard block  | 
                                                    ||
| 75 | 75 | 'core.display_forums_modify_forum_rows' => 'display_forums_modify_forum_rows',  | 
                                                        
| 76 | 76 | 'core.display_forums_modify_category_template_vars' => 'display_forums_modify_category_template_vars',  | 
                                                        
| 77 | 77 | 'core.generate_forum_nav' => 'generate_forum_nav',  | 
                                                        
| 78 | - 'core.make_jumpbox_modify_tpl_ary' => 'make_jumpbox_modify_tpl_ary', // Not in phpBB  | 
                                                        |
| 78 | + 'core.make_jumpbox_modify_tpl_ary' => 'make_jumpbox_modify_tpl_ary', // Not in phpBB  | 
                                                        |
| 79 | 79 | 'core.memberlist_view_profile' => 'memberlist_view_profile',  | 
                                                        
| 80 | 80 | 'core.pagination_generate_page_link' => 'pagination_generate_page_link',  | 
                                                        
| 81 | 81 | 'core.search_modify_tpl_ary' => 'search_modify_tpl_ary',  | 
                                                        
@@ -98,9 +98,9 @@ discard block  | 
                                                    ||
| 98 | 98 | */  | 
                                                        
| 99 | 99 | public function append_sid($event)  | 
                                                        
| 100 | 100 |  	{ | 
                                                        
| 101 | -		if ($this->in_viewtopic && preg_match('#./../viewtopic.' . $this->php_ext  . '#', $event['url'])) | 
                                                        |
| 101 | +		if ($this->in_viewtopic && preg_match('#./../viewtopic.'.$this->php_ext.'#', $event['url'])) | 
                                                        |
| 102 | 102 |  		{ | 
                                                        
| 103 | - $url = '../viewtopic.' . $this->php_ext ;  | 
                                                        |
| 103 | + $url = '../viewtopic.'.$this->php_ext;  | 
                                                        |
| 104 | 104 | $event['url'] = $url;  | 
                                                        
| 105 | 105 | }  | 
                                                        
| 106 | 106 | if (isset($event['params']['redirect']))  | 
                                                        
@@ -141,9 +141,9 @@ discard block  | 
                                                    ||
| 141 | 141 | $forum_rows = $event['forum_rows'];  | 
                                                        
| 142 | 142 | if ($event['row']['forum_last_post_time'] == $forum_rows[$event['parent_id']]['forum_last_post_time'])  | 
                                                        
| 143 | 143 |  		{ | 
                                                        
| 144 | - $forum_rows[$event['parent_id']]['forum_name_last_post'] =$event['row']['forum_name'];  | 
                                                        |
| 145 | - $forum_rows[$event['parent_id']]['topic_id_last_post'] =$event['row']['topic_id'];  | 
                                                        |
| 146 | - $forum_rows[$event['parent_id']]['topic_title_last_post'] =$event['row']['topic_title'];  | 
                                                        |
| 144 | + $forum_rows[$event['parent_id']]['forum_name_last_post'] = $event['row']['forum_name'];  | 
                                                        |
| 145 | + $forum_rows[$event['parent_id']]['topic_id_last_post'] = $event['row']['topic_id'];  | 
                                                        |
| 146 | + $forum_rows[$event['parent_id']]['topic_title_last_post'] = $event['row']['topic_title'];  | 
                                                        |
| 147 | 147 | $event['forum_rows'] = $forum_rows;  | 
                                                        
| 148 | 148 | }  | 
                                                        
| 149 | 149 | }  | 
                                                        
@@ -172,14 +172,14 @@ discard block  | 
                                                    ||
| 172 | 172 | |
| 173 | 173 | // Update the image source in forums  | 
                                                        
| 174 | 174 | $img = $this->path_helper->update_web_root_path($forum_row['FORUM_IMAGE_SRC']);  | 
                                                        
| 175 | -		$forum_row['FORUM_IMAGE'] = preg_replace('#img src=\"(.*)\" alt#', 'img src="' . $img . '" alt', $forum_row['FORUM_IMAGE']); | 
                                                        |
| 175 | +		$forum_row['FORUM_IMAGE'] = preg_replace('#img src=\"(.*)\" alt#', 'img src="'.$img.'" alt', $forum_row['FORUM_IMAGE']); | 
                                                        |
| 176 | 176 | |
| 177 | 177 | // Rewrite links to topics, posts and forums  | 
                                                        
| 178 | 178 |  		$replies = $this->base->get_count('topic_posts', $event['row'], $event['row']['forum_id']) - 1; | 
                                                        
| 179 | 179 | $url = $this->base->generate_topic_link($event['row']['forum_id_last_post'], $event['row']['forum_name_last_post'], $event['row']['topic_id_last_post'], $event['row']['topic_title_last_post']);  | 
                                                        
| 180 | - $forum_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($replies, $url) . '#p' . $event['row']['forum_last_post_id']);  | 
                                                        |
| 180 | + $forum_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($replies, $url).'#p'.$event['row']['forum_last_post_id']);  | 
                                                        |
| 181 | 181 | $forum_row['U_VIEWFORUM'] = append_sid($this->base->generate_forum_link($forum_row['FORUM_ID'], $forum_row['FORUM_NAME']));  | 
                                                        
| 182 | - $forum_row['U_NEWEST_POST'] = $url . '?view=unread#unread';  | 
                                                        |
| 182 | + $forum_row['U_NEWEST_POST'] = $url.'?view=unread#unread';  | 
                                                        |
| 183 | 183 | |
| 184 | 184 | $event['subforums_row'] = $subforums_row;  | 
                                                        
| 185 | 185 | $event['forum_row'] = $forum_row;  | 
                                                        
@@ -215,7 +215,7 @@ discard block  | 
                                                    ||
| 215 | 215 | |
| 216 | 216 | foreach ($navlinks_parents as $id => $data)  | 
                                                        
| 217 | 217 |  		{ | 
                                                        
| 218 | - $navlinks_parents[$id]['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($data['FORUM_ID'] , $data['FORUM_NAME']));  | 
                                                        |
| 218 | + $navlinks_parents[$id]['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($data['FORUM_ID'], $data['FORUM_NAME']));  | 
                                                        |
| 219 | 219 | }  | 
                                                        
| 220 | 220 | |
| 221 | 221 | $navlinks['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($forum_data['forum_id'], $forum_data['forum_name']));  | 
                                                        
@@ -230,7 +230,7 @@ discard block  | 
                                                    ||
| 230 | 230 | $row = $event['row'];  | 
                                                        
| 231 | 231 | foreach ($tpl_ary as $id => $data)  | 
                                                        
| 232 | 232 |  		{ | 
                                                        
| 233 | - $tpl_ary[$id]['LINK'] = append_sid($this->base->generate_forum_link($row['forum_id'], $row['forum_name']));  | 
                                                        |
| 233 | + $tpl_ary[$id]['LINK'] = append_sid($this->base->generate_forum_link($row['forum_id'], $row['forum_name']));  | 
                                                        |
| 234 | 234 | }  | 
                                                        
| 235 | 235 | |
| 236 | 236 | $event['tpl_ary'] = $tpl_ary;  | 
                                                        
@@ -293,10 +293,10 @@ discard block  | 
                                                    ||
| 293 | 293 | $u_view_topic = $this->base->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']);  | 
                                                        
| 294 | 294 | |
| 295 | 295 | $tpl_ary = $event['tpl_ary'];  | 
                                                        
| 296 | - $tpl_ary['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($replies, $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 296 | + $tpl_ary['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($replies, $u_view_topic).'#p'.$event['row']['topic_last_post_id']);  | 
                                                        |
| 297 | 297 | $tpl_ary['U_VIEW_TOPIC'] = append_sid($u_view_topic);  | 
                                                        
| 298 | 298 | $tpl_ary['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($event['row']['forum_id'], $event['row']['forum_name']));  | 
                                                        
| 299 | - $tpl_ary['U_NEWEST_POST'] = $u_view_topic . '?view=unread#unread';  | 
                                                        |
| 299 | + $tpl_ary['U_NEWEST_POST'] = $u_view_topic.'?view=unread#unread';  | 
                                                        |
| 300 | 300 | |
| 301 | 301 | $event['tpl_ary'] = $tpl_ary;  | 
                                                        
| 302 | 302 | }  | 
                                                        
@@ -323,8 +323,8 @@ discard block  | 
                                                    ||
| 323 | 323 | $u_view_topic = $this->base->generate_topic_link($topic_row['FORUM_ID'], $topic_row['FORUM_NAME'], $topic_row['TOPIC_ID'], $topic_row['TOPIC_TITLE']);  | 
                                                        
| 324 | 324 | $topic_row['U_VIEW_TOPIC'] = append_sid($u_view_topic);  | 
                                                        
| 325 | 325 | $topic_row['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($topic_row['FORUM_ID'], $topic_row['FORUM_NAME']));  | 
                                                        
| 326 | - $topic_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($event['topic_row']['REPLIES'], $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 327 | - $topic_row['U_NEWEST_POST'] = $u_view_topic . '?view=unread#unread';  | 
                                                        |
| 326 | + $topic_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($event['topic_row']['REPLIES'], $u_view_topic).'#p'.$event['row']['topic_last_post_id']);  | 
                                                        |
| 327 | + $topic_row['U_NEWEST_POST'] = $u_view_topic.'?view=unread#unread';  | 
                                                        |
| 328 | 328 | |
| 329 | 329 | $event['topic_row'] = $topic_row;  | 
                                                        
| 330 | 330 | }  | 
                                                        
@@ -362,9 +362,9 @@ discard block  | 
                                                    ||
| 362 | 362 |  	{ | 
                                                        
| 363 | 363 | $data = $event['topic_data'];  | 
                                                        
| 364 | 364 | $this->template->assign_vars(array(  | 
                                                        
| 365 | - 'U_VIEW_TOPIC' => append_sid($this->base->generate_topic_link($event['forum_id'] , $data['forum_name'], $event['topic_id'], $data['topic_title'], $event['start'])),  | 
                                                        |
| 366 | - 'U_VIEW_FORUM' => append_sid($this->base->generate_forum_link($event['forum_id'] , $data['forum_name'])),  | 
                                                        |
| 367 | - 'S_POLL_ACTION' => append_sid($this->base->generate_topic_link($event['forum_id'] , $data['forum_name'], $event['topic_id'], $data['topic_title'], $event['start'])),  | 
                                                        |
| 365 | + 'U_VIEW_TOPIC' => append_sid($this->base->generate_topic_link($event['forum_id'], $data['forum_name'], $event['topic_id'], $data['topic_title'], $event['start'])),  | 
                                                        |
| 366 | + 'U_VIEW_FORUM' => append_sid($this->base->generate_forum_link($event['forum_id'], $data['forum_name'])),  | 
                                                        |
| 367 | + 'S_POLL_ACTION' => append_sid($this->base->generate_topic_link($event['forum_id'], $data['forum_name'], $event['topic_id'], $data['topic_title'], $event['start'])),  | 
                                                        |
| 368 | 368 | ));  | 
                                                        
| 369 | 369 | }  | 
                                                        
| 370 | 370 | |
@@ -419,7 +419,7 @@ discard block  | 
                                                    ||
| 419 | 419 | $row = $event['post_row'];  | 
                                                        
| 420 | 420 |  		$start = $this->request->variable('start', 0); | 
                                                        
| 421 | 421 | $data = $event['topic_data'];  | 
                                                        
| 422 | - $row['U_MINI_POST'] = append_sid($this->base->generate_topic_link($data['forum_id'], $data['forum_name'], $data['topic_id'], $data['topic_title'], $start) . '#p' . $event['row']['post_id']);  | 
                                                        |
| 422 | + $row['U_MINI_POST'] = append_sid($this->base->generate_topic_link($data['forum_id'], $data['forum_name'], $data['topic_id'], $data['topic_title'], $start).'#p'.$event['row']['post_id']);  | 
                                                        |
| 423 | 423 | $event['post_row'] = $row;  | 
                                                        
| 424 | 424 | }  | 
                                                        
| 425 | 425 | }  | 
                                                        
@@ -16,408 +16,408 @@  | 
                                                    ||
| 16 | 16 | */  | 
                                                        
| 17 | 17 | class listener implements EventSubscriberInterface  | 
                                                        
| 18 | 18 |  { | 
                                                        
| 19 | - /** @var \tas2580\seourls\event\base */  | 
                                                        |
| 20 | - protected $base;  | 
                                                        |
| 21 | -  | 
                                                        |
| 22 | - /** @var \phpbb\template\template */  | 
                                                        |
| 23 | - protected $template;  | 
                                                        |
| 24 | -  | 
                                                        |
| 25 | - /** @var \phpbb\request\request */  | 
                                                        |
| 26 | - protected $request;  | 
                                                        |
| 27 | -  | 
                                                        |
| 28 | - /** @var \phpbb\path_helper */  | 
                                                        |
| 29 | - protected $path_helper;  | 
                                                        |
| 30 | -  | 
                                                        |
| 31 | - /** @var string phpbb_root_path */  | 
                                                        |
| 32 | - protected $phpbb_root_path;  | 
                                                        |
| 33 | -  | 
                                                        |
| 34 | - /** @var string php_ext */  | 
                                                        |
| 35 | - protected $php_ext;  | 
                                                        |
| 36 | -  | 
                                                        |
| 37 | - /**  | 
                                                        |
| 38 | - * Constructor  | 
                                                        |
| 39 | - *  | 
                                                        |
| 40 | - * @param \tas2580\seourls\event\base $base  | 
                                                        |
| 41 | - * @param \phpbb\template\template $template Template object  | 
                                                        |
| 42 | - * @param \phpbb\request\request $request Request object  | 
                                                        |
| 43 | - * @param \phpbb\path_helper $path_helper Controller helper object  | 
                                                        |
| 44 | - * @param string $phpbb_root_path phpbb_root_path  | 
                                                        |
| 45 | - * @param string $php_ext php_ext  | 
                                                        |
| 46 | - * @access public  | 
                                                        |
| 47 | - */  | 
                                                        |
| 48 | - public function __construct(\tas2580\seourls\event\base $base, \phpbb\template\template $template, \phpbb\request\request $request, \phpbb\path_helper $path_helper, $phpbb_root_path, $php_ext)  | 
                                                        |
| 49 | -	{ | 
                                                        |
| 50 | - $this->base = $base;  | 
                                                        |
| 51 | - $this->template = $template;  | 
                                                        |
| 52 | - $this->request = $request;  | 
                                                        |
| 53 | - $this->path_helper = $path_helper;  | 
                                                        |
| 54 | - $this->phpbb_root_path = $phpbb_root_path;  | 
                                                        |
| 55 | - $this->php_ext = $php_ext;  | 
                                                        |
| 56 | -  | 
                                                        |
| 57 | - $this->in_viewtopic = false;  | 
                                                        |
| 58 | - }  | 
                                                        |
| 59 | -  | 
                                                        |
| 60 | - /**  | 
                                                        |
| 61 | - * Assign functions defined in this class to event listeners in the core  | 
                                                        |
| 62 | - *  | 
                                                        |
| 63 | - * @return array  | 
                                                        |
| 64 | - * @static  | 
                                                        |
| 65 | - * @access public  | 
                                                        |
| 66 | - */  | 
                                                        |
| 67 | - public static function getSubscribedEvents()  | 
                                                        |
| 68 | -	{ | 
                                                        |
| 69 | - return array(  | 
                                                        |
| 70 | - 'core.append_sid' => 'append_sid',  | 
                                                        |
| 71 | - 'core.display_forums_modify_sql' => 'display_forums_modify_sql',  | 
                                                        |
| 72 | - 'core.display_forums_modify_template_vars' => 'display_forums_modify_template_vars',  | 
                                                        |
| 73 | - 'core.display_forums_modify_forum_rows' => 'display_forums_modify_forum_rows',  | 
                                                        |
| 74 | - 'core.display_forums_modify_category_template_vars' => 'display_forums_modify_category_template_vars',  | 
                                                        |
| 75 | - 'core.generate_forum_nav' => 'generate_forum_nav',  | 
                                                        |
| 76 | - 'core.make_jumpbox_modify_tpl_ary' => 'make_jumpbox_modify_tpl_ary', // Not in phpBB  | 
                                                        |
| 77 | - 'core.memberlist_view_profile' => 'memberlist_view_profile',  | 
                                                        |
| 78 | - 'core.pagination_generate_page_link' => 'pagination_generate_page_link',  | 
                                                        |
| 79 | - 'core.search_modify_tpl_ary' => 'search_modify_tpl_ary',  | 
                                                        |
| 80 | - 'core.viewforum_modify_topicrow' => 'viewforum_modify_topicrow',  | 
                                                        |
| 81 | - 'core.viewforum_get_topic_data' => 'viewforum_get_topic_data',  | 
                                                        |
| 82 | - 'core.viewtopic_assign_template_vars_before' => 'viewtopic_assign_template_vars_before',  | 
                                                        |
| 83 | - 'core.viewtopic_before_f_read_check' => 'viewtopic_before_f_read_check',  | 
                                                        |
| 84 | - 'core.viewtopic_modify_page_title' => 'viewtopic_modify_page_title',  | 
                                                        |
| 85 | - 'core.viewtopic_modify_post_row' => 'viewtopic_modify_post_row',  | 
                                                        |
| 86 | - 'core.viewtopic_get_post_data' => 'viewtopic_get_post_data',  | 
                                                        |
| 87 | - );  | 
                                                        |
| 88 | - }  | 
                                                        |
| 89 | -  | 
                                                        |
| 90 | - /**  | 
                                                        |
| 91 | - * Correct the path of $viewtopic_url  | 
                                                        |
| 92 | - *  | 
                                                        |
| 93 | - * @param object $event The event object  | 
                                                        |
| 94 | - * @return null  | 
                                                        |
| 95 | - * @access public  | 
                                                        |
| 96 | - */  | 
                                                        |
| 97 | - public function append_sid($event)  | 
                                                        |
| 98 | -	{ | 
                                                        |
| 99 | -		if ($this->in_viewtopic && preg_match('#./../viewtopic.' . $this->php_ext  . '#', $event['url'])) | 
                                                        |
| 100 | -		{ | 
                                                        |
| 101 | - $url = '../viewtopic.' . $this->php_ext ;  | 
                                                        |
| 102 | - $event['url'] = $url;  | 
                                                        |
| 103 | - }  | 
                                                        |
| 104 | - if (isset($event['params']['redirect']))  | 
                                                        |
| 105 | -		{ | 
                                                        |
| 106 | - $params = $event['params'];  | 
                                                        |
| 107 | -			$params['redirect'] = str_replace('..', '.', $event['params']['redirect']); | 
                                                        |
| 108 | - $event['params'] = $params;  | 
                                                        |
| 109 | - }  | 
                                                        |
| 110 | - }  | 
                                                        |
| 111 | -  | 
                                                        |
| 112 | - /**  | 
                                                        |
| 113 | - * Get informations for the last post from Database  | 
                                                        |
| 114 | - *  | 
                                                        |
| 115 | - * @param object $event The event object  | 
                                                        |
| 116 | - * @return null  | 
                                                        |
| 117 | - * @access public  | 
                                                        |
| 118 | - */  | 
                                                        |
| 119 | - public function display_forums_modify_sql($event)  | 
                                                        |
| 120 | -	{ | 
                                                        |
| 121 | - $sql_array = $event['sql_ary'];  | 
                                                        |
| 122 | - $sql_array['LEFT_JOIN'][] = array(  | 
                                                        |
| 123 | - 'FROM' => array(TOPICS_TABLE => 't'),  | 
                                                        |
| 124 | - 'ON' => "f.forum_last_post_id = t.topic_last_post_id"  | 
                                                        |
| 125 | - );  | 
                                                        |
| 126 | - $sql_array['SELECT'] .= ', t.topic_title, t.topic_id, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted';  | 
                                                        |
| 127 | - $event['sql_ary'] = $sql_array;  | 
                                                        |
| 128 | - }  | 
                                                        |
| 129 | -  | 
                                                        |
| 130 | - /**  | 
                                                        |
| 131 | - * Store informations for the last post in forum_rows array  | 
                                                        |
| 132 | - *  | 
                                                        |
| 133 | - * @param object $event The event object  | 
                                                        |
| 134 | - * @return null  | 
                                                        |
| 135 | - * @access public  | 
                                                        |
| 136 | - */  | 
                                                        |
| 137 | - public function display_forums_modify_forum_rows($event)  | 
                                                        |
| 138 | -	{ | 
                                                        |
| 139 | - $forum_rows = $event['forum_rows'];  | 
                                                        |
| 140 | - if ($event['row']['forum_last_post_time'] == $forum_rows[$event['parent_id']]['forum_last_post_time'])  | 
                                                        |
| 141 | -		{ | 
                                                        |
| 142 | - $forum_rows[$event['parent_id']]['forum_name_last_post'] =$event['row']['forum_name'];  | 
                                                        |
| 143 | - $forum_rows[$event['parent_id']]['topic_id_last_post'] =$event['row']['topic_id'];  | 
                                                        |
| 144 | - $forum_rows[$event['parent_id']]['topic_title_last_post'] =$event['row']['topic_title'];  | 
                                                        |
| 145 | - $event['forum_rows'] = $forum_rows;  | 
                                                        |
| 146 | - }  | 
                                                        |
| 147 | - }  | 
                                                        |
| 148 | -  | 
                                                        |
| 149 | - /**  | 
                                                        |
| 150 | - * Rewrite links to forums and subforums in forum index  | 
                                                        |
| 151 | - * also correct the path of the forum images if we are in a forum  | 
                                                        |
| 152 | - *  | 
                                                        |
| 153 | - * @param object $event The event object  | 
                                                        |
| 154 | - * @return null  | 
                                                        |
| 155 | - * @access public  | 
                                                        |
| 156 | - */  | 
                                                        |
| 157 | - public function display_forums_modify_template_vars($event)  | 
                                                        |
| 158 | -	{ | 
                                                        |
| 159 | - $subforums_row = $event['subforums_row'];  | 
                                                        |
| 160 | - $forum_row = $event['forum_row'];  | 
                                                        |
| 161 | -  | 
                                                        |
| 162 | - // Rewrite URLs of sub forums  | 
                                                        |
| 163 | - foreach ($subforums_row as $i => $subforum)  | 
                                                        |
| 164 | -		{ | 
                                                        |
| 165 | - // A little bit a dirty way, but there is no better solution  | 
                                                        |
| 166 | -			$query = str_replace('&', '&', parse_url($subforum['U_SUBFORUM'], PHP_URL_QUERY)); | 
                                                        |
| 167 | - parse_str($query, $id);  | 
                                                        |
| 168 | - $subforums_row[$i]['U_SUBFORUM'] = append_sid($this->base->generate_forum_link($id['f'], $subforum['SUBFORUM_NAME']));  | 
                                                        |
| 169 | - }  | 
                                                        |
| 170 | -  | 
                                                        |
| 171 | - // Update the image source in forums  | 
                                                        |
| 172 | - $img = $this->path_helper->update_web_root_path($forum_row['FORUM_IMAGE_SRC']);  | 
                                                        |
| 173 | -		$forum_row['FORUM_IMAGE'] = preg_replace('#img src=\"(.*)\" alt#', 'img src="' . $img . '" alt', $forum_row['FORUM_IMAGE']); | 
                                                        |
| 174 | -  | 
                                                        |
| 175 | - // Rewrite links to topics, posts and forums  | 
                                                        |
| 176 | -		$replies = $this->base->get_count('topic_posts', $event['row'], $event['row']['forum_id']) - 1; | 
                                                        |
| 177 | - $url = $this->base->generate_topic_link($event['row']['forum_id_last_post'], $event['row']['forum_name_last_post'], $event['row']['topic_id_last_post'], $event['row']['topic_title_last_post']);  | 
                                                        |
| 178 | - $forum_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($replies, $url) . '#p' . $event['row']['forum_last_post_id']);  | 
                                                        |
| 179 | - $forum_row['U_VIEWFORUM'] = append_sid($this->base->generate_forum_link($forum_row['FORUM_ID'], $forum_row['FORUM_NAME']));  | 
                                                        |
| 180 | - $forum_row['U_NEWEST_POST'] = $url . '?view=unread#unread';  | 
                                                        |
| 181 | -  | 
                                                        |
| 182 | - $event['subforums_row'] = $subforums_row;  | 
                                                        |
| 183 | - $event['forum_row'] = $forum_row;  | 
                                                        |
| 184 | - }  | 
                                                        |
| 185 | -  | 
                                                        |
| 186 | - /**  | 
                                                        |
| 187 | - * Rewrite the categorie links  | 
                                                        |
| 188 | - *  | 
                                                        |
| 189 | - * @param object $event The event object  | 
                                                        |
| 190 | - * @return null  | 
                                                        |
| 191 | - * @access public  | 
                                                        |
| 192 | - */  | 
                                                        |
| 193 | - public function display_forums_modify_category_template_vars($event)  | 
                                                        |
| 194 | -	{ | 
                                                        |
| 195 | - $cat_row = $event['cat_row'];  | 
                                                        |
| 196 | - $row = $event['row'];  | 
                                                        |
| 197 | - $cat_row['U_VIEWFORUM'] = append_sid($this->base->generate_forum_link($row['forum_id'], $row['forum_name']));  | 
                                                        |
| 198 | - $event['cat_row'] = $cat_row;  | 
                                                        |
| 199 | - }  | 
                                                        |
| 200 | -  | 
                                                        |
| 201 | - /**  | 
                                                        |
| 202 | - * Rewrite links in breadcrumbs  | 
                                                        |
| 203 | - *  | 
                                                        |
| 204 | - * @param object $event The event object  | 
                                                        |
| 205 | - * @return null  | 
                                                        |
| 206 | - * @access public  | 
                                                        |
| 207 | - */  | 
                                                        |
| 208 | - public function generate_forum_nav($event)  | 
                                                        |
| 209 | -	{ | 
                                                        |
| 210 | - $forum_data = $event['forum_data'];  | 
                                                        |
| 211 | - $navlinks = $event['navlinks'];  | 
                                                        |
| 212 | - $navlinks_parents = $event['navlinks_parents'];  | 
                                                        |
| 213 | -  | 
                                                        |
| 214 | - foreach ($navlinks_parents as $id => $data)  | 
                                                        |
| 215 | -		{ | 
                                                        |
| 216 | - $navlinks_parents[$id]['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($data['FORUM_ID'] , $data['FORUM_NAME']));  | 
                                                        |
| 217 | - }  | 
                                                        |
| 218 | -  | 
                                                        |
| 219 | - $navlinks['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($forum_data['forum_id'], $forum_data['forum_name']));  | 
                                                        |
| 220 | - $event['navlinks'] = $navlinks;  | 
                                                        |
| 221 | - $event['navlinks_parents'] = $navlinks_parents;  | 
                                                        |
| 222 | - }  | 
                                                        |
| 223 | -  | 
                                                        |
| 224 | - // Not in phpBB  | 
                                                        |
| 225 | - public function make_jumpbox_modify_tpl_ary($event)  | 
                                                        |
| 226 | -	{ | 
                                                        |
| 227 | - $tpl_ary = $event['tpl_ary'];  | 
                                                        |
| 228 | - $row = $event['row'];  | 
                                                        |
| 229 | - foreach ($tpl_ary as $id => $data)  | 
                                                        |
| 230 | -		{ | 
                                                        |
| 231 | - $tpl_ary[$id]['LINK'] = append_sid($this->base->generate_forum_link($row['forum_id'], $row['forum_name']));  | 
                                                        |
| 232 | - }  | 
                                                        |
| 233 | -  | 
                                                        |
| 234 | - $event['tpl_ary'] = $tpl_ary;  | 
                                                        |
| 235 | - }  | 
                                                        |
| 236 | -  | 
                                                        |
| 237 | - /**  | 
                                                        |
| 238 | - * Rewrite links to most active forum and topic on profile page  | 
                                                        |
| 239 | - *  | 
                                                        |
| 240 | - * @param object $event The event object  | 
                                                        |
| 241 | - * @return null  | 
                                                        |
| 242 | - * @access public  | 
                                                        |
| 243 | - */  | 
                                                        |
| 244 | - public function memberlist_view_profile($event)  | 
                                                        |
| 245 | -	{ | 
                                                        |
| 246 | - $data = $event['member'];  | 
                                                        |
| 247 | - $this->template->assign_vars(array(  | 
                                                        |
| 248 | - 'U_ACTIVE_FORUM' => $this->base->generate_forum_link($data['active_f_row']['forum_id'], $data['active_f_row']['forum_name'], 0, true),  | 
                                                        |
| 249 | - 'U_ACTIVE_TOPIC' => $this->base->generate_topic_link($data['active_f_row']['forum_id'], $data['active_f_row']['forum_name'], $data['active_t_row']['topic_id'], $data['active_t_row']['topic_title'], 0, true),  | 
                                                        |
| 250 | - ));  | 
                                                        |
| 251 | - }  | 
                                                        |
| 252 | -  | 
                                                        |
| 253 | - /**  | 
                                                        |
| 254 | - * Rewrite pagination links  | 
                                                        |
| 255 | - *  | 
                                                        |
| 256 | - * @param object $event The event object  | 
                                                        |
| 257 | - * @return null  | 
                                                        |
| 258 | - * @access public  | 
                                                        |
| 259 | - */  | 
                                                        |
| 260 | - public function pagination_generate_page_link($event)  | 
                                                        |
| 261 | -	{ | 
                                                        |
| 262 | - // If we have a sort key we do not rewrite the URL  | 
                                                        |
| 263 | -		$query = str_replace('&', '&', parse_url($event['base_url'], PHP_URL_QUERY)); | 
                                                        |
| 264 | - parse_str($query, $param);  | 
                                                        |
| 265 | - if (isset($param['sd']) || isset($param['sk']) || isset($param['st']))  | 
                                                        |
| 266 | -		{ | 
                                                        |
| 267 | - return;  | 
                                                        |
| 268 | - }  | 
                                                        |
| 269 | -  | 
                                                        |
| 270 | - $start = (($event['on_page'] - 1) * $event['per_page']);  | 
                                                        |
| 271 | - if (!empty($this->topic_data) && isset($param['f']) && isset($param['t']))  | 
                                                        |
| 272 | -		{ | 
                                                        |
| 273 | - $event['generate_page_link_override'] = append_sid($this->base->generate_topic_link($this->topic_data['forum_id'], $this->topic_data['forum_name'], $this->topic_data['topic_id'], $this->topic_data['topic_title'], $start));  | 
                                                        |
| 274 | - }  | 
                                                        |
| 275 | - else if (!empty($this->forum_data) && isset($param['f']))  | 
                                                        |
| 276 | -		{ | 
                                                        |
| 277 | - $event['generate_page_link_override'] = append_sid($this->base->generate_forum_link($this->forum_data['forum_id'], $this->forum_data['forum_name'], $start));  | 
                                                        |
| 278 | - }  | 
                                                        |
| 279 | - }  | 
                                                        |
| 280 | -  | 
                                                        |
| 281 | - /**  | 
                                                        |
| 282 | - * Rewrite links in the search result  | 
                                                        |
| 283 | - *  | 
                                                        |
| 284 | - * @param object $event The event object  | 
                                                        |
| 285 | - * @return null  | 
                                                        |
| 286 | - * @access public  | 
                                                        |
| 287 | - */  | 
                                                        |
| 288 | - public function search_modify_tpl_ary($event)  | 
                                                        |
| 289 | -	{ | 
                                                        |
| 290 | -		$replies = $this->base->get_count('topic_posts', $event['row'], $event['row']['forum_id']) - 1; | 
                                                        |
| 291 | - $u_view_topic = $this->base->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']);  | 
                                                        |
| 292 | -  | 
                                                        |
| 293 | - $tpl_ary = $event['tpl_ary'];  | 
                                                        |
| 294 | - $tpl_ary['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($replies, $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 295 | - $tpl_ary['U_VIEW_TOPIC'] = append_sid($u_view_topic);  | 
                                                        |
| 296 | - $tpl_ary['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($event['row']['forum_id'], $event['row']['forum_name']));  | 
                                                        |
| 297 | - $tpl_ary['U_NEWEST_POST'] = $u_view_topic . '?view=unread#unread';  | 
                                                        |
| 298 | -  | 
                                                        |
| 299 | - $event['tpl_ary'] = $tpl_ary;  | 
                                                        |
| 300 | - }  | 
                                                        |
| 301 | -  | 
                                                        |
| 302 | - /**  | 
                                                        |
| 303 | - * Rewrite links to topics in forum view  | 
                                                        |
| 304 | - *  | 
                                                        |
| 305 | - * @param object $event The event object  | 
                                                        |
| 306 | - * @return null  | 
                                                        |
| 307 | - * @access public  | 
                                                        |
| 308 | - */  | 
                                                        |
| 309 | - public function viewforum_modify_topicrow($event)  | 
                                                        |
| 310 | -	{ | 
                                                        |
| 311 | - // assign to be used in pagination_generate_page_link  | 
                                                        |
| 312 | - $this->topic_data = array(  | 
                                                        |
| 313 | - 'forum_id' => $event['topic_row']['FORUM_ID'],  | 
                                                        |
| 314 | - 'forum_name' => $event['topic_row']['FORUM_NAME'],  | 
                                                        |
| 315 | - 'topic_id' => $event['topic_row']['TOPIC_ID'],  | 
                                                        |
| 316 | - 'topic_title' => $event['topic_row']['TOPIC_TITLE']  | 
                                                        |
| 317 | - );  | 
                                                        |
| 318 | -  | 
                                                        |
| 319 | - $topic_row = $event['topic_row'];  | 
                                                        |
| 320 | -  | 
                                                        |
| 321 | - $u_view_topic = $this->base->generate_topic_link($topic_row['FORUM_ID'], $topic_row['FORUM_NAME'], $topic_row['TOPIC_ID'], $topic_row['TOPIC_TITLE']);  | 
                                                        |
| 322 | - $topic_row['U_VIEW_TOPIC'] = append_sid($u_view_topic);  | 
                                                        |
| 323 | - $topic_row['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($topic_row['FORUM_ID'], $topic_row['FORUM_NAME']));  | 
                                                        |
| 324 | - $topic_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($event['topic_row']['REPLIES'], $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 325 | - $topic_row['U_NEWEST_POST'] = $u_view_topic . '?view=unread#unread';  | 
                                                        |
| 326 | -  | 
                                                        |
| 327 | - $event['topic_row'] = $topic_row;  | 
                                                        |
| 328 | - }  | 
                                                        |
| 329 | -  | 
                                                        |
| 330 | - /**  | 
                                                        |
| 331 | - * Rewrite the canonical URL on viewforum.php  | 
                                                        |
| 332 | - *  | 
                                                        |
| 333 | - * @param object $event The event object  | 
                                                        |
| 334 | - * @return null  | 
                                                        |
| 335 | - * @access public  | 
                                                        |
| 336 | - */  | 
                                                        |
| 337 | - public function viewforum_get_topic_data($event)  | 
                                                        |
| 338 | -	{ | 
                                                        |
| 339 | - // assign to be used in pagination_generate_page_link  | 
                                                        |
| 340 | - $this->forum_data = array(  | 
                                                        |
| 341 | - 'forum_id' => $event['forum_data']['forum_id'],  | 
                                                        |
| 342 | - 'forum_name' => $event['forum_data']['forum_name']  | 
                                                        |
| 343 | - );  | 
                                                        |
| 344 | -  | 
                                                        |
| 345 | -		$start = $this->request->variable('start', 0); | 
                                                        |
| 346 | - $this->template->assign_vars(array(  | 
                                                        |
| 347 | - 'U_VIEW_FORUM' => append_sid($this->base->generate_forum_link($event['forum_data']['forum_id'], $event['forum_data']['forum_name'], $start)),  | 
                                                        |
| 348 | - 'U_CANONICAL' => $this->base->generate_forum_link($event['forum_data']['forum_id'], $event['forum_data']['forum_name'], $start, true),  | 
                                                        |
| 349 | - ));  | 
                                                        |
| 350 | - }  | 
                                                        |
| 351 | -  | 
                                                        |
| 352 | - /**  | 
                                                        |
| 353 | - * Rewrite the topic URL for the headline of the topic page and the link back to forum  | 
                                                        |
| 354 | - *  | 
                                                        |
| 355 | - * @param object $event The event object  | 
                                                        |
| 356 | - * @return null  | 
                                                        |
| 357 | - * @access public  | 
                                                        |
| 358 | - */  | 
                                                        |
| 359 | - public function viewtopic_get_post_data($event)  | 
                                                        |
| 360 | -	{ | 
                                                        |
| 361 | - $data = $event['topic_data'];  | 
                                                        |
| 362 | - $this->template->assign_vars(array(  | 
                                                        |
| 363 | - 'U_VIEW_TOPIC' => append_sid($this->base->generate_topic_link($event['forum_id'] , $data['forum_name'], $event['topic_id'], $data['topic_title'], $event['start'])),  | 
                                                        |
| 364 | - 'U_VIEW_FORUM' => append_sid($this->base->generate_forum_link($event['forum_id'] , $data['forum_name'])),  | 
                                                        |
| 365 | - 'S_POLL_ACTION' => append_sid($this->base->generate_topic_link($event['forum_id'] , $data['forum_name'], $event['topic_id'], $data['topic_title'], $event['start'])),  | 
                                                        |
| 366 | - ));  | 
                                                        |
| 367 | - }  | 
                                                        |
| 368 | -  | 
                                                        |
| 369 | - /**  | 
                                                        |
| 370 | - * Assign topic data to global variables for pagination  | 
                                                        |
| 371 | - *  | 
                                                        |
| 372 | - * @param object $event The event object  | 
                                                        |
| 373 | - * @return null  | 
                                                        |
| 374 | - * @access public  | 
                                                        |
| 375 | - */  | 
                                                        |
| 376 | - public function viewtopic_assign_template_vars_before($event)  | 
                                                        |
| 377 | -	{ | 
                                                        |
| 378 | - // assign to be used in pagination_generate_page_link  | 
                                                        |
| 379 | - $this->topic_data = array(  | 
                                                        |
| 380 | - 'forum_id' => $event['topic_data']['forum_id'],  | 
                                                        |
| 381 | - 'forum_name' => $event['topic_data']['forum_name'],  | 
                                                        |
| 382 | - 'topic_id' => $event['topic_data']['topic_id'],  | 
                                                        |
| 383 | - 'topic_title' => $event['topic_data']['topic_title']  | 
                                                        |
| 384 | - );  | 
                                                        |
| 385 | - }  | 
                                                        |
| 386 | -  | 
                                                        |
| 387 | - public function viewtopic_before_f_read_check()  | 
                                                        |
| 388 | -	{ | 
                                                        |
| 389 | - $this->in_viewtopic = true;  | 
                                                        |
| 390 | - }  | 
                                                        |
| 391 | -  | 
                                                        |
| 392 | - /**  | 
                                                        |
| 393 | - * Rewrite the canonical URL on viewtopic.php  | 
                                                        |
| 394 | - *  | 
                                                        |
| 395 | - * @param object $event The event object  | 
                                                        |
| 396 | - * @return null  | 
                                                        |
| 397 | - * @access public  | 
                                                        |
| 398 | - */  | 
                                                        |
| 399 | - public function viewtopic_modify_page_title($event)  | 
                                                        |
| 400 | -	{ | 
                                                        |
| 401 | -		$start = $this->request->variable('start', 0); | 
                                                        |
| 402 | - $data = $event['topic_data'];  | 
                                                        |
| 403 | - $this->template->assign_vars(array(  | 
                                                        |
| 404 | - 'U_CANONICAL' => $this->base->generate_topic_link($data['forum_id'], $data['forum_name'], $data['topic_id'], $data['topic_title'], $start, true),  | 
                                                        |
| 405 | - ));  | 
                                                        |
| 406 | - }  | 
                                                        |
| 407 | -  | 
                                                        |
| 408 | - /**  | 
                                                        |
| 409 | - * Rewrite mini post img link  | 
                                                        |
| 410 | - *  | 
                                                        |
| 411 | - * @param object $event The event object  | 
                                                        |
| 412 | - * @return null  | 
                                                        |
| 413 | - * @access public  | 
                                                        |
| 414 | - */  | 
                                                        |
| 415 | - public function viewtopic_modify_post_row($event)  | 
                                                        |
| 416 | -	{ | 
                                                        |
| 417 | - $row = $event['post_row'];  | 
                                                        |
| 418 | -		$start = $this->request->variable('start', 0); | 
                                                        |
| 419 | - $data = $event['topic_data'];  | 
                                                        |
| 420 | - $row['U_MINI_POST'] = append_sid($this->base->generate_topic_link($data['forum_id'], $data['forum_name'], $data['topic_id'], $data['topic_title'], $start) . '#p' . $event['row']['post_id']);  | 
                                                        |
| 421 | - $event['post_row'] = $row;  | 
                                                        |
| 422 | - }  | 
                                                        |
| 19 | + /** @var \tas2580\seourls\event\base */  | 
                                                        |
| 20 | + protected $base;  | 
                                                        |
| 21 | +  | 
                                                        |
| 22 | + /** @var \phpbb\template\template */  | 
                                                        |
| 23 | + protected $template;  | 
                                                        |
| 24 | +  | 
                                                        |
| 25 | + /** @var \phpbb\request\request */  | 
                                                        |
| 26 | + protected $request;  | 
                                                        |
| 27 | +  | 
                                                        |
| 28 | + /** @var \phpbb\path_helper */  | 
                                                        |
| 29 | + protected $path_helper;  | 
                                                        |
| 30 | +  | 
                                                        |
| 31 | + /** @var string phpbb_root_path */  | 
                                                        |
| 32 | + protected $phpbb_root_path;  | 
                                                        |
| 33 | +  | 
                                                        |
| 34 | + /** @var string php_ext */  | 
                                                        |
| 35 | + protected $php_ext;  | 
                                                        |
| 36 | +  | 
                                                        |
| 37 | + /**  | 
                                                        |
| 38 | + * Constructor  | 
                                                        |
| 39 | + *  | 
                                                        |
| 40 | + * @param \tas2580\seourls\event\base $base  | 
                                                        |
| 41 | + * @param \phpbb\template\template $template Template object  | 
                                                        |
| 42 | + * @param \phpbb\request\request $request Request object  | 
                                                        |
| 43 | + * @param \phpbb\path_helper $path_helper Controller helper object  | 
                                                        |
| 44 | + * @param string $phpbb_root_path phpbb_root_path  | 
                                                        |
| 45 | + * @param string $php_ext php_ext  | 
                                                        |
| 46 | + * @access public  | 
                                                        |
| 47 | + */  | 
                                                        |
| 48 | + public function __construct(\tas2580\seourls\event\base $base, \phpbb\template\template $template, \phpbb\request\request $request, \phpbb\path_helper $path_helper, $phpbb_root_path, $php_ext)  | 
                                                        |
| 49 | +    { | 
                                                        |
| 50 | + $this->base = $base;  | 
                                                        |
| 51 | + $this->template = $template;  | 
                                                        |
| 52 | + $this->request = $request;  | 
                                                        |
| 53 | + $this->path_helper = $path_helper;  | 
                                                        |
| 54 | + $this->phpbb_root_path = $phpbb_root_path;  | 
                                                        |
| 55 | + $this->php_ext = $php_ext;  | 
                                                        |
| 56 | +  | 
                                                        |
| 57 | + $this->in_viewtopic = false;  | 
                                                        |
| 58 | + }  | 
                                                        |
| 59 | +  | 
                                                        |
| 60 | + /**  | 
                                                        |
| 61 | + * Assign functions defined in this class to event listeners in the core  | 
                                                        |
| 62 | + *  | 
                                                        |
| 63 | + * @return array  | 
                                                        |
| 64 | + * @static  | 
                                                        |
| 65 | + * @access public  | 
                                                        |
| 66 | + */  | 
                                                        |
| 67 | + public static function getSubscribedEvents()  | 
                                                        |
| 68 | +    { | 
                                                        |
| 69 | + return array(  | 
                                                        |
| 70 | + 'core.append_sid' => 'append_sid',  | 
                                                        |
| 71 | + 'core.display_forums_modify_sql' => 'display_forums_modify_sql',  | 
                                                        |
| 72 | + 'core.display_forums_modify_template_vars' => 'display_forums_modify_template_vars',  | 
                                                        |
| 73 | + 'core.display_forums_modify_forum_rows' => 'display_forums_modify_forum_rows',  | 
                                                        |
| 74 | + 'core.display_forums_modify_category_template_vars' => 'display_forums_modify_category_template_vars',  | 
                                                        |
| 75 | + 'core.generate_forum_nav' => 'generate_forum_nav',  | 
                                                        |
| 76 | + 'core.make_jumpbox_modify_tpl_ary' => 'make_jumpbox_modify_tpl_ary', // Not in phpBB  | 
                                                        |
| 77 | + 'core.memberlist_view_profile' => 'memberlist_view_profile',  | 
                                                        |
| 78 | + 'core.pagination_generate_page_link' => 'pagination_generate_page_link',  | 
                                                        |
| 79 | + 'core.search_modify_tpl_ary' => 'search_modify_tpl_ary',  | 
                                                        |
| 80 | + 'core.viewforum_modify_topicrow' => 'viewforum_modify_topicrow',  | 
                                                        |
| 81 | + 'core.viewforum_get_topic_data' => 'viewforum_get_topic_data',  | 
                                                        |
| 82 | + 'core.viewtopic_assign_template_vars_before' => 'viewtopic_assign_template_vars_before',  | 
                                                        |
| 83 | + 'core.viewtopic_before_f_read_check' => 'viewtopic_before_f_read_check',  | 
                                                        |
| 84 | + 'core.viewtopic_modify_page_title' => 'viewtopic_modify_page_title',  | 
                                                        |
| 85 | + 'core.viewtopic_modify_post_row' => 'viewtopic_modify_post_row',  | 
                                                        |
| 86 | + 'core.viewtopic_get_post_data' => 'viewtopic_get_post_data',  | 
                                                        |
| 87 | + );  | 
                                                        |
| 88 | + }  | 
                                                        |
| 89 | +  | 
                                                        |
| 90 | + /**  | 
                                                        |
| 91 | + * Correct the path of $viewtopic_url  | 
                                                        |
| 92 | + *  | 
                                                        |
| 93 | + * @param object $event The event object  | 
                                                        |
| 94 | + * @return null  | 
                                                        |
| 95 | + * @access public  | 
                                                        |
| 96 | + */  | 
                                                        |
| 97 | + public function append_sid($event)  | 
                                                        |
| 98 | +    { | 
                                                        |
| 99 | +        if ($this->in_viewtopic && preg_match('#./../viewtopic.' . $this->php_ext  . '#', $event['url'])) | 
                                                        |
| 100 | +        { | 
                                                        |
| 101 | + $url = '../viewtopic.' . $this->php_ext ;  | 
                                                        |
| 102 | + $event['url'] = $url;  | 
                                                        |
| 103 | + }  | 
                                                        |
| 104 | + if (isset($event['params']['redirect']))  | 
                                                        |
| 105 | +        { | 
                                                        |
| 106 | + $params = $event['params'];  | 
                                                        |
| 107 | +            $params['redirect'] = str_replace('..', '.', $event['params']['redirect']); | 
                                                        |
| 108 | + $event['params'] = $params;  | 
                                                        |
| 109 | + }  | 
                                                        |
| 110 | + }  | 
                                                        |
| 111 | +  | 
                                                        |
| 112 | + /**  | 
                                                        |
| 113 | + * Get informations for the last post from Database  | 
                                                        |
| 114 | + *  | 
                                                        |
| 115 | + * @param object $event The event object  | 
                                                        |
| 116 | + * @return null  | 
                                                        |
| 117 | + * @access public  | 
                                                        |
| 118 | + */  | 
                                                        |
| 119 | + public function display_forums_modify_sql($event)  | 
                                                        |
| 120 | +    { | 
                                                        |
| 121 | + $sql_array = $event['sql_ary'];  | 
                                                        |
| 122 | + $sql_array['LEFT_JOIN'][] = array(  | 
                                                        |
| 123 | + 'FROM' => array(TOPICS_TABLE => 't'),  | 
                                                        |
| 124 | + 'ON' => "f.forum_last_post_id = t.topic_last_post_id"  | 
                                                        |
| 125 | + );  | 
                                                        |
| 126 | + $sql_array['SELECT'] .= ', t.topic_title, t.topic_id, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted';  | 
                                                        |
| 127 | + $event['sql_ary'] = $sql_array;  | 
                                                        |
| 128 | + }  | 
                                                        |
| 129 | +  | 
                                                        |
| 130 | + /**  | 
                                                        |
| 131 | + * Store informations for the last post in forum_rows array  | 
                                                        |
| 132 | + *  | 
                                                        |
| 133 | + * @param object $event The event object  | 
                                                        |
| 134 | + * @return null  | 
                                                        |
| 135 | + * @access public  | 
                                                        |
| 136 | + */  | 
                                                        |
| 137 | + public function display_forums_modify_forum_rows($event)  | 
                                                        |
| 138 | +    { | 
                                                        |
| 139 | + $forum_rows = $event['forum_rows'];  | 
                                                        |
| 140 | + if ($event['row']['forum_last_post_time'] == $forum_rows[$event['parent_id']]['forum_last_post_time'])  | 
                                                        |
| 141 | +        { | 
                                                        |
| 142 | + $forum_rows[$event['parent_id']]['forum_name_last_post'] =$event['row']['forum_name'];  | 
                                                        |
| 143 | + $forum_rows[$event['parent_id']]['topic_id_last_post'] =$event['row']['topic_id'];  | 
                                                        |
| 144 | + $forum_rows[$event['parent_id']]['topic_title_last_post'] =$event['row']['topic_title'];  | 
                                                        |
| 145 | + $event['forum_rows'] = $forum_rows;  | 
                                                        |
| 146 | + }  | 
                                                        |
| 147 | + }  | 
                                                        |
| 148 | +  | 
                                                        |
| 149 | + /**  | 
                                                        |
| 150 | + * Rewrite links to forums and subforums in forum index  | 
                                                        |
| 151 | + * also correct the path of the forum images if we are in a forum  | 
                                                        |
| 152 | + *  | 
                                                        |
| 153 | + * @param object $event The event object  | 
                                                        |
| 154 | + * @return null  | 
                                                        |
| 155 | + * @access public  | 
                                                        |
| 156 | + */  | 
                                                        |
| 157 | + public function display_forums_modify_template_vars($event)  | 
                                                        |
| 158 | +    { | 
                                                        |
| 159 | + $subforums_row = $event['subforums_row'];  | 
                                                        |
| 160 | + $forum_row = $event['forum_row'];  | 
                                                        |
| 161 | +  | 
                                                        |
| 162 | + // Rewrite URLs of sub forums  | 
                                                        |
| 163 | + foreach ($subforums_row as $i => $subforum)  | 
                                                        |
| 164 | +        { | 
                                                        |
| 165 | + // A little bit a dirty way, but there is no better solution  | 
                                                        |
| 166 | +            $query = str_replace('&', '&', parse_url($subforum['U_SUBFORUM'], PHP_URL_QUERY)); | 
                                                        |
| 167 | + parse_str($query, $id);  | 
                                                        |
| 168 | + $subforums_row[$i]['U_SUBFORUM'] = append_sid($this->base->generate_forum_link($id['f'], $subforum['SUBFORUM_NAME']));  | 
                                                        |
| 169 | + }  | 
                                                        |
| 170 | +  | 
                                                        |
| 171 | + // Update the image source in forums  | 
                                                        |
| 172 | + $img = $this->path_helper->update_web_root_path($forum_row['FORUM_IMAGE_SRC']);  | 
                                                        |
| 173 | +        $forum_row['FORUM_IMAGE'] = preg_replace('#img src=\"(.*)\" alt#', 'img src="' . $img . '" alt', $forum_row['FORUM_IMAGE']); | 
                                                        |
| 174 | +  | 
                                                        |
| 175 | + // Rewrite links to topics, posts and forums  | 
                                                        |
| 176 | +        $replies = $this->base->get_count('topic_posts', $event['row'], $event['row']['forum_id']) - 1; | 
                                                        |
| 177 | + $url = $this->base->generate_topic_link($event['row']['forum_id_last_post'], $event['row']['forum_name_last_post'], $event['row']['topic_id_last_post'], $event['row']['topic_title_last_post']);  | 
                                                        |
| 178 | + $forum_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($replies, $url) . '#p' . $event['row']['forum_last_post_id']);  | 
                                                        |
| 179 | + $forum_row['U_VIEWFORUM'] = append_sid($this->base->generate_forum_link($forum_row['FORUM_ID'], $forum_row['FORUM_NAME']));  | 
                                                        |
| 180 | + $forum_row['U_NEWEST_POST'] = $url . '?view=unread#unread';  | 
                                                        |
| 181 | +  | 
                                                        |
| 182 | + $event['subforums_row'] = $subforums_row;  | 
                                                        |
| 183 | + $event['forum_row'] = $forum_row;  | 
                                                        |
| 184 | + }  | 
                                                        |
| 185 | +  | 
                                                        |
| 186 | + /**  | 
                                                        |
| 187 | + * Rewrite the categorie links  | 
                                                        |
| 188 | + *  | 
                                                        |
| 189 | + * @param object $event The event object  | 
                                                        |
| 190 | + * @return null  | 
                                                        |
| 191 | + * @access public  | 
                                                        |
| 192 | + */  | 
                                                        |
| 193 | + public function display_forums_modify_category_template_vars($event)  | 
                                                        |
| 194 | +    { | 
                                                        |
| 195 | + $cat_row = $event['cat_row'];  | 
                                                        |
| 196 | + $row = $event['row'];  | 
                                                        |
| 197 | + $cat_row['U_VIEWFORUM'] = append_sid($this->base->generate_forum_link($row['forum_id'], $row['forum_name']));  | 
                                                        |
| 198 | + $event['cat_row'] = $cat_row;  | 
                                                        |
| 199 | + }  | 
                                                        |
| 200 | +  | 
                                                        |
| 201 | + /**  | 
                                                        |
| 202 | + * Rewrite links in breadcrumbs  | 
                                                        |
| 203 | + *  | 
                                                        |
| 204 | + * @param object $event The event object  | 
                                                        |
| 205 | + * @return null  | 
                                                        |
| 206 | + * @access public  | 
                                                        |
| 207 | + */  | 
                                                        |
| 208 | + public function generate_forum_nav($event)  | 
                                                        |
| 209 | +    { | 
                                                        |
| 210 | + $forum_data = $event['forum_data'];  | 
                                                        |
| 211 | + $navlinks = $event['navlinks'];  | 
                                                        |
| 212 | + $navlinks_parents = $event['navlinks_parents'];  | 
                                                        |
| 213 | +  | 
                                                        |
| 214 | + foreach ($navlinks_parents as $id => $data)  | 
                                                        |
| 215 | +        { | 
                                                        |
| 216 | + $navlinks_parents[$id]['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($data['FORUM_ID'] , $data['FORUM_NAME']));  | 
                                                        |
| 217 | + }  | 
                                                        |
| 218 | +  | 
                                                        |
| 219 | + $navlinks['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($forum_data['forum_id'], $forum_data['forum_name']));  | 
                                                        |
| 220 | + $event['navlinks'] = $navlinks;  | 
                                                        |
| 221 | + $event['navlinks_parents'] = $navlinks_parents;  | 
                                                        |
| 222 | + }  | 
                                                        |
| 223 | +  | 
                                                        |
| 224 | + // Not in phpBB  | 
                                                        |
| 225 | + public function make_jumpbox_modify_tpl_ary($event)  | 
                                                        |
| 226 | +    { | 
                                                        |
| 227 | + $tpl_ary = $event['tpl_ary'];  | 
                                                        |
| 228 | + $row = $event['row'];  | 
                                                        |
| 229 | + foreach ($tpl_ary as $id => $data)  | 
                                                        |
| 230 | +        { | 
                                                        |
| 231 | + $tpl_ary[$id]['LINK'] = append_sid($this->base->generate_forum_link($row['forum_id'], $row['forum_name']));  | 
                                                        |
| 232 | + }  | 
                                                        |
| 233 | +  | 
                                                        |
| 234 | + $event['tpl_ary'] = $tpl_ary;  | 
                                                        |
| 235 | + }  | 
                                                        |
| 236 | +  | 
                                                        |
| 237 | + /**  | 
                                                        |
| 238 | + * Rewrite links to most active forum and topic on profile page  | 
                                                        |
| 239 | + *  | 
                                                        |
| 240 | + * @param object $event The event object  | 
                                                        |
| 241 | + * @return null  | 
                                                        |
| 242 | + * @access public  | 
                                                        |
| 243 | + */  | 
                                                        |
| 244 | + public function memberlist_view_profile($event)  | 
                                                        |
| 245 | +    { | 
                                                        |
| 246 | + $data = $event['member'];  | 
                                                        |
| 247 | + $this->template->assign_vars(array(  | 
                                                        |
| 248 | + 'U_ACTIVE_FORUM' => $this->base->generate_forum_link($data['active_f_row']['forum_id'], $data['active_f_row']['forum_name'], 0, true),  | 
                                                        |
| 249 | + 'U_ACTIVE_TOPIC' => $this->base->generate_topic_link($data['active_f_row']['forum_id'], $data['active_f_row']['forum_name'], $data['active_t_row']['topic_id'], $data['active_t_row']['topic_title'], 0, true),  | 
                                                        |
| 250 | + ));  | 
                                                        |
| 251 | + }  | 
                                                        |
| 252 | +  | 
                                                        |
| 253 | + /**  | 
                                                        |
| 254 | + * Rewrite pagination links  | 
                                                        |
| 255 | + *  | 
                                                        |
| 256 | + * @param object $event The event object  | 
                                                        |
| 257 | + * @return null  | 
                                                        |
| 258 | + * @access public  | 
                                                        |
| 259 | + */  | 
                                                        |
| 260 | + public function pagination_generate_page_link($event)  | 
                                                        |
| 261 | +    { | 
                                                        |
| 262 | + // If we have a sort key we do not rewrite the URL  | 
                                                        |
| 263 | +        $query = str_replace('&', '&', parse_url($event['base_url'], PHP_URL_QUERY)); | 
                                                        |
| 264 | + parse_str($query, $param);  | 
                                                        |
| 265 | + if (isset($param['sd']) || isset($param['sk']) || isset($param['st']))  | 
                                                        |
| 266 | +        { | 
                                                        |
| 267 | + return;  | 
                                                        |
| 268 | + }  | 
                                                        |
| 269 | +  | 
                                                        |
| 270 | + $start = (($event['on_page'] - 1) * $event['per_page']);  | 
                                                        |
| 271 | + if (!empty($this->topic_data) && isset($param['f']) && isset($param['t']))  | 
                                                        |
| 272 | +        { | 
                                                        |
| 273 | + $event['generate_page_link_override'] = append_sid($this->base->generate_topic_link($this->topic_data['forum_id'], $this->topic_data['forum_name'], $this->topic_data['topic_id'], $this->topic_data['topic_title'], $start));  | 
                                                        |
| 274 | + }  | 
                                                        |
| 275 | + else if (!empty($this->forum_data) && isset($param['f']))  | 
                                                        |
| 276 | +        { | 
                                                        |
| 277 | + $event['generate_page_link_override'] = append_sid($this->base->generate_forum_link($this->forum_data['forum_id'], $this->forum_data['forum_name'], $start));  | 
                                                        |
| 278 | + }  | 
                                                        |
| 279 | + }  | 
                                                        |
| 280 | +  | 
                                                        |
| 281 | + /**  | 
                                                        |
| 282 | + * Rewrite links in the search result  | 
                                                        |
| 283 | + *  | 
                                                        |
| 284 | + * @param object $event The event object  | 
                                                        |
| 285 | + * @return null  | 
                                                        |
| 286 | + * @access public  | 
                                                        |
| 287 | + */  | 
                                                        |
| 288 | + public function search_modify_tpl_ary($event)  | 
                                                        |
| 289 | +    { | 
                                                        |
| 290 | +        $replies = $this->base->get_count('topic_posts', $event['row'], $event['row']['forum_id']) - 1; | 
                                                        |
| 291 | + $u_view_topic = $this->base->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']);  | 
                                                        |
| 292 | +  | 
                                                        |
| 293 | + $tpl_ary = $event['tpl_ary'];  | 
                                                        |
| 294 | + $tpl_ary['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($replies, $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 295 | + $tpl_ary['U_VIEW_TOPIC'] = append_sid($u_view_topic);  | 
                                                        |
| 296 | + $tpl_ary['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($event['row']['forum_id'], $event['row']['forum_name']));  | 
                                                        |
| 297 | + $tpl_ary['U_NEWEST_POST'] = $u_view_topic . '?view=unread#unread';  | 
                                                        |
| 298 | +  | 
                                                        |
| 299 | + $event['tpl_ary'] = $tpl_ary;  | 
                                                        |
| 300 | + }  | 
                                                        |
| 301 | +  | 
                                                        |
| 302 | + /**  | 
                                                        |
| 303 | + * Rewrite links to topics in forum view  | 
                                                        |
| 304 | + *  | 
                                                        |
| 305 | + * @param object $event The event object  | 
                                                        |
| 306 | + * @return null  | 
                                                        |
| 307 | + * @access public  | 
                                                        |
| 308 | + */  | 
                                                        |
| 309 | + public function viewforum_modify_topicrow($event)  | 
                                                        |
| 310 | +    { | 
                                                        |
| 311 | + // assign to be used in pagination_generate_page_link  | 
                                                        |
| 312 | + $this->topic_data = array(  | 
                                                        |
| 313 | + 'forum_id' => $event['topic_row']['FORUM_ID'],  | 
                                                        |
| 314 | + 'forum_name' => $event['topic_row']['FORUM_NAME'],  | 
                                                        |
| 315 | + 'topic_id' => $event['topic_row']['TOPIC_ID'],  | 
                                                        |
| 316 | + 'topic_title' => $event['topic_row']['TOPIC_TITLE']  | 
                                                        |
| 317 | + );  | 
                                                        |
| 318 | +  | 
                                                        |
| 319 | + $topic_row = $event['topic_row'];  | 
                                                        |
| 320 | +  | 
                                                        |
| 321 | + $u_view_topic = $this->base->generate_topic_link($topic_row['FORUM_ID'], $topic_row['FORUM_NAME'], $topic_row['TOPIC_ID'], $topic_row['TOPIC_TITLE']);  | 
                                                        |
| 322 | + $topic_row['U_VIEW_TOPIC'] = append_sid($u_view_topic);  | 
                                                        |
| 323 | + $topic_row['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($topic_row['FORUM_ID'], $topic_row['FORUM_NAME']));  | 
                                                        |
| 324 | + $topic_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($event['topic_row']['REPLIES'], $u_view_topic) . '#p' . $event['row']['topic_last_post_id']);  | 
                                                        |
| 325 | + $topic_row['U_NEWEST_POST'] = $u_view_topic . '?view=unread#unread';  | 
                                                        |
| 326 | +  | 
                                                        |
| 327 | + $event['topic_row'] = $topic_row;  | 
                                                        |
| 328 | + }  | 
                                                        |
| 329 | +  | 
                                                        |
| 330 | + /**  | 
                                                        |
| 331 | + * Rewrite the canonical URL on viewforum.php  | 
                                                        |
| 332 | + *  | 
                                                        |
| 333 | + * @param object $event The event object  | 
                                                        |
| 334 | + * @return null  | 
                                                        |
| 335 | + * @access public  | 
                                                        |
| 336 | + */  | 
                                                        |
| 337 | + public function viewforum_get_topic_data($event)  | 
                                                        |
| 338 | +    { | 
                                                        |
| 339 | + // assign to be used in pagination_generate_page_link  | 
                                                        |
| 340 | + $this->forum_data = array(  | 
                                                        |
| 341 | + 'forum_id' => $event['forum_data']['forum_id'],  | 
                                                        |
| 342 | + 'forum_name' => $event['forum_data']['forum_name']  | 
                                                        |
| 343 | + );  | 
                                                        |
| 344 | +  | 
                                                        |
| 345 | +        $start = $this->request->variable('start', 0); | 
                                                        |
| 346 | + $this->template->assign_vars(array(  | 
                                                        |
| 347 | + 'U_VIEW_FORUM' => append_sid($this->base->generate_forum_link($event['forum_data']['forum_id'], $event['forum_data']['forum_name'], $start)),  | 
                                                        |
| 348 | + 'U_CANONICAL' => $this->base->generate_forum_link($event['forum_data']['forum_id'], $event['forum_data']['forum_name'], $start, true),  | 
                                                        |
| 349 | + ));  | 
                                                        |
| 350 | + }  | 
                                                        |
| 351 | +  | 
                                                        |
| 352 | + /**  | 
                                                        |
| 353 | + * Rewrite the topic URL for the headline of the topic page and the link back to forum  | 
                                                        |
| 354 | + *  | 
                                                        |
| 355 | + * @param object $event The event object  | 
                                                        |
| 356 | + * @return null  | 
                                                        |
| 357 | + * @access public  | 
                                                        |
| 358 | + */  | 
                                                        |
| 359 | + public function viewtopic_get_post_data($event)  | 
                                                        |
| 360 | +    { | 
                                                        |
| 361 | + $data = $event['topic_data'];  | 
                                                        |
| 362 | + $this->template->assign_vars(array(  | 
                                                        |
| 363 | + 'U_VIEW_TOPIC' => append_sid($this->base->generate_topic_link($event['forum_id'] , $data['forum_name'], $event['topic_id'], $data['topic_title'], $event['start'])),  | 
                                                        |
| 364 | + 'U_VIEW_FORUM' => append_sid($this->base->generate_forum_link($event['forum_id'] , $data['forum_name'])),  | 
                                                        |
| 365 | + 'S_POLL_ACTION' => append_sid($this->base->generate_topic_link($event['forum_id'] , $data['forum_name'], $event['topic_id'], $data['topic_title'], $event['start'])),  | 
                                                        |
| 366 | + ));  | 
                                                        |
| 367 | + }  | 
                                                        |
| 368 | +  | 
                                                        |
| 369 | + /**  | 
                                                        |
| 370 | + * Assign topic data to global variables for pagination  | 
                                                        |
| 371 | + *  | 
                                                        |
| 372 | + * @param object $event The event object  | 
                                                        |
| 373 | + * @return null  | 
                                                        |
| 374 | + * @access public  | 
                                                        |
| 375 | + */  | 
                                                        |
| 376 | + public function viewtopic_assign_template_vars_before($event)  | 
                                                        |
| 377 | +    { | 
                                                        |
| 378 | + // assign to be used in pagination_generate_page_link  | 
                                                        |
| 379 | + $this->topic_data = array(  | 
                                                        |
| 380 | + 'forum_id' => $event['topic_data']['forum_id'],  | 
                                                        |
| 381 | + 'forum_name' => $event['topic_data']['forum_name'],  | 
                                                        |
| 382 | + 'topic_id' => $event['topic_data']['topic_id'],  | 
                                                        |
| 383 | + 'topic_title' => $event['topic_data']['topic_title']  | 
                                                        |
| 384 | + );  | 
                                                        |
| 385 | + }  | 
                                                        |
| 386 | +  | 
                                                        |
| 387 | + public function viewtopic_before_f_read_check()  | 
                                                        |
| 388 | +    { | 
                                                        |
| 389 | + $this->in_viewtopic = true;  | 
                                                        |
| 390 | + }  | 
                                                        |
| 391 | +  | 
                                                        |
| 392 | + /**  | 
                                                        |
| 393 | + * Rewrite the canonical URL on viewtopic.php  | 
                                                        |
| 394 | + *  | 
                                                        |
| 395 | + * @param object $event The event object  | 
                                                        |
| 396 | + * @return null  | 
                                                        |
| 397 | + * @access public  | 
                                                        |
| 398 | + */  | 
                                                        |
| 399 | + public function viewtopic_modify_page_title($event)  | 
                                                        |
| 400 | +    { | 
                                                        |
| 401 | +        $start = $this->request->variable('start', 0); | 
                                                        |
| 402 | + $data = $event['topic_data'];  | 
                                                        |
| 403 | + $this->template->assign_vars(array(  | 
                                                        |
| 404 | + 'U_CANONICAL' => $this->base->generate_topic_link($data['forum_id'], $data['forum_name'], $data['topic_id'], $data['topic_title'], $start, true),  | 
                                                        |
| 405 | + ));  | 
                                                        |
| 406 | + }  | 
                                                        |
| 407 | +  | 
                                                        |
| 408 | + /**  | 
                                                        |
| 409 | + * Rewrite mini post img link  | 
                                                        |
| 410 | + *  | 
                                                        |
| 411 | + * @param object $event The event object  | 
                                                        |
| 412 | + * @return null  | 
                                                        |
| 413 | + * @access public  | 
                                                        |
| 414 | + */  | 
                                                        |
| 415 | + public function viewtopic_modify_post_row($event)  | 
                                                        |
| 416 | +    { | 
                                                        |
| 417 | + $row = $event['post_row'];  | 
                                                        |
| 418 | +        $start = $this->request->variable('start', 0); | 
                                                        |
| 419 | + $data = $event['topic_data'];  | 
                                                        |
| 420 | + $row['U_MINI_POST'] = append_sid($this->base->generate_topic_link($data['forum_id'], $data['forum_name'], $data['topic_id'], $data['topic_title'], $start) . '#p' . $event['row']['post_id']);  | 
                                                        |
| 421 | + $event['post_row'] = $row;  | 
                                                        |
| 422 | + }  | 
                                                        |
| 423 | 423 | }  | 
                                                        
@@ -4,15 +4,15 @@  | 
                                                    ||
| 4 | 4 | |
| 5 | 5 | abstract class database_test extends \phpbb_database_test_case  | 
                                                        
| 6 | 6 |  { | 
                                                        
| 7 | - protected static function setup_extensions()  | 
                                                        |
| 8 | -	{ | 
                                                        |
| 9 | -		return array('tas2580/seourls'); | 
                                                        |
| 10 | - }  | 
                                                        |
| 11 | - protected $db;  | 
                                                        |
| 12 | - public function setUp()  | 
                                                        |
| 13 | -	{ | 
                                                        |
| 14 | - parent::setUp();  | 
                                                        |
| 15 | - global $db;  | 
                                                        |
| 16 | - $db = $this->db = $this->new_dbal();  | 
                                                        |
| 17 | - }  | 
                                                        |
| 7 | + protected static function setup_extensions()  | 
                                                        |
| 8 | +    { | 
                                                        |
| 9 | +        return array('tas2580/seourls'); | 
                                                        |
| 10 | + }  | 
                                                        |
| 11 | + protected $db;  | 
                                                        |
| 12 | + public function setUp()  | 
                                                        |
| 13 | +    { | 
                                                        |
| 14 | + parent::setUp();  | 
                                                        |
| 15 | + global $db;  | 
                                                        |
| 16 | + $db = $this->db = $this->new_dbal();  | 
                                                        |
| 17 | + }  | 
                                                        |
| 18 | 18 | }  | 
                                                        
@@ -3,8 +3,8 @@  | 
                                                    ||
| 3 | 3 | namespace tas2580\seourls\tests\base;  | 
                                                        
| 4 | 4 | abstract class functional_test extends \phpbb_functional_test_case  | 
                                                        
| 5 | 5 |  { | 
                                                        
| 6 | - protected static function setup_extensions()  | 
                                                        |
| 7 | -	{ | 
                                                        |
| 8 | -		return array('tas2580/seourls'); | 
                                                        |
| 9 | - }  | 
                                                        |
| 6 | + protected static function setup_extensions()  | 
                                                        |
| 7 | +    { | 
                                                        |
| 8 | +        return array('tas2580/seourls'); | 
                                                        |
| 9 | + }  | 
                                                        |
| 10 | 10 | }  |