Report#80:Add a custom block, managed in the ACP

This commit is contained in:
Kevin
2008-03-21 17:03:32 +00:00
parent b94f27aad8
commit 4ec3584b4c
22 changed files with 255 additions and 89 deletions

View File

@@ -196,20 +196,24 @@ class acp_portal
)
);
break;
/*
case 'ads':
case 'customblock':
$display_vars = array(
'title' => 'ACP_PORTAL_ADS_SETTINGS',
'title' => 'ACP_PORTAL_CUSTOM_SETTINGS',
'vars' => array(
'legend1' => 'ACP_PORTAL_ADS_SETTINGS',
'portal_ads_small' => array('lang' => 'PORTAL_ADS_SMALL' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
//'portal_ads_small_box' => array('lang' => 'PORTAL_ADS_SMALL_BOX' , 'validate' => 'string', 'type' => 'textarea:8:8', 'explain' => true),
'portal_ads_center' => array('lang' => 'PORTAL_ADS_CENTER' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
//'portal_ads_center_box' => array('lang' => 'PORTAL_ADS_CENTER_BOX' , 'validate' => 'string', 'type' => 'textarea:8:8', 'explain' => true),
'legend1' => 'ACP_PORTAL_CUSTOM_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_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' , 'validate' => 'string', 'type' => 'textarea:6:6', 'explain' => true),
'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_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' , 'validate' => 'string', 'type' => 'textarea:6:6', 'explain' => true),
)
);
break;
*/
case 'minicalendar':
$display_vars = array(
'title' => 'ACP_PORTAL_MINICALENDAR_SETTINGS',

View File

@@ -34,7 +34,7 @@ class acp_portal_info
'polls' => array('title' => 'ACP_PORTAL_POLLS_INFO', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
'bots' => array('title' => 'ACP_PORTAL_BOTS_INFO', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
'poster' => array('title' => 'ACP_PORTAL_MOST_POSTER_INFO', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
//'ads' => array('title' => 'ACP_PORTAL_ADS_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')),
),
);

View File

@@ -464,6 +464,17 @@ if( $user->data['is_registered'] && $auth->acl_get('a_board') )
'module_auth' => ''
);
$modules->update_module_data($minicalendar);
$customblock = array(
'module_basename' => 'portal',
'module_enabled' => 1,
'module_display' => 1,
'parent_id' => $portal['module_id'],
'module_class' => 'acp',
'module_langname' => 'ACP_PORTAL_CUSTOM_INFO',
'module_mode' => 'customblock',
'module_auth' => ''
);
$modules->update_module_data($customblock);
// clear cache and log what we did
$cache->purge();
add_log('admin', $page_title . ' installed');
@@ -603,7 +614,8 @@ if( $user->data['is_registered'] && $auth->acl_get('a_board') )
OR module_langname = 'ACP_PORTAL_POLLS_INFO'
OR module_langname = 'ACP_PORTAL_BOTS_INFO'
OR module_langname = 'ACP_PORTAL_MOST_POSTER_INFO'
OR module_langname = 'ACP_PORTAL_MINICALENDAR_INFO'";
OR module_langname = 'ACP_PORTAL_MINICALENDAR_INFO'
OR module_langname = 'ACP_PORTAL_CUSTOM_INFO'";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
@@ -800,6 +812,17 @@ if( $user->data['is_registered'] && $auth->acl_get('a_board') )
'module_auth' => ''
);
$modules->update_module_data($minicalendar);
$customblock = array(
'module_basename' => 'portal',
'module_enabled' => 1,
'module_display' => 1,
'parent_id' => $portal['module_id'],
'module_class' => 'acp',
'module_langname' => 'ACP_PORTAL_CUSTOM_INFO',
'module_mode' => 'customblock',
'module_auth' => ''
);
$modules->update_module_data($customblock);
// clear cache and log what we did
$cache->purge();
@@ -903,7 +926,8 @@ if( $user->data['is_registered'] && $auth->acl_get('a_board') )
OR module_langname = 'ACP_PORTAL_POLLS_INFO'
OR module_langname = 'ACP_PORTAL_BOTS_INFO'
OR module_langname = 'ACP_PORTAL_MOST_POSTER_INFO'
OR module_langname = 'ACP_PORTAL_MINICALENDAR_INFO'";
OR module_langname = 'ACP_PORTAL_MINICALENDAR_INFO'
OR module_langname = 'ACP_PORTAL_CUSTOM_INFO'";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{

View File

@@ -72,6 +72,14 @@ INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_atta
# Version 0.2.3 #
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_announcements_permissions', '1');
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_news_permissions', '1');
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_center', '0');
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_small', '0');
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_code_center', '');
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_code_small', '');
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_center_bbcode', '0');
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_small_bbcode', '0');
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_center_headline', 'Headline center box');
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_small_headline', 'Headline small box');
# POSTGRES COMMIT #

View File

@@ -14,6 +14,14 @@ $sql_update['0.2.2'] = array(
$sql_update['0.2.3'] = array(
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_announcements_permissions', '1')",
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_news_permissions', '1')",
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_center', '0')";
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_small', '0')";
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_code_center', '')";
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_code_small', '')";
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_center_bbcode', '0')";
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_small_bbcode', '0')";
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_center_headline', 'Headline center box')";
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_custom_small_headline', 'Headline small box')";
);
?>

View File

@@ -35,7 +35,7 @@ $lang = array_merge($lang, array(
'ACP_PORTAL_BOTS_INFO' => 'Last visited bots',
'ACP_PORTAL_MOST_POSTER_INFO' => 'Most posters',
'ACP_PORTAL_WELCOME_INFO' => 'Welcome message',
'ACP_PORTAL_ADS_INFO' => 'Advertisement',
'ACP_PORTAL_CUSTOM_INFO' => 'Custom block',
'ACP_PORTAL_MINICALENDAR_INFO' => 'Mini calendar',
));

View File

@@ -231,6 +231,27 @@ $lang = array_merge($lang, array(
'PORTAL_WELCOME_GUEST' => 'Welcome message only for guests?',
'PORTAL_WELCOME_INTRO_EXPLAIN' => 'Change the welcome message (BBCode is allowed). Max. 600 characters!',
// custom
'ACP_PORTAL_CUSTOM_INFO' => 'Custom block',
'ACP_PORTAL_CUSTOM_SETTINGS' => 'Custom blocks settings',
'ACP_PORTAL_CUSTOM_SETTINGS_EXPLAIN' => 'Here you can change your custom blocks. These blocks could be filled with HTML or BBCode for several purposes like advertisement, videos, images, flash or text. Just insert the needed code.',
'PORTAL_CUSTOM_SMALL_HEADLINE' => 'Headline for the small custom block',
'PORTAL_CUSTOM_SMALL_HEADLINE_EXPLAIN' => 'Here you can change the headline for the small custom block.',
'PORTAL_CUSTOM_SMALL' => 'Display the small custom block',
'PORTAL_CUSTOM_SMALL_EXPLAIN' => 'Display this block on portal.',
'PORTAL_CUSTOM_SMALL_BBCODE' => 'Activate BBCode for the small custom Block',
'PORTAL_CUSTOM_SMALL_BBCODE_EXPLAIN' => 'BBCode could be used in this Box. If BBCode is not activated, HTML will be parsed.',
'PORTAL_CUSTOM_CODE_SMALL' => 'Code for the small custom block',
'PORTAL_CUSTOM_CODE_SMALL_EXPLAIN' => 'Change the Code for the small custom Block (HTML or BBCode) here.',
'PORTAL_CUSTOM_CENTER' => 'Display the center custom block',
'PORTAL_CUSTOM_CENTER_EXPLAIN' => 'Display this block on portal.',
'PORTAL_CUSTOM_CENTER_HEADLINE' => 'Headline for the center custom block',
'PORTAL_CUSTOM_CENTER_HEADLINE_EXPLAIN' => 'Here you can change the headline for the center custom block.',
'PORTAL_CUSTOM_CENTER_BBCODE' => 'Activate BBCode for the center custom Block',
'PORTAL_CUSTOM_CENTER_BBCODE_EXPLAIN' => 'BBCode could be used in this Box. If BBCode is not activated, HTML will be parsed.',
'PORTAL_CUSTOM_CODE_CENTER' => 'Code for the center custom block',
'PORTAL_CUSTOM_CODE_CENTER_EXPLAIN' => 'Change the Code for the small custom Block (HTML or BBCode) here.',
// minicalendar
'ACP_PORTAL_MINICALENDAR_INFO' => 'Mini calendar',
'ACP_PORTAL_MINICALENDAR_SETTINGS' => 'Mini calendar settings',

View File

@@ -46,6 +46,7 @@ $lang = array_merge($lang, array(
'LOG_CONFIG_BOTS' => '<strong>Portal: Altered last visited bots settings</strong>',
'LOG_CONFIG_POSTER' => '<strong>Portal: Altered most posters settings</strong>',
'LOG_CONFIG_MINICALENDAR' => '<strong>Portal: Altered mini calendar settings</strong>',
'LOG_CONFIG_CUSTOMBLOCK' => '<strong>Portal: Altered custom block settings</strong>',
));

View File

@@ -101,15 +101,10 @@ if ( $load_center === TRUE )
));
}
/*
if ($portal_config['portal_ads_center'])
if ($portal_config['portal_custom_center'] or $portal_config['portal_custom_small'])
{
$template->assign_vars(array(
'S_ADS_CENTER' => ($portal_config['portal_ads_center_box']) ? true : false,
// 'ADS_CENTER_BOX' => $portal_config['portal_ads_center_box'],
));
include($phpbb_root_path . 'portal/block/custom.'.$phpEx);
}
*/
if ($config['load_online'] && $config['load_online_time'] && $portal_config['portal_whois_online'])
{
@@ -227,16 +222,6 @@ if ($portal_config['portal_pay_s_block'] or ( $portal_config['portal_pay_c_block
include($phpbb_root_path . 'portal/block/donate.'.$phpEx);
}
/*
if ($portal_config['portal_ads_small'])
{
$template->assign_vars(array(
'S_ADS_SMALL' => ($portal_config['portal_ads_small_box']) ? true : false,
// 'ADS_SMALL_BOX' => $portal_config['portal_ads_small_box'],
));
}
*/
$template->assign_vars(array(
'PORTAL_LEFT_COLLUMN' => $portal_config['portal_left_collumn_width'],
'PORTAL_RIGHT_COLLUMN' => $portal_config['portal_right_collumn_width'],

View File

@@ -0,0 +1,96 @@
<?php
/**
*
* @package - Board3portal
* @version $Id$
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) Ice, (c) nickvergessen ( http://www.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (!defined('IN_PORTAL'))
{
exit;
}
$allow_bbcode = 1;
$allow_urls = 1;
$allow_smilies = 1;
// Center Box
if ($portal_config['portal_custom_center'])
{
if ($portal_config['portal_custom_center_bbcode'])
{
$message_parser = new parse_message($portal_config['portal_custom_code_center']);
$message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies);
$text_center = $message_parser->message;
$bbcode_uid = $message_parser->bbcode_uid;
$bbcode_bitfield = $message_parser->bbcode_bitfield;
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
$text_center = censor_text($text_center);
$bbcode->bbcode_second_pass($text_center, $bbcode_uid, $bbcode_bitfield);
$text_center = bbcode_nl2br($text_center);
$text_center = smiley_text($text_center);
$template->assign_vars(array(
'PORTAL_CUSTOM_CENTER_CODE' => $text_center,
));
}
else
{
$template->assign_vars(array(
'PORTAL_CUSTOM_CENTER_CODE' => htmlspecialchars_decode($portal_config['portal_custom_code_center'],ENT_QUOTES),
));
}
$template->assign_vars(array(
'S_CUSTOM_CENTER' => true,
'PORTAL_CUSTOM_CENTER_HEADLINE' => $portal_config['portal_custom_center_headline'],
));
}
// Small Box
if ($portal_config['portal_custom_small'])
{
if ($portal_config['portal_custom_small_bbcode'])
{
$message_parser = new parse_message($portal_config['portal_custom_code_small']);
$message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies);
$text_small = $message_parser->message;
$bbcode_uid = $message_parser->bbcode_uid;
$bbcode_bitfield = $message_parser->bbcode_bitfield;
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
$text_small = censor_text($text_small);
$bbcode->bbcode_second_pass($text_small, $bbcode_uid, $bbcode_bitfield);
$text_small = bbcode_nl2br($text_small);
$text_small = smiley_text($text_small);
$template->assign_vars(array(
'PORTAL_CUSTOM_SMALL_CODE' => $text_small,
));
}
else
{
$template->assign_vars(array(
'PORTAL_CUSTOM_SMALL_CODE' => htmlspecialchars_decode($portal_config['portal_custom_code_small'],ENT_QUOTES),
));
}
$template->assign_vars(array(
'S_CUSTOM_SMALL' => true,
'PORTAL_CUSTOM_SMALL_HEADLINE' => $portal_config['portal_custom_small_headline'],
));
}
?>

View File

@@ -1,12 +0,0 @@
<div class="panel">
<div class="inner">
<span class="corners-top"><span></span></span>
<h3>{L_SPONSOR}</h3>
<div style="text-align: center;">
-insert ads codes here-
</div>
<br />
<span class="corners-bottom"><span></span></span>
</div>
</div>
<br style="clear:both" />

View File

@@ -0,0 +1,19 @@
<div class="forabg">
<div class="inner">
<span class="corners-top"><span></span></span>
<ul class="topiclist">
<li class="header"><dl><dt>{PORTAL_CUSTOM_CENTER_HEADLINE}</dt></dl></li>
</ul>
<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
<div class="postbody" style="width: 100%">
<div class="content">{PORTAL_CUSTOM_CENTER_CODE}</div>
</div>
<span class="corners-bottom"><span></span></span></div>
</div>
<span class="corners-bottom"><span></span></span>
</div>
</div>
<br style="clear:both" />

View File

@@ -1,9 +1,9 @@
<div class="panel">
<div class="inner">
<span class="corners-top"><span></span></span>
<h3>{L_SPONSOR}</h3>
<div style="text-align: center;">
-insert ads codes here-
<h3>{PORTAL_CUSTOM_SMALL_HEADLINE}</h3>
<div class="postbody" style="width: 100%">
<div class="content">{PORTAL_CUSTOM_SMALL_CODE}</div>
</div>
<br />
<span class="corners-bottom"><span></span></span>

View File

@@ -31,8 +31,8 @@
<!-- INCLUDE portal/block/attachments.html -->
<!-- ENDIF -->
<!-- IF S_ADS_SMALL -->
<!-- INCLUDE portal/block/ads_small.html -->
<!-- IF S_CUSTOM_SMALL -->
<!-- INCLUDE portal/block/custom_small.html -->
<!-- ENDIF -->
<!-- IF S_STYLE_OPTIONS -->
@@ -76,10 +76,9 @@
<!-- ENDIF -->
<!-- ENDIF -->
<!-- IF S_ADS_CENTER -->
<!-- INCLUDE portal/block/ads_center.html -->
<!-- IF S_CUSTOM_CENTER -->
<!-- INCLUDE portal/block/custom_center.html -->
<!-- ENDIF -->
<!-- IF S_DISPLAY_RECENT -->
<!-- INCLUDE portal/block/recent.html -->
<!-- ENDIF -->