main_module::main()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 18
rs 9.9666
ccs 0
cts 13
cp 0
cc 3
nc 2
nop 2
crap 12
1
<?php
2
/**
3
 * phpBB Gallery - ACP CleanUp Extension
4
 *
5
 * @package   phpbbgallery/acpcleanup
6
 * @author    nickvergessen
7
 * @author    satanasov
8
 * @author    Leinad4Mind
9
 * @copyright 2007-2012 nickvergessen, 2014- satanasov, 2018- Leinad4Mind
10
 * @license   GPL-2.0-only
11
 */
12
13
namespace phpbbgallery\acpcleanup\acp;
14
15
class main_module
16
{
17
	public string $u_action;
18
19
	public function main(string $id, string $mode): void
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed. ( Ignorable by Annotation )

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

19
	public function main(/** @scrutinizer ignore-unused */ string $id, string $mode): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $mode is not used and could be removed. ( Ignorable by Annotation )

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

19
	public function main(string $id, /** @scrutinizer ignore-unused */ string $mode): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
20
	{
21
		global $auth, $cache, $config, $db, $template, $request, $user, $phpEx, $phpbb_root_path, $phpbb_ext_gallery;
22
23
		$user->add_lang_ext('phpbbgallery/core', array('gallery_acp', 'gallery'));
24
		$this->tpl_name = 'gallery_cleanup';
0 ignored issues
show
Bug Best Practice introduced by
The property tpl_name does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
25
26
		add_form_key('acp_gallery');
0 ignored issues
show
Bug introduced by
The function add_form_key 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

26
		/** @scrutinizer ignore-call */ 
27
  add_form_key('acp_gallery');
Loading history...
27
28
		$submit = $request->is_set_post('submit');
29
30
		if ($submit && !check_form_key('acp_gallery'))
0 ignored issues
show
Bug introduced by
The function check_form_key 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

30
		if ($submit && !/** @scrutinizer ignore-call */ check_form_key('acp_gallery'))
Loading history...
31
		{
32
			trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
0 ignored issues
show
Bug introduced by
The function adm_back_link 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

32
			trigger_error($user->lang('FORM_INVALID') . /** @scrutinizer ignore-call */ adm_back_link($this->u_action), E_USER_WARNING);
Loading history...
33
		}
34
35
		$this->page_title = $user->lang['ACP_GALLERY_CLEANUP'];
0 ignored issues
show
Bug Best Practice introduced by
The property page_title does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
36
		$this->cleanup($submit);
37
	}
38
39
	/**
40
	 * Cleanup gallery files and database entries
41
	 *
42
	 * @param array $missing_entries Files to clean
43
	 * @param bool $move_to_import Whether to move files to import dir
44
	 * @return array Messages about cleanup results
45
	 * @throws \RuntimeException On file operation errors
46
	 */
47
	public function cleanup(bool $submit = false): void
48
	{
49
		global $auth, $cache, $db, $template, $user, $phpbb_ext_gallery, $table_prefix, $phpbb_container, $request;
50
51
		$delete = $request->is_set_post('delete');
52
		$prune = $request->is_set_post('prune');
53
54
		$missing_sources = $request->variable('source', array(0));
55
		$missing_entries = $request->variable('entry', array(''), true);
56
		$missing_authors = $request->variable('author', array(0), true);
57
		$missing_comments = $request->variable('comment', array(0), true);
58
		$missing_personals = $request->variable('personal', array(0), true);
59
		$personals_bad = $request->variable('personal_bad', array(0), true);
60
		$prune_pattern = $request->variable('prune_pattern', array('' => ''), true);
61
62
		$move_to_import = $request->variable('move_to_import', 0);
63
		$new_author = $request->variable('new_author', '');
64
65
		$gallery_album = $phpbb_container->get('phpbbgallery.core.album');
66
		$core_cleanup = $phpbb_container->get('phpbbgallery.acpcleanup.cleanup');
67
		$gallery_auth = $phpbb_container->get('phpbbgallery.core.auth');
68
		$gallery_config = $phpbb_container->get('phpbbgallery.core.config');
69
		$gallery_url = $phpbb_container->get('phpbbgallery.core.url');
70
71
		// Lets detect if ACP Import exists (find if directory is with RW access)
72
		$acp_import_installed = false;
73
		$acp_import_dir = $gallery_url->path('import');
74
		if (file_exists($acp_import_dir) && is_writable($acp_import_dir))
75
		{
76
			$acp_import_installed = true;
77
		}
78
		if ($prune && empty($prune_pattern))
79
		{
80
			$prune_pattern['image_album_id'] = implode(',', $request->variable('prune_album_ids', array(0)));
81
			if (isset($_POST['prune_username_check']))
82
			{
83
				$usernames = $request->variable('prune_usernames', '', true);
84
				$usernames = explode("\n", $usernames);
85
				$prune_pattern['image_user_id'] = array();
86
				if (!empty($usernames))
87
				{
88
					if (!function_exists('user_get_id_name'))
89
					{
90
						$gallery_url->_include('functions_user', 'phpbb');
91
					}
92
					user_get_id_name($user_ids, $usernames);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $user_ids does not exist. Did you maybe mean $user_id?
Loading history...
93
					$prune_pattern['image_user_id'] = $user_ids;
94
				}
95
				if (isset($_POST['prune_anonymous']))
96
				{
97
					$prune_pattern['image_user_id'][] = ANONYMOUS;
0 ignored issues
show
Bug introduced by
The constant phpbbgallery\acpcleanup\acp\ANONYMOUS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
98
				}
99
				$prune_pattern['image_user_id'] = implode(',', $prune_pattern['image_user_id']);
100
			}
101
			if (isset($_POST['prune_time_check']))
102
			{
103
				$prune_time = explode('-', $request->variable('prune_time', ''));
104
105
				if (sizeof($prune_time) == 3)
106
				{
107
					$prune_pattern['image_time'] = @gmmktime(0, 0, 0, (int) $prune_time[1], (int) $prune_time[2], (int) $prune_time[0]);
108
				}
109
			}
110
			if (isset($_POST['prune_comments_check']))
111
			{
112
				$prune_pattern['image_comments'] = $request->variable('prune_comments', 0);
113
			}
114
			if (isset($_POST['prune_ratings_check']))
115
			{
116
				$prune_pattern['image_rates'] = $request->variable('prune_ratings', 0);
117
			}
118
			if (isset($_POST['prune_rating_avg_check']))
119
			{
120
				$prune_pattern['image_rate_avg'] = (int) ($request->variable('prune_rating_avg', 0.0) * 100);
121
			}
122
		}
123
124
		$s_hidden_fields = build_hidden_fields(array(
0 ignored issues
show
Bug introduced by
The function build_hidden_fields 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

124
		$s_hidden_fields = /** @scrutinizer ignore-call */ build_hidden_fields(array(
Loading history...
125
			'source'		=> $missing_sources,
126
			'entry'			=> $missing_entries,
127
			'author'		=> $missing_authors,
128
			'comment'		=> $missing_comments,
129
			'personal'		=> $missing_personals,
130
			'personal_bad'	=> $personals_bad,
131
			'prune_pattern'	=> $prune_pattern,
132
			'move_to_import'	=> $move_to_import,
133
		));
134
135
		if ($submit)
136
		{
137
			$user_id = 1;
138
			if ($new_author)
139
			{
140
				$user_id = 0;
141
				if (!function_exists('user_get_id_name'))
142
				{
143
					$gallery_url->_include('functions_user', 'phpbb');
144
				}
145
				user_get_id_name($user_id, $new_author);
146
				if (is_array($user_id) && !empty($user_id))
0 ignored issues
show
introduced by
The condition is_array($user_id) is always false.
Loading history...
147
				{
148
					$user_id = $user_id[0];
149
				}
150
				if (!$user_id)
151
				{
152
					trigger_error($user->lang('CLEAN_USER_NOT_FOUND', $new_author) . adm_back_link($this->u_action), E_USER_WARNING);
0 ignored issues
show
Bug introduced by
The function adm_back_link 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

152
					trigger_error($user->lang('CLEAN_USER_NOT_FOUND', $new_author) . /** @scrutinizer ignore-call */ adm_back_link($this->u_action), E_USER_WARNING);
Loading history...
153
				}
154
			}
155
			if ($missing_authors)
156
			{
157
				$sql = 'UPDATE ' . $table_prefix . 'gallery_images
158
					SET image_user_id = ' . $user_id . ",
159
						image_user_colour = ''
160
					WHERE " . $db->sql_in_set('image_id', $missing_authors);
161
				$db->sql_query($sql);
162
			}
163
			if ($missing_comments)
164
			{
165
				$sql = 'UPDATE ' . $table_prefix . 'gallery_comments
166
					SET comment_user_id = ' . $user_id . ",
167
						comment_user_colour = ''
168
					WHERE " . $db->sql_in_set('comment_id', $missing_comments);
169
				$db->sql_query($sql);
170
			}
171
			trigger_error($user->lang['CLEAN_CHANGED'] . adm_back_link($this->u_action));
172
		}
173
174
		if (confirm_box(true))
0 ignored issues
show
Bug introduced by
The function confirm_box 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

174
		if (/** @scrutinizer ignore-call */ confirm_box(true))
Loading history...
175
		{
176
			$message = array();
177
			if ($missing_entries)
178
			{
179
				if ($acp_import_installed && $move_to_import)
180
				{
181
					foreach ($missing_entries as $entry)
182
					{
183
						copy($gallery_url->path('upload') . '/' . $entry, $gallery_url->path('import') . '/' . $entry);
184
					}
185
				}
186
				$message[] = $core_cleanup->delete_files($missing_entries);
187
			}
188
			if ($missing_sources)
189
			{
190
				$message[] = $core_cleanup->delete_images($missing_sources);
191
			}
192
			if ($missing_authors)
193
			{
194
				$message[] = $core_cleanup->delete_author_images($missing_entries);
195
			}
196
			if ($missing_comments)
197
			{
198
				$message[] = $core_cleanup->delete_author_comments($missing_comments);
199
			}
200
			if ($missing_personals || $personals_bad)
201
			{
202
				$message = array_merge($message, $core_cleanup->delete_pegas($personals_bad, $missing_personals));
203
204
				// Only do this, when we changed something about the albums
205
				$cache->destroy('_albums');
206
				$gallery_auth->set_user_permissions('all', '');
207
			}
208
			if ($prune_pattern)
209
			{
210
				$message[] = $core_cleanup->prune($prune_pattern);
211
			}
212
213
			if (empty($message))
214
			{
215
				trigger_error($user->lang['CLEAN_NO_ACTION'] . adm_back_link($this->u_action), E_USER_WARNING);
216
			}
217
218
			// Make sure the overall image & comment count is correct...
219
			$sql = 'SELECT COUNT(image_id) AS num_images, SUM(image_comments) AS num_comments
220
				FROM ' . $table_prefix . 'gallery_images
221
				WHERE image_status <> ' . (int) \phpbbgallery\core\block::STATUS_UNAPPROVED;
222
			$result = $db->sql_query($sql);
223
			$row = $db->sql_fetchrow($result);
224
			$db->sql_freeresult($result);
225
226
			$gallery_config->set('num_images', $row['num_images']);
227
			$gallery_config->set('num_comments', (int) $row['num_comments']);
228
229
			$cache->destroy('sql', $table_prefix . 'gallery_albums');
230
			$cache->destroy('sql', $table_prefix . 'gallery_comments');
231
			$cache->destroy('sql', $table_prefix . 'gallery_images');
232
			$cache->destroy('sql', $table_prefix . 'gallery_rates');
233
			$cache->destroy('sql', $table_prefix . 'gallery_reports');
234
			$cache->destroy('sql', $table_prefix . 'gallery_watch');
235
236
			$message_string = '';
237
			foreach ($message as $lang_key)
238
			{
239
				$message_string .= (($message_string) ? '<br />' : '') . $user->lang[$lang_key];
240
			}
241
242
			trigger_error($message_string . adm_back_link($this->u_action));
243
		}
244
		else if ($delete || $prune || (isset($_POST['cancel'])))
245
		{
246
			if (isset($_POST['cancel']))
247
			{
248
				trigger_error($user->lang['CLEAN_GALLERY_ABORT'] . adm_back_link($this->u_action), E_USER_WARNING);
249
			}
250
			else
251
			{
252
				$clean_gallery_confirm = $user->lang['CONFIRM_CLEAN'];
253
				if ($missing_sources)
254
				{
255
					$clean_gallery_confirm = $user->lang['CONFIRM_CLEAN_SOURCES'] . '<br />' . $clean_gallery_confirm;
256
				}
257
				if ($missing_entries)
258
				{
259
					$clean_gallery_confirm = $user->lang['CONFIRM_CLEAN_ENTRIES'] . '<br />' . $clean_gallery_confirm;
260
				}
261
				if ($missing_authors)
262
				{
263
					$core_cleanup->delete_author_images($missing_authors);
264
					$clean_gallery_confirm = $user->lang['CONFIRM_CLEAN_AUTHORS'] . '<br />' . $clean_gallery_confirm;
265
				}
266
				if ($missing_comments)
267
				{
268
					$clean_gallery_confirm = $user->lang['CONFIRM_CLEAN_COMMENTS'] . '<br />' . $clean_gallery_confirm;
269
				}
270
				if ($personals_bad || $missing_personals)
271
				{
272
					$sql = 'SELECT album_name, album_user_id
273
						FROM ' . $table_prefix . 'gallery_albums
274
						WHERE ' . $db->sql_in_set('album_user_id', array_merge($missing_personals, $personals_bad));
275
					$result = $db->sql_query($sql);
276
					while ($row = $db->sql_fetchrow($result))
277
					{
278
						if (in_array($row['album_user_id'], $personals_bad))
279
						{
280
							$personals_bad_names[] = $row['album_name'];
281
						}
282
						else
283
						{
284
							$missing_personals_names[] = $row['album_name'];
285
						}
286
					}
287
					$db->sql_freeresult($result);
288
				}
289
				if ($missing_personals)
290
				{
291
					$clean_gallery_confirm = $user->lang('CONFIRM_CLEAN_PERSONALS', implode(', ', $missing_personals_names)) . '<br />' . $clean_gallery_confirm;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $missing_personals_names does not seem to be defined for all execution paths leading up to this point.
Loading history...
292
				}
293
				if ($personals_bad)
294
				{
295
					$clean_gallery_confirm = $user->lang('CONFIRM_CLEAN_PERSONALS_BAD', implode(', ', $personals_bad_names)) . '<br />' . $clean_gallery_confirm;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $personals_bad_names does not seem to be defined for all execution paths leading up to this point.
Loading history...
296
				}
297
				if ($prune && empty($prune_pattern))
298
				{
299
					trigger_error($user->lang['CLEAN_PRUNE_NO_PATTERN'] . adm_back_link($this->u_action), E_USER_WARNING);
300
				}
301
				else if ($prune && $prune_pattern)
302
				{
303
					$clean_gallery_confirm = $user->lang('CONFIRM_PRUNE', $core_cleanup->lang_prune_pattern($prune_pattern)) . '<br />' . $clean_gallery_confirm;
304
				}
305
				confirm_box(false, $clean_gallery_confirm, $s_hidden_fields);
306
			}
307
		}
308
309
		$requested_source = array();
310
		$sql_array = array(
311
			'SELECT'		=> 'i.image_id, i.image_name, i.image_filemissing, i.image_filename, i.image_username, u.user_id',
312
			'FROM'			=> array($table_prefix . 'gallery_images' => 'i'),
313
314
			'LEFT_JOIN'		=> array(
315
				array(
316
					'FROM'		=> array(USERS_TABLE => 'u'),
0 ignored issues
show
Bug introduced by
The constant phpbbgallery\acpcleanup\acp\USERS_TABLE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
317
					'ON'		=> 'u.user_id = i.image_user_id',
318
				),
319
			),
320
		);
321
		$sql = $db->sql_build_query('SELECT', $sql_array);
322
		$result = $db->sql_query($sql);
323
		while ($row = $db->sql_fetchrow($result))
324
		{
325
			if ($row['image_filemissing'])
326
			{
327
				$template->assign_block_vars('sourcerow', array(
328
					'IMAGE_ID'		=> $row['image_id'],
329
					'IMAGE_NAME'	=> $row['image_name'],
330
				));
331
			}
332
			if (!$row['user_id'])
333
			{
334
				$template->assign_block_vars('authorrow', array(
335
					'IMAGE_ID'		=> $row['image_id'],
336
					'AUTHOR_NAME'	=> $row['image_username'],
337
				));
338
			}
339
			$requested_source[] = $row['image_filename'];
340
		}
341
		$db->sql_freeresult($result);
342
343
		$check_mode = $request->variable('check_mode', '');
344
		if ($check_mode == 'source')
345
		{
346
			$source_missing = array();
347
348
			// Reset the status: a image might have been viewed without file but the file is back
349
			$sql = 'UPDATE ' . $table_prefix . 'gallery_images
350
				SET image_filemissing = 0';
351
			$db->sql_query($sql);
352
353
			$sql = 'SELECT image_id, image_filename, image_filemissing
354
				FROM ' . $table_prefix . 'gallery_images';
355
			$result = $db->sql_query($sql);
356
			while ($row = $db->sql_fetchrow($result))
357
			{
358
				if (!file_exists($gallery_url->path('upload') . $row['image_filename']))
359
				{
360
					$source_missing[] = $row['image_id'];
361
				}
362
			}
363
			$db->sql_freeresult($result);
364
365
			if ($source_missing)
366
			{
367
				$sql = 'UPDATE ' . $table_prefix . "gallery_images
368
					SET image_filemissing = 1
369
					WHERE " . $db->sql_in_set('image_id', $source_missing);
370
				$db->sql_query($sql);
371
			}
372
		}
373
374
		if ($check_mode == 'entry')
375
		{
376
			$directory = $gallery_url->path('upload');
377
			$handle = opendir($directory);
378
			while ($file = readdir($handle))
379
			{
380
				if (!is_dir($directory . $file) &&
381
				 ((substr(strtolower($file), '-5') == '.webp') || (substr(strtolower($file), '-4') == '.png') || (substr(strtolower($file), '-4') == '.gif') || (substr(strtolower($file), '-4') == '.jpg') || (substr(strtolower($file), '-5') == '.jpeg')) &&
382
				 ((substr(strtolower($file), '-8') <> '_wm.webp') && (substr(strtolower($file), '-7') <> '_wm.png') && (substr(strtolower($file), '-7') <> '_wm.gif') && (substr(strtolower($file), '-7') <> '_wm.jpg') && (substr(strtolower($file), '-8') <> '_wm.jpeg'))
383
				 && !in_array($file, $requested_source)
384
				)
385
				{
386
					if ((strpos($file, 'image_not_exist') !== false) || (strpos($file, 'not_authorised') !== false) || (strpos($file, 'no_hotlinking') !== false))
387
					{
388
						continue;
389
					}
390
391
					$template->assign_block_vars('entryrow', array(
392
						'FILE_NAME'				=> utf8_encode($file),
393
					));
394
				}
395
			}
396
			closedir($handle);
397
		}
398
399
		$sql_array = array(
400
			'SELECT'		=> 'c.comment_id, c.comment_image_id, c.comment_username, u.user_id',
401
			'FROM'			=> array($table_prefix . 'gallery_comments' => 'c'),
402
403
			'LEFT_JOIN'		=> array(
404
				array(
405
					'FROM'		=> array(USERS_TABLE => 'u'),
406
					'ON'		=> 'u.user_id = c.comment_user_id',
407
				),
408
			),
409
		);
410
		$sql = $db->sql_build_query('SELECT', $sql_array);
411
		$result = $db->sql_query($sql);
412
		while ($row = $db->sql_fetchrow($result))
413
		{
414
			if (!$row['user_id'])
415
			{
416
				$template->assign_block_vars('commentrow', array(
417
					'COMMENT_ID'	=> $row['comment_id'],
418
					'IMAGE_ID'		=> $row['comment_image_id'],
419
					'AUTHOR_NAME'	=> $row['comment_username'],
420
				));
421
			}
422
		}
423
		$db->sql_freeresult($result);
424
425
		$sql_array = array(
426
			'SELECT'		=> 'a.album_id, a.album_user_id, a.album_name, u.user_id, a.album_images_real',
427
			'FROM'			=> array($table_prefix . 'gallery_albums' => 'a'),
428
429
			'LEFT_JOIN'		=> array(
430
				array(
431
					'FROM'		=> array(USERS_TABLE => 'u'),
432
					'ON'		=> 'u.user_id = a.album_user_id',
433
				),
434
			),
435
436
			'WHERE'			=> 'a.album_user_id <> ' . (int) \phpbbgallery\core\block::PUBLIC_ALBUM . ' AND a.parent_id = 0',
437
		);
438
		$sql = $db->sql_build_query('SELECT', $sql_array);
439
		$result = $db->sql_query($sql);
440
		$personalrow = $personal_bad_row = array();
441
		while ($row = $db->sql_fetchrow($result))
442
		{
443
			$album = array(
444
				'user_id'		=> $row['album_user_id'],
445
				'album_id'		=> $row['album_id'],
446
				'album_name'	=> $row['album_name'],
447
				'images'		=> $row['album_images_real'],
448
			);
449
			if (!$row['user_id'])
450
			{
451
				$personalrow[$row['album_user_id']] = $album;
452
			}
453
			$personal_bad_row[$row['album_user_id']] = $album;
454
		}
455
		$db->sql_freeresult($result);
456
457
		$sql = 'SELECT ga.album_user_id, ga.album_images_real
458
			FROM ' . $table_prefix . 'gallery_albums ga
459
			WHERE ga.album_user_id <> ' . (int) \phpbbgallery\core\block::PUBLIC_ALBUM . '
460
				AND ga.parent_id <> 0';
461
		$result = $db->sql_query($sql);
462
		while ($row = $db->sql_fetchrow($result))
463
		{
464
			if (isset($personalrow[$row['album_user_id']]))
465
			{
466
				$personalrow[$row['album_user_id']]['images'] = $personalrow[$row['album_user_id']]['images'] + $row['album_images_real'];
467
			}
468
			$personal_bad_row[$row['album_user_id']]['images'] = $personal_bad_row[$row['album_user_id']]['images'] + $row['album_images_real'];
469
		}
470
		$db->sql_freeresult($result);
471
472
		foreach ($personalrow as $key => $row)
473
		{
474
			$template->assign_block_vars('personalrow', array(
475
				'USER_ID'		=> $row['user_id'],
476
				'ALBUM_ID'		=> $row['album_id'],
477
				'AUTHOR_NAME'	=> $row['album_name'],
478
			));
479
		}
480
		foreach ($personal_bad_row as $key => $row)
481
		{
482
			$template->assign_block_vars('personal_bad_row', array(
483
				'USER_ID'		=> $row['user_id'],
484
				'ALBUM_ID'		=> $row['album_id'],
485
				'AUTHOR_NAME'	=> $row['album_name'],
486
				'IMAGES'		=> $row['images'],
487
			));
488
		}
489
490
		$template->assign_vars(array(
491
			'S_GALLERY_MANAGE_RESTS'		=> true,
492
			'ACP_GALLERY_TITLE'				=> $user->lang['ACP_GALLERY_CLEANUP'],
493
			'ACP_GALLERY_TITLE_EXPLAIN'		=> $user->lang['ACP_GALLERY_CLEANUP_EXPLAIN'],
494
			'ACP_IMPORT_INSTALLED'	=> $acp_import_installed,
495
			'CHECK_SOURCE'			=> $this->u_action . '&amp;check_mode=source',
496
			'CHECK_ENTRY'			=> $this->u_action . '&amp;check_mode=entry',
497
498
			'U_FIND_USERNAME'		=> $gallery_url->append_sid('phpbb', 'memberlist', 'mode=searchuser&amp;form=acp_gallery&amp;field=prune_usernames'),
499
			'S_SELECT_ALBUM'		=> $gallery_album->get_albumbox(false, '', false, false, false, (int) \phpbbgallery\core\block::PUBLIC_ALBUM, (int) \phpbbgallery\core\block::TYPE_UPLOAD),
500
501
			'S_FOUNDER'				=> ($user->data['user_type'] == USER_FOUNDER) ? true : false,
0 ignored issues
show
Bug introduced by
The constant phpbbgallery\acpcleanup\acp\USER_FOUNDER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
502
		));
503
	}
504
}
505