@@ -39,17 +39,17 @@ discard block |
||
| 39 | 39 | protected $php_ext; |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | - * Constructor |
|
| 43 | - * |
|
| 44 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 45 | - * @param \phpbb\config\config $config Config object |
|
| 46 | - * @param \phpbb\log\log $phpbb_log Log object |
|
| 47 | - * @param \phpbb\user $user User object |
|
| 48 | - * @param \phpbb\notification\manager $notification Notification object |
|
| 49 | - * @param \ernadoo\phpbbdirectory\core\link $link PhpBB Directory extension link object |
|
| 50 | - * @param string $root_path phpBB root path |
|
| 51 | - * @param string $php_ext phpEx |
|
| 52 | - */ |
|
| 42 | + * Constructor |
|
| 43 | + * |
|
| 44 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 45 | + * @param \phpbb\config\config $config Config object |
|
| 46 | + * @param \phpbb\log\log $phpbb_log Log object |
|
| 47 | + * @param \phpbb\user $user User object |
|
| 48 | + * @param \phpbb\notification\manager $notification Notification object |
|
| 49 | + * @param \ernadoo\phpbbdirectory\core\link $link PhpBB Directory extension link object |
|
| 50 | + * @param string $root_path phpBB root path |
|
| 51 | + * @param string $php_ext phpEx |
|
| 52 | + */ |
|
| 53 | 53 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\log\log $phpbb_log, \phpbb\user $user, \phpbb\notification\manager $notification, \ernadoo\phpbbdirectory\core\link $link, $root_path, $php_ext) |
| 54 | 54 | { |
| 55 | 55 | $this->db = $db; |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * Method called by cron task. |
|
| 67 | - * |
|
| 68 | - * @param array $cat_data Information about category, from db |
|
| 69 | - * @return null |
|
| 70 | - */ |
|
| 66 | + * Method called by cron task. |
|
| 67 | + * |
|
| 68 | + * @param array $cat_data Information about category, from db |
|
| 69 | + * @return null |
|
| 70 | + */ |
|
| 71 | 71 | public function auto_check($cat_data) |
| 72 | 72 | { |
| 73 | 73 | $sql = 'SELECT cat_name |
@@ -116,14 +116,14 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | - * Check, for website with backlink specified, if backlink is always here. |
|
| 120 | - * After $nb_check verification, website is deleted, otherwise, a notification is send to poster |
|
| 121 | - * |
|
| 122 | - * @param int $cat_id The category ID |
|
| 123 | - * @param int $nb_check Number of check before demete a website |
|
| 124 | - * @param int $next_prune Date of next auto check |
|
| 125 | - * @return null |
|
| 126 | - */ |
|
| 119 | + * Check, for website with backlink specified, if backlink is always here. |
|
| 120 | + * After $nb_check verification, website is deleted, otherwise, a notification is send to poster |
|
| 121 | + * |
|
| 122 | + * @param int $cat_id The category ID |
|
| 123 | + * @param int $nb_check Number of check before demete a website |
|
| 124 | + * @param int $next_prune Date of next auto check |
|
| 125 | + * @return null |
|
| 126 | + */ |
|
| 127 | 127 | private function _check($cat_id, $nb_check, $next_prune) |
| 128 | 128 | { |
| 129 | 129 | $del_array = $update_array = array(); |
@@ -171,12 +171,12 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
| 174 | - * Update website verification number after a missing backlink, and send notificaton |
|
| 175 | - * |
|
| 176 | - * @param array $u_array Information about website |
|
| 177 | - * @param int $next_prune Date of next auto check |
|
| 178 | - * @return null |
|
| 179 | - */ |
|
| 174 | + * Update website verification number after a missing backlink, and send notificaton |
|
| 175 | + * |
|
| 176 | + * @param array $u_array Information about website |
|
| 177 | + * @param int $next_prune Date of next auto check |
|
| 178 | + * @return null |
|
| 179 | + */ |
|
| 180 | 180 | private function _update_check($u_array, $next_prune) |
| 181 | 181 | { |
| 182 | 182 | if (!class_exists('messenger')) |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\log\log $phpbb_log, \phpbb\user $user, \phpbb\notification\manager $notification, \ernadoo\phpbbdirectory\core\link $link, $root_path, $php_ext) |
| 54 | 54 | { |
| 55 | - $this->db = $db; |
|
| 56 | - $this->config = $config; |
|
| 57 | - $this->phpbb_log = $phpbb_log; |
|
| 55 | + $this->db = $db; |
|
| 56 | + $this->config = $config; |
|
| 57 | + $this->phpbb_log = $phpbb_log; |
|
| 58 | 58 | $this->user = $user; |
| 59 | - $this->notification = $notification; |
|
| 59 | + $this->notification = $notification; |
|
| 60 | 60 | $this->link = $link; |
| 61 | - $this->root_path = $root_path; |
|
| 62 | - $this->php_ext = $php_ext; |
|
| 61 | + $this->root_path = $root_path; |
|
| 62 | + $this->php_ext = $php_ext; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function auto_check($cat_data) |
| 72 | 72 | { |
| 73 | 73 | $sql = 'SELECT cat_name |
| 74 | - FROM ' . $this->categories_table . ' |
|
| 74 | + FROM ' . $this->categories_table.' |
|
| 75 | 75 | WHERE cat_id = ' . (int) $cat_data['cat_id']; |
| 76 | 76 | $result = $this->db->sql_query($sql); |
| 77 | 77 | $row = $this->db->sql_fetchrow($result); |
@@ -83,9 +83,9 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $this->_check($cat_data['cat_id'], $cat_data['cat_cron_nb_check'], $next_prune); |
| 85 | 85 | |
| 86 | - $sql = 'UPDATE ' . $this->categories_table . " |
|
| 86 | + $sql = 'UPDATE '.$this->categories_table." |
|
| 87 | 87 | SET cat_cron_next = $next_prune |
| 88 | - WHERE cat_id = " . (int) $cat_data['cat_id']; |
|
| 88 | + WHERE cat_id = ".(int) $cat_data['cat_id']; |
|
| 89 | 89 | $this->db->sql_query($sql); |
| 90 | 90 | |
| 91 | 91 | $this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_DIR_AUTO_PRUNE', time(), array($row['cat_name'])); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | public function get_cat($cat_id) |
| 104 | 104 | { |
| 105 | 105 | $sql = 'SELECT cat_id, cat_cron_enable, cat_cron_next, cat_cron_freq, cat_cron_nb_check |
| 106 | - FROM ' . $this->categories_table . ' |
|
| 106 | + FROM ' . $this->categories_table.' |
|
| 107 | 107 | WHERE cat_id = ' . (int) $cat_id; |
| 108 | 108 | $result = $this->db->sql_query($sql); |
| 109 | 109 | $row = $this->db->sql_fetchrow($result); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | 'ON' => 'l.link_user_id = u.user_id' |
| 139 | 139 | ) |
| 140 | 140 | ), |
| 141 | - 'WHERE' => 'l.link_back <> "" AND l.link_active = 1 AND l.link_cat = ' . (int) $cat_id); |
|
| 141 | + 'WHERE' => 'l.link_back <> "" AND l.link_active = 1 AND l.link_cat = '.(int) $cat_id); |
|
| 142 | 142 | |
| 143 | 143 | $sql = $this->db->sql_build_query('SELECT', $sql_array); |
| 144 | 144 | $result = $this->db->sql_query($sql); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | if ($this->link->validate_link_back($row['link_back'], false, true) !== false) |
| 149 | 149 | { |
| 150 | - if (!$nb_check || ($row['link_nb_check']+1) >= $nb_check) |
|
| 150 | + if (!$nb_check || ($row['link_nb_check'] + 1) >= $nb_check) |
|
| 151 | 151 | { |
| 152 | 152 | $del_array[] = $row['link_id']; |
| 153 | 153 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | if (!class_exists('messenger')) |
| 183 | 183 | { |
| 184 | - include($this->root_path . 'includes/functions_messenger.' . $this->php_ext); |
|
| 184 | + include($this->root_path.'includes/functions_messenger.'.$this->php_ext); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $messenger = new \messenger(false); |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | // We need to define it, because we use user->format_date below |
| 191 | 191 | $this->user->timezone = new \DateTimeZone($this->config['board_timezone']); |
| 192 | 192 | |
| 193 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 193 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 194 | 194 | SET link_nb_check = link_nb_check + 1 |
| 195 | 195 | WHERE ' . $this->db->sql_in_set('link_id', array_keys($u_array)); |
| 196 | 196 | $this->db->sql_query($sql); |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\language\language $language) |
| 30 | 30 | { |
| 31 | - $this->db = $db; |
|
| 32 | - $this->language = $language; |
|
| 31 | + $this->db = $db; |
|
| 32 | + $this->language = $language; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $this->db->sql_transaction('begin'); |
| 44 | 44 | |
| 45 | - $sql = 'INSERT INTO ' . $this->comments_table . ' ' . $this->db->sql_build_array('INSERT', $data); |
|
| 45 | + $sql = 'INSERT INTO '.$this->comments_table.' '.$this->db->sql_build_array('INSERT', $data); |
|
| 46 | 46 | $this->db->sql_query($sql); |
| 47 | 47 | |
| 48 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 48 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 49 | 49 | SET link_comment = link_comment + 1 |
| 50 | 50 | WHERE link_id = ' . (int) $data['comment_link_id']; |
| 51 | 51 | $this->db->sql_query($sql); |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function edit($data, $comment_id) |
| 64 | 64 | { |
| 65 | - $sql = 'UPDATE ' . $this->comments_table . ' |
|
| 66 | - SET ' . $this->db->sql_build_array('UPDATE', $data) . ' |
|
| 65 | + $sql = 'UPDATE '.$this->comments_table.' |
|
| 66 | + SET ' . $this->db->sql_build_array('UPDATE', $data).' |
|
| 67 | 67 | WHERE comment_id = ' . (int) $comment_id; |
| 68 | 68 | $this->db->sql_query($sql); |
| 69 | 69 | } |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $this->db->sql_transaction('begin'); |
| 83 | 83 | |
| 84 | - $sql = 'DELETE FROM ' . $this->comments_table . ' WHERE comment_id = ' . (int) $comment_id; |
|
| 84 | + $sql = 'DELETE FROM '.$this->comments_table.' WHERE comment_id = '.(int) $comment_id; |
|
| 85 | 85 | $this->db->sql_query($sql); |
| 86 | 86 | |
| 87 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 87 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 88 | 88 | SET link_comment = link_comment - 1 |
| 89 | 89 | WHERE link_id = ' . (int) $link_id; |
| 90 | 90 | $this->db->sql_query($sql); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | if ($request->is_ajax()) |
| 95 | 95 | { |
| 96 | 96 | $sql = 'SELECT COUNT(comment_id) AS nb_comments |
| 97 | - FROM ' . $this->comments_table . ' |
|
| 97 | + FROM ' . $this->comments_table.' |
|
| 98 | 98 | WHERE comment_link_id = ' . (int) $link_id; |
| 99 | 99 | $result = $this->db->sql_query($sql); |
| 100 | 100 | $nb_comments = (int) $this->db->sql_fetchfield('nb_comments'); |
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | protected $language; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * Constructor |
|
| 25 | - * |
|
| 26 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 27 | - * @param \phpbb\language\language $language Language object |
|
| 28 | - */ |
|
| 24 | + * Constructor |
|
| 25 | + * |
|
| 26 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 27 | + * @param \phpbb\language\language $language Language object |
|
| 28 | + */ |
|
| 29 | 29 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\language\language $language) |
| 30 | 30 | { |
| 31 | 31 | $this->db = $db; |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * Add a comment |
|
| 37 | - * |
|
| 38 | - * @param array $data Link's data from db |
|
| 39 | - * @return null |
|
| 40 | - */ |
|
| 36 | + * Add a comment |
|
| 37 | + * |
|
| 38 | + * @param array $data Link's data from db |
|
| 39 | + * @return null |
|
| 40 | + */ |
|
| 41 | 41 | public function add($data) |
| 42 | 42 | { |
| 43 | 43 | $this->db->sql_transaction('begin'); |
@@ -54,12 +54,12 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * Edit a comment |
|
| 58 | - * |
|
| 59 | - * @param array $data Data to edit |
|
| 60 | - * @param int $comment_id The comment ID |
|
| 61 | - * @return null |
|
| 62 | - */ |
|
| 57 | + * Edit a comment |
|
| 58 | + * |
|
| 59 | + * @param array $data Data to edit |
|
| 60 | + * @param int $comment_id The comment ID |
|
| 61 | + * @return null |
|
| 62 | + */ |
|
| 63 | 63 | public function edit($data, $comment_id) |
| 64 | 64 | { |
| 65 | 65 | $sql = 'UPDATE ' . $this->comments_table . ' |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | - * Delete a comment |
|
| 73 | - * |
|
| 74 | - * @param string $link_id The link ID |
|
| 75 | - * @param string $comment_id The comment ID |
|
| 76 | - * @return null |
|
| 77 | - */ |
|
| 72 | + * Delete a comment |
|
| 73 | + * |
|
| 74 | + * @param string $link_id The link ID |
|
| 75 | + * @param string $comment_id The comment ID |
|
| 76 | + * @return null |
|
| 77 | + */ |
|
| 78 | 78 | public function del($link_id, $comment_id) |
| 79 | 79 | { |
| 80 | 80 | global $request; |
@@ -13,8 +13,8 @@ |
||
| 13 | 13 | class cat_description extends \phpbb\textreparser\row_based_plugin |
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | - * {@inheritdoc} |
|
| 17 | - */ |
|
| 16 | + * {@inheritdoc} |
|
| 17 | + */ |
|
| 18 | 18 | public function get_columns() |
| 19 | 19 | { |
| 20 | 20 | return array( |
@@ -13,8 +13,8 @@ |
||
| 13 | 13 | class link_description extends \phpbb\textreparser\row_based_plugin |
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | - * {@inheritdoc} |
|
| 17 | - */ |
|
| 16 | + * {@inheritdoc} |
|
| 17 | + */ |
|
| 18 | 18 | public function get_columns() |
| 19 | 19 | { |
| 20 | 20 | return array( |
@@ -37,37 +37,37 @@ discard block |
||
| 37 | 37 | private $ext_name = 'ernadoo/phpbbdirectory'; |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * Set the extension manager |
|
| 41 | - * |
|
| 42 | - * @param \phpbb\extension\manager $phpbb_extension_manager |
|
| 43 | - * @return null |
|
| 44 | - */ |
|
| 40 | + * Set the extension manager |
|
| 41 | + * |
|
| 42 | + * @param \phpbb\extension\manager $phpbb_extension_manager |
|
| 43 | + * @return null |
|
| 44 | + */ |
|
| 45 | 45 | public function set_extension_manager(\phpbb\extension\manager $phpbb_extension_manager) |
| 46 | 46 | { |
| 47 | 47 | $this->extension_manager = $phpbb_extension_manager; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * Set the path helper |
|
| 52 | - * |
|
| 53 | - * @param \phpbb\path_helper $path_helper |
|
| 54 | - * @return null |
|
| 55 | - */ |
|
| 51 | + * Set the path helper |
|
| 52 | + * |
|
| 53 | + * @param \phpbb\path_helper $path_helper |
|
| 54 | + * @return null |
|
| 55 | + */ |
|
| 56 | 56 | public function set_path_helper(\phpbb\path_helper $path_helper) |
| 57 | 57 | { |
| 58 | 58 | $this->path_helper = $path_helper; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | - * Set the tables names |
|
| 63 | - * |
|
| 64 | - * @param string $categories_table |
|
| 65 | - * @param string $comments_table |
|
| 66 | - * @param string $links_table |
|
| 67 | - * @param string $votes_table |
|
| 68 | - * @param string $watch_table |
|
| 69 | - * @return null |
|
| 70 | - */ |
|
| 62 | + * Set the tables names |
|
| 63 | + * |
|
| 64 | + * @param string $categories_table |
|
| 65 | + * @param string $comments_table |
|
| 66 | + * @param string $links_table |
|
| 67 | + * @param string $votes_table |
|
| 68 | + * @param string $watch_table |
|
| 69 | + * @return null |
|
| 70 | + */ |
|
| 71 | 71 | public function set_tables($categories_table, $comments_table, $links_table, $votes_table, $watch_table) |
| 72 | 72 | { |
| 73 | 73 | $this->comments_table = $comments_table; |
@@ -77,48 +77,48 @@ discard block |
||
| 77 | 77 | $this->categories_table = $categories_table; |
| 78 | 78 | } |
| 79 | 79 | /** |
| 80 | - * Return ext name |
|
| 81 | - * |
|
| 82 | - * @param bool $web_root_path Whether the path should be relative to web root |
|
| 83 | - * @return string Path to an extension |
|
| 84 | - */ |
|
| 80 | + * Return ext name |
|
| 81 | + * |
|
| 82 | + * @param bool $web_root_path Whether the path should be relative to web root |
|
| 83 | + * @return string Path to an extension |
|
| 84 | + */ |
|
| 85 | 85 | public function get_ext_name($web_root_path = false) |
| 86 | 86 | { |
| 87 | 87 | return (($web_root_path) ? $this->path_helper->get_web_root_path() : '') . $this->extension_manager->get_extension_path($this->ext_name); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | - * Return path to resource image |
|
| 92 | - * |
|
| 93 | - * @param string $type is ressource type (flags|icons) |
|
| 94 | - * @param string $image is the resource to display |
|
| 95 | - * @return string The relative path to ressource |
|
| 96 | - */ |
|
| 91 | + * Return path to resource image |
|
| 92 | + * |
|
| 93 | + * @param string $type is ressource type (flags|icons) |
|
| 94 | + * @param string $image is the resource to display |
|
| 95 | + * @return string The relative path to ressource |
|
| 96 | + */ |
|
| 97 | 97 | public function get_img_path($type, $image = '') |
| 98 | 98 | { |
| 99 | 99 | return $this->get_ext_name(true) . 'images/' . $type . '/' . $image; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | - * Return path to banner |
|
| 104 | - * |
|
| 105 | - * @param string $banner is the physical name |
|
| 106 | - * @return string The relative path to banner |
|
| 107 | - */ |
|
| 103 | + * Return path to banner |
|
| 104 | + * |
|
| 105 | + * @param string $banner is the physical name |
|
| 106 | + * @return string The relative path to banner |
|
| 107 | + */ |
|
| 108 | 108 | public function get_banner_path($banner = '') |
| 109 | 109 | { |
| 110 | 110 | return 'files/' . $this->get_ext_name() . 'banners/' . $banner; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | - * Return array entries that match the pattern |
|
| 115 | - * |
|
| 116 | - * @link http://php.net/manual/fr/function.preg-grep.php#95787 |
|
| 117 | - * |
|
| 118 | - * @param string $pattern The pattern to search for |
|
| 119 | - * @param array $input The input array |
|
| 120 | - * @return array $vals Returns an array indexed using the keys from the input array |
|
| 121 | - */ |
|
| 114 | + * Return array entries that match the pattern |
|
| 115 | + * |
|
| 116 | + * @link http://php.net/manual/fr/function.preg-grep.php#95787 |
|
| 117 | + * |
|
| 118 | + * @param string $pattern The pattern to search for |
|
| 119 | + * @param array $input The input array |
|
| 120 | + * @return array $vals Returns an array indexed using the keys from the input array |
|
| 121 | + */ |
|
| 122 | 122 | public function preg_grep_keys($pattern, $input) |
| 123 | 123 | { |
| 124 | 124 | $keys = preg_grep($pattern, array_keys($input)); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function set_extension_manager(\phpbb\extension\manager $phpbb_extension_manager) |
| 46 | 46 | { |
| 47 | - $this->extension_manager = $phpbb_extension_manager; |
|
| 47 | + $this->extension_manager = $phpbb_extension_manager; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function set_tables($categories_table, $comments_table, $links_table, $votes_table, $watch_table) |
| 72 | 72 | { |
| 73 | - $this->comments_table = $comments_table; |
|
| 73 | + $this->comments_table = $comments_table; |
|
| 74 | 74 | $this->links_table = $links_table; |
| 75 | 75 | $this->votes_table = $votes_table; |
| 76 | 76 | $this->watch_table = $watch_table; |
| 77 | - $this->categories_table = $categories_table; |
|
| 77 | + $this->categories_table = $categories_table; |
|
| 78 | 78 | } |
| 79 | 79 | /** |
| 80 | 80 | * Return ext name |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function get_ext_name($web_root_path = false) |
| 86 | 86 | { |
| 87 | - return (($web_root_path) ? $this->path_helper->get_web_root_path() : '') . $this->extension_manager->get_extension_path($this->ext_name); |
|
| 87 | + return (($web_root_path) ? $this->path_helper->get_web_root_path() : '').$this->extension_manager->get_extension_path($this->ext_name); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function get_img_path($type, $image = '') |
| 98 | 98 | { |
| 99 | - return $this->get_ext_name(true) . 'images/' . $type . '/' . $image; |
|
| 99 | + return $this->get_ext_name(true).'images/'.$type.'/'.$image; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function get_banner_path($banner = '') |
| 109 | 109 | { |
| 110 | - return 'files/' . $this->get_ext_name() . 'banners/' . $banner; |
|
| 110 | + return 'files/'.$this->get_ext_name().'banners/'.$banner; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -37,16 +37,16 @@ discard block |
||
| 37 | 37 | protected $php_ext; |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * Constructor |
|
| 41 | - * |
|
| 42 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 43 | - * @param \phpbb\controller\helper $helper Controller helper object |
|
| 44 | - * @param \phpbb\language\language $language Language object |
|
| 45 | - * @param \phpbb\template\template $template Template object |
|
| 46 | - * @param string $table_prefix prefix table |
|
| 47 | - * @param string $php_ext phpEx |
|
| 48 | - * @access public |
|
| 49 | - */ |
|
| 40 | + * Constructor |
|
| 41 | + * |
|
| 42 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 43 | + * @param \phpbb\controller\helper $helper Controller helper object |
|
| 44 | + * @param \phpbb\language\language $language Language object |
|
| 45 | + * @param \phpbb\template\template $template Template object |
|
| 46 | + * @param string $table_prefix prefix table |
|
| 47 | + * @param string $php_ext phpEx |
|
| 48 | + * @access public |
|
| 49 | + */ |
|
| 50 | 50 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\language\language $language, \phpbb\template\template $template, $table_prefix, $php_ext) |
| 51 | 51 | { |
| 52 | 52 | $this->db = $db; |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | - * Assign functions defined in this class to event listeners in the core |
|
| 62 | - * |
|
| 63 | - * @return array |
|
| 64 | - * @static |
|
| 65 | - * @access public |
|
| 66 | - */ |
|
| 61 | + * Assign functions defined in this class to event listeners in the core |
|
| 62 | + * |
|
| 63 | + * @return array |
|
| 64 | + * @static |
|
| 65 | + * @access public |
|
| 66 | + */ |
|
| 67 | 67 | static public function getSubscribedEvents() |
| 68 | 68 | { |
| 69 | 69 | return array( |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | - * Display links to Directory |
|
| 80 | - * |
|
| 81 | - * @return null |
|
| 82 | - */ |
|
| 79 | + * Display links to Directory |
|
| 80 | + * |
|
| 81 | + * @return null |
|
| 82 | + */ |
|
| 83 | 83 | public function add_page_header_variables() |
| 84 | 84 | { |
| 85 | 85 | $ext_theme_path = $this->get_ext_name() . '/styles/prosilver/theme/'; |
@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * Show users as viewing Directory on Who Is Online page |
|
| 103 | - * |
|
| 104 | - * @param object $event The event object |
|
| 105 | - * @return null |
|
| 106 | - */ |
|
| 102 | + * Show users as viewing Directory on Who Is Online page |
|
| 103 | + * |
|
| 104 | + * @param object $event The event object |
|
| 105 | + * @return null |
|
| 106 | + */ |
|
| 107 | 107 | public function add_page_viewonline($event) |
| 108 | 108 | { |
| 109 | 109 | if (strrpos($event['row']['session_page'], 'app.' . $this->php_ext . '/directory') === 0) |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | - * Load common language files during user setup |
|
| 118 | - * |
|
| 119 | - * @param object $event The event object |
|
| 120 | - * @return null |
|
| 121 | - */ |
|
| 117 | + * Load common language files during user setup |
|
| 118 | + * |
|
| 119 | + * @param object $event The event object |
|
| 120 | + * @return null |
|
| 121 | + */ |
|
| 122 | 122 | public function load_language_on_setup($event) |
| 123 | 123 | { |
| 124 | 124 | $lang_set_ext = $event['lang_set_ext']; |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | - * Add administrative permissions to manage Directory |
|
| 134 | - * |
|
| 135 | - * @param object $event The event object |
|
| 136 | - * @return null |
|
| 137 | - */ |
|
| 133 | + * Add administrative permissions to manage Directory |
|
| 134 | + * |
|
| 135 | + * @param object $event The event object |
|
| 136 | + * @return null |
|
| 137 | + */ |
|
| 138 | 138 | public function permissions_add_directory($event) |
| 139 | 139 | { |
| 140 | 140 | $event->update_subarray('categories', 'dir', 'ACL_CAT_DIRECTORY'); |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | - * Update Directory tables if needed, after deleted an user |
|
| 159 | - * |
|
| 160 | - * @param object $event The event object |
|
| 161 | - * @return null |
|
| 162 | - */ |
|
| 158 | + * Update Directory tables if needed, after deleted an user |
|
| 159 | + * |
|
| 160 | + * @param object $event The event object |
|
| 161 | + * @return null |
|
| 162 | + */ |
|
| 163 | 163 | public function update_links_with_anonymous($event) |
| 164 | 164 | { |
| 165 | 165 | $user_ids = $event['user_ids']; |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\language\language $language, \phpbb\template\template $template, $table_prefix, $php_ext) |
| 51 | 51 | { |
| 52 | - $this->db = $db; |
|
| 53 | - $this->helper = $helper; |
|
| 52 | + $this->db = $db; |
|
| 53 | + $this->helper = $helper; |
|
| 54 | 54 | $this->language = $language; |
| 55 | 55 | $this->template = $template; |
| 56 | 56 | $this->table_prefix = $table_prefix; |
| 57 | - $this->php_ext = $php_ext; |
|
| 57 | + $this->php_ext = $php_ext; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function add_page_header_variables() |
| 84 | 84 | { |
| 85 | - $ext_theme_path = $this->get_ext_name() . '/styles/prosilver/theme/'; |
|
| 85 | + $ext_theme_path = $this->get_ext_name().'/styles/prosilver/theme/'; |
|
| 86 | 86 | $theme_lang_path = $this->language->get_used_language(); |
| 87 | 87 | |
| 88 | 88 | // Prevent 'Twig_Error_Loader' if user's lang directory doesn't exist |
| 89 | - if (!file_exists($ext_theme_path . $theme_lang_path . '/directory.css')) |
|
| 89 | + if (!file_exists($ext_theme_path.$theme_lang_path.'/directory.css')) |
|
| 90 | 90 | { |
| 91 | 91 | // Fallback to English language. |
| 92 | 92 | $theme_lang_path = \phpbb\language\language::FALLBACK_LANGUAGE; |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function add_page_viewonline($event) |
| 108 | 108 | { |
| 109 | - if (strrpos($event['row']['session_page'], 'app.' . $this->php_ext . '/directory') === 0) |
|
| 109 | + if (strrpos($event['row']['session_page'], 'app.'.$this->php_ext.'/directory') === 0) |
|
| 110 | 110 | { |
| 111 | - $event['location'] = $this->language->lang('DIRECTORY'); |
|
| 112 | - $event['location_url'] = $this->helper->route('ernadoo_phpbbdirectory_base_controller'); |
|
| 111 | + $event['location'] = $this->language->lang('DIRECTORY'); |
|
| 112 | + $event['location_url'] = $this->helper->route('ernadoo_phpbbdirectory_base_controller'); |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
@@ -137,21 +137,21 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function permissions_add_directory($event) |
| 139 | 139 | { |
| 140 | - $event->update_subarray('categories', 'dir', 'ACL_CAT_DIRECTORY'); |
|
| 141 | - |
|
| 142 | - $event->update_subarray('permissions', 'm_delete_dir', array('lang' => 'ACL_M_DELETE_DIR', 'cat' => 'dir')); |
|
| 143 | - $event->update_subarray('permissions', 'm_delete_comment_dir', array('lang' => 'ACL_M_DELETE_COMMENT_DIR', 'cat' => 'dir')); |
|
| 144 | - $event->update_subarray('permissions', 'm_edit_dir', array('lang' => 'ACL_M_EDIT_DIR', 'cat' => 'dir')); |
|
| 145 | - $event->update_subarray('permissions', 'm_edit_comment_dir', array('lang' => 'ACL_M_EDIT_COMMENT_DIR', 'cat' => 'dir')); |
|
| 146 | - |
|
| 147 | - $event->update_subarray('permissions', 'u_comment_dir', array('lang' => 'ACL_U_COMMENT_DIR', 'cat' => 'dir')); |
|
| 148 | - $event->update_subarray('permissions', 'u_delete_dir', array('lang' => 'ACL_U_DELETE_DIR', 'cat' => 'dir')); |
|
| 149 | - $event->update_subarray('permissions', 'u_delete_comment_dir', array('lang' => 'ACL_U_DELETE_COMMENT_DIR', 'cat' => 'dir')); |
|
| 150 | - $event->update_subarray('permissions', 'u_edit_dir', array('lang' => 'ACL_U_EDIT_DIR', 'cat' => 'dir')); |
|
| 151 | - $event->update_subarray('permissions', 'u_edit_comment_dir', array('lang' => 'ACL_U_EDIT_COMMENT_DIR', 'cat' => 'dir')); |
|
| 152 | - $event->update_subarray('permissions', 'u_search_dir', array('lang' => 'ACL_U_SEARCH_DIR', 'cat' => 'dir')); |
|
| 153 | - $event->update_subarray('permissions', 'u_submit_dir', array('lang' => 'ACL_U_SUBMIT_DIR', 'cat' => 'dir')); |
|
| 154 | - $event->update_subarray('permissions', 'u_vote_dir', array('lang' => 'ACL_U_VOTE_DIR', 'cat' => 'dir')); |
|
| 140 | + $event->update_subarray('categories', 'dir', 'ACL_CAT_DIRECTORY'); |
|
| 141 | + |
|
| 142 | + $event->update_subarray('permissions', 'm_delete_dir', array('lang' => 'ACL_M_DELETE_DIR', 'cat' => 'dir')); |
|
| 143 | + $event->update_subarray('permissions', 'm_delete_comment_dir', array('lang' => 'ACL_M_DELETE_COMMENT_DIR', 'cat' => 'dir')); |
|
| 144 | + $event->update_subarray('permissions', 'm_edit_dir', array('lang' => 'ACL_M_EDIT_DIR', 'cat' => 'dir')); |
|
| 145 | + $event->update_subarray('permissions', 'm_edit_comment_dir', array('lang' => 'ACL_M_EDIT_COMMENT_DIR', 'cat' => 'dir')); |
|
| 146 | + |
|
| 147 | + $event->update_subarray('permissions', 'u_comment_dir', array('lang' => 'ACL_U_COMMENT_DIR', 'cat' => 'dir')); |
|
| 148 | + $event->update_subarray('permissions', 'u_delete_dir', array('lang' => 'ACL_U_DELETE_DIR', 'cat' => 'dir')); |
|
| 149 | + $event->update_subarray('permissions', 'u_delete_comment_dir', array('lang' => 'ACL_U_DELETE_COMMENT_DIR', 'cat' => 'dir')); |
|
| 150 | + $event->update_subarray('permissions', 'u_edit_dir', array('lang' => 'ACL_U_EDIT_DIR', 'cat' => 'dir')); |
|
| 151 | + $event->update_subarray('permissions', 'u_edit_comment_dir', array('lang' => 'ACL_U_EDIT_COMMENT_DIR', 'cat' => 'dir')); |
|
| 152 | + $event->update_subarray('permissions', 'u_search_dir', array('lang' => 'ACL_U_SEARCH_DIR', 'cat' => 'dir')); |
|
| 153 | + $event->update_subarray('permissions', 'u_submit_dir', array('lang' => 'ACL_U_SUBMIT_DIR', 'cat' => 'dir')); |
|
| 154 | + $event->update_subarray('permissions', 'u_vote_dir', array('lang' => 'ACL_U_VOTE_DIR', 'cat' => 'dir')); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -169,17 +169,17 @@ discard block |
||
| 169 | 169 | $user_ids = array($user_ids); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $sql = 'UPDATE ' . $this->comments_table . ' |
|
| 173 | - SET comment_user_id = ' . ANONYMOUS . ' |
|
| 172 | + $sql = 'UPDATE '.$this->comments_table.' |
|
| 173 | + SET comment_user_id = ' . ANONYMOUS.' |
|
| 174 | 174 | WHERE ' . $this->db->sql_in_set('comment_user_id', $user_ids); |
| 175 | 175 | $this->db->sql_query($sql); |
| 176 | 176 | |
| 177 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 178 | - SET link_user_id = ' . ANONYMOUS . ' |
|
| 177 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 178 | + SET link_user_id = ' . ANONYMOUS.' |
|
| 179 | 179 | WHERE ' . $this->db->sql_in_set('link_user_id', $user_ids); |
| 180 | 180 | $this->db->sql_query($sql); |
| 181 | 181 | |
| 182 | - $sql = 'DELETE FROM ' . $this->watch_table . ' |
|
| 182 | + $sql = 'DELETE FROM '.$this->watch_table.' |
|
| 183 | 183 | WHERE ' . $this->db->sql_in_set('user_id', $user_ids); |
| 184 | 184 | $this->db->sql_query($sql); |
| 185 | 185 | } |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | private $cat_data; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * Constructor. |
|
| 26 | - * |
|
| 27 | - * @param \phpbb\config\config $config Config object |
|
| 28 | - * @param \ernadoo\phpbbdirectory\core\cron $directory_cron PhpBB Directory extension link object |
|
| 29 | - */ |
|
| 25 | + * Constructor. |
|
| 26 | + * |
|
| 27 | + * @param \phpbb\config\config $config Config object |
|
| 28 | + * @param \ernadoo\phpbbdirectory\core\cron $directory_cron PhpBB Directory extension link object |
|
| 29 | + */ |
|
| 30 | 30 | public function __construct(\phpbb\config\config $config, \ernadoo\phpbbdirectory\core\cron $directory_cron) |
| 31 | 31 | { |
| 32 | 32 | $this->config = $config; |
@@ -34,66 +34,66 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * Manually set categorie data. |
|
| 38 | - * |
|
| 39 | - * @param array $cat_data Information about a category to be pruned. |
|
| 40 | - */ |
|
| 37 | + * Manually set categorie data. |
|
| 38 | + * |
|
| 39 | + * @param array $cat_data Information about a category to be pruned. |
|
| 40 | + */ |
|
| 41 | 41 | public function set_categorie_data($cat_data) |
| 42 | 42 | { |
| 43 | 43 | $this->cat_data = $cat_data; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | - * Runs this cron task. |
|
| 48 | - * |
|
| 49 | - * @return null |
|
| 50 | - */ |
|
| 47 | + * Runs this cron task. |
|
| 48 | + * |
|
| 49 | + * @return null |
|
| 50 | + */ |
|
| 51 | 51 | public function run() |
| 52 | 52 | { |
| 53 | 53 | $this->dir_cron->auto_check($this->cat_data); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * Returns whether this cron task can run, given current board configuration. |
|
| 58 | - * |
|
| 59 | - * @return bool |
|
| 60 | - */ |
|
| 57 | + * Returns whether this cron task can run, given current board configuration. |
|
| 58 | + * |
|
| 59 | + * @return bool |
|
| 60 | + */ |
|
| 61 | 61 | public function is_runnable() |
| 62 | 62 | { |
| 63 | 63 | return !$this->config['use_system_cron'] && !empty($this->cat_data); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * Returns whether this cron task should run now, because enough time |
|
| 68 | - * has passed since it was last run. |
|
| 69 | - * |
|
| 70 | - * @return bool |
|
| 71 | - */ |
|
| 67 | + * Returns whether this cron task should run now, because enough time |
|
| 68 | + * has passed since it was last run. |
|
| 69 | + * |
|
| 70 | + * @return bool |
|
| 71 | + */ |
|
| 72 | 72 | public function should_run() |
| 73 | 73 | { |
| 74 | 74 | return $this->cat_data['cat_cron_enable'] && $this->cat_data['cat_cron_next'] < time(); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * Returns parameters of this cron task as an array. |
|
| 79 | - * The array has one key, c, whose value is id of the category to be pruned. |
|
| 80 | - * |
|
| 81 | - * @return array |
|
| 82 | - */ |
|
| 78 | + * Returns parameters of this cron task as an array. |
|
| 79 | + * The array has one key, c, whose value is id of the category to be pruned. |
|
| 80 | + * |
|
| 81 | + * @return array |
|
| 82 | + */ |
|
| 83 | 83 | public function get_parameters() |
| 84 | 84 | { |
| 85 | 85 | return array('c' => $this->cat_data['cat_id']); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | - * Parses parameters found in $request, which is an instance of |
|
| 90 | - * \phpbb\request\request_interface. |
|
| 91 | - * |
|
| 92 | - * It is expected to have a key f whose value is id of the forum to be pruned. |
|
| 93 | - * |
|
| 94 | - * @param \phpbb\request\request_interface $request Request object. |
|
| 95 | - * @return null |
|
| 96 | - */ |
|
| 89 | + * Parses parameters found in $request, which is an instance of |
|
| 90 | + * \phpbb\request\request_interface. |
|
| 91 | + * |
|
| 92 | + * It is expected to have a key f whose value is id of the forum to be pruned. |
|
| 93 | + * |
|
| 94 | + * @param \phpbb\request\request_interface $request Request object. |
|
| 95 | + * @return null |
|
| 96 | + */ |
|
| 97 | 97 | public function parse_parameters(\phpbb\request\request_interface $request) |
| 98 | 98 | { |
| 99 | 99 | $this->cat_data = array(); |
@@ -29,8 +29,8 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function __construct(\phpbb\config\config $config, \ernadoo\phpbbdirectory\core\cron $directory_cron) |
| 31 | 31 | { |
| 32 | - $this->config = $config; |
|
| 33 | - $this->dir_cron = $directory_cron; |
|
| 32 | + $this->config = $config; |
|
| 33 | + $this->dir_cron = $directory_cron; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -21,32 +21,32 @@ discard block |
||
| 21 | 21 | protected $helper; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * Set the controller helper |
|
| 25 | - * |
|
| 26 | - * @param \phpbb\controller\helper $helper |
|
| 27 | - * @return null |
|
| 28 | - */ |
|
| 24 | + * Set the controller helper |
|
| 25 | + * |
|
| 26 | + * @param \phpbb\controller\helper $helper |
|
| 27 | + * @return null |
|
| 28 | + */ |
|
| 29 | 29 | public function set_controller_helper(\phpbb\controller\helper $helper) |
| 30 | 30 | { |
| 31 | 31 | $this->helper = $helper; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * Get notification type name |
|
| 36 | - * |
|
| 37 | - * @return string |
|
| 38 | - */ |
|
| 35 | + * Get notification type name |
|
| 36 | + * |
|
| 37 | + * @return string |
|
| 38 | + */ |
|
| 39 | 39 | public function get_type() |
| 40 | 40 | { |
| 41 | 41 | return 'ernadoo.phpbbdirectory.notification.type.directory_website_approved'; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * Notification option data (for outputting to the user) |
|
| 46 | - * |
|
| 47 | - * @var bool|array False if the service should use it's default data |
|
| 48 | - * Array of data (including keys 'id', 'lang', and 'group') |
|
| 49 | - */ |
|
| 45 | + * Notification option data (for outputting to the user) |
|
| 46 | + * |
|
| 47 | + * @var bool|array False if the service should use it's default data |
|
| 48 | + * Array of data (including keys 'id', 'lang', and 'group') |
|
| 49 | + */ |
|
| 50 | 50 | public static $notification_option = array( |
| 51 | 51 | 'id' => 'dir_moderation_queue', |
| 52 | 52 | 'lang' => 'NOTIFICATION_TYPE_DIR_UCP_MODERATION_QUEUE', |
@@ -54,17 +54,17 @@ discard block |
||
| 54 | 54 | ); |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * Permission to check for (in find_users_for_notification) |
|
| 58 | - * |
|
| 59 | - * @var string Permission name |
|
| 60 | - */ |
|
| 57 | + * Permission to check for (in find_users_for_notification) |
|
| 58 | + * |
|
| 59 | + * @var string Permission name |
|
| 60 | + */ |
|
| 61 | 61 | protected $permission = array('a_', 'm_'); |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * Is available |
|
| 65 | - * |
|
| 66 | - * @return bool True/False whether or not this is available to the user |
|
| 67 | - */ |
|
| 64 | + * Is available |
|
| 65 | + * |
|
| 66 | + * @return bool True/False whether or not this is available to the user |
|
| 67 | + */ |
|
| 68 | 68 | public function is_available() |
| 69 | 69 | { |
| 70 | 70 | $has_permission = $this->auth->acl_gets($this->permission, true); |
@@ -73,21 +73,21 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | - * Get link id |
|
| 77 | - * |
|
| 78 | - * @param array $data The data from the link |
|
| 79 | - * @return int |
|
| 80 | - */ |
|
| 76 | + * Get link id |
|
| 77 | + * |
|
| 78 | + * @param array $data The data from the link |
|
| 79 | + * @return int |
|
| 80 | + */ |
|
| 81 | 81 | static public function get_item_id($data) |
| 82 | 82 | { |
| 83 | 83 | return (int) $data['link_id']; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | - * Get parent id - it's not used |
|
| 88 | - * |
|
| 89 | - * @param array $data The data from the link |
|
| 90 | - */ |
|
| 87 | + * Get parent id - it's not used |
|
| 88 | + * |
|
| 89 | + * @param array $data The data from the link |
|
| 90 | + */ |
|
| 91 | 91 | static public function get_item_parent_id($data) |
| 92 | 92 | { |
| 93 | 93 | // No parent |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | - * Find the users who want to receive notifications |
|
| 99 | - * |
|
| 100 | - * @param array $data Data from submit link |
|
| 101 | - * @param array $options Options for finding users for notification |
|
| 102 | - * @return array |
|
| 103 | - */ |
|
| 98 | + * Find the users who want to receive notifications |
|
| 99 | + * |
|
| 100 | + * @param array $data Data from submit link |
|
| 101 | + * @param array $options Options for finding users for notification |
|
| 102 | + * @return array |
|
| 103 | + */ |
|
| 104 | 104 | public function find_users_for_notification($data, $options = array()) |
| 105 | 105 | { |
| 106 | 106 | $options = array_merge(array( |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | - * Get the HTML formatted title of this notification |
|
| 120 | - * |
|
| 121 | - * @return string |
|
| 122 | - */ |
|
| 119 | + * Get the HTML formatted title of this notification |
|
| 120 | + * |
|
| 121 | + * @return string |
|
| 122 | + */ |
|
| 123 | 123 | public function get_title() |
| 124 | 124 | { |
| 125 | 125 | $link_name = $this->get_data('link_name'); |
@@ -129,20 +129,20 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | - * Get email template |
|
| 133 | - * |
|
| 134 | - * @return string |
|
| 135 | - */ |
|
| 132 | + * Get email template |
|
| 133 | + * |
|
| 134 | + * @return string |
|
| 135 | + */ |
|
| 136 | 136 | public function get_email_template() |
| 137 | 137 | { |
| 138 | 138 | return '@ernadoo_phpbbdirectory/directory_website_approved'; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | - * Get email template variables |
|
| 143 | - * |
|
| 144 | - * @return array |
|
| 145 | - */ |
|
| 142 | + * Get email template variables |
|
| 143 | + * |
|
| 144 | + * @return array |
|
| 145 | + */ |
|
| 146 | 146 | public function get_email_template_variables() |
| 147 | 147 | { |
| 148 | 148 | return array( |
@@ -151,33 +151,33 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | - * Get the url to this item |
|
| 155 | - * |
|
| 156 | - * @return string URL |
|
| 157 | - */ |
|
| 154 | + * Get the url to this item |
|
| 155 | + * |
|
| 156 | + * @return string URL |
|
| 157 | + */ |
|
| 158 | 158 | public function get_url() |
| 159 | 159 | { |
| 160 | 160 | return $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $this->get_data('cat_id')); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | - * Users needed to query before this notification can be displayed |
|
| 165 | - * |
|
| 166 | - * @return array Array of user_ids |
|
| 167 | - */ |
|
| 164 | + * Users needed to query before this notification can be displayed |
|
| 165 | + * |
|
| 166 | + * @return array Array of user_ids |
|
| 167 | + */ |
|
| 168 | 168 | public function users_to_query() |
| 169 | 169 | { |
| 170 | 170 | return array(); |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
| 174 | - * Function for preparing the data for insertion in an SQL query |
|
| 175 | - * (The service handles insertion) |
|
| 176 | - * |
|
| 177 | - * @param array $data Data from submit link |
|
| 178 | - * @param array $pre_create_data Data from pre_create_insert_array() |
|
| 179 | - * @return array Array of data ready to be inserted into the database |
|
| 180 | - */ |
|
| 174 | + * Function for preparing the data for insertion in an SQL query |
|
| 175 | + * (The service handles insertion) |
|
| 176 | + * |
|
| 177 | + * @param array $data Data from submit link |
|
| 178 | + * @param array $pre_create_data Data from pre_create_insert_array() |
|
| 179 | + * @return array Array of data ready to be inserted into the database |
|
| 180 | + */ |
|
| 181 | 181 | public function create_insert_array($data, $pre_create_data = array()) |
| 182 | 182 | { |
| 183 | 183 | $this->set_data('link_name', $data['link_name']); |
@@ -157,7 +157,7 @@ |
||
| 157 | 157 | */ |
| 158 | 158 | public function get_url() |
| 159 | 159 | { |
| 160 | - return $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $this->get_data('cat_id')); |
|
| 160 | + return $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$this->get_data('cat_id')); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | protected $watch_table; |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * Set the controller helper |
|
| 28 | - * |
|
| 29 | - * @param \phpbb\controller\helper $helper |
|
| 30 | - * @return null |
|
| 31 | - */ |
|
| 27 | + * Set the controller helper |
|
| 28 | + * |
|
| 29 | + * @param \phpbb\controller\helper $helper |
|
| 30 | + * @return null |
|
| 31 | + */ |
|
| 32 | 32 | public function set_controller_helper(\phpbb\controller\helper $helper) |
| 33 | 33 | { |
| 34 | 34 | $this->helper = $helper; |
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * Get notification type name |
|
| 50 | - * |
|
| 51 | - * @return string |
|
| 52 | - */ |
|
| 49 | + * Get notification type name |
|
| 50 | + * |
|
| 51 | + * @return string |
|
| 52 | + */ |
|
| 53 | 53 | public function get_type() |
| 54 | 54 | { |
| 55 | 55 | return 'ernadoo.phpbbdirectory.notification.type.directory_website'; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | - * Notification option data (for outputting to the user) |
|
| 60 | - * |
|
| 61 | - * @var bool|array False if the service should use it's default data |
|
| 62 | - * Array of data (including keys 'id', 'lang', and 'group') |
|
| 63 | - */ |
|
| 59 | + * Notification option data (for outputting to the user) |
|
| 60 | + * |
|
| 61 | + * @var bool|array False if the service should use it's default data |
|
| 62 | + * Array of data (including keys 'id', 'lang', and 'group') |
|
| 63 | + */ |
|
| 64 | 64 | public static $notification_option = array( |
| 65 | 65 | 'lang' => 'NOTIFICATION_TYPE_DIR_UCP_WEBSITE', |
| 66 | 66 | 'group' => 'NOTIFICATION_DIR_UCP', |
@@ -75,31 +75,31 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * Is available |
|
| 79 | - * |
|
| 80 | - * @return bool True/False whether or not this is available to the user |
|
| 81 | - */ |
|
| 78 | + * Is available |
|
| 79 | + * |
|
| 80 | + * @return bool True/False whether or not this is available to the user |
|
| 81 | + */ |
|
| 82 | 82 | public function is_available() |
| 83 | 83 | { |
| 84 | 84 | return true; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | - * Get link id |
|
| 89 | - * |
|
| 90 | - * @param array $data The data from the link |
|
| 91 | - * @return int |
|
| 92 | - */ |
|
| 88 | + * Get link id |
|
| 89 | + * |
|
| 90 | + * @param array $data The data from the link |
|
| 91 | + * @return int |
|
| 92 | + */ |
|
| 93 | 93 | static public function get_item_id($data) |
| 94 | 94 | { |
| 95 | 95 | return (int) $data['link_id']; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | - * Get parent id - it's not used |
|
| 100 | - * |
|
| 101 | - * @param array $data The data from the link |
|
| 102 | - */ |
|
| 99 | + * Get parent id - it's not used |
|
| 100 | + * |
|
| 101 | + * @param array $data The data from the link |
|
| 102 | + */ |
|
| 103 | 103 | static public function get_item_parent_id($data) |
| 104 | 104 | { |
| 105 | 105 | // No parent |
@@ -107,12 +107,12 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | - * Find the users who want to receive notifications |
|
| 111 | - * |
|
| 112 | - * @param array $data Data from submit link |
|
| 113 | - * @param array $options Options for finding users for notification |
|
| 114 | - * @return array |
|
| 115 | - */ |
|
| 110 | + * Find the users who want to receive notifications |
|
| 111 | + * |
|
| 112 | + * @param array $data Data from submit link |
|
| 113 | + * @param array $options Options for finding users for notification |
|
| 114 | + * @return array |
|
| 115 | + */ |
|
| 116 | 116 | public function find_users_for_notification($data, $options = array()) |
| 117 | 117 | { |
| 118 | 118 | $options = array_merge(array( |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | - * Get the user's avatar |
|
| 148 | - */ |
|
| 147 | + * Get the user's avatar |
|
| 148 | + */ |
|
| 149 | 149 | public function get_avatar() |
| 150 | 150 | { |
| 151 | 151 | return $this->user_loader->get_avatar($this->get_data('user_from'), false, true); |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | - * Get the HTML formatted title of this notification |
|
| 157 | - * |
|
| 158 | - * @return string |
|
| 159 | - */ |
|
| 156 | + * Get the HTML formatted title of this notification |
|
| 157 | + * |
|
| 158 | + * @return string |
|
| 159 | + */ |
|
| 160 | 160 | |
| 161 | 161 | public function get_title() |
| 162 | 162 | { |
@@ -169,20 +169,20 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | - * Get email template |
|
| 173 | - * |
|
| 174 | - * @return string |
|
| 175 | - */ |
|
| 172 | + * Get email template |
|
| 173 | + * |
|
| 174 | + * @return string |
|
| 175 | + */ |
|
| 176 | 176 | public function get_email_template() |
| 177 | 177 | { |
| 178 | 178 | return '@ernadoo_phpbbdirectory/directory_website'; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
| 182 | - * Get email template variables |
|
| 183 | - * |
|
| 184 | - * @return array |
|
| 185 | - */ |
|
| 182 | + * Get email template variables |
|
| 183 | + * |
|
| 184 | + * @return array |
|
| 185 | + */ |
|
| 186 | 186 | public function get_email_template_variables() |
| 187 | 187 | { |
| 188 | 188 | return array( |
@@ -194,33 +194,33 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | - * Get the url to this item |
|
| 198 | - * |
|
| 199 | - * @return string URL |
|
| 200 | - */ |
|
| 197 | + * Get the url to this item |
|
| 198 | + * |
|
| 199 | + * @return string URL |
|
| 200 | + */ |
|
| 201 | 201 | public function get_url() |
| 202 | 202 | { |
| 203 | 203 | return $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $this->get_data('cat_id')); |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
| 207 | - * Users needed to query before this notification can be displayed |
|
| 208 | - * |
|
| 209 | - * @return array Array of user_ids |
|
| 210 | - */ |
|
| 207 | + * Users needed to query before this notification can be displayed |
|
| 208 | + * |
|
| 209 | + * @return array Array of user_ids |
|
| 210 | + */ |
|
| 211 | 211 | public function users_to_query() |
| 212 | 212 | { |
| 213 | 213 | return array($this->get_data('user_from')); |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
| 217 | - * Function for preparing the data for insertion in an SQL query |
|
| 218 | - * (The service handles insertion) |
|
| 219 | - * |
|
| 220 | - * @param array $data Data from submit link |
|
| 221 | - * @param array $pre_create_data Data from pre_create_insert_array() |
|
| 222 | - * @return array Array of data ready to be inserted into the database |
|
| 223 | - */ |
|
| 217 | + * Function for preparing the data for insertion in an SQL query |
|
| 218 | + * (The service handles insertion) |
|
| 219 | + * |
|
| 220 | + * @param array $data Data from submit link |
|
| 221 | + * @param array $pre_create_data Data from pre_create_insert_array() |
|
| 222 | + * @return array Array of data ready to be inserted into the database |
|
| 223 | + */ |
|
| 224 | 224 | public function create_insert_array($data, $pre_create_data = array()) |
| 225 | 225 | { |
| 226 | 226 | $this->set_data('link_name', $data['link_name']); |
@@ -122,9 +122,9 @@ discard block |
||
| 122 | 122 | $users = array(); |
| 123 | 123 | |
| 124 | 124 | $sql = 'SELECT user_id |
| 125 | - FROM ' . $this->watch_table . ' |
|
| 126 | - WHERE cat_id = ' . (int) $data['cat_id'] . ' |
|
| 127 | - AND notify_status = ' . NOTIFY_YES . ' |
|
| 125 | + FROM ' . $this->watch_table.' |
|
| 126 | + WHERE cat_id = ' . (int) $data['cat_id'].' |
|
| 127 | + AND notify_status = ' . NOTIFY_YES.' |
|
| 128 | 128 | AND user_id <> ' . (int) $data['user_from']; |
| 129 | 129 | $result = $this->db->sql_query($sql); |
| 130 | 130 | while ($row = $this->db->sql_fetchrow($result)) |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public function get_url() |
| 202 | 202 | { |
| 203 | - return $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $this->get_data('cat_id')); |
|
| 203 | + return $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$this->get_data('cat_id')); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |