Skip to content
Merged
20 changes: 10 additions & 10 deletions core/acp/albums_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function main($id, $mode)
extract($phpbb_dispatcher->trigger_event('phpbbgallery.core.acp.albums.request_data', compact($vars)));

// Categories are not able to be locked...
if ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CAT)
if ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT)
{
$album_data['album_status'] = \phpbbgallery\core\block::ALBUM_OPEN;
}
Expand Down Expand Up @@ -330,7 +330,7 @@ function main($id, $mode)
$album_data['left_id'] = $row['left_id'];
$album_data['right_id'] = $row['right_id'];
}
if ($row['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST)
if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST)
{
$contest_data = $phpbb_gallery_contest->get_contest($album_id, 'album');
}
Expand Down Expand Up @@ -454,7 +454,7 @@ function main($id, $mode)
$album_sort_dir_options .= '<option' . (($album_data['album_sort_dir'] == 'd') ? ' selected="selected"' : '') . " value='d'>" . $this->language->lang('SORT_DESCENDING') . '</option>';
$album_sort_dir_options .= '<option' . (($album_data['album_sort_dir'] == 'a') ? ' selected="selected"' : '') . " value='a'>" . $this->language->lang('SORT_ASCENDING') . '</option>';

$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>';
$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>';

$sql = 'SELECT album_id
FROM ' . $table_prefix . 'gallery_albums
Expand Down Expand Up @@ -540,12 +540,12 @@ function main($id, $mode)
'S_PARENT_OPTIONS' => $parents_list,
'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),

'S_ALBUM_ORIG_UPLOAD' => (isset($old_album_type) && $old_album_type == \phpbbgallery\core\block::TYPE_UPLOAD) ? true : false,
'S_ALBUM_ORIG_CAT' => (isset($old_album_type) && $old_album_type == \phpbbgallery\core\block::TYPE_CAT) ? true : false,
'S_ALBUM_ORIG_CONTEST' => (isset($old_album_type) && $old_album_type == \phpbbgallery\core\block::TYPE_CONTEST) ? true : false,
'S_ALBUM_UPLOAD' => ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_UPLOAD) ? true : false,
'S_ALBUM_CAT' => ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CAT) ? true : false,
'S_ALBUM_CONTEST' => ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST) ? true : false,
'S_ALBUM_ORIG_UPLOAD' => (isset($old_album_type) && $old_album_type == (int) \phpbbgallery\core\block::TYPE_UPLOAD) ? true : false,
'S_ALBUM_ORIG_CAT' => (isset($old_album_type) && $old_album_type == (int) \phpbbgallery\core\block::TYPE_CAT) ? true : false,
'S_ALBUM_ORIG_CONTEST' => (isset($old_album_type) && $old_album_type == (int) \phpbbgallery\core\block::TYPE_CONTEST) ? true : false,
'S_ALBUM_UPLOAD' => ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_UPLOAD) ? true : false,
'S_ALBUM_CAT' => ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT) ? true : false,
'S_ALBUM_CONTEST' => ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST) ? true : false,
'ALBUM_UPLOAD' => \phpbbgallery\core\block::TYPE_UPLOAD,
'ALBUM_CAT' => \phpbbgallery\core\block::TYPE_CAT,
'ALBUM_CONTEST' => \phpbbgallery\core\block::TYPE_CONTEST,
Expand Down Expand Up @@ -675,7 +675,7 @@ function main($id, $mode)
{
$album_type = $row['album_type'];

if ($row['album_status'] == \phpbbgallery\core\block::ALBUM_LOCKED)
if ($row['album_status'] == (int) \phpbbgallery\core\block::ALBUM_LOCKED)
{
$folder_image = '<img src="images/icon_folder_lock.gif" alt="' . $user->lang['LOCKED'] . '" />';
}
Expand Down
2 changes: 1 addition & 1 deletion core/album/album.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public function get_albumbox($ignore_personals, $select_name, $select_id = false
((is_array($ignore_id) && in_array($row['album_id'], $ignore_id)) || $row['album_id'] == $ignore_id)
||
// Need upload permissions (for moving)
(($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']))))
(($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']))))
||
// album_type does not fit
($check_album_type && ($row['album_type'] != $requested_album_type))
Expand Down
2 changes: 1 addition & 1 deletion core/album/loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function load($album_id)
{
throw new \OutOfBoundsException('INVALID_ALBUM');
}
if ($row['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST)
if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST)
{
$album_contest_data = $this->contest->get_contest($row['album_id'], 'album');
$row = array_merge($row, $album_contest_data);
Expand Down
20 changes: 10 additions & 10 deletions core/album/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function update_album_data(&$album_data, &$contest_data)
}
}*/
// Validate the contest timestamps:
if ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST)
if ($album_data['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST)
{
if ($this->user->data['user_timezone'] == '')
{
Expand Down Expand Up @@ -386,7 +386,7 @@ public function update_album_data(&$album_data, &$contest_data)
$album_data['album_id'] = (int) $this->db->sql_nextid();

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

if ($row['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] != \phpbbgallery\core\block::TYPE_CONTEST)
if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] != \phpbbgallery\core\block::TYPE_CONTEST)
{
// Changing a contest to album? No!
// Changing a contest to category? No!
$errors[] = $this->language->lang('ALBUM_WITH_CONTEST_NO_TYPE_CHANGE');
return $errors;
}
else if ($row['album_type'] != \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST)
else if ($row['album_type'] != \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST)
{
// Changing a album to contest? No!
// Changing a category to contest? No!
$errors[] = $this->language->lang('ALBUM_NO_TYPE_CHANGE_TO_CONTEST');
return $errors;
}
else if ($row['album_type'] == \phpbbgallery\core\block::TYPE_CAT && $album_data_sql['album_type'] == \phpbbgallery\core\block::TYPE_UPLOAD)
else if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_UPLOAD)
{
// Changing a category to a album? Yes!
// Reset the data (you couldn't upload directly in a cat, you must use a album)
$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;
$album_data_sql['album_last_username'] = $album_data_sql['album_last_user_colour'] = $album_data_sql['album_last_image_name'] = '';
}
else if ($row['album_type'] == \phpbbgallery\core\block::TYPE_UPLOAD && $album_data_sql['album_type'] == \phpbbgallery\core\block::TYPE_CAT)
else if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_UPLOAD && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT)
{
// Changing a album to a category? Yes!
// we're turning a uploadable album into a non-uploadable album
Expand All @@ -455,13 +455,13 @@ public function update_album_data(&$album_data, &$contest_data)
return array($this->language->lang('NO_ALBUM_ACTION'));
}
}
else if ($row['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST)
else if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST)
{
// Changing a contest to contest? Yes!
// We need to check for the contest_data
$row_contest = $this->gallery_contest->get_contest($album_data['album_id'], 'album');
$contest_data['contest_id'] = $row_contest['contest_id'];
if ($row_contest['contest_marked'] == \phpbbgallery\core\block::NO_CONTEST)
if ($row_contest['contest_marked'] == (int) \phpbbgallery\core\block::NO_CONTEST)
{
// If the old contest is finished, but the new one isn't, we need to remark the images!
// If we change it the other way round, the album.php will do the end on the first visit!
Expand Down Expand Up @@ -520,14 +520,14 @@ public function update_album_data(&$album_data, &$contest_data)
$contest_id = $contest_data['contest_id'];
unset($contest_data['contest_id']);

$sql = 'UPDATE ' . GALLERY_CONTESTS_TABLE . '
$sql = 'UPDATE ' . $this->contests_table . '
SET ' . $db->sql_build_array('UPDATE', $contest_data) . '
WHERE contest_id = ' . (int) $contest_id;
$db->sql_query($sql);
if ($reset_marked_images)
{
// If the old contest is finished, but the new one isn't, we need to remark the images!
$sql = 'UPDATE ' . GALLERY_IMAGES_TABLE . '
$sql = 'UPDATE ' . $this->images_table . '
SET image_contest_rank = 0,
image_contest_end = 0,
image_contest = ' . phpbb_ext_gallery_core_image::IN_CONTEST . '
Expand Down
2 changes: 1 addition & 1 deletion core/auth/level.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function __construct(\phpbbgallery\core\auth\auth $auth, \phpbb\config\co
}

/**
* User authorisation levels output
* User authorization levels output
*
* @param int $album_id The current album the user is in.
* @param int $album_status The albums status bit.
Expand Down
Loading
Loading