Skip to content

Commit de1c6ed

Browse files
authored
Merge pull request #316 from Leinad4Mind/poster-unapproved-image
New feature: Poster can see unapproved images
2 parents d062e1e + a01b569 commit de1c6ed

29 files changed

+206
-122
lines changed

core/acp/albums_module.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ function main($id, $mode)
149149
extract($phpbb_dispatcher->trigger_event('phpbbgallery.core.acp.albums.request_data', compact($vars)));
150150

151151
// Categories are not able to be locked...
152-
if ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CAT)
152+
if ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT)
153153
{
154154
$album_data['album_status'] = \phpbbgallery\core\block::ALBUM_OPEN;
155155
}
@@ -330,7 +330,7 @@ function main($id, $mode)
330330
$album_data['left_id'] = $row['left_id'];
331331
$album_data['right_id'] = $row['right_id'];
332332
}
333-
if ($row['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST)
333+
if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST)
334334
{
335335
$contest_data = $phpbb_gallery_contest->get_contest($album_id, 'album');
336336
}
@@ -454,7 +454,7 @@ function main($id, $mode)
454454
$album_sort_dir_options .= '<option' . (($album_data['album_sort_dir'] == 'd') ? ' selected="selected"' : '') . " value='d'>" . $this->language->lang('SORT_DESCENDING') . '</option>';
455455
$album_sort_dir_options .= '<option' . (($album_data['album_sort_dir'] == 'a') ? ' selected="selected"' : '') . " value='a'>" . $this->language->lang('SORT_ASCENDING') . '</option>';
456456

457-
$statuslist = '<option value="' . \phpbbgallery\core\block::ALBUM_OPEN . '"' . (($album_data['album_status'] == \phpbbgallery\core\block::ALBUM_OPEN) ? ' selected="selected"' : '') . '>' . $user->lang['UNLOCKED'] . '</option><option value="' . \phpbbgallery\core\block::ALBUM_LOCKED . '"' . (($album_data['album_status'] == \phpbbgallery\core\block::ALBUM_LOCKED) ? ' selected="selected"' : '') . '>' . $user->lang['LOCKED'] . '</option>';
457+
$statuslist = '<option value="' . \phpbbgallery\core\block::ALBUM_OPEN . '"' . (($album_data['album_status'] == (int) \phpbbgallery\core\block::ALBUM_OPEN) ? ' selected="selected"' : '') . '>' . $user->lang['UNLOCKED'] . '</option><option value="' . \phpbbgallery\core\block::ALBUM_LOCKED . '"' . (($album_data['album_status'] == (int) \phpbbgallery\core\block::ALBUM_LOCKED) ? ' selected="selected"' : '') . '>' . $user->lang['LOCKED'] . '</option>';
458458

459459
$sql = 'SELECT album_id
460460
FROM ' . $table_prefix . 'gallery_albums
@@ -540,12 +540,12 @@ function main($id, $mode)
540540
'S_PARENT_OPTIONS' => $parents_list,
541541
'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),
542542

543-
'S_ALBUM_ORIG_UPLOAD' => (isset($old_album_type) && $old_album_type == \phpbbgallery\core\block::TYPE_UPLOAD) ? true : false,
544-
'S_ALBUM_ORIG_CAT' => (isset($old_album_type) && $old_album_type == \phpbbgallery\core\block::TYPE_CAT) ? true : false,
545-
'S_ALBUM_ORIG_CONTEST' => (isset($old_album_type) && $old_album_type == \phpbbgallery\core\block::TYPE_CONTEST) ? true : false,
546-
'S_ALBUM_UPLOAD' => ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_UPLOAD) ? true : false,
547-
'S_ALBUM_CAT' => ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CAT) ? true : false,
548-
'S_ALBUM_CONTEST' => ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST) ? true : false,
543+
'S_ALBUM_ORIG_UPLOAD' => (isset($old_album_type) && $old_album_type == (int) \phpbbgallery\core\block::TYPE_UPLOAD) ? true : false,
544+
'S_ALBUM_ORIG_CAT' => (isset($old_album_type) && $old_album_type == (int) \phpbbgallery\core\block::TYPE_CAT) ? true : false,
545+
'S_ALBUM_ORIG_CONTEST' => (isset($old_album_type) && $old_album_type == (int) \phpbbgallery\core\block::TYPE_CONTEST) ? true : false,
546+
'S_ALBUM_UPLOAD' => ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_UPLOAD) ? true : false,
547+
'S_ALBUM_CAT' => ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT) ? true : false,
548+
'S_ALBUM_CONTEST' => ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST) ? true : false,
549549
'ALBUM_UPLOAD' => \phpbbgallery\core\block::TYPE_UPLOAD,
550550
'ALBUM_CAT' => \phpbbgallery\core\block::TYPE_CAT,
551551
'ALBUM_CONTEST' => \phpbbgallery\core\block::TYPE_CONTEST,
@@ -675,7 +675,7 @@ function main($id, $mode)
675675
{
676676
$album_type = $row['album_type'];
677677

678-
if ($row['album_status'] == \phpbbgallery\core\block::ALBUM_LOCKED)
678+
if ($row['album_status'] == (int) \phpbbgallery\core\block::ALBUM_LOCKED)
679679
{
680680
$folder_image = '<img src="images/icon_folder_lock.gif" alt="' . $user->lang['LOCKED'] . '" />';
681681
}

core/album/album.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public function get_albumbox($ignore_personals, $select_name, $select_id = false
236236
((is_array($ignore_id) && in_array($row['album_id'], $ignore_id)) || $row['album_id'] == $ignore_id)
237237
||
238238
// Need upload permissions (for moving)
239-
(($requested_permission == 'm_move') && (($row['album_type'] == \phpbbgallery\core\block::TYPE_CAT) || (!$this->gallery_auth->acl_check('i_upload', $row['album_id'], $row['album_user_id']) && !$this->gallery_auth->acl_check('m_move', $row['album_id'], $row['album_user_id']))))
239+
(($requested_permission == 'm_move') && (($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT) || (!$this->gallery_auth->acl_check('i_upload', $row['album_id'], $row['album_user_id']) && !$this->gallery_auth->acl_check('m_move', $row['album_id'], $row['album_user_id']))))
240240
||
241241
// album_type does not fit
242242
($check_album_type && ($row['album_type'] != $requested_album_type))

core/album/loader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function load($album_id)
6767
{
6868
throw new \OutOfBoundsException('INVALID_ALBUM');
6969
}
70-
if ($row['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST)
70+
if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST)
7171
{
7272
$album_contest_data = $this->contest->get_contest($row['album_id'], 'album');
7373
$row = array_merge($row, $album_contest_data);

core/album/manage.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public function update_album_data(&$album_data, &$contest_data)
211211
}
212212
}*/
213213
// Validate the contest timestamps:
214-
if ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST)
214+
if ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST)
215215
{
216216
if ($this->user->data['user_timezone'] == '')
217217
{
@@ -386,7 +386,7 @@ public function update_album_data(&$album_data, &$contest_data)
386386
$album_data['album_id'] = (int) $this->db->sql_nextid();
387387

388388
// Type is contest, so create it...
389-
if ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST)
389+
if ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST)
390390
{
391391
$contest_data_sql = $contest_data;
392392
$contest_data_sql['contest_album_id'] = $album_data['album_id'];
@@ -408,28 +408,28 @@ public function update_album_data(&$album_data, &$contest_data)
408408
$row = $this->gallery_album->get_info($album_data_sql['album_id']);
409409
$reset_marked_images = false;
410410

411-
if ($row['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] != \phpbbgallery\core\block::TYPE_CONTEST)
411+
if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] != \phpbbgallery\core\block::TYPE_CONTEST)
412412
{
413413
// Changing a contest to album? No!
414414
// Changing a contest to category? No!
415415
$errors[] = $this->language->lang('ALBUM_WITH_CONTEST_NO_TYPE_CHANGE');
416416
return $errors;
417417
}
418-
else if ($row['album_type'] != \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST)
418+
else if ($row['album_type'] != \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST)
419419
{
420420
// Changing a album to contest? No!
421421
// Changing a category to contest? No!
422422
$errors[] = $this->language->lang('ALBUM_NO_TYPE_CHANGE_TO_CONTEST');
423423
return $errors;
424424
}
425-
else if ($row['album_type'] == \phpbbgallery\core\block::TYPE_CAT && $album_data_sql['album_type'] == \phpbbgallery\core\block::TYPE_UPLOAD)
425+
else if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_UPLOAD)
426426
{
427427
// Changing a category to a album? Yes!
428428
// Reset the data (you couldn't upload directly in a cat, you must use a album)
429429
$album_data_sql['album_images'] = $album_data_sql['album_images_real'] = $album_data_sql['album_last_image_id'] = $album_data_sql['album_last_user_id'] = $album_data_sql['album_last_image_time'] = $album_data_sql['album_contest'] = 0;
430430
$album_data_sql['album_last_username'] = $album_data_sql['album_last_user_colour'] = $album_data_sql['album_last_image_name'] = '';
431431
}
432-
else if ($row['album_type'] == \phpbbgallery\core\block::TYPE_UPLOAD && $album_data_sql['album_type'] == \phpbbgallery\core\block::TYPE_CAT)
432+
else if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_UPLOAD && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT)
433433
{
434434
// Changing a album to a category? Yes!
435435
// we're turning a uploadable album into a non-uploadable album
@@ -455,13 +455,13 @@ public function update_album_data(&$album_data, &$contest_data)
455455
return array($this->language->lang('NO_ALBUM_ACTION'));
456456
}
457457
}
458-
else if ($row['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST)
458+
else if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST)
459459
{
460460
// Changing a contest to contest? Yes!
461461
// We need to check for the contest_data
462462
$row_contest = $this->gallery_contest->get_contest($album_data['album_id'], 'album');
463463
$contest_data['contest_id'] = $row_contest['contest_id'];
464-
if ($row_contest['contest_marked'] == \phpbbgallery\core\block::NO_CONTEST)
464+
if ($row_contest['contest_marked'] == (int) \phpbbgallery\core\block::NO_CONTEST)
465465
{
466466
// If the old contest is finished, but the new one isn't, we need to remark the images!
467467
// If we change it the other way round, the album.php will do the end on the first visit!
@@ -520,14 +520,14 @@ public function update_album_data(&$album_data, &$contest_data)
520520
$contest_id = $contest_data['contest_id'];
521521
unset($contest_data['contest_id']);
522522
523-
$sql = 'UPDATE ' . GALLERY_CONTESTS_TABLE . '
523+
$sql = 'UPDATE ' . $this->contests_table . '
524524
SET ' . $db->sql_build_array('UPDATE', $contest_data) . '
525525
WHERE contest_id = ' . (int) $contest_id;
526526
$db->sql_query($sql);
527527
if ($reset_marked_images)
528528
{
529529
// If the old contest is finished, but the new one isn't, we need to remark the images!
530-
$sql = 'UPDATE ' . GALLERY_IMAGES_TABLE . '
530+
$sql = 'UPDATE ' . $this->images_table . '
531531
SET image_contest_rank = 0,
532532
image_contest_end = 0,
533533
image_contest = ' . phpbb_ext_gallery_core_image::IN_CONTEST . '

core/auth/level.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function __construct(\phpbbgallery\core\auth\auth $auth, \phpbb\config\co
6262
}
6363

6464
/**
65-
* User authorisation levels output
65+
* User authorization levels output
6666
*
6767
* @param int $album_id The current album the user is in.
6868
* @param int $album_status The albums status bit.

0 commit comments

Comments
 (0)