Start working on the future
This commit is contained in:
@@ -40,6 +40,18 @@
|
|||||||
<!-- END mods -->
|
<!-- END mods -->
|
||||||
|
|
||||||
<form id="acp_portal_config" method="post" action="{U_ACTION}">
|
<form id="acp_portal_config" method="post" action="{U_ACTION}">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{L_MODULE_OPTIONS}</legend>
|
||||||
|
<dl>
|
||||||
|
<dt><label for="module_name">{L_MODULE_NAME}:</label></dt>
|
||||||
|
<dd><input id="module_name" type="text" value="{MODULE_NAME}" name="module_name" maxlength="255" size="64" /></dd>
|
||||||
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<dt><label for="module_image">{L_MODULE_IMAGE}:</label></dt>
|
||||||
|
<dd><input id="module_image" type="text" value="{MODULE_IMAGE}" name="module_image" maxlength="255" size="64" /></dd>
|
||||||
|
<!-- IF MODULE_IMAGE_SRC --><dd><img src="{MODULE_IMAGE_SRC}" alt="{L_MODULE_IMAGE}" /></dd><!-- ENDIF -->
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<!-- BEGIN options -->
|
<!-- BEGIN options -->
|
||||||
<!-- IF options.S_LEGEND -->
|
<!-- IF options.S_LEGEND -->
|
||||||
|
|||||||
451
root/includes/acp/acp_portal.php
Normal file
451
root/includes/acp/acp_portal.php
Normal file
@@ -0,0 +1,451 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Portal
|
||||||
|
* @version $Id$
|
||||||
|
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
class acp_portal
|
||||||
|
{
|
||||||
|
var $u_action;
|
||||||
|
var $new_config = array();
|
||||||
|
|
||||||
|
function main($id, $mode)
|
||||||
|
{
|
||||||
|
global $db, $user, $cache, $template, $display_vars;
|
||||||
|
global $config, $portal_config, $phpbb_root_path, $portal_root_path, $phpbb_admin_path, $phpEx;
|
||||||
|
$portal_root_path = PORTAL_ROOT_PATH;
|
||||||
|
if (!function_exists('column_string_const'))
|
||||||
|
{
|
||||||
|
include($phpbb_root_path . $portal_root_path . 'includes/functions_modules.' . $phpEx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if (!function_exists('obtain_portal_config'))
|
||||||
|
{
|
||||||
|
include($phpbb_root_path . $portal_root_path . 'includes/functions.' . $phpEx);
|
||||||
|
}
|
||||||
|
$portal_config = obtain_portal_config();
|
||||||
|
|
||||||
|
if (!function_exists('mod_version_check'))
|
||||||
|
{
|
||||||
|
include($phpbb_root_path . $portal_root_path . 'includes/functions_version_check.' . $phpEx);
|
||||||
|
}
|
||||||
|
mod_version_check();*/
|
||||||
|
|
||||||
|
$user->add_lang('mods/portal');
|
||||||
|
$submit = (isset($_POST['submit'])) ? true : false;
|
||||||
|
|
||||||
|
$form_key = 'acp_portal';
|
||||||
|
add_form_key($form_key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validation types are:
|
||||||
|
* string, int, bool,
|
||||||
|
* script_path (absolute path in url - beginning with / and no trailing slash),
|
||||||
|
* rpath (relative), rwpath (realtive, writeable), path (relative path, but able to escape the root), wpath (writeable)
|
||||||
|
*/
|
||||||
|
switch ($mode)
|
||||||
|
{
|
||||||
|
case 'config':
|
||||||
|
$display_vars = array(
|
||||||
|
/* 'title' => 'ACP_PORTAL_GENERAL_TITLE',
|
||||||
|
'vars' => array(
|
||||||
|
'legend1' => 'ACP_PORTAL_GENERAL_INFO',
|
||||||
|
'portal_enable' => array('lang' => 'PORTAL_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
'portal_left_column_width' => array('lang' => 'PORTAL_LEFT_COLUMN_WIDTH', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
|
'portal_right_column_width' => array('lang' => 'PORTAL_RIGHT_COLUMN_WIDTH', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
|
)*/
|
||||||
|
);
|
||||||
|
|
||||||
|
$module_id = request_var('module_id', 0);
|
||||||
|
if ($module_id)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM ' . PORTAL_MODULES_TABLE . '
|
||||||
|
WHERE module_id = ' . $module_id;
|
||||||
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
|
$module_data = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if ($module_data !== false)
|
||||||
|
{
|
||||||
|
$class = 'portal_' . $module_data['module_classname'] . '_module';
|
||||||
|
if (!class_exists($class))
|
||||||
|
{
|
||||||
|
include($phpbb_root_path . 'portal/modules/portal_' . $module_data['module_classname'] . '.' . $phpEx);
|
||||||
|
}
|
||||||
|
if (!class_exists($class))
|
||||||
|
{
|
||||||
|
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$c_class = new $class();
|
||||||
|
if ($c_class->language)
|
||||||
|
{
|
||||||
|
$user->add_lang('mods/portal/' . $c_class->language);
|
||||||
|
}
|
||||||
|
$display_vars = $c_class->get_template_acp($module_id);
|
||||||
|
$template->assign_vars(array(
|
||||||
|
'MODULE_NAME' => $module_data['module_name'],
|
||||||
|
'MODULE_IMAGE' => $module_data['module_image_src'],
|
||||||
|
'MODULE_IMAGE_SRC' => ($module_data['module_image_src']) ? $phpbb_root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/' . $module_data['module_image_src'] : '',
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->new_config = $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);
|
||||||
|
if ($submit && !check_form_key($form_key))
|
||||||
|
{
|
||||||
|
$error[] = $user->lang['FORM_INVALID'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not write values if there is an error
|
||||||
|
if (sizeof($error))
|
||||||
|
{
|
||||||
|
$submit = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
|
||||||
|
|
||||||
|
if ($submit)
|
||||||
|
{
|
||||||
|
set_config($config_name, $config_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($submit)
|
||||||
|
{
|
||||||
|
$sql_ary = array(
|
||||||
|
'module_image_src' => request_var('module_image', ''),
|
||||||
|
'module_name' => request_var('module_name', '', true),
|
||||||
|
);
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
|
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||||
|
WHERE module_id = ' . $module_id;
|
||||||
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
$cache->destroy('sql', CONFIG_TABLE);
|
||||||
|
add_log('admin', 'LOG_PORTAL_CONFIG', $user->lang['ACP_PORTAL_' . strtoupper($mode) . '_INFO']);
|
||||||
|
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->tpl_name = 'acp_portal_config';
|
||||||
|
$this->page_title = $display_vars['title'];
|
||||||
|
|
||||||
|
$template->assign_vars(array(
|
||||||
|
'L_TITLE' => $user->lang[$display_vars['title']],
|
||||||
|
'L_TITLE_EXPLAIN' => (isset($user->lang[$display_vars['title'] . '_EXPLAIN'])) ? $user->lang[$display_vars['title'] . '_EXPLAIN'] : '',
|
||||||
|
|
||||||
|
'S_ERROR' => (sizeof($error)) ? true : false,
|
||||||
|
'ERROR_MSG' => implode('<br />', $error),
|
||||||
|
|
||||||
|
'U_ACTION' => $this->u_action . (($module_id) ? '&module_id=' . $module_id : ''),
|
||||||
|
));
|
||||||
|
|
||||||
|
// Output relevant page
|
||||||
|
foreach ($display_vars['vars'] as $config_key => $vars)
|
||||||
|
{
|
||||||
|
if (!is_array($vars) && strpos($config_key, 'legend') === false)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos($config_key, 'legend') !== false)
|
||||||
|
{
|
||||||
|
$template->assign_block_vars('options', array(
|
||||||
|
'S_LEGEND' => true,
|
||||||
|
'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars)
|
||||||
|
);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$this->new_config[$config_key] = $config[$config_key];
|
||||||
|
$type = explode(':', $vars['type']);
|
||||||
|
|
||||||
|
$l_explain = '';
|
||||||
|
if ($vars['explain'])
|
||||||
|
{
|
||||||
|
$l_explain = (isset($user->lang[$vars['lang'] . '_EXP'])) ? $user->lang[$vars['lang'] . '_EXP'] : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
|
||||||
|
|
||||||
|
if (empty($content))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$template->assign_block_vars('options', array(
|
||||||
|
'KEY' => $config_key,
|
||||||
|
'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'],
|
||||||
|
'S_EXPLAIN' => $vars['explain'],
|
||||||
|
'TITLE_EXPLAIN' => $l_explain,
|
||||||
|
'CONTENT' => $content,
|
||||||
|
));
|
||||||
|
|
||||||
|
unset($display_vars['vars'][$config_key]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'modules':
|
||||||
|
$action = request_var('action', '');
|
||||||
|
$module_id = request_var('module_id', '');
|
||||||
|
if ($action == 'move_up')
|
||||||
|
{
|
||||||
|
$sql = 'SELECT module_order, module_column
|
||||||
|
FROM ' . PORTAL_MODULES_TABLE . '
|
||||||
|
WHERE module_id = ' . $module_id;
|
||||||
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
|
$module_data = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (($module_data !== false) && ($module_data['module_order'] > 1))
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
|
SET module_order = module_order + 1
|
||||||
|
WHERE module_order = ' . ($module_data['module_order'] - 1) . '
|
||||||
|
AND module_column = ' . $module_data['module_column'];
|
||||||
|
$db->sql_query($sql);
|
||||||
|
$updated = $db->sql_affectedrows();
|
||||||
|
if ($updated)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
|
SET module_order = module_order - 1
|
||||||
|
WHERE module_id = ' . $module_id;
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($action == 'move_down')
|
||||||
|
{
|
||||||
|
$sql = 'SELECT module_order, module_column
|
||||||
|
FROM ' . PORTAL_MODULES_TABLE . '
|
||||||
|
WHERE module_id = ' . $module_id;
|
||||||
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
|
$module_data = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if ($module_data !== false)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
|
SET module_order = module_order - 1
|
||||||
|
WHERE module_order = ' . ($module_data['module_order'] + 1) . '
|
||||||
|
AND module_column = ' . $module_data['module_column'];
|
||||||
|
$db->sql_query($sql);
|
||||||
|
$updated = $db->sql_affectedrows();
|
||||||
|
if ($updated)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
|
SET module_order = module_order + 1
|
||||||
|
WHERE module_id = ' . $module_id;
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($action == 'delete')
|
||||||
|
{
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM ' . PORTAL_MODULES_TABLE . '
|
||||||
|
WHERE module_id = ' . $module_id;
|
||||||
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
|
$module_data = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if ($module_data !== false)
|
||||||
|
{
|
||||||
|
$module_classname = request_var('module_classname', '');
|
||||||
|
$class = 'portal_' . $module_classname . '_module';
|
||||||
|
if (!class_exists($class))
|
||||||
|
{
|
||||||
|
include($directory . 'portal_' . $module_classname . '.' . $phpEx);
|
||||||
|
}
|
||||||
|
if (!class_exists($class))
|
||||||
|
{
|
||||||
|
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$c_class = new $class();
|
||||||
|
$c_class->uninstall($module_data['module_id']);
|
||||||
|
|
||||||
|
$sql = 'DELETE FROM ' . PORTAL_MODULES_TABLE . '
|
||||||
|
WHERE module_id = ' . $module_id;
|
||||||
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
|
SET module_order = module_order - 1
|
||||||
|
WHERE module_column = ' . $module_data['module_column'] . '
|
||||||
|
AND module_order > ' . $module_data['module_order'];
|
||||||
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
trigger_error('SUCCESS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$add_module = key(request_var('add', array('' => '')));
|
||||||
|
$add_column = request_var('add_column', column_string_num($add_module));
|
||||||
|
if ($add_column)
|
||||||
|
{
|
||||||
|
$submit = (isset($_POST['submit'])) ? true : false;
|
||||||
|
$directory = $phpbb_root_path . 'portal/modules/';
|
||||||
|
|
||||||
|
if ($submit)
|
||||||
|
{
|
||||||
|
$module_classname = request_var('module_classname', '');
|
||||||
|
$class = 'portal_' . $module_classname . '_module';
|
||||||
|
if (!class_exists($class))
|
||||||
|
{
|
||||||
|
include($directory . 'portal_' . $module_classname . '.' . $phpEx);
|
||||||
|
}
|
||||||
|
if (!class_exists($class))
|
||||||
|
{
|
||||||
|
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'SELECT module_order
|
||||||
|
FROM ' . PORTAL_MODULES_TABLE . '
|
||||||
|
WHERE module_column = ' . $add_column . '
|
||||||
|
ORDER BY module_order DESC';
|
||||||
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
|
$module_order = 1 + (int) $db->sql_fetchfield('module_order');
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$c_class = new $class();
|
||||||
|
|
||||||
|
$sql_ary = array(
|
||||||
|
'module_classname' => $module_classname,
|
||||||
|
'module_column' => $add_column,
|
||||||
|
'module_order' => $module_order,
|
||||||
|
'module_name' => $c_class->name,
|
||||||
|
'module_image_src' => $c_class->image_src,
|
||||||
|
'module_group_ids' => '',
|
||||||
|
);
|
||||||
|
$sql = 'INSERT INTO ' . PORTAL_MODULES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||||
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
$c_class->install($db->sql_nextid());
|
||||||
|
|
||||||
|
trigger_error('SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
$template->assign_var('S_EDIT', true);
|
||||||
|
$fileinfo = array();
|
||||||
|
|
||||||
|
$dh = @opendir($directory);
|
||||||
|
if (!$dh)
|
||||||
|
{
|
||||||
|
return $fileinfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (($file = readdir($dh)) !== false)
|
||||||
|
{
|
||||||
|
// Is module?
|
||||||
|
if (preg_match('/^portal_.+\.' . $phpEx . '$/', $file))
|
||||||
|
{
|
||||||
|
$class = str_replace(".$phpEx", '', $file) . '_module';
|
||||||
|
if (!class_exists($class))
|
||||||
|
{
|
||||||
|
include($directory . $file);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get module title tag
|
||||||
|
if (class_exists($class))
|
||||||
|
{
|
||||||
|
$c_class = new $class();
|
||||||
|
if ($c_class->columns & column_string_const($add_module))
|
||||||
|
{
|
||||||
|
$fileinfo[] = substr($class, 7, -7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($dh);
|
||||||
|
|
||||||
|
ksort($fileinfo);
|
||||||
|
$options = '';
|
||||||
|
|
||||||
|
foreach ($fileinfo as $module)
|
||||||
|
{
|
||||||
|
$options .= '<option value="' . $module . '">' . $module . '</option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$s_hidden_fields = build_hidden_fields(array(
|
||||||
|
'add_column' => column_string_num($add_module),
|
||||||
|
));
|
||||||
|
$template->assign_vars(array(
|
||||||
|
'S_MODULE_NAMES' => $options,
|
||||||
|
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$directory = $phpbb_root_path . 'portal/modules/';
|
||||||
|
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM ' . PORTAL_MODULES_TABLE . '
|
||||||
|
ORDER BY module_column, module_order ASC';
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$class = 'portal_' . $row['module_classname'] . '_module';
|
||||||
|
if (!class_exists($class))
|
||||||
|
{
|
||||||
|
include($directory . 'portal_' . $row['module_classname'] . '.' . $phpEx);
|
||||||
|
}
|
||||||
|
if (!class_exists($class))
|
||||||
|
{
|
||||||
|
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$c_class = new $class();
|
||||||
|
if ($c_class->language)
|
||||||
|
{
|
||||||
|
$user->add_lang('mods/portal/' . $c_class->language);
|
||||||
|
}
|
||||||
|
$template_column = column_num_string($row['module_column']);
|
||||||
|
|
||||||
|
$template->assign_block_vars('modules_' . $template_column, array(
|
||||||
|
'MODULE_NAME' => (isset($user->lang[$row['module_name']])) ? $user->lang[$row['module_name']] : $row['module_name'],
|
||||||
|
'MODULE_IMAGE' => ($row['module_image_src']) ? '<img src="' . $phpbb_root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/' . $row['module_image_src'] . '" alt="' . $row['module_name'] . '" />' : '',
|
||||||
|
|
||||||
|
'U_DELETE' => $this->u_action . '&module_id=' . $row['module_id'] . '&action=delete',
|
||||||
|
'U_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=portal&mode=config&module_id=' . $row['module_id']),
|
||||||
|
'U_MOVE_UP' => $this->u_action . '&module_id=' . $row['module_id'] . '&action=move_up',
|
||||||
|
'U_MOVE_DOWN' => $this->u_action . '&module_id=' . $row['module_id'] . '&action=move_down',
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->tpl_name = 'acp_portal_modules';
|
||||||
|
$this->page_title = 'ACP_PORTAL_MODULES';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
trigger_error('NO_MODE', E_USER_ERROR);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -8,6 +8,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// COULD BE DELETED
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// COULD BE DELETED
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// COULD BE DELETED
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
|||||||
33
root/includes/acp/info/acp_portal.php
Normal file
33
root/includes/acp/info/acp_portal.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Portal
|
||||||
|
* @version $Id$
|
||||||
|
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package module_install
|
||||||
|
*/
|
||||||
|
class acp_portal_info
|
||||||
|
{
|
||||||
|
function module()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'filename' => 'acp_portal',
|
||||||
|
'title' => 'ACP_PORTAL',
|
||||||
|
'version' => '1.2.0',
|
||||||
|
'modes' => array(
|
||||||
|
'config' => array('title' => 'ACP_PORTAL_GENERAL_INFO', 'auth' => 'acl_a_portal', 'cat' => array('ACP_PORTAL')),
|
||||||
|
'modules' => array('title' => 'ACP_PORTAL_MODULES', 'auth' => 'acl_a_portal', 'cat' => array('ACP_PORTAL')),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
61
root/install/umil.php
Normal file
61
root/install/umil.php
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Portal
|
||||||
|
* @version $Id$
|
||||||
|
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('UMIL_AUTO', true);
|
||||||
|
define('IN_PHPBB', true);
|
||||||
|
define('IN_INSTALL', true);
|
||||||
|
|
||||||
|
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
|
||||||
|
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
||||||
|
include($phpbb_root_path . 'common.' . $phpEx);
|
||||||
|
|
||||||
|
$user->session_begin();
|
||||||
|
$auth->acl($user->data);
|
||||||
|
$user->setup();
|
||||||
|
|
||||||
|
if (!file_exists($phpbb_root_path . 'umil/umil_auto.' . $phpEx))
|
||||||
|
{
|
||||||
|
trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$mod_name = 'PORTAL_MOD';
|
||||||
|
|
||||||
|
$version_config_name = 'portal_board3_version';
|
||||||
|
$language_file = 'mods/info_acp_portal';
|
||||||
|
|
||||||
|
$versions = array(
|
||||||
|
// Version 1.1.0 => 1.2.x-dev
|
||||||
|
'1.1.1' => array(
|
||||||
|
'permission_add' => array(
|
||||||
|
array('a_portal'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'1.1.4' => array(
|
||||||
|
'table_add' => array(
|
||||||
|
array(PORTAL_MODULES_TABLE, array(
|
||||||
|
'COLUMNS' => array(
|
||||||
|
'module_id' => array('UINT', NULL, 'auto_increment'),
|
||||||
|
'module_classname' => array('VCHAR:64', ''),
|
||||||
|
'module_column' => array('TINT:3', 0),
|
||||||
|
'module_order' => array('TINT:3', 0),
|
||||||
|
'module_name' => array('VCHAR', ''),
|
||||||
|
'module_image_src' => array('VCHAR', ''),
|
||||||
|
'module_group_ids' => array('VCHAR', ''),
|
||||||
|
),
|
||||||
|
'PRIMARY_KEY' => 'module_id',
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Include the UMIL Auto file and everything else will be handled automatically.
|
||||||
|
include($phpbb_root_path . 'umil/umil_auto.' . $phpEx);
|
||||||
|
?>
|
||||||
39
root/language/de/mods/portal/portal_topposters_module.php
Normal file
39
root/language/de/mods/portal/portal_topposters_module.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?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(
|
||||||
|
'TOPPOSTERS' => 'Top Poster',
|
||||||
|
'TOPPOSTERS_CONFIG' => 'Einstellungen zu Top Poster',
|
||||||
|
'NUM_TOPPOSTERS' => 'Anzahl der Top Poster',
|
||||||
|
));
|
||||||
|
|
||||||
|
?>
|
||||||
225
root/portal.php
225
root/portal.php
@@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
* @package Portal
|
||||||
* @package Board3 Portal v2
|
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @copyright (c) Board3 Group ( www.board3.de )
|
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// DO NOT TOUCH YET!
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
@@ -17,187 +17,70 @@ define('IN_PORTAL', true);
|
|||||||
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
|
$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);
|
require($phpbb_root_path . 'common.' . $phpEx);
|
||||||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
$portal_root_path = PORTAL_ROOT_PATH;
|
||||||
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
|
$portal_icons_path = PORTAL_ICONS_PATH;
|
||||||
|
include($phpbb_root_path . $portal_root_path . 'includes/functions_modules.' . $phpEx);
|
||||||
|
//include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
|
||||||
|
|
||||||
// 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');
|
||||||
|
|
||||||
$portal_root_path = PORTAL_ROOT_PATH;
|
$sql = 'SELECT *
|
||||||
$portal_icons_path = PORTAL_ICONS_PATH;
|
FROM ' . PORTAL_MODULES_TABLE;
|
||||||
if (!function_exists('group_memberships'))
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
|
||||||
}
|
|
||||||
if (!function_exists('obtain_portal_config'))
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'includes/functions.' . $phpEx);
|
|
||||||
}
|
|
||||||
$portal_config = obtain_portal_config();
|
|
||||||
|
|
||||||
|
|
||||||
if (!$portal_config['portal_enable'])
|
|
||||||
{
|
|
||||||
redirect($phpbb_root_path . 'index.' . $phpEx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists($phpbb_root_path . 'install/index.' . $phpEx) && ($user->data['user_type'] == USER_FOUNDER))
|
|
||||||
{
|
|
||||||
$template->assign_var('S_DISPLAY_GENERAL', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Grab blocks
|
|
||||||
if ($portal_config['num_blocks'] > 0)
|
|
||||||
{
|
|
||||||
$blocks = $cache->obtain_blocks();
|
|
||||||
|
|
||||||
if (sizeof($blocks))
|
|
||||||
{
|
|
||||||
foreach ($blocks as $id => $data)
|
|
||||||
{
|
|
||||||
$group_id = $data['group'];
|
|
||||||
$user_id = $user->data['user_id'];
|
|
||||||
$is_in_group = ($data['group'] <> 0) ? group_memberships($group_id, $user_id , true) : true;
|
|
||||||
|
|
||||||
/*if ($data['title'] == 'BLOCK_ANNOUNCEMENTS' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/announcements.' . $phpEx);
|
|
||||||
}
|
|
||||||
if ($data['title'] == 'BLOCK_ATTACHMENTS' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/attachments.' . $phpEx);
|
|
||||||
}*/
|
|
||||||
if ($data['title'] == 'BLOCK_BIRTHDAY' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/birthday_list.' . $phpEx);
|
|
||||||
}
|
|
||||||
/*if ($data['title'] == 'BLOCK_CHANGE_STYLE' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/change_style.' . $phpEx);
|
|
||||||
}*/
|
|
||||||
if ($data['title'] == 'BLOCK_DONATE' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/donate.' . $phpEx);
|
|
||||||
}
|
|
||||||
if ($data['title'] == 'BLOCK_ONLINE_FRIENDS' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/friends.' . $phpEx);
|
|
||||||
}
|
|
||||||
if ($data['title'] == 'BLOCK_LATEST_MEMBERS' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/latest_members.' . $phpEx);
|
|
||||||
}
|
|
||||||
if ($data['title'] == 'BLOCK_BOTS' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/latest_bots.' . $phpEx);
|
|
||||||
}
|
|
||||||
/*if ($data['title'] == 'BLOCK_LEADERS' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
if ($portal_config['portal_leaders_ext'])
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . 'portal/block/leaders_ext.'.$phpEx);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . 'portal/block/leaders.'.$phpEx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($data['title'] == 'BLOCK_LINK_US' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/link_us.' . $phpEx);
|
|
||||||
}
|
|
||||||
if ($data['title'] == 'BLOCK_MINI_CAL' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/mini_cal.' . $phpEx);
|
|
||||||
}
|
|
||||||
if ($data['title'] == 'BLOCK_POLL' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/poll.' . $phpEx);
|
|
||||||
}
|
|
||||||
if ($data['title'] == 'BLOCK_RANDOM_MEMBER' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/random_member.' . $phpEx);
|
|
||||||
}
|
|
||||||
if ($data['title'] == 'BLOCK_RECENT' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/recent.' . $phpEx);
|
|
||||||
}*/
|
|
||||||
if ($data['title'] == 'BLOCK_STATISTICS' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/statistics.' . $phpEx);
|
|
||||||
}
|
|
||||||
if ($data['title'] == 'BLOCK_TOP_POSTERS' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/top_posters.' . $phpEx);
|
|
||||||
}
|
|
||||||
if ($data['title'] == 'BLOCK_USER_MENU' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/user_menu.' . $phpEx);
|
|
||||||
}
|
|
||||||
/*if ($data['title'] == 'BLOCK_WORDGRAPH' && $data['position'] > 0 && $is_in_group)
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . $portal_root_path . 'block/wordgraph.' . $phpEx);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$template->assign_block_vars('blocks', array(
|
|
||||||
'TYPE' => $data['type'],
|
|
||||||
'ICON' => $phpbb_root_path . $portal_icons_path .'/' . $data['icon'],
|
|
||||||
'TITLE' => (!empty($user->lang[strtoupper($data['title'])])) ? $user->lang[strtoupper($data['title'])] : $data['title'],
|
|
||||||
'TEXT' => ($data['type'] == 'custom') ? generate_text_for_display($data['text'], $data['text_uid'], $data['text_bitfield'], $data['text_options']) : '',
|
|
||||||
|
|
||||||
'S_GROUP' => ($is_in_group) ? true : false,
|
|
||||||
'S_ICON' => ($data['icon']) ? true : false,
|
|
||||||
'S_BLOCK_LEFT' => ($data['position'] == BLOCK_LEFT) ? true : false,
|
|
||||||
'S_BLOCK_RIGHT' => ($data['position'] == BLOCK_RIGHT) ? true : false,
|
|
||||||
'S_BLOCK_TOP' => ($data['position'] == BLOCK_TOP) ? true : false,
|
|
||||||
'S_BLOCK_BOTTOM' => ($data['position'] == BLOCK_BOTTOM) ? true : false,
|
|
||||||
'S_BLOCK_MIDDLE_TOP' => ($data['position'] == BLOCK_MIDDLE_TOP) ? true : false,
|
|
||||||
'S_BLOCK_MIDDLE_BOTTOM' => ($data['position'] == BLOCK_MIDDLE_BOTTOM) ? true : false,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'SELECT block_position
|
|
||||||
FROM ' . PORTAL_BLOCKS_TABLE;
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$db->sql_freeresult($result);
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
|
||||||
// Grab navigation links
|
|
||||||
if ($portal_config['num_links'] > 0)
|
|
||||||
{
|
{
|
||||||
$links = $cache->obtain_links();
|
$class_name = 'portal_' . $row['module_classname'] . '_module';
|
||||||
|
if (!class_exists($class_name))
|
||||||
if (sizeof($links))
|
|
||||||
{
|
{
|
||||||
foreach ($links as $id => $data)
|
include("{$phpbb_root_path}{$portal_root_path}modules/portal_{$row['module_classname']}.$phpEx");
|
||||||
{
|
|
||||||
$template->assign_block_vars('links', array(
|
|
||||||
'TITLE' => $data['title'],
|
|
||||||
'URL' => $data['url'],
|
|
||||||
|
|
||||||
'S_IS_CAT' => $data['is_cat'],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (!class_exists($class_name))
|
||||||
|
{
|
||||||
|
trigger_error(sprintf($user->lang['CLASS_NOT_FOUND'], $class_name, 'portal_' . $row['module_classname']), E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$module = new $class_name();
|
||||||
|
if ($module->language)
|
||||||
|
{
|
||||||
|
$user->add_lang('mods/portal/' . $module->language);
|
||||||
|
}
|
||||||
|
if ($row['module_column'] == 1)
|
||||||
|
{
|
||||||
|
$template_module = $module->get_template_side($row['module_id']);
|
||||||
|
$template_column = 'left';
|
||||||
|
}
|
||||||
|
if ($row['module_column'] == 2)
|
||||||
|
{
|
||||||
|
$template_module = $module->get_template_center($row['module_id']);
|
||||||
|
$template_column = 'center';
|
||||||
|
}
|
||||||
|
if ($row['module_column'] == 3)
|
||||||
|
{
|
||||||
|
$template_module = $module->get_template_side($row['module_id']);
|
||||||
|
$template_column = 'right';
|
||||||
|
}
|
||||||
|
if (!$template_module)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$template->assign_block_vars('modules_' . column_num_string($row['module_column']), array(
|
||||||
|
'TEMPLATE_FILE' => 'portal/modules/' . $template_module,
|
||||||
|
'IMAGE_SRC' => $phpbb_root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/' . $row['module_image_src'],
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// Assign specific vars
|
// Assign specific vars
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'WELCOME_USERNAME' => get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']),
|
'S_SMALL_BLOCK' => true,
|
||||||
|
'S_PORTAL_LEFT_COLUMN' => 250,
|
||||||
'U_M_BBCODE' => append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode'),
|
'S_PORTAL_RIGHT_COLUMN' => 250,
|
||||||
'U_M_TERMS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'),
|
|
||||||
'U_M_PRV' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'),
|
|
||||||
|
|
||||||
'PAY_ACC' => $portal_config['portal_pay_acc'],
|
|
||||||
|
|
||||||
'S_SMALL_BLOCK' => ($row['block_position'] == BLOCK_LEFT || $row['block_position'] == BLOCK_RIGHT) ? true : false,
|
|
||||||
'S_PORTAL_LEFT_COLUMN' => $portal_config['portal_left_column_width'],
|
|
||||||
'S_PORTAL_RIGHT_COLUMN' => $portal_config['portal_right_column_width'],
|
|
||||||
));
|
));
|
||||||
|
|
||||||
// Output page
|
// Output page
|
||||||
|
|||||||
69
root/portal/includes/functions_modules.php
Normal file
69
root/portal/includes/functions_modules.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Portal
|
||||||
|
* @version $Id$
|
||||||
|
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function column_num_string($column)
|
||||||
|
{
|
||||||
|
switch ($column)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
return 'left';
|
||||||
|
case 2:
|
||||||
|
return 'center';
|
||||||
|
case 3:
|
||||||
|
return 'right';
|
||||||
|
case 4:
|
||||||
|
return 'top';
|
||||||
|
case 5:
|
||||||
|
return 'bottom';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function column_string_num($column)
|
||||||
|
{
|
||||||
|
switch ($column)
|
||||||
|
{
|
||||||
|
case 'left':
|
||||||
|
return 1;
|
||||||
|
case 'center':
|
||||||
|
return 2;
|
||||||
|
case 'right':
|
||||||
|
return 3;
|
||||||
|
case 'top':
|
||||||
|
return 4;
|
||||||
|
case 'bottom':
|
||||||
|
return 5;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function column_string_const($column)
|
||||||
|
{
|
||||||
|
switch ($column)
|
||||||
|
{
|
||||||
|
case 'top':
|
||||||
|
return 1;
|
||||||
|
case 'left':
|
||||||
|
return 2;
|
||||||
|
case 'center':
|
||||||
|
return 4;
|
||||||
|
case 'right':
|
||||||
|
return 8;
|
||||||
|
case 'bottom':
|
||||||
|
return 16;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
107
root/portal/modules/portal_default.php
Normal file
107
root/portal/modules/portal_default.php
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Portal - Modulname
|
||||||
|
* @version $Id$
|
||||||
|
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package Modulname
|
||||||
|
*/
|
||||||
|
class portal_modulename_module
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Allowed columns: Just sum up your options (Exp: left + right = 10)
|
||||||
|
* top 1
|
||||||
|
* left 2
|
||||||
|
* center 4
|
||||||
|
* right 8
|
||||||
|
* bottom 16
|
||||||
|
*/
|
||||||
|
var $columns = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default modulename
|
||||||
|
*/
|
||||||
|
var $name = 'MODULENAME';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default module-image:
|
||||||
|
* file must be in "{T_THEME_PATH}/images/portal/"
|
||||||
|
*/
|
||||||
|
var $image_src = 'modulename.png';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* module-language file
|
||||||
|
* file must be in "language/{$user->lang}/mods/portal/"
|
||||||
|
*/
|
||||||
|
var $language = '';
|
||||||
|
|
||||||
|
function get_template_center($module_id)
|
||||||
|
{
|
||||||
|
global $config, $template;
|
||||||
|
|
||||||
|
$template->assign_vars(array(
|
||||||
|
'EXAMPLE' => $config['portal_' . $module_id . '_configname'],
|
||||||
|
));
|
||||||
|
|
||||||
|
return 'modulename_center.html';
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_template_side($module_id)
|
||||||
|
{
|
||||||
|
global $config, $template;
|
||||||
|
|
||||||
|
$template->assign_vars(array(
|
||||||
|
'EXAMPLE' => $config['portal_' . $module_id . '_configname2'],
|
||||||
|
));
|
||||||
|
|
||||||
|
return 'modulename_side.html';
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_template_acp($module_id)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'title' => 'ACP_CONFIG_MODULENAME',
|
||||||
|
'vars' => array(
|
||||||
|
'legend1' => 'ACP_MODULENAME_CONFIGLEGEND',
|
||||||
|
'portal_' . $module_id . '_configname' => array('lang' => 'MODULENAME_CONFIGNAME', 'validate' => 'string', 'type' => 'text:10:200', 'explain' => false),
|
||||||
|
'portal_' . $module_id . '_configname2' => array('lang' => 'MODULENAME_CONFIGNAME2', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API functions
|
||||||
|
*/
|
||||||
|
function install($module_id)
|
||||||
|
{
|
||||||
|
set_config('portal_' . $module_id . '_configname', 'Hello World!');
|
||||||
|
set_config('portal_' . $module_id . '_configname2', 1337);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function uninstall($module_id)
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$del_config = array(
|
||||||
|
'portal_' . $module_id . '_configname',
|
||||||
|
'portal_' . $module_id . '_configname2',
|
||||||
|
);
|
||||||
|
$sql = 'DELETE FROM ' . CONFIG_TABLE . '
|
||||||
|
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||||
|
return $db->sql_query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
113
root/portal/modules/portal_topposters.php
Normal file
113
root/portal/modules/portal_topposters.php
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Portal - Topposters
|
||||||
|
* @version $Id$
|
||||||
|
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package Topposters
|
||||||
|
*/
|
||||||
|
class portal_topposters_module
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Allowed columns: Just sum up your options (Exp: left + right = 10)
|
||||||
|
* top 1
|
||||||
|
* left 2
|
||||||
|
* center 4
|
||||||
|
* right 8
|
||||||
|
* bottom 16
|
||||||
|
*/
|
||||||
|
var $columns = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default modulename
|
||||||
|
*/
|
||||||
|
var $name = 'TOPPOSTERS';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default module-image:
|
||||||
|
* file must be in "{T_THEME_PATH}/images/portal/"
|
||||||
|
*/
|
||||||
|
var $image_src = 'topposters.png';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* module-language file
|
||||||
|
* file must be in "language/{$user->lang}/mods/portal/"
|
||||||
|
*/
|
||||||
|
var $language = 'portal_topposters_module';
|
||||||
|
|
||||||
|
function get_template_center($module_id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_template_side($module_id)
|
||||||
|
{
|
||||||
|
global $config, $db, $template;
|
||||||
|
global $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
$sql = 'SELECT user_id, username, user_posts, user_colour
|
||||||
|
FROM ' . USERS_TABLE . '
|
||||||
|
WHERE user_type <> ' . USER_IGNORE . "
|
||||||
|
AND user_posts <> 0
|
||||||
|
AND username <> ''
|
||||||
|
ORDER BY user_posts DESC";
|
||||||
|
$result = $db->sql_query_limit($sql, $config['portal_topposters']);
|
||||||
|
|
||||||
|
while (($row = $db->sql_fetchrow($result)))
|
||||||
|
{
|
||||||
|
$template->assign_block_vars('topposters', array(
|
||||||
|
'S_SEARCH_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&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);
|
||||||
|
|
||||||
|
return 'topposters_side.html';
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_template_acp($module_id)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'title' => 'TOPPOSTERS_CONFIG',
|
||||||
|
'vars' => array(
|
||||||
|
'legend1' => 'TOPPOSTERS',
|
||||||
|
'portal_topposters' => array('lang' => 'NUM_TOPPOSTERS', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API functions
|
||||||
|
*/
|
||||||
|
function install($module_id)
|
||||||
|
{
|
||||||
|
set_config('portal_topposters', 5);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function uninstall($module_id)
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$del_config = array(
|
||||||
|
'portal_topposters',
|
||||||
|
);
|
||||||
|
$sql = 'DELETE FROM ' . CONFIG_TABLE . '
|
||||||
|
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||||
|
return $db->sql_query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<!--version $Id$ //-->
|
||||||
|
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{T_THEME_PATH}/images/portal/portal_birthday.png" width="16" height="16" alt="" /> <!-- ENDIF -->{L_BIRTHDAYS}{$LR_BLOCK_H_R}
|
||||||
|
<!-- IF BIRTHDAY_LIST -->
|
||||||
|
<strong>{L_CONGRATULATIONS}:</strong><br /> {BIRTHDAY_LIST}
|
||||||
|
<!-- ELSE -->
|
||||||
|
{L_NO_BIRTHDAYS}
|
||||||
|
<!-- ENDIF -->
|
||||||
|
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
|
||||||
|
{$LR_BLOCK_H_L}{L_BIRTHDAYS_AHEAD}{$LR_BLOCK_H_R}
|
||||||
|
<!-- IF BIRTHDAYS_AHEAD_LIST -->
|
||||||
|
{BIRTHDAYS_AHEAD_LIST}
|
||||||
|
<!-- ELSE -->
|
||||||
|
{L_NO_BIRTHDAYS_AHEAD}
|
||||||
|
<!-- ENDIF -->
|
||||||
|
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<!--version $Id$ //-->
|
||||||
|
<strong>{SITENAME}</strong> {L_DONATION_TEXT}
|
||||||
|
<br />
|
||||||
|
<div style="float: left; padding: 5px 5px 5px 5px"><img src="{T_IMAGES_PATH}portal/paypal.gif" alt="" /></div>
|
||||||
|
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="padding-top:15px">
|
||||||
|
<div>
|
||||||
|
<input type="hidden" name="cmd" value="_xclick" />
|
||||||
|
<input type="hidden" name="business" value="{PAY_ACC}" />
|
||||||
|
<input type="hidden" name="item_name" value="{L_PAY_ITEM}" />
|
||||||
|
<input type="hidden" name="no_note" value="1" />
|
||||||
|
<input type="hidden" name="no_shipping" value="2" />
|
||||||
|
<input type="hidden" name="bn" value="PP-DonationsBF" />
|
||||||
|
<input type="hidden" name="tax" value="0" />
|
||||||
|
<input type="text" tabindex="11" name="amount" size="10" maxlength="6" value="" class="inputbox autowidth" title="{L_PAY_MSG}" />
|
||||||
|
<select name="currency_code" class="autowidth">
|
||||||
|
<option value="USD">{L_USD}</option>
|
||||||
|
<option value="AUD">{L_AUD}</option>
|
||||||
|
<option value="CAD">{L_CAD}</option>
|
||||||
|
<option value="CZK">{L_CZK}</option>
|
||||||
|
<option value="DKK">{L_DKK}</option>
|
||||||
|
<option value="EUR" selected="selected">{L_EUR}</option>
|
||||||
|
<option value="HKD">{L_HKD}</option>
|
||||||
|
<option value="HUF">{L_HUF}</option>
|
||||||
|
<option value="NZD">{L_NZD}</option>
|
||||||
|
<option value="NOK">{L_NOK}</option>
|
||||||
|
<option value="PLN">{L_PLN}</option>
|
||||||
|
<option value="GBP">{L_GBP}</option>
|
||||||
|
<option value="SGD">{L_SGD}</option>
|
||||||
|
<option value="SEK">{L_SEK}</option>
|
||||||
|
<option value="CHF">{L_CHF}</option>
|
||||||
|
<option value="JPY">{L_JPY}</option>
|
||||||
|
<option value="MXN">{L_MXN}</option>
|
||||||
|
<option value="ILS">{L_ILS}</option>
|
||||||
|
</select>
|
||||||
|
<input type="submit" name="submit" value="{L_DONATION}" class="button1" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<br />
|
||||||
|
<strong>{L_PAY_MSG}</strong>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<!--version $Id$ //-->
|
||||||
|
{$LR_BLOCK_H_L}<img src="{$IMAGE_SRC}" width="16" height="16" alt="" /> {L_TOPPOSTERS}{$LR_BLOCK_H_R}
|
||||||
|
<span style="float:left;"><strong>{L_USERNAME}</strong></span>
|
||||||
|
<span style="float:right;padding-right:10px;"><strong>{L_POSTS}</strong></span><br style="clear:both" />
|
||||||
|
<!-- BEGIN topposters -->
|
||||||
|
<span style="float:left;"><img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;">{topposters.USERNAME_FULL}</span>
|
||||||
|
<span style="float:right; padding-right:10px; padding-top:2px;"><a href="{topposters.S_SEARCH_ACTION}">{topposters.POSTER_POSTS}</a></span><br style="clear:both" />
|
||||||
|
<!-- END topposters -->
|
||||||
|
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
<!-- INCLUDE overall_header.html -->
|
<!-- INCLUDE overall_header.html -->
|
||||||
<!-- INCLUDE portal/_block_config.html -->
|
<!-- INCLUDE portal/_block_config.html -->
|
||||||
|
|
||||||
<!--version $Id$ //-->
|
|
||||||
<!-- IF PORTAL_VERSION_CHECK and U_ACP -->
|
<!-- IF PORTAL_VERSION_CHECK and U_ACP -->
|
||||||
<div id="portal_version_check" class="rules">
|
<div id="portal_version_check" class="rules">
|
||||||
<div class="inner"><span class="corners-top"><span></span></span>
|
<div class="inner"><span class="corners-top"><span></span></span>
|
||||||
@@ -15,32 +14,42 @@
|
|||||||
|
|
||||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<!-- [+] left block area -->
|
<!-- [+] left module area -->
|
||||||
<td valign="top" style="width: {S_PORTAL_LEFT_COLUMN}px; padding-right:{$BLOCK_DISTANCE};">
|
<td valign="top" style="width: {S_PORTAL_LEFT_COLUMN}px; padding-right:{$BLOCK_DISTANCE};">
|
||||||
<br style="clear:both" />
|
<br style="clear:both" />
|
||||||
<!-- INCLUDE portal/blocks_left.html -->
|
|
||||||
</td>
|
|
||||||
<!-- [-] left block area -->
|
|
||||||
|
|
||||||
<!-- [+] center block area -->
|
<!-- BEGIN modules_left -->
|
||||||
<td valign="top">
|
<!-- DEFINE $TEMPLATE_FILE = '{modules_left.TEMPLATE_FILE}' -->
|
||||||
<br style="clear:both" />
|
<!-- DEFINE $IMAGE_SRC = '{modules_left.IMAGE_SRC}' -->
|
||||||
<!-- INCLUDE portal/blocks_middle_top.html -->
|
<!-- INCLUDE {$TEMPLATE_FILE} -->
|
||||||
<!-- INCLUDE portal/blocks_middle_bottom.html -->
|
<!-- END modules_left -->
|
||||||
|
</td>
|
||||||
|
<!-- [-] left module area -->
|
||||||
|
|
||||||
|
<!-- [+] center module area -->
|
||||||
|
<td valign="top">
|
||||||
|
<br style="clear:both" />
|
||||||
|
<!-- sINCLUDE portal/modules_middle_top.html -->
|
||||||
|
<!-- sINCLUDE portal/modules_middle_bottom.html -->
|
||||||
<!-- IF S_DISPLAY_JUMPBOX -->
|
<!-- IF S_DISPLAY_JUMPBOX -->
|
||||||
<!-- INCLUDE portal/block/jumpbox.html -->
|
<!-- sINCLUDE portal/module/jumpbox.html -->
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
</td>
|
</td>
|
||||||
<!-- [-] center block area -->
|
<!-- [-] center module area -->
|
||||||
|
|
||||||
<!-- [+] right block area -->
|
<!-- [+] right module area -->
|
||||||
<td valign="top" style="width: {S_PORTAL_RIGHT_COLUMN}px; padding-left:{$BLOCK_DISTANCE};">
|
<td valign="top" style="width: {S_PORTAL_RIGHT_COLUMN}px; padding-left:{$BLOCK_DISTANCE};">
|
||||||
<br style="clear:both" />
|
<br style="clear:both" />
|
||||||
<!-- INCLUDE portal/blocks_right.html -->
|
|
||||||
|
<!-- BEGIN modules_right -->
|
||||||
|
<!-- DEFINE $TEMPLATE_FILE = '{modules_right.TEMPLATE_FILE}' -->
|
||||||
|
<!-- INCLUDE {$TEMPLATE_FILE} -->
|
||||||
|
<!-- END modules_right -->
|
||||||
</td>
|
</td>
|
||||||
<!-- [-] right block area -->
|
<!-- [-] right module area -->
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!-- INCLUDE portal/blocks_bottom.html -->
|
<!-- INCLUDE portal/blocks_bottom.html -->
|
||||||
<!--// board3 Portal by www.board3.de //-->
|
<!--// board3 Portal by www.board3.de //-->
|
||||||
<div class="copyright">Powered by <a href="http://www.board3.de/">Board3 Portal</a> © 2009 Board3 Group</div>
|
<div class="copyright">Powered by <a href="http://www.board3.de/">Board3 Portal</a> © 2009 Board3 Group</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user