Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion acpcleanup/cleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public function delete_pegas($unwanted_pegas, $obsolete_pegas)
),
),

'WHERE' => 'a.album_user_id <> ' . $this->album->get_public() . ' AND a.parent_id = 0',
'WHERE' => 'a.album_user_id <> ' . (int) $this->album->get_public() . ' AND a.parent_id = 0',
'ORDER_BY' => 'a.album_id DESC',
);
$sql = $this->db->sql_build_query('SELECT', $sql_array);
Expand Down
4 changes: 2 additions & 2 deletions acpimport/acp/main_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ function import()

$sql = 'SELECT username, user_colour, user_id
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user_id;
WHERE user_id = ' . (int) $user_id;
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
Expand Down Expand Up @@ -339,7 +339,7 @@ function import()
// Where do we put them to?
$sql = 'SELECT album_id, album_name
FROM ' . $table_prefix . 'gallery_albums
WHERE album_id = ' . $album_id;
WHERE album_id = ' . (int) $album_id;
$result = $db->sql_query($sql);
$album_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
Expand Down
28 changes: 15 additions & 13 deletions core/album/display.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function generate_navigation($album_data)
$album_parents = $this->get_parents($album_data);

// Display username for personal albums
if ($album_data['album_user_id'] > \phpbbgallery\core\block::PUBLIC_ALBUM)
if ($album_data['album_user_id'] > (int) \phpbbgallery\core\block::PUBLIC_ALBUM)
{
$sql = 'SELECT user_id, username, user_colour
FROM ' . USERS_TABLE . '
Expand Down Expand Up @@ -179,9 +179,9 @@ public function generate_navigation($album_data)
'ALBUM_ID' => $album_data['album_id'],
'ALBUM_NAME' => $album_data['album_name'],
'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']),
'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)) : '',
'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)) : '',
'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)) : '',
'ALBUM_CONTEST_START' => ($album_data['album_type'] == (int) \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)) : '',
'ALBUM_CONTEST_RATING' => ($album_data['album_type'] == (int) \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)) : '',
'ALBUM_CONTEST_END' => ($album_data['album_type'] == (int) \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)) : '',
'U_VIEW_ALBUM' => $this->helper->route('phpbbgallery_core_album', array('album_id' => (int) $album_data['album_id'])),
));

Expand All @@ -199,7 +199,8 @@ public function generate_navigation($album_data)
*/
public function get_parents($album_data)
{
$album_parents = array();
$album_parents = [];

if ($album_data['parent_id'] > 0)
{
if ($album_data['album_parents'] == '')
Expand All @@ -210,11 +211,12 @@ public function get_parents($album_data)
AND right_id > ' . (int) $album_data['right_id'] . '
AND album_user_id = ' . (int) $album_data['album_user_id'] . '
ORDER BY left_id ASC';

$result = $this->db->sql_query($sql);

while ($row = $this->db->sql_fetchrow($result))
{
$album_parents[$row['album_id']] = array($row['album_name'], (int) $row['album_type']);
$album_parents[$row['album_id']] = [$row['album_name'], (int) $row['album_type']];
}
$this->db->sql_freeresult($result);

Expand Down Expand Up @@ -344,8 +346,8 @@ public function display_albums($root_data = '', $display_moderators = true, $ret
{
$mark_read = 'all';
}
$root_data = array('album_id' => \phpbbgallery\core\block::PUBLIC_ALBUM);
$sql_where = 'a.album_user_id = ' . \phpbbgallery\core\block::PUBLIC_ALBUM;
$root_data = array('album_id' => (int) \phpbbgallery\core\block::PUBLIC_ALBUM);
$sql_where = 'a.album_user_id = ' . (int) \phpbbgallery\core\block::PUBLIC_ALBUM;
}
else if ($root_data == 'personal')
{
Expand All @@ -354,7 +356,7 @@ public function display_albums($root_data = '', $display_moderators = true, $ret
$mark_read = 'all';
}
$root_data = array('album_id' => 0);
$sql_where = 'a.album_user_id > ' . \phpbbgallery\core\block::PUBLIC_ALBUM;
$sql_where = 'a.album_user_id > ' . (int) \phpbbgallery\core\block::PUBLIC_ALBUM;
$num_pegas = $this->config['phpbb_gallery_num_pegas'];
$first_char = $this->request->variable('first_char', '');
if ($first_char == 'other')
Expand Down Expand Up @@ -601,7 +603,7 @@ public function display_albums($root_data = '', $display_moderators = true, $ret
foreach ($album_rows as $row)
{
// Empty category
if (($row['parent_id'] == $root_data['album_id']) && ($row['album_type'] == \phpbbgallery\core\block::TYPE_CAT))
if (($row['parent_id'] == $root_data['album_id']) && ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT))
{
$this->template->assign_block_vars('albumrow', array(
'S_IS_CAT' => true,
Expand Down Expand Up @@ -676,7 +678,7 @@ public function display_albums($root_data = '', $display_moderators = true, $ret
$folder_alt = ($album_unread) ? 'NEW_IMAGES' : 'NO_NEW_IMAGES';
$folder_image = ($album_unread) ? 'forum_unread' : 'forum_read';
}
if ($row['album_status'] == \phpbbgallery\core\block::ALBUM_LOCKED)
if ($row['album_status'] == (int) \phpbbgallery\core\block::ALBUM_LOCKED)
{
$folder_image = ($album_unread) ? 'forum_unread_locked' : 'forum_read_locked';
$folder_alt = 'ALBUM_LOCKED';
Expand Down Expand Up @@ -721,12 +723,12 @@ public function display_albums($root_data = '', $display_moderators = true, $ret
$s_subalbums_list = (string) implode(', ', $s_subalbums_list);
$catless = ($row['parent_id'] == $root_data['album_id']) ? true : false;

$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);
$s_username_hidden = ($lastimage_album_type == (int) \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);

$this->template->assign_block_vars('albumrow', array(
'S_IS_CAT' => false,
'S_NO_CAT' => $catless && !$last_catless,
'S_LOCKED_ALBUM' => ($row['album_status'] == \phpbbgallery\core\block::ALBUM_LOCKED) ? true : false,
'S_LOCKED_ALBUM' => ($row['album_status'] == (int) \phpbbgallery\core\block::ALBUM_LOCKED) ? true : false,
'S_UNREAD_ALBUM' => ($album_unread) ? true : false,
'S_LIST_SUBALBUMS' => ($row['display_subalbum_list']) ? true : false,
'S_SUBALBUMS' => (sizeof($subalbums_list)) ? true : false,
Expand Down
2 changes: 1 addition & 1 deletion core/controller/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function base()
'S_RECENT_COMMENTS' => $this->helper->route('phpbbgallery_core_search_commented'),
'COMMENTS_EXPAND' => $this->gallery_config->get('rrc_gindex_comments') ? true : false,
));
$this->gallery_search->recent_comments($this->gallery_config->get('items_per_page'), 0);
$this->gallery_search->recent_comments($this->gallery_config->get('items_per_page'), 0, false);
}
}
$this->display_legend();
Expand Down
31 changes: 13 additions & 18 deletions core/controller/moderate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
*
* @package phpBB Gallery Core
* @copyright (c) 2014 nickvergessen
* @copyright (c) 2014 nickvergessen | 2025 Leinad4Mind
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
Expand Down Expand Up @@ -425,56 +425,51 @@ public function album_overview($album_id, $page)
{
if (confirm_box(true) || $moving_target)
{
$message = '';
switch ($action)
{
case 'approve':
$this->image->approve_images($actions_array, $album_id);
$this->album->update_info($album_id);

$message = $this->language->lang('WAITING_APPROVED_IMAGE', count($actions_array));
$this->url->meta_refresh(3, $back_link);
trigger_error($message);
break;

case 'unapprove':
$this->image->unapprove_images($actions_array, $album_id);
$this->album->update_info($album_id);

$message = $this->language->lang('WAITING_UNAPPROVED_IMAGE', count($actions_array));
$this->url->meta_refresh(3, $back_link);
trigger_error($message);
break;

case 'lock':
$this->image->lock_images($actions_array, $album_id);
$this->album->update_info($album_id);

$message = $this->language->lang('WAITING_LOCKED_IMAGE', count($actions_array));
$this->url->meta_refresh(3, $back_link);
trigger_error($message);
break;

case 'delete':
$this->moderate->delete_images($actions_array);
$this->album->update_info($album_id);

$message = $this->language->lang('DELETED_IMAGES', count($actions_array));
$this->url->meta_refresh(3, $back_link);
trigger_error($message);
break;

case 'move':
$this->image->move_image($actions_array, $moving_target);
$this->album->update_info($album_id);
$this->album->update_info($moving_target);

$message = $this->language->lang('MOVED_IMAGES', count($actions_array));
$this->url->meta_refresh(3, $back_link);
trigger_error($message);
break;

case 'report':
$this->report->close_reports_by_image($actions_array);
$message = $this->language->lang('WAITING_REPORTED_DONE', count($actions_array));
$this->url->meta_refresh(3, $back_link);
trigger_error($message);
break;
}

if (!empty($message))
{
$this->url->meta_refresh(3, $back_link);
trigger_error($message);
}
}
else
{
Expand Down
55 changes: 12 additions & 43 deletions core/image/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
*
* @package phpBB Gallery Core
* @copyright (c) 2014 nickvergessen
* @copyright (c) 2014 nickvergessen | Leinad4Mind 2025
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
Expand Down Expand Up @@ -613,50 +613,19 @@ public function get_last_image()

return $row;
}
public function assign_block($image_block_name, $image_data, $display_option = 0, $thumbanil_link = 'image_page', $imagename_link = 'image_page')
public function assign_block($image_block_name, $image_data, $display_option = 0, $thumbnail_link = 'image_page', $imagename_link = 'image_page')
{
// Now let's get display options
$show_ip = $show_ratings = $show_username = $show_views = $show_time = $show_imagename = $show_comments = $show_album = false;
if ($display_option >= self::IMAGE_SHOW_IP)
{
$show_ip = true;
$display_option = $display_option - self::IMAGE_SHOW_IP;
}
if ($display_option >= self::IMAGE_SHOW_RATINGS)
{
$show_ratings = true;
$display_option = $display_option - self::IMAGE_SHOW_RATINGS;
}
if ($display_option >= self::IMAGE_SHOW_USERNAME)
{
$show_username = true;
$display_option = $display_option - self::IMAGE_SHOW_USERNAME;
}
if ($display_option >= self::IMAGE_SHOW_VIEWS)
{
$show_views = true;
$display_option = $display_option - self::IMAGE_SHOW_VIEWS;
}
if ($display_option >= self::IMAGE_SHOW_TIME)
{
$show_time = true;
$display_option = $display_option - self::IMAGE_SHOW_TIME;
}
if ($display_option >= self::IMAGE_SHOW_IMAGENAME)
{
$show_imagename = true;
$display_option = $display_option - self::IMAGE_SHOW_IMAGENAME;
}
if ($display_option >= self::IMAGE_SHOW_COMMENTS)
{
$show_comments = true;
$display_option = $display_option - self::IMAGE_SHOW_COMMENTS;
}
if ($display_option == self::IMAGE_SHOW_ALBUM)
{
$show_album = true;
}
switch ($thumbanil_link)
$show_ip = ($display_option & self::IMAGE_SHOW_IP) !== 0;
$show_ratings = ($display_option & self::IMAGE_SHOW_RATINGS) !== 0;
$show_username = ($display_option & self::IMAGE_SHOW_USERNAME) !== 0;
$show_views = ($display_option & self::IMAGE_SHOW_VIEWS) !== 0;
$show_time = ($display_option & self::IMAGE_SHOW_TIME) !== 0;
$show_imagename = ($display_option & self::IMAGE_SHOW_IMAGENAME) !== 0;
$show_comments = ($display_option & self::IMAGE_SHOW_COMMENTS) !== 0;
$show_album = ($display_option & self::IMAGE_SHOW_ALBUM) !== 0;

switch ($thumbnail_link)
{
case 'image_page':
$action = $this->helper->route('phpbbgallery_core_image', array('image_id' => (int) $image_data['image_id']));
Expand Down
9 changes: 4 additions & 5 deletions core/log.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ public function delete_logs($mark)
* @param array $additional
* @internal param int $start start count used to build paging
*/
public function build_list($type, $limit = 0, $page = 1, $album = 0, $image = 0, $additional = array())
public function build_list($type, $limit = 0, $page = 1, $album = 0, $image = 0, $additional = [])
{
if ($limit == 0)
{
$limit = $this->gallery_config->get('items_per_page');
}
$this->language->add_lang(array('info_acp_gallery_logs'), 'phpbbgallery/core');
$this->language->add_lang(['info_acp_gallery_logs'], 'phpbbgallery/core');

$this->gallery_auth->load_user_permissions($this->user->data['user_id']);
$sql_array = array(
Expand All @@ -147,7 +147,7 @@ public function build_list($type, $limit = 0, $page = 1, $album = 0, $image = 0,
)
)
);
$sql_where = array();
$sql_where = [];
if ($type != 'all')
{
$sql_where[] = "l.log_type = '" . $this->db->sql_escape($type) . "'";
Expand Down Expand Up @@ -261,8 +261,7 @@ public function build_list($type, $limit = 0, $page = 1, $album = 0, $image = 0,
'U_LOG_IP' => $var['ip'],
'U_ALBUM_LINK' => $var['album'] != 0 ? $this->helper->route('phpbbgallery_core_album', array('album_id' => $var['album'])) : false,
'U_IMAGE_LINK' => $var['image'] != 0 ? $this->helper->route('phpbbgallery_core_image', array('image_id' => $var['image'])) : false,
//'U_LOG_ACTION' => $description,
'U_LOG_ACTION' => $this->language->lang($var['description'][0], isset($var['description'][1]) ? $var['description'][1] : false, isset($var['description'][2]) ? $var['description'][2] : false, isset($var['description'][3]) ? $var['description'][3] : false),
'U_LOG_ACTION' => isset($var['description']) && is_array($var['description']) ? $this->language->lang($var['description'][0], $var['description'][1] ?? false, $var['description'][2] ?? false, $var['description'][3] ?? false) : '',
'U_TIME' => $this->user->format_date($var['time']),
));
}
Expand Down
Loading
Loading