Passed
Push — master ( 51345c...1b3f41 )
by Stanislav
12:38 queued 10:10
created

display::get_parents()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 35
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 11.8736

Importance

Changes 0
Metric Value
eloc 20
c 0
b 0
f 0
dl 0
loc 35
ccs 4
cts 19
cp 0.2105
rs 9.6
cc 4
nc 3
nop 1
crap 11.8736
1
<?php
2
3
/**
4
*
5
* @package phpBB Gallery Core
6
* @copyright (c) 2014 nickvergessen
7
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
8
*
9
*/
10
11
namespace phpbbgallery\core\album;
12
13
class display
14
{
15
	protected $auth;
16
	protected $config;
17
	protected $db;
18
	protected $helper;
19
	protected $pagination;
20
	protected $request;
21
	protected $template;
22
	protected $user;
23
	protected $gallery_auth;
24
	protected $gallery_user;
25
	protected $root_path;
26
	protected $php_ext;
27
	protected $table_albums;
28
	protected $table_contests;
29
	protected $table_moderators;
30
	protected $table_tracking;
31
	public $album_start;
32
	public $album_limit;
33
	public $albums_total;
34
	public $album_mode;
35
36 19
	public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\controller\helper $helper,
0 ignored issues
show
Bug introduced by
The type phpbb\auth\auth was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The type phpbb\controller\helper was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The type phpbb\config\config was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
37
								\phpbb\db\driver\driver_interface $db, \phpbb\pagination $pagination,
0 ignored issues
show
Bug introduced by
The type phpbb\pagination was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The type phpbb\db\driver\driver_interface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
38
								\phpbb\request\request $request, \phpbb\template\template $template,
0 ignored issues
show
Bug introduced by
The type phpbb\template\template was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The type phpbb\request\request was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
39
								\phpbb\user $user, \phpbb\language\language $language, \phpbbgallery\core\auth\auth $gallery_auth,
0 ignored issues
show
Bug introduced by
The type phpbb\language\language was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The type phpbb\user was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
40
								\phpbbgallery\core\user $gallery_user, \phpbbgallery\core\misc $misc,
41
								$root_path, $php_ext, $albums_table, $contests_table, $tracking_table, $moderators_table)
42
	{
43 19
		$this->auth = $auth;
44 19
		$this->config = $config;
45 19
		$this->helper = $helper;
46 19
		$this->db = $db;
47 19
		$this->pagination = $pagination;
48 19
		$this->request = $request;
49 19
		$this->template = $template;
50 19
		$this->user = $user;
51 19
		$this->language = $language;
0 ignored issues
show
Bug Best Practice introduced by
The property language does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
52 19
		$this->gallery_auth = $gallery_auth;
53 19
		$this->gallery_user = $gallery_user;
54 19
		$this->misc = $misc;
0 ignored issues
show
Bug Best Practice introduced by
The property misc does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
55 19
		$this->root_path = $root_path;
56 19
		$this->php_ext = $php_ext;
57 19
		$this->table_albums = $albums_table;
58 19
		$this->table_contests = $contests_table;
59 19
		$this->table_tracking = $tracking_table;
60 19
		$this->table_moderators = $moderators_table;
61 19
	}
62
63
	/**
64
	 * Get album branch
65
	 *
66
	 * borrowed from phpBB3
67
	 * @author: phpBB Group
68
	 * @function: get_forum_branch
69
	 * @param $branch_user_id
70
	 * @param $album_id
71
	 * @param string $type
72
	 * @param string $order
73
	 * @param bool $include_album
74
	 * @return array
75
	 */
76 4
	public function get_branch($branch_user_id, $album_id, $type = 'all', $order = 'descending', $include_album = true)
77
	{
78 4
		switch ($type)
79
		{
80 4
			case 'parents':
81
				$condition = 'a1.left_id BETWEEN a2.left_id AND a2.right_id';
82
			break;
83
84 4
			case 'children':
85 1
				$condition = 'a2.left_id BETWEEN a1.left_id AND a1.right_id';
86 1
			break;
87
88
			default:
89 3
				$condition = 'a2.left_id BETWEEN a1.left_id AND a1.right_id OR a1.left_id BETWEEN a2.left_id AND a2.right_id';
90 3
			break;
91
		}
92
93 4
		$rows = array();
94
95
		$sql = 'SELECT a2.*
96 4
			FROM ' . $this->table_albums . ' a1
97 4
			LEFT JOIN ' . $this->table_albums . ' a2 ON (' . $condition .') AND a2.album_user_id = ' . (int) $branch_user_id .'
98 4
			WHERE a1.album_id = ' . (int) $album_id . '
99 4
				AND a1.album_user_id = ' . (int) $branch_user_id . '
100 4
			ORDER BY a2.left_id ' . (($order == 'descending') ? 'ASC' : 'DESC');
101 4
		$result = $this->db->sql_query($sql);
102
103 4
		while ($row = $this->db->sql_fetchrow($result))
104
		{
105 4
			if (!$include_album && $row['album_id'] == $album_id)
106
			{
107 1
				continue;
108
			}
109
110 4
			$rows[] = $row;
111
		}
112 4
		$this->db->sql_freeresult($result);
113
114 4
		return $rows;
115
	}
116
117
	/**
118
	 * Create album navigation links for given album, create parent
119
	 * list if currently null, assign basic album info to template
120
	 *
121
	 * borrowed from phpBB3
122
	 * @author: phpBB Group
123
	 * @function: generate_forum_nav
124
	 * @param $album_data
125
	 */
126 4
	public function generate_navigation($album_data)
127
	{
128
		// Add gallery menu entry
129
		// TO DO !!! THIS SHOULD BE MOVED TO MENU CREATOR!!
130 4
		$this->template->assign_block_vars('navlinks', array(
131 4
			'FORUM_NAME'   => $this->language->lang('GALLERY'),
132 4
			'U_VIEW_FORUM'   => $this->helper->route('phpbbgallery_core_index'),
133
		));
134
		// Get album parents
135 4
		$album_parents = $this->get_parents($album_data);
136
137
		// Display username for personal albums
138 4
		if ($album_data['album_user_id'] > \phpbbgallery\core\block::PUBLIC_ALBUM)
139
		{
140
			$sql = 'SELECT user_id, username, user_colour
141
				FROM ' . USERS_TABLE . '
0 ignored issues
show
Bug introduced by
The constant phpbbgallery\core\album\USERS_TABLE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
142
				WHERE user_id = ' . (int) $album_data['album_user_id'];
143
			$result = $this->db->sql_query($sql);
144
145
			while ($row = $this->db->sql_fetchrow($result))
0 ignored issues
show
Unused Code introduced by
The assignment to $row is dead and can be removed.
Loading history...
146
			{
147
				$this->template->assign_block_vars('navlinks', array(
148
					'FORUM_NAME'	=> $this->language->lang('PERSONAL_ALBUMS'),
149
					'U_VIEW_FORUM'	=> $this->helper->route('phpbbgallery_core_personal'),
150
				));
151
			}
152
			$this->db->sql_freeresult($result);
153
		}
154
155
		// Build navigation links
156 4
		if (!empty($album_parents))
157
		{
158
			foreach ($album_parents as $parent_album_id => $parent_data)
159
			{
160
				list($parent_name, $parent_type) = array_values($parent_data);
161
162
				$this->template->assign_block_vars('navlinks', array(
163
					'FORUM_NAME'	=> $parent_name,
164
					'FORUM_ID'		=> $parent_album_id,
165
					'U_VIEW_FORUM'	=> $this->helper->route('phpbbgallery_core_album', array('album_id' => (int) $parent_album_id)),
166
				));
167
			}
168
		}
169
170 4
		$this->template->assign_block_vars('navlinks', array(
171 4
			'FORUM_NAME'	=> $album_data['album_name'],
172 4
			'FORUM_ID'		=> $album_data['album_id'],
173 4
			'U_VIEW_FORUM'	=> $this->helper->route('phpbbgallery_core_album', array('album_id' => (int) $album_data['album_id'])),
174
		));
175
176 4
		$this->template->assign_vars(array(
177 4
			'ALBUM_ID' 		=> $album_data['album_id'],
178 4
			'ALBUM_NAME'	=> $album_data['album_name'],
179 4
			'ALBUM_DESC'	=> generate_text_for_display($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_bitfield'], $album_data['album_desc_options']),
0 ignored issues
show
Bug introduced by
The function generate_text_for_display was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

179
			'ALBUM_DESC'	=> /** @scrutinizer ignore-call */ generate_text_for_display($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_bitfield'], $album_data['album_desc_options']),
Loading history...
180 4
			'ALBUM_CONTEST_START'	=> ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST) ? $this->language->lang('CONTEST_START' . ((($album_data['contest_start']) < time())? 'ED' : 'S'), $this->user->format_date(($album_data['contest_start']), false, true)) : '',
181 4
			'ALBUM_CONTEST_RATING'	=> ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST) ? $this->language->lang('CONTEST_RATING_START' . ((($album_data['contest_start'] + $album_data['contest_rating']) < time())? 'ED' : 'S'), $this->user->format_date(($album_data['contest_start'] + $album_data['contest_rating']), false, true)) : '',
182 4
			'ALBUM_CONTEST_END'		=> ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST) ? $this->language->lang('CONTEST_END' . ((($album_data['contest_start'] + $album_data['contest_end']) < time())? 'ED' : 'S'), $this->user->format_date(($album_data['contest_start'] + $album_data['contest_end']), false, true)) : '',
183 4
			'U_VIEW_ALBUM'	=> $this->helper->route('phpbbgallery_core_album', array('album_id' => (int) $album_data['album_id'])),
184
		));
185
186 4
		return;
187
	}
188
189
	/**
190
	 * Returns album parents as an array. Get them from album_data if available, or update the database otherwise
191
	 *
192
	 * borrowed from phpBB3
193
	 * @author: phpBB Group
194
	 * @function: get_forum_parents
195
	 * @param $album_data
196
	 * @return array|mixed
197
	 */
198 4
	public function get_parents($album_data)
199
	{
200 4
		$album_parents = array();
201 4
		if ($album_data['parent_id'] > 0)
202
		{
203
			if ($album_data['album_parents'] == '')
204
			{
205
				$sql = 'SELECT album_id, album_name, album_type
206
					FROM ' . $this->table_albums . '
207
					WHERE left_id < ' . (int) $album_data['left_id'] . '
208
						AND right_id > ' . (int) $album_data['right_id'] . '
209
						AND album_user_id = ' . (int) $album_data['album_user_id'] . '
210
					ORDER BY left_id ASC';
211
				$result = $this->db->sql_query($sql);
212
213
				while ($row = $this->db->sql_fetchrow($result))
214
				{
215
					$album_parents[$row['album_id']] = array($row['album_name'], (int) $row['album_type']);
216
				}
217
				$this->db->sql_freeresult($result);
218
219
				$album_data['album_parents'] = serialize($album_parents);
220
221
				$sql = 'UPDATE ' . $this->table_albums . "
222
					SET album_parents = '" . $this->db->sql_escape($album_data['album_parents']) . "'
223
					WHERE parent_id = " . (int) $album_data['parent_id'];
224
				$this->db->sql_query($sql);
225
			}
226
			else
227
			{
228
				$album_parents = unserialize($album_data['album_parents']);
229
			}
230
		}
231
232 4
		return $album_parents;
233
	}
234
235
	/**
236
	 * Obtain list of moderators of each album
237
	 *
238
	 * borrowed from phpBB3
239
	 * @author: phpBB Group
240
	 * @function: get_forum_moderators
241
	 * @param bool $album_id
242
	 * @return array
243
	 */
244 1
	public function get_moderators($album_id = false)
245
	{
246 1
		$album_id_ary = $album_moderators = array();
247
248 1
		if ($album_id !== false)
249
		{
250 1
			if (!is_array($album_id))
0 ignored issues
show
introduced by
The condition is_array($album_id) is always false.
Loading history...
251
			{
252 1
				$album_id = array($album_id);
253
			}
254
255
			// Exchange key/value pair to be able to faster check for the album id existence
256 1
			$album_id_ary = array_flip($album_id);
257
		}
258
259
		$sql_array = array(
260 1
			'SELECT'	=> 'm.*, u.user_colour, g.group_colour, g.group_type',
261 1
			'FROM'		=> array($this->table_moderators => 'm'),
262
263
			'LEFT_JOIN'	=> array(
264
				array(
265 1
					'FROM'	=> array(USERS_TABLE => 'u'),
0 ignored issues
show
Bug introduced by
The constant phpbbgallery\core\album\USERS_TABLE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
266 1
					'ON'	=> 'm.user_id = u.user_id',
267
				),
268
				array(
269 1
					'FROM'	=> array(GROUPS_TABLE => 'g'),
0 ignored issues
show
Bug introduced by
The constant phpbbgallery\core\album\GROUPS_TABLE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
270 1
					'ON'	=> 'm.group_id = g.group_id',
271
				),
272
			),
273
274 1
			'WHERE'		=> 'm.display_on_index = 1',
275 1
			'ORDER_BY'	=> 'm.group_id ASC, m.user_id ASC',
276
		);
277
278
		// We query every album here because for caching we should not have any parameter.
279 1
		$sql = $this->db->sql_build_query('SELECT', $sql_array);
280 1
		$result = $this->db->sql_query($sql, 3600);
281
282 1
		while ($row = $this->db->sql_fetchrow($result))
283
		{
284 1
			$a_id = (int) $row['album_id'];
285
286 1
			if (!isset($album_id_ary[$a_id]))
287
			{
288 1
				continue;
289
			}
290
291 1
			if (!empty($row['user_id']))
292
			{
293
				$album_moderators[$a_id][] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
0 ignored issues
show
Bug introduced by
The function get_username_string was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

293
				$album_moderators[$a_id][] = /** @scrutinizer ignore-call */ get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
Loading history...
294
			}
295
			else
296
			{
297 1
				$group_name = (($row['group_type'] == GROUP_SPECIAL) ? $this->language->lang('G_' . $row['group_name']) : $row['group_name']);
0 ignored issues
show
Bug introduced by
The constant phpbbgallery\core\album\GROUP_SPECIAL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
298
299 1
				if ($this->user->data['user_id'] != ANONYMOUS && !$this->auth->acl_get('u_viewprofile'))
0 ignored issues
show
Bug introduced by
The constant phpbbgallery\core\album\ANONYMOUS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
300
				{
301 1
					$album_moderators[$a_id][] = '<span' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . '>' . $group_name . '</span>';
302
				}
303
				else
304
				{
305
					$album_moderators[$a_id][] = '<a' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . ' href="' . append_sid($this->root_path . 'memberlist.' . $this->php_ext, 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>';
0 ignored issues
show
Bug introduced by
The function append_sid was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

305
					$album_moderators[$a_id][] = '<a' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . ' href="' . /** @scrutinizer ignore-call */ append_sid($this->root_path . 'memberlist.' . $this->php_ext, 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>';
Loading history...
306
				}
307
			}
308
		}
309 1
		$this->db->sql_freeresult($result);
310
311 1
		return $album_moderators;
312
	}
313
314
	/**
315
	 * Display albums
316
	 *
317
	 * borrowed from phpBB3
318
	 * @author: phpBB Group
319
	 * @function: display_forums
320
	 * @param string $root_data
321
	 * @param bool $display_moderators
322
	 * @param bool $return_moderators
323
	 * @return array
324
	 */
325 11
	public function display_albums($root_data = '', $display_moderators = true, $return_moderators = false)
326
	{
327 11
		$album_rows = $subalbums = $album_ids = $album_ids_moderator = $album_moderators = $active_album_ary = array();
328 11
		$parent_id = $visible_albums = 0;
329
		//$mode = $this->request->variable('mode', '');
330 11
		$mode = $this->album_mode;
331
		// Mark albums read?
332 11
		$mark_read = $this->request->variable('mark', '');
333
334 11
		if ($mark_read == 'all')
335
		{
336
			$mark_read = '';
337
		}
338
339 11
		if (!$root_data)
340
		{
341 6
			if ($mark_read == 'albums')
342
			{
343
				$mark_read = 'all';
344
			}
345 6
			$root_data = array('album_id' => \phpbbgallery\core\block::PUBLIC_ALBUM);
346 6
			$sql_where = 'a.album_user_id = ' . \phpbbgallery\core\block::PUBLIC_ALBUM;
347
		}
348 6
		else if ($root_data == 'personal')
349
		{
350 4
			if ($mark_read == 'albums')
351
			{
352
				$mark_read = 'all';
353
			}
354 4
			$root_data = array('album_id' => 0);
355 4
			$sql_where = 'a.album_user_id > ' . \phpbbgallery\core\block::PUBLIC_ALBUM;
356 4
			$num_pegas = $this->config['phpbb_gallery_num_pegas'];
0 ignored issues
show
Unused Code introduced by
The assignment to $num_pegas is dead and can be removed.
Loading history...
357 4
			$first_char = $this->request->variable('first_char', '');
358 4
			if ($first_char == 'other')
359
			{
360
				// Loop the ASCII: a-z
361
				for ($i = 97; $i < 123; $i++)
362
				{
363
					$sql_where .= ' AND u.username_clean NOT ' . $this->db->sql_like_expression(chr($i) . $this->db->any_char);
364
				}
365
			}
366 4
			else if ($first_char)
367
			{
368
				$sql_where .= ' AND u.username_clean ' . $this->db->sql_like_expression(substr($first_char, 0, 1) . $this->db->any_char);
369
			}
370
371 4
			if ($first_char)
372
			{
373
				// We do not view all personal albums, so we need to recount, for the pagination.
374
				$sql_array = array(
375
					'SELECT'		=> 'count(a.album_id) as pgalleries',
376
					'FROM'			=> array($this->table_albums => 'a'),
377
378
					'LEFT_JOIN'		=> array(
379
						array(
380
							'FROM'		=> array(USERS_TABLE => 'u'),
0 ignored issues
show
Bug introduced by
The constant phpbbgallery\core\album\USERS_TABLE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
381
							'ON'		=> 'u.user_id = a.album_user_id',
382
						),
383
					),
384
385
					'WHERE'			=> 'a.parent_id = 0 AND ' . $sql_where,
386
				);
387
				$sql = $this->db->sql_build_query('SELECT', $sql_array);
388
				$result = $this->db->sql_query($sql);
389
				$num_pegas = $this->db->sql_fetchfield('pgalleries');
390
				$this->db->sql_freeresult($result);
391
			}
392
393 4
			$mode_personal = true;
394 4
			$start = $this->album_start;
395
			//$limit = $this->config['phpbb_gallery_pegas_per_page'];
396 4
			$limit = $this->album_limit;
397
			/*$this->template->assign_vars(array(
398
				'PAGINATION'				=> $this->pagination->generate_template_pagination(array(
399
						//todo 'mode=' . $mode . (($first_char) ? '&amp;first_char=' . $first_char : '')
400
					), 'pagination', 'page', $num_pegas, $limit, $start),
401
				'TOTAL_PGALLERIES_SHORT'	=> $this->user->lang('TOTAL_PEGAS_SHORT_SPRINTF', $num_pegas),
402
				'PAGE_NUMBER'				=> $this->pagination->on_page($num_pegas, $limit, $start),
403
			));
404
			$this->pagination->generate_template_pagination(array(
405
				'routes' => array(
406
					'phpbbgallery_core_search_recent',
407
					'phpbbgallery_core_search_recent_page',),
408
					'params' => array()), 'pagination', 'page', $num_pegas, $limit, $start
409
			);*/
410
		}
411
		else
412
		{
413 2
			$sql_where = 'a.left_id > ' . $root_data['left_id'] . ' AND a.left_id < ' . $root_data['right_id'] . ' AND a.album_user_id = ' . $root_data['album_user_id'];
414
		}
415
416
		$sql_array = array(
417 11
			'SELECT'	=> 'a.*, at.mark_time',
418 11
			'FROM'		=> array($this->table_albums => 'a'),
419
420
			'LEFT_JOIN'	=> array(
421
				array(
422 11
					'FROM'	=> array($this->table_tracking => 'at'),
423 11
					'ON'	=> 'at.user_id = ' . $this->user->data['user_id'] . ' AND a.album_id = at.album_id'
424
				)
425
			),
426
427 11
			'ORDER_BY'	=> 'a.album_user_id, a.left_id',
428
		);
429
430 11
		if (isset($mode_personal))
431
		{
432 4
			$sql_array['LEFT_JOIN'][] = array(
433 4
				'FROM'	=> array(USERS_TABLE => 'u'),
434 4
				'ON'	=> 'u.user_id = a.album_user_id',
435
			);
436 4
			$sql_array['ORDER_BY'] = 'u.username_clean, a.left_id';
437
		}
438
439 11
		$sql_array['LEFT_JOIN'][] = array(
440 11
			'FROM'	=> array($this->table_contests => 'c'),
441 11
			'ON'	=> 'c.contest_album_id = a.album_id',
442
		);
443 11
		$sql_array['SELECT'] = $sql_array['SELECT'] . ', c.contest_marked';
444
445 11
		$sql = $this->db->sql_build_query('SELECT', array(
446 11
			'SELECT'	=> $sql_array['SELECT'],
447 11
			'FROM'		=> $sql_array['FROM'],
448 11
			'LEFT_JOIN'	=> $sql_array['LEFT_JOIN'],
449 11
			'WHERE'		=> $sql_where,
450 11
			'ORDER_BY'	=> $sql_array['ORDER_BY'],
451
		));
452
453 11
		$result = $this->db->sql_query($sql);
454
455 11
		$album_tracking_info = array();
456 11
		$branch_root_id = $root_data['album_id'];
457 11
		$zebra_array = $this->gallery_auth->get_user_zebra($this->user->data['user_id']);
458 11
		$listable = $this->gallery_auth->acl_album_ids('a_list');
459 11
		while ($row = $this->db->sql_fetchrow($result))
460
		{
461 9
			$album_id = $row['album_id'];
462
			//if user has no right to see the album - scip it here!
463 9
			if (!in_array($album_id, $listable))
0 ignored issues
show
Bug introduced by
It seems like $listable can also be of type true; however, parameter $haystack of in_array() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

463
			if (!in_array($album_id, /** @scrutinizer ignore-type */ $listable))
Loading history...
464
			{
465 7
				continue;
466
			}
467
			// Mark albums read?
468 7
			if ($mark_read == 'albums' || $mark_read == 'all')
469
			{
470
				if ($this->gallery_auth->acl_check('a_list', $album_id, $row['album_user_id']))
471
				{
472
					$album_ids[] = $album_id;
473
					continue;
474
				}
475
			}
476
477
			// Category with no members
478 7
			if (!$row['album_type'] && ($row['left_id'] + 1 == $row['right_id']))
479
			{
480
				continue;
481
			}
482
483
			// Skip branch
484 7
			if (isset($right_id))
485
			{
486
				if ($row['left_id'] < $right_id)
487
				{
488
					continue;
489
				}
490
				unset($right_id);
491
			}
492
493
			// if this is invizible due zebra ... make it go away
494 7
			if ($this->gallery_auth->get_zebra_state($zebra_array, (int) $row['album_user_id'], (int) $row['album_id']) < (int) $row['album_auth_access'])
495
			{
496
				continue;
497
			}
498
499 7
			if (false)//@todo !$this->gallery_auth->acl_check('a_list', $album_id, $row['album_user_id']))
500
			{
501
				// if the user does not have permissions to list this album, skip everything until next branch
502
				$right_id = $row['right_id'];
503
				continue;
504
			}
505
506 7
			$album_tracking_info[$album_id] = (!empty($row['mark_time'])) ? $row['mark_time'] : $this->gallery_user->get_data('user_lastmark');
507
508 7
			if ($row['parent_id'] == $root_data['album_id'] || $row['parent_id'] == $branch_root_id)
509
			{
510 7
				if ($row['album_type'])
511
				{
512 7
					$album_ids_moderator[] = (int) $album_id;
513
				}
514
515
				// Direct child of current branch
516 7
				$parent_id = $album_id;
517 7
				$album_rows[$album_id] = $row;
518
519 7
				if (!$row['album_type'] && $row['parent_id'] == $root_data['album_id'])
520
				{
521
					$branch_root_id = $album_id;
522
				}
523 7
				$album_rows[$parent_id]['album_id_last_image'] = $row['album_id'];
524 7
				$album_rows[$parent_id]['album_type_last_image'] = $row['album_type'];
525 7
				$album_rows[$parent_id]['album_contest_marked'] = $row['contest_marked'];
526 7
				$album_rows[$parent_id]['orig_album_last_image_time'] = $row['album_last_image_time'];
527
			}
528 5
			else if ($row['album_type'])
529
			{
530 5
				$subalbums[$parent_id][$album_id]['display'] = ($row['display_on_index']) ? true : false;
531 5
				$subalbums[$parent_id][$album_id]['name'] = $row['album_name'];
532 5
				$subalbums[$parent_id][$album_id]['orig_album_last_image_time'] = $row['album_last_image_time'];
533 5
				$subalbums[$parent_id][$album_id]['children'] = array();
534
535 5
				if (isset($subalbums[$parent_id][$row['parent_id']]) && !$row['display_on_index'])
536
				{
537
					$subalbums[$parent_id][$row['parent_id']]['children'][] = $album_id;
538
				}
539
540 5
				$album_rows[$parent_id]['album_images'] += $row['album_images'];
541 5
				$album_rows[$parent_id]['album_images_real'] += $row['album_images_real'];
542
543 5
				if ($row['album_last_image_time'] > $album_rows[$parent_id]['album_last_image_time'])
544
				{
545
					$album_rows[$parent_id]['album_last_image_id'] = $row['album_last_image_id'];
546
					$album_rows[$parent_id]['album_last_image_name'] = $row['album_last_image_name'];
547
					$album_rows[$parent_id]['album_last_image_time'] = $row['album_last_image_time'];
548
					$album_rows[$parent_id]['album_last_user_id'] = $row['album_last_user_id'];
549
					$album_rows[$parent_id]['album_last_username'] = $row['album_last_username'];
550
					$album_rows[$parent_id]['album_last_user_colour'] = $row['album_last_user_colour'];
551
					$album_rows[$parent_id]['album_type_last_image'] = $row['album_type'];
552
					$album_rows[$parent_id]['album_contest_marked'] = $row['contest_marked'];
553
					$album_rows[$parent_id]['album_id_last_image'] = $album_id;
554
				}
555
			}
556
		}
557 11
		$this->db->sql_freeresult($result);
558
559
		// Handle marking albums
560 11
		if ($mark_read == 'albums' || $mark_read == 'all')
561
		{
562
			$redirect = build_url('mark');
0 ignored issues
show
Bug introduced by
The function build_url was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

562
			$redirect = /** @scrutinizer ignore-call */ build_url('mark');
Loading history...
563
			$token = $this->request->variable('hash', '');
564
			if (check_link_hash($token, 'global'))
0 ignored issues
show
Bug introduced by
The function check_link_hash was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

564
			if (/** @scrutinizer ignore-call */ check_link_hash($token, 'global'))
Loading history...
565
			{
566
				if ($mark_read == 'all')
567
				{
568
					$this->misc->markread('all');
569
					$message = $this->language->lang('RETURN_INDEX', '<a href="' . $redirect . '">', '</a>');
570
				}
571
				else
572
				{
573
					$this->misc->markread('albums', $album_ids);
0 ignored issues
show
Bug introduced by
$album_ids of type array is incompatible with the type boolean expected by parameter $album_id of phpbbgallery\core\misc::markread(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

573
					$this->misc->markread('albums', /** @scrutinizer ignore-type */ $album_ids);
Loading history...
574
					$message = $this->language->lang('RETURN_ALBUM', '<a href="' . $redirect . '">', '</a>');
575
				}
576
				meta_refresh(3, $redirect);
0 ignored issues
show
Bug introduced by
The function meta_refresh was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

576
				/** @scrutinizer ignore-call */ 
577
    meta_refresh(3, $redirect);
Loading history...
577
				trigger_error($this->language->lang('ALBUMS_MARKED') . '<br /><br />' . $message);
578
			}
579
			else
580
			{
581
				$message = $this->language->lang('RETURN_PAGE', '<a href="' . $redirect . '">', '</a>');
582
				meta_refresh(3, $redirect);
583
				trigger_error($message);
584
			}
585
		}
586
587
		// Grab moderators ... if necessary
588 11
		if ($display_moderators)
589
		{
590 1
			if ($return_moderators)
591
			{
592
				$album_ids_moderator[] = $root_data['album_id'];
593
			}
594 1
			$this->get_moderators($album_moderators);
0 ignored issues
show
Bug introduced by
$album_moderators of type array is incompatible with the type boolean expected by parameter $album_id of phpbbgallery\core\album\display::get_moderators(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

594
			$this->get_moderators(/** @scrutinizer ignore-type */ $album_moderators);
Loading history...
595
		}
596
597
		// Used to tell whatever we have to create a dummy category or not.
598 11
		$last_catless = true;
599 11
		foreach ($album_rows as $row)
600
		{
601
			// Empty category
602 7
			if (($row['parent_id'] == $root_data['album_id']) && ($row['album_type'] == \phpbbgallery\core\block::TYPE_CAT))
603
			{
604
				$this->template->assign_block_vars('albumrow', array(
605
					'S_IS_CAT'				=> true,
606
					'ALBUM_ID'				=> $row['album_id'],
607
					'ALBUM_NAME'			=> $row['album_name'],
608
					'ALBUM_DESC'			=> generate_text_for_display($row['album_desc'], $row['album_desc_uid'], $row['album_desc_bitfield'], $row['album_desc_options']),
0 ignored issues
show
Bug introduced by
The function generate_text_for_display was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

608
					'ALBUM_DESC'			=> /** @scrutinizer ignore-call */ generate_text_for_display($row['album_desc'], $row['album_desc_uid'], $row['album_desc_bitfield'], $row['album_desc_options']),
Loading history...
609
					'ALBUM_FOLDER_IMG'		=> '',
610
					'ALBUM_FOLDER_IMG_SRC'	=> '',
611
					// 'ALBUM_IMAGE'			=> ($row['album_image']) ? $row['album_image'] : '',
612
					'U_VIEWALBUM'			=> $this->helper->route('phpbbgallery_core_album', array('album_id' => (int) $row['album_id'])),
613
				));
614
615
				continue;
616
			}
617
618 7
			$visible_albums++;
619 7
			if (($mode == 'personal') && (($visible_albums <= $start) || ($visible_albums > ($start + $limit))))
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $start does not seem to be defined for all execution paths leading up to this point.
Loading history...
Comprehensibility Best Practice introduced by
The variable $limit does not seem to be defined for all execution paths leading up to this point.
Loading history...
620
			{
621 1
				continue;
622
			}
623
624 7
			$album_id = $row['album_id'];
625 7
			$album_unread = (isset($album_tracking_info[$album_id]) && ($row['orig_album_last_image_time'] > $album_tracking_info[$album_id]) && ($this->user->data['user_id'] != ANONYMOUS)) ? true : false;
0 ignored issues
show
Bug introduced by
The constant phpbbgallery\core\album\ANONYMOUS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
626
627 7
			$folder_alt = $l_subalbums = '';
628 7
			$subalbums_list = array();
629
630
			// Generate list of subalbums if we need to
631 7
			if (isset($subalbums[$album_id]))
632
			{
633 5
				foreach ($subalbums[$album_id] as $subalbum_id => $subalbum_row)
634
				{
635 5
					$subalbum_unread = (isset($album_tracking_info[$subalbum_id]) && $subalbum_row['orig_album_last_image_time'] > $album_tracking_info[$subalbum_id] && ($this->user->data['user_id'] != ANONYMOUS)) ? true : false;
636
637 5
					if (!$subalbum_unread && !empty($subalbum_row['children']) && ($this->user->data['user_id'] != ANONYMOUS))
638
					{
639
						foreach ($subalbum_row['children'] as $child_id)
640
						{
641
							if (isset($album_tracking_info[$child_id]) && $subalbums[$album_id][$child_id]['orig_album_last_image_time'] > $album_tracking_info[$child_id])
642
							{
643
								// Once we found an unread child album, we can drop out of this loop
644
								$subalbum_unread = true;
645
								break;
646
							}
647
						}
648
					}
649
650 5
					if ($subalbum_row['display'] && $subalbum_row['name'])
651
					{
652 5
						$subalbums_list[] = array(
653 5
							'link'		=> $this->helper->route('phpbbgallery_core_album', array('album_id' => (int) $subalbum_id)),
654 5
							'name'		=> $subalbum_row['name'],
655 5
							'unread'	=> $subalbum_unread,
656
						);
657
					}
658
					else
659
					{
660
						unset($subalbums[$album_id][$subalbum_id]);
661
					}
662
663 5
					if ($subalbum_unread)
664
					{
665
						$album_unread = true;
666
					}
667
				}
668
669 5
				$l_subalbums = (sizeof($subalbums[$album_id]) == 1) ? $this->language->lang('SUBALBUM') : $this->language->lang('SUBALBUMS');
670 5
				$folder_image = ($album_unread) ? 'forum_unread_subforum' : 'forum_read_subforum';
671
			}
672
			else
673
			{
674 3
				$folder_alt = ($album_unread) ? 'NEW_IMAGES' : 'NO_NEW_IMAGES';
675 3
				$folder_image = ($album_unread) ? 'forum_unread' : 'forum_read';
676
			}
677 7
			if ($row['album_status'] == \phpbbgallery\core\block::ALBUM_LOCKED)
678
			{
679
				$folder_image = ($album_unread) ? 'forum_unread_locked' : 'forum_read_locked';
680
				$folder_alt = 'ALBUM_LOCKED';
681
			}
682
683
			// Create last post link information, if appropriate
684 7
			if ($row['album_last_image_id'])
685
			{
686 5
				$lastimage_time = $this->user->format_date($row['album_last_image_time']);
687 5
				$lastimage_album_type = $row['album_type_last_image'];
688 5
				$lastimage_contest_marked = $row['album_contest_marked'];
689
				// phpbb_ext_gallery_core_image::generate_link('fake_thumbnail', $phpbb_ext_gallery->config->get('link_thumbnail'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
690 5
				$lastimage_uc_fake_thumbnail = $row['album_image'] ? generate_board_url() . '/' . $row['album_image'] : $this->helper->route('phpbbgallery_core_image_file_mini', array('image_id' => $row['album_last_image_id']));
0 ignored issues
show
Bug introduced by
The function generate_board_url was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

690
				$lastimage_uc_fake_thumbnail = $row['album_image'] ? /** @scrutinizer ignore-call */ generate_board_url() . '/' . $row['album_image'] : $this->helper->route('phpbbgallery_core_image_file_mini', array('image_id' => $row['album_last_image_id']));
Loading history...
691 5
				$lastimage_uc_fake_thumbnail_url = $row['album_image'] ? generate_board_url() . '/' . $row['album_image'] : $this->helper->route('phpbbgallery_core_image', array('image_id' => $row['album_last_image_id']));
692
				// phpbb_ext_gallery_core_image::generate_link('thumbnail', $phpbb_ext_gallery->config->get('link_thumbnail'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
693 5
				$lastimage_uc_thumbnail = $row['album_image'] ? generate_board_url() . '/' . $row['album_image'] : $this->helper->route('phpbbgallery_core_image_file_mini', array('image_id' => $row['album_last_image_id']));
694
				// phpbb_ext_gallery_core_image::generate_link('image_name', $phpbb_ext_gallery->config->get('link_image_name'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
695 5
				$lastimage_uc_name = '';//@todo phpbb_ext_gallery_core_image::generate_link('image_name', $phpbb_ext_gallery->config->get('link_image_name'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
696
				// phpbb_ext_gallery_core_image::generate_link('lastimage_icon', $phpbb_ext_gallery->config->get('link_image_icon'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
697 5
				$lastimage_uc_icon = '';//@todo phpbb_ext_gallery_core_image::generate_link('lastimage_icon', $phpbb_ext_gallery->config->get('link_image_icon'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
698
			}
699
			else
700
			{
701 3
				$lastimage_time = $lastimage_album_type = $lastimage_contest_marked = 0;
702 3
				$lastimage_uc_fake_thumbnail = $lastimage_uc_fake_thumbnail_url = $lastimage_uc_thumbnail = $lastimage_uc_name = $lastimage_uc_icon = '';
0 ignored issues
show
Unused Code introduced by
The assignment to $lastimage_uc_fake_thumbnail is dead and can be removed.
Loading history...
Unused Code introduced by
The assignment to $lastimage_uc_thumbnail is dead and can be removed.
Loading history...
Unused Code introduced by
The assignment to $lastimage_uc_fake_thumbnail_url is dead and can be removed.
Loading history...
703 3
				$lastimage_uc_fake_thumbnail = $lastimage_uc_fake_thumbnail_url = $lastimage_uc_thumbnail = $this->helper->route('phpbbgallery_core_image_file_mini', array('image_id' => 0));
704
			}
705
706
			// Output moderator listing ... if applicable
707 7
			$l_moderator = $moderators_list = '';
708 7
			if ($display_moderators && !empty($album_moderators[$album_id]))
709
			{
710
				$l_moderator = (sizeof($album_moderators[$album_id]) == 1) ? $this->language->lang('MODERATOR') : $this->language->lang('MODERATORS');
711
				$moderators_list = implode(', ', $album_moderators[$album_id]);
712
			}
713
714 7
			$s_subalbums_list = array();
715 7
			foreach ($subalbums_list as $subalbum)
716
			{
717 5
				$s_subalbums_list[] = '<a href="' . $subalbum['link'] . '" class="subforum ' . (($subalbum['unread']) ? 'unread' : 'read') . '" title="' . (($subalbum['unread']) ? $this->language->lang('NEW_IMAGES') : $this->language->lang('NO_NEW_IMAGES')) . '">' . $subalbum['name'] . '</a>';
718
			}
719 7
			$s_subalbums_list = (string) implode(', ', $s_subalbums_list);
720 7
			$catless = ($row['parent_id'] == $root_data['album_id']) ? true : false;
721
722 7
			$s_username_hidden = ($lastimage_album_type == \phpbbgallery\core\block::TYPE_CONTEST) && $lastimage_contest_marked && !$this->gallery_auth->acl_check('m_status', $album_id, $row['album_user_id']) && ($this->user->data['user_id'] != $row['album_last_user_id'] || $row['album_last_user_id'] == ANONYMOUS);
723
724 7
			$this->template->assign_block_vars('albumrow', array(
725 7
				'S_IS_CAT'			=> false,
726 7
				'S_NO_CAT'			=> $catless && !$last_catless,
727 7
				'S_LOCKED_ALBUM'	=> ($row['album_status'] == \phpbbgallery\core\block::ALBUM_LOCKED) ? true : false,
728 7
				'S_UNREAD_ALBUM'	=> ($album_unread) ? true : false,
729 7
				'S_LIST_SUBALBUMS'	=> ($row['display_subalbum_list']) ? true : false,
730 7
				'S_SUBALBUMS'		=> (sizeof($subalbums_list)) ? true : false,
731
732 7
				'ALBUM_ID'				=> (int) $row['album_id'],
733 7
				'ALBUM_NAME'			=> $row['album_name'],
734 7
				'ALBUM_DESC'			=> generate_text_for_display($row['album_desc'], $row['album_desc_uid'], $row['album_desc_bitfield'], $row['album_desc_options']),
735 7
				'IMAGES'				=> (int) $row['album_images'],
736 7
				'UNAPPROVED_IMAGES'		=> ($this->gallery_auth->acl_check('m_status', $album_id, $row['album_user_id'])) ? ($row['album_images_real'] - $row['album_images']) : 0,
737 7
				'ALBUM_IMG_STYLE'		=> $folder_image,
738 7
				'ALBUM_FOLDER_IMG'		=> $this->user->img($folder_image, $folder_alt),
739 7
				'ALBUM_FOLDER_IMG_ALT'	=> $this->language->lang($folder_alt) ? $this->language->lang($folder_alt) : '',
740
				//'ALBUM_IMAGE'			=> ($row['album_image']) ? $row['album_image'] : '',
741 7
				'LAST_IMAGE_TIME'		=> $lastimage_time,
742 7
				'LAST_USER_FULL'		=> ($s_username_hidden) ? $this->language->lang('CONTEST_USERNAME') : get_username_string('full', $row['album_last_user_id'], $row['album_last_username'], $row['album_last_user_colour']),
0 ignored issues
show
Bug introduced by
The function get_username_string was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

742
				'LAST_USER_FULL'		=> ($s_username_hidden) ? $this->language->lang('CONTEST_USERNAME') : /** @scrutinizer ignore-call */ get_username_string('full', $row['album_last_user_id'], $row['album_last_username'], $row['album_last_user_colour']),
Loading history...
743 7
				'UC_THUMBNAIL'			=> $this->config['phpbb_gallery_mini_thumbnail_disp'] ? $lastimage_uc_thumbnail : '',
744 7
				'UC_FAKE_THUMBNAIL'		=> $this->config['phpbb_gallery_mini_thumbnail_disp'] ? $lastimage_uc_fake_thumbnail : '',
745 7
				'UC_IMAGE_URL'			=> $this->config['phpbb_gallery_mini_thumbnail_disp'] ? $lastimage_uc_fake_thumbnail_url : '',
746 7
				'UC_IMAGE_NAME'			=> $lastimage_uc_name,
747 7
				'UC_LASTIMAGE_ICON'		=> $lastimage_uc_icon,
748 7
				'ALBUM_COLOUR'			=> get_username_string('colour', $row['album_last_user_id'], $row['album_last_username'], $row['album_last_user_colour']),
749 7
				'MODERATORS'			=> $moderators_list,
750 7
				'SUBALBUMS'				=> $s_subalbums_list,
751
752 7
				'L_SUBALBUM_STR'		=> $l_subalbums,
753 7
				'L_ALBUM_FOLDER_ALT'	=> $folder_alt,
754 7
				'L_MODERATOR_STR'		=> $l_moderator,
755
756 7
				'U_VIEWALBUM'			=> $this->helper->route('phpbbgallery_core_album', array('album_id' => (int) $row['album_id'])),
757
			));
758
759
			// Assign subforums loop for style authors
760 7
			foreach ($subalbums_list as $subalbum)
761
			{
762 5
				$this->template->assign_block_vars('albumrow.subalbum', array(
763 5
					'U_SUBALBUM'	=> $subalbum['link'],
764 5
					'SUBALBUM_NAME'	=> $subalbum['name'],
765 5
					'S_UNREAD'		=> $subalbum['unread'],
766
				));
767
			}
768
769 7
			$last_catless = $catless;
770
		}
771
772 11
		$this->template->assign_vars(array(
773 11
			'U_MARK_ALBUMS'		=> ($this->user->data['is_registered']) ? $this->helper->route('phpbbgallery_core_album', array('album_id' => (int) $root_data['album_id'], 'hash' => generate_link_hash('global'), 'mark' => 'albums')) : '',
0 ignored issues
show
Bug introduced by
The function generate_link_hash was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

773
			'U_MARK_ALBUMS'		=> ($this->user->data['is_registered']) ? $this->helper->route('phpbbgallery_core_album', array('album_id' => (int) $root_data['album_id'], 'hash' => /** @scrutinizer ignore-call */ generate_link_hash('global'), 'mark' => 'albums')) : '',
Loading history...
774 11
			'S_HAS_SUBALBUM'	=> ($visible_albums) ? true : false,
775 11
			'L_SUBFORUM'		=> ($visible_albums == 1) ? $this->language->lang('SUBALBUM') : $this->language->lang('SUBALBUMS'),
776 11
			'LAST_POST_IMG'		=> $this->user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
777 11
			'FAKE_THUMB_SIZE'	=> $this->config['phpbb_gallery_mini_thumbnail_size'],
778
		));
779
780 11
		if ($return_moderators)
781
		{
782
			return array($active_album_ary, $album_moderators);
783
		}
784
785 11
		$this->albums_total = $visible_albums;
786
787 11
		return array($active_album_ary, array());
788
	}
789
}
790