@@ -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 | /** |
@@ -50,20 +50,20 @@ discard block |
||
| 50 | 50 | protected $link; |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | - * Constructor |
|
| 54 | - * |
|
| 55 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 56 | - * @param \phpbb\config\config $config Config object |
|
| 57 | - * @param \phpbb\language\language $language Language object |
|
| 58 | - * @param \phpbb\template\template $template Template object |
|
| 59 | - * @param \phpbb\user $user User object |
|
| 60 | - * @param \phpbb\controller\helper $helper Controller helper object |
|
| 61 | - * @param \phpbb\request\request $request Request object |
|
| 62 | - * @param \phpbb\auth\auth $auth Auth object |
|
| 63 | - * @param \phpbb\pagination $pagination Pagination object |
|
| 64 | - * @param \ernadoo\phpbbdirectory\core\categorie $categorie PhpBB Directory extension categorie object |
|
| 65 | - * @param \ernadoo\phpbbdirectory\core\link $link PhpBB Directory extension link object |
|
| 66 | - */ |
|
| 53 | + * Constructor |
|
| 54 | + * |
|
| 55 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 56 | + * @param \phpbb\config\config $config Config object |
|
| 57 | + * @param \phpbb\language\language $language Language object |
|
| 58 | + * @param \phpbb\template\template $template Template object |
|
| 59 | + * @param \phpbb\user $user User object |
|
| 60 | + * @param \phpbb\controller\helper $helper Controller helper object |
|
| 61 | + * @param \phpbb\request\request $request Request object |
|
| 62 | + * @param \phpbb\auth\auth $auth Auth object |
|
| 63 | + * @param \phpbb\pagination $pagination Pagination object |
|
| 64 | + * @param \ernadoo\phpbbdirectory\core\categorie $categorie PhpBB Directory extension categorie object |
|
| 65 | + * @param \ernadoo\phpbbdirectory\core\link $link PhpBB Directory extension link object |
|
| 66 | + */ |
|
| 67 | 67 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\language\language $language, \phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, \phpbb\request\request $request, \phpbb\auth\auth $auth, \phpbb\pagination $pagination, \ernadoo\phpbbdirectory\core\categorie $categorie, \ernadoo\phpbbdirectory\core\link $link) |
| 68 | 68 | { |
| 69 | 69 | $this->db = $db; |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | - * Base controller to be accessed with the URL /directory |
|
| 90 | - * |
|
| 91 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 92 | - */ |
|
| 89 | + * Base controller to be accessed with the URL /directory |
|
| 90 | + * |
|
| 91 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 92 | + */ |
|
| 93 | 93 | public function base() |
| 94 | 94 | { |
| 95 | 95 | $this->categorie->display(); |
@@ -99,19 +99,19 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * Legacy view controller for display a category |
|
| 103 | - * Used with /directory/categorie/{cat_id} |
|
| 104 | - * @deprecated 2.0.0 No longer used since dynamic routing. |
|
| 105 | - * |
|
| 106 | - * @param int $cat_id The category ID |
|
| 107 | - * @param int $page Page number taken from the URL |
|
| 108 | - * @param int $sort_days Specifies the maximum amount of days a link may be old |
|
| 109 | - * @param string $sort_key is the key of $sort_by_sql for the selected sorting: a|t|r|s|v|p |
|
| 110 | - * @param string $sort_dir is either a or d representing ASC and DESC (ascending|descending) |
|
| 111 | - * @param string $mode watch|unwatch |
|
| 112 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 113 | - * @throws \phpbb\exception\http_exception |
|
| 114 | - */ |
|
| 102 | + * Legacy view controller for display a category |
|
| 103 | + * Used with /directory/categorie/{cat_id} |
|
| 104 | + * @deprecated 2.0.0 No longer used since dynamic routing. |
|
| 105 | + * |
|
| 106 | + * @param int $cat_id The category ID |
|
| 107 | + * @param int $page Page number taken from the URL |
|
| 108 | + * @param int $sort_days Specifies the maximum amount of days a link may be old |
|
| 109 | + * @param string $sort_key is the key of $sort_by_sql for the selected sorting: a|t|r|s|v|p |
|
| 110 | + * @param string $sort_dir is either a or d representing ASC and DESC (ascending|descending) |
|
| 111 | + * @param string $mode watch|unwatch |
|
| 112 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 113 | + * @throws \phpbb\exception\http_exception |
|
| 114 | + */ |
|
| 115 | 115 | public function view($cat_id, $page, $sort_days, $sort_key, $sort_dir, $mode = '') |
| 116 | 116 | { |
| 117 | 117 | $url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, array('page' => $page, 'sort_days' => $sort_days, 'sort_key' => $sort_key, 'sort_dir' => $sort_dir)); |
@@ -120,17 +120,17 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | - * View controller for display a category |
|
| 124 | - * |
|
| 125 | - * @param int $cat_id The category ID |
|
| 126 | - * @param int $page Page number taken from the URL |
|
| 127 | - * @param int $sort_days Specifies the maximum amount of days a link may be old |
|
| 128 | - * @param string $sort_key is the key of $sort_by_sql for the selected sorting: a|t|r|s|v|p |
|
| 129 | - * @param string $sort_dir is either a or d representing ASC and DESC (ascending|descending) |
|
| 130 | - * @param string $mode watch|unwatch |
|
| 131 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 132 | - * @throws \phpbb\exception\http_exception |
|
| 133 | - */ |
|
| 123 | + * View controller for display a category |
|
| 124 | + * |
|
| 125 | + * @param int $cat_id The category ID |
|
| 126 | + * @param int $page Page number taken from the URL |
|
| 127 | + * @param int $sort_days Specifies the maximum amount of days a link may be old |
|
| 128 | + * @param string $sort_key is the key of $sort_by_sql for the selected sorting: a|t|r|s|v|p |
|
| 129 | + * @param string $sort_dir is either a or d representing ASC and DESC (ascending|descending) |
|
| 130 | + * @param string $mode watch|unwatch |
|
| 131 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 132 | + * @throws \phpbb\exception\http_exception |
|
| 133 | + */ |
|
| 134 | 134 | public function view_route($cat_id, $page, $sort_days, $sort_key, $sort_dir, $mode = '') |
| 135 | 135 | { |
| 136 | 136 | if (false === $this->categorie->get($cat_id)) |
@@ -393,11 +393,11 @@ discard block |
||
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | /** |
| 396 | - * date controller for return a date |
|
| 397 | - * |
|
| 398 | - * @return \phpbb\json_response A Json Response |
|
| 399 | - * @throws \phpbb\exception\http_exception |
|
| 400 | - */ |
|
| 396 | + * date controller for return a date |
|
| 397 | + * |
|
| 398 | + * @return \phpbb\json_response A Json Response |
|
| 399 | + * @throws \phpbb\exception\http_exception |
|
| 400 | + */ |
|
| 401 | 401 | public function return_date() |
| 402 | 402 | { |
| 403 | 403 | if (!$this->request->is_ajax()) |
@@ -414,11 +414,11 @@ discard block |
||
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | /** |
| 417 | - * slug controller for return a slugify category name |
|
| 418 | - * |
|
| 419 | - * @return \phpbb\json_response A Json Response |
|
| 420 | - * @throws \phpbb\exception\http_exception |
|
| 421 | - */ |
|
| 417 | + * slug controller for return a slugify category name |
|
| 418 | + * |
|
| 419 | + * @return \phpbb\json_response A Json Response |
|
| 420 | + * @throws \phpbb\exception\http_exception |
|
| 421 | + */ |
|
| 422 | 422 | public function return_slug() |
| 423 | 423 | { |
| 424 | 424 | if (!$this->request->is_ajax()) |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\language\language $language, \phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, \phpbb\request\request $request, \phpbb\auth\auth $auth, \phpbb\pagination $pagination, \ernadoo\phpbbdirectory\core\categorie $categorie, \ernadoo\phpbbdirectory\core\link $link) |
| 68 | 68 | { |
| 69 | - $this->db = $db; |
|
| 70 | - $this->config = $config; |
|
| 69 | + $this->db = $db; |
|
| 70 | + $this->config = $config; |
|
| 71 | 71 | $this->language = $language; |
| 72 | 72 | $this->template = $template; |
| 73 | 73 | $this->user = $user; |
| 74 | - $this->helper = $helper; |
|
| 75 | - $this->request = $request; |
|
| 74 | + $this->helper = $helper; |
|
| 75 | + $this->request = $request; |
|
| 76 | 76 | $this->auth = $auth; |
| 77 | - $this->pagination = $pagination; |
|
| 78 | - $this->categorie = $categorie; |
|
| 77 | + $this->pagination = $pagination; |
|
| 78 | + $this->categorie = $categorie; |
|
| 79 | 79 | $this->link = $link; |
| 80 | 80 | |
| 81 | 81 | $language->add_lang('directory', 'ernadoo/phpbbdirectory'); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function view($cat_id, $page, $sort_days, $sort_key, $sort_dir, $mode = '') |
| 116 | 116 | { |
| 117 | - $url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, array('page' => $page, 'sort_days' => $sort_days, 'sort_key' => $sort_key, 'sort_dir' => $sort_dir)); |
|
| 117 | + $url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, array('page' => $page, 'sort_days' => $sort_days, 'sort_key' => $sort_key, 'sort_dir' => $sort_dir)); |
|
| 118 | 118 | |
| 119 | 119 | return new RedirectResponse($url, 301); |
| 120 | 120 | } |
@@ -140,18 +140,18 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $start = ($page - 1) * $this->config['dir_show']; |
| 142 | 142 | |
| 143 | - $default_sort_days = 0; |
|
| 143 | + $default_sort_days = 0; |
|
| 144 | 144 | $default_sort_key = (string) substr($this->config['dir_default_order'], 0, 1); |
| 145 | 145 | $default_sort_dir = (string) substr($this->config['dir_default_order'], 2); |
| 146 | 146 | |
| 147 | 147 | $sort_days = (!$sort_days) ? $this->request->variable('st', $default_sort_days) : $sort_days; |
| 148 | 148 | $sort_key = (!$sort_key) ? $this->request->variable('sk', $default_sort_key) : $sort_key; |
| 149 | - $sort_dir = (!$sort_dir) ? $this->request->variable('sd', $default_sort_dir) : $sort_dir; |
|
| 149 | + $sort_dir = (!$sort_dir) ? $this->request->variable('sd', $default_sort_dir) : $sort_dir; |
|
| 150 | 150 | $link_list = $rowset = array(); |
| 151 | 151 | |
| 152 | 152 | // Categorie ordering options |
| 153 | 153 | $limit_days = array(0 => $this->language->lang('SEE_ALL'), 1 => $this->language->lang('1_DAY'), 7 => $this->language->lang('7_DAYS'), 14 => $this->language->lang('2_WEEKS'), 30 => $this->language->lang('1_MONTH'), 90 => $this->language->lang('3_MONTHS'), 180 => $this->language->lang('6_MONTHS'), 365 => $this->language->lang('1_YEAR')); |
| 154 | - $sort_by_text = array('a' => $this->language->lang('AUTHOR'), 't' => $this->language->lang('POST_TIME'), 'r' => $this->language->lang('DIR_COMMENTS_ORDER'), 's' => $this->language->lang('DIR_NAME_ORDER'), 'v' => $this->language->lang('DIR_NB_CLICKS_ORDER')); |
|
| 154 | + $sort_by_text = array('a' => $this->language->lang('AUTHOR'), 't' => $this->language->lang('POST_TIME'), 'r' => $this->language->lang('DIR_COMMENTS_ORDER'), 's' => $this->language->lang('DIR_NAME_ORDER'), 'v' => $this->language->lang('DIR_NB_CLICKS_ORDER')); |
|
| 155 | 155 | $sort_by_sql = array('a' => 'u.username_clean', 't' => array('l.link_time', 'l.link_id'), 'r' => 'l.link_comment', 's' => 'LOWER(l.link_name)', 'v' => 'l.link_view'); |
| 156 | 156 | |
| 157 | 157 | if ($this->config['dir_activ_pagerank']) |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | $min_post_time = time() - ($sort_days * 86400); |
| 191 | 191 | |
| 192 | 192 | $sql = 'SELECT COUNT(link_id) AS nb_links |
| 193 | - FROM ' . $this->links_table . ' |
|
| 194 | - WHERE link_cat = ' . (int) $cat_id . ' |
|
| 193 | + FROM ' . $this->links_table.' |
|
| 194 | + WHERE link_cat = ' . (int) $cat_id.' |
|
| 195 | 195 | AND link_time >= ' . (int) $min_post_time; |
| 196 | 196 | $result = $this->db->sql_query($sql); |
| 197 | 197 | $nb_links = (int) $this->db->sql_fetchfield('nb_links'); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | else |
| 207 | 207 | { |
| 208 | 208 | $sql_limit_time = ''; |
| 209 | - $nb_links = (int) $this->categorie->data['cat_links']; |
|
| 209 | + $nb_links = (int) $this->categorie->data['cat_links']; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // Make sure $start is set to the last page if it exceeds the amount |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $this->categorie->make_cat_jumpbox(); |
| 220 | 220 | |
| 221 | 221 | $base_url = array( |
| 222 | - 'routes' => 'ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, |
|
| 222 | + 'routes' => 'ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, |
|
| 223 | 223 | 'params' => array_merge(array('cat_id' => $cat_id), $u_sort_param), |
| 224 | 224 | ); |
| 225 | 225 | |
@@ -232,14 +232,14 @@ discard block |
||
| 232 | 232 | 'S_SELECT_SORT_KEY' => $s_sort_key, |
| 233 | 233 | 'S_SELECT_SORT_DAYS' => $s_limit_days, |
| 234 | 234 | 'S_CATLIST' => $this->categorie->make_cat_select($cat_id), |
| 235 | - 'S_PAGE_ACTION' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, array('page' => $page)), |
|
| 235 | + 'S_PAGE_ACTION' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, array('page' => $page)), |
|
| 236 | 236 | 'S_CAT_ID' => $cat_id, |
| 237 | 237 | |
| 238 | 238 | 'TOTAL_LINKS' => $this->language->lang('DIR_NB_LINKS', (int) $nb_links), |
| 239 | 239 | |
| 240 | 240 | 'U_NEW_SITE' => $this->helper->route('ernadoo_phpbbdirectory_new_controller', array('cat_id' => $cat_id)), |
| 241 | 241 | |
| 242 | - 'U_VIEW_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id), |
|
| 242 | + 'U_VIEW_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id), |
|
| 243 | 243 | 'U_WATCH_CAT' => $s_watching_categorie['link'], |
| 244 | 244 | 'U_WATCH_CAT_TOGGLE' => $s_watching_categorie['link_toggle'], |
| 245 | 245 | 'S_WATCH_CAT_TITLE' => $s_watching_categorie['title'], |
@@ -269,11 +269,11 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | if (is_array($sort_by_sql[$sort_key])) |
| 271 | 271 | { |
| 272 | - $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; |
|
| 272 | + $sql_sort_order = implode(' '.$direction.', ', $sort_by_sql[$sort_key]).' '.$direction; |
|
| 273 | 273 | } |
| 274 | 274 | else |
| 275 | 275 | { |
| 276 | - $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; |
|
| 276 | + $sql_sort_order = $sort_by_sql[$sort_key].' '.$direction; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | // Grab just the sorted link ids |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | ), |
| 317 | 317 | array( |
| 318 | 318 | 'FROM' => array($this->votes_table => 'v'), |
| 319 | - 'ON' => 'l.link_id = v.vote_link_id AND v.vote_user_id = ' . $this->user->data['user_id'] |
|
| 319 | + 'ON' => 'l.link_id = v.vote_link_id AND v.vote_user_id = '.$this->user->data['user_id'] |
|
| 320 | 320 | ) |
| 321 | 321 | ), |
| 322 | 322 | 'WHERE' => $this->db->sql_in_set('l.link_id', $link_list) |
@@ -333,8 +333,8 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | $link_list = ($store_reverse) ? array_reverse($link_list) : $link_list; |
| 335 | 335 | |
| 336 | - $votes_status = ($this->categorie->data['cat_allow_votes']) ? true : false; |
|
| 337 | - $comments_status = ($this->categorie->data['cat_allow_comments']) ? true : false; |
|
| 336 | + $votes_status = ($this->categorie->data['cat_allow_votes']) ? true : false; |
|
| 337 | + $comments_status = ($this->categorie->data['cat_allow_comments']) ? true : false; |
|
| 338 | 338 | |
| 339 | 339 | foreach ($link_list as $link_id) |
| 340 | 340 | { |
@@ -344,11 +344,11 @@ discard block |
||
| 344 | 344 | $s_note = $this->link->display_note($site['link_note'], $site['link_vote'], $votes_status); |
| 345 | 345 | $s_thumb = $this->link->display_thumb($site); |
| 346 | 346 | $s_vote = $this->link->display_vote($site); |
| 347 | - $s_banner = $this->link->display_bann($site); |
|
| 348 | - $s_pr = $this->link->display_pagerank($site); |
|
| 349 | - $s_rss = $this->link->display_rss($site); |
|
| 347 | + $s_banner = $this->link->display_bann($site); |
|
| 348 | + $s_pr = $this->link->display_pagerank($site); |
|
| 349 | + $s_rss = $this->link->display_rss($site); |
|
| 350 | 350 | |
| 351 | - $edit_allowed = ($this->user->data['is_registered'] && ($this->auth->acl_get('m_edit_dir') || ($this->user->data['user_id'] == $site['link_user_id'] && $this->auth->acl_get('u_edit_dir')))); |
|
| 351 | + $edit_allowed = ($this->user->data['is_registered'] && ($this->auth->acl_get('m_edit_dir') || ($this->user->data['user_id'] == $site['link_user_id'] && $this->auth->acl_get('u_edit_dir')))); |
|
| 352 | 352 | $delete_allowed = ($this->user->data['is_registered'] && ($this->auth->acl_get('m_delete_dir') || ($this->user->data['user_id'] == $site['link_user_id'] && $this->auth->acl_get('u_delete_dir')))); |
| 353 | 353 | |
| 354 | 354 | $this->template->assign_block_vars('site', array( |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | $this->template->assign_block_vars('no_draw_link', array()); |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - $page_title = $this->language->lang('DIRECTORY') . ' - ' . $this->categorie->data['cat_name']; |
|
| 388 | + $page_title = $this->language->lang('DIRECTORY').' - '.$this->categorie->data['cat_name']; |
|
| 389 | 389 | |
| 390 | 390 | $this->categorie->display(); |
| 391 | 391 | |
@@ -69,19 +69,19 @@ discard block |
||
| 69 | 69 | private $update; |
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | - * Constructor |
|
| 73 | - * |
|
| 74 | - * @param \phpbb\cache\service $cache Cache object |
|
| 75 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 76 | - * @param \phpbb\controller\helper $helper Helper object |
|
| 77 | - * @param \phpbb\language\language $language Language object |
|
| 78 | - * @param \phpbb\log\log $log Log object |
|
| 79 | - * @param \phpbb\request\request $request Request object |
|
| 80 | - * @param \phpbb\template\template $template Template object |
|
| 81 | - * @param \phpbb\user $user User object |
|
| 82 | - * @param \ernadoo\phpbbdirectory\core\categorie $categorie PhpBB Directory extension categorie object |
|
| 83 | - * @param \ernadoo\phpbbdirectory\core\nestedset_category $nestedset_category PhpBB Directory extension nestedset object |
|
| 84 | - */ |
|
| 72 | + * Constructor |
|
| 73 | + * |
|
| 74 | + * @param \phpbb\cache\service $cache Cache object |
|
| 75 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 76 | + * @param \phpbb\controller\helper $helper Helper object |
|
| 77 | + * @param \phpbb\language\language $language Language object |
|
| 78 | + * @param \phpbb\log\log $log Log object |
|
| 79 | + * @param \phpbb\request\request $request Request object |
|
| 80 | + * @param \phpbb\template\template $template Template object |
|
| 81 | + * @param \phpbb\user $user User object |
|
| 82 | + * @param \ernadoo\phpbbdirectory\core\categorie $categorie PhpBB Directory extension categorie object |
|
| 83 | + * @param \ernadoo\phpbbdirectory\core\nestedset_category $nestedset_category PhpBB Directory extension nestedset object |
|
| 84 | + */ |
|
| 85 | 85 | public function __construct(\phpbb\cache\service $cache, \phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\language\language $language, \phpbb\log\log $log, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, \ernadoo\phpbbdirectory\core\categorie $categorie, \ernadoo\phpbbdirectory\core\nestedset_category $nestedset_category) |
| 86 | 86 | { |
| 87 | 87 | $this->cache = $cache; |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | - * Initialize defaults data for add page |
|
| 109 | - * |
|
| 110 | - * @return null |
|
| 111 | - */ |
|
| 108 | + * Initialize defaults data for add page |
|
| 109 | + * |
|
| 110 | + * @return null |
|
| 111 | + */ |
|
| 112 | 112 | public function action_add() |
| 113 | 113 | { |
| 114 | 114 | $this->cat_id = $this->parent_id; |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | - * Display deleting page |
|
| 147 | - * |
|
| 148 | - * @return null |
|
| 149 | - */ |
|
| 146 | + * Display deleting page |
|
| 147 | + * |
|
| 148 | + * @return null |
|
| 149 | + */ |
|
| 150 | 150 | public function action_delete() |
| 151 | 151 | { |
| 152 | 152 | if (!$this->cat_id) |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | - * Initialize data for edit page |
|
| 201 | - * |
|
| 202 | - * @return null |
|
| 203 | - */ |
|
| 200 | + * Initialize data for edit page |
|
| 201 | + * |
|
| 202 | + * @return null |
|
| 203 | + */ |
|
| 204 | 204 | public function action_edit() |
| 205 | 205 | { |
| 206 | 206 | $row = $this->_get_cat_info($this->cat_id); |
@@ -227,10 +227,10 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
| 230 | - * Move order categories |
|
| 231 | - * |
|
| 232 | - * @return null |
|
| 233 | - */ |
|
| 230 | + * Move order categories |
|
| 231 | + * |
|
| 232 | + * @return null |
|
| 233 | + */ |
|
| 234 | 234 | public function action_move() |
| 235 | 235 | { |
| 236 | 236 | if (!$this->cat_id) |
@@ -273,10 +273,10 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
| 276 | - * Display progress bar for syncinc categories |
|
| 277 | - * |
|
| 278 | - * @return null |
|
| 279 | - */ |
|
| 276 | + * Display progress bar for syncinc categories |
|
| 277 | + * |
|
| 278 | + * @return null |
|
| 279 | + */ |
|
| 280 | 280 | public function action_progress_bar() |
| 281 | 281 | { |
| 282 | 282 | $start = $this->request->variable('start', 0); |
@@ -297,10 +297,10 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /** |
| 300 | - * Get link's ID interval for _sync_dir_links() |
|
| 301 | - * |
|
| 302 | - * @return null |
|
| 303 | - */ |
|
| 300 | + * Get link's ID interval for _sync_dir_links() |
|
| 301 | + * |
|
| 302 | + * @return null |
|
| 303 | + */ |
|
| 304 | 304 | public function action_sync() |
| 305 | 305 | { |
| 306 | 306 | if (!$this->cat_id) |
@@ -382,10 +382,10 @@ discard block |
||
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | /** |
| 385 | - * Sync category data |
|
| 386 | - * |
|
| 387 | - * @return null |
|
| 388 | - */ |
|
| 385 | + * Sync category data |
|
| 386 | + * |
|
| 387 | + * @return null |
|
| 388 | + */ |
|
| 389 | 389 | public function action_sync_cat() |
| 390 | 390 | { |
| 391 | 391 | $sql = 'SELECT cat_name |
@@ -409,10 +409,10 @@ discard block |
||
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /** |
| 412 | - * Display categories page |
|
| 413 | - * |
|
| 414 | - * @return null |
|
| 415 | - */ |
|
| 412 | + * Display categories page |
|
| 413 | + * |
|
| 414 | + * @return null |
|
| 415 | + */ |
|
| 416 | 416 | public function display_cats() |
| 417 | 417 | { |
| 418 | 418 | // Default management page |
@@ -506,22 +506,22 @@ discard block |
||
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | /** |
| 509 | - * Set page url |
|
| 510 | - * |
|
| 511 | - * @param string $u_action Custom form action |
|
| 512 | - * @return null |
|
| 513 | - * @access public |
|
| 514 | - */ |
|
| 509 | + * Set page url |
|
| 510 | + * |
|
| 511 | + * @param string $u_action Custom form action |
|
| 512 | + * @return null |
|
| 513 | + * @access public |
|
| 514 | + */ |
|
| 515 | 515 | public function set_page_url($u_action) |
| 516 | 516 | { |
| 517 | 517 | $this->u_action = $u_action; |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | /** |
| 521 | - * Update cat table |
|
| 522 | - * |
|
| 523 | - * @return null |
|
| 524 | - */ |
|
| 521 | + * Update cat table |
|
| 522 | + * |
|
| 523 | + * @return null |
|
| 524 | + */ |
|
| 525 | 525 | public function update() |
| 526 | 526 | { |
| 527 | 527 | if (!check_form_key($this->form_key)) |
@@ -619,13 +619,13 @@ discard block |
||
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | /** |
| 622 | - * Check route |
|
| 623 | - * |
|
| 624 | - * @param string $route Route text |
|
| 625 | - * @return null |
|
| 626 | - * @access public |
|
| 627 | - * @throws \phpbb\pages\exception\unexpected_value |
|
| 628 | - */ |
|
| 622 | + * Check route |
|
| 623 | + * |
|
| 624 | + * @param string $route Route text |
|
| 625 | + * @return null |
|
| 626 | + * @access public |
|
| 627 | + * @throws \phpbb\pages\exception\unexpected_value |
|
| 628 | + */ |
|
| 629 | 629 | private function _check_route($route) |
| 630 | 630 | { |
| 631 | 631 | // Route is a required field |
@@ -656,11 +656,11 @@ discard block |
||
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | /** |
| 659 | - * Display form |
|
| 660 | - * |
|
| 661 | - * @param string $parents_list Drop-down list |
|
| 662 | - * @return null |
|
| 663 | - */ |
|
| 659 | + * Display form |
|
| 660 | + * |
|
| 661 | + * @param string $parents_list Drop-down list |
|
| 662 | + * @return null |
|
| 663 | + */ |
|
| 664 | 664 | private function _display_cat_form($parents_list) |
| 665 | 665 | { |
| 666 | 666 | $dir_cat_desc_data = array( |
@@ -732,11 +732,11 @@ discard block |
||
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | /** |
| 735 | - * Get category details |
|
| 736 | - * |
|
| 737 | - * @param int $cat_id The category ID |
|
| 738 | - * @return array |
|
| 739 | - */ |
|
| 735 | + * Get category details |
|
| 736 | + * |
|
| 737 | + * @param int $cat_id The category ID |
|
| 738 | + * @return array |
|
| 739 | + */ |
|
| 740 | 740 | private function _get_cat_info($cat_id) |
| 741 | 741 | { |
| 742 | 742 | $sql = 'SELECT cat_id, parent_id, right_id, left_id, cat_desc, cat_desc_uid, cat_desc_options, cat_icon, cat_name, cat_route, display_subcat_list, cat_allow_comments, cat_allow_votes, cat_must_describe, cat_count_all, cat_validate, cat_cron_freq, cat_cron_nb_check, cat_link_back, cat_cron_enable, cat_cron_next |
@@ -755,10 +755,10 @@ discard block |
||
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | /** |
| 758 | - * Update category data |
|
| 759 | - * |
|
| 760 | - * @return array |
|
| 761 | - */ |
|
| 758 | + * Update category data |
|
| 759 | + * |
|
| 760 | + * @return array |
|
| 761 | + */ |
|
| 762 | 762 | private function _update_cat_data() |
| 763 | 763 | { |
| 764 | 764 | if (!$this->cat_data['cat_name']) |
@@ -854,14 +854,14 @@ discard block |
||
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | /** |
| 857 | - * Remove complete category |
|
| 858 | - * |
|
| 859 | - * @param string $action_links Action for categories links |
|
| 860 | - * @param string $action_subcats Action for sub-categories |
|
| 861 | - * @param int $links_to_id New category ID for links |
|
| 862 | - * @param int $subcats_to_id New category ID for sub-categories |
|
| 863 | - * @return array |
|
| 864 | - */ |
|
| 857 | + * Remove complete category |
|
| 858 | + * |
|
| 859 | + * @param string $action_links Action for categories links |
|
| 860 | + * @param string $action_subcats Action for sub-categories |
|
| 861 | + * @param int $links_to_id New category ID for links |
|
| 862 | + * @param int $subcats_to_id New category ID for sub-categories |
|
| 863 | + * @return array |
|
| 864 | + */ |
|
| 865 | 865 | private function _delete_cat($action_links = 'delete', $action_subcats = 'delete', $links_to_id = 0, $subcats_to_id = 0) |
| 866 | 866 | { |
| 867 | 867 | $this->cat_data = $this->_get_cat_info($this->cat_id); |
@@ -978,12 +978,12 @@ discard block |
||
| 978 | 978 | } |
| 979 | 979 | |
| 980 | 980 | /** |
| 981 | - * Move category content from one to another forum |
|
| 982 | - * |
|
| 983 | - * @param int $from_id |
|
| 984 | - * @param int $to_id |
|
| 985 | - * @return null |
|
| 986 | - */ |
|
| 981 | + * Move category content from one to another forum |
|
| 982 | + * |
|
| 983 | + * @param int $from_id |
|
| 984 | + * @param int $to_id |
|
| 985 | + * @return null |
|
| 986 | + */ |
|
| 987 | 987 | private function _move_cat_content($from_id, $to_id) |
| 988 | 988 | { |
| 989 | 989 | $sql = 'UPDATE ' . $this->links_table . ' |
@@ -999,10 +999,10 @@ discard block |
||
| 999 | 999 | } |
| 1000 | 1000 | |
| 1001 | 1001 | /** |
| 1002 | - * Delete category content |
|
| 1003 | - * |
|
| 1004 | - * @return array |
|
| 1005 | - */ |
|
| 1002 | + * Delete category content |
|
| 1003 | + * |
|
| 1004 | + * @return array |
|
| 1005 | + */ |
|
| 1006 | 1006 | private function _delete_cat_content() |
| 1007 | 1007 | { |
| 1008 | 1008 | $this->db->sql_transaction('begin'); |
@@ -1061,11 +1061,11 @@ discard block |
||
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | /** |
| 1064 | - * Update links counter |
|
| 1065 | - * |
|
| 1066 | - * @param int $cat_id The category ID |
|
| 1067 | - * @return null |
|
| 1068 | - */ |
|
| 1064 | + * Update links counter |
|
| 1065 | + * |
|
| 1066 | + * @param int $cat_id The category ID |
|
| 1067 | + * @return null |
|
| 1068 | + */ |
|
| 1069 | 1069 | private function _sync_dir_cat($cat_id) |
| 1070 | 1070 | { |
| 1071 | 1071 | $sql = 'SELECT COUNT(link_id) AS num_links |
@@ -1083,12 +1083,12 @@ discard block |
||
| 1083 | 1083 | } |
| 1084 | 1084 | |
| 1085 | 1085 | /** |
| 1086 | - * Update link data (note, vote, comment) |
|
| 1087 | - * |
|
| 1088 | - * @param int $start |
|
| 1089 | - * @param int $stop |
|
| 1090 | - * @return null |
|
| 1091 | - */ |
|
| 1086 | + * Update link data (note, vote, comment) |
|
| 1087 | + * |
|
| 1088 | + * @param int $start |
|
| 1089 | + * @param int $stop |
|
| 1090 | + * @return null |
|
| 1091 | + */ |
|
| 1092 | 1092 | private function _sync_dir_links($start, $stop) |
| 1093 | 1093 | { |
| 1094 | 1094 | $sql_ary = array( |
@@ -1131,12 +1131,12 @@ discard block |
||
| 1131 | 1131 | } |
| 1132 | 1132 | |
| 1133 | 1133 | /** |
| 1134 | - * Display icons drop-down list |
|
| 1135 | - * |
|
| 1136 | - * @param string $icons_path |
|
| 1137 | - * @param string $img_selected |
|
| 1138 | - * @return string |
|
| 1139 | - */ |
|
| 1134 | + * Display icons drop-down list |
|
| 1135 | + * |
|
| 1136 | + * @param string $icons_path |
|
| 1137 | + * @param string $img_selected |
|
| 1138 | + * @return string |
|
| 1139 | + */ |
|
| 1140 | 1140 | private function _get_dir_icon_list($icons_path, $img_selected) |
| 1141 | 1141 | { |
| 1142 | 1142 | $imglist = filelist($icons_path, ''); |
@@ -84,23 +84,23 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function __construct(\phpbb\cache\service $cache, \phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\language\language $language, \phpbb\log\log $log, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, \ernadoo\phpbbdirectory\core\categorie $categorie, \ernadoo\phpbbdirectory\core\nestedset_category $nestedset_category) |
| 86 | 86 | { |
| 87 | - $this->cache = $cache; |
|
| 88 | - $this->db = $db; |
|
| 89 | - $this->helper = $helper; |
|
| 87 | + $this->cache = $cache; |
|
| 88 | + $this->db = $db; |
|
| 89 | + $this->helper = $helper; |
|
| 90 | 90 | $this->language = $language; |
| 91 | 91 | $this->phpbb_log = $log; |
| 92 | - $this->request = $request; |
|
| 92 | + $this->request = $request; |
|
| 93 | 93 | $this->template = $template; |
| 94 | - $this->user = $user; |
|
| 94 | + $this->user = $user; |
|
| 95 | 95 | $this->categorie = $categorie; |
| 96 | - $this->nestedset_category = $nestedset_category; |
|
| 96 | + $this->nestedset_category = $nestedset_category; |
|
| 97 | 97 | |
| 98 | 98 | $this->form_key = 'acp_dir_cat'; |
| 99 | 99 | add_form_key($this->form_key); |
| 100 | 100 | |
| 101 | 101 | $this->action = $this->request->variable('action', ''); |
| 102 | 102 | $this->cat_id = $request->variable('c', 0); |
| 103 | - $this->parent_id = $request->variable('parent_id', 0); |
|
| 103 | + $this->parent_id = $request->variable('parent_id', 0); |
|
| 104 | 104 | $this->update = ($this->request->is_set_post('update')) ? true : false; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | { |
| 152 | 152 | if (!$this->cat_id) |
| 153 | 153 | { |
| 154 | - trigger_error($this->language->lang('DIR_NO_CAT') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
| 154 | + trigger_error($this->language->lang('DIR_NO_CAT').adm_back_link($this->u_action.'&parent_id='.$this->parent_id), E_USER_WARNING); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $this->cat_data = $this->_get_cat_info($this->cat_id); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $cat_list = $this->categorie->make_cat_select((int) $this->cat_data['parent_id'], $subcats_id); |
| 168 | 168 | |
| 169 | 169 | $sql = 'SELECT cat_id |
| 170 | - FROM ' . $this->categories_table . ' |
|
| 170 | + FROM ' . $this->categories_table.' |
|
| 171 | 171 | WHERE cat_id <> ' . (int) $this->cat_id; |
| 172 | 172 | $result = $this->db->sql_query_limit($sql, 1); |
| 173 | 173 | |
@@ -183,8 +183,8 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $this->template->assign_vars(array( |
| 185 | 185 | 'S_DELETE_DIR_CAT' => true, |
| 186 | - 'U_ACTION' => $this->u_action . "&parent_id={$parent_id}&action=delete&c=$this->cat_id", |
|
| 187 | - 'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id, |
|
| 186 | + 'U_ACTION' => $this->u_action."&parent_id={$parent_id}&action=delete&c=$this->cat_id", |
|
| 187 | + 'U_BACK' => $this->u_action.'&parent_id='.$this->parent_id, |
|
| 188 | 188 | |
| 189 | 189 | 'DIR_CAT_NAME' => $this->cat_data['cat_name'], |
| 190 | 190 | 'S_HAS_SUBCATS' => ($this->cat_data['right_id'] - $this->cat_data['left_id'] > 1) ? true : false, |
@@ -235,11 +235,11 @@ discard block |
||
| 235 | 235 | { |
| 236 | 236 | if (!$this->cat_id) |
| 237 | 237 | { |
| 238 | - trigger_error($this->language->lang('DIR_NO_CAT') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
| 238 | + trigger_error($this->language->lang('DIR_NO_CAT').adm_back_link($this->u_action.'&parent_id='.$this->parent_id), E_USER_WARNING); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | $sql = 'SELECT cat_id, cat_name, parent_id, left_id, right_id |
| 242 | - FROM ' . $this->categories_table . ' |
|
| 242 | + FROM ' . $this->categories_table.' |
|
| 243 | 243 | WHERE cat_id = ' . (int) $this->cat_id; |
| 244 | 244 | $result = $this->db->sql_query($sql); |
| 245 | 245 | $row = $this->db->sql_fetchrow($result); |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | if (!$row) |
| 249 | 249 | { |
| 250 | - trigger_error($this->language->lang('DIR_NO_CAT') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
| 250 | + trigger_error($this->language->lang('DIR_NO_CAT').adm_back_link($this->u_action.'&parent_id='.$this->parent_id), E_USER_WARNING); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | try |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | if ($move_cat_name !== false) |
| 263 | 263 | { |
| 264 | - $this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_DIR_CAT_' . strtoupper($this->action), time(), array($row['cat_name'], $move_cat_name)); |
|
| 264 | + $this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_DIR_CAT_'.strtoupper($this->action), time(), array($row['cat_name'], $move_cat_name)); |
|
| 265 | 265 | $this->cache->destroy('sql', $this->categories_table); |
| 266 | 266 | } |
| 267 | 267 | |
@@ -305,13 +305,13 @@ discard block |
||
| 305 | 305 | { |
| 306 | 306 | if (!$this->cat_id) |
| 307 | 307 | { |
| 308 | - trigger_error($this->language->lang('DIR_NO_CAT') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
| 308 | + trigger_error($this->language->lang('DIR_NO_CAT').adm_back_link($this->u_action.'&parent_id='.$this->parent_id), E_USER_WARNING); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | @set_time_limit(0); |
| 312 | 312 | |
| 313 | 313 | $sql = 'SELECT cat_name, cat_links |
| 314 | - FROM ' . $this->categories_table . ' |
|
| 314 | + FROM ' . $this->categories_table.' |
|
| 315 | 315 | WHERE cat_id = ' . (int) $this->cat_id; |
| 316 | 316 | $result = $this->db->sql_query($sql); |
| 317 | 317 | $row = $this->db->sql_fetchrow($result); |
@@ -319,12 +319,12 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | if (!$row) |
| 321 | 321 | { |
| 322 | - trigger_error($this->language->lang('DIR_NO_CAT') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
| 322 | + trigger_error($this->language->lang('DIR_NO_CAT').adm_back_link($this->u_action.'&parent_id='.$this->parent_id), E_USER_WARNING); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | $sql = 'SELECT MIN(link_id) as min_link_id, MAX(link_id) as max_link_id |
| 326 | - FROM ' . $this->links_table . ' |
|
| 327 | - WHERE link_cat = ' . (int) $this->cat_id . ' |
|
| 326 | + FROM ' . $this->links_table.' |
|
| 327 | + WHERE link_cat = ' . (int) $this->cat_id.' |
|
| 328 | 328 | AND link_active = 1'; |
| 329 | 329 | $result = $this->db->sql_query($sql); |
| 330 | 330 | $row2 = $this->db->sql_fetchrow($result); |
@@ -346,22 +346,22 @@ discard block |
||
| 346 | 346 | { |
| 347 | 347 | // We really need to find a way of showing statistics... no progress here |
| 348 | 348 | $sql = 'SELECT COUNT(link_id) as num_links |
| 349 | - FROM ' . $this->links_table . ' |
|
| 350 | - WHERE link_cat = ' . (int) $this->cat_id . ' |
|
| 349 | + FROM ' . $this->links_table.' |
|
| 350 | + WHERE link_cat = ' . (int) $this->cat_id.' |
|
| 351 | 351 | AND link_active = 1 |
| 352 | - AND link_id BETWEEN ' . (int) $start . ' AND ' . (int) $end; |
|
| 352 | + AND link_id BETWEEN ' . (int) $start.' AND '.(int) $end; |
|
| 353 | 353 | $result = $this->db->sql_query($sql); |
| 354 | 354 | $links_done = $this->request->variable('links_done', 0) + (int) $this->db->sql_fetchfield('num_links'); |
| 355 | 355 | $this->db->sql_freeresult($result); |
| 356 | 356 | |
| 357 | 357 | $start += $batch_size; |
| 358 | 358 | |
| 359 | - $url = $this->u_action . "&parent_id={$this->parent_id}&c=$this->cat_id&action=sync&start=$start&links_done=$links_done&total={$row['cat_links']}"; |
|
| 359 | + $url = $this->u_action."&parent_id={$this->parent_id}&c=$this->cat_id&action=sync&start=$start&links_done=$links_done&total={$row['cat_links']}"; |
|
| 360 | 360 | |
| 361 | 361 | meta_refresh(0, $url); |
| 362 | 362 | |
| 363 | 363 | $this->template->assign_vars(array( |
| 364 | - 'UA_PROGRESS_BAR' => $this->u_action . "&action=progress_bar&start=$links_done&total={$row['cat_links']}", |
|
| 364 | + 'UA_PROGRESS_BAR' => $this->u_action."&action=progress_bar&start=$links_done&total={$row['cat_links']}", |
|
| 365 | 365 | 'S_CONTINUE_SYNC' => true, |
| 366 | 366 | 'L_PROGRESS_EXPLAIN' => $this->language->lang('SYNC_IN_PROGRESS_EXPLAIN', $links_done, $row['cat_links'])) |
| 367 | 367 | ); |
@@ -369,11 +369,11 @@ discard block |
||
| 369 | 369 | return; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - $url = $this->u_action . "&parent_id={$this->parent_id}&c=$this->cat_id&action=sync_cat"; |
|
| 372 | + $url = $this->u_action."&parent_id={$this->parent_id}&c=$this->cat_id&action=sync_cat"; |
|
| 373 | 373 | meta_refresh(0, $url); |
| 374 | 374 | |
| 375 | 375 | $this->template->assign_vars(array( |
| 376 | - 'UA_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', |
|
| 376 | + 'UA_PROGRESS_BAR' => $this->u_action.'&action=progress_bar', |
|
| 377 | 377 | 'S_CONTINUE_SYNC' => true, |
| 378 | 378 | 'L_PROGRESS_EXPLAIN' => $this->language->lang('SYNC_IN_PROGRESS_EXPLAIN', 0, $row['cat_links'])) |
| 379 | 379 | ); |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | public function action_sync_cat() |
| 390 | 390 | { |
| 391 | 391 | $sql = 'SELECT cat_name |
| 392 | - FROM ' . $this->categories_table . ' |
|
| 392 | + FROM ' . $this->categories_table.' |
|
| 393 | 393 | WHERE cat_id = ' . (int) $this->cat_id; |
| 394 | 394 | $result = $this->db->sql_query($sql); |
| 395 | 395 | $row = $this->db->sql_fetchrow($result); |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | if (!$row) |
| 399 | 399 | { |
| 400 | - trigger_error($this->language->lang('DIR_NO_CAT') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
| 400 | + trigger_error($this->language->lang('DIR_NO_CAT').adm_back_link($this->u_action.'&parent_id='.$this->parent_id), E_USER_WARNING); |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | $this->_sync_dir_cat($this->cat_id); |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | } |
| 423 | 423 | else |
| 424 | 424 | { |
| 425 | - $navigation = '<a href="' . $this->u_action . '">' . $this->language->lang('DIR_INDEX') . '</a>'; |
|
| 425 | + $navigation = '<a href="'.$this->u_action.'">'.$this->language->lang('DIR_INDEX').'</a>'; |
|
| 426 | 426 | |
| 427 | 427 | $cats_nav = $this->nestedset_category->get_path_data($this->parent_id); |
| 428 | 428 | |
@@ -430,11 +430,11 @@ discard block |
||
| 430 | 430 | { |
| 431 | 431 | if ($row['cat_id'] == $this->parent_id) |
| 432 | 432 | { |
| 433 | - $navigation .= ' -> ' . $row['cat_name']; |
|
| 433 | + $navigation .= ' -> '.$row['cat_name']; |
|
| 434 | 434 | } |
| 435 | 435 | else |
| 436 | 436 | { |
| 437 | - $navigation .= ' -> <a href="' . $this->u_action . '&parent_id=' . $row['cat_id'] . '">' . $row['cat_name'] . '</a>'; |
|
| 437 | + $navigation .= ' -> <a href="'.$this->u_action.'&parent_id='.$row['cat_id'].'">'.$row['cat_name'].'</a>'; |
|
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | 440 | } |
@@ -448,8 +448,8 @@ discard block |
||
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | $sql = 'SELECT cat_id, parent_id, right_id, left_id, cat_name, cat_icon, cat_desc_uid, cat_desc_bitfield, cat_desc, cat_desc_options, cat_links |
| 451 | - FROM ' . $this->categories_table . ' |
|
| 452 | - WHERE parent_id = ' . (int) $this->parent_id . ' |
|
| 451 | + FROM ' . $this->categories_table.' |
|
| 452 | + WHERE parent_id = ' . (int) $this->parent_id.' |
|
| 453 | 453 | ORDER BY left_id'; |
| 454 | 454 | $result = $this->db->sql_query($sql); |
| 455 | 455 | |
@@ -457,23 +457,23 @@ discard block |
||
| 457 | 457 | { |
| 458 | 458 | do |
| 459 | 459 | { |
| 460 | - $folder_image = ($row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" alt="' . $this->language->lang('DIR_SUBCAT') . '" />' : '<img src="images/icon_folder.gif" alt="' . $this->language->lang('FOLDER') . '" />'; |
|
| 460 | + $folder_image = ($row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" alt="'.$this->language->lang('DIR_SUBCAT').'" />' : '<img src="images/icon_folder.gif" alt="'.$this->language->lang('FOLDER').'" />'; |
|
| 461 | 461 | |
| 462 | - $url = $this->u_action . "&parent_id=$this->parent_id&c={$row['cat_id']}"; |
|
| 462 | + $url = $this->u_action."&parent_id=$this->parent_id&c={$row['cat_id']}"; |
|
| 463 | 463 | |
| 464 | 464 | $this->template->assign_block_vars('cats', array( |
| 465 | 465 | 'FOLDER_IMAGE' => $folder_image, |
| 466 | - 'CAT_IMAGE' => ($row['cat_icon']) ? '<img src="' . $this->get_img_path('icons', $row['cat_icon']) . '" alt="" />' : '', |
|
| 466 | + 'CAT_IMAGE' => ($row['cat_icon']) ? '<img src="'.$this->get_img_path('icons', $row['cat_icon']).'" alt="" />' : '', |
|
| 467 | 467 | 'CAT_NAME' => $row['cat_name'], |
| 468 | 468 | 'CAT_DESCRIPTION' => generate_text_for_display($row['cat_desc'], $row['cat_desc_uid'], $row['cat_desc_bitfield'], $row['cat_desc_options']), |
| 469 | 469 | 'CAT_LINKS' => $row['cat_links'], |
| 470 | 470 | |
| 471 | - 'U_CAT' => $this->u_action . '&parent_id=' . $row['cat_id'], |
|
| 472 | - 'U_MOVE_UP' => $url . '&action=move_up', |
|
| 473 | - 'U_MOVE_DOWN' => $url . '&action=move_down', |
|
| 474 | - 'U_EDIT' => $url . '&action=edit', |
|
| 475 | - 'U_DELETE' => $url . '&action=delete', |
|
| 476 | - 'U_SYNC' => $url . '&action=sync') |
|
| 471 | + 'U_CAT' => $this->u_action.'&parent_id='.$row['cat_id'], |
|
| 472 | + 'U_MOVE_UP' => $url.'&action=move_up', |
|
| 473 | + 'U_MOVE_DOWN' => $url.'&action=move_down', |
|
| 474 | + 'U_EDIT' => $url.'&action=edit', |
|
| 475 | + 'U_DELETE' => $url.'&action=delete', |
|
| 476 | + 'U_SYNC' => $url.'&action=sync') |
|
| 477 | 477 | ); |
| 478 | 478 | } |
| 479 | 479 | while ($row = $this->db->sql_fetchrow($result)); |
@@ -482,14 +482,14 @@ discard block |
||
| 482 | 482 | { |
| 483 | 483 | $row = $this->_get_cat_info($this->parent_id); |
| 484 | 484 | |
| 485 | - $url = $this->u_action . '&parent_id=' . $this->parent_id . '&c=' . $row['cat_id']; |
|
| 485 | + $url = $this->u_action.'&parent_id='.$this->parent_id.'&c='.$row['cat_id']; |
|
| 486 | 486 | |
| 487 | 487 | $this->template->assign_vars(array( |
| 488 | 488 | 'S_NO_CATS' => true, |
| 489 | 489 | |
| 490 | - 'U_EDIT' => $url . '&action=edit', |
|
| 491 | - 'U_DELETE' => $url . '&action=delete', |
|
| 492 | - 'U_SYNC' => $url . '&action=sync') |
|
| 490 | + 'U_EDIT' => $url.'&action=edit', |
|
| 491 | + 'U_DELETE' => $url.'&action=delete', |
|
| 492 | + 'U_SYNC' => $url.'&action=sync') |
|
| 493 | 493 | ); |
| 494 | 494 | } |
| 495 | 495 | $this->db->sql_freeresult($result); |
@@ -499,9 +499,9 @@ discard block |
||
| 499 | 499 | 'NAVIGATION' => $navigation, |
| 500 | 500 | 'CAT_BOX' => $cat_box, |
| 501 | 501 | 'U_SEL_ACTION' => $this->u_action, |
| 502 | - 'U_ACTION' => $this->u_action . '&parent_id=' . $this->parent_id, |
|
| 502 | + 'U_ACTION' => $this->u_action.'&parent_id='.$this->parent_id, |
|
| 503 | 503 | |
| 504 | - 'UA_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', |
|
| 504 | + 'UA_PROGRESS_BAR' => $this->u_action.'&action=progress_bar', |
|
| 505 | 505 | )); |
| 506 | 506 | } |
| 507 | 507 | |
@@ -533,10 +533,10 @@ discard block |
||
| 533 | 533 | switch ($this->action) |
| 534 | 534 | { |
| 535 | 535 | case 'delete': |
| 536 | - $action_subcats = $this->request->variable('action_subcats', ''); |
|
| 537 | - $subcats_to_id = $this->request->variable('subcats_to_id', 0); |
|
| 538 | - $action_links = $this->request->variable('action_links', ''); |
|
| 539 | - $links_to_id = $this->request->variable('links_to_id', 0); |
|
| 536 | + $action_subcats = $this->request->variable('action_subcats', ''); |
|
| 537 | + $subcats_to_id = $this->request->variable('subcats_to_id', 0); |
|
| 538 | + $action_links = $this->request->variable('action_links', ''); |
|
| 539 | + $links_to_id = $this->request->variable('links_to_id', 0); |
|
| 540 | 540 | |
| 541 | 541 | try |
| 542 | 542 | { |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | |
| 555 | 555 | $this->cache->destroy('sql', $this->categories_table); |
| 556 | 556 | |
| 557 | - trigger_error($this->language->lang('DIR_CAT_DELETED') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); |
|
| 557 | + trigger_error($this->language->lang('DIR_CAT_DELETED').adm_back_link($this->u_action.'&parent_id='.$this->parent_id)); |
|
| 558 | 558 | |
| 559 | 559 | break; |
| 560 | 560 | |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | |
| 609 | 609 | $message = ($this->action == 'add') ? $this->language->lang('DIR_CAT_CREATED') : $this->language->lang('DIR_CAT_UPDATED'); |
| 610 | 610 | |
| 611 | - trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); |
|
| 611 | + trigger_error($message.adm_back_link($this->u_action.'&parent_id='.$this->parent_id)); |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | break; |
@@ -642,8 +642,8 @@ discard block |
||
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | $sql = 'SELECT cat_route |
| 645 | - FROM ' . $this->categories_table . " |
|
| 646 | - WHERE cat_route = '" . $this->db->sql_escape($route) . "' |
|
| 645 | + FROM ' . $this->categories_table." |
|
| 646 | + WHERE cat_route = '" . $this->db->sql_escape($route)."' |
|
| 647 | 647 | AND cat_id <> " . $this->cat_id; |
| 648 | 648 | $result = $this->db->sql_query_limit($sql, 1); |
| 649 | 649 | $row = $this->db->sql_fetchrow($result); |
@@ -693,10 +693,10 @@ discard block |
||
| 693 | 693 | 'S_CAT_PARENT_ID' => $this->cat_data['parent_id'], |
| 694 | 694 | 'S_ADD_ACTION' => ($this->action == 'add') ? true : false, |
| 695 | 695 | |
| 696 | - 'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id, |
|
| 697 | - 'U_EDIT_ACTION' => $this->u_action . "&parent_id={$this->parent_id}&action=$this->action&c=$this->cat_id", |
|
| 696 | + 'U_BACK' => $this->u_action.'&parent_id='.$this->parent_id, |
|
| 697 | + 'U_EDIT_ACTION' => $this->u_action."&parent_id={$this->parent_id}&action=$this->action&c=$this->cat_id", |
|
| 698 | 698 | |
| 699 | - 'L_TITLE' => $this->language->lang('DIR_' . strtoupper($this->action) . '_CAT'), |
|
| 699 | + 'L_TITLE' => $this->language->lang('DIR_'.strtoupper($this->action).'_CAT'), |
|
| 700 | 700 | 'ERROR_MSG' => (sizeof($this->errors)) ? implode('<br />', $this->errors) : '', |
| 701 | 701 | 'ICON_IMAGE' => ($this->cat_data['cat_icon']) ? $this->get_img_path('icons', $this->cat_data['cat_icon']) : 'images/spacer.gif', |
| 702 | 702 | |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | private function _get_cat_info($cat_id) |
| 741 | 741 | { |
| 742 | 742 | $sql = 'SELECT cat_id, parent_id, right_id, left_id, cat_desc, cat_desc_uid, cat_desc_options, cat_icon, cat_name, cat_route, display_subcat_list, cat_allow_comments, cat_allow_votes, cat_must_describe, cat_count_all, cat_validate, cat_cron_freq, cat_cron_nb_check, cat_link_back, cat_cron_enable, cat_cron_next |
| 743 | - FROM ' . $this->categories_table . ' |
|
| 743 | + FROM ' . $this->categories_table.' |
|
| 744 | 744 | WHERE cat_id = ' . (int) $cat_id; |
| 745 | 745 | $result = $this->db->sql_query($sql); |
| 746 | 746 | $row = $this->db->sql_fetchrow($result); |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | { |
| 806 | 806 | if ($cat_data_sql['cat_cron_enable']) |
| 807 | 807 | { |
| 808 | - $cat_data_sql['cat_cron_next'] = time() + $cat_data_sql['cat_cron_freq']*86400; |
|
| 808 | + $cat_data_sql['cat_cron_next'] = time() + $cat_data_sql['cat_cron_freq'] * 86400; |
|
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | $this->cat_data = $this->nestedset_category->insert($cat_data_sql); |
@@ -828,13 +828,13 @@ discard block |
||
| 828 | 828 | |
| 829 | 829 | if ($cat_data_sql['cat_cron_enable'] && ($row['cat_cron_freq'] != $cat_data_sql['cat_cron_freq'] || !$row['cat_cron_enable'])) |
| 830 | 830 | { |
| 831 | - $cat_data_sql['cat_cron_next'] = time() + $cat_data_sql['cat_cron_freq']*86400; |
|
| 831 | + $cat_data_sql['cat_cron_next'] = time() + $cat_data_sql['cat_cron_freq'] * 86400; |
|
| 832 | 832 | } |
| 833 | 833 | |
| 834 | 834 | if ($row['cat_name'] != $cat_data_sql['cat_name']) |
| 835 | 835 | { |
| 836 | 836 | // the cat name has changed, clear the parents list of all categories (for safety) |
| 837 | - $sql = 'UPDATE ' . $this->categories_table . " |
|
| 837 | + $sql = 'UPDATE '.$this->categories_table." |
|
| 838 | 838 | SET cat_parents = ''"; |
| 839 | 839 | $this->db->sql_query($sql); |
| 840 | 840 | } |
@@ -842,8 +842,8 @@ discard block |
||
| 842 | 842 | // Setting the cat id to the categorie id is not really received well by some dbs. ;) |
| 843 | 843 | unset($cat_data_sql['cat_id']); |
| 844 | 844 | |
| 845 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
| 846 | - SET ' . $this->db->sql_build_array('UPDATE', $cat_data_sql) . ' |
|
| 845 | + $sql = 'UPDATE '.$this->categories_table.' |
|
| 846 | + SET ' . $this->db->sql_build_array('UPDATE', $cat_data_sql).' |
|
| 847 | 847 | WHERE cat_id = ' . (int) $this->cat_id; |
| 848 | 848 | $this->db->sql_query($sql); |
| 849 | 849 | |
@@ -884,7 +884,7 @@ discard block |
||
| 884 | 884 | $log_action_links = 'MOVE_LINKS'; |
| 885 | 885 | |
| 886 | 886 | $sql = 'SELECT cat_name |
| 887 | - FROM ' . $this->categories_table . ' |
|
| 887 | + FROM ' . $this->categories_table.' |
|
| 888 | 888 | WHERE cat_id = ' . (int) $links_to_id; |
| 889 | 889 | $result = $this->db->sql_query($sql); |
| 890 | 890 | $row = $this->db->sql_fetchrow($result); |
@@ -986,12 +986,12 @@ discard block |
||
| 986 | 986 | */ |
| 987 | 987 | private function _move_cat_content($from_id, $to_id) |
| 988 | 988 | { |
| 989 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 990 | - SET link_cat = ' . (int) $to_id . ' |
|
| 989 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 990 | + SET link_cat = ' . (int) $to_id.' |
|
| 991 | 991 | WHERE link_cat = ' . (int) $from_id; |
| 992 | 992 | $this->db->sql_query($sql); |
| 993 | 993 | |
| 994 | - $sql = 'DELETE FROM ' . $this->watch_table . ' |
|
| 994 | + $sql = 'DELETE FROM '.$this->watch_table.' |
|
| 995 | 995 | WHERE cat_id = ' . (int) $from_id; |
| 996 | 996 | $this->db->sql_query($sql); |
| 997 | 997 | |
@@ -1009,7 +1009,7 @@ discard block |
||
| 1009 | 1009 | |
| 1010 | 1010 | // Before we remove anything we make sure we are able to adjust the post counts later. ;) |
| 1011 | 1011 | $sql = 'SELECT link_id, link_banner |
| 1012 | - FROM ' . $this->links_table . ' |
|
| 1012 | + FROM ' . $this->links_table.' |
|
| 1013 | 1013 | WHERE link_cat = ' . (int) $this->cat_id; |
| 1014 | 1014 | $result = $this->db->sql_query($sql); |
| 1015 | 1015 | |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | |
| 1041 | 1041 | foreach ($link_datas_ary as $table => $field) |
| 1042 | 1042 | { |
| 1043 | - $this->db->sql_query("DELETE FROM $table WHERE " . $this->db->sql_in_set($field, $link_ids)); |
|
| 1043 | + $this->db->sql_query("DELETE FROM $table WHERE ".$this->db->sql_in_set($field, $link_ids)); |
|
| 1044 | 1044 | } |
| 1045 | 1045 | } |
| 1046 | 1046 | |
@@ -1052,7 +1052,7 @@ discard block |
||
| 1052 | 1052 | |
| 1053 | 1053 | foreach ($cat_datas_ary as $table => $field) |
| 1054 | 1054 | { |
| 1055 | - $this->db->sql_query("DELETE FROM $table WHERE $field = " . (int) $this->cat_id); |
|
| 1055 | + $this->db->sql_query("DELETE FROM $table WHERE $field = ".(int) $this->cat_id); |
|
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 1058 | 1058 | $this->db->sql_transaction('commit'); |
@@ -1069,15 +1069,15 @@ discard block |
||
| 1069 | 1069 | private function _sync_dir_cat($cat_id) |
| 1070 | 1070 | { |
| 1071 | 1071 | $sql = 'SELECT COUNT(link_id) AS num_links |
| 1072 | - FROM ' . $this->links_table . ' |
|
| 1073 | - WHERE link_cat = ' . (int) $cat_id . ' |
|
| 1072 | + FROM ' . $this->links_table.' |
|
| 1073 | + WHERE link_cat = ' . (int) $cat_id.' |
|
| 1074 | 1074 | AND link_active = 1'; |
| 1075 | 1075 | $result = $this->db->sql_query($sql); |
| 1076 | 1076 | $total_links = (int) $this->db->sql_fetchfield('num_links'); |
| 1077 | 1077 | $this->db->sql_freeresult($result); |
| 1078 | 1078 | |
| 1079 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
| 1080 | - SET cat_links = ' . $total_links . ' |
|
| 1079 | + $sql = 'UPDATE '.$this->categories_table.' |
|
| 1080 | + SET cat_links = ' . $total_links.' |
|
| 1081 | 1081 | WHERE cat_id = ' . (int) $cat_id; |
| 1082 | 1082 | $this->db->sql_query($sql); |
| 1083 | 1083 | } |
@@ -1097,33 +1097,33 @@ discard block |
||
| 1097 | 1097 | 'link_vote' => 0, |
| 1098 | 1098 | ); |
| 1099 | 1099 | |
| 1100 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 1101 | - SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' |
|
| 1102 | - WHERE link_id BETWEEN ' . (int) $start . ' AND ' . (int) $stop; |
|
| 1100 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 1101 | + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary).' |
|
| 1102 | + WHERE link_id BETWEEN ' . (int) $start.' AND '.(int) $stop; |
|
| 1103 | 1103 | $this->db->sql_query($sql); |
| 1104 | 1104 | |
| 1105 | - $sql = 'SELECT vote_link_id, COUNT(vote_note) AS nb_vote, SUM(vote_note) AS total FROM ' . $this->votes_table . ' |
|
| 1106 | - WHERE vote_link_id BETWEEN ' . (int) $start . ' AND ' . (int) $stop . ' |
|
| 1105 | + $sql = 'SELECT vote_link_id, COUNT(vote_note) AS nb_vote, SUM(vote_note) AS total FROM '.$this->votes_table.' |
|
| 1106 | + WHERE vote_link_id BETWEEN ' . (int) $start.' AND '.(int) $stop.' |
|
| 1107 | 1107 | GROUP BY vote_link_id'; |
| 1108 | 1108 | $result = $this->db->sql_query($sql); |
| 1109 | 1109 | while ($tmp = $this->db->sql_fetchrow($result)) |
| 1110 | 1110 | { |
| 1111 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 1112 | - SET link_note = ' . (int) $tmp['total'] . ', link_vote = ' . (int) $tmp['nb_vote'] . ' |
|
| 1111 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 1112 | + SET link_note = ' . (int) $tmp['total'].', link_vote = '.(int) $tmp['nb_vote'].' |
|
| 1113 | 1113 | WHERE link_id = ' . (int) $tmp['vote_link_id']; |
| 1114 | 1114 | $this->db->sql_query($sql); |
| 1115 | 1115 | } |
| 1116 | 1116 | $this->db->sql_freeresult($result); |
| 1117 | 1117 | |
| 1118 | 1118 | $sql = 'SELECT comment_link_id, COUNT(comment_id) AS nb_comment |
| 1119 | - FROM ' . $this->comments_table . ' |
|
| 1120 | - WHERE comment_link_id BETWEEN ' . (int) $start . ' AND ' . (int) $stop . ' |
|
| 1119 | + FROM ' . $this->comments_table.' |
|
| 1120 | + WHERE comment_link_id BETWEEN ' . (int) $start.' AND '.(int) $stop.' |
|
| 1121 | 1121 | GROUP BY comment_link_id'; |
| 1122 | 1122 | $result = $this->db->sql_query($sql); |
| 1123 | 1123 | while ($tmp = $this->db->sql_fetchrow($result)) |
| 1124 | 1124 | { |
| 1125 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 1126 | - SET link_comment = ' . (int) $tmp['nb_comment'] . ' |
|
| 1125 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 1126 | + SET link_comment = ' . (int) $tmp['nb_comment'].' |
|
| 1127 | 1127 | WHERE link_id = ' . (int) $tmp['comment_link_id']; |
| 1128 | 1128 | $this->db->sql_query($sql); |
| 1129 | 1129 | } |
@@ -1148,7 +1148,7 @@ discard block |
||
| 1148 | 1148 | |
| 1149 | 1149 | foreach ($img_ary as $img) |
| 1150 | 1150 | { |
| 1151 | - $img = $path . $img; |
|
| 1151 | + $img = $path.$img; |
|
| 1152 | 1152 | $selected = ''; |
| 1153 | 1153 | |
| 1154 | 1154 | if (strlen($img) > 255) |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | $selected = ' selected="selected"'; |
| 1162 | 1162 | } |
| 1163 | 1163 | |
| 1164 | - $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>'; |
|
| 1164 | + $filename_list .= '<option value="'.htmlspecialchars($img).'"'.$selected.'>'.$img.'</option>'; |
|
| 1165 | 1165 | } |
| 1166 | 1166 | } |
| 1167 | 1167 | |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * @inheritDoc |
|
| 26 | - */ |
|
| 25 | + * @inheritDoc |
|
| 26 | + */ |
|
| 27 | 27 | public function update_schema() |
| 28 | 28 | { |
| 29 | 29 | return array( |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * @inheritDoc |
|
| 40 | - */ |
|
| 39 | + * @inheritDoc |
|
| 40 | + */ |
|
| 41 | 41 | public function update_data() |
| 42 | 42 | { |
| 43 | 43 | return array( |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * @inheritDoc |
|
| 50 | - */ |
|
| 49 | + * @inheritDoc |
|
| 50 | + */ |
|
| 51 | 51 | public function revert_schema() |
| 52 | 52 | { |
| 53 | 53 | return array( |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | return array( |
| 30 | 30 | 'add_columns' => array( |
| 31 | - $this->table_prefix . 'directory_cats' => array( |
|
| 31 | + $this->table_prefix.'directory_cats' => array( |
|
| 32 | 32 | 'cat_route' => array('VCHAR', '', 'after' => 'cat_name'), |
| 33 | 33 | ) |
| 34 | 34 | ), |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | return array( |
| 54 | 54 | 'drop_columns' => array( |
| 55 | - $this->table_prefix . 'directory_cats' => array( |
|
| 55 | + $this->table_prefix.'directory_cats' => array( |
|
| 56 | 56 | 'cat_route', |
| 57 | 57 | ), |
| 58 | 58 | ), |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $slug = new \E1379\SpeakingUrl\SpeakingUrl(); |
| 65 | 65 | |
| 66 | - $sql = 'SELECT cat_id, cat_name FROM ' . $this->table_prefix . 'directory_cats'; |
|
| 66 | + $sql = 'SELECT cat_id, cat_name FROM '.$this->table_prefix.'directory_cats'; |
|
| 67 | 67 | $result = $this->db->sql_query($sql); |
| 68 | 68 | |
| 69 | 69 | while ($row = $this->db->sql_fetchrow($result)) |
| 70 | 70 | { |
| 71 | - $sql = 'UPDATE ' . $this->table_prefix . 'directory_cats' . ' |
|
| 72 | - SET cat_route = "' . (string) $slug->getSlug($row['cat_name'], array('lang' => $this->config['default_lang'], 'symbols' => true)). '" |
|
| 71 | + $sql = 'UPDATE '.$this->table_prefix.'directory_cats'.' |
|
| 72 | + SET cat_route = "' . (string) $slug->getSlug($row['cat_name'], array('lang' => $this->config['default_lang'], 'symbols' => true)).'" |
|
| 73 | 73 | WHERE cat_id = ' . (int) $row['cat_id']; |
| 74 | 74 | $this->db->sql_query($sql); |
| 75 | 75 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | * @inheritDoc |
| 26 | 26 | */ |
| 27 | 27 | public function update_schema() |
| 28 | - { |
|
| 28 | + { |
|
| 29 | 29 | return array( |
| 30 | 30 | 'add_columns' => array( |
| 31 | 31 | $this->table_prefix . 'directory_cats' => array( |