From e22397bb64c6725e393e69afe5588a3797640506 Mon Sep 17 00:00:00 2001 From: Kevin Date: Sun, 16 Mar 2008 13:56:26 +0000 Subject: [PATCH] Report#79: Change Style - activate this function - Code provided by Christian_N --- contrib/update_board3portal_010.xml | 6 ++ contrib/update_board3portal_020.xml | 12 ++- contrib/update_phpbb3portal_110b.xml | 6 ++ contrib/update_phpbb3portal_122.xml | 6 ++ install.xml | 6 ++ root/includes/acp/acp_portal.php | 2 +- root/portal/block/change_style.php | 75 ++++++++----------- .../template/portal/block/change_style.html | 14 ++-- .../template/portal/block/change_style.html | 15 ++-- 9 files changed, 77 insertions(+), 65 deletions(-) diff --git a/contrib/update_board3portal_010.xml b/contrib/update_board3portal_010.xml index cb6c0f8d..48a741b6 100644 --- a/contrib/update_board3portal_010.xml +++ b/contrib/update_board3portal_010.xml @@ -167,6 +167,12 @@ Dieses Portal basiert auf dem phpBB3 Portal a.k.a canverPortal ( www.phpbb3por add_lang('mods/lang_portal_acp_logs');]]> + + + + acl_get('a_styles'))]]> + + diff --git a/contrib/update_board3portal_020.xml b/contrib/update_board3portal_020.xml index 56b9ada4..f2b0df8e 100644 --- a/contrib/update_board3portal_020.xml +++ b/contrib/update_board3portal_020.xml @@ -162,15 +162,19 @@ Dieses Portal basiert auf dem phpBB3 Portal a.k.a canverPortal ( www.phpbb3por + + + acl_get('a_styles'))]]> + + + ]]> ]]> - No need to run the installer. -Please rember to do the same changes in subsilver2! - Die install_portal/install.php muß nicht ausgeführt werden. -Bitte daran denken die Änderungen auch im subsilver2 Style vorzunehmen! + Browse to install_portal/install.php and run the installer, after successfull installation delete the installer. + install_portal/install.php aufrufen und ausführen, nach erfolgreicher Installation löschen \ No newline at end of file diff --git a/contrib/update_phpbb3portal_110b.xml b/contrib/update_phpbb3portal_110b.xml index a7975d67..eb131dac 100644 --- a/contrib/update_phpbb3portal_110b.xml +++ b/contrib/update_phpbb3portal_110b.xml @@ -220,6 +220,12 @@ DirectoryIndex portal.php index.php index.html index.htm]]> append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'),]]> append_sid("{$phpbb_root_path}portal.$phpEx"),]]> + + + + acl_get('a_styles'))]]> + + diff --git a/contrib/update_phpbb3portal_122.xml b/contrib/update_phpbb3portal_122.xml index 46d6b24c..71f419a6 100644 --- a/contrib/update_phpbb3portal_122.xml +++ b/contrib/update_phpbb3portal_122.xml @@ -234,6 +234,12 @@ DirectoryIndex portal.php index.php index.html index.htm]]> append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'),]]> append_sid("{$phpbb_root_path}portal.$phpEx"),]]> + + + + acl_get('a_styles'))]]> + + diff --git a/install.xml b/install.xml index e6aa6b46..3a3fa9ac 100644 --- a/install.xml +++ b/install.xml @@ -192,6 +192,12 @@ Deny from All append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'),]]> append_sid("{$phpbb_root_path}portal.$phpEx"),]]> + + + + acl_get('a_styles'))]]> + + diff --git a/root/includes/acp/acp_portal.php b/root/includes/acp/acp_portal.php index f4697247..4a52eded 100644 --- a/root/includes/acp/acp_portal.php +++ b/root/includes/acp/acp_portal.php @@ -54,7 +54,7 @@ class acp_portal 'portal_birthdays_ahead' => array('lang' => 'PORTAL_BIRTHDAYS_AHEAD' , 'validate' => 'int' , 'type' => 'text:3:3' , 'explain' => true), 'portal_random_member' => array('lang' => 'PORTAL_RANDOM_MEMBER' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true), 'portal_whois_online' => array('lang' => 'PORTAL_WHOIS_ONLINE' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true), - //'portal_change_style' => array('lang' => 'PORTAL_CHANGE_STYLE' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true), + 'portal_change_style' => array('lang' => 'PORTAL_CHANGE_STYLE' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true), 'portal_main_menu' => array('lang' => 'PORTAL_MAIN_MENU' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true), 'portal_user_menu' => array('lang' => 'PORTAL_USER_MENU' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true), 'portal_friends' => array('lang' => 'PORTAL_FRIENDS' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true), diff --git a/root/portal/block/change_style.php b/root/portal/block/change_style.php index bd0e7a41..ef826009 100644 --- a/root/portal/block/change_style.php +++ b/root/portal/block/change_style.php @@ -20,57 +20,44 @@ if (!defined('IN_PORTAL')) exit; } -$lang = request_var('lang', '', false, true); +$style = request_var('style', 0); + + $sql = 'SELECT style_id, style_name, style_copyright + FROM ' . STYLES_TABLE . ' + WHERE style_active = 1 + ORDER BY style_name ASC'; -if (file_exists($phpbb_root_path . 'language/' . $lang . "/common.$phpEx")) -{ - $this->lang_name = $lang; - $this->lang_path = $phpbb_root_path . 'language/' . $this->lang_name . '/'; + $result = $db->sql_query($sql); + $style_select = ''; + while ($row = $db->sql_fetchrow($result)) + { + $selected = ( $style == $row['style_id'] ) ? ' selected="selected"' : ''; + $style_value = append_sid("{$phpbb_root_path}portal.$phpEx", 'style=' . $row['style_id']); + $style_select .= ''; + } + $db->sql_freeresult($result); + + // style info + $sql2 = 'SELECT style_id, style_name, style_copyright + FROM ' . STYLES_TABLE . ' + WHERE style_active = 1 + AND style_id = ' . $style; - $cookie_expire = $this->time_now + (($config['max_autologin_time']) ? 86400 * (int) $config['max_autologin_time'] : 31536000); - $this->set_cookie('lang', $lang, $cookie_expire); - unset($cookie_expire); -} + $result = $db->sql_query($sql2); + $row = $db->sql_fetchrow($result); -$requested_style = request_var('style', 0, false, true); + $template->assign_vars(array( + 'S_STYLE_ACTION'=> append_sid("{$phpbb_root_path}portal.$phpEx"), + 'STYLE_NAME' => $row['style_name'], + 'STYLE_COPY' => $row['style_copyright'], + 'STYLE_SELECT' => $style_select, + )); -if ($requested_style && (!$config['override_user_style'] || $auth->acl_get('a_styles'))) -{ - $style = $requested_style; - - $cookie_expire = $this->time_now + (($config['max_autologin_time']) ? 86400 * (int) $config['max_autologin_time'] : 31536000); - $this->set_cookie('style', $style, $cookie_expire); - unset($cookie_expire); -} - -$all = false; -$default = ''; - -$sql_where = (!$all) ? 'WHERE style_active = 1 ' : ''; -$sql = 'SELECT style_id, style_name, style_copyright - FROM ' . STYLES_TABLE . " - $sql_where - ORDER BY style_name"; -$result = $db->sql_query($sql); - -$style_options = ''; -while ($row = $db->sql_fetchrow($result)) -{ - $selected = ($row['style_id'] == $default) ? ' selected="selected"' : ''; - $style_options .= ''; - - $template->assign_block_vars('styles', array( - 'STYLE_ID' => $row['style_id'], - 'STYLE_NAME' => $row['style_name'], - 'STYLE_COPY' => $row['style_copyright'], - 'U_STYLE' => append_sid("{$phpbb_root_path}portal.$phpEx", 'style=' . $row['style_id']), - )); -} -$db->sql_freeresult($result); + $db->sql_freeresult($result); // Assign specific vars $template->assign_vars(array( - 'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['style']), + 'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['style']), 'S_DISPLAY_CHANGE_STYLE' => true, )); diff --git a/root/styles/prosilver/template/portal/block/change_style.html b/root/styles/prosilver/template/portal/block/change_style.html index 0e6b0dc8..f839ae58 100644 --- a/root/styles/prosilver/template/portal/block/change_style.html +++ b/root/styles/prosilver/template/portal/block/change_style.html @@ -13,14 +13,12 @@ } //--> - -
- + +
+ +

diff --git a/templates/subsilver2/template/portal/block/change_style.html b/templates/subsilver2/template/portal/block/change_style.html index 46d7f41d..7ffa5a8f 100644 --- a/templates/subsilver2/template/portal/block/change_style.html +++ b/templates/subsilver2/template/portal/block/change_style.html @@ -14,14 +14,13 @@ } //--> -
- -
+
+
+ +
+