Removed unnecessary acp_portal_blocks files;

Added language files for announcements module; 
Converted portal.php and acp_portal.php back to using the phpBB config table;
This commit is contained in:
Marc Alexander
2010-04-06 21:17:21 +00:00
parent 6b207166e3
commit 5bcfe37930
17 changed files with 180 additions and 1409 deletions

View File

@@ -1,285 +0,0 @@
<!-- INCLUDE overall_header.html -->
<a name="maincontent"></a>
<!-- IF S_EDIT -->
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">&laquo; {L_BACK}</a>
<script type="text/javascript">
// <![CDATA[
function update_icon(new_icon)
{
document.getElementById('current_icon').src = (new_icon) ? "{ICONS_PATH}/" + encodeURI(new_icon) : "./images/spacer.gif";
}
function display_types(value)
{
if (value == 'custom')
{
dE('custom_block', 1);
}
else
{
dE('custom_block', -1);
}
if (value == 'donation')
{
dE('donation_block', 1);
}
else
{
dE('donation_block', -1);
}
if (value == 'online_friends')
{
dE('online_friends_block', 1);
}
else
{
dE('online_friends_block', -1);
}
if (value == 'birthday')
{
dE('birthday_block', 1);
}
else
{
dE('birthday_block', -1);
}
if (value == 'latest_bots')
{
dE('latest_bots_block', 1);
}
else
{
dE('latest_bots_block', -1);
}
if (value == 'latest_members')
{
dE('latest_members_block', 1);
}
else
{
dE('latest_members_block', -1);
}
}
// ]]>
</script>
<script type="text/javascript">
// <![CDATA[
var form_name = 'acp_portal_blocks';
var text_name = 'block_text';
// Define the bbCode tags
var bbcode = new Array();
var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]','[flash=]', '[/flash]','[size=]','[/size]'<!-- BEGIN custom_tags -->, {custom_tags.BBCODE_NAME}<!-- END custom_tags -->);
var imageTag = false;
// Helpline messages
var help_line = {
b: '{LA_BBCODE_B_HELP}',
i: '{LA_BBCODE_I_HELP}',
u: '{LA_BBCODE_U_HELP}',
q: '{LA_BBCODE_Q_HELP}',
c: '{LA_BBCODE_C_HELP}',
l: '{LA_BBCODE_L_HELP}',
o: '{LA_BBCODE_O_HELP}',
p: '{LA_BBCODE_P_HELP}',
w: '{LA_BBCODE_W_HELP}',
s: '{LA_BBCODE_S_HELP}',
f: '{LA_BBCODE_F_HELP}',
e: '{LA_BBCODE_E_HELP}',
d: '{LA_BBCODE_D_HELP}',
t: '{LA_BBCODE_T_HELP}',
tip: '{L_STYLES_TIP}'
<!-- BEGIN custom_tags -->
,cb_{custom_tags.BBCODE_ID}: '{custom_tags.A_BBCODE_HELPLINE}'
<!-- END custom_tags -->
}
// ]]>
</script>
<script type="text/javascript" src="{T_TEMPLATE_PATH}/editor.js"></script>
<h1>{L_ACP_PORTAL_BLOCKS}</h1>
<p>{L_ACP_PORTAL_BLOCKS_EXPLAIN}</p>
<form id="acp_portal_blocks" method="post" action="{U_ACTION}">
<fieldset>
<legend>{L_ACP_PORTAL_BLOCKS}</legend>
<dl>
<dt><label for="block_title">{L_BLOCK_TITLE}:</label><br />
<span>{L_BLOCK_TITLE_EXPLAIN}</span></dt>
<dd><input name="block_title" type="text" id="block_title" value="{BLOCK_TITLE}" maxlength="255" /></dd>
</dl>
<dl>
<dt><label for="block_icon">{L_BLOCK_ICON}:</label><br />
<span>{L_BLOCK_ICON_EXPLAIN}</span></dt>
<dd><select name="block_icon" id="block_icon" onchange="update_icon(this.options[selectedIndex].value);">{S_ICON_FILENAME_LIST}</select></dd>
<dd><img src="{BLOCK_ICON}" id="current_icon" alt="" /></dd>
</dl>
<dl>
<dt><label for="block_groups">Gruppe:</label></dt>
<dd><select name="block_groups" id="block_groups">{S_BLOCK_GROUPS}</select></dd>
</dl>
<dl>
<dt><label for="block_position">{L_BLOCK_POSITION}:</label><br />
<span>{L_BLOCK_POSITION_EXPLAIN}</span></dt>
<dd><select name="block_position" id="block_position">{S_POSITION_OPTIONS}</select></dd>
</dl>
<dl>
<dt><label for="block_type">{L_BLOCK_TYPE}:</label><br />
<span>{L_BLOCK_TYPE_EXPLAIN}</span></dt>
<dd><select name="block_type" id="block_type" onchange="display_types(this.value);">{S_TYPE_OPTIONS}</select></dd>
</dl>
<!-- IF S_SELECT_BIRTHDAY --><div id="birthday_block" style="display: none;"><!-- ELSE --><div id="birthday_block"><!-- ENDIF -->
<dl>
<dt><label for="block_birthday">Geburtstag:</label></dt>
<dd><input name="block_birthday" type="text" id="block_birthday" value="{BLOCK_BIRTHDAY}" maxlength="255" /></dd>
</dl>
</div>
<!-- IF S_SELECT_PAYPAL --><div id="donation_block" style="display: none;"><!-- ELSE --><div id="donation_block"><!-- ENDIF -->
<dl>
<dt><label for="block_donation">{L_PORTAL_PAY_ACC}:</label><br />
<span>{L_PORTAL_PAY_ACC_EXPLAIN}</span></dt>
<dd><input name="block_donation" type="text" id="block_donation" value="{BLOCK_PAYPAL}" maxlength="255" /></dd>
</dl>
</div>
<!-- IF S_SELECT_ONLINE_FRIENDS --><div id="online_friends_block" style="display: none;"><!-- ELSE --><div id="online_friends_block"><!-- ENDIF -->
<dl>
<dt><label for="block_online_friends">{L_PORTAL_MAX_ONLINE_FRIENDS}:</label><br />
<span>{L_PORTAL_MAX_ONLINE_FRIENDS_EXPLAIN}</span></dt>
<dd><input name="block_online_friends" type="text" id="block_online_friends" value="{BLOCK_ONLINE_FRIENDS}" maxlength="3" size="3" /></dd>
</dl>
</div>
<!-- IF S_SELECT_LATEST_MEMBERS --><div id="latest_members_block" style="display: none;"><!-- ELSE --><div id="latest_members_block"><!-- ENDIF -->
<dl>
<dt><label for="block_latest_members">{L_PORTAL_MAX_LAST_MEMBER}:</label><br />
<span>{L_PORTAL_MAX_LAST_MEMBER_EXPLAIN}</span></dt>
<dd><input name="block_latest_members" type="text" id="block_latest_members" value="{BLOCK_LATEST_MEMBERS}" maxlength="3" size="3" /></dd>
</dl>
</div>
<!-- IF S_SELECT_LATEST_BOTS --><div id="latest_bots_block" style="display: none;"><!-- ELSE --><div id="latest_bots_block"><!-- ENDIF -->
<dl>
<dt><label for="block_latest_bots">{L_PORTAL_LAST_VISITED_BOTS_NUMBER}:</label><br />
<span>{L_PORTAL_LAST_VISITED_BOTS_NUMBER_EXPLAIN}</span></dt>
<dd><input name="block_latest_bots" type="text" id="block_latest_bots" value="{BLOCK_LATEST_BOTS}" maxlength="3" size="3" /></dd>
</dl>
</div>
<!-- IF S_SELECT_BLOCK --><div id="custom_block" style="display: none;"><!-- ELSE --><div id="custom_block"><!-- ENDIF -->
<!-- IF BLOCK_TEXT_PREVIEW -->
<dl>
<dt><label>{L_PREVIEW}:</label></dt>
<dd>{BLOCK_TEXT_PREVIEW}</dd>
</dl>
<!-- ENDIF -->
<dl>
<dt><label for="block_text">{L_BLOCK_TEXT}:</label><br />
<span>{L_BLOCK_TEXT_EXPLAIN}</span>
<div id="format-buttons">
{L_FONT_SIZE}: <select name="addbbcode20" onchange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]');this.form.addbbcode20.selectedIndex = 2;" title="{L_FONT_SIZE}" onmouseover="helpline('f')" onmouseout="helpline('tip')">
<option value="50">{L_FONT_TINY}</option>
<option value="85">{L_FONT_SMALL}</option>
<option value="100" selected="selected">{L_FONT_NORMAL}</option>
<option value="150">{L_FONT_LARGE}</option>
<option value="200">{L_FONT_HUGE}</option>
</select>
<br /><br />
<input type="button" class="button2" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px;" onclick="bbstyle(0)" onmouseover="helpline('b')" onmouseout="helpline('tip')" />
<input type="button" class="button2" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px;" onclick="bbstyle(2)" onmouseover="helpline('i')" onmouseout="helpline('tip')" />
<input type="button" class="button2" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px;" onclick="bbstyle(4)" onmouseover="helpline('u')" onmouseout="helpline('tip')" />
<input type="button" class="button2" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onclick="bbstyle(6)" onmouseover="helpline('q')" onmouseout="helpline('tip')" />
<input type="button" class="button2" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" onmouseover="helpline('c')" onmouseout="helpline('tip')" />
<input type="button" class="button2" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" onmouseover="helpline('l')" onmouseout="helpline('tip')" />
<input type="button" class="button2" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" onmouseover="helpline('o')" onmouseout="helpline('tip')" />
<input type="button" class="button2" accesskey="t" name="addlitsitem" value="[*]" style="width: 40px" onclick="bbstyle(-1)" onmouseover="helpline('e')" onmouseout="helpline('tip')" />
<input type="button" class="button2" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" onmouseover="helpline('p')" onmouseout="helpline('tip')" />
<input type="button" class="button2" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onclick="bbstyle(16)" onmouseover="helpline('w')" onmouseout="helpline('tip')" />
<input type="button" class="button2" accesskey="d" name="addbbcode18" value="Flash" onclick="bbstyle(18)" onmouseover="helpline('d')" onmouseout="helpline('tip')" />
<!-- IF .custom_tags -->
<!-- BEGIN custom_tags -->
<input type="button" class="button2" name="addbbcode{custom_tags.BBCODE_ID}" value="{custom_tags.BBCODE_TAG}" onclick="bbstyle({custom_tags.BBCODE_ID})"<!-- IF custom_tags.BBCODE_HELPLINE !== '' --> onmouseover="helpline('cb_{custom_tags.BBCODE_ID}')" onmouseout="helpline('tip')"<!-- ENDIF --> />
<!-- END custom_tags -->
<!-- ENDIF -->
<p><input type="text" class="text full" style="border: 0; background: none;" name="helpbox" value="{L_STYLES_TIP}" /></p>
<script type="text/javascript">
// <![CDATA[
colorPalette('h', 12, 10);
// ]]>
</script>
</div>
</dt>
<dd><textarea id="block_text" name="block_text" rows="20" cols="45">{BLOCK_TEXT}</textarea></dd>
<dd><label><input type="checkbox" class="radio" name="text_parse_bbcode"<!-- IF S_TEXT_BBCODE_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_BBCODE}</label>
<label><input type="checkbox" class="radio" name="text_parse_smilies"<!-- IF S_TEXT_SMILIES_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_SMILIES}</label>
<label><input type="checkbox" class="radio" name="text_parse_urls"<!-- IF S_TEXT_URLS_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_URLS}</label></dd>
</dl>
</div>
<p class="submit-buttons">
<input type="hidden" name="action" value="save" />
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />&nbsp;
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
{S_FORM_TOKEN}
</p>
</fieldset>
</form>
<!-- ELSE -->
<h1>{L_ACP_PORTAL_BLOCKS}</h1>
<p>{L_ACP_PORTAL_BLOCKS_EXPLAIN}</p>
<form id="acp_portal_blocks" method="post" action="{U_ACTION}">
<fieldset class="tabulated">
<legend>{L_ACP_PORTAL_BLOCKS}</legend>
<p class="quick">
<input class="button2" name="add" type="submit" value="{L_ADD_BLOCK}" />
</p>
<table cellspacing="1">
<thead>
<tr>
<th>{L_BLOCK_ICON}</th>
<th>{L_BLOCK_TITLE}</th>
<th>{L_BLOCK_TYPE}</th>
<th>{L_BLOCK_POSITION}</th>
<th>{L_ACTION}</th>
</tr>
</thead>
<tbody>
<!-- BEGIN blocks -->
<!-- IF blocks.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
<td style="text-align: center;"><!-- IF blocks.S_BLOCK_ICON --><img src="{blocks.BLOCK_ICON}" alt="{blocks.BLOCK_TITLE}" title="{blocks.BLOCK_TITLE}" /><!-- ELSE -->&nbsp; - &nbsp;<!-- ENDIF --></td>
<td style="text-align: center;">{blocks.BLOCK_TITLE}</td>
<td style="text-align: center;">{blocks.BLOCK_TYPE}</td>
<td style="text-align: center;">{blocks.BLOCK_POSITION}<!-- IF not blocks.S_BLOCK_DISABLED --> [ <a href="{blocks.U_DISABLE}">{L_DISABLE}</a> ]<!-- ENDIF --></td>
<td style="text-align: center;">
<!-- IF blocks.S_FIRST_ROW -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{blocks.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->&nbsp;
<!-- IF blocks.S_LAST_ROW -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{blocks.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->&nbsp;
<a href="{blocks.U_EDIT}">{ICON_EDIT}</a> <a href="{blocks.U_DELETE}">{ICON_DELETE}</a>
</td>
</tr>
<!-- END blocks -->
</tbody>
</table>
{S_FORM_TOKEN}
</fieldset>
</form>
<!-- ENDIF -->
<!-- INCLUDE overall_footer.html -->

View File

@@ -22,19 +22,19 @@ class acp_portal
function main($id, $mode) function main($id, $mode)
{ {
global $db, $user, $cache, $template, $display_vars; global $db, $user, $cache, $template, $display_vars;
global $config, $portal_config, $phpbb_root_path, $portal_root_path, $phpbb_admin_path, $phpEx; global $config, $phpbb_root_path, $portal_root_path, $phpbb_admin_path, $phpEx;
$portal_root_path = PORTAL_ROOT_PATH; $portal_root_path = PORTAL_ROOT_PATH;
if (!function_exists('column_string_const')) if (!function_exists('column_string_const'))
{ {
include($phpbb_root_path . $portal_root_path . 'includes/functions_modules.' . $phpEx); include($phpbb_root_path . $portal_root_path . 'includes/functions_modules.' . $phpEx);
} }
/*
if (!function_exists('obtain_portal_config')) if (!function_exists('obtain_portal_config'))
{ {
include($phpbb_root_path . $portal_root_path . 'includes/functions.' . $phpEx); include($phpbb_root_path . $portal_root_path . 'includes/functions.' . $phpEx);
} }
$portal_config = obtain_portal_config(); $portal_config = obtain_portal_config();
/*
if (!function_exists('mod_version_check')) if (!function_exists('mod_version_check'))
{ {
include($phpbb_root_path . $portal_root_path . 'includes/functions_version_check.' . $phpEx); include($phpbb_root_path . $portal_root_path . 'includes/functions_version_check.' . $phpEx);
@@ -110,7 +110,7 @@ class acp_portal
} }
} }
$this->new_config = $portal_config; $this->new_config = $config;
$cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config; $cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
$error = array(); $error = array();
@@ -139,7 +139,7 @@ class acp_portal
if ($submit) if ($submit)
{ {
set_portal_config($config_name, $config_value); set_config($config_name, $config_value);
} }
} }
@@ -190,7 +190,7 @@ class acp_portal
continue; continue;
} }
//$this->new_config[$config_key] = $config[$config_key]; $this->new_config[$config_key] = $config[$config_key];
$type = explode(':', $vars['type']); $type = explode(':', $vars['type']);
$l_explain = ''; $l_explain = '';

View File

@@ -1,499 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
// COULD BE DELETED
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* @package acp
*/
class acp_portal_blocks
{
var $u_action;
function main($id, $mode)
{
global $db, $user, $template, $cache, $portal_config;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$portal_root_path = PORTAL_ROOT_PATH;
$portal_icons_path = PORTAL_ICONS_PATH;
include($phpbb_root_path . $portal_root_path . 'includes/functions.' . $phpEx);
$portal_config = obtain_portal_config();
// Set up general vars
$action = request_var('action', '');
$action = (isset($_POST['add'])) ? 'add' : $action;
$action = (isset($_POST['save'])) ? 'save' : $action;
$block_id = request_var('id', 0);
$this->tpl_name = 'acp_portal_blocks';
$this->page_title = 'ACP_PORTAL_BLOCKS';
$form_name = 'acp_portal_blocks';
add_form_key($form_name);
switch ($action)
{
case 'save':
if (!check_form_key($form_name))
{
trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);
}
$block_title = utf8_normalize_nfc(request_var('block_title', '', true));
$block_birthday = request_var('block_birthday', '');
$block_online_friends = request_var('block_online_friends', '');
$block_donation = request_var('block_donation', '');
$block_latest_members = request_var('block_latest_members', '');
$block_latest_bots = request_var('block_latest_bots', '');
$block_type = request_var('block_type', '');
$block_position = request_var('block_position', 0);
$block_groups = request_var('block_groups', 0);
$block_icon = request_var('block_icon', '');
$block_text = ($block_type == 'custom') ? utf8_normalize_nfc(request_var('block_text', '', true)) : '';
if ($block_icon != '' && !preg_match('#(\.gif|\.png|\.jpg|\.jpeg)$#i', $block_icon))
{
$block_icon = '';
}
if (!$block_title)
{
trigger_error($user->lang['NO_BLOCK_TITLE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
if ($block_type == 'custom' && $block_text == '')
{
trigger_error($user->lang['NO_BLOCK_TEXT'] . adm_back_link($this->u_action), E_USER_WARNING);
}
set_portal_config('portal_birthdays_ahead', $block_birthday);
set_portal_config('portal_max_online_friends', $block_online_friends);
set_portal_config('portal_pay_acc', $block_donation);
set_portal_config('portal_max_last_member', $block_latest_members);
set_portal_config('portal_last_visited_bots_number', $block_latest_bots);
$sql_ary = array(
'block_title' => $block_title,
'block_type' => $block_type,
'block_position' => $block_position,
'block_groups' => $block_groups,
'block_icon' => htmlspecialchars_decode($block_icon),
'block_text' => ($block_type == 'custom') ? $block_text : '',
'block_text_uid' => '',
'block_text_options' => 7,
'block_text_bitfield' => '',
);
$order_ary = array(
'block_order' => $portal_config['num_blocks'] + 1,
);
// Get data for block text if specified
if ($sql_ary['block_text'])
{
generate_text_for_storage($sql_ary['block_text'], $sql_ary['block_text_uid'], $sql_ary['block_text_bitfield'], $sql_ary['block_text_options'], request_var('text_parse_bbcode', false), request_var('text_parse_urls', false), request_var('text_parse_smilies', false));
}
if ($block_id)
{
$sql = 'UPDATE ' . PORTAL_BLOCKS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE block_id = $block_id";
$message = $user->lang['BLOCK_UPDATED'];
add_log('admin', 'LOG_BLOCK_UPDATED', (!empty($user->lang[strtoupper($block_title)])) ? $user->lang[strtoupper($block_title)] : $block_title);
}
else
{
$sql = 'INSERT INTO ' . PORTAL_BLOCKS_TABLE . ' ' . $db->sql_build_array('INSERT', array_merge($sql_ary, $order_ary));
$message = $user->lang['BLOCK_ADDED'];
set_portal_config('num_blocks', $portal_config['num_blocks'] + 1, true);
add_log('admin', 'LOG_BLOCK_ADDED', (!empty($user->lang[strtoupper($block_title)])) ? $user->lang[strtoupper($block_title)] : $block_title);
}
$db->sql_query($sql);
$cache->destroy('_blocks');
trigger_error($message . adm_back_link($this->u_action));
break;
case 'delete':
if (!$block_id)
{
trigger_error($user->lang['MUST_SELECT_BLOCK'] . adm_back_link($this->u_action), E_USER_WARNING);
}
if (confirm_box(true))
{
$sql = 'SELECT block_title, block_order
FROM ' . PORTAL_BLOCKS_TABLE . "
WHERE block_id = $block_id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($row)
{
$row['block_title'] = (string) $row['block_title'];
$row['block_order'] = (int) $row['block_order'];
}
$sql = 'DELETE FROM ' . PORTAL_BLOCKS_TABLE . " WHERE block_id = $block_id";
$db->sql_query($sql);
$sql = 'UPDATE ' . PORTAL_BLOCKS_TABLE . ' SET block_order = block_order - 1 WHERE block_order > ' . $row['block_order'];
$db->sql_query($sql);
$cache->destroy('_blocks');
set_portal_config('num_blocks', $portal_config['num_blocks'] - 1, true);
add_log('admin', 'LOG_BLOCK_REMOVED', (!empty($user->lang[strtoupper($row['block_title'])])) ? $user->lang[strtoupper($row['block_title'])] : $row['block_title']);
}
else
{
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
'i' => $id,
'mode' => $mode,
'block_id' => $block_id,
'action' => 'delete',
)));
}
break;
case 'disable':
if (!$block_id)
{
trigger_error($user->lang['MUST_SELECT_BLOCK'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$sql = 'SELECT block_title
FROM ' . PORTAL_BLOCKS_TABLE . "
WHERE block_id = $block_id";
$result = $db->sql_query($sql);
$disabled_block = $db->sql_fetchfield('block_title');
$db->sql_freeresult($result);
$sql = 'UPDATE ' . PORTAL_BLOCKS_TABLE . " SET block_position = 0 WHERE block_id = $block_id";
$db->sql_query($sql);
$cache->destroy('_blocks');
add_log('admin', 'LOG_BLOCK_DISABLED', (!empty($user->lang[strtoupper($disabled_block)])) ? $user->lang[strtoupper($disabled_block)] : $disabled_block);
break;
case 'move_up':
case 'move_down':
if (!$block_id)
{
trigger_error($user->lang['MUST_SELECT_BLOCK'] . adm_back_link($this->u_action), E_USER_WARNING);
}
// Get current order id...
$sql = 'SELECT block_order AS current_order
FROM ' . PORTAL_BLOCKS_TABLE . "
WHERE block_id = $block_id";
$result = $db->sql_query($sql);
$current_order = (int) $db->sql_fetchfield('current_order');
$db->sql_freeresult($result);
if ($current_order == 0 && $action == 'move_up')
{
break;
}
$switch_order_id = ($action == 'move_down') ? $current_order + 1 : $current_order - 1;
$sql = 'UPDATE ' . PORTAL_BLOCKS_TABLE . "
SET block_order = $current_order
WHERE block_order = $switch_order_id
AND block_id <> $block_id";
$db->sql_query($sql);
if ($db->sql_affectedrows())
{
$sql = 'UPDATE ' . PORTAL_BLOCKS_TABLE . "
SET block_order = $switch_order_id
WHERE block_order = $current_order
AND block_id = $block_id";
$db->sql_query($sql);
}
$cache->destroy('_blocks');
break;
case 'edit':
case 'add':
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
$user->add_lang('posting');
// Assigning custom bbcodes
display_custom_bbcodes();
$blocks = $existing_icons = array();
$sql = 'SELECT *
FROM ' . PORTAL_BLOCKS_TABLE . '
ORDER BY block_order';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$existing_icons[] = $row['block_icon'];
if ($action == 'edit' && $block_id == $row['block_id'])
{
$blocks = $row;
}
}
$db->sql_freeresult($result);
// Select the block icon
$icon_list = filelist($phpbb_root_path . $portal_icons_path);
$edit_icon = $icon_filename_list = '';
foreach ($icon_list as $path => $icon_ary)
{
sort($icon_ary);
foreach ($icon_ary as $icon)
{
$icon = $path . $icon;
if (!in_array($icon, $existing_icons) || $action == 'edit')
{
if ($blocks && $icon == $blocks['block_icon'])
{
$selected = ' selected="selected"';
$edit_icon = $icon;
}
else
{
$selected = '';
}
if (strlen($icon) > 255)
{
continue;
}
$icon_filename_list .= '<option value="' . htmlspecialchars($icon) . '"' . $selected . '>' . $icon . '</option>';
}
}
}
$icon_filename_list = '<option value=""' . (($edit_icon == '') ? ' selected="selected"' : '') . '>' . $user->lang['SELECT_BLOCK_ICON'] . '</option>' . $icon_filename_list;
unset($existing_icons, $icon_list);
$block_groups = '';
$sql = 'SELECT g.*
FROM ' . GROUPS_TABLE . ' g
ORDER BY g.group_id';
$result = $db->sql_query($sql);
$block_groups = '<option value="0"' . ((0 <> isset($blocks['block_groups'])) ? '' : ' selected="selected"') . '>' . "Alle" . '</option>';
while ($row = $db->sql_fetchrow($result))
{
$block_groups .= '<option value="' . $row['group_id'] . '"' . (($row['group_id'] <> isset($blocks['block_groups'])) ? '' : ' selected="selected"') . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
}
$db->sql_freeresult($result);
// Select the display position for block
$position_list = array(
'none' => array($user->lang['BLOCK_POSITION_NONE'], BLOCK_NONE),
'left' => array($user->lang['BLOCK_POSITION_LEFT'], BLOCK_LEFT),
'right' => array($user->lang['BLOCK_POSITION_RIGHT'], BLOCK_RIGHT),
'top' => array($user->lang['BLOCK_POSITION_TOP'], BLOCK_TOP),
'bottom' => array($user->lang['BLOCK_POSITION_BOTTOM'], BLOCK_BOTTOM),
'middle_top' => array($user->lang['BLOCK_POSITION_MIDDLE_TOP'], BLOCK_MIDDLE_TOP),
'middle_bottom' => array($user->lang['BLOCK_POSITION_MIDDLE_BOTTOM'], BLOCK_MIDDLE_BOTTOM),
);
$s_position_options = '<option value=""' . ((!isset($blocks['block_position'])) ? ' selected="selected"' : '') . '>' . $user->lang['SELECT_BLOCK_POSITION'] . '</option>';
foreach ($position_list as $position_var => $position_ary)
{
$selected = (isset($blocks['block_position']) && $position_ary[1] == $blocks['block_position']) ? ' selected="selected"' : '';
$s_position_options .= '<option value="' . $position_ary[1] . '" ' . $selected . '>' . $position_ary[0] . '</option>';
}
// Select the block type
$type_list = array(
0 => array($user->lang['BLOCK_CUSTOM'], 'custom'),
1 => array($user->lang['BLOCK_BIRTHDAY'], 'birthday'),
2 => array($user->lang['BLOCK_ONLINE'], 'online'),
3 => array($user->lang['BLOCK_SEARCH'], 'search'),
4 => array($user->lang['BLOCK_CLOCK'], 'clock'),
5 => array($user->lang['BLOCK_USER_MENU'], 'user_menu'),
6 => array($user->lang['BLOCK_CHANGE_STYLE'], 'change_style'),
7 => array($user->lang['BLOCK_DONATION'], 'donation'),
8 => array($user->lang['BLOCK_LINKS'], 'links'),
9 => array($user->lang['BLOCK_LATEST_BOTS'], 'latest_bots'),
10 => array($user->lang['BLOCK_LATEST_MEMBERS'], 'latest_members'),
11 => array($user->lang['BLOCK_MINI_CALENDAR'], 'mini_calendar'),
12 => array($user->lang['BLOCK_ONLINE_FRIENDS'], 'online_friends'),
13 => array($user->lang['BLOCK_STATISTICS'], 'statistics'),
14 => array($user->lang['BLOCK_TOP_POSTER'], 'top_poster'),
//15 => array($user->lang['BLOCK_'], ''),// Add your blocks here...
);
$s_type_options = '<option value=""' . ((!isset($blocks['block_type'])) ? ' selected="selected"' : '') . '>' . $user->lang['SELECT_BLOCK_TYPE'] . '</option>';
foreach ($type_list as $type_var => $type_ary)
{
$selected = (isset($blocks['block_type']) && $type_ary[1] == $blocks['block_type']) ? ' selected="selected"' : '';
$s_type_options .= '<option value="' . $type_ary[1] . '" ' . $selected . '>' . $type_ary[0] . '</option>';
}
$block_text_data = array(
'text' => (isset($blocks['block_text'])) ? $blocks['block_text'] : '',
'allow_bbcode' => true,
'allow_smilies' => true,
'allow_urls' => true
);
$block_text_preview = '';
if (isset($blocks['block_text']))
{
if (!isset($blocks['block_text_uid']))
{
$blocks['block_text_uid'] = '';
$blocks['block_text_bitfield'] = '';
$blocks['block_text_options'] = 0;
generate_text_for_storage($blocks['block_text'], $blocks['block_text_uid'], $blocks['block_text_bitfield'], $blocks['block_text_options'], request_var('text_allow_bbcode', false), request_var('text_allow_urls', false), request_var('text_allow_smilies', false));
}
$block_text_preview = generate_text_for_display($blocks['block_text'], $blocks['block_text_uid'], $blocks['block_text_bitfield'], $blocks['block_text_options']);
$block_text_data = generate_text_for_edit($blocks['block_text'], $blocks['block_text_uid'], $blocks['block_text_options']);
}
$template->assign_vars(array(
'TYPE' => (isset($blocks['block_type'])) ? $blocks['block_type'] : '',
'ICONS_PATH' => $phpbb_root_path . $portal_icons_path,
'BLOCK_TITLE' => (isset($blocks['block_title'])) ? $blocks['block_title'] : '',
'BLOCK_PAYPAL' => (isset($portal_config['portal_pay_acc'])) ? $portal_config['portal_pay_acc'] : '',
'BLOCK_BIRTHDAY' => (isset($portal_config['portal_birthdays_ahead'])) ? $portal_config['portal_birthdays_ahead'] : '',
'BLOCK_LATEST_MEMBERS' => (isset($portal_config['portal_max_last_member'])) ? $portal_config['portal_max_last_member'] : '',
'BLOCK_ONLINE_FRIENDS' => (isset($portal_config['portal_max_online_friends'])) ? $portal_config['portal_max_online_friends'] : '',
'BLOCK_LATEST_BOTS' => (isset($portal_config['portal_last_visited_bots_number'])) ? $portal_config['portal_last_visited_bots_number'] : '',
'BLOCK_GROUPS' => (isset($blocks['block_groups'])) ? $blocks['block_groups'] : 0,
'BLOCK_POSITION' => (isset($blocks['block_position'])) ? $blocks['block_position'] : 0,
'BLOCK_ICON' => ($edit_icon) ? $phpbb_root_path . $portal_icons_path . '/' . $edit_icon : $phpbb_admin_path . 'images/spacer.gif',
'BLOCK_TEXT' => $block_text_data['text'],
'BLOCK_TEXT_PREVIEW' => $block_text_preview,
'U_BACK' => $this->u_action,
'U_ACTION' => $this->u_action . '&amp;id=' . $block_id,
'S_EDIT' => true,
'S_ICON_FILENAME_LIST' => $icon_filename_list,
'S_POSITION_OPTIONS' => $s_position_options,
'S_BLOCK_GROUPS' => $block_groups,
'S_TYPE_OPTIONS' => $s_type_options,
'S_SELECT_BLOCK' => (!isset($blocks['block_type']) || $blocks['block_type'] != 'custom') ? true : false,
'S_SELECT_BIRTHDAY' => (!isset($blocks['block_type']) || $blocks['block_type'] != 'birthday') ? true : false,
'S_SELECT_ONLINE_FRIENDS' => (!isset($blocks['block_type']) || $blocks['block_type'] != 'online_friends') ? true : false,
'S_SELECT_PAYPAL' => (!isset($blocks['block_type']) || $blocks['block_type'] != 'donation') ? true : false,
'S_SELECT_LATEST_MEMBERS' => (!isset($blocks['block_type']) || $blocks['block_type'] != 'latest_members') ? true : false,
'S_SELECT_LATEST_BOTS' => (!isset($blocks['block_type']) || $blocks['block_type'] != 'latest_bots') ? true : false,
'S_TEXT_BBCODE_CHECKED' => ($block_text_data['allow_bbcode']) ? true : false,
'S_TEXT_SMILIES_CHECKED' => ($block_text_data['allow_smilies']) ? true : false,
'S_TEXT_URLS_CHECKED' => ($block_text_data['allow_urls']) ? true : false,
));
return;
break;
}
$template->assign_vars(array(
'U_ACTION' => $this->u_action,
));
$sql = 'SELECT *
FROM ' . PORTAL_BLOCKS_TABLE . '
ORDER BY block_order';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
switch ($row['block_position'])
{
case BLOCK_LEFT:
$position = $user->lang['BLOCK_POSITION_LEFT'];
break;
case BLOCK_RIGHT:
$position = $user->lang['BLOCK_POSITION_RIGHT'];
break;
case BLOCK_TOP:
$position = $user->lang['BLOCK_POSITION_TOP'];
break;
case BLOCK_BOTTOM:
$position = $user->lang['BLOCK_POSITION_BOTTOM'];
break;
case BLOCK_MIDDLE_TOP:
$position = $user->lang['BLOCK_POSITION_MIDDLE_TOP'];
break;
case BLOCK_MIDDLE_BOTTOM:
$position = $user->lang['BLOCK_POSITION_MIDDLE_BOTTOM'];
break;
case BLOCK_NONE:
default:
$position = $user->lang['BLOCK_POSITION_NONE'];
break;
}
$template->assign_block_vars('blocks', array(
'BLOCK_TITLE' => (!empty($user->lang[strtoupper($row['block_title'])])) ? $user->lang[strtoupper($row['block_title'])] : $row['block_title'],
'BLOCK_POSITION' => $position,
//'BLOCK_GROUP' => $groups,
'BLOCK_TYPE' => $user->lang['BLOCK_' . strtoupper($row['block_type'])],
'BLOCK_ICON' => $phpbb_root_path . $portal_icons_path . '/' . $row['block_icon'],
'U_DISABLE' => $this->u_action . '&amp;action=disable&amp;id=' . $row['block_id'],
'U_EDIT' => $this->u_action . '&amp;action=edit&amp;id=' . $row['block_id'],
'U_DELETE' => $this->u_action . '&amp;action=delete&amp;id=' . $row['block_id'],
'U_MOVE_UP' => $this->u_action . '&amp;action=move_up&amp;id=' . $row['block_id'],
'U_MOVE_DOWN' => $this->u_action . '&amp;action=move_down&amp;id=' . $row['block_id'],
'S_BLOCK_ICON' => ($row['block_icon']) ? true : false,
'S_BLOCK_DISABLED' => ($row['block_position'] == BLOCK_NONE) ? true : false,
));
}
$db->sql_freeresult($result);
}
}
?>

View File

@@ -1,42 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* @package module_install
*/
class acp_portal_blocks_info
{
function module()
{
return array(
'filename' => 'acp_portal_blocks',
'title' => 'ACP_PORTAL_BLOCKS',
'version' => '2.0.0',
'modes' => array(
'blocks' => array('title' => 'ACP_PORTAL_MANAGE_BLOCKS', 'auth' => 'acl_a_portal', 'cat' => array('ACP_PORTAL')),
),
);
}
function install()
{
}
function uninstall()
{
}
}
?>

View File

@@ -0,0 +1,51 @@
<?php
/**
* @package Portal - Topposters
* @version $Id$
* @copyright (c) 2009, 2010 Board3 Portal Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array(
'LATEST_ANNOUNCEMENTS' => 'Letzte Bekanntmachung',
'GLOBAL_ANNOUNCEMENT' => 'Globale Bekanntmachung',
'VIEW_LATEST_ANNOUNCEMENT' => '1 Bekanntmachung',
'VIEW_LATEST_ANNOUNCEMENTS' => '%d Bekanntmachungen',
'READ_FULL' => 'alles lesen',
'NO_ANNOUNCEMENTS' => 'Keine Bekanntmachung',
'POSTED_BY' => 'Autor',
'COMMENTS' => 'Antworten',
'VIEW_COMMENTS' => 'Antworten anzeigen',
'POST_REPLY' => 'Antwort schreiben',
'TOPIC_VIEWS' => 'Zugriffe',
'JUMP_NEWEST' => 'Zum letzten Beitrag springen',
'JUMP_FIRST' => 'Zum ersten Beitrag springen',
'JUMP_TO_POST' => 'Rufe den Beitrag auf',
'BACK' => 'Zur<75>ck',
));
?>

View File

@@ -0,0 +1,51 @@
<?php
/**
* @package Portal - Topposters
* @version $Id$
* @copyright (c) 2009, 2010 Board3 Portal Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array(
'LATEST_ANNOUNCEMENTS' => 'Latest global announcements',
'GLOBAL_ANNOUNCEMENT' => 'Global announcement',
'VIEW_LATEST_ANNOUNCEMENT' => '1 announcement',
'VIEW_LATEST_ANNOUNCEMENTS' => '%d announcements',
'READ_FULL' => 'Read all',
'NO_ANNOUNCEMENTS' => 'No global announcements',
'POSTED_BY' => 'Poster',
'COMMENTS' => 'Comments',
'VIEW_COMMENTS' => 'View comments',
'POST_REPLY' => 'Write comments',
'TOPIC_VIEWS' => 'Views',
'JUMP_NEWEST' => 'Jump to newest post',
'JUMP_FIRST' => 'Jump to first post',
'JUMP_TO_POST' => 'Jump to post',
'BACK' => 'Back',
));
?>

View File

@@ -16,21 +16,18 @@ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1); $phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
$portal_root_path = PORTAL_ROOT_PATH; $portal_root_path = PORTAL_ROOT_PATH;
$portal_icons_path = PORTAL_ICONS_PATH; $portal_icons_path = PORTAL_ICONS_PATH;
include($phpbb_root_path . $portal_root_path . 'includes/functions.' . $phpEx);
include($phpbb_root_path . $portal_root_path . 'includes/functions_modules.' . $phpEx); include($phpbb_root_path . $portal_root_path . 'includes/functions_modules.' . $phpEx);
//include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
$portal_config = obtain_portal_config();
// Start session management // Start session management
$user->session_begin(); $user->session_begin();
$auth->acl($user->data); $auth->acl($user->data);
$user->setup('mods/portal'); $user->setup('mods/portal');
if (!$portal_config['portal_enable']) if (!$config['portal_enable'])
{ {
redirect(reapply_sid($phpbb_root_path . 'index.' . $phpEx)); redirect(reapply_sid($phpbb_root_path . 'index.' . $phpEx));
} }

View File

@@ -1,86 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
// Generate birthday list if required ... / borrowed from index.php 3.0.6
$birthday_list = $birthday_ahead_list = '';
if ($config['load_birthdays'] && $config['allow_birthdays'])
{
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
$cache_days = $portal_config['portal_birthdays_ahead'];
$sql_days = '';
while ($cache_days > 0)
{
$day = getdate(time() + 86400 * $cache_days + $user->timezone + $user->dst - date('Z'));
$sql_days .= " OR u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $day['mday'], $day['mon'])) . "%'";
$cache_days--;
}
switch ($db->sql_layer)
{
case 'mssql':
case 'mssql_odbc':
$order_by = 'u.user_birthday ASC';
break;
default:
$order_by = 'SUBSTRING(u.user_birthday FROM 4 FOR 2) ASC, SUBSTRING(u.user_birthday FROM 1 FOR 2) ASC, u.username_clean ASC';
break;
}
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
$sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
FROM ' . USERS_TABLE . ' u
LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
WHERE (b.ban_id IS NULL
OR b.ban_exclude = 1)
AND (u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' {$sql_days})
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
ORDER BY ' . $order_by;
$result = $db->sql_query($sql);
$today = sprintf('%2d-%2d-', $now['mday'], $now['mon']);
while ($row = $db->sql_fetchrow($result))
{
if (substr($row['user_birthday'], 0, 6) == $today)
{
$birthday_list .= get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
if ($age = (int) substr($row['user_birthday'], -4))
{
$birthday_list .= ' (' . ($now['year'] - $age) . ')';
}
$birthday_list .= '<br /><br />';
}
else
{
$birthday_ahead_list .= '<span title="' . format_birthday($user_birthday, 'd M') . '">' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) . '</span>';
if ($age = (int) substr($row['user_birthday'], -4))
{
$birthday_ahead_list .= ' (' . ($now['year'] - $age) . ')';
}
$birthday_ahead_list .= '<br /><br />';
}
}
$db->sql_freeresult($result);
}
// Assign index specific vars
$template->assign_vars(array(
'BIRTHDAY_LIST' => $birthday_list,
'BIRTHDAYS_AHEAD_LIST' => ($portal_config['portal_birthdays_ahead']) ? $birthday_ahead_list : '',
'L_BIRTHDAYS_AHEAD' => sprintf($user->lang['BIRTHDAYS_AHEAD'], $portal_config['portal_birthdays_ahead']),
'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
));
?>

View File

@@ -1,33 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
if ($portal_config['portal_pay_acc'])
{
if ($portal_config['portal_pay_c_block'])
{
$template->assign_var('S_DISPLAY_PAY_C', true);
}
if ($portal_config['portal_pay_s_block'])
{
$template->assign_var('S_DISPLAY_PAY_S', true);
}
// Assign specific vars
$template->assign_var('PAY_ACC', $portal_config['portal_pay_acc']);
}
?>

View File

@@ -1,66 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
$s_display_friends = false;
// Output listing of friends online
$update_time = $config['load_online_time'] * 60;
$sql = $db->sql_build_query('SELECT_DISTINCT', array(
'SELECT' => 'u.user_id, u.username, u.username_clean, u.user_colour, u.user_allow_viewonline, MAX(s.session_time) as online_time, MIN(s.session_viewonline) AS viewonline',
'FROM' => array(
USERS_TABLE => 'u',
ZEBRA_TABLE => 'z'
),
'LEFT_JOIN' => array(
array(
'FROM' => array(SESSIONS_TABLE => 's'),
'ON' => 's.session_user_id = z.zebra_id'
)
),
'WHERE' => 'z.user_id = ' . $user->data['user_id'] . '
AND z.friend = 1
AND u.user_id = z.zebra_id',
'GROUP_BY' => 'z.zebra_id, u.user_id, u.username, u.user_allow_viewonline, u.user_colour',
'ORDER_BY' => 'u.username_clean ASC',
));
$result = $db->sql_query_limit($sql, $portal_config['portal_max_online_friends']);
while ($row = $db->sql_fetchrow($result))
{
$which = (time() - $update_time < $row['online_time'] && ($row['viewonline'] || $auth->acl_get('u_viewonline'))) ? 'online' : 'offline';
$s_display_friends = ($row['user_id']) ? true : false;
$template->assign_block_vars("friends_{$which}", array(
'USER_ID' => $row['user_id'],
'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
'USER_COLOUR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']))
);
}
$db->sql_freeresult($result);
// Assign specific vars
$template->assign_vars(array(
'S_DISPLAY_FRIENDS' => $s_display_friends,
'S_ZEBRA_ENABLED' => true,
));
?>

View File

@@ -1,8 +0,0 @@
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body bgcolor="#FFFFFF" text="#000000">
</body>
</html>

View File

@@ -1,55 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
// Last x visited bots
$sql = 'SELECT username, user_colour, user_lastvisit
FROM ' . USERS_TABLE . '
WHERE user_type = ' . USER_IGNORE . '
ORDER BY user_lastvisit DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_last_visited_bots_number']);
$first = true;
while ($row = $db->sql_fetchrow($result))
{
if (!$row['user_lastvisit'] && $first == TRUE)
{
$template->assign_vars(array(
'S_DISPLAY_LAST_BOTS' => false,
));
}
else
{
$template->assign_var('S_DISPLAY_LAST_BOTS', true);
if( $row['user_lastvisit'] > 0 )
{
$template->assign_block_vars('last_visited_bots', array(
'BOT_NAME' => get_username_string('full', '', $row['username'], $row['user_colour']),
'LAST_VISIT_DATE' => $user->format_date($row['user_lastvisit']),
));
}
}
$first = false;
}
$db->sql_freeresult($result);
// Assign specific vars
$template->assign_vars(array(
'LAST_VISITED_BOTS' => sprintf($user->lang['LAST_VISITED_BOTS'], $portal_config['portal_last_visited_bots_number']),
'S_LAST_VISITED_BOTS' => ($portal_config['portal_load_last_visited_bots']) ? true : false,
));
?>

View File

@@ -1,35 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
$sql = 'SELECT user_id, username, user_regdate, user_colour
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . '
AND user_inactive_time = 0
ORDER BY user_regdate DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_max_last_member']);
while( ($row = $db->sql_fetchrow($result)) && ($row['username']) )
{
$template->assign_block_vars('latest_members', array(
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
'JOINED' => $user->format_date($row['user_regdate'], $format = 'd M'),
));
}
$db->sql_freeresult($result);
$template->assign_var('S_DISPLAY_LATEST_MEMBERS', true);
?>

View File

@@ -1,140 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
// switch idea from phpBB2 :p
function get_db_stat($mode)
{
global $db, $user;
switch( $mode )
{
case 'announcementtotal':
$sql = 'SELECT COUNT(distinct t.topic_id) AS announcement_total
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
WHERE t.topic_type = ' . POST_ANNOUNCE . '
AND p.post_id = t.topic_first_post_id';
break;
case 'stickytotal':
$sql = 'SELECT COUNT(distinct t.topic_id) AS sticky_total
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
WHERE t.topic_type = ' . POST_STICKY . '
AND p.post_id = t.topic_first_post_id';
break;
case 'attachmentstotal':
$sql = 'SELECT COUNT(attach_id) AS attachments_total
FROM ' . ATTACHMENTS_TABLE;
break;
}
if ( !($result = $db->sql_query($sql)) )
{
return false;
}
$row = $db->sql_fetchrow($result);
switch ( $mode )
{
case 'announcementtotal':
return $row['announcement_total'];
break;
case 'stickytotal':
return $row['sticky_total'];
break;
case 'attachmentstotal':
return $row['attachments_total'];
break;
}
return false;
}
// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts = $config['num_posts'];
$total_topics = $config['num_topics'];
$total_users = $config['num_users'];
$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
// avarage stat
$board_days = ( time() - $config['board_startdate'] ) / 86400;
$topics_per_day = ($total_topics) ? round($total_topics / $board_days, 0) : 0;
$posts_per_day = ($total_posts) ? round($total_posts / $board_days, 0) : 0;
$users_per_day = round($total_users / $board_days, 0);
$topics_per_user = ($total_topics) ? round($total_topics / $total_users, 0) : 0;
$posts_per_user = ($total_posts) ? round($total_posts / $total_users, 0) : 0;
$posts_per_topic = ($total_topics) ? round($total_posts / $total_topics, 0) : 0;
if ($topics_per_day > $total_topics)
{
$topics_per_day = $total_topics;
}
if ($posts_per_day > $total_posts)
{
$posts_per_day = $total_posts;
}
if ($users_per_day > $total_users)
{
$users_per_day = $total_users;
}
if ($topics_per_user > $total_topics)
{
$topics_per_user = $total_topics;
}
if ($posts_per_user > $total_posts)
{
$posts_per_user = $total_posts;
}
if ($posts_per_topic > $total_posts)
{
$posts_per_topic = $total_posts;
}
$l_topics_per_day_s = ($total_topics == 0) ? 'TOPICS_PER_DAY_ZERO' : 'TOPICS_PER_DAY_OTHER';
$l_posts_per_day_s = ($total_posts == 0) ? 'POSTS_PER_DAY_ZERO' : 'POSTS_PER_DAY_OTHER';
$l_users_per_day_s = ($total_users == 0) ? 'USERS_PER_DAY_ZERO' : 'USERS_PER_DAY_OTHER';
$l_topics_per_user_s = ($total_topics == 0) ? 'TOPICS_PER_USER_ZERO' : 'TOPICS_PER_USER_OTHER';
$l_posts_per_user_s = ($total_posts == 0) ? 'POSTS_PER_USER_ZERO' : 'POSTS_PER_USER_OTHER';
$l_posts_per_topic_s = ($total_posts == 0) ? 'POSTS_PER_TOPIC_ZERO' : 'POSTS_PER_TOPIC_OTHER';
// Assign specific vars
$template->assign_vars(array(
'S_DISPLAY_ADVANCED_STAT' => true,
'TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts),
'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics),
'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users),
'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
'S_ANN' => get_db_stat('announcementtotal'),
'S_SCT' => get_db_stat('stickytotal'),
'S_TOT_ATTACH' => ($config['allow_attachments']) ? get_db_stat('attachmentstotal') : 0,
// avarage stat
'TOPICS_PER_DAY' => sprintf($user->lang[$l_topics_per_day_s], $topics_per_day),
'POSTS_PER_DAY' => sprintf($user->lang[$l_posts_per_day_s], $posts_per_day),
'USERS_PER_DAY' => sprintf($user->lang[$l_users_per_day_s], $users_per_day),
'TOPICS_PER_USER' => sprintf($user->lang[$l_topics_per_user_s], $topics_per_user),
'POSTS_PER_USER' => sprintf($user->lang[$l_posts_per_user_s], $posts_per_user),
'POSTS_PER_TOPIC' => sprintf($user->lang[$l_posts_per_topic_s], $posts_per_topic),
));
?>

View File

@@ -1,39 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
/**
*/
$sql = 'SELECT user_id, username, user_posts, user_colour
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . '
AND user_posts <> 0
ORDER BY user_posts DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_max_most_poster']);
while( ($row = $db->sql_fetchrow($result)) && ($row['username']) )
{
$template->assign_block_vars('top_poster', array(
'S_SEARCH_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&amp;sr=posts'),
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
'POSTER_POSTS' => $row['user_posts'],
)
);
}
$db->sql_freeresult($result);
$template->assign_var('S_DISPLAY_TOP_POSTERS', true);
?>

View File

@@ -1,100 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
//
// + new posts since last visit & you post number
//
if ($user->data['is_registered'])
{
$ex_fid_ary = array_unique(array_merge(array_keys($auth->acl_getf('!f_read', true)), array_keys($auth->acl_getf('!f_search', true))));
if ($auth->acl_get('m_approve'))
{
$m_approve_fid_ary = array(-1);
$m_approve_fid_sql = '';
}
else if ($auth->acl_getf_global('m_approve'))
{
$m_approve_fid_ary = array_diff(array_keys($auth->acl_getf('!m_approve', true)), $ex_fid_ary);
$m_approve_fid_sql = ' AND (p.post_approved = 1' . ((sizeof($m_approve_fid_ary)) ? ' OR ' . $db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) : '') . ')';
}
else
{
$m_approve_fid_ary = array();
$m_approve_fid_sql = ' AND p.post_approved = 1';
}
$sql = 'SELECT COUNT(distinct t.topic_id) as total
FROM ' . TOPICS_TABLE . ' t
WHERE t.topic_last_post_time > ' . $user->data['user_lastvisit'] . '
AND t.topic_moved_id = 0
' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . '
' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '');
$result = $db->sql_query($sql);
$new_posts_count = (int) $db->sql_fetchfield('total');
// your post number
$sql = "SELECT user_posts
FROM " . USERS_TABLE . "
WHERE user_id = " . $user->data['user_id'];
$result = $db->sql_query($sql);
$you_posts_count = (int) $db->sql_fetchfield('user_posts');
}
//
// - new posts since last visit & you post number
//
// Get user...
$user_id = $user->data['user_id'];
$username = $user->data['username'];
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE ' . (($username) ? "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "user_id = $user_id");
$result = $db->sql_query($sql);
$member = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$avatar_img = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']);
$rank_title = $rank_img = '';
get_user_rank($member['user_rank'], $member['user_posts'], $rank_title, $rank_img, $rank_img_src);
$username = $member['username'];
$user_id = (int) $member['user_id'];
$colour = $member['user_colour'];
// Assign specific vars
$template->assign_vars(array(
'L_NEW_POSTS' => $user->lang['SEARCH_NEW'] . '&nbsp;(' . $new_posts_count . ')',
'L_SELF_POSTS' => $user->lang['SEARCH_SELF'] . '&nbsp;(' . $you_posts_count . ')',
'AVATAR_IMG' => $avatar_img,
'RANK_TITLE' => $rank_title,
'RANK_IMG' => $rank_img,
'RANK_IMG_SRC' => $rank_img_src,
'USERNAME_FULL' => get_username_string('full', $user_id, $username, $colour),
'USERNAME' => get_username_string('username', $user_id, $username, $colour),
'USER_COLOR' => get_username_string('colour', $user_id, $username, $colour),
'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $colour),
'U_NEW_POSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts'),
'U_SELF_POSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'),
'U_UM_BOOKMARKS' => ($config['allow_bookmarks']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=main&amp;mode=bookmarks') : '',
'U_UM_MAIN_SUBSCRIBED' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=main&amp;mode=subscribed'),
'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=front', true, $user->session_id) : '',
));
?>

View File

@@ -48,7 +48,7 @@ class portal_announcements_module
function get_template_center($module_id) function get_template_center($module_id)
{ {
global $config, $template, $db, $portal_config; global $config, $template, $db;
$announcement = request_var('announcement', -1); $announcement = request_var('announcement', -1);
$announcement = ($announcement > $portal_config['portal_announcements_length'] -1) ? -1 : $announcement; $announcement = ($announcement > $portal_config['portal_announcements_length'] -1) ? -1 : $announcement;
@@ -371,11 +371,18 @@ class portal_announcements_module
function get_template_acp($module_id) function get_template_acp($module_id)
{ {
return array( return array(
'title' => 'ACP_CONFIG_MODULENAME', 'title' => 'ACP_PORTAL_ANNOUNCE_SETTINGS',
'vars' => array( 'vars' => array(
'legend1' => 'ACP_MODULENAME_CONFIGLEGEND', 'legend1' => 'ACP_PORTAL_ANNOUNCE_SETTINGS',
'portal_configname' => array('lang' => 'MODULENAME_CONFIGNAME', 'validate' => 'string', 'type' => 'text:10:200', 'explain' => false), 'portal_announcements_style' => array('lang' => 'PORTAL_ANNOUNCEMENTS_STYLE' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_configname2' => array('lang' => 'MODULENAME_CONFIGNAME2', 'validate' => 'int', 'type' => 'text:3:3', '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' => 'custom', 'explain' => true, 'method' => 'select_forums', 'submit' => 'store_selected_forums'),
'portal_announcements_forum_exclude' => array('lang' => 'PORTAL_ANNOUNCEMENTS_FORUM_EXCLUDE', 'validate' => 'string', 'type' => 'radio:yes_no', 'explain' => true),
'portal_announcements_archive' => array('lang' => 'PORTAL_ANNOUNCEMENTS_ARCHIVE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_announcements_permissions' => array('lang' => 'PORTAL_ANNOUNCEMENTS_PERMISSIONS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_show_announcements_replies_views' => array('lang' => 'PORTAL_SHOW_REPLIES_VIEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
), ),
); );
} }
@@ -385,8 +392,16 @@ class portal_announcements_module
*/ */
function install($module_id) function install($module_id)
{ {
set_portal_config('portal_configname', 'Hello World!'); set_config('portal_announcements_style', 0);
set_portal_config('portal_configname2', 1337); set_config('portal_number_of_announcements', 1);
set_config('portal_announcements_day', 0);
set_config('portal_announcements_length', 200);
set_config('portal_global_announcements_forum', '');
set_config('portal_announcements_forum_exclude', 0);
set_config('portal_announcements_archive', 1);
set_config('portal_announcements_permissions', 1);
set_config('portal_show_announcements_replies_views', 1);
return true; return true;
} }
@@ -395,13 +410,58 @@ class portal_announcements_module
global $db; global $db;
$del_config = array( $del_config = array(
'portal_configname', 'portal_announcements_style',
'portal_configname2', 'portal_number_of_announcements',
'portal_announcements_day',
'portal_announcements_length',
'portal_global_announcements_forum',
'portal_announcements_forum_exclude',
'portal_announcements_archive',
'portal_announcements_permissions',
'portal_show_announcements_replies_views',
); );
$sql = 'DELETE FROM ' . PORTAL_CONFIG_TABLE . ' $sql = 'DELETE FROM ' . CONFIG_TABLE . '
WHERE ' . $db->sql_in_set('config_name', $del_config); WHERE ' . $db->sql_in_set('config_name', $del_config);
return $db->sql_query($sql); return $db->sql_query($sql);
} }
// Create forum select box
function select_forums($value, $key)
{
global $user, $config;
$forum_list = make_forum_select(false, false, true, true, true, false, true);
$selected = array();
if(isset($config[$key]) && strlen($config[$key]) > 0)
{
$selected = explode(',', $[$key]);
}
// Build forum options
$s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
foreach ($forum_list as $f_id => $f_row)
{
$s_forum_options .= '<option value="' . $f_id . '"' . ((in_array($f_id, $selected)) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
}
$s_forum_options .= '</select>';
return $s_forum_options;
}
// Store selected forums
function store_selected_forums($key)
{
global $db, $cache;
// Get selected extensions
$values = request_var($key, array(0 => ''));
$news = implode(',', $values);
set_config($key, $news);
}
} }
?> ?>