diff --git a/root/includes/acp/acp_portal.php b/root/includes/acp/acp_portal.php
index dc923bd9..bc0703e5 100644
--- a/root/includes/acp/acp_portal.php
+++ b/root/includes/acp/acp_portal.php
@@ -28,6 +28,8 @@ class acp_portal
$action = request_var('action', '');
$submit = (isset($_POST['submit'])) ? true : false;
+
+ $this->new_config = $portal_config;
/**
* Validation types are:
@@ -47,11 +49,10 @@ class acp_portal
'portal_leaders' => array('lang' => 'PORTAL_LEADERS' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true),
'portal_clock' => array('lang' => 'PORTAL_CLOCK' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true),
'portal_link_us' => array('lang' => 'PORTAL_LINK_US' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true),
- 'portal_links' => array('lang' => 'PORTAL_LINKS' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true),
'portal_birthdays' => array('lang' => 'PORTAL_BIRTHDAYS' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true),
'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_forum_index' => array('lang' => 'PORTAL_FORUM_INDEX' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true),
+ 'forum_index' => array('lang' => 'PORTAL_FORUM_INDEX' , '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_main_menu' => array('lang' => 'PORTAL_MAIN_MENU' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true),
@@ -70,15 +71,15 @@ class acp_portal
'title' => 'ACP_PORTAL_NEWS_SETTINGS',
'vars' => array(
'legend1' => 'ACP_PORTAL_NEWS_SETTINGS',
- 'portal_news' => array('lang' => 'PORTAL_NEWS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'portal_news_style' => array('lang' => 'PORTAL_NEWS_STYLE' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'portal_show_all_news' => array('lang' => 'PORTAL_SHOW_ALL_NEWS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'portal_number_of_news' => array('lang' => 'PORTAL_NUMBER_OF_NEWS' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
- 'portal_news_length' => array('lang' => 'PORTAL_NEWS_LENGTH' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
- 'portal_news_forum' => array('lang' => 'PORTAL_NEWS_FORUM' , 'validate' => 'string', 'type' => 'text:10:200', 'explain' => true),
- 'portal_news_permissions' => array('lang' => 'PORTAL_NEWS_PERMISSIONS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'portal_news_show_last' => array('lang' => 'PORTAL_NEWS_SHOW_LAST' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'portal_news_archive' => array('lang' => 'PORTAL_NEWS_ARCHIVE' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'portal_news' => array('lang' => 'PORTAL_NEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'portal_news_style' => array('lang' => 'PORTAL_NEWS_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'portal_show_all_news' => array('lang' => 'PORTAL_SHOW_ALL_NEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'portal_number_of_news' => array('lang' => 'PORTAL_NUMBER_OF_NEWS', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
+ 'portal_news_length' => array('lang' => 'PORTAL_NEWS_LENGTH', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
+ 'portal_news_forum' => array('lang' => 'PORTAL_NEWS_FORUM', 'validate' => 'string', 'type' => 'text:10:200', 'explain' => true),
+ 'portal_news_permissions' => array('lang' => 'PORTAL_NEWS_PERMISSIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'portal_news_show_last' => array('lang' => 'PORTAL_NEWS_SHOW_LAST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'portal_news_archive' => array('lang' => 'PORTAL_NEWS_ARCHIVE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
)
);
break;
@@ -87,14 +88,14 @@ class acp_portal
'title' => 'ACP_PORTAL_ANNOUNCE_SETTINGS',
'vars' => array(
'legend1' => 'ACP_PORTAL_ANNOUNCE_SETTINGS',
- 'portal_announcements' => array('lang' => 'PORTAL_ANNOUNCEMENTS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'portal_announcements' => array('lang' => 'PORTAL_ANNOUNCEMENTS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_announcements_style' => array('lang' => 'PORTAL_ANNOUNCEMENTS_STYLE' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_number_of_announcements' => array('lang' => 'PORTAL_NUMBER_OF_ANNOUNCEMENTS' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
'portal_announcements_day' => array('lang' => 'PORTAL_ANNOUNCEMENTS_DAY' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
'portal_announcements_length' => array('lang' => 'PORTAL_ANNOUNCEMENTS_LENGTH' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
'portal_global_announcements_forum' => array('lang' => 'PORTAL_GLOBAL_ANNOUNCEMENTS_FORUM' , 'validate' => 'string', 'type' => 'text:10:200', 'explain' => true),
'portal_announcements_permissions' => array('lang' => 'PORTAL_ANNOUNCEMENTS_PERMISSIONS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'portal_announcements_archive' => array('lang' => 'PORTAL_ANNOUNCEMENTS_ARCHIVE' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'portal_announcements_archive' => array('lang' => 'PORTAL_ANNOUNCEMENTS_ARCHIVE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
)
);
break;
@@ -103,7 +104,7 @@ class acp_portal
'title' => 'ACP_PORTAL_RECENT_SETTINGS',
'vars' => array(
'legend1' => 'ACP_PORTAL_RECENT_SETTINGS',
- 'portal_recent' => array('lang' => 'PORTAL_RECENT' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'portal_recent' => array('lang' => 'PORTAL_RECENT' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_max_topics' => array('lang' => 'PORTAL_MAX_TOPIC' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
'portal_recent_title_limit' => array('lang' => 'PORTAL_RECENT_TITLE_LIMIT' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
'portal_exclude_forums' => array('lang' => 'PORTAL_EXCLUDE_FORUM' , 'validate' => 'string', 'type' => 'text:10:200', 'explain' => true),
@@ -127,8 +128,8 @@ class acp_portal
'title' => 'ACP_PORTAL_PAYPAL_SETTINGS',
'vars' => array(
'legend2' => 'ACP_PORTAL_PAYPAL_SETTINGS',
- 'portal_pay_c_block' => array('lang' => 'PORTAL_PAY_C_BLOCK' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'portal_pay_s_block' => array('lang' => 'PORTAL_PAY_S_BLOCK' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'portal_pay_c_block' => array('lang' => 'PORTAL_PAY_C_BLOCK' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'portal_pay_s_block' => array('lang' => 'PORTAL_PAY_S_BLOCK' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_pay_acc' => array('lang' => 'PORTAL_PAY_ACC' , 'validate' => 'string', 'type' => 'text:25:100', 'explain' => true),
)
);
@@ -138,7 +139,7 @@ class acp_portal
'title' => 'ACP_PORTAL_ATTACHMENTS_NUMBER_SETTINGS',
'vars' => array(
'legend1' => 'ACP_PORTAL_ATTACHMENTS_NUMBER_SETTINGS',
- 'portal_attachments' => array('lang' => 'PORTAL_ATTACHMENTS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'portal_attachments' => array('lang' => 'PORTAL_ATTACHMENTS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_attachments_number' => array('lang' => 'PORTAL_ATTACHMENTS_NUMBER' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
'portal_attachments_forum_ids' => array('lang' => 'PORTAL_ATTACHMENTS_FORUM_IDS', 'validate' => 'string', 'type' => 'text:10:200', 'explain' => true),
)
@@ -149,7 +150,7 @@ class acp_portal
'title' => 'ACP_PORTAL_MEMBERS_SETTINGS',
'vars' => array(
'legend1' => 'ACP_PORTAL_MEMBERS_SETTINGS',
- 'portal_latest_members' => array('lang' => 'PORTAL_LATEST_MEMBERS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'portal_latest_members' => array('lang' => 'PORTAL_LATEST_MEMBERS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_max_last_member' => array('lang' => 'PORTAL_MAX_LAST_MEMBER' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
)
);
@@ -182,7 +183,7 @@ class acp_portal
'vars' => array(
'legend1' => 'ACP_PORTAL_MOST_POSTER_SETTINGS',
'portal_top_posters' => array('lang' => 'PORTAL_TOP_POSTERS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'portal_max_most_poster' => array('lang' => 'PORTAL_MAX_MOST_POSTER' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
+ 'portal_max_most_poster' => array('lang' => 'PORTAL_MAX_MOST_POSTER' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
)
);
break;
@@ -205,29 +206,99 @@ class acp_portal
'vars' => array(
'legend1' => 'ACP_PORTAL_CUSTOM_SMALL_SETTINGS',
'portal_custom_small' => array('lang' => 'PORTAL_CUSTOM_SMALL' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'portal_custom_small_headline' => array('lang' => 'PORTAL_CUSTOM_SMALL_HEADLINE' , 'validate' => 'string', 'type' => 'text:40:200', 'explain' => true),
+ 'portal_custom_small_headline' => array('lang' => 'PORTAL_CUSTOM_SMALL_HEADLINE' , 'validate' => 'string', 'type' => 'text:40:200', 'explain' => true),
'portal_custom_small_bbcode' => array('lang' => 'PORTAL_CUSTOM_SMALL_BBCODE' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_custom_code_small' => array('lang' => 'PORTAL_CUSTOM_CODE_SMALL' , 'type' => 'textarea:6:6', 'explain' => true),
'legend2' => 'ACP_PORTAL_CUSTOM_CENTER_SETTINGS',
'portal_custom_center' => array('lang' => 'PORTAL_CUSTOM_CENTER' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'portal_custom_center_headline' => array('lang' => 'PORTAL_CUSTOM_CENTER_HEADLINE' , 'validate' => 'string', 'type' => 'text:40:200', 'explain' => true),
+ 'portal_custom_center_headline' => array('lang' => 'PORTAL_CUSTOM_CENTER_HEADLINE' , 'validate' => 'string', 'type' => 'text:40:200', 'explain' => true),
'portal_custom_center_bbcode' => array('lang' => 'PORTAL_CUSTOM_CENTER_BBCODE' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_custom_code_center' => array('lang' => 'PORTAL_CUSTOM_CODE_CENTER' , 'type' => 'textarea:6:6', 'explain' => true),
)
);
break;
- case 'minicalendar':
+ case 'minicalendar':
$display_vars = array(
'title' => 'ACP_PORTAL_MINICALENDAR_SETTINGS',
'vars' => array(
'legend1' => 'ACP_PORTAL_MINICALENDAR_SETTINGS',
'portal_minicalendar' => array('lang' => 'PORTAL_MINICALENDAR' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'portal_minicalendar_today_color' => array('lang' => 'PORTAL_MINICALENDAR_TODAY_COLOR' , 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true),
- 'portal_minicalendar_day_link_color' => array('lang' => 'PORTAL_MINICALENDAR_DAY_LINK_COLOR' , 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true),
+ 'portal_minicalendar_today_color' => array('lang' => 'PORTAL_MINICALENDAR_TODAY_COLOR' , 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true),
+ 'portal_minicalendar_day_link_color' => array('lang' => 'PORTAL_MINICALENDAR_DAY_LINK_COLOR' , 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true),
)
);
break;
+ case 'links':
+ $display_vars = array(
+ 'title' => 'ACP_PORTAL_LINKS_SETTINGS',
+ 'vars' => array(
+ 'legend1' => 'ACP_PORTAL_LINKS_SETTINGS',
+ 'portal_links' => array('lang' => 'PORTAL_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ )
+ );
+ // Links require preprocessing
+
+ $links = ( strlen($portal_config['portal_links_array']) ) ? utf_unserialize($portal_config['portal_links_array']) : array() ;
+ $this->link_num = count( $links );
+
+ $lid = request_var('link', 0);
+
+ switch( $action )
+ {
+ case 'delete':
+ if($lid > 0)
+ {
+ if($lid < $this->link_num)
+ {
+ for($i = $lid+1; $i <= $this->link_num; ++$i)
+ {
+ $links[$i-1] = $links[$i];
+ }
+ }
+ unset($links[$this->link_num]);
+ set_portal_config('portal_links_array', serialize($links));
+ }
+ break;
+ case 'add':
+ $this->link_num = $this->link_num + 1;
+ $links[$this->link_num] = array( 'url' => '', 'text' => '' );
+ set_portal_config('portal_links_array', serialize($links));
+ break;
+ case 'moveup':
+ if($lid > 1 && isset($links[$lid]))
+ {
+ $temp = $links[$lid];
+ $links[$lid] = $links[$lid-1];
+ $links[$lid-1] = $temp;
+ unset($temp);
+ set_portal_config('portal_links_array', serialize($links));
+ }
+ break;
+ case 'movedown':
+ if($lid > 0 && $lid < $this->link_num && isset($links[$lid]))
+ {
+ $temp = $links[$lid];
+ $links[$lid] = $links[$lid+1];
+ $links[$lid+1] = $temp;
+ unset($temp);
+ set_portal_config('portal_links_array', serialize($links));
+ }
+ break;
+ }
+
+ ksort( $links );
+ reset( $links );
+
+ foreach($links as $link_id => $link_data)
+ {
+ $key = 'portal_link_'.$link_id;
+ $display_vars['vars'][$key] = array('lang' => 'PORTAL_LINK_TEXT', 'type' => 'custom', 'method' => 'createLink', 'explain' => true);
+ $this->new_config[$key] = array('key' => $link_id, 'text' => $link_data['text'], 'url' => $link_data['url']);
+ }
+
+ $display_vars['vars']['portal_links_add'] = array('lang' => 'PORTAL_ADD_LINK_TEXT', 'type' => 'custom', 'method' => 'addLink', 'explain' => true);
+ break;
default:
trigger_error('NO_MODE', E_USER_ERROR);
break;
@@ -238,23 +309,41 @@ class acp_portal
$user->add_lang($display_vars['lang']);
}
- $this->new_config = $portal_config;
$cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
$error = array();
-
+
// We validate the complete config if whished
validate_config_vars($display_vars['vars'], $cfg_array, $error);
-
+
// Do not write values if there is an error
if (sizeof($error))
{
$submit = false;
}
+ if ($submit)
+ {
+ switch( $mode )
+ {
+ case 'links':
+ $links = array();
+
+ for($i = 1; $i <= $this->link_num; ++$i)
+ {
+ $links[$i] = array(
+ 'url' => $cfg_array['portal_link_'.$i.'_url'],
+ 'text' => $cfg_array['portal_link_'.$i.'_text'],
+ );
+ }
+ $display_vars['vars']['portal_links_array'] = '';
+ $cfg_array['portal_links_array'] = serialize($links);
+ break;
+ }
+ }
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($display_vars['vars'] as $config_name => $null)
{
- if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false)
+ if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') || ($type == 'links' && strpos($config_name, 'portal_link_') ) !== false)
{
continue;
}
@@ -331,6 +420,32 @@ class acp_portal
unset($display_vars['vars'][$config_key]);
}
}
+
+ function createLink($value, $key)
+ {
+ global $user, $phpEx;
+ $icon_up = '
';
+ $icon_up_d = '
';
+ $icon_down = '
';
+ $icon_down_d = '
';
+ $icon_del = '
';
+
+ return ' ' . $icon_del . ' ' . ( ($value['key'] < $this->link_num) ? $icon_down : $icon_down_d ) . ' ' . ( ($value['key'] > 1) ? $icon_up : $icon_up_d );
+ }
+
+ function addLink($value, $key)
+ {
+ global $user, $phpEx;
+
+ $link = append_sid("{$phpbb_root_path}index.$phpEx", 'i=portal&mode=links&action=add');
+
+ return ''.$user->lang['PORTAL_LINK_ADD'].'';
+ }
+}
+
+function utf_unserialize($serial_str) {
+ $out = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $serial_str );
+ return unserialize($out);
}
?>
\ No newline at end of file
diff --git a/root/includes/acp/info/acp_portal.php b/root/includes/acp/info/acp_portal.php
index ec2c17e6..0beedbc2 100644
--- a/root/includes/acp/info/acp_portal.php
+++ b/root/includes/acp/info/acp_portal.php
@@ -36,6 +36,7 @@ class acp_portal_info
'poster' => array('title' => 'ACP_PORTAL_MOST_POSTER_INFO', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
'customblock' => array('title' => 'ACP_PORTAL_CUSTOM_INFO', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
'minicalendar' => array('title' => 'ACP_PORTAL_MINICALENDAR_INFO', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
+ 'links' => array('title' => 'ACP_PORTAL_LINKS_INFO', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
),
);
}
diff --git a/root/install_portal/install.php b/root/install_portal/install.php
index c6035917..dae79108 100644
--- a/root/install_portal/install.php
+++ b/root/install_portal/install.php
@@ -822,7 +822,18 @@ if( $user->data['is_registered'] && $auth->acl_get('a_board') )
'module_mode' => 'customblock',
'module_auth' => ''
);
- $modules->update_module_data($customblock);
+ $modules->update_module_data($customblock);
+ $linkblock = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_LINKS_INFO',
+ 'module_mode' => 'links',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($linkblock);
// clear cache and log what we did
$cache->purge();
@@ -873,7 +884,18 @@ if( $user->data['is_registered'] && $auth->acl_get('a_board') )
'module_mode' => 'customblock',
'module_auth' => ''
);
- $modules->update_module_data($customblock);
+ $modules->update_module_data($customblock);
+ $linkblock = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_LINKS_INFO',
+ 'module_mode' => 'links',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($linkblock);
$updated = true;
}
diff --git a/root/install_portal/schemas/_schema_data.sql b/root/install_portal/schemas/_schema_data.sql
index e4f0fcb2..8d8023f9 100644
--- a/root/install_portal/schemas/_schema_data.sql
+++ b/root/install_portal/schemas/_schema_data.sql
@@ -84,6 +84,7 @@ INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_foru
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_news_show_last', '0');
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_news_archive', '1');
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_announcements_archive', '1');
+INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_links_array', 'a:2:{i:1;a:2:{s:4:"text";s:9:"Board3.de";s:3:"url";s:21:"http://www.board3.de/";}i:2;a:2:{s:4:"text";s:9:"phpBB.com";s:3:"url";s:21:"http://www.phpbb.com/";}}');
# POSTGRES COMMIT #
diff --git a/root/install_portal/schemas/update_schema.php b/root/install_portal/schemas/update_schema.php
index 569de8e1..49cc140d 100644
--- a/root/install_portal/schemas/update_schema.php
+++ b/root/install_portal/schemas/update_schema.php
@@ -26,6 +26,7 @@ $sql_update['0.2.3'] = array(
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_news_show_last', '0')",
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_news_archive', '1')",
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_announcements_archive', '1')",
+ "INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_links_array', 'a:2:{i:1;a:2:{s:4:\"text\";s:9:\"Board3.de\";s:3:\"url\";s:21:\"http://www.board3.de/\";}i:2;a:2:{s:4:\"text\";s:9:\"phpBB.com\";s:3:\"url\";s:21:\"http://www.phpbb.com/\";}}')",
);
?>
\ No newline at end of file
diff --git a/root/language/en/mods/info_acp_portal.php b/root/language/en/mods/info_acp_portal.php
index ffcfd9ef..6ae918b1 100644
--- a/root/language/en/mods/info_acp_portal.php
+++ b/root/language/en/mods/info_acp_portal.php
@@ -37,6 +37,7 @@ $lang = array_merge($lang, array(
'ACP_PORTAL_WELCOME_INFO' => 'Welcome message',
'ACP_PORTAL_CUSTOM_INFO' => 'Custom block',
'ACP_PORTAL_MINICALENDAR_INFO' => 'Mini calendar',
+ 'ACP_PORTAL_LINKS_INFO' => 'Links',
));
?>
\ No newline at end of file
diff --git a/root/language/en/mods/lang_portal_acp.php b/root/language/en/mods/lang_portal_acp.php
index 2aff1271..9d053971 100644
--- a/root/language/en/mods/lang_portal_acp.php
+++ b/root/language/en/mods/lang_portal_acp.php
@@ -53,8 +53,6 @@ $lang = array_merge($lang, array(
'PORTAL_CLOCK_EXPLAIN' => 'Display this block on portal.',
'PORTAL_LINK_US' => 'Link us block',
'PORTAL_LINK_US_EXPLAIN' => 'Display this block on portal.',
- 'PORTAL_LINKS' => 'Links block',
- 'PORTAL_LINKS_EXPLAIN' => 'Display this block on portal.',
'PORTAL_BIRTHDAYS' => 'Birthday block',
'PORTAL_BIRTHDAYS_EXPLAIN' => 'Display this block on portal.',
'PORTAL_BIRTHDAYS_AHEAD' => 'Birthdays ahead days',
@@ -238,6 +236,18 @@ $lang = array_merge($lang, array(
'PORTAL_WELCOME_INTRO' => 'Welcome message',
'PORTAL_WELCOME_GUEST' => 'Welcome message only for guests?',
'PORTAL_WELCOME_INTRO_EXPLAIN' => 'Change the welcome message (BBCode is allowed).',
+
+ // links
+ 'ACP_PORTAL_LINKS_INFO' => 'Links',
+ 'ACP_PORTAL_LINKS_SETTINGS' => 'Link Settings',
+ 'ACP_PORTAL_LINKS_SETTINGS_EXPLAIN' => 'Set up the link block links.',
+ 'PORTAL_LINKS' => 'Links block',
+ 'PORTAL_LINKS_EXPLAIN' => 'Display this block on portal.',
+ 'PORTAL_LINK_TEXT' => 'Text/URL',
+ 'PORTAL_LINK_TEXT_EXPLAIN' => 'The text followed by the url for the link. Use the buttons to delete and reorder the links.',
+ 'PORTAL_ADD_LINK_TEXT' => 'Add link',
+ 'PORTAL_ADD_LINK_TEXT_EXPLAIN' => 'Click the text to create a new link.',
+ 'PORTAL_LINK_ADD' => 'Add',
// custom
'ACP_PORTAL_CUSTOM_INFO' => 'Custom block',
diff --git a/root/portal.php b/root/portal.php
index 4e7aa40c..869c7236 100644
--- a/root/portal.php
+++ b/root/portal.php
@@ -227,10 +227,7 @@ if ($portal_config['portal_clock'])
if ($portal_config['portal_links'])
{
-// include($phpbb_root_path . 'portal/block/links.'.$phpEx);
- $template->assign_vars(array(
- 'S_DISPLAY_LINKS' => true,
- ));
+ include($phpbb_root_path . 'portal/block/links.'.$phpEx);
}
diff --git a/root/portal/block/links.php b/root/portal/block/links.php
index 91486e7f..a3d61e3e 100644
--- a/root/portal/block/links.php
+++ b/root/portal/block/links.php
@@ -20,6 +20,19 @@ if (!defined('IN_PORTAL'))
exit;
}
+$links = ( strlen($portal_config['portal_links_array']) > 0 ) ? unserialize($portal_config['portal_links_array']) : array();
+
+ksort( $links );
+reset( $links );
+
+foreach( $links as $link_id => $link_data )
+{
+ $template->assign_block_vars('link', array(
+ 'URL' => $link_data['url'],
+ 'TEXT' => $link_data['text'],
+ ));
+}
+
$template->assign_vars(array(
'S_DISPLAY_LINKS' => true,
));
diff --git a/root/styles/prosilver/template/portal/block/links.html b/root/styles/prosilver/template/portal/block/links.html
index 26f6e756..0c352366 100644
--- a/root/styles/prosilver/template/portal/block/links.html
+++ b/root/styles/prosilver/template/portal/block/links.html
@@ -4,9 +4,9 @@