|
@@ -66,16 +66,16 @@ discard block |
|
|
block discarded – undo |
|
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'); |
|
@@ -119,7 +119,7 @@ discard block |
|
|
block discarded – undo |
|
119
|
119
|
throw new \phpbb\exception\http_exception(404, 'DIR_ERROR_NO_CATS'); |
|
120
|
120
|
} |
|
121
|
121
|
|
|
122
|
|
- $url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, array('page' => $page)); |
|
|
122
|
+ $url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, array('page' => $page)); |
|
123
|
123
|
|
|
124
|
124
|
return new RedirectResponse($url, 301); |
|
125
|
125
|
} |
|
@@ -145,13 +145,13 @@ discard block |
|
|
block discarded – undo |
|
145
|
145
|
|
|
146
|
146
|
$start = ($page - 1) * $this->config['dir_show']; |
|
147
|
147
|
|
|
148
|
|
- $default_sort_days = 0; |
|
|
148
|
+ $default_sort_days = 0; |
|
149
|
149
|
$default_sort_key = (string) substr($this->config['dir_default_order'], 0, 1); |
|
150
|
150
|
$default_sort_dir = (string) substr($this->config['dir_default_order'], 2); |
|
151
|
151
|
|
|
152
|
152
|
$sort_days = (!$sort_days) ? $this->request->variable('st', $default_sort_days) : $sort_days; |
|
153
|
153
|
$sort_key = (!$sort_key) ? $this->request->variable('sk', $default_sort_key) : $sort_key; |
|
154
|
|
- $sort_dir = (!$sort_dir) ? $this->request->variable('sd', $default_sort_dir) : $sort_dir; |
|
|
154
|
+ $sort_dir = (!$sort_dir) ? $this->request->variable('sd', $default_sort_dir) : $sort_dir; |
|
155
|
155
|
$link_list = $rowset = array(); |
|
156
|
156
|
|
|
157
|
157
|
// Categorie ordering options |
|
@@ -189,8 +189,8 @@ discard block |
|
|
block discarded – undo |
|
189
|
189
|
$min_post_time = time() - ($sort_days * 86400); |
|
190
|
190
|
|
|
191
|
191
|
$sql = 'SELECT COUNT(link_id) AS nb_links |
|
192
|
|
- FROM ' . $this->links_table . ' |
|
193
|
|
- WHERE link_cat = ' . (int) $cat_id . ' |
|
|
192
|
+ FROM ' . $this->links_table.' |
|
|
193
|
+ WHERE link_cat = ' . (int) $cat_id.' |
|
194
|
194
|
AND link_time >= ' . $min_post_time; |
|
195
|
195
|
$result = $this->db->sql_query($sql); |
|
196
|
196
|
$nb_links = (int) $this->db->sql_fetchfield('nb_links'); |
|
@@ -205,7 +205,7 @@ discard block |
|
|
block discarded – undo |
|
205
|
205
|
else |
|
206
|
206
|
{ |
|
207
|
207
|
$sql_limit_time = ''; |
|
208
|
|
- $nb_links = (int) $this->categorie->data['cat_links']; |
|
|
208
|
+ $nb_links = (int) $this->categorie->data['cat_links']; |
|
209
|
209
|
} |
|
210
|
210
|
|
|
211
|
211
|
// Make sure $start is set to the last page if it exceeds the amount |
|
@@ -218,7 +218,7 @@ discard block |
|
|
block discarded – undo |
|
218
|
218
|
$this->categorie->make_cat_jumpbox(); |
|
219
|
219
|
|
|
220
|
220
|
$base_url = array( |
|
221
|
|
- 'routes' => 'ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, |
|
|
221
|
+ 'routes' => 'ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, |
|
222
|
222
|
'params' => array_merge(array('cat_id' => $cat_id), $u_sort_param), |
|
223
|
223
|
); |
|
224
|
224
|
|
|
@@ -231,14 +231,14 @@ discard block |
|
|
block discarded – undo |
|
231
|
231
|
'S_SELECT_SORT_KEY' => $s_sort_key, |
|
232
|
232
|
'S_SELECT_SORT_DAYS' => $s_limit_days, |
|
233
|
233
|
'S_CATLIST' => $this->categorie->make_cat_select($cat_id), |
|
234
|
|
- 'S_PAGE_ACTION' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, array('page' => $page)), |
|
|
234
|
+ 'S_PAGE_ACTION' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, array('page' => $page)), |
|
235
|
235
|
'S_CAT_ID' => $cat_id, |
|
236
|
236
|
|
|
237
|
237
|
'TOTAL_LINKS' => $this->language->lang('DIR_NB_LINKS', (int) $nb_links), |
|
238
|
238
|
|
|
239
|
239
|
'U_NEW_SITE' => $this->helper->route('ernadoo_phpbbdirectory_new_controller', array('cat_id' => $cat_id)), |
|
240
|
240
|
|
|
241
|
|
- 'U_VIEW_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id), |
|
|
241
|
+ 'U_VIEW_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id), |
|
242
|
242
|
'U_WATCH_CAT' => $s_watching_categorie['link'], |
|
243
|
243
|
'U_WATCH_CAT_TOGGLE' => $s_watching_categorie['link_toggle'], |
|
244
|
244
|
'S_WATCH_CAT_TITLE' => $s_watching_categorie['title'], |
|
@@ -268,11 +268,11 @@ discard block |
|
|
block discarded – undo |
|
268
|
268
|
|
|
269
|
269
|
if (is_array($sort_by_sql[$sort_key])) |
|
270
|
270
|
{ |
|
271
|
|
- $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; |
|
|
271
|
+ $sql_sort_order = implode(' '.$direction.', ', $sort_by_sql[$sort_key]).' '.$direction; |
|
272
|
272
|
} |
|
273
|
273
|
else |
|
274
|
274
|
{ |
|
275
|
|
- $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; |
|
|
275
|
+ $sql_sort_order = $sort_by_sql[$sort_key].' '.$direction; |
|
276
|
276
|
} |
|
277
|
277
|
|
|
278
|
278
|
// Grab just the sorted link ids |
|
@@ -315,7 +315,7 @@ discard block |
|
|
block discarded – undo |
|
315
|
315
|
), |
|
316
|
316
|
array( |
|
317
|
317
|
'FROM' => array($this->votes_table => 'v'), |
|
318
|
|
- 'ON' => 'l.link_id = v.vote_link_id AND v.vote_user_id = ' . $this->user->data['user_id'] |
|
|
318
|
+ 'ON' => 'l.link_id = v.vote_link_id AND v.vote_user_id = '.$this->user->data['user_id'] |
|
319
|
319
|
) |
|
320
|
320
|
), |
|
321
|
321
|
'WHERE' => $this->db->sql_in_set('l.link_id', $link_list) |
|
@@ -332,8 +332,8 @@ discard block |
|
|
block discarded – undo |
|
332
|
332
|
|
|
333
|
333
|
$link_list = ($store_reverse) ? array_reverse($link_list) : $link_list; |
|
334
|
334
|
|
|
335
|
|
- $votes_status = ($this->categorie->data['cat_allow_votes']) ? true : false; |
|
336
|
|
- $comments_status = ($this->categorie->data['cat_allow_comments']) ? true : false; |
|
|
335
|
+ $votes_status = ($this->categorie->data['cat_allow_votes']) ? true : false; |
|
|
336
|
+ $comments_status = ($this->categorie->data['cat_allow_comments']) ? true : false; |
|
337
|
337
|
|
|
338
|
338
|
foreach ($link_list as $link_id) |
|
339
|
339
|
{ |
|
@@ -343,10 +343,10 @@ discard block |
|
|
block discarded – undo |
|
343
|
343
|
$s_note = $this->link->display_note($site['link_note'], $site['link_vote'], $votes_status); |
|
344
|
344
|
$s_thumb = $this->link->display_thumb($site); |
|
345
|
345
|
$s_vote = $this->link->display_vote($site); |
|
346
|
|
- $s_banner = $this->link->display_bann($site); |
|
347
|
|
- $s_rss = $this->link->display_rss($site); |
|
|
346
|
+ $s_banner = $this->link->display_bann($site); |
|
|
347
|
+ $s_rss = $this->link->display_rss($site); |
|
348
|
348
|
|
|
349
|
|
- $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')))); |
|
|
349
|
+ $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')))); |
|
350
|
350
|
$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')))); |
|
351
|
351
|
|
|
352
|
352
|
$this->template->assign_block_vars('site', array( |
|
@@ -382,7 +382,7 @@ discard block |
|
|
block discarded – undo |
|
382
|
382
|
$this->template->assign_block_vars('no_draw_link', array()); |
|
383
|
383
|
} |
|
384
|
384
|
|
|
385
|
|
- $page_title = $this->language->lang('DIRECTORY') . ' - ' . $this->categorie->data['cat_name']; |
|
|
385
|
+ $page_title = $this->language->lang('DIRECTORY').' - '.$this->categorie->data['cat_name']; |
|
386
|
386
|
|
|
387
|
387
|
$this->categorie->display(); |
|
388
|
388
|
|