|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* phpBB Gallery - Core Extension |
|
4
|
|
|
* |
|
5
|
|
|
* @package phpbbgallery/core |
|
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
|
|
|
* mostly borrowed from phpBB3 |
|
13
|
|
|
* @author: phpBB Group |
|
14
|
|
|
* @location: includes/acp/acp_forums.php |
|
15
|
|
|
* |
|
16
|
|
|
* Note: There are several code parts commented out, for example the album/forum_password. |
|
17
|
|
|
* I didn't remove them, to have it easier when I implement this feature one day. I hope it's okay. |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
namespace phpbbgallery\core\acp; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @package acp |
|
24
|
|
|
*/ |
|
25
|
|
|
class albums_module |
|
26
|
|
|
{ |
|
27
|
|
|
var $u_action; |
|
28
|
|
|
var $parent_id = 0; |
|
29
|
|
|
var $language; |
|
30
|
|
|
var $tpl_name; |
|
31
|
|
|
var $page_title; |
|
32
|
|
|
|
|
33
|
|
|
function main($id, $mode) |
|
|
|
|
|
|
34
|
|
|
{ |
|
35
|
|
|
global $auth, $cache, $config, $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_ext_gallery, $request; |
|
36
|
|
|
global $phpbb_dispatcher, $table_prefix, $table_name, $phpbb_container, $request, $moderators_table, $permissions_table, $roles_table, $users_table; |
|
37
|
|
|
$helper = $phpbb_container->get('controller.helper'); |
|
38
|
|
|
$pagination = $phpbb_container->get('pagination'); |
|
39
|
|
|
$this->language = $phpbb_container->get('language'); |
|
40
|
|
|
|
|
41
|
|
|
// Let us define some helpers; |
|
42
|
|
|
$albums_table = $table_prefix . 'gallery_albums'; |
|
43
|
|
|
$contests_table = $table_prefix . 'gallery_contests'; |
|
44
|
|
|
$tracking_table = $table_prefix . 'gallery_albums_tracking'; |
|
45
|
|
|
// Init ext gallery |
|
46
|
|
|
$this->language->add_lang(array('gallery_acp', 'gallery'), 'phpbbgallery/core'); |
|
47
|
|
|
|
|
48
|
|
|
$gallery_user = $phpbb_container->get('phpbbgallery.core.user'); |
|
49
|
|
|
$phpbb_ext_gallery_core_auth = $phpbb_container->get('phpbbgallery.core.auth'); |
|
50
|
|
|
$phpbb_ext_gallery_core_url = $phpbb_container->get('phpbbgallery.core.url'); |
|
51
|
|
|
|
|
52
|
|
|
// Init manage albums |
|
53
|
|
|
$manage_albums = $phpbb_container->get('phpbbgallery.core.album.manage'); |
|
54
|
|
|
$manage_albums->set_user($request->variable('user_id', 0)); |
|
55
|
|
|
$manage_albums->set_parent($request->variable('parent_id', 0)); |
|
56
|
|
|
$manage_albums->set_u_action($this->u_action); |
|
57
|
|
|
|
|
58
|
|
|
// Init album |
|
59
|
|
|
$phpbb_ext_gallery_core_album = $phpbb_container->get('phpbbgallery.core.album'); |
|
60
|
|
|
|
|
61
|
|
|
$phpbb_ext_gallery_core_album_display = $phpbb_container->get('phpbbgallery.core.album.display'); |
|
62
|
|
|
|
|
63
|
|
|
// Init contest |
|
64
|
|
|
$phpbb_gallery_contest = $phpbb_container->get('phpbbgallery.core.contest'); |
|
65
|
|
|
|
|
66
|
|
|
$this->tpl_name = 'gallery_albums'; |
|
67
|
|
|
$this->page_title = 'ACP_GALLERY_MANAGE_ALBUMS'; |
|
68
|
|
|
|
|
69
|
|
|
$form_key = 'acp_gallery_albums'; |
|
70
|
|
|
add_form_key($form_key); |
|
|
|
|
|
|
71
|
|
|
|
|
72
|
|
|
$action = $request->variable('action', ''); |
|
73
|
|
|
$update = (isset($_POST['update'])) ? true : false; |
|
74
|
|
|
$album_id = $request->variable('a', 0); |
|
75
|
|
|
|
|
76
|
|
|
$this->parent_id = $request->variable('parent_id', 0); |
|
77
|
|
|
$album_data = $errors = array(); |
|
78
|
|
|
if ($update && !check_form_key($form_key)) |
|
|
|
|
|
|
79
|
|
|
{ |
|
80
|
|
|
$update = false; |
|
81
|
|
|
$errors[] = $this->language->lang('FORM_INVALID'); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
// Major routines |
|
85
|
|
|
if ($update) |
|
86
|
|
|
{ |
|
87
|
|
|
switch ($action) |
|
88
|
|
|
{ |
|
89
|
|
|
case 'delete': |
|
90
|
|
|
$action_subalbums = $request->variable('action_subalbums', ''); |
|
91
|
|
|
$subalbums_to_id = $request->variable('subalbums_to_id', 0); |
|
92
|
|
|
$action_images = $request->variable('action_images', ''); |
|
93
|
|
|
$images_to_id = $request->variable('images_to_id', 0); |
|
94
|
|
|
|
|
95
|
|
|
$errors = $manage_albums->delete_album($album_id, $action_images, $action_subalbums, $images_to_id, $subalbums_to_id); |
|
96
|
|
|
|
|
97
|
|
|
if (sizeof($errors)) |
|
98
|
|
|
{ |
|
99
|
|
|
break; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
$cache->destroy('sql', $table_prefix . 'gallery_albums'); |
|
103
|
|
|
|
|
104
|
|
|
trigger_error($this->language->lang('ALBUM_DELETED') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); |
|
|
|
|
|
|
105
|
|
|
|
|
106
|
|
|
break; |
|
107
|
|
|
|
|
108
|
|
|
/** @noinspection PhpMissingBreakStatementInspection */ |
|
109
|
|
|
case 'edit': |
|
110
|
|
|
$album_data = array( |
|
111
|
|
|
'album_id' => $album_id |
|
112
|
|
|
); |
|
113
|
|
|
|
|
114
|
|
|
// No break; here |
|
115
|
|
|
|
|
116
|
|
|
case 'add': |
|
117
|
|
|
|
|
118
|
|
|
$album_data += array( |
|
119
|
|
|
'parent_id' => $request->variable('album_parent_id', $this->parent_id), |
|
120
|
|
|
'album_type' => $request->variable('album_type', (int) \phpbbgallery\core\block::TYPE_UPLOAD), |
|
121
|
|
|
'type_action' => $request->variable('type_action', ''), |
|
122
|
|
|
'album_status' => $request->variable('album_status', (int) \phpbbgallery\core\block::ALBUM_OPEN), |
|
123
|
|
|
'album_parents' => '', |
|
124
|
|
|
'album_name' => utf8_normalize_nfc($request->variable('album_name', '', true)), |
|
|
|
|
|
|
125
|
|
|
'album_desc' => utf8_normalize_nfc($request->variable('album_desc', '', true)), |
|
126
|
|
|
'album_desc_uid' => '', |
|
127
|
|
|
'album_desc_options' => 7, |
|
128
|
|
|
'album_desc_bitfield' => '', |
|
129
|
|
|
'album_image' => $request->variable('album_image', ''), |
|
130
|
|
|
'album_watermark' => $request->variable('album_watermark', false), |
|
131
|
|
|
'album_sort_key' => $request->variable('album_sort_key', ''), |
|
132
|
|
|
'album_sort_dir' => $request->variable('album_sort_dir', ''), |
|
133
|
|
|
'display_subalbum_list' => $request->variable('display_subalbum_list', false), |
|
134
|
|
|
'display_on_index' => $request->variable('display_on_index', false), |
|
135
|
|
|
'display_in_rrc' => $request->variable('display_in_rrc', false), |
|
136
|
|
|
/* |
|
137
|
|
|
'album_password' => $request->variable('album_password', '', true), |
|
138
|
|
|
'album_password_confirm'=> $request->variable('album_password_confirm', '', true), |
|
139
|
|
|
'album_password_unset' => $request->variable('album_password_unset', false), |
|
140
|
|
|
*/ |
|
141
|
|
|
); |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* Event to send requested data |
|
145
|
|
|
* @event phpbbgallery.core.acp.albums.request_data |
|
146
|
|
|
* @var string action Action we are taking |
|
147
|
|
|
* @var int album_id Album we are doing it to |
|
148
|
|
|
* @var array album_data Album data for the album |
|
149
|
|
|
* @since 1.2.0 |
|
150
|
|
|
*/ |
|
151
|
|
|
$vars = array('action', 'album_id', 'album_data'); |
|
152
|
|
|
extract($phpbb_dispatcher->trigger_event('phpbbgallery.core.acp.albums.request_data', compact($vars))); |
|
153
|
|
|
|
|
154
|
|
|
// Categories are not able to be locked... |
|
155
|
|
|
if ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT) |
|
156
|
|
|
{ |
|
157
|
|
|
$album_data['album_status'] = (int) \phpbbgallery\core\block::ALBUM_OPEN; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
// Contests need contest_data, freaky... :-O |
|
161
|
|
|
$contest_data = array( |
|
162
|
|
|
'contest_start' => $request->variable('contest_start', ''), |
|
163
|
|
|
'contest_rating' => $request->variable('contest_rating', ''), |
|
164
|
|
|
'contest_end' => $request->variable('contest_end', ''), |
|
165
|
|
|
); |
|
166
|
|
|
|
|
167
|
|
|
// Get data for album description if specified |
|
168
|
|
|
if ($album_data['album_desc']) |
|
169
|
|
|
{ |
|
170
|
|
|
generate_text_for_storage($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_bitfield'], $album_data['album_desc_options'], $request->variable('desc_parse_bbcode', false), $request->variable('desc_parse_urls', false), $request->variable('desc_parse_smilies', false)); |
|
|
|
|
|
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
$errors = $manage_albums->update_album_data($album_data, $contest_data); |
|
174
|
|
|
|
|
175
|
|
|
if (!sizeof($errors)) |
|
176
|
|
|
{ |
|
177
|
|
|
$album_perm_from = $request->variable('album_perm_from', 0); |
|
178
|
|
|
|
|
179
|
|
|
// Copy permissions? You do not need permissions for that in the gallery |
|
180
|
|
|
if ($album_perm_from && $album_perm_from != $album_data['album_id']) |
|
181
|
|
|
{ |
|
182
|
|
|
// If we edit a album delete current permissions first |
|
183
|
|
|
if ($action == 'edit') |
|
184
|
|
|
{ |
|
185
|
|
|
$sql = 'DELETE FROM ' . $table_prefix . 'gallery_permissions |
|
186
|
|
|
WHERE perm_album_id = ' . (int) $album_data['album_id']; |
|
187
|
|
|
$db->sql_query($sql); |
|
188
|
|
|
|
|
189
|
|
|
$sql = 'DELETE FROM ' . $table_prefix . 'gallery_modscache |
|
190
|
|
|
WHERE album_id = ' . (int) $album_data['album_id']; |
|
191
|
|
|
$db->sql_query($sql); |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
$sql = 'SELECT * |
|
195
|
|
|
FROM ' . $table_prefix . 'gallery_permissions |
|
196
|
|
|
WHERE perm_album_id = ' . (int) $album_perm_from; |
|
197
|
|
|
$result = $db->sql_query($sql); |
|
198
|
|
|
$perm_data = array(); |
|
199
|
|
|
while ($row = $db->sql_fetchrow($result)) |
|
200
|
|
|
{ |
|
201
|
|
|
$perm_data[] = array( |
|
202
|
|
|
'perm_role_id' => $row['perm_role_id'], |
|
203
|
|
|
'perm_album_id' => $album_data['album_id'], |
|
204
|
|
|
'perm_user_id' => $row['perm_user_id'], |
|
205
|
|
|
'perm_group_id' => $row['perm_group_id'], |
|
206
|
|
|
'perm_system' => $row['perm_system'], |
|
207
|
|
|
); |
|
208
|
|
|
} |
|
209
|
|
|
$db->sql_freeresult($result); |
|
210
|
|
|
|
|
211
|
|
|
$modscache_ary = array(); |
|
212
|
|
|
$sql = 'SELECT * FROM ' . $table_prefix . 'gallery_modscache |
|
213
|
|
|
WHERE album_id = ' . (int) $album_perm_from; |
|
214
|
|
|
$result = $db->sql_query($sql); |
|
215
|
|
|
while ($row = $db->sql_fetchrow($result)) |
|
216
|
|
|
{ |
|
217
|
|
|
$modscache_ary[] = array( |
|
218
|
|
|
'album_id' => $album_data['album_id'], |
|
219
|
|
|
'user_id' => $row['user_id'], |
|
220
|
|
|
'username' => $row['username'], |
|
221
|
|
|
'group_id' => $row['group_id'], |
|
222
|
|
|
'group_name' => $row['group_name'], |
|
223
|
|
|
'display_on_index' => $row['display_on_index'], |
|
224
|
|
|
); |
|
225
|
|
|
} |
|
226
|
|
|
$db->sql_freeresult($result); |
|
227
|
|
|
|
|
228
|
|
|
$db->sql_multi_insert($table_prefix . 'gallery_permissions', $perm_data); |
|
229
|
|
|
$db->sql_multi_insert($table_prefix . 'gallery_modscache', $modscache_ary); |
|
230
|
|
|
} |
|
231
|
|
|
|
|
232
|
|
|
$cache->destroy('sql', $table_prefix . 'gallery_albums'); |
|
233
|
|
|
$cache->destroy('sql', $table_prefix . 'gallery_modscache'); |
|
234
|
|
|
$cache->destroy('sql', $table_prefix . 'gallery_permissions'); |
|
235
|
|
|
$cache->destroy('_albums'); |
|
236
|
|
|
$phpbb_ext_gallery_core_auth->set_user_permissions('all', ''); |
|
237
|
|
|
|
|
238
|
|
|
$acl_url = '&mode=manage&action=v_mask&album_id[]=' . $album_data['album_id']; |
|
239
|
|
|
|
|
240
|
|
|
$message = ($action == 'add') ? $this->language->lang('ALBUM_CREATED') : $this->language->lang('ALBUM_UPDATED'); |
|
241
|
|
|
$message .= '<br /><br />' . sprintf($this->language->lang('REDIRECT_ACL'), '<a href="' . $phpbb_ext_gallery_core_url->append_sid('admin' , 'index', 'i=-phpbbgallery-core-acp-permissions_module' . $acl_url) . '">', '</a>'); |
|
242
|
|
|
|
|
243
|
|
|
// Redirect directly to permission settings screen |
|
244
|
|
|
if ($action == 'add' && !$album_perm_from) |
|
245
|
|
|
{ |
|
246
|
|
|
meta_refresh(5, $phpbb_ext_gallery_core_url->append_sid('admin' , 'index', 'i=-phpbbgallery-core-acp-permissions_module' . $acl_url)); |
|
|
|
|
|
|
247
|
|
|
} |
|
248
|
|
|
|
|
249
|
|
|
trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); |
|
250
|
|
|
} |
|
251
|
|
|
|
|
252
|
|
|
break; |
|
253
|
|
|
} |
|
254
|
|
|
} |
|
255
|
|
|
|
|
256
|
|
|
switch ($action) |
|
257
|
|
|
{ |
|
258
|
|
|
case 'move_up': |
|
259
|
|
|
case 'move_down': |
|
260
|
|
|
|
|
261
|
|
|
if (!$album_id) |
|
262
|
|
|
{ |
|
263
|
|
|
trigger_error($this->language->lang('NO_ALBUM') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
$sql = 'SELECT * |
|
267
|
|
|
FROM ' . $table_prefix . 'gallery_albums |
|
268
|
|
|
WHERE album_id = ' . (int) $album_id; |
|
269
|
|
|
$result = $db->sql_query($sql); |
|
270
|
|
|
$row = $db->sql_fetchrow($result); |
|
271
|
|
|
$db->sql_freeresult($result); |
|
272
|
|
|
|
|
273
|
|
|
if (!$row) |
|
274
|
|
|
{ |
|
275
|
|
|
trigger_error($this->language->lang('NO_ALBUM') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
276
|
|
|
} |
|
277
|
|
|
|
|
278
|
|
|
$move_album_name = $manage_albums->move_album_by($row, $action, 1); |
|
279
|
|
|
|
|
280
|
|
|
if ($move_album_name !== false) |
|
281
|
|
|
{ |
|
282
|
|
|
$log = $phpbb_container->get('phpbbgallery.core.log'); |
|
283
|
|
|
$log->add_log('admin', 'move', $row['album_id'], 0, array('LOG_ALBUM_' . strtoupper($action), $row['album_name'], $move_album_name)); |
|
284
|
|
|
$cache->destroy('sql', $table_prefix . 'gallery_albums'); |
|
285
|
|
|
} |
|
286
|
|
|
|
|
287
|
|
|
break; |
|
288
|
|
|
|
|
289
|
|
|
case 'sync': |
|
290
|
|
|
case 'sync_album': |
|
291
|
|
|
if (!$album_id) |
|
292
|
|
|
{ |
|
293
|
|
|
trigger_error($this->language->lang('NO_ALBUM') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
294
|
|
|
} |
|
295
|
|
|
|
|
296
|
|
|
$sql = 'SELECT album_name, album_type |
|
297
|
|
|
FROM ' . $table_prefix . 'gallery_albums |
|
298
|
|
|
WHERE album_id = ' . (int) $album_id; |
|
299
|
|
|
$result = $db->sql_query($sql); |
|
300
|
|
|
$row = $db->sql_fetchrow($result); |
|
301
|
|
|
$db->sql_freeresult($result); |
|
302
|
|
|
|
|
303
|
|
|
if (!$row) |
|
304
|
|
|
{ |
|
305
|
|
|
trigger_error($this->language->lang('NO_ALBUM') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
306
|
|
|
} |
|
307
|
|
|
|
|
308
|
|
|
$phpbb_ext_gallery_core_album->update_info($album_id); |
|
309
|
|
|
|
|
310
|
|
|
$log = $phpbb_container->get('phpbbgallery.core.log'); |
|
311
|
|
|
$log->add_log('admin', 'resync', $album_id, 0, array('LOG_ALBUM_SYNC', $row['album_name'])); |
|
312
|
|
|
|
|
313
|
|
|
$template->assign_var('L_ALBUM_RESYNCED', sprintf($this->language->lang('ALBUM_RESYNCED'), $row['album_name'])); |
|
314
|
|
|
|
|
315
|
|
|
break; |
|
316
|
|
|
|
|
317
|
|
|
case 'add': |
|
318
|
|
|
case 'edit': |
|
319
|
|
|
|
|
320
|
|
|
// Show form to create/modify a album |
|
321
|
|
|
if ($action == 'edit') |
|
322
|
|
|
{ |
|
323
|
|
|
$this->page_title = 'EDIT_ALBUM'; |
|
324
|
|
|
$row = $phpbb_ext_gallery_core_album->get_info($album_id); |
|
325
|
|
|
$old_album_type = $row['album_type']; |
|
326
|
|
|
|
|
327
|
|
|
if (!$update) |
|
328
|
|
|
{ |
|
329
|
|
|
$album_data = $row; |
|
330
|
|
|
} |
|
331
|
|
|
else |
|
332
|
|
|
{ |
|
333
|
|
|
$album_data['left_id'] = $row['left_id']; |
|
334
|
|
|
$album_data['right_id'] = $row['right_id']; |
|
335
|
|
|
} |
|
336
|
|
|
if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST) |
|
337
|
|
|
{ |
|
338
|
|
|
$contest_data = $phpbb_gallery_contest->get_contest($album_id, 'album'); |
|
339
|
|
|
} |
|
340
|
|
|
else |
|
341
|
|
|
{ |
|
342
|
|
|
// Default values, 3 days later rate and 7 for the end of the contest |
|
343
|
|
|
$contest_data = array( |
|
344
|
|
|
'contest_start' => time(), |
|
345
|
|
|
'contest_rating' => 3 * 86400, |
|
346
|
|
|
'contest_end' => 7 * 86400, |
|
347
|
|
|
); |
|
348
|
|
|
} |
|
349
|
|
|
|
|
350
|
|
|
// Make sure no direct child albums are able to be selected as parents. |
|
351
|
|
|
$exclude_albums = array(); |
|
352
|
|
|
foreach ($phpbb_ext_gallery_core_album_display->get_branch((int) \phpbbgallery\core\block::PUBLIC_ALBUM, $album_id, 'children') as $row) |
|
353
|
|
|
{ |
|
354
|
|
|
$exclude_albums[] = $row['album_id']; |
|
355
|
|
|
} |
|
356
|
|
|
|
|
357
|
|
|
$parents_list = $phpbb_ext_gallery_core_album->get_albumbox(true, '', $album_data['parent_id'], false, $exclude_albums); |
|
358
|
|
|
|
|
359
|
|
|
/* |
|
360
|
|
|
$album_data['album_password_confirm'] = $album_data['album_password']; |
|
361
|
|
|
*/ |
|
362
|
|
|
} |
|
363
|
|
|
else |
|
364
|
|
|
{ |
|
365
|
|
|
$this->page_title = 'CREATE_ALBUM'; |
|
366
|
|
|
|
|
367
|
|
|
$album_id = $this->parent_id; |
|
368
|
|
|
$parents_list = $phpbb_ext_gallery_core_album->get_albumbox(true, '', $this->parent_id); |
|
369
|
|
|
|
|
370
|
|
|
// Fill album data with default values |
|
371
|
|
|
if (!$update) |
|
372
|
|
|
{ |
|
373
|
|
|
$album_data = array( |
|
374
|
|
|
'parent_id' => $this->parent_id, |
|
375
|
|
|
'album_type' => (int) \phpbbgallery\core\block::TYPE_UPLOAD, |
|
376
|
|
|
'album_status' => (int) \phpbbgallery\core\block::ALBUM_OPEN, |
|
377
|
|
|
'album_name' => utf8_normalize_nfc($request->variable('album_name', '', true)), |
|
378
|
|
|
'album_desc' => '', |
|
379
|
|
|
'album_image' => '', |
|
380
|
|
|
'album_watermark' => true, |
|
381
|
|
|
'album_sort_key' => '', |
|
382
|
|
|
'album_sort_dir' => '', |
|
383
|
|
|
'display_subalbum_list' => true, |
|
384
|
|
|
'display_on_index' => true, |
|
385
|
|
|
'display_in_rrc' => true, |
|
386
|
|
|
/* |
|
387
|
|
|
'album_password' => '', |
|
388
|
|
|
'album_password_confirm'=> '', |
|
389
|
|
|
*/ |
|
390
|
|
|
); |
|
391
|
|
|
|
|
392
|
|
|
/** |
|
393
|
|
|
* Event to send default data |
|
394
|
|
|
* |
|
395
|
|
|
* @event phpbbgallery.core.acp.albums.default_data |
|
396
|
|
|
* @var action action Action taken |
|
397
|
|
|
* @var array album_data Album data array |
|
398
|
|
|
* @since 1.2.0 |
|
399
|
|
|
*/ |
|
400
|
|
|
$vars = array('action', 'album_data'); |
|
401
|
|
|
extract($phpbb_dispatcher->trigger_event('phpbbgallery.core.acp.albums.default_data', compact($vars))); |
|
402
|
|
|
|
|
403
|
|
|
// Default values, 3 days later rate and 7 for the end of the contest |
|
404
|
|
|
$contest_data = array( |
|
405
|
|
|
'contest_start' => time(), |
|
406
|
|
|
'contest_rating' => 3 * 86400, |
|
407
|
|
|
'contest_end' => 7 * 86400, |
|
408
|
|
|
); |
|
409
|
|
|
} |
|
410
|
|
|
} |
|
411
|
|
|
|
|
412
|
|
|
$album_desc_data = array( |
|
413
|
|
|
'text' => $album_data['album_desc'], |
|
414
|
|
|
'allow_bbcode' => true, |
|
415
|
|
|
'allow_smilies' => true, |
|
416
|
|
|
'allow_urls' => true |
|
417
|
|
|
); |
|
418
|
|
|
|
|
419
|
|
|
// Parse description if specified |
|
420
|
|
|
if ($album_data['album_desc']) |
|
421
|
|
|
{ |
|
422
|
|
|
if (!isset($album_data['album_desc_uid'])) |
|
423
|
|
|
{ |
|
424
|
|
|
// Before we are able to display the preview and plane text, we need to parse our request_var()'d value... |
|
425
|
|
|
$album_data['album_desc_uid'] = ''; |
|
426
|
|
|
$album_data['album_desc_bitfield'] = ''; |
|
427
|
|
|
$album_data['album_desc_options'] = 0; |
|
428
|
|
|
|
|
429
|
|
|
generate_text_for_storage($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_bitfield'], $album_data['album_desc_options'], $request->variable('desc_allow_bbcode', false), $request->variable('desc_allow_urls', false), $request->variable('desc_allow_smilies', false)); |
|
430
|
|
|
} |
|
431
|
|
|
|
|
432
|
|
|
// decode... |
|
433
|
|
|
$album_desc_data = generate_text_for_edit($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_options']); |
|
|
|
|
|
|
434
|
|
|
} |
|
435
|
|
|
|
|
436
|
|
|
$album_type_options = ''; |
|
437
|
|
|
$album_type_ary = array((int) \phpbbgallery\core\block::TYPE_CAT => 'CAT', (int) \phpbbgallery\core\block::TYPE_UPLOAD => 'UPLOAD', (int) \phpbbgallery\core\block::TYPE_CONTEST => 'CONTEST'); |
|
438
|
|
|
|
|
439
|
|
|
foreach ($album_type_ary as $value => $lang) |
|
440
|
|
|
{ |
|
441
|
|
|
$album_type_options .= '<option value="' . $value . '"' . (($value == $album_data['album_type']) ? ' selected="selected"' : '') . '>' . $user->lang['ALBUM_TYPE_' . $lang] . '</option>'; |
|
442
|
|
|
} |
|
443
|
|
|
|
|
444
|
|
|
$album_sort_key_options = ''; |
|
445
|
|
|
$album_sort_key_options .= '<option' . ((!in_array($album_data['album_sort_key'], array('t', 'n', 'vc', 'u', 'ra', 'r', 'c', 'lc'))) ? ' selected="selected"' : '') . " value=''>" . $this->language->lang('SORT_DEFAULT') . '</option>'; |
|
446
|
|
|
$album_sort_key_options .= '<option' . (($album_data['album_sort_key'] == 't') ? ' selected="selected"' : '') . " value='t'>" . $this->language->lang('TIME') . '</option>'; |
|
447
|
|
|
$album_sort_key_options .= '<option' . (($album_data['album_sort_key'] == 'n') ? ' selected="selected"' : '') . " value='n'>" . $this->language->lang('IMAGE_NAME') . '</option>'; |
|
448
|
|
|
$album_sort_key_options .= '<option' . (($album_data['album_sort_key'] == 'vc') ? ' selected="selected"' : '') . " value='vc'>" . $this->language->lang('GALLERY_VIEWS') . '</option>'; |
|
449
|
|
|
$album_sort_key_options .= '<option' . (($album_data['album_sort_key'] == 'u') ? ' selected="selected"' : '') . " value='u'>" . $this->language->lang('USERNAME') . '</option>'; |
|
450
|
|
|
$album_sort_key_options .= '<option' . (($album_data['album_sort_key'] == 'ra') ? ' selected="selected"' : '') . " value='ra'>" . $this->language->lang('RATING') . '</option>'; |
|
451
|
|
|
$album_sort_key_options .= '<option' . (($album_data['album_sort_key'] == 'r') ? ' selected="selected"' : '') . " value='r'>" . $this->language->lang('RATES_COUNT') . '</option>'; |
|
452
|
|
|
$album_sort_key_options .= '<option' . (($album_data['album_sort_key'] == 'c') ? ' selected="selected"' : '') . " value='c'>" . $this->language->lang('COMMENTS') . '</option>'; |
|
453
|
|
|
$album_sort_key_options .= '<option' . (($album_data['album_sort_key'] == 'lc') ? ' selected="selected"' : '') . " value='lc'>" . $this->language->lang('NEW_COMMENT') . '</option>'; |
|
454
|
|
|
|
|
455
|
|
|
$album_sort_dir_options = ''; |
|
456
|
|
|
$album_sort_dir_options .= '<option' . ((($album_data['album_sort_dir'] != 'd') && ($album_data['album_sort_dir'] != 'a')) ? ' selected="selected"' : '') . " value=''>" . $this->language->lang('SORT_DEFAULT') . '</option>'; |
|
457
|
|
|
$album_sort_dir_options .= '<option' . (($album_data['album_sort_dir'] == 'd') ? ' selected="selected"' : '') . " value='d'>" . $this->language->lang('SORT_DESCENDING') . '</option>'; |
|
458
|
|
|
$album_sort_dir_options .= '<option' . (($album_data['album_sort_dir'] == 'a') ? ' selected="selected"' : '') . " value='a'>" . $this->language->lang('SORT_ASCENDING') . '</option>'; |
|
459
|
|
|
|
|
460
|
|
|
$statuslist = '<option value="' . (int) \phpbbgallery\core\block::ALBUM_OPEN . '"' . (($album_data['album_status'] == (int) \phpbbgallery\core\block::ALBUM_OPEN) ? ' selected="selected"' : '') . '>' . $user->lang['UNLOCKED'] . '</option><option value="' . (int) \phpbbgallery\core\block::ALBUM_LOCKED . '"' . (($album_data['album_status'] == (int) \phpbbgallery\core\block::ALBUM_LOCKED) ? ' selected="selected"' : '') . '>' . $user->lang['LOCKED'] . '</option>'; |
|
461
|
|
|
|
|
462
|
|
|
$sql = 'SELECT album_id |
|
463
|
|
|
FROM ' . $table_prefix . 'gallery_albums |
|
464
|
|
|
WHERE album_type = ' . (int) \phpbbgallery\core\block::TYPE_UPLOAD . ' |
|
465
|
|
|
AND album_user_id = ' . (int) \phpbbgallery\core\block::PUBLIC_ALBUM . ' |
|
466
|
|
|
AND album_id <> ' . (int) $album_id; |
|
467
|
|
|
$result = $db->sql_query_limit($sql, 1); |
|
468
|
|
|
|
|
469
|
|
|
$uploadable_album_exists = false; |
|
470
|
|
|
if ($db->sql_fetchrow($result)) |
|
471
|
|
|
{ |
|
472
|
|
|
$uploadable_album_exists = true; |
|
473
|
|
|
} |
|
474
|
|
|
$db->sql_freeresult($result); |
|
475
|
|
|
|
|
476
|
|
|
// Subalbum move options |
|
477
|
|
|
if ($action == 'edit' && in_array($album_data['album_type'], array((int) \phpbbgallery\core\block::TYPE_UPLOAD, (int) \phpbbgallery\core\block::TYPE_CONTEST))) |
|
478
|
|
|
{ |
|
479
|
|
|
$subalbums_id = array(); |
|
480
|
|
|
$subalbums = $phpbb_ext_gallery_core_album_display->get_branch((int) \phpbbgallery\core\block::PUBLIC_ALBUM, $album_id, 'children'); |
|
481
|
|
|
|
|
482
|
|
|
foreach ($subalbums as $row) |
|
483
|
|
|
{ |
|
484
|
|
|
$subalbums_id[] = $row['album_id']; |
|
485
|
|
|
} |
|
486
|
|
|
|
|
487
|
|
|
$albums_list = $phpbb_ext_gallery_core_album->get_albumbox(true, '', $album_data['parent_id'], false, $subalbums_id); |
|
488
|
|
|
|
|
489
|
|
|
if ($uploadable_album_exists) |
|
490
|
|
|
{ |
|
491
|
|
|
$template->assign_vars(array( |
|
492
|
|
|
'S_MOVE_ALBUM_OPTIONS' => $phpbb_ext_gallery_core_album->get_albumbox(true, '', $album_data['parent_id'], false, $subalbums_id, (int) \phpbbgallery\core\block::PUBLIC_ALBUM, (int) \phpbbgallery\core\block::TYPE_UPLOAD), |
|
493
|
|
|
)); |
|
494
|
|
|
} |
|
495
|
|
|
|
|
496
|
|
|
$template->assign_vars(array( |
|
497
|
|
|
'S_HAS_SUBALBUMS' => ($album_data['right_id'] - $album_data['left_id'] > 1) ? true : false, |
|
498
|
|
|
'S_ALBUMS_LIST' => $albums_list, |
|
499
|
|
|
)); |
|
500
|
|
|
} |
|
501
|
|
|
else if ($uploadable_album_exists) |
|
502
|
|
|
{ |
|
503
|
|
|
$template->assign_vars(array( |
|
504
|
|
|
'S_MOVE_ALBUM_OPTIONS' => $phpbb_ext_gallery_core_album->get_albumbox(true, '', $album_data['parent_id'], false, $album_id, 0, (int) \phpbbgallery\core\block::TYPE_UPLOAD), |
|
505
|
|
|
)); |
|
506
|
|
|
} |
|
507
|
|
|
|
|
508
|
|
|
/* |
|
509
|
|
|
if (strlen($album_data['album_password']) == 32) |
|
510
|
|
|
{ |
|
511
|
|
|
$errors[] = $user->lang['ALBUM_PASSWORD_OLD']; |
|
512
|
|
|
} |
|
513
|
|
|
*/ |
|
514
|
|
|
|
|
515
|
|
|
$template->assign_vars(array( |
|
516
|
|
|
'S_EDIT_ALBUM' => true, |
|
517
|
|
|
'S_ERROR' => (sizeof($errors)) ? true : false, |
|
518
|
|
|
'S_PARENT_ID' => $this->parent_id, |
|
519
|
|
|
'S_ALBUM_PARENT_ID' => $album_data['parent_id'], |
|
520
|
|
|
'S_ADD_ACTION' => ($action == 'add') ? true : false, |
|
521
|
|
|
|
|
522
|
|
|
'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id, |
|
523
|
|
|
'U_EDIT_ACTION' => $this->u_action . "&parent_id={$this->parent_id}&action=$action&a=$album_id", |
|
524
|
|
|
|
|
525
|
|
|
'L_COPY_PERMISSIONS_EXPLAIN' => $user->lang['COPY_PERMISSIONS_' . strtoupper($action) . '_EXPLAIN'], |
|
526
|
|
|
'L_TITLE' => $user->lang[$this->page_title], |
|
527
|
|
|
'ERROR_MSG' => (sizeof($errors)) ? implode('<br />', $errors) : '', |
|
528
|
|
|
|
|
529
|
|
|
'ALBUM_NAME' => $album_data['album_name'], |
|
530
|
|
|
'ALBUM_IMAGE' => $album_data['album_image'], |
|
531
|
|
|
'ALBUM_IMAGE_SRC' => ($album_data['album_image']) ? $phpbb_ext_gallery_core_url->path('phpbb') . $album_data['album_image'] : '', |
|
532
|
|
|
/* |
|
533
|
|
|
'S_ALBUM_PASSWORD_SET' => (empty($album_data['album_password'])) ? false : true, |
|
534
|
|
|
*/ |
|
535
|
|
|
|
|
536
|
|
|
'ALBUM_DESC' => $album_desc_data['text'], |
|
537
|
|
|
'S_DESC_BBCODE_CHECKED' => ($album_desc_data['allow_bbcode']) ? true : false, |
|
538
|
|
|
'S_DESC_SMILIES_CHECKED' => ($album_desc_data['allow_smilies']) ? true : false, |
|
539
|
|
|
'S_DESC_URLS_CHECKED' => ($album_desc_data['allow_urls']) ? true : false, |
|
540
|
|
|
|
|
541
|
|
|
'S_ALBUM_TYPE_OPTIONS' => $album_type_options, |
|
542
|
|
|
'S_STATUS_OPTIONS' => $statuslist, |
|
543
|
|
|
'S_PARENT_OPTIONS' => $parents_list, |
|
544
|
|
|
'S_ALBUM_OPTIONS' => $phpbb_ext_gallery_core_album->get_albumbox(true, '', ($action == 'add') ? $album_data['parent_id'] : false, false, ($action == 'edit') ? $album_data['album_id'] : false), |
|
545
|
|
|
|
|
546
|
|
|
'S_ALBUM_ORIG_UPLOAD' => (isset($old_album_type) && $old_album_type == (int) \phpbbgallery\core\block::TYPE_UPLOAD) ? true : false, |
|
547
|
|
|
'S_ALBUM_ORIG_CAT' => (isset($old_album_type) && $old_album_type == (int) \phpbbgallery\core\block::TYPE_CAT) ? true : false, |
|
548
|
|
|
'S_ALBUM_ORIG_CONTEST' => (isset($old_album_type) && $old_album_type == (int) \phpbbgallery\core\block::TYPE_CONTEST) ? true : false, |
|
549
|
|
|
'S_ALBUM_UPLOAD' => ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_UPLOAD) ? true : false, |
|
550
|
|
|
'S_ALBUM_CAT' => ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT) ? true : false, |
|
551
|
|
|
'S_ALBUM_CONTEST' => ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST) ? true : false, |
|
552
|
|
|
'ALBUM_UPLOAD' => (int) \phpbbgallery\core\block::TYPE_UPLOAD, |
|
553
|
|
|
'ALBUM_CAT' => (int) \phpbbgallery\core\block::TYPE_CAT, |
|
554
|
|
|
'ALBUM_CONTEST' => (int) \phpbbgallery\core\block::TYPE_CONTEST, |
|
555
|
|
|
'S_CAN_COPY_PERMISSIONS' => true, |
|
556
|
|
|
|
|
557
|
|
|
'S_ALBUM_WATERMARK' => ($album_data['album_watermark']) ? true : false, |
|
558
|
|
|
'ALBUM_SORT_KEY_OPTIONS' => $album_sort_key_options, |
|
559
|
|
|
'ALBUM_SORT_DIR_OPTIONS' => $album_sort_dir_options, |
|
560
|
|
|
'S_DISPLAY_SUBALBUM_LIST' => ($album_data['display_subalbum_list']) ? true : false, |
|
561
|
|
|
'S_DISPLAY_ON_INDEX' => ($album_data['display_on_index']) ? true : false, |
|
562
|
|
|
'S_DISPLAY_IN_RRC' => ($album_data['display_in_rrc']) ? true : false, |
|
563
|
|
|
|
|
564
|
|
|
'S_CONTEST_START' => $user->format_date($contest_data['contest_start'], 'Y-m-d H:i'), |
|
565
|
|
|
'CONTEST_RATING' => $user->format_date($contest_data['contest_start'] + $contest_data['contest_rating'], 'Y-m-d H:i'), |
|
566
|
|
|
'CONTEST_END' => $user->format_date($contest_data['contest_start'] + $contest_data['contest_end'], 'Y-m-d H:i'), |
|
567
|
|
|
)); |
|
568
|
|
|
|
|
569
|
|
|
/** |
|
570
|
|
|
* Event after assigning data to template |
|
571
|
|
|
* |
|
572
|
|
|
* @event phpbbgallery.core.acp.albums.send_to_template |
|
573
|
|
|
* @var action action Action taken |
|
574
|
|
|
* @var array album_data Album data array |
|
575
|
|
|
* @since 1.2.0 |
|
576
|
|
|
*/ |
|
577
|
|
|
$vars = array('action', 'album_data'); |
|
578
|
|
|
extract($phpbb_dispatcher->trigger_event('phpbbgallery.core.acp.albums.send_to_template', compact($vars))); |
|
579
|
|
|
|
|
580
|
|
|
return; |
|
581
|
|
|
|
|
582
|
|
|
break; |
|
|
|
|
|
|
583
|
|
|
|
|
584
|
|
|
case 'delete': |
|
585
|
|
|
|
|
586
|
|
|
if (!$album_id) |
|
587
|
|
|
{ |
|
588
|
|
|
trigger_error($user->lang['NO_ALBUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
589
|
|
|
} |
|
590
|
|
|
|
|
591
|
|
|
$album_data = $phpbb_ext_gallery_core_album->get_info($album_id); |
|
592
|
|
|
|
|
593
|
|
|
$subalbums_id = array(); |
|
594
|
|
|
$subalbums = $phpbb_ext_gallery_core_album_display->get_branch((int) \phpbbgallery\core\block::PUBLIC_ALBUM, $album_id, 'children'); |
|
595
|
|
|
|
|
596
|
|
|
foreach ($subalbums as $row) |
|
597
|
|
|
{ |
|
598
|
|
|
$subalbums_id[] = $row['album_id']; |
|
599
|
|
|
} |
|
600
|
|
|
|
|
601
|
|
|
$albums_list = $phpbb_ext_gallery_core_album->get_albumbox(true, '', $album_data['parent_id'], false, $subalbums_id); |
|
602
|
|
|
|
|
603
|
|
|
$sql = 'SELECT album_id |
|
604
|
|
|
FROM ' . $table_prefix . 'gallery_albums |
|
605
|
|
|
WHERE album_type = ' . (int) \phpbbgallery\core\block::TYPE_UPLOAD . ' |
|
606
|
|
|
AND album_id <> ' . (int) $album_id . ' |
|
607
|
|
|
AND album_user_id = ' . (int) \phpbbgallery\core\block::PUBLIC_ALBUM; |
|
608
|
|
|
$result = $db->sql_query_limit($sql, 1); |
|
609
|
|
|
|
|
610
|
|
|
if ($db->sql_fetchrow($result)) |
|
611
|
|
|
{ |
|
612
|
|
|
$template->assign_vars(array( |
|
613
|
|
|
'S_MOVE_ALBUM_OPTIONS' => $phpbb_ext_gallery_core_album->get_albumbox(true, '', $album_data['parent_id'], false, $subalbums_id, (int) \phpbbgallery\core\block::PUBLIC_ALBUM, (int) \phpbbgallery\core\block::TYPE_UPLOAD), |
|
614
|
|
|
)); |
|
615
|
|
|
} |
|
616
|
|
|
$db->sql_freeresult($result); |
|
617
|
|
|
|
|
618
|
|
|
$parent_id = ($this->parent_id == $album_id) ? 0 : $this->parent_id; |
|
619
|
|
|
$template->assign_vars(array( |
|
620
|
|
|
'S_DELETE_ALBUM' => true, |
|
621
|
|
|
'U_ACTION' => $this->u_action . "&parent_id={$parent_id}&action=delete&a=" . $album_id, |
|
622
|
|
|
'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id, |
|
623
|
|
|
|
|
624
|
|
|
'ALBUM_NAME' => $album_data['album_name'], |
|
625
|
|
|
'S_ALBUM_POST' => (in_array($album_data['album_type'], array((int) \phpbbgallery\core\block::TYPE_UPLOAD, (int) \phpbbgallery\core\block::TYPE_CONTEST))) ? true : false, |
|
626
|
|
|
'S_HAS_SUBALBUMS' => ($album_data['right_id'] - $album_data['left_id'] > 1) ? true : false, |
|
627
|
|
|
'S_ALBUMS_LIST' => $albums_list, |
|
628
|
|
|
|
|
629
|
|
|
'S_ERROR' => (sizeof($errors)) ? true : false, |
|
630
|
|
|
'ERROR_MSG' => (sizeof($errors)) ? implode('<br />', $errors) : '', |
|
631
|
|
|
)); |
|
632
|
|
|
|
|
633
|
|
|
return; |
|
634
|
|
|
break; |
|
635
|
|
|
} |
|
636
|
|
|
|
|
637
|
|
|
// Default management page |
|
638
|
|
|
if (!$this->parent_id) |
|
639
|
|
|
{ |
|
640
|
|
|
$navigation = $user->lang['GALLERY_INDEX']; |
|
641
|
|
|
} |
|
642
|
|
|
else |
|
643
|
|
|
{ |
|
644
|
|
|
$navigation = '<a href="' . $this->u_action . '">' . $user->lang['GALLERY_INDEX'] . '</a>'; |
|
645
|
|
|
|
|
646
|
|
|
$albums_nav = $phpbb_ext_gallery_core_album_display->get_branch((int) \phpbbgallery\core\block::PUBLIC_ALBUM, $this->parent_id, 'parents', 'descending'); |
|
647
|
|
|
foreach ($albums_nav as $row) |
|
648
|
|
|
{ |
|
649
|
|
|
if ($row['album_id'] == $this->parent_id) |
|
650
|
|
|
{ |
|
651
|
|
|
$navigation .= ' -> ' . $row['album_name']; |
|
652
|
|
|
} |
|
653
|
|
|
else |
|
654
|
|
|
{ |
|
655
|
|
|
$navigation .= ' -> <a href="' . $this->u_action . '&parent_id=' . $row['album_id'] . '">' . $row['album_name'] . '</a>'; |
|
656
|
|
|
} |
|
657
|
|
|
} |
|
658
|
|
|
} |
|
659
|
|
|
|
|
660
|
|
|
// Jumpbox |
|
661
|
|
|
$album_box = $phpbb_ext_gallery_core_album->get_albumbox(true, '', $this->parent_id, false, false); |
|
662
|
|
|
|
|
663
|
|
|
if ($action == 'sync' || $action == 'sync_album') |
|
664
|
|
|
{ |
|
665
|
|
|
$template->assign_var('S_RESYNCED', true); |
|
666
|
|
|
} |
|
667
|
|
|
|
|
668
|
|
|
$sql = 'SELECT * |
|
669
|
|
|
FROM ' . $table_prefix . "gallery_albums |
|
670
|
|
|
WHERE parent_id = {$this->parent_id} |
|
671
|
|
|
AND album_user_id = " . (int) \phpbbgallery\core\block::PUBLIC_ALBUM . ' |
|
672
|
|
|
ORDER BY left_id'; |
|
673
|
|
|
$result = $db->sql_query($sql); |
|
674
|
|
|
|
|
675
|
|
|
if ($row = $db->sql_fetchrow($result)) |
|
676
|
|
|
{ |
|
677
|
|
|
do |
|
678
|
|
|
{ |
|
679
|
|
|
$album_type = $row['album_type']; |
|
680
|
|
|
|
|
681
|
|
|
if ($row['album_status'] == (int) \phpbbgallery\core\block::ALBUM_LOCKED) |
|
682
|
|
|
{ |
|
683
|
|
|
$folder_image = '<img src="images/icon_folder_lock.gif" alt="' . $user->lang['LOCKED'] . '" />'; |
|
684
|
|
|
} |
|
685
|
|
|
else |
|
686
|
|
|
{ |
|
687
|
|
|
$folder_image = ($row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" alt="' . $user->lang['SUBALBUM'] . '" />' : '<img src="images/icon_folder.gif" alt="' . $user->lang['FOLDER'] . '" />'; |
|
688
|
|
|
} |
|
689
|
|
|
|
|
690
|
|
|
$url = $this->u_action . "&parent_id=$this->parent_id&a={$row['album_id']}"; |
|
691
|
|
|
|
|
692
|
|
|
$template->assign_block_vars('albums', array( |
|
693
|
|
|
'FOLDER_IMAGE' => $folder_image, |
|
694
|
|
|
'ALBUM_IMAGE' => ($row['album_image']) ? '<img src="' . $phpbb_ext_gallery_core_url->path('phpbb') . $row['album_image'] . '" alt="" />' : '', |
|
695
|
|
|
'ALBUM_IMAGE_SRC' => ($row['album_image']) ? $phpbb_ext_gallery_core_url->path('phpbb') . $row['album_image'] : '', |
|
696
|
|
|
'ALBUM_NAME' => $row['album_name'], |
|
697
|
|
|
'ALBUM_DESCRIPTION' => generate_text_for_display($row['album_desc'], $row['album_desc_uid'], $row['album_desc_bitfield'], $row['album_desc_options']), |
|
|
|
|
|
|
698
|
|
|
'ALBUM_IMAGES' => $row['album_images'], |
|
699
|
|
|
|
|
700
|
|
|
'S_ALBUM_POST' => ($album_type != (int) \phpbbgallery\core\block::TYPE_CAT) ? true : false, |
|
701
|
|
|
|
|
702
|
|
|
'U_ALBUM' => $this->u_action . '&parent_id=' . $row['album_id'], |
|
703
|
|
|
'U_MOVE_UP' => $url . '&action=move_up', |
|
704
|
|
|
'U_MOVE_DOWN' => $url . '&action=move_down', |
|
705
|
|
|
'U_EDIT' => $url . '&action=edit', |
|
706
|
|
|
'U_DELETE' => $url . '&action=delete', |
|
707
|
|
|
'U_SYNC' => $url . '&action=sync') |
|
708
|
|
|
); |
|
709
|
|
|
} |
|
710
|
|
|
while ($row = $db->sql_fetchrow($result)); |
|
711
|
|
|
} |
|
712
|
|
|
else if ($this->parent_id) |
|
713
|
|
|
{ |
|
714
|
|
|
$row = $phpbb_ext_gallery_core_album->get_info($this->parent_id); |
|
715
|
|
|
|
|
716
|
|
|
$url = $this->u_action . '&parent_id=' . $this->parent_id . '&a=' . $row['album_id']; |
|
717
|
|
|
|
|
718
|
|
|
$template->assign_vars(array( |
|
719
|
|
|
'S_NO_ALBUMS' => true, |
|
720
|
|
|
|
|
721
|
|
|
'U_EDIT' => $url . '&action=edit', |
|
722
|
|
|
'U_DELETE' => $url . '&action=delete', |
|
723
|
|
|
'U_SYNC' => $url . '&action=sync', |
|
724
|
|
|
)); |
|
725
|
|
|
} |
|
726
|
|
|
$db->sql_freeresult($result); |
|
727
|
|
|
|
|
728
|
|
|
$template->assign_vars(array( |
|
729
|
|
|
'ERROR_MSG' => (sizeof($errors)) ? implode('<br />', $errors) : '', |
|
730
|
|
|
'NAVIGATION' => $navigation, |
|
731
|
|
|
'ALBUM_BOX' => $album_box, |
|
732
|
|
|
'U_SEL_ACTION' => $this->u_action, |
|
733
|
|
|
'U_ACTION' => $this->u_action . '&parent_id=' . $this->parent_id, |
|
734
|
|
|
|
|
735
|
|
|
'U_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', |
|
736
|
|
|
)); |
|
737
|
|
|
} |
|
738
|
|
|
|
|
739
|
|
|
/** |
|
740
|
|
|
* Display progress bar for syncing albums |
|
741
|
|
|
* |
|
742
|
|
|
* borrowed from phpBB3 |
|
743
|
|
|
* @author: phpBB Group |
|
744
|
|
|
* @function: display_progress_bar |
|
745
|
|
|
* @param $start |
|
746
|
|
|
* @param $total |
|
747
|
|
|
*/ |
|
748
|
|
|
function display_progress_bar($start, $total) |
|
|
|
|
|
|
749
|
|
|
{ |
|
750
|
|
|
global $template, $user; |
|
751
|
|
|
|
|
752
|
|
|
adm_page_header($user->lang['SYNC_IN_PROGRESS']); |
|
|
|
|
|
|
753
|
|
|
|
|
754
|
|
|
$template->set_filenames(array( |
|
755
|
|
|
'body' => 'progress_bar.html', |
|
756
|
|
|
)); |
|
757
|
|
|
|
|
758
|
|
|
$template->assign_vars(array( |
|
759
|
|
|
'L_PROGRESS' => $user->lang['SYNC_IN_PROGRESS'], |
|
760
|
|
|
'L_PROGRESS_EXPLAIN' => ($start && $total) ? sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $start, $total) : $user->lang['SYNC_IN_PROGRESS']) |
|
761
|
|
|
); |
|
762
|
|
|
|
|
763
|
|
|
adm_page_footer(); |
|
|
|
|
|
|
764
|
|
|
} |
|
765
|
|
|
} |
|
766
|
|
|
|
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.