From 887863e5c5ba80cd1bcbcd6097719afe2178c672 Mon Sep 17 00:00:00 2001 From: David M Date: Sun, 8 Apr 2007 17:40:36 +0000 Subject: - overhaul of imagesets imagesets are now "intelligently" multilingual, one may use imagesets inside of CSS files now (as well as properties like the width and height of an imageset's image) all previous styles should change their imageset.cfg to be like prosilver and subsilver2 (notice how there is now an imageset.cfg in the /en folder, there should be one for each language) git-svn-id: file:///svn/phpbb/trunk@7304 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/session.php | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) (limited to 'phpBB/includes/session.php') diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 2b845bc4d7..fc380436d3 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1166,6 +1166,7 @@ class user extends session var $lang_name; var $lang_path; var $img_lang; + var $img_array = array(); // Able to add new option (id 7) var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10); @@ -1366,6 +1367,17 @@ class user extends session $this->img_lang = (file_exists($phpbb_root_path . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . $this->lang_name)) ? $this->lang_name : $config['default_lang']; + $sql = 'SELECT * + FROM ' . STYLES_IMAGESET_DATA_TABLE . ' + WHERE imageset_id = ' . $this->theme['imageset_id'] . " + AND image_lang IN('" . $db->sql_escape($this->img_lang) . "', '')"; + $result = $db->sql_query($sql, 3600); + + while ($row = $db->sql_fetchrow($result)) + { + $this->img_array[$row['image_name']] = $row; + } + // If this function got called from the error handler we are finished here. if (defined('IN_ERROR_HANDLER')) { @@ -1610,43 +1622,20 @@ class user extends session static $imgs; global $phpbb_root_path; - $img_data = &$imgs[$img . $suffix]; + $img_data = &$imgs[$img]; if (empty($img_data) || $width !== false) { - if (!isset($this->theme[$img]) || !$this->theme[$img]) + if (!isset($this->img_array[$img])) { // Do not fill the image to let designers decide what to do if the image is empty $img_data = ''; return $img_data; } - // Do not include dimensions? - if (strpos($this->theme[$img], '*') === false) - { - $imgsrc = trim($this->theme[$img]); - $width = $height = false; - } - else - { - if ($width === false) - { - list($imgsrc, $height, $width) = explode('*', $this->theme[$img]); - } - else - { - list($imgsrc, $height) = explode('*', $this->theme[$img]); - } - } - - if ($suffix !== '') - { - $imgsrc = str_replace('{SUFFIX}', $suffix, $imgsrc); - } - - $img_data['src'] = $phpbb_root_path . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . str_replace('{LANG}', $this->img_lang, $imgsrc); - $img_data['width'] = $width; - $img_data['height'] = $height; + $img_data['src'] = $phpbb_root_path . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . ($this->img_array[$img]['image_lang'] ? $this->img_array[$img]['image_lang'] .'/' : '') . $this->img_array[$img]['image_filename']; + $img_data['width'] = $this->img_array[$img]['image_width']; + $img_data['height'] = $this->img_array[$img]['image_height']; } $alt = (!empty($this->lang[$alt])) ? $this->lang[$alt] : $alt; -- cgit v1.2.1