diff --git a/core/acp/config_module.php b/core/acp/config_module.php index 3a2b8d5b3..3c67f3c91 100644 --- a/core/acp/config_module.php +++ b/core/acp/config_module.php @@ -14,6 +14,13 @@ class config_module { + /** @var \phpbb\language\language */ + public $language; + public $new_config; + public $tpl_name; + public $page_title; + public $u_action; + /** * This function is called, when the main() function is called. * You can use this function to add your language files, check for a valid mode, unset config options and more. @@ -37,7 +44,7 @@ public function main($id, $mode) $this->language = $phpbb_container->get('language'); $this->language->add_lang(array('gallery', 'gallery_acp'), 'phpbbgallery/core'); - $submit = (isset($_POST['submit'])) ? true : false; + $submit = $request->is_set_post('submit'); $form_key = 'acp_time'; add_form_key($form_key); @@ -52,7 +59,7 @@ public function main($id, $mode) // Init gallery configs class $phpbb_gallery_configs = new \phpbbgallery\core\config($config); $this->new_config = $phpbb_gallery_configs->get_all(); - $cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $this->new_config; + $cfg_array = $request->is_set_post('config') ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $this->new_config; $error = array(); // We validate the complete config if whished diff --git a/core/acp/gallery_logs_module.php b/core/acp/gallery_logs_module.php index 49fa79ca0..47105c9c5 100644 --- a/core/acp/gallery_logs_module.php +++ b/core/acp/gallery_logs_module.php @@ -18,6 +18,10 @@ class gallery_logs_module { var $u_action; + /** @var \phpbb\language\language */ + var $language; + var $tpl_name; + var $page_title; function main($id, $mode) { diff --git a/core/acp/main_module.php b/core/acp/main_module.php index b237648ba..0de54bd0e 100644 --- a/core/acp/main_module.php +++ b/core/acp/main_module.php @@ -18,6 +18,10 @@ class main_module { var $u_action; + /** @var \phpbb\language\language */ + var $language; + var $tpl_name; + var $page_title; function main($id, $mode) { @@ -562,6 +566,11 @@ function overview() $dir_sizes = $db->sql_fetchrow($result); $db->sql_freeresult($result); + $gallery_version = $phpbb_container + ->get('ext.manager') + ->create_extension_metadata_manager('phpbbgallery/core') + ->get_metadata('version'); + $template->assign_vars(array( 'S_GALLERY_OVERVIEW' => true, 'ACP_GALLERY_TITLE' => $this->language->lang('ACP_GALLERY_OVERVIEW'), @@ -574,7 +583,7 @@ function overview() 'GUPLOAD_DIR_SIZE' => get_formatted_filesize($dir_sizes['stat']), 'MEDIUM_DIR_SIZE' => get_formatted_filesize($dir_sizes['stat_medium']), 'CACHE_DIR_SIZE' => get_formatted_filesize($dir_sizes['stat_cache']), - 'GALLERY_VERSION' => $config['phpbb_gallery_version'], + 'GALLERY_VERSION' => $gallery_version, 'U_FIND_USERNAME' => $gallery_url->append_sid('phpbb', 'memberlist', 'mode=searchuser&form=action_create_pega_form&field=username&select_single=true'), 'S_SELECT_ALBUM' => $phpbb_ext_gallery_core_album->get_albumbox(false, 'reset_album_id', false, false, false, (int) \phpbbgallery\core\block::PUBLIC_ALBUM, (int) \phpbbgallery\core\block::TYPE_UPLOAD), diff --git a/core/acp/permissions_module.php b/core/acp/permissions_module.php index dd42e27bd..670a1c58f 100644 --- a/core/acp/permissions_module.php +++ b/core/acp/permissions_module.php @@ -49,7 +49,7 @@ public function main($id, $mode) $this->tpl_name = 'gallery_permissions'; $this->page_title = $this->language->lang('ALBUM_AUTH_TITLE'); add_form_key('acp_gallery'); - $submit = (isset($_POST['submit_edit_options'])) ? true : ((isset($_POST['submit_add_options'])) ? true : false); + $submit = $request->is_set_post('submit_edit_options') || $request->is_set_post('submit_add_options'); $action = $request->variable('action', ''); /** @@ -164,8 +164,8 @@ private function permissions_v_mask() $this->language->add_lang('acp/permissions'); - $submit = (isset($_POST['submit'])) ? true : false; - $delete = (isset($_POST['delete'])) ? true : false; + $submit = $request->is_set_post('submit'); + $delete = $request->is_set_post('delete'); $album_id = $request->variable('album_id', array(0)); $group_id = $request->variable('group_id', array(0)); $user_id = $request->variable('user_id', array(0)); @@ -679,7 +679,7 @@ private function permissions_set() $phpbb_ext_gallery_core_auth = $phpbb_container->get('phpbbgallery.core.auth'); // Send constants to the template - $submit = (isset($_POST['submit'])) ? true : false; + $submit = $request->is_set_post('submit'); $album_id = $request->variable('album_id', array(0)); $group_id = $request->variable('group_id', array(0)); $user_id = $request->variable('user_id', array(0)); @@ -1018,7 +1018,7 @@ private function copy_album_permissions() $phpbb_ext_gallery_core_album = $phpbb_container->get('phpbbgallery.core.album'); $this->language = $phpbb_container->get('language'); - $submit = isset($_POST['submit']) ? true : false; + $submit = $request->is_set_post('submit'); if ($submit) { diff --git a/core/album/display.php b/core/album/display.php index d5e4ac9d9..1d781258a 100644 --- a/core/album/display.php +++ b/core/album/display.php @@ -205,7 +205,8 @@ public function get_parents($album_data) if ($album_data['parent_id'] > 0) { - if ($album_data['album_parents'] == '') + $cached_parents = json_decode($album_data['album_parents'], true); + if (!is_array($cached_parents)) { $sql = 'SELECT album_id, album_name, album_type FROM ' . $this->table_albums . ' @@ -222,7 +223,7 @@ public function get_parents($album_data) } $this->db->sql_freeresult($result); - $album_data['album_parents'] = serialize($album_parents); + $album_data['album_parents'] = json_encode($album_parents, JSON_UNESCAPED_UNICODE); $sql = 'UPDATE ' . $this->table_albums . " SET album_parents = '" . $this->db->sql_escape($album_data['album_parents']) . "' @@ -231,7 +232,7 @@ public function get_parents($album_data) } else { - $album_parents = @unserialize($album_data['album_parents']); + $album_parents = $cached_parents; } } @@ -390,7 +391,7 @@ public function display_albums($root_data = '', $display_moderators = true, $ret ), ), - 'WHERE' => 'a.parent_id = 0 AND ' . $sql_where, + 'WHERE' => implode(' AND ', array('a.parent_id = 0', $sql_where)), ); $sql = $this->db->sql_build_query('SELECT', $sql_array); $result = $this->db->sql_query($sql); diff --git a/core/auth/auth.php b/core/auth/auth.php index 950b5e6dd..00bb81513 100644 --- a/core/auth/auth.php +++ b/core/auth/auth.php @@ -376,7 +376,7 @@ protected function restrict_pegas($user_id) $zebra = null; - $albums = array();//@todo $this->cache->obtain_album_list(); + $albums = $this->cache->get_albums(); foreach ($albums as $album) { if (!$album['album_auth_access'] || ($album['album_user_id'] == self::PUBLIC_ALBUM))# || ($album['album_user_id'] == $user_id)) diff --git a/core/block.bkp b/core/block.bkp deleted file mode 100644 index a58f4cd26..000000000 --- a/core/block.bkp +++ /dev/null @@ -1,660 +0,0 @@ -set_mode(($mode) ? $mode : (self::MODE_RECENT + self::MODE_RANDOM + self::MODE_COMMENT)); - $this->set_display(($display_options) ? $display_options : (self::DISPLAY_ALBUMNAME + self::DISPLAY_IMAGENAME + self::DISPLAY_IMAGETIME + self::DISPLAY_IMAGEVIEWS + self::DISPLAY_USERNAME + self::DISPLAY_IP)); - $this->set_num(($nums) ? $nums : array(1, 4, 5, 0)); - $this->set_toggle((is_bool($toggle_comments)) ? $toggle_comments : false); - $this->set_pegas((is_bool($display_pegas)) ? $display_pegas : true); - - /*if (!phpbb_gallery::$loaded) - { - phpbb_gallery::init(); - } */ - /* - global $user; - $user->add_lang_ext('phpbbgallery/core', array('gallery_acp', 'gallery')); - - if (!function_exists('generate_text_for_display')) - { - phpbb_gallery_url::_include('message_parser', 'phpbb'); - } - } - */ - /** - * block constructor. - * @param \phpbb\user $user - * @param \phpbb\db\driver\driver_interface $db - * @param auth\auth $gallery_auth - * @param config $gallery_config - * @param image\image $gallery_image - * @param $images_table - * @param $albums_table - * @param $contests_table - */ - public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\controller\helper $controller_helper, - \phpbbgallery\core\auth\auth $gallery_auth, \phpbbgallery\core\config $gallery_config, \phpbbgallery\core\image\image $gallery_image, - $images_table, $albums_table, $contests_table) - { - // phpBB core - $this->user = $user; - $this->db = $db; - $this->template = $template; - $this->controller_helper = $controller_helper; - // phpBB Gallery Core - $this->gallery_auth = $gallery_auth; - $this->gallery_config = $gallery_config; - $this->gallery_image = $gallery_image; - // Variables (tables and shit) - $this->images_table = $images_table; - $this->albums_table = $albums_table; - $this->contests_table = $contests_table; - } - - /** - * The name of the outer template loop for the imageblock and comments - * You need to call this on your second code block, - * when you want to view the module two times with different settings on the same page. - * @param $image_block - * @param string $comment_block - */ - public function set_template_block_name($image_block, $comment_block = 'commentrow') - { - $this->template_block_images = $image_block; - $this->template_block_comments = $comment_block; - } - - /** - * @param array $modes Array of strings: 'none', 'recent', 'random', 'comment' - */ - public function set_modes($modes = array()) - { - // Reset the mode - $this->mode = self::MODE_NONE; - - $allowed_modes = array('recent', 'random', 'comment'); - foreach ($allowed_modes as $mode) - { - if (in_array($mode, $modes) && !($this->mode & constant("self::MODE_" . strtoupper($mode)))) - { - $this->mode += constant("self::MODE_" . strtoupper($mode)); - } - } - } - - /** - * @param int $new_mode Integer between 0 and 7 (including bounds) - */ - public function set_mode($new_mode = self::MODE_NONE) - { - if (is_int($new_mode) && ($new_mode >= 0) && ($new_mode <= 7)) - { - $this->mode = $new_mode; - } - } - - public function get_mode() - { - return $this->mode; - } - - /** - * @param array $options Array of strings: - * 'none', 'albumname', 'comments', 'imagename', 'imagetime', 'imageviews', 'username', 'ratings', 'ip' - */ - public function set_display_options($options = array()) - { - // Reset the mode - $this->display = self::DISPLAY_NONE; - - $allowed_options = array('albumname', 'comments', 'imagename', 'imagetime', 'imageviews', 'username', 'ratings', 'ip'); - foreach ($allowed_options as $option) - { - if (in_array($option, $options) && !($this->display & constant("self::DISPLAY_" . strtoupper($option)))) - { - $this->display += constant("self::DISPLAY_" . strtoupper($option)); - } - } - } - - /** - * @param int $new_display - * @internal param int $new_mode Integer between 0 and 255 (including bounds) - */ - public function set_display($new_display = self::DISPLAY_NONE) - { - if (is_int($new_display) && ($new_display >= 0) && ($new_display <= 255)) - { - $this->display = $new_display; - } - } - - public function get_display() - { - return $this->display; - } - - public function set_nums($nums = array()) - { - $allowed_nums = array('rows', 'columns', 'comments', 'contests'); - foreach ($allowed_nums as $num) - { - if (isset($nums[$num]) && is_int($nums[$num])) - { - $variable_name = 'num_' . $num; - $this->$variable_name = $nums[$num]; - } - } - - $this->num_sql_limit = $this->num_rows * $this->num_columns; - } - - /** - * @param array $nums Array of int for: - * # of rows, # of columns, # of comments, # of contests - */ - public function set_num($nums) - { - if (sizeof($nums) == 4) - { - $this->num_rows = (int) $nums[0]; - $this->num_columns = (int) $nums[1]; - $this->num_comments = (int) $nums[2]; - $this->num_contests = (int) $nums[3]; - $this->num_sql_limit = $this->num_rows * $this->num_columns; - } - } - - /** - * Option to toggle or display the comments by default. - */ - - public function set_toggle($new_toggle) - { - if (is_bool($new_toggle) || ($new_toggle == 0) || ($new_toggle == 1)) - { - $this->toggle_comments = (bool) $new_toggle; - } - } - - /** - * Array of albums the images and comments are pulled from. - * Empty array means all albums. - */ - - public function add_albums($album_id) - { - if (is_array($album_id)) - { - $this->albums = array_unique(array_merge($this->albums, array_map('intval', $album_id))); - } - else if (is_int($album_id) && !in_array($album_id, $this->albums)) - { - $this->albums[] = $album_id; - } - } - public function set_pegas($new_pegas) - { - if (is_bool($new_pegas) || ($new_pegas == 0) || ($new_pegas == 1)) - { - $this->include_pegas = (bool) $new_pegas; - } - } - - public function clear_albums() - { - $this->albums = array(); - } - - public function get_albums() - { - return $this->albums; - } - public function get_pegas() - { - return $this->include_pegas; - } - - /** - * Array of users the images and comments are pulled from. - * Empty array means all users. - */ - - public function add_users($user_id) - { - if (is_array($user_id)) - { - $this->users = array_unique(array_merge($this->users, array_map('intval', $user_id))); - } - else if (is_int($user_id) && !in_array($user_id, $this->users)) - { - $this->users[] = $user_id; - } - } - - public function clear_users() - { - $this->users = array(); - } - - public function get_users() - { - return $this->users; - } - - /** - * Wrapper-function for the total display - */ - public function display() - { - $this->get_album_permissions(); - $this->get_image_ids(); - $this->get_image_data(); - $this->display_images(); - $this->display_comments(); - } - - private function get_album_permissions() - { - $albums_is_empty = !empty($this->albums); - - $this->auth_moderate = $this->gallery_auth->acl_album_ids('m_status', 'array', !$albums_is_empty, $this->get_pegas()); - if ($albums_is_empty) - { - $this->auth_moderate = array_intersect($this->auth_moderate, $this->albums); - } - $this->auth_view = array_diff($this->gallery_auth->acl_album_ids('i_view', 'array', !$albums_is_empty, $this->get_pegas()), $this->auth_moderate); - if ($albums_is_empty) - { - $this->auth_view = array_intersect($this->auth_view, $this->albums); - } - if ($this->gallery_config->get('allow_comments') && ($this->mode & self::MODE_COMMENT) && $this->num_comments) - { - $this->auth_comments = $this->gallery_auth->acl_album_ids('c_read', 'array', !$albums_is_empty, $this->get_pegas()); - if ($albums_is_empty) - { - $this->auth_comments = array_intersect($this->auth_comments, $this->albums); - } - } - - $this->sql_where_auth = '('; - $this->sql_where_auth .= ((!empty($this->auth_view)) ? '(' . $this->db->sql_in_set('image_album_id', $this->auth_view) . ' AND image_status <> ' . $this->gallery_image->get_image_status_unapproved() . ((!empty($this->users)) ? ' AND image_contest = ' . $this->gallery_image->get_no_contest() : '') . ')' : ''); - $this->sql_where_auth .= ((!empty($this->auth_moderate)) ? ((!empty($this->auth_view)) ? ' OR ' : '') . '(' . $this->db->sql_in_set('image_album_id', $this->auth_moderate, false, true) . ')' : ''); - - if ($this->sql_where_auth == '(') - { - // User does not have permissions for any album, so we just return with 1=0 so there is no result: - $this->sql_where_auth = '0 = 1'; - return; - } - $this->sql_where_auth .= (!empty($this->users)) ? ') AND ' . $this->db->sql_in_set('image_user_id', $this->users) : ')'; - } - - /** - * - */ - private function get_image_ids() - { - $this->images = $this->recent_images = $this->random_images = $this->contest_images = array(); - // First step: grab all the IDs we are going to display ... - if ($this->mode & self::MODE_RECENT) - { - $sql = 'SELECT image_id - FROM ' . $this->images_table . ' - WHERE ' . $this->sql_where_auth . ' - AND image_status <> ' . $this->gallery_image->get_status_orphan() . ' - ORDER BY image_time DESC'; - $result = $this->db->sql_query_limit($sql, $this->num_sql_limit); - - while ($row = $this->db->sql_fetchrow($result)) - { - $this->images[] = $row['image_id']; - $this->recent_images[] = $row['image_id']; - } - $this->db->sql_freeresult($result); - } - if ($this->mode & self::MODE_RANDOM) - { - switch ($this->db->get_sql_layer()) - { - case 'postgres': - $random_sql = 'RANDOM()'; - break; - case 'mssql': - case 'mssql_odbc': - $random_sql = 'NEWID()'; - break; - default: - $random_sql = 'RAND()'; - break; - } - - $sql = 'SELECT image_id - FROM ' . $this->images_table . ' - WHERE ' . $this->sql_where_auth . ' - AND image_status <> ' . $this->gallery_image->get_status_orphan() . ' - ORDER BY ' . $random_sql; - $result = $this->db->sql_query_limit($sql, $this->num_sql_limit); - - while ($row = $this->db->sql_fetchrow($result)) - { - $this->images[] = $row['image_id']; - $this->random_images[] = $row['image_id']; - } - $this->db->sql_freeresult($result); - } - if ($this->num_contests) - { - $sql_array = array( - 'SELECT' => 'c.*, a.album_name', - 'FROM' => array($this->contests_table => 'c'), - - 'LEFT_JOIN' => array( - array( - 'FROM' => array($this->albums_table => 'a'), - 'ON' => 'a.album_id = c.contest_album_id', - ), - ), - - 'WHERE' => $this->db->sql_in_set('c.contest_album_id', array_unique(array_merge($this->auth_view, $this->auth_moderate)), false, true) . ' AND c.contest_marked = ' . $this->gallery_image->get_no_contest(), - 'ORDER_BY' => 'c.contest_start + c.contest_end DESC', - ); - $sql = $this->db->sql_build_query('SELECT', $sql_array); - $result = $this->db->sql_query_limit($sql, $this->num_contests); - - while ($row = $this->db->sql_fetchrow($result)) - { - $this->images[] = $row['contest_first']; - $this->images[] = $row['contest_second']; - $this->images[] = $row['contest_third']; - $this->contest_images[$row['contest_id']] = array( - 'album_id' => $row['contest_album_id'], - 'album_name' => $row['album_name'], - 'images' => array($row['contest_first'], $row['contest_second'], $row['contest_third']) - ); - } - $this->db->sql_freeresult($result); - } - $this->images = array_unique($this->images); - } - - private function get_image_data() - { - if (!empty($this->images)) - { - $sql_array = array( - 'SELECT' => 'i.*, a.album_name, a.album_status, a.album_id, a.album_user_id', - 'FROM' => array($this->images_table => 'i'), - - 'LEFT_JOIN' => array( - array( - 'FROM' => array($this->albums_table => 'a'), - 'ON' => 'i.image_album_id = a.album_id', - ), - ), - - 'WHERE' => $this->db->sql_in_set('i.image_id', $this->images, false, true), - 'ORDER_BY' => 'i.image_time DESC', - ); - $sql = $this->db->sql_build_query('SELECT', $sql_array); - $result = $this->db->sql_query($sql); - - while ($row = $this->db->sql_fetchrow($result)) - { - $this->images_data[$row['image_id']] = $row; - } - $this->db->sql_freeresult($result); - } - } - - /** - * Put the images into the template. - */ - private function display_images() - { - if (!empty($this->recent_images)) - { - $this->template->assign_block_vars($this->template_block_images, array( - 'U_BLOCK' => $this->controller_helper->route('phpbbgallery_core_search_recent'), - 'BLOCK_NAME' => $this->user->lang('RECENT_IMAGES'), - )); - foreach ($this->recent_images as $image) - { - phpbb_gallery_image::assign_block($this->template_block_images . '.imagerow.image', $this->images_data[$image], $this->images_data[$image]['album_status'], $this->get_display(), $this->images_data[$image]['album_user_id']); - } - } - - if (!empty($this->random_images)) - { - $num = 0; - $this->template->assign_block_vars($this->template_block_images, array( - 'U_BLOCK' => phpbb_gallery_url::append_sid('search', 'search_id=random'), - 'BLOCK_NAME' => $this->user->lang['RANDOM_IMAGES'], - 'S_COL_WIDTH' => (100 / $this->num_columns) . '%', - 'S_COLS' => $this->num_columns, - )); - foreach ($this->random_images as $image) - { - if (($num % $this->num_columns) == 0) - { - $this->template->assign_block_vars($this->template_block_images . '.imagerow', array()); - } - phpbb_gallery_image::assign_block($this->template_block_images . '.imagerow.image', $this->images_data[$image], $this->images_data[$image]['album_status'], $this->get_display(), $this->images_data[$image]['album_user_id']); - $num++; - } - while (($num % $this->num_columns) > 0) - { - $this->template->assign_block_vars($this->template_block_images . '.imagerow.no_image', array()); - $num++; - } - } - - if (!empty($this->contest_images)) - { - foreach ($this->contest_images as $contest => $contest_data) - { - $num = 0; - $this->template->assign_block_vars($this->template_block_images, array( - 'U_BLOCK' => phpbb_gallery_url::append_sid('album', 'album_id=' . $contest_data['album_id'] . '&sk=ra&sd=d'), - 'BLOCK_NAME' => sprintf($user->lang['CONTEST_WINNERS_OF'], $contest_data['album_name']), - 'S_CONTEST_BLOCK' => true, - 'S_COL_WIDTH' => '33%', - 'S_COLS' => 3, - )); - foreach ($contest_data['images'] as $image) - { - if (($num % phpbb_gallery_contest::NUM_IMAGES) == 0) - { - $this->template->assign_block_vars($this->template_block_images . '.imagerow', array()); - } - if (!empty($this->images_data[$image])) - { - phpbb_gallery_image::assign_block($this->template_block_images . '.imagerow.image', $this->images_data[$image], $this->images_data[$image]['album_status'], $this->get_display(), $this->images_data[$image]['album_user_id']); - $num++; - } - } - while (($num % phpbb_gallery_contest::NUM_IMAGES) > 0) - { - $this->template->assign_block_vars($this->template_block_images . '.imagerow.no_image', array()); - $num++; - } - } - } - - $this->template->assign_vars(array( - 'S_THUMBNAIL_SIZE' => phpbb_gallery_config::get('thumbnail_height') + 20 + ((phpbb_gallery_config::get('thumbnail_infoline')) ? phpbb_gallery_constants::THUMBNAIL_INFO_HEIGHT : 0), - )); - } - - /** - * Query the comments and put them into the template. - */ - private function display_comments() - { - if (empty($this->auth_comments)) - { - return; - } - - global $auth, $db, $template, $user; - $user->add_lang('viewtopic'); - - $sql_array = array( - 'SELECT' => 'c.*, i.*', - 'FROM' => array(GALLERY_COMMENTS_TABLE => 'c'), - - 'LEFT_JOIN' => array( - array( - 'FROM' => array(GALLERY_IMAGES_TABLE => 'i'), - 'ON' => 'c.comment_image_id = i.image_id', - ), - ), - - 'WHERE' => $this->sql_where_auth . ' AND ' . $db->sql_in_set('i.image_album_id', $this->auth_comments, false, true), - 'ORDER_BY' => 'c.comment_id DESC', - ); - $sql = $db->sql_build_query('SELECT', $sql_array); - $result = $db->sql_query_limit($sql, $this->num_comments); - - while ($row = $db->sql_fetchrow($result)) - { - $image_id = (int) $row['image_id']; - $album_id = (int) $row['image_album_id']; - - $template->assign_block_vars($this->template_block_comments, array( - 'U_COMMENT' => phpbb_gallery_url::append_sid('image_page', "album_id=$album_id&image_id=$image_id") . '#comment_' . $row['comment_id'], - 'COMMENT_ID' => $row['comment_id'], - 'TIME' => $user->format_date($row['comment_time']), - 'TEXT' => generate_text_for_display($row['comment'], $row['comment_uid'], $row['comment_bitfield'], 7), - 'U_DELETE' => (phpbb_gallery::$auth->acl_check('m_comments', $album_id) || (phpbb_gallery::$auth->acl_check('c_delete', $album_id) && ($row['comment_user_id'] == $user->data['user_id']) && $user->data['is_registered'])) ? phpbb_gallery_url::append_sid('comment', "album_id=$album_id&image_id=$image_id&mode=delete&comment_id=" . $row['comment_id']) : '', - 'U_QUOTE' => (phpbb_gallery::$auth->acl_check('c_post', $album_id)) ? phpbb_gallery_url::append_sid('comment', "album_id=$album_id&image_id=$image_id&mode=add&comment_id=" . $row['comment_id']) : '', - 'U_EDIT' => (phpbb_gallery::$auth->acl_check('m_comments', $album_id) || (phpbb_gallery::$auth->acl_check('c_edit', $album_id) && ($row['comment_user_id'] == $user->data['user_id']) && $user->data['is_registered'])) ? phpbb_gallery_url::append_sid('comment', "album_id=$album_id&image_id=$image_id&mode=edit&comment_id=" . $row['comment_id']) : '', - 'U_WHOIS' => ($auth->acl_get('a_')) ? phpbb_gallery_url::append_sid('mcp', 'mode=whois&ip=' . $row['comment_user_ip']) : '', - - 'UC_THUMBNAIL' => phpbb_gallery_image::generate_link('thumbnail', phpbb_gallery_config::get('link_thumbnail'), $row['image_id'], $row['image_name'], $row['image_album_id']), - 'UC_IMAGE_NAME' => phpbb_gallery_image::generate_link('image_name', phpbb_gallery_config::get('link_image_name'), $row['image_id'], $row['image_name'], $row['image_album_id']), - 'IMAGE_AUTHOR' => get_username_string('full', $row['image_user_id'], $row['image_username'], $row['image_user_colour']), - 'IMAGE_TIME' => $user->format_date($row['image_time']), - - 'POST_AUTHOR_FULL' => get_username_string('full', $row['comment_user_id'], $row['comment_username'], $row['comment_user_colour']), - 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['comment_user_id'], $row['comment_username'], $row['comment_user_colour']), - 'POST_AUTHOR' => get_username_string('username', $row['comment_user_id'], $row['comment_username'], $row['comment_user_colour']), - 'U_POST_AUTHOR' => get_username_string('profile', $row['comment_user_id'], $row['comment_username'], $row['comment_user_colour']), - )); - } - $db->sql_freeresult($result); - - $template->assign_vars(array( - 'S_COMMENTS' => true, - - 'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_COMMENT'), - 'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_COMMENT'), - 'QUOTE_IMG' => $user->img('icon_post_quote', 'QUOTE_COMMENT'), - 'INFO_IMG' => $user->img('icon_post_info', 'IP'), - 'MINI_POST_IMG' => $user->img('icon_post_target', 'COMMENT'), - 'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE'), - 'COLLAPSE_COMMENTS' => $this->toggle_comments, - )); - } -} diff --git a/core/composer.json b/core/composer.json index 452e2aa38..d349decfd 100644 --- a/core/composer.json +++ b/core/composer.json @@ -26,7 +26,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "extra": { "display-name": "phpBB Gallery", diff --git a/core/contest.php b/core/contest.php index 9f759f292..f620d9d22 100644 --- a/core/contest.php +++ b/core/contest.php @@ -151,9 +151,9 @@ public function end($album_id, $contest_id, $end_time) $sql = 'UPDATE ' . $this->contest_table . ' SET contest_marked = ' . $this->NO_CONTEST . ", - contest_first = $first, - contest_second = $second, - contest_third = $third + contest_first = " . (int) $first . ", + contest_second = " . (int) $second . ", + contest_third = " . (int) $third . " WHERE contest_id = " . (int) $contest_id; $this->db->sql_query($sql); diff --git a/core/controller/album.php b/core/controller/album.php index b050f140f..444e5aea9 100644 --- a/core/controller/album.php +++ b/core/controller/album.php @@ -392,7 +392,7 @@ protected function display_images($album_id, $album_data, $start, $limit) $this->template->assign_block_vars('imageblock.image', array( 'IMAGE_ID' => (int) $image_data['image_id'], 'U_IMAGE' => $action_image, - 'UC_IMAGE_NAME' => $show_imagename ? htmlspecialchars_decode($image_data['image_name'], ENT_COMPAT) : false, + 'UC_IMAGE_NAME' => $show_imagename ? $image_data['image_name'] : false, 'U_ALBUM' => $show_album ? $this->helper->route('phpbbgallery_core_album', array('album_id' => (int) $album_data['album_id'])) : false, 'ALBUM_NAME' => $show_album ? $album_data['album_name'] : false, 'IMAGE_VIEWS' => $show_views ? (int) $image_data['image_view_count'] : -1, diff --git a/core/controller/comment.php b/core/controller/comment.php index 6312818bb..d493bfbbc 100644 --- a/core/controller/comment.php +++ b/core/controller/comment.php @@ -287,7 +287,7 @@ public function add($image_id, $comment_id) $submit = false; } } - if (($comment_plain == '') && !$s_user_rated) + if ($comment_plain == '') { $error .= (($error) ? '
' : '') . $this->language->lang('MISSING_COMMENT'); } @@ -317,7 +317,7 @@ public function add($image_id, $comment_id) 'comment' => $message_parser->message, 'comment_uid' => $message_parser->bbcode_uid, 'comment_bitfield' => $message_parser->bbcode_bitfield, - 'comment_signature' => ($this->auth->acl_get('u_sig') && isset($_POST['attach_sig'])), + 'comment_signature' => ($this->auth->acl_get('u_sig') && $this->request->is_set_post('attach_sig')), ); if ((!$error) && ($sql_ary['comment'] != '')) { @@ -344,7 +344,7 @@ public function add($image_id, $comment_id) { $s_captcha_hidden_fields = ($captcha->is_solved()) ? build_hidden_fields($captcha->get_hidden_fields()) : ''; } - $sig_checked = ($this->auth->acl_get('u_sig') && isset($_POST['attach_sig'])); + $sig_checked = ($this->auth->acl_get('u_sig') && $this->request->is_set_post('attach_sig')); } else { @@ -420,7 +420,26 @@ public function edit($image_id, $comment_id) $submit = $this->request->variable('submit', false); $error = $message = ''; - // load Image Data + $image_backlink = $this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id)); + $login_link = append_sid($this->phpbb_root_path . 'ucp.' . $this->php_ext . '?mode=login'); + if ($comment_id == 0) + { + $this->misc->not_authorised($image_backlink, $login_link); + } + + $sql = 'SELECT * + FROM ' . $this->table_comments . ' + WHERE comment_id = ' . (int) $comment_id; + $result = $this->db->sql_query($sql); + $comment_data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + if (!$comment_data) + { + $this->misc->not_authorised($image_backlink, $login_link); + } + + // Derive the image and album used for permission checks from the comment. + $image_id = (int) $comment_data['comment_image_id']; $image_data = $this->image->get_image_data($image_id); $album_id = (int) $image_data['image_album_id']; $album_data = $this->loader->get($album_id); @@ -429,24 +448,11 @@ public function edit($image_id, $comment_id) $image_backlink = $this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id)); $album_backlink = $this->helper->route('phpbbgallery_core_album', array('album_id' => $album_id)); - $image_loginlink = $this->url->append_sid('relative', 'image_page', "album_id=$album_id&image_id=$image_id"); - $album_loginlink = append_sid($this->phpbb_root_path . 'ucp.' . $this->php_ext . '?mode=login'); - if ($comment_id != 0) - { - $sql = 'SELECT * - FROM ' . $this->table_comments . ' - WHERE comment_id = ' . (int) $comment_id; - $result = $this->db->sql_query($sql); - $comment_data = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - $image_id = (int) $comment_data['comment_image_id']; - } - else - { - $this->misc->not_authorised($image_backlink, $image_loginlink); - } + $image_loginlink = $login_link; + $album_loginlink = $login_link; + $this->gallery_auth->load_user_permissions($this->user->data['user_id']); - if (!$this->gallery_auth->acl_check('c_edit', $album_id, $album_data['album_user_id']) /*&& $mode == 'add'*/) + if (!$this->gallery_auth->acl_check('c_edit', $album_id, $album_data['album_user_id'])) { if (!$this->gallery_auth->acl_check('m_comments', $album_id, $album_data['album_user_id'])) { @@ -567,7 +573,7 @@ public function edit($image_id, $comment_id) 'comment_uid' => $message_parser->bbcode_uid, 'comment_bitfield' => $message_parser->bbcode_bitfield, 'comment_edit_count' => $comment_data['comment_edit_count'] + 1, - 'comment_signature' => ($this->auth->acl_get('u_sig') && isset($_POST['attach_sig'])), + 'comment_signature' => ($this->auth->acl_get('u_sig') && $this->request->is_set_post('attach_sig')), )); if (!$error) @@ -634,7 +640,26 @@ public function delete($image_id, $comment_id) $submit = $this->request->variable('submit', false); $error = $message = ''; - // load Image Data + $image_backlink = $this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id)); + $login_link = append_sid($this->phpbb_root_path . 'ucp.' . $this->php_ext . '?mode=login'); + if ($comment_id == 0) + { + $this->misc->not_authorised($image_backlink, $login_link); + } + + $sql = 'SELECT * + FROM ' . $this->table_comments . ' + WHERE comment_id = ' . (int) $comment_id; + $result = $this->db->sql_query($sql); + $comment_data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + if (!$comment_data) + { + $this->misc->not_authorised($image_backlink, $login_link); + } + + // Derive the image and album used for permission checks from the comment. + $image_id = (int) $comment_data['comment_image_id']; $image_data = $this->image->get_image_data($image_id); $album_id = (int) $image_data['image_album_id']; $album_data = $this->loader->get($album_id); @@ -643,24 +668,11 @@ public function delete($image_id, $comment_id) $image_backlink = $this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id)); $album_backlink = $this->helper->route('phpbbgallery_core_album', array('album_id' => $album_id)); - $image_loginlink = $this->url->append_sid('relative', 'image_page', "album_id=$album_id&image_id=$image_id"); - $album_loginlink = append_sid($this->phpbb_root_path . 'ucp.' . $this->php_ext . '?mode=login'); - if ($comment_id != 0) - { - $sql = 'SELECT * - FROM ' . $this->table_comments . ' - WHERE comment_id = ' . (int) $comment_id; - $result = $this->db->sql_query($sql); - $comment_data = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - $image_id = (int) $comment_data['comment_image_id']; - } - else - { - $this->misc->not_authorised($image_backlink, $image_loginlink); - } + $image_loginlink = $login_link; + $album_loginlink = $login_link; + $this->gallery_auth->load_user_permissions($this->user->data['user_id']); - if (!$this->gallery_auth->acl_check('c_edit', $album_id, $album_data['album_user_id']) /*&& $mode == 'add'*/) + if (!$this->gallery_auth->acl_check('c_edit', $album_id, $album_data['album_user_id'])) { if (!$this->gallery_auth->acl_check('m_comments', $album_id, $album_data['album_user_id'])) { @@ -737,7 +749,7 @@ public function delete($image_id, $comment_id) } else { - if (isset($_POST['cancel'])) + if ($this->request->is_set_post('cancel')) { $message = $this->language->lang('DELETED_COMMENT_NOT') . '
'; $submit = true; @@ -782,7 +794,11 @@ public function rate($image_id) $this->language->add_lang(array('gallery'), 'phpbbgallery/core'); add_form_key('gallery'); - $submit = $this->request->variable('submit', false); + $rate_submitted = $this->request->is_set_post('rating'); + if ($rate_submitted && !check_form_key('gallery')) + { + trigger_error('FORM_INVALID'); + } $error = $message = ''; // load Image Data $image_data = $this->image->get_image_data($image_id); @@ -842,7 +858,7 @@ public function rate($image_id) // User just rated the image, so we store it $rate_point = $this->request->variable('rating', 0); - if ($rating->rating_enabled && $rate_point > 0) + if ($rate_submitted && $rating->rating_enabled && $rate_point > 0) { $rating->submit_rating(); $s_user_rated = true; diff --git a/core/controller/image.php b/core/controller/image.php index 3d894851f..b28d24b78 100644 --- a/core/controller/image.php +++ b/core/controller/image.php @@ -270,7 +270,7 @@ public function base($image_id, $page = 0) else { $user_id = (int) $this->user->data['user_id']; - $image_status_check = ' AND (image_status = ' . (int) \phpbbgallery\core\block::STATUS_APPROVED . ' OR image_user_id = ' . $user_id . ')'; + $image_status_check = '(image_status = ' . (int) \phpbbgallery\core\block::STATUS_APPROVED . ' OR image_user_id = ' . $user_id . ')'; } if (!$this->user->data['is_bot'] && isset($this->user->data['session_page']) && (strpos($this->user->data['session_page'], '&image_id=' . $image_id) === false || isset($this->user->data['session_created']))) @@ -321,15 +321,6 @@ public function base($image_id, $page = 0) $sort_key = $this->request->variable('sk', ($album_data['album_sort_key']) ? $album_data['album_sort_key'] : $this->config['phpbb_gallery_default_sort_key']); $sort_dir = $this->request->variable('sd', ($album_data['album_sort_dir']) ? $album_data['album_sort_dir'] : $this->config['phpbb_gallery_default_sort_dir']); - if (in_array($sort_key, array('r', 'ra'))) - { - $sql_help_sort = ', image_id ' . (($sort_dir == 'd') ? 'ASC' : 'DESC'); - } - else - { - $sql_help_sort = ', image_id ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); - } - $limit_days = array(); $sort_by_text = array( 't' => $this->language->lang('TIME'), @@ -358,17 +349,42 @@ public function base($image_id, $page = 0) $sort_by_text['lc'] = $this->language->lang('NEW_COMMENT'); $sort_by_sql['lc'] = 'image_last_comment'; } + if (!isset($sort_by_sql[$sort_key])) + { + $sort_key = 't'; + } + if (!in_array($sort_dir, array('a', 'd'), true)) + { + $sort_dir = 'd'; + } + if (in_array($sort_key, array('r', 'ra'), true)) + { + $sql_help_sort = ', image_id ' . (($sort_dir == 'd') ? 'ASC' : 'DESC'); + } + else + { + $sql_help_sort = ', image_id ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + } gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); $sql_sort_order .= $sql_help_sort; // Let's see if there is previous image - $sql = 'SELECT * - FROM ' . $this->table_images . ' - WHERE image_album_id = ' . (int) $album_id . ' - AND image_status <> ' . (int) \phpbbgallery\core\block::STATUS_ORPHAN . ' - ' . $image_status_check . ' - ORDER BY ' . $sql_sort_order . $sql_help_sort; + $sql_conditions = array( + 'image_album_id = ' . (int) $album_id, + 'image_status <> ' . (int) \phpbbgallery\core\block::STATUS_ORPHAN, + ); + if ($image_status_check) + { + $sql_conditions[] = $image_status_check; + } + $sql_array = array( + 'SELECT' => '*', + 'FROM' => array($this->table_images => 'i'), + 'WHERE' => implode(' AND ', $sql_conditions), + 'ORDER_BY' => $sql_sort_order, + ); + $sql = $this->db->sql_build_query('SELECT', $sql_array); $result = $this->db->sql_query($sql); $images_array = []; while ($row = $this->db->sql_fetchrow($result)) @@ -401,8 +417,8 @@ public function base($image_id, $page = 0) $this->db->sql_freeresult($result); $this->template->assign_vars(array( - 'UC_NEXT_IMAGE' => ($next ? ($this->gallery_config->get('disp_nextprev_thumbnail') ? '' . htmlspecialchars_decode($next['image_name'], ENT_COMPAT) . '' : '' . htmlspecialchars_decode($next['image_name'], ENT_COMPAT) . ' »»') : ''), - 'UC_PREV_IMAGE' => ($prev ? ($this->gallery_config->get('disp_nextprev_thumbnail') ? '' . htmlspecialchars_decode($prev['image_name'], ENT_COMPAT) . '' : '«« ' . htmlspecialchars_decode($prev['image_name'], ENT_COMPAT) . '') : ''), + 'UC_NEXT_IMAGE' => ($next ? ($this->gallery_config->get('disp_nextprev_thumbnail') ? '' . $next['image_name'] . '' : '' . $next['image_name'] . ' »»') : ''), + 'UC_PREV_IMAGE' => ($prev ? ($this->gallery_config->get('disp_nextprev_thumbnail') ? '' . $prev['image_name'] . '' : '«« ' . $prev['image_name'] . '') : ''), 'U_VIEW_ALBUM' => $this->helper->route('phpbbgallery_core_album', array('album_id' => $album_id)), 'UC_IMAGE' => $this->helper->route('phpbbgallery_core_image_file_medium', array('image_id' => (int) $image_id)), //'UC_IMAGE_ACTION' => $this->gallery_config->get('link_imagepage') == 'none' ? '' : $this->gallery_config->get('link_imagepage') == 'image' ? $this->helper->route('phpbbgallery_core_image_file_source', array('image_id' => $image_id)) : $next && $this->gallery_config->get('link_imagepage') == 'next' ? $this->helper->route('phpbbgallery_core_image', array('image_id' => $next['image_id'])) : '', @@ -413,7 +429,7 @@ public function base($image_id, $page = 0) 'U_STATUS' => ($s_allowed_status) ? $this->helper->route('phpbbgallery_core_moderate_image', array('image_id' => $image_id)) : '', 'CONTEST_RANK' => ($this->data['image_contest_rank']) ? $this->language->lang('CONTEST_RESULT_' . $this->data['image_contest_rank']) : '', - 'IMAGE_NAME' => htmlspecialchars_decode($this->data['image_name'], ENT_COMPAT), + 'IMAGE_NAME' => $this->data['image_name'], 'IMAGE_DESC' => $image_desc, 'IMAGE_BBCODE' => ($this->config['allow_bbcode']) ? '[image]' . (int) $image_id . '[/image]' : '', 'IMAGE_IMGURL_BBCODE' => ($this->config['phpbb_gallery_disp_image_url']) ? '[url=' . $this->url->get_uri($this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id))) . '][img]' . $this->url->get_uri($this->helper->route('phpbbgallery_core_image_file_mini', array('image_id' => $image_id))) . '[/img][/url]' : '', @@ -484,8 +500,8 @@ public function base($image_id, $page = 0) 'POSTER_WARNINGS' => $user_data['warnings'] ?? 0, 'POSTER_AGE' => $user_data['age'] ?? '', - 'POSTER_ONLINE_IMG' => ($user_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? '' : ($user_data['online'] ? $this->user->img('icon_user_online', 'ONLINE') : $this->user->img('icon_user_offline', 'OFFLINE')), - 'S_POSTER_ONLINE' => ($user_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? false : $user_data['online'], + 'POSTER_ONLINE_IMG' => ($user_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? '' : (($user_data['online'] ?? false) ? $this->user->img('icon_user_online', 'ONLINE') : $this->user->img('icon_user_offline', 'OFFLINE')), + 'S_POSTER_ONLINE' => ($user_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? false : ($user_data['online'] ?? false), //'U_POSTER_PROFILE' => $user_data['profile'] ?? '', 'U_POSTER_SEARCH' => $user_data['search'] ?? '', @@ -730,8 +746,8 @@ protected function display_comments($image_id, $image_data, $album_id, $album_da // 'MINI_POST_IMG' => $this->user->img('icon_post_target', 'POST'), // 'ICQ_STATUS_IMG' => isset($user_data['icq_status_img']) ? $user_data['icq_status_img'] : '', - 'POSTER_ONLINE_IMG' => ($poster_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? '' : ($user_deleted ? '' : ($user_data['online'] ? $this->user->img('icon_user_online', 'ONLINE') : $this->user->img('icon_user_offline', 'OFFLINE'))), - 'S_POSTER_ONLINE' => ($poster_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? false : ($user_deleted ? '' : $user_data['online']), + 'POSTER_ONLINE_IMG' => ($poster_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? '' : ($user_deleted ? '' : (($user_data['online'] ?? false) ? $this->user->img('icon_user_online', 'ONLINE') : $this->user->img('icon_user_offline', 'OFFLINE'))), + 'S_POSTER_ONLINE' => ($poster_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? false : ($user_deleted ? '' : ($user_data['online'] ?? false)), 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false, ); @@ -825,7 +841,7 @@ public function edit($image_id) $owner_id = $image_data['image_user_id']; $album_loginlink = './ucp.php?mode=login'; $this->gallery_auth->load_user_permissions($this->user->data['user_id']); - if (!$this->gallery_auth->acl_check('i_edit', $album_id, $album_data['album_user_id']) || ($image_data['image_status'] == (int) \phpbbgallery\core\block::STATUS_ORPHAN)) + if ((int) $owner_id !== (int) $this->user->data['user_id'] || !$this->gallery_auth->acl_check('i_edit', $album_id, $album_data['album_user_id']) || ($image_data['image_status'] == (int) \phpbbgallery\core\block::STATUS_ORPHAN)) { if (!$this->gallery_auth->acl_check('m_edit', $album_id, $album_data['album_user_id'])) { @@ -1067,7 +1083,7 @@ public function delete($image_id) $image_backlink = $this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id)); $album_backlink = $this->helper->route('phpbbgallery_core_album', array('album_id' => $image_data['image_album_id'])); $this->gallery_auth->load_user_permissions($this->user->data['user_id']); - if (!$this->gallery_auth->acl_check('i_delete', $album_id, $album_data['album_user_id']) || ($image_data['image_status'] == (int) \phpbbgallery\core\block::STATUS_ORPHAN)) + if ((int) $image_data['image_user_id'] !== (int) $this->user->data['user_id'] || !$this->gallery_auth->acl_check('i_delete', $album_id, $album_data['album_user_id']) || ($image_data['image_status'] == (int) \phpbbgallery\core\block::STATUS_ORPHAN)) { if (!$this->gallery_auth->acl_check('m_delete', $album_id, $album_data['album_user_id'])) { @@ -1083,7 +1099,7 @@ public function delete($image_id) if (confirm_box(true)) { $this->image->handle_counter($image_id, false); - $this->moderate->delete_images(array($image_id), array($image_id => $image_data['image_filename'])); + $this->moderate->delete_images(array($image_id), array($image_id => $image_data['image_filename']), $album_id); $this->album->update_info($album_id); $message = $this->language->lang('DELETED_IMAGE') . '
'; @@ -1100,7 +1116,7 @@ public function delete($image_id) } else { - if (isset($_POST['cancel'])) + if ($this->request->is_set_post('cancel')) { $message = $this->language->lang('DELETED_IMAGE_NOT') . '
'; $message .= '
' . sprintf($this->language->lang('CLICK_RETURN_IMAGE'), '', ''); diff --git a/core/controller/index.php b/core/controller/index.php index 1912cdd46..df5a0ea2b 100644 --- a/core/controller/index.php +++ b/core/controller/index.php @@ -310,11 +310,29 @@ protected function assign_dropdown_links($base_route) $show_random = (bool) ($show_options & self::RRC_MODE_RANDOM_IMAGES); $show_recent = (bool) ($show_options & self::RRC_MODE_RECENT_IMAGES); + $newest_pega = ''; + if ($this->gallery_config->get('num_pegas')) + { + $newest_pega_username = utf8_htmlspecialchars(html_entity_decode((string) $this->gallery_config->get('newest_pega_username'), ENT_QUOTES, 'UTF-8')); + $newest_pega_user_colour = (string) $this->gallery_config->get('newest_pega_user_colour'); + if (!preg_match('/^[0-9a-f]{6}$/i', $newest_pega_user_colour)) + { + $newest_pega_user_colour = ''; + } + + $newest_pega = sprintf( + $this->language->lang('NEWEST_PGALLERY'), + '' . + get_username_string('no_profile', (int) $this->gallery_config->get('newest_pega_user_id'), $newest_pega_username, $newest_pega_user_colour) . + '' + ); + } + $this->template->assign_vars(array( 'TOTAL_IMAGES' => ($this->gallery_config->get('disp_statistic')) ? $this->language->lang('TOTAL_IMAGES_SPRINTF', $this->gallery_config->get('num_images')) : '', 'TOTAL_COMMENTS' => ($this->gallery_config->get('allow_comments')) ? $this->language->lang('TOTAL_COMMENTS_SPRINTF', $this->gallery_config->get('num_comments')) : '', 'TOTAL_PGALLERIES' => ($this->gallery_auth->acl_check('a_list', \phpbbgallery\core\auth\auth::PERSONAL_ALBUM)) ? $this->language->lang('TOTAL_PEGAS_SPRINTF', $this->gallery_config->get('num_pegas')) : '', - 'NEWEST_PGALLERIES' => ($this->gallery_config->get('num_pegas')) ? sprintf($this->language->lang('NEWEST_PGALLERY'), 'gallery_config->get('newest_pega_user_colour') ? 'class="username-coloured" style="color: #' . $this->gallery_config->get('newest_pega_user_colour') . ';"' : 'class="username"') . '>' . $this->gallery_config->get('newest_pega_username') . '') : '', + 'NEWEST_PGALLERIES' => $newest_pega, )); $this->template->assign_vars(array( diff --git a/core/controller/moderate.php b/core/controller/moderate.php index d201c2f49..2e87718a1 100644 --- a/core/controller/moderate.php +++ b/core/controller/moderate.php @@ -133,6 +133,63 @@ public function __construct(\phpbb\config\config $config, \phpbb\request\request $this->php_ext = $php_ext; } + /** + * Require a moderator permission on a concrete album. + * + * @param string $permission + * @param int $album_id + * @return array + */ + protected function require_album_permission($permission, $album_id) + { + $album_id = (int) $album_id; + $album_data = $this->album->get_info($album_id); + if (!$album_data || !$this->gallery_auth->acl_check($permission, $album_id, $album_data['album_user_id'])) + { + $back_link = $this->helper->route('phpbbgallery_core_moderate'); + $login_link = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); + $this->misc->not_authorised($back_link, $login_link, 'LOGIN_EXPLAIN_UPLOAD'); + } + + return $album_data; + } + + /** + * Resolve client-supplied image IDs to their real albums and authorize each album. + * + * @param array|int $image_ids + * @param string $permission + * @param int $route_album_id + * @return array Album ID => image IDs + */ + protected function get_authorized_image_groups($image_ids, $permission, $route_album_id = 0) + { + $groups = array(); + foreach (array_unique(array_map('intval', (array) $image_ids)) as $image_id) + { + $image_data = $this->image->get_image_data($image_id); + if (!$image_data || (int) $image_data['image_status'] === (int) \phpbbgallery\core\block::STATUS_ORPHAN) + { + continue; + } + + $source_album_id = (int) $image_data['image_album_id']; + if ($route_album_id && $source_album_id !== (int) $route_album_id) + { + $this->require_album_permission($permission, $source_album_id); + continue; + } + if (!isset($groups[$source_album_id])) + { + $this->require_album_permission($permission, $source_album_id); + $groups[$source_album_id] = array(); + } + $groups[$source_album_id][] = $image_id; + } + + return $groups; + } + /** * Index Controller * Route: gallery/moderate @@ -195,6 +252,7 @@ public function queue_approve($page, $album_id) { $approve_ary = $this->request->variable('approval', array('' => array(0))); $action_ary = $this->request->variable('action', array('' => 0)); + $action = ''; $back_link = $this->request->variable('back_link', $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_queue_approve_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_queue_approve')); foreach ($action_ary as $act => $garb) { @@ -222,17 +280,24 @@ public function queue_approve($page, $album_id) $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); } } - if (!empty($approve_ary)) + $submitted_ids = array(); + foreach ($approve_ary as $approve_array) + { + $submitted_ids = array_merge($submitted_ids, $approve_array); + } + $submitted_ids = array_values(array_filter(array_map('intval', $submitted_ids))); + if (!empty($submitted_ids)) { + $image_groups = $this->get_authorized_image_groups($submitted_ids, 'm_status', $album_id); if (confirm_box(true)) { + $count = 0; if ($action == 'approve') { - $count = 0; - foreach ($approve_ary as $album_id => $approve_array) + foreach ($image_groups as $source_album_id => $approve_array) { - $this->image->approve_images($approve_array, $album_id); - $this->album->update_info($album_id); + $this->image->approve_images($approve_array, $source_album_id); + $this->album->update_info($source_album_id); $count = $count + count($approve_array); } @@ -242,17 +307,16 @@ public function queue_approve($page, $album_id) } if ($action == 'disapprove') { - $count = 0; - foreach ($approve_ary as $album_id => $delete_array) + foreach ($image_groups as $source_album_id => $delete_array) { // Let's load info for images, so we can $filenames = $this->image->get_filenames($delete_array); // Let's log the action foreach ($filenames as $name) { - $this->gallery_log->add_log('moderator', 'disapprove', $album_id, 0, array('LOG_GALLERY_DISAPPROVED', $name)); + $this->gallery_log->add_log('moderator', 'disapprove', $source_album_id, 0, array('LOG_GALLERY_DISAPPROVED', $name)); } - $this->moderate->delete_images($delete_array); + $this->moderate->delete_images($delete_array, array(), $source_album_id); $count = $count + count($delete_array); } $message = $this->language->lang('WAITING_DISAPPROVED_IMAGE', $count); @@ -342,8 +406,9 @@ public function action_log($page, $album_id) */ public function reports($page, $album_id, $status) { - $report_ary = $this->request->variable('report', array(0)); + $report_ary = array_values(array_filter(array_map('intval', $this->request->variable('report', array(0))))); $action_ary = $this->request->variable('action', array('' => 0)); + $action = ''; $back_link = $this->request->variable('back_link', $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_reports_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_reports')); foreach ($action_ary as $act => $garb) { @@ -352,13 +417,34 @@ public function reports($page, $album_id, $status) $this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); $this->language->add_lang('mcp'); + $this->gallery_auth->load_user_permissions($this->user->data['user_id']); + $album_backlink = $album_id === 0 ? $this->helper->route('phpbbgallery_core_moderate') : $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)); + $album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); + if ($album_id === 0) + { + if (!$this->gallery_auth->acl_check_global('m_report')) + { + $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); + } + $album = array(); + } + else + { + $album = $this->require_album_permission('m_report', $album_id); + } + $report_groups = $this->get_authorized_image_groups($report_ary, 'm_report', $album_id); if (!empty($report_ary)) { if (confirm_box(true)) { - $this->report->close_reports_by_image($report_ary); - $message = $this->language->lang('WAITING_REPORTED_DONE', count($report_ary)); + $count = 0; + foreach ($report_groups as $image_ids) + { + $this->report->close_reports_by_image($image_ids); + $count += count($image_ids); + } + $message = $this->language->lang('WAITING_REPORTED_DONE', $count); $this->url->meta_refresh(3, $back_link); trigger_error($message); } @@ -373,25 +459,6 @@ public function reports($page, $album_id, $status) confirm_box(false, $this->language->lang('REPORTS_A_CLOSE2_CONFIRM'), $s_hidden_fields); } } - $this->gallery_auth->load_user_permissions($this->user->data['user_id']); - $album_backlink = $album_id === 0 ? $this->helper->route('phpbbgallery_core_moderate') : $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)); - $album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); - if ($album_id === 0) - { - if (!$this->gallery_auth->acl_check_global('m_report')) - { - $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); - } - } - else - { - $album = $this->album->get_info($album_id); - if (!$this->gallery_auth->acl_check('m_report', $album['album_id'], $album['album_user_id'])) - { - $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); - } - } - $this->template->assign_vars(array( 'U_GALLERY_MODERATE_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate'), 'U_GALLERY_MODERATE_APPROVE' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_queue_approve_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_queue_approve'), @@ -420,13 +487,60 @@ public function album_overview($album_id, $page) $this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); $this->language->add_lang('mcp'); - $actions_array = $this->request->variable('action', array(0)); + $actions_array = array_values(array_filter(array_map('intval', $this->request->variable('action', array(0))))); $action = $this->request->variable('select_action', ''); $back_link = $this->request->variable('back_link', $this->helper->route('phpbbgallery_core_moderate_view', array('album_id' => $album_id))); - $moving_target = $this->request->variable('moving_target', ''); + $moving_target = $this->request->variable('moving_target', 0); + $this->gallery_auth->load_user_permissions($this->user->data['user_id']); + $album = $this->require_album_permission('m_', $album_id); if (!empty($actions_array)) { - if (confirm_box(true) || $moving_target) + $permission_map = array( + 'approve' => 'm_status', + 'unapprove' => 'm_status', + 'lock' => 'm_status', + 'delete' => 'm_delete', + 'move' => 'm_move', + 'report' => 'm_report', + ); + if (!isset($permission_map[$action])) + { + trigger_error('NO_MODE'); + } + $image_groups = $this->get_authorized_image_groups($actions_array, $permission_map[$action], $album_id); + $actions_array = isset($image_groups[$album_id]) ? $image_groups[$album_id] : array(); + if (empty($actions_array)) + { + trigger_error('NO_IMAGES'); + } + if ($action === 'move' && $moving_target) + { + $this->require_album_permission('m_move', $moving_target); + } + + $s_hidden_fields = ''; + $s_hidden_fields .= ''; + foreach ($actions_array as $var) + { + $s_hidden_fields .= ''; + } + if ($moving_target) + { + $s_hidden_fields .= ''; + } + + if ($action === 'move' && !$moving_target) + { + $category_select = $this->album->get_albumbox(false, 'moving_target', $album_id, 'm_move', $album_id); + $this->template->assign_vars(array( + 'S_MOVING_IMAGES' => true, + 'S_ALBUM_SELECT' => $category_select, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + )); + return $this->helper->render('gallery/mcp_body.html', $this->language->lang('GALLERY')); + } + + if (confirm_box(true)) { $message = ''; switch ($action) @@ -450,13 +564,13 @@ public function album_overview($album_id, $page) break; case 'delete': - $this->moderate->delete_images($actions_array); + $this->moderate->delete_images($actions_array, array(), $album_id); $this->album->update_info($album_id); $message = $this->language->lang('DELETED_IMAGES', count($actions_array)); break; case 'move': - $this->image->move_image($actions_array, $moving_target); + $this->image->move_image($actions_array, $moving_target, $album_id); $this->album->update_info($album_id); $this->album->update_info($moving_target); $message = $this->language->lang('MOVED_IMAGES', count($actions_array)); @@ -476,50 +590,16 @@ public function album_overview($album_id, $page) } else { - $s_hidden_fields = ''; - $s_hidden_fields .= ''; - foreach ($actions_array as $var) - { - $s_hidden_fields .= ''; - } if ($action == 'report') { confirm_box(false, $this->language->lang('REPORT_A_CLOSE2_CONFIRM'), $s_hidden_fields); } - if ($action == 'move') - { - $category_select = $this->album->get_albumbox(false, 'moving_target', $album_id, 'm_move', $album_id); - $this->template->assign_vars(array( - 'S_MOVING_IMAGES' => true, - 'S_ALBUM_SELECT' => $category_select, - 'S_HIDDEN_FIELDS' => $s_hidden_fields, - )); - return $this->helper->render('gallery/mcp_body.html', $this->language->lang('GALLERY')); - } else { confirm_box(false, $this->language->lang('QUEUES_A_' . strtoupper($action) . '2_CONFIRM'), $s_hidden_fields); } } } - $this->gallery_auth->load_user_permissions($this->user->data['user_id']); - $album_backlink = $album_id === 0 ? $this->helper->route('phpbbgallery_core_moderate') : $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)); - $album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); - if ($album_id === 0) - { - if (!$this->gallery_auth->acl_check_global('m_')) - { - $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); - } - } - else - { - $album = $this->album->get_info($album_id); - if (!$this->gallery_auth->acl_check('m_', $album['album_id'], $album['album_user_id'])) - { - $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); - } - } $this->template->assign_vars(array( 'U_GALLERY_MODERATE_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate'), 'U_GALLERY_MODERATE_APPROVE' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_queue_approve_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_queue_approve'), @@ -543,6 +623,14 @@ public function image($image_id) { $this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); $this->language->add_lang('mcp'); + $image_data = $this->image->get_image_data($image_id); + if (!$image_data) + { + trigger_error('NO_IMAGE'); + } + $album_data = $this->album->get_info($image_data['image_album_id']); + $this->gallery_auth->load_user_permissions($this->user->data['user_id']); + $this->require_album_permission('m_', $image_data['image_album_id']); $quick_action = $this->request->variable('action', ''); // If we have quick mode (EDIT, DELETE) just send us to the page we need @@ -550,35 +638,24 @@ public function image($image_id) { case 'images_move': $route = $this->helper->route('phpbbgallery_core_moderate_image_move', array('image_id' => $image_id)); - $redirect = new RedirectResponse($route); - $redirect->send(); - break; + return new RedirectResponse($route); case 'image_edit': $route = $this->helper->route('phpbbgallery_core_image_edit', array('image_id' => $image_id)); - $redirect = new RedirectResponse($route); - $redirect->send(); - break; + return new RedirectResponse($route); case 'images_unapprove': $route = $this->helper->route('phpbbgallery_core_moderate_image_unapprove', array('image_id' => $image_id)); - $redirect = new RedirectResponse($route); - $redirect->send(); - break; + return new RedirectResponse($route); case 'images_approve': $route = $this->helper->route('phpbbgallery_core_moderate_image_approve', array('image_id' => $image_id)); - $redirect = new RedirectResponse($route); - $redirect->send(); - break; + return new RedirectResponse($route); case 'images_lock': $route = $this->helper->route('phpbbgallery_core_moderate_image_lock', array('image_id' => $image_id)); - $redirect = new RedirectResponse($route); - $redirect->send(); - break; + return new RedirectResponse($route); case 'images_delete': $route = $this->helper->route('phpbbgallery_core_image_delete', array('image_id' => $image_id)); - $redirect = new RedirectResponse($route); - $redirect->send(); - break; + return new RedirectResponse($route); case 'reports_close': + $this->require_album_permission('m_report', $image_data['image_album_id']); if (confirm_box(true)) { $back_link = $this->helper->route('phpbbgallery_core_moderate_image', array('image_id' => $image_id)); @@ -595,12 +672,8 @@ public function image($image_id) break; case 'reports_open': $route = $this->helper->route('phpbbgallery_core_image_report', array('image_id' => $image_id)); - $redirect = new RedirectResponse($route); - $redirect->send(); - break; + return new RedirectResponse($route); } - $image_data = $this->image->get_image_data($image_id); - $album_data = $this->album->get_info($image_data['image_album_id']); $users_array = $report_data = array(); $open_report = false; $report_data = $this->report->get_data_by_image($image_id); @@ -617,7 +690,6 @@ public function image($image_id) $this->user_loader->load_users(array_keys($users_array)); // Now let's get some ACL $select_select = ''; - $this->gallery_auth->load_user_permissions($this->user->data['user_id']); if ($this->gallery_auth->acl_check('m_status', $album_data['album_id'], $album_data['album_user_id'])) { if ($image_data['image_status'] == 0) @@ -709,8 +781,7 @@ public function approve($image_id) if ($action === 'disapprove') { - $redirect = new RedirectResponse($this->helper->route('phpbbgallery_core_image_delete', ['image_id' => $image_id])); - $redirect->send(); + return new RedirectResponse($this->helper->route('phpbbgallery_core_image_delete', ['image_id' => $image_id])); } $show_notify = true; $this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); @@ -808,17 +879,25 @@ public function move($image_id): \Symfony\Component\HttpFoundation\Response { $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); } - $moving_target = $this->request->variable('moving_target', ''); + $moving_target = $this->request->variable('moving_target', 0); if ($moving_target) { - $target = array($image_id); - $this->image->move_image($target, $moving_target); - $message = sprintf($this->language->lang('IMAGES_MOVED', 1)); - $this->album->update_info($album_id); - $this->album->update_info($moving_target); - meta_refresh($meta_refresh_time, $image_backlink); - trigger_error($message); + $this->require_album_permission('m_move', $moving_target); + $s_hidden_fields = build_hidden_fields(array( + 'moving_target' => $moving_target, + )); + if (confirm_box(true)) + { + $target = array($image_id); + $this->image->move_image($target, $moving_target, $album_id); + $message = sprintf($this->language->lang('IMAGES_MOVED', 1)); + $this->album->update_info($album_id); + $this->album->update_info($moving_target); + meta_refresh($meta_refresh_time, $image_backlink); + trigger_error($message); + } + confirm_box(false, $this->language->lang('QUEUES_A_MOVE2_CONFIRM'), $s_hidden_fields); } else { diff --git a/core/controller/search.php b/core/controller/search.php index fbcc6de2b..b221932e0 100644 --- a/core/controller/search.php +++ b/core/controller/search.php @@ -187,6 +187,14 @@ public function base($page = 1) $sort_by_text['lc'] = $this->language->lang('NEW_COMMENT'); $sort_by_sql['lc'] = 'image_last_comment'; } + if (!isset($sort_by_sql[$sort_key])) + { + $sort_key = 't'; + } + if (!in_array($sort_dir, array('a', 'd'), true)) + { + $sort_dir = 'd'; + } $this->gallery_auth->load_user_permissions($this->user->data['user_id']); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; @@ -200,6 +208,7 @@ public function base($page = 1) ); if ($keywords || $username || $user_id || $search_id || $submit) { + $user_id_ary = array(); // Let's resolve username to user id ... or array of them. if ($username) { @@ -214,7 +223,6 @@ public function base($page = 1) AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')'; $result = $this->db->sql_query_limit($sql, 100); - $user_id_ary = []; while ($row = $this->db->sql_fetchrow($result)) { $user_id_ary[] = (int) $row['user_id']; @@ -272,14 +280,12 @@ public function base($page = 1) } $sql_where[] = $search_query; - if (empty($search_album)) - { - $sql_where[] = $this->db->sql_in_set('i.image_album_id', $this->gallery_auth->acl_album_ids('i_view')); - } - else - { - $sql_where[] = $this->db->sql_in_set('i.image_album_id', $search_album); - } + $view_album_ids = array_map('intval', $this->gallery_auth->acl_album_ids('i_view')); + $requested_album_ids = array_filter(array_map('intval', $search_album)); + $search_album = empty($requested_album_ids) ? $view_album_ids : array_values(array_intersect($requested_album_ids, $view_album_ids)); + $sql_where[] = $this->db->sql_in_set('i.image_album_id', $search_album, false, true); + $sql_where[] = 'i.image_status <> ' . (int) \phpbbgallery\core\block::STATUS_UNAPPROVED; + $sql_where[] = 'i.image_status <> ' . (int) \phpbbgallery\core\block::STATUS_ORPHAN; $sql_array['WHERE'] = implode(' and ', array_filter($sql_where)); $sql_array['SELECT'] = 'COUNT(i.image_id) as count'; @@ -293,7 +299,7 @@ public function base($page = 1) { trigger_error('NO_SEARCH_RESULTS'); } - $sql_array['SELECT'] = '*, a.album_name, a.album_status, a.album_user_id, a.album_id'; + $sql_array['SELECT'] = 'i.*, a.album_name, a.album_status, a.album_user_id, a.album_id'; $sql_array['LEFT_JOIN'] = array( array( 'FROM' => array($this->albums_table => 'a'), @@ -301,7 +307,6 @@ public function base($page = 1) ) ); $sql_array['ORDER_BY'] = $sql_order; - $sql_array['GROUP_BY'] = $sort_by_sql[$sort_key] . ', i.image_id, a.album_id'; $sql = $this->db->sql_build_query('SELECT', $sql_array); $result = $this->db->sql_query_limit($sql, $this->gallery_config->get('items_per_page'), $start); diff --git a/core/controller/upload.php b/core/controller/upload.php index 9bd929da5..b958272e9 100644 --- a/core/controller/upload.php +++ b/core/controller/upload.php @@ -170,7 +170,7 @@ public function main($album_id) $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); } } - $page_title = 'Upload to "' . $album_data['album_name'] . '"'; + $page_title = $this->language->lang('UPLOAD_TO_ALBUM', $album_data['album_name']); // Before all if (!$this->check_fs()) @@ -184,6 +184,10 @@ public function main($album_id) // Anons should suffer. if ($this->request->is_ajax() && $this->user->data['is_registered']) { + if (!check_form_key('gallery')) + { + trigger_error('FORM_INVALID'); + } // So we use ajax request to upload (so we are going to copy some functions from other upload // Upload Quota Check // 1. Check album-configuration Quota diff --git a/core/ext.php b/core/ext.php index 43bf60f55..b61277722 100644 --- a/core/ext.php +++ b/core/ext.php @@ -74,7 +74,7 @@ function disable_step($old_state) $phpbb_notifications = $this->container->get('notification_manager'); $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.image_for_approval'); $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.image_approved'); - $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.image_not_approve'); + $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.image_not_approved'); $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.new_comment'); $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.new_image'); $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.new_report'); diff --git a/core/file/file.php b/core/file/file.php index 7999e46aa..f71930d24 100644 --- a/core/file/file.php +++ b/core/file/file.php @@ -253,8 +253,7 @@ public function write_image($destination, $quality = -1, $destroy_image = false) */ public function header_filename($file) { - $raw = $this->request->server('HTTP_USER_AGENT'); - $user_agent = htmlspecialchars($raw); + $user_agent = $this->request->server('HTTP_USER_AGENT'); // There be dragons here. // Not many follows the RFC... diff --git a/core/image/image.php b/core/image/image.php index 435cbcea7..6fdcd67dd 100644 --- a/core/image/image.php +++ b/core/image/image.php @@ -468,6 +468,38 @@ public function get_image_data($image_id) } } + /** + * Return non-orphan image IDs that actually belong to an album. + * + * @param array|int $image_ids + * @param int $album_id + * @return array + */ + public function get_image_ids_by_album($image_ids, $album_id) + { + $image_ids = array_values(array_unique(array_map('intval', (array) $image_ids))); + $album_id = (int) $album_id; + if (empty($image_ids) || !$album_id) + { + return array(); + } + + $sql = 'SELECT image_id + FROM ' . $this->table_images . ' + WHERE image_album_id = ' . (int) $album_id . ' + AND image_status <> ' . (int) \phpbbgallery\core\block::STATUS_ORPHAN . ' + AND ' . $this->db->sql_in_set('image_id', $image_ids); + $result = $this->db->sql_query($sql); + $scoped_ids = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $scoped_ids[] = (int) $row['image_id']; + } + $this->db->sql_freeresult($result); + + return $scoped_ids; + } + /** * Approve image * @param (array) $image_id_ary The image ID array to be approved @@ -476,9 +508,16 @@ public function get_image_data($image_id) */ public function approve_images($image_id_ary, $album_id) { + $image_id_ary = $this->get_image_ids_by_album($image_id_ary, $album_id); + if (empty($image_id_ary)) + { + return; + } + $sql = 'SELECT image_id, image_name, image_user_id FROM ' . $this->table_images . ' WHERE image_status = 0 + AND image_album_id = ' . (int) $album_id . ' AND ' . $this->db->sql_in_set('image_id', $image_id_ary); $result = $this->db->sql_query($sql); $targets = array(); @@ -504,6 +543,7 @@ public function approve_images($image_id_ary, $album_id) $sql = 'UPDATE ' . $this->table_images . ' SET image_status = ' . (int) \phpbbgallery\core\block::STATUS_APPROVED . ' WHERE image_status <> ' . (int) \phpbbgallery\core\block::STATUS_ORPHAN . ' + AND image_album_id = ' . (int) $album_id . ' AND ' . $this->db->sql_in_set('image_id', $image_id_ary); $this->db->sql_query($sql); } @@ -515,17 +555,25 @@ public function approve_images($image_id_ary, $album_id) */ public function unapprove_images($image_id_ary, $album_id) { + $image_id_ary = $this->get_image_ids_by_album($image_id_ary, $album_id); + if (empty($image_id_ary)) + { + return; + } + self::handle_counter($image_id_ary, false); $sql = 'UPDATE ' . $this->table_images .' SET image_status = ' . (int) \phpbbgallery\core\block::STATUS_UNAPPROVED . ' WHERE image_status <> ' . (int) \phpbbgallery\core\block::STATUS_ORPHAN . ' + AND image_album_id = ' . (int) $album_id . ' AND ' . $this->db->sql_in_set('image_id', $image_id_ary); $this->db->sql_query($sql); $sql = 'SELECT image_id, image_name FROM ' . $this->table_images .' WHERE image_status <> ' . (int) \phpbbgallery\core\block::STATUS_ORPHAN . ' + AND image_album_id = ' . (int) $album_id . ' AND ' . $this->db->sql_in_set('image_id', $image_id_ary); $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) @@ -542,8 +590,14 @@ public function unapprove_images($image_id_ary, $album_id) * @param $album_id * @internal param $ (int) $album_id The album we want to move image to */ - public function move_image($image_id_ary, $album_id) + public function move_image($image_id_ary, $album_id, $source_album_id) { + $image_id_ary = $this->get_image_ids_by_album($image_id_ary, $source_album_id); + if (empty($image_id_ary)) + { + return; + } + $target_data = $this->album->get_info($album_id); // Store images to cache (so we can log them) @@ -551,7 +605,8 @@ public function move_image($image_id_ary, $album_id) //TO DO - Contests $sql = 'UPDATE ' . $this->table_images . ' SET image_album_id = ' . (int) $album_id . ' - WHERE ' . $this->db->sql_in_set('image_id', $image_id_ary); + WHERE image_album_id = ' . (int) $source_album_id . ' + AND ' . $this->db->sql_in_set('image_id', $image_id_ary); $this->db->sql_query($sql); $this->gallery_report->move_images($image_id_ary, $album_id); @@ -571,17 +626,25 @@ public function move_image($image_id_ary, $album_id) */ public function lock_images($image_id_ary, $album_id) { + $image_id_ary = $this->get_image_ids_by_album($image_id_ary, $album_id); + if (empty($image_id_ary)) + { + return; + } + self::handle_counter($image_id_ary, false); $sql = 'UPDATE ' . $this->table_images . ' SET image_status = ' . (int) \phpbbgallery\core\block::STATUS_LOCKED . ' WHERE image_status <> ' . (int) \phpbbgallery\core\block::STATUS_ORPHAN . ' + AND image_album_id = ' . (int) $album_id . ' AND ' . $this->db->sql_in_set('image_id', $image_id_ary); $this->db->sql_query($sql); $sql = 'SELECT image_id, image_name FROM ' . $this->table_images . ' WHERE image_status <> ' . (int) \phpbbgallery\core\block::STATUS_ORPHAN . ' + AND image_album_id = ' . (int) $album_id . ' AND ' . $this->db->sql_in_set('image_id', $image_id_ary); $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) diff --git a/core/language/bg/gallery.php b/core/language/bg/gallery.php index 755f0e26f..aaad92c89 100644 --- a/core/language/bg/gallery.php +++ b/core/language/bg/gallery.php @@ -371,4 +371,7 @@ // Versions 1.2.1 additions 'GALLERY_DROP' => 'Пуснете изображенията си тук', + 'GALLERY_UPLOAD_CANCEL' => 'Отказ', + 'GALLERY_UPLOAD_START' => 'Стартиране', + 'UPLOAD_TO_ALBUM' => 'Качване в „%s“', )); diff --git a/core/language/de/gallery.php b/core/language/de/gallery.php index dc66ce613..8e9d18151 100644 --- a/core/language/de/gallery.php +++ b/core/language/de/gallery.php @@ -370,4 +370,7 @@ // Versions 1.2.1 additions 'GALLERY_DROP' => 'Lege Dein Bild hier rein', + 'GALLERY_UPLOAD_CANCEL' => 'Abbrechen', + 'GALLERY_UPLOAD_START' => 'Starten', + 'UPLOAD_TO_ALBUM' => 'In "%s" hochladen', )); diff --git a/core/language/en/gallery.php b/core/language/en/gallery.php index 4916d7415..4e6d73e30 100644 --- a/core/language/en/gallery.php +++ b/core/language/en/gallery.php @@ -306,6 +306,9 @@ 'UNWATCHED_PEGAS' => 'You are no longer automatically subscribed to new personal galleries.', 'UPLOAD_ERROR' => 'While uploading “%1$s“ the following error occurred:
» %2$s', 'UPLOAD_IMAGE' => 'Upload Image', + 'GALLERY_UPLOAD_CANCEL' => 'Cancel', + 'GALLERY_UPLOAD_START' => 'Start', + 'UPLOAD_TO_ALBUM' => 'Upload to "%s"', 'UPLOAD_IMAGE_SIZE_TOO_BIG' => 'Your image dimension size is too large', 'UPLOAD_NO_FILE' => 'You must enter your path and filename', 'UPLOADED_BY_USER' => 'Uploaded by', diff --git a/core/language/en/gallery_acp.php b/core/language/en/gallery_acp.php index 761e2a24b..95ddf41ae 100644 --- a/core/language/en/gallery_acp.php +++ b/core/language/en/gallery_acp.php @@ -43,7 +43,7 @@ 'ALBUM_DELETE_EXPLAIN' => 'The form below will allow you to delete a album and decide where you want to put the images it contained', 'ALBUM_DELETED' => 'This album has been deleted successfully.', 'ALBUM_DESC' => 'Description', - 'ALBUM_DESC_EXPLAIN' => 'Any HTML markup entered here will be displayed as is.', + 'ALBUM_DESC_EXPLAIN' => 'The album description is parsed according to the selected BBCode, smilies, and URL options.', 'ALBUM_DESC_TOO_LONG' => 'The album description is too long, it must be less than 4000 characters.', 'ALBUM_EDIT_EXPLAIN' => 'The form below will allow you to customise this album. Please note that moderation control are set via album permissions for each user or usergroup.', 'ALBUM_ID' => 'Album-ID', diff --git a/core/language/es/gallery.php b/core/language/es/gallery.php index b4833fb98..5f50d89d6 100644 --- a/core/language/es/gallery.php +++ b/core/language/es/gallery.php @@ -372,4 +372,7 @@ // Versions 1.2.1 additions 'GALLERY_DROP' => 'Deja tus imágenes aquí', + 'GALLERY_UPLOAD_CANCEL' => 'Cancelar', + 'GALLERY_UPLOAD_START' => 'Iniciar', + 'UPLOAD_TO_ALBUM' => 'Subir a "%s"', )); diff --git a/core/language/fr/gallery.php b/core/language/fr/gallery.php index f105e233c..763b2ed52 100644 --- a/core/language/fr/gallery.php +++ b/core/language/fr/gallery.php @@ -387,4 +387,7 @@ // Versions 1.2.1 additions 'GALLERY_DROP' => 'Déposez vos images ici', + 'GALLERY_UPLOAD_CANCEL' => 'Annuler', + 'GALLERY_UPLOAD_START' => 'Démarrer', + 'UPLOAD_TO_ALBUM' => 'Téléverser vers « %s »', )); diff --git a/core/language/it/gallery.php b/core/language/it/gallery.php index 96594508e..459e5f70c 100644 --- a/core/language/it/gallery.php +++ b/core/language/it/gallery.php @@ -372,4 +372,7 @@ // Versions 1.2.1 addiotions 'GALLERY_DROP' => 'Lascia qui le tue immagini', + 'GALLERY_UPLOAD_CANCEL' => 'Annulla', + 'GALLERY_UPLOAD_START' => 'Avvia', + 'UPLOAD_TO_ALBUM' => 'Carica in "%s"', )); diff --git a/core/language/nl/gallery.php b/core/language/nl/gallery.php index ea347b81e..13f0143ef 100644 --- a/core/language/nl/gallery.php +++ b/core/language/nl/gallery.php @@ -372,4 +372,7 @@ // Versions 1.2.1 additions 'GALLERY_DROP' => 'Plaats je afbeeldingen hier', + 'GALLERY_UPLOAD_CANCEL' => 'Annuleren', + 'GALLERY_UPLOAD_START' => 'Starten', + 'UPLOAD_TO_ALBUM' => 'Uploaden naar "%s"', )); diff --git a/core/language/ru/gallery.php b/core/language/ru/gallery.php index 7d55d3090..367424917 100644 --- a/core/language/ru/gallery.php +++ b/core/language/ru/gallery.php @@ -347,4 +347,7 @@ // Versions 1.2.1 additions 'GALLERY_DROP' => 'Перетащите сюда ваши фото', + 'GALLERY_UPLOAD_CANCEL' => 'Отмена', + 'GALLERY_UPLOAD_START' => 'Начать', + 'UPLOAD_TO_ALBUM' => 'Загрузить в «%s»', )); diff --git a/core/log.php b/core/log.php index ca427fb96..585effc51 100644 --- a/core/log.php +++ b/core/log.php @@ -94,13 +94,13 @@ public function add_log($log_type, $log_action, $album = 0, $image = 0, $descrip $sql_array = array( 'log_time' => (int) $time, - 'log_type' => $this->db->sql_escape($log_type), - 'log_action' => $this->db->sql_escape($log_action), + 'log_type' => $log_type, + 'log_action' => $log_action, 'log_user' => (int) $user, - 'log_ip' => $this->db->sql_escape($this->user->ip), + 'log_ip' => $this->user->ip, 'album' => (int) $album, 'image' => (int) $image, - 'description' => $this->db->sql_escape(json_encode($description)) + 'description' => json_encode($description, JSON_UNESCAPED_UNICODE) ); $sql = 'INSERT INTO ' . $this->log_table . ' ' . $this->db->sql_build_array('INSERT', $sql_array); $this->db->sql_query($sql); @@ -199,22 +199,18 @@ public function build_list($type, $limit = 0, $page = 1, $album = 0, $image = 0, { case 'u': $sql_array['ORDER_BY'] = 'l.log_user ' . (isset($additional['sort_dir']) ? 'ASC' : 'DESC'); - $sql_array['GROUP_BY'] = 'l.log_user, l.log_id, i.image_id, i.image_album_id'; break; case 'i': $sql_array['ORDER_BY'] = 'l.log_ip ' . (isset($additional['sort_dir']) ? 'ASC' : 'DESC'); - $sql_array['GROUP_BY'] = 'l.log_ip, l.log_id, i.image_id, i.image_album_id'; break; case 'o': $sql_array['ORDER_BY'] = 'l.description ' . (isset($additional['sort_dir']) ? 'ASC' : 'DESC'); - $sql_array['GROUP_BY'] = 'l.description, l.log_id, i.image_id, i.image_album_id'; break; } } else { $sql_array['ORDER_BY'] = 'l.log_time ' . (isset($additional['sort_dir']) ? 'ASC' : 'DESC'); - $sql_array['GROUP_BY'] = 'l.log_time, l.log_id, i.image_id, i.image_album_id'; } // So we need count - so define SELECT $count_sql_array = $sql_array; @@ -260,7 +256,7 @@ public function build_list($type, $limit = 0, $page = 1, $album = 0, $image = 0, 'ip' => $row['log_ip'], 'album' => $row['album'], 'image' => $row['image'], - 'description' => json_decode(stripslashes($row['description'])) + 'description' => json_decode($row['description'], true) ); $users_array[$row['log_user']] = array(''); } diff --git a/core/migrations/release_1_2_0_add_bbcode.php b/core/migrations/release_1_2_0_add_bbcode.php index 4b65b4e56..2e4ffc9cf 100644 --- a/core/migrations/release_1_2_0_add_bbcode.php +++ b/core/migrations/release_1_2_0_add_bbcode.php @@ -18,7 +18,7 @@ class release_1_2_0_add_bbcode extends migration { static public function depends_on() { - return array('\phpbbgallery\core\migrations\release_1_2_0'); + return array('\phpbbgallery\core\migrations\release_1_2_0_db_create'); } public function update_data() diff --git a/core/migrations/release_3_2_1_0.php b/core/migrations/release_3_2_1_0.php index a900ee007..cbc42afd6 100644 --- a/core/migrations/release_3_2_1_0.php +++ b/core/migrations/release_3_2_1_0.php @@ -17,7 +17,7 @@ class release_3_2_1_0 extends profilefield_base_migration { static public function depends_on() { - return array('\phpbbgallery\core\migrations\release_1_2_0'); + return array('\phpbbgallery\core\migrations\split_ucp_module_settings'); } public function update_data() @@ -61,6 +61,7 @@ public function fix_gallery_lang() static public $configs = array( 'version' => '3.2.1', 'disp_gallery_icon' => true, + 'allow_webp' => true, ); protected $profilefield_name = 'gallery_palbum'; diff --git a/core/migrations/release_3_2_1_1.php b/core/migrations/release_3_2_1_1.php index b919b179b..87cf42f18 100644 --- a/core/migrations/release_3_2_1_1.php +++ b/core/migrations/release_3_2_1_1.php @@ -17,7 +17,7 @@ class release_3_2_1_1 extends migration { static public function depends_on() { - return ['\phpbbgallery\core\migrations\release_1_2_0_db_create']; + return ['\phpbbgallery\core\migrations\release_3_2_1_0']; } public function update_data() diff --git a/core/migrations/release_3_3_0.php b/core/migrations/release_3_3_0.php index 5ba437bef..e3f9f5df7 100644 --- a/core/migrations/release_3_3_0.php +++ b/core/migrations/release_3_3_0.php @@ -17,7 +17,7 @@ class release_3_3_0 extends migration { static public function depends_on() { - return ['\phpbbgallery\core\migrations\release_1_2_0_db_create']; + return ['\phpbbgallery\core\migrations\release_3_2_1_1']; } public function update_data() diff --git a/core/migrations/release_3_4_0.php b/core/migrations/release_3_4_0.php index 2d650b80a..4961bdf0f 100644 --- a/core/migrations/release_3_4_0.php +++ b/core/migrations/release_3_4_0.php @@ -16,7 +16,7 @@ class release_3_4_0 extends migration { static public function depends_on() { - return ['\phpbbgallery\core\migrations\release_1_2_0_db_create']; + return ['\phpbbgallery\core\migrations\release_3_3_0']; } public function update_data() diff --git a/core/migrations/remove_gallery_version.php b/core/migrations/remove_gallery_version.php new file mode 100644 index 000000000..75156f5d0 --- /dev/null +++ b/core/migrations/remove_gallery_version.php @@ -0,0 +1,28 @@ +image->get_image_ids_by_album($images, $album_id); + if (empty($images)) + { + return; + } + $files = array_intersect_key($files, array_flip($images)); + // We are going to do some cleanup $this->gallery_rating->loader(0); $this->gallery_rating->delete_ratings($images); diff --git a/core/rating.php b/core/rating.php index b0832ab2e..f3e2d0ebd 100644 --- a/core/rating.php +++ b/core/rating.php @@ -422,7 +422,7 @@ public function recalc_image_rating($image_ids) $image_ids = (int) $image_ids; } - $sql = 'SELECT rate_image_id, COUNT(rate_user_ip) image_rates, AVG(rate_point) image_rate_avg, SUM(rate_point) image_rate_points + $sql = 'SELECT rate_image_id, COUNT(rate_user_ip) image_rates, AVG(rate_point * 1.0) image_rate_avg, SUM(rate_point) image_rate_points FROM ' . $this->rates_table . ' WHERE ' . $this->db->sql_in_set('rate_image_id', $image_ids, false, true) . ' GROUP BY rate_image_id'; diff --git a/core/report.php b/core/report.php index 86de307a7..64589c316 100644 --- a/core/report.php +++ b/core/report.php @@ -305,7 +305,7 @@ public function build_list($album, $page = 1, $per_page = 0, $status = 1) $this->reports_table => 'r', ), 'WHERE' => 'i.image_id = r.report_image_id and r.report_status = ' . (int) $status . ' and ' . $this->db->sql_in_set('i.image_album_id', $mod_array), - 'ORBER_BY' => 'r.report_id DESC' + 'ORDER_BY' => 'r.report_id DESC' ); // Get Count $sql_array['SELECT'] = 'COUNT(r.report_id) as count'; diff --git a/core/search.php b/core/search.php index 86b7f5c69..666974ca6 100644 --- a/core/search.php +++ b/core/search.php @@ -149,6 +149,10 @@ public function random($limit, $user = 0, $fields = 'rrc_gindex_display', $block $sql_order = 'NEWID()'; break; + case 'oracle': + $sql_order = 'DBMS_RANDOM.VALUE'; + break; + default: $sql_order = 'RAND()'; break; @@ -213,10 +217,8 @@ public function random($limit, $user = 0, $fields = 'rrc_gindex_display', $block $id_ary = array_map('intval', $id_ary); - $sql_where = $this->db->sql_in_set('i.image_id', $id_ary); - $sql_array = array( - 'SELECT' => 'i.*, a.album_name, a.album_status, a.album_user_id, album_id', + 'SELECT' => 'i.*, a.album_name, a.album_status, a.album_user_id, a.album_id', 'FROM' => array($this->images_table => 'i'), 'LEFT_JOIN' => array( @@ -226,8 +228,7 @@ public function random($limit, $user = 0, $fields = 'rrc_gindex_display', $block ), ), - 'WHERE' => 'i.image_status <> ' . (int) \phpbbgallery\core\block::STATUS_ORPHAN . ' AND ' . $sql_where, - 'GROUP_BY' => 'i.image_id, a.album_name, a.album_status, a.album_user_id, a.album_id', + 'WHERE' => 'i.image_status <> ' . (int) \phpbbgallery\core\block::STATUS_ORPHAN . ' AND ' . $this->db->sql_in_set('i.image_id', $id_ary), 'ORDER_BY' => $sql_order, ); $sql = $this->db->sql_build_query('SELECT', $sql_array); @@ -335,7 +336,6 @@ public function recent_comments($limit, $start = 0, $pagination = true) $this->comments_table => 'c', ), 'WHERE' => 'i.image_id = c.comment_image_id and ' . $this->db->sql_in_set('image_album_id', $this->gallery_auth->acl_album_ids('c_read'), false, true), - 'GROUP_BY' => 'c.comment_id, c.comment_time, i.image_id', 'ORDER_BY' => 'comment_time DESC' ); $sql_array['WHERE'] .= ' AND ((' . $this->db->sql_in_set('image_album_id', array_diff($this->gallery_auth->acl_album_ids('i_view'), $exclude_albums), false, true) . ' AND image_status <> ' . (int) \phpbbgallery\core\block::STATUS_UNAPPROVED . ') @@ -541,8 +541,6 @@ public function recent($limit, $start = 0, $user = 0, $fields = 'rrc_gindex_disp $id_ary = array_map('intval', $id_ary); - $sql_where = $this->db->sql_in_set('i.image_id', $id_ary); - $sql_array = array( 'SELECT' => 'i.*, a.album_name, a.album_status, a.album_user_id, a.album_id', 'FROM' => array($this->images_table => 'i'), @@ -554,7 +552,7 @@ public function recent($limit, $start = 0, $user = 0, $fields = 'rrc_gindex_disp ), ), - 'WHERE' => 'i.image_status <> ' . (int) \phpbbgallery\core\block::STATUS_ORPHAN . ' AND ' . $sql_where, + 'WHERE' => 'i.image_status <> ' . (int) \phpbbgallery\core\block::STATUS_ORPHAN . ' AND ' . $this->db->sql_in_set('i.image_id', $id_ary), 'ORDER_BY' => $sql_order, ); $sql = $this->db->sql_build_query('SELECT', $sql_array); @@ -619,7 +617,7 @@ public function rating($limit, $start = 0) $row = $this->db->sql_fetchrow($result); $this->db->sql_freeresult($result); $count = $row['count']; - $sql_array['SELECT'] = '* , a.album_name, a.album_status, a.album_user_id, a.album_id'; + $sql_array['SELECT'] = 'i.*, a.album_name, a.album_status, a.album_user_id, a.album_id'; $sql_array['LEFT_JOIN'] = array( array( 'FROM' => array($this->albums_table => 'a'), diff --git a/core/styles/all/template/event/overall_footer_after.html b/core/styles/all/template/event/overall_footer_after.html index 3164e3a2c..6d920824b 100644 --- a/core/styles/all/template/event/overall_footer_after.html +++ b/core/styles/all/template/event/overall_footer_after.html @@ -11,6 +11,7 @@ //acceptFileTypes: '{S_QUICK_FILE_TYPES}', // User side filetype test does not work! maxFileSize: '{S_QUICK_MAX_FILESIZE}', // And it appears that user side size is ignored too. dataType: 'json', + formData: $('#postform').serializeArray(), paramName: 'files[]', uploadTemplateId: null, downloadTemplateId: null, @@ -27,8 +28,8 @@ '' + '' + (!index && !o.options.autoUpload ? - '' : '') + - (!index ? '' : '') + + '' : '') + + (!index ? '' : '') + '' + ''); row.find('.name').text(file.name); @@ -136,14 +137,17 @@ }); })(jQuery); // Avoid conflicts with other libraries - - - - - - - - + + + + + + + + + + + @@ -151,4 +155,4 @@ (function($) { // Avoid conflicts with other libraries $('#pf_gallery_palbum').prop('disabled', true); })(jQuery); // Avoid conflicts with other libraries - \ No newline at end of file + diff --git a/core/styles/prosilver/template/gallery/ucp_gallery.html b/core/styles/prosilver/template/gallery/ucp_gallery.html index 707406298..53d7e56fe 100644 --- a/core/styles/prosilver/template/gallery/ucp_gallery.html +++ b/core/styles/prosilver/template/gallery/ucp_gallery.html @@ -313,6 +313,7 @@

{L_TITLE_EXPLAIN}

+ {S_FORM_TOKEN} @@ -334,4 +335,4 @@

{L_TITLE_EXPLAIN}


{L_GALLERY_TRANSLATION_INFO} - \ No newline at end of file + diff --git a/core/styles/prosilver/template/gallery/viewimage_body.html b/core/styles/prosilver/template/gallery/viewimage_body.html index 8a8331a9e..ebbeb7b56 100644 --- a/core/styles/prosilver/template/gallery/viewimage_body.html +++ b/core/styles/prosilver/template/gallery/viewimage_body.html @@ -89,21 +89,21 @@

{L_IMAGE_DESC}

{L_CONTACT}{L_COLON}