- changed ucp classes to work with the new module system

- mcp is no longer working, i know.


git-svn-id: file:///svn/phpbb/trunk@5254 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2005-10-04 21:31:35 +00:00
parent 95ff1f3b64
commit 5449c591a9
17 changed files with 174 additions and 348 deletions

View file

@ -13,9 +13,9 @@
* ucp_activate * ucp_activate
* User activation * User activation
*/ */
class ucp_activate extends module class ucp_activate
{ {
function ucp_activate($id, $mode) function main($id, $mode)
{ {
global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;

View file

@ -13,13 +13,16 @@
* ucp_attachments * ucp_attachments
* User attachments * User attachments
*/ */
class ucp_attachments extends module class ucp_attachments
{ {
function ucp_attachments($id, $mode) function main($id, $mode)
{ {
global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $SID; global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $SID;
$start = request_var('start', 0); $start = request_var('start', 0);
$sort_key = request_var('sk', 'a');
$sort_dir = request_var('sd', 'a');
$delete = (isset($_POST['delete'])) ? true : false; $delete = (isset($_POST['delete'])) ? true : false;
$confirm = (isset($_POST['confirm'])) ? true : false; $confirm = (isset($_POST['confirm'])) ? true : false;
$delete_ids = isset($_REQUEST['attachment']) ? array_keys(array_map('intval', $_REQUEST['attachment'])) : array(); $delete_ids = isset($_REQUEST['attachment']) ? array_keys(array_map('intval', $_REQUEST['attachment'])) : array();
@ -49,9 +52,6 @@ class ucp_attachments extends module
} }
} }
$sort_key = request_var('sk', 'a');
$sort_dir = request_var('sd', 'a');
// Select box eventually // Select box eventually
$sort_key_text = array('a' => $user->lang['SORT_FILENAME'], 'b' => $user->lang['SORT_COMMENT'], 'c' => $user->lang['SORT_EXTENSION'], 'd' => $user->lang['SORT_SIZE'], 'e' => $user->lang['SORT_DOWNLOADS'], 'f' => $user->lang['SORT_POST_TIME'], 'g' => $user->lang['SORT_TOPIC_TITLE']); $sort_key_text = array('a' => $user->lang['SORT_FILENAME'], 'b' => $user->lang['SORT_COMMENT'], 'c' => $user->lang['SORT_EXTENSION'], 'd' => $user->lang['SORT_SIZE'], 'e' => $user->lang['SORT_DOWNLOADS'], 'f' => $user->lang['SORT_POST_TIME'], 'g' => $user->lang['SORT_TOPIC_TITLE']);
$sort_key_sql = array('a' => 'a.real_filename', 'b' => 'a.comment', 'c' => 'a.extension', 'd' => 'a.filesize', 'e' => 'a.download_count', 'f' => 'a.filetime', 'g' => 't.topic_title'); $sort_key_sql = array('a' => 'a.real_filename', 'b' => 'a.comment', 'c' => 'a.extension', 'd' => 'a.filesize', 'e' => 'a.download_count', 'f' => 'a.filetime', 'g' => 't.topic_title');
@ -104,7 +104,7 @@ class ucp_attachments extends module
} }
else else
{ {
$view_topic = "{$phpbb_root_path}viewtopic.$phpEx$SID&t=" . $row['topic_id'] . '&p=' . $row['post_msg_id'] . '#' . $row['post_msg_id']; $view_topic = "{$phpbb_root_path}viewtopic.$phpEx$SID&t={$row['topic_id']}&p={$row['post_msg_id']}#{$row['post_msg_id']}";
} }
$template->assign_block_vars('attachrow', array( $template->assign_block_vars('attachrow', array(
@ -155,7 +155,7 @@ class ucp_attachments extends module
'S_ORDER_SELECT' => $s_sort_dir) 'S_ORDER_SELECT' => $s_sort_dir)
); );
$this->display($user->lang['UCP_ATTACHMENTS'], 'ucp_attachments.html'); $this->tpl_name = 'ucp_attachments';
} }
} }

View file

@ -20,9 +20,9 @@
* released or distributed in any way under a licence other * released or distributed in any way under a licence other
* than the GPL. We will be watching ... ;) * than the GPL. We will be watching ... ;)
*/ */
class ucp_confirm extends module class ucp_confirm
{ {
function ucp_confirm($id, $mode) function main($id, $mode)
{ {
global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;

View file

@ -12,9 +12,9 @@
* @package ucp * @package ucp
* ucp_groups * ucp_groups
*/ */
class ucp_groups extends module class ucp_groups
{ {
function ucp_groups($id, $mode) function main($id, $mode)
{ {
global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
@ -367,7 +367,7 @@ class ucp_groups extends module
break; break;
} }
$this->display($user->lang['UCP_GROUPS_' . strtoupper($mode)], 'ucp_groups_' . $mode . '.html'); $this->tpl_name = 'ucp_groups_' . $mode;
} }
} }

View file

@ -13,9 +13,16 @@
* ucp_main * ucp_main
* UCP Front Panel * UCP Front Panel
*/ */
class ucp_main extends module class ucp_main
{ {
function ucp_main($id, $mode) var $p_master;
function ucp_main(&$p_master)
{
$this->p_master = &$p_master;
}
function main($id, $mode)
{ {
global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
@ -653,9 +660,8 @@ class ucp_main extends module
break; break;
case 'drafts': case 'drafts':
global $ucp;
$pm_drafts = ($ucp->name == 'pm') ? true : false; $pm_drafts = ($this->p_master->p_name == 'pm') ? true : false;
$user->add_lang('posting'); $user->add_lang('posting');
@ -832,27 +838,8 @@ class ucp_main extends module
'S_UCP_ACTION' => $phpbb_root_path . "ucp.$phpEx$SID&i=$id&mode=$mode") 'S_UCP_ACTION' => $phpbb_root_path . "ucp.$phpEx$SID&i=$id&mode=$mode")
); );
$this->display($user->lang['UCP_MAIN'], 'ucp_main_' . $mode . '.html'); // Set desired template
} $this->tpl_name = 'ucp_main_' . $mode;
function install()
{
}
function uninstall()
{
}
function module()
{
$details = array(
'name' => 'UCP - Main',
'description' => 'Front end for User Control Panel',
'filename' => 'main',
'version' => '1.0.0',
'phpbbversion' => '2.2.0'
);
return $details;
} }
} }

View file

@ -1,6 +1,5 @@
<?php <?php
/** /**
*
* @package ucp * @package ucp
* @version $Id$ * @version $Id$
* @copyright (c) 2005 phpBB Group * @copyright (c) 2005 phpBB Group
@ -10,7 +9,6 @@
/** /**
* @package ucp * @package ucp
* ucp_pm
* *
* Private Message Class * Private Message Class
* *
@ -19,8 +17,8 @@
* *
* *
* Display Unread Messages - mode=unread * Display Unread Messages - mode=unread
* Display Messages (default to inbox) - mode=view_messages * Display Messages (default to inbox) - mode=view
* Display single message - mode=view_messages&action=view_message&p=[msg_id] or &p=[msg_id] (short linkage) * Display single message - mode=view&p=[msg_id] or &p=[msg_id] (short linkage)
* *
* if the folder id with (&f=[folder_id]) is used when displaying messages, one query will be saved. If it is not used, phpBB needs to grab * if the folder id with (&f=[folder_id]) is used when displaying messages, one query will be saved. If it is not used, phpBB needs to grab
* the folder id first in order to display the input boxes and folder names and such things. ;) phpBB always checks this against the database to make * the folder id first in order to display the input boxes and folder names and such things. ;) phpBB always checks this against the database to make
@ -29,19 +27,14 @@
* Composing Messages (mode=compose): * Composing Messages (mode=compose):
* To specific user (u=[user_id]) * To specific user (u=[user_id])
* To specific group (g=[group_id]) * To specific group (g=[group_id])
* Quoting a post (action=quote&q=1&p=[post_id]) * Quoting a post (action=quotepost&p=[post_id])
* Quoting a PM (action=quote&p=[msg_id]) * Quoting a PM (action=quote&p=[msg_id])
* Forwarding a PM (action=forward&p=[msg_id]) * Forwarding a PM (action=forward&p=[msg_id])
* *
*
* @todo Review of post when replying/quoting
* @todo Report PM
* @todo Check Permissions (compose message - to user/group)
*
*/ */
class ucp_pm extends module class ucp_pm
{ {
function ucp_pm($id, $mode) function main($id, $mode)
{ {
global $user, $template, $phpbb_root_path, $auth, $phpEx, $db, $SID, $config; global $user, $template, $phpbb_root_path, $auth, $phpEx, $db, $SID, $config;
@ -73,16 +66,15 @@ class ucp_pm extends module
if (!$folder_specified) if (!$folder_specified)
{ {
$mode = (!$mode) ? request_var('mode', 'view_messages') : $mode; $mode = (!$mode) ? request_var('mode', 'view') : $mode;
} }
else else
{ {
$mode = 'view_messages'; $mode = 'view';
} }
include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
$tpl_file = 'ucp_pm_' . $mode . '.html';
switch ($mode) switch ($mode)
{ {
// New private messages popup // New private messages popup
@ -124,7 +116,7 @@ class ucp_pm extends module
include($phpbb_root_path . 'includes/ucp/ucp_pm_compose.'.$phpEx); include($phpbb_root_path . 'includes/ucp/ucp_pm_compose.'.$phpEx);
compose_pm($id, $mode, $action); compose_pm($id, $mode, $action);
$tpl_file = 'posting_body.html'; $tpl_file = 'posting_body';
break; break;
case 'options': case 'options':
@ -141,18 +133,28 @@ class ucp_pm extends module
include($phpbb_root_path . 'includes/ucp/ucp_pm_options.'.$phpEx); include($phpbb_root_path . 'includes/ucp/ucp_pm_options.'.$phpEx);
message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions); message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions);
$tpl_file = 'ucp_pm_options';
break; break;
case 'drafts': case 'drafts':
get_folder($user->data['user_id'], $folder); get_folder($user->data['user_id'], $folder);
$this->p_name = 'pm';
// Call another module... please do not try this at home... Hoochie Coochie Man
include($phpbb_root_path . 'includes/ucp/ucp_main.'.$phpEx); include($phpbb_root_path . 'includes/ucp/ucp_main.'.$phpEx);
$module = new ucp_main($id, $mode);
$module = new ucp_main($this);
$module->main($id, $mode);
$this->tpl_name = $module->tpl_name;
unset($module); unset($module);
exit; return;
break; break;
case 'unread': case 'unread':
case 'view_messages': case 'view':
$sql = 'SELECT group_message_limit $sql = 'SELECT group_message_limit
FROM ' . GROUPS_TABLE . ' FROM ' . GROUPS_TABLE . '
@ -177,7 +179,8 @@ class ucp_pm extends module
$msg_id = request_var('p', 0); $msg_id = request_var('p', 0);
$view = request_var('view', ''); $view = request_var('view', '');
if ($msg_id && $action == 'view_folder') // if ($msg_id && $action == 'view_folder')
if ($msg_id)
{ {
$action = 'view_message'; $action = 'view_message';
} }
@ -248,7 +251,7 @@ class ucp_pm extends module
} }
$message_row = array(); $message_row = array();
if ($mode == 'view_messages' && $action == 'view_message' && $msg_id) if ($mode == 'view' && $action == 'view_message' && $msg_id)
{ {
// Get Message user want to see // Get Message user want to see
@ -310,7 +313,7 @@ class ucp_pm extends module
// Header for message view - folder and so on // Header for message view - folder and so on
$folder_status = get_folder_status($folder_id, $folder); $folder_status = get_folder_status($folder_id, $folder);
$url = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id"; $url = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode";
$template->assign_vars(array( $template->assign_vars(array(
'CUR_FOLDER_ID' => $folder_id, 'CUR_FOLDER_ID' => $folder_id,
@ -321,8 +324,8 @@ class ucp_pm extends module
'S_FOLDER_OPTIONS' => $s_folder_options, 'S_FOLDER_OPTIONS' => $s_folder_options,
'S_TO_FOLDER_OPTIONS' => $s_to_folder_options, 'S_TO_FOLDER_OPTIONS' => $s_to_folder_options,
'S_FOLDER_ACTION' => "$url&amp;mode=view_messages&amp;action=view_folder", 'S_FOLDER_ACTION' => "$url&amp;action=view_folder",
'S_PM_ACTION' => "$url&amp;mode=$mode&amp;action=$action", 'S_PM_ACTION' => "$url&amp;action=$action",
'U_INBOX' => "$url&amp;folder=inbox", 'U_INBOX' => "$url&amp;folder=inbox",
'U_OUTBOX' => "$url&amp;folder=outbox", 'U_OUTBOX' => "$url&amp;folder=outbox",
@ -345,7 +348,7 @@ class ucp_pm extends module
include($phpbb_root_path . 'includes/ucp/ucp_pm_viewfolder.'.$phpEx); include($phpbb_root_path . 'includes/ucp/ucp_pm_viewfolder.'.$phpEx);
view_folder($id, $mode, $folder_id, $folder, (($mode == 'unread') ? 'unread' : 'folder')); view_folder($id, $mode, $folder_id, $folder, (($mode == 'unread') ? 'unread' : 'folder'));
$tpl_file = 'ucp_pm_viewfolder.html'; $tpl_file = 'ucp_pm_viewfolder';
} }
else if ($action == 'view_message') else if ($action == 'view_message')
{ {
@ -362,7 +365,7 @@ class ucp_pm extends module
include($phpbb_root_path . 'includes/ucp/ucp_pm_viewmessage.'.$phpEx); include($phpbb_root_path . 'includes/ucp/ucp_pm_viewmessage.'.$phpEx);
view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row); view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row);
$tpl_file = ($view == 'print') ? 'ucp_pm_viewmessage_print.html' : 'ucp_pm_viewmessage.html'; $tpl_file = ($view == 'print') ? 'ucp_pm_viewmessage_print' : 'ucp_pm_viewmessage';
} }
break; break;
@ -376,7 +379,8 @@ class ucp_pm extends module
'S_UCP_ACTION' => "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode" . ((isset($action)) ? "&amp;action=$action" : '')) 'S_UCP_ACTION' => "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode" . ((isset($action)) ? "&amp;action=$action" : ''))
); );
$this->display($user->lang['UCP_PM'], $tpl_file); // Set desired template
$this->tpl_name = $tpl_file;
} }
} }

View file

@ -14,13 +14,14 @@
*/ */
function view_folder($id, $mode, $folder_id, $folder, $type) function view_folder($id, $mode, $folder_id, $folder, $type)
{ {
global $phpbb_root_path, $phpEx, $SID, $user, $template, $auth, $config, $db; global $user, $template, $auth, $db, $cache;
global $phpbb_root_path, $config, $phpEx, $SID;
$user->add_lang('viewforum'); $user->add_lang('viewforum');
// Grab icons // Grab icons
$icons = array(); $icons = array();
obtain_icons($icons); $cache->obtain_icons($icons);
$color_rows = array('marked', 'replied', 'message_reported', 'friend', 'foe'); $color_rows = array('marked', 'replied', 'message_reported', 'friend', 'foe');
@ -127,7 +128,7 @@ function view_folder($id, $mode, $folder_id, $folder, $type)
// Generate all URIs ... // Generate all URIs ...
$message_author = "<a href=\"{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['author_id'] . '">' . $row['username'] . '</a>'; $message_author = "<a href=\"{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['author_id'] . '">' . $row['username'] . '</a>';
$view_message_url = "$url&amp;i=$id&amp;f=$folder_id&amp;p=$message_id"; $view_message_url = "$url&amp;i=$id&amp;mode=$mode&amp;f=$folder_id&amp;p=$message_id";
$remove_message_url = "$url&amp;i=compose&amp;action=delete&amp;p=$message_id"; $remove_message_url = "$url&amp;i=compose&amp;action=delete&amp;p=$message_id";
$row_indicator = ''; $row_indicator = '';

View file

@ -241,7 +241,7 @@ function message_history($msg_id, $user_id, $message_row, $folder)
FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u
WHERE t.msg_id = p.msg_id WHERE t.msg_id = p.msg_id
AND p.author_id = u.user_id AND p.author_id = u.user_id
AND t.folder_id <> ' . PRIVMSGS_NO_BOX . " AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ")
AND t.user_id = $user_id"; AND t.user_id = $user_id";
if (!$message_row['root_level']) if (!$message_row['root_level'])

View file

@ -13,9 +13,9 @@
* ucp_prefs * ucp_prefs
* Changing user preferences * Changing user preferences
*/ */
class ucp_prefs extends module class ucp_prefs
{ {
function ucp_prefs($id, $mode) function main($id, $mode)
{ {
global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
@ -413,7 +413,7 @@ class ucp_prefs extends module
'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode") 'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode")
); );
$this->display($user->lang['UCP_PROFILE'], 'ucp_prefs_' . $mode . '.html'); $this->tpl_name = 'ucp_prefs_' . $mode;
} }
} }

View file

@ -13,9 +13,9 @@
* ucp_profile * ucp_profile
* Changing profile settings * Changing profile settings
*/ */
class ucp_profile extends module class ucp_profile
{ {
function ucp_profile($id, $mode) function main($id, $mode)
{ {
global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
@ -649,7 +649,8 @@ class ucp_profile extends module
'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode") 'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode")
); );
$this->display($user->lang['UCP_PROFILE'], 'ucp_profile_' . $mode . '.html'); // Set desired template
$this->tpl_name = 'ucp_profile_' . $mode;
} }
} }

View file

@ -13,9 +13,9 @@
* ucp_register * ucp_register
* Board registration * Board registration
*/ */
class ucp_register extends module class ucp_register
{ {
function ucp_register($id, $mode) function main($id, $mode)
{ {
global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
@ -78,7 +78,8 @@ class ucp_register extends module
); );
} }
$this->display($user->lang['REGISTER'], 'ucp_agreement.html'); $this->tpl_name = 'ucp_agreement';
return;
} }
$var_ary = array( $var_ary = array(
@ -480,7 +481,7 @@ class ucp_register extends module
$cp->generate_profile_fields('register', $user->get_iso_lang_id()); $cp->generate_profile_fields('register', $user->get_iso_lang_id());
// //
$this->display($user->lang['REGISTER'], 'ucp_register.html'); $this->tpl_name = 'ucp_register';
} }
} }

View file

@ -13,9 +13,9 @@
* ucp_remind * ucp_remind
* Sending password reminders * Sending password reminders
*/ */
class ucp_remind extends module class ucp_remind
{ {
function ucp_remind($id, $mode) function main($id, $mode)
{ {
global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
@ -95,7 +95,7 @@ class ucp_remind extends module
'EMAIL' => $email) 'EMAIL' => $email)
); );
$this->display($user->lang['UCP_REMIND'], 'ucp_remind.html'); $this->tpl_name = 'ucp_remind';
} }
} }

View file

@ -13,9 +13,9 @@
* ucp_resend * ucp_resend
* Resending activation emails * Resending activation emails
*/ */
class ucp_resend extends module class ucp_resend
{ {
function ucp_resend($id, $mode) function main($id, $mode)
{ {
global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
@ -143,7 +143,7 @@ class ucp_resend extends module
'EMAIL' => $email) 'EMAIL' => $email)
); );
$this->display($user->lang['UCP_RESEND'], 'ucp_resend.html'); $this->tpl_name = 'ucp_resend';
} }
} }

View file

@ -12,9 +12,9 @@
* @package ucp * @package ucp
* ucp_zebra * ucp_zebra
*/ */
class ucp_zebra extends module class ucp_zebra
{ {
function ucp_zebra($id, $mode) function main($id, $mode)
{ {
global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
@ -125,7 +125,7 @@ class ucp_zebra extends module
case 'mssql': case 'mssql':
case 'sqlite': case 'sqlite':
$sql = 'INSERT INTO ' . ZEBRA_TABLE . " (user_id, zebra_id, $sql_mode) $sql = 'INSERT INTO ' . ZEBRA_TABLE . " (user_id, zebra_id, $sql_mode)
" . implode(' UNION ALL ', preg_replace('#^([0-9]+)$#', '(' . $user->data['user_id'] . ", \\1, 1)", $user_id_ary)); VALUES " . implode(' UNION ALL ', preg_replace('#^([0-9]+)$#', '(' . $user->data['user_id'] . ", \\1, 1)", $user_id_ary));
$db->sql_query($sql); $db->sql_query($sql);
break; break;
@ -201,7 +201,7 @@ class ucp_zebra extends module
'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode") 'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode")
); );
$this->display($user->lang['UCP_ZEBRA'], 'ucp_zebra_' . $mode . '.html'); $this->tpl_name = 'ucp_zebra_' . $mode;
} }
} }

View file

@ -345,7 +345,7 @@ $lang += array(
'UCP_PM_OPTIONS' => 'Options', 'UCP_PM_OPTIONS' => 'Options',
'UCP_PM_POPUP' => 'Private Messages', 'UCP_PM_POPUP' => 'Private Messages',
'UCP_PM_UNREAD' => 'Unread Messages', 'UCP_PM_UNREAD' => 'Unread Messages',
'UCP_PM_VIEW_MESSAGES' => 'View Messages', 'UCP_PM_VIEW' => 'View Messages',
'UCP_PROFILE' => 'Profile', 'UCP_PROFILE' => 'Profile',
'UCP_PROFILE_AVATAR' => 'Your avatar', 'UCP_PROFILE_AVATAR' => 'Your avatar',

View file

@ -51,24 +51,25 @@
<tr> <tr>
<th>{L_OPTIONS}</th> <th>{L_OPTIONS}</th>
</tr> </tr>
<!-- BEGIN ucp_section -->
<!-- BEGIN l_block1 -->
<tr> <tr>
<!-- IF ucp_section.S_SELECTED --> <!-- IF l_block1.S_SELECTED -->
<td class="row1"><b class="nav">{ucp_section.L_TITLE}</b> <td class="row1"><b class="nav">{l_block1.L_TITLE}</b>
<ul class="nav" style="margin: 0px; padding: 0px; list-style-type: none; line-height: 175%;"> <ul class="nav" style="margin: 0px; padding: 0px; list-style-type: none; line-height: 175%;">
<!-- BEGIN ucp_subsection --> <!-- BEGIN l_block2 -->
<li>&#187; <!-- IF ucp_section.ucp_subsection.S_SELECTED --><b>{ucp_section.ucp_subsection.L_TITLE}</b><!-- ELSE --><a href="{ucp_section.ucp_subsection.U_TITLE}">{ucp_section.ucp_subsection.L_TITLE}</a><!-- ENDIF --></li> <li>&#187; <!-- IF l_block1.l_block2.S_SELECTED --><b>{l_block1.l_block2.L_TITLE}</b><!-- ELSE --><a href="{l_block1.l_block2.U_TITLE}">{l_block1.l_block2.L_TITLE}</a><!-- ENDIF --></li>
<!-- END ucp_subsection --> <!-- END l_block2 -->
</ul> </ul>
<!-- ELSE --> <!-- ELSE -->
<td class="row2" nowrap="nowrap" onmouseover="this.className='row1'" onmouseout="this.className='row2'" onclick="location.href='{ucp_section.U_TITLE}'"><a class="nav" href="{ucp_section.U_TITLE}">{ucp_section.L_TITLE}</a> <td class="row2" nowrap="nowrap" onmouseover="this.className='row1'" onmouseout="this.className='row2'" onclick="location.href='{l_block1.U_TITLE}'"><a class="nav" href="{l_block1.U_TITLE}">{l_block1.L_TITLE}</a>
<!-- ENDIF --> <!-- ENDIF -->
</td> </td>
</tr> </tr>
<!-- END ucp_section --> <!-- END l_block1 -->
</table>
</table>
<div style="padding: 2px;"></div> <div style="padding: 2px;"></div>

View file

@ -13,13 +13,13 @@
define('IN_PHPBB', true); define('IN_PHPBB', true);
$phpbb_root_path = './'; $phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1); $phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'common.'.$phpEx); require($phpbb_root_path . 'includes/functions_user.'.$phpEx);
include($phpbb_root_path . '/includes/functions_user.'.$phpEx); require($phpbb_root_path . 'includes/functions_module.'.$phpEx);
// Basic parameter data // Basic parameter data
$id = request_var('i', '');
$mode = request_var('mode', ''); $mode = request_var('mode', '');
$module = request_var('i', '');
if ($mode == 'login' || $mode == 'logout') if ($mode == 'login' || $mode == 'logout')
{ {
@ -27,224 +27,30 @@ if ($mode == 'login' || $mode == 'logout')
} }
// Start session management // Start session management
$user->start(); $user->session_begin();
$auth->acl($user->data); $auth->acl($user->data);
$user->setup('ucp'); $user->setup('ucp');
$ucp = new module(); $module = new p_master();
/**
* @package ucp
* UCP Module
*/
class module
{
var $id = 0;
var $type;
var $name;
var $mode;
// Private methods, should not be overwritten
function create($module_type, $module_url, $selected_mod = false, $selected_submod = false)
{
global $template, $auth, $db, $user, $config;
$sql = 'SELECT module_id, module_title, module_filename, module_subs, module_acl
FROM ' . MODULES_TABLE . "
WHERE module_type = '{$module_type}'
AND module_enabled = 1
ORDER BY module_order ASC";
$result = $db->sql_query($sql);
$i = 0;
while ($row = $db->sql_fetchrow($result))
{
// Authorisation is required for the basic module
if ($row['module_acl'])
{
$is_auth = false;
eval('$is_auth = (' . preg_replace(array('#acl_([a-z_]+)#e', '#cfg_([a-z_]+)#e'), array('(int) $auth->acl_get("\\1")', '(int) $config["\\1"]'), trim($row['module_acl'])) . ');');
// The user is not authorised to use this module, skip it
if (!$is_auth)
{
continue;
}
}
$selected = ($row['module_filename'] == $selected_mod || $row['module_id'] == $selected_mod || (!$selected_mod && !$i)) ? true : false;
// Get the localised lang string if available, or make up our own otherwise
$module_lang = strtoupper($module_type) . '_' . $row['module_title'];
$template->assign_block_vars($module_type . '_section', array(
'L_TITLE' => (isset($user->lang[$module_lang])) ? $user->lang[$module_lang] : ucfirst(str_replace('_', ' ', strtolower($row['module_title']))),
'S_SELECTED' => $selected,
'U_TITLE' => $module_url . '&amp;i=' . $row['module_id'])
);
if ($selected)
{
$module_id = $row['module_id'];
$module_name = $row['module_filename'];
if ($row['module_subs'])
{
$j = 0;
$submodules_ary = explode("\n", $row['module_subs']);
foreach ($submodules_ary as $submodule)
{
if (!trim($submodule))
{
continue;
}
$submodule = explode(',', trim($submodule));
$submodule_title = array_shift($submodule);
$is_auth = true;
foreach ($submodule as $auth_option)
{
eval('$is_auth = (' . preg_replace(array('#acl_([a-z_]+)#e', '#cfg_([a-z_]+)#e'), array('(int) $auth->acl_get("\\1")', '(int) $config["\\1"]'), trim($auth_option)) . ');');
if (!$is_auth)
{
break;
}
}
if (!$is_auth)
{
continue;
}
$selected = ($submodule_title == $selected_submod || (!$selected_submod && !$j)) ? true : false;
// Get the localised lang string if available, or make up our own otherwise
$module_lang = strtoupper($module_type . '_' . $module_name . '_' . $submodule_title);
$template->assign_block_vars("{$module_type}_section.{$module_type}_subsection", array(
'L_TITLE' => (isset($user->lang[$module_lang])) ? $user->lang[$module_lang] : ucfirst(str_replace('_', ' ', strtolower($module_lang))),
'S_SELECTED' => $selected,
'U_TITLE' => $module_url . '&amp;i=' . $module_id . '&amp;mode=' . $submodule_title
));
if ($selected)
{
$this->mode = $submodule_title;
}
$j++;
}
}
}
$i++;
}
$db->sql_freeresult($result);
if (!isset($module_id) || !$module_id)
{
trigger_error('MODULE_NOT_EXIST');
}
$this->type = $module_type;
$this->id = $module_id;
$this->name = $module_name;
}
function load($type = false, $name = false, $mode = false, $run = true)
{
global $phpbb_root_path, $phpEx;
if ($type)
{
$this->type = $type;
}
if ($name)
{
$this->name = $name;
}
if (!class_exists($this->type . '_' . $this->name))
{
require_once($phpbb_root_path . "includes/{$this->type}/{$this->type}_{$this->name}.$phpEx");
if ($run)
{
if (!isset($this->mode))
{
$this->mode = $mode;
}
eval("\$this->module = new {$this->type}_{$this->name}(\$this->id, \$this->mode);");
if (method_exists($this->module, 'init'))
{
$this->module->init();
}
}
}
}
// Displays the appropriate template with the given title
function display($page_title, $tpl_name)
{
global $template;
page_header($page_title);
$template->set_filenames(array(
'body' => $tpl_name)
);
page_footer();
}
// Public methods to be overwritten by modules
function module()
{
// Module name
// Module filename
// Module description
// Module version
// Module compatibility
return false;
}
function init()
{
return false;
}
function install()
{
return false;
}
function uninstall()
{
return false;
}
}
// Basic "global" modes // Basic "global" modes
switch ($mode) switch ($mode)
{ {
case 'activate': case 'activate':
$ucp->load('ucp', 'activate'); $module->load('ucp', 'activate');
$ucp->module->ucp_activate(); $module->display($user->lang['UCP_ACTIVATE']);
redirect("index.$phpEx$SID"); redirect("index.$phpEx$SID");
break; break;
case 'resend_act': case 'resend_act':
$ucp->load('ucp', 'resend'); $module->load('ucp', 'resend');
$ucp->module->ucp_resend(); $module->display($user->lang['UCP_RESEND']);
break; break;
case 'sendpassword': case 'sendpassword':
$ucp->load('ucp', 'remind'); $module->load('ucp', 'remind');
$ucp->module->ucp_remind(); $module->display($user->lang['UCP_REMIND']);
break; break;
case 'register': case 'register':
@ -253,13 +59,14 @@ switch ($mode)
redirect("index.$phpEx$SID"); redirect("index.$phpEx$SID");
} }
$ucp->load('ucp', 'register'); $module->load('ucp', 'register');
$ucp->module->ucp_register(); $module->display($user->lang['UCP_REGISTER']);
break; break;
case 'confirm': case 'confirm':
$ucp->load('ucp', 'confirm');
$ucp->module->ucp_confirm(); $module->load('ucp', 'confirm');
exit;
break; break;
case 'login': case 'login':
@ -279,7 +86,7 @@ switch ($mode)
meta_refresh(3, "index.$phpEx$SID"); meta_refresh(3, "index.$phpEx$SID");
$message = $user->lang['LOGOUT_REDIRECT'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . "index.$phpEx$SID" . '">', '</a> '); $message = $user->lang['LOGOUT_REDIRECT'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . "{$phpbb_root_path}index.$phpEx$SID" . '">', '</a> ');
trigger_error($message); trigger_error($message);
break; break;
@ -321,7 +128,6 @@ switch ($mode)
break; break;
} }
// Only registered users can go beyond this point // Only registered users can go beyond this point
if (!$user->data['is_registered']) if (!$user->data['is_registered'])
{ {
@ -388,9 +194,34 @@ if ($mode == 'compose' && request_var('action', '') != 'edit')
} }
// Instantiate module system and generate list of available modules // Instantiate module system and generate list of available modules
$ucp->create('ucp', "ucp.$phpEx$SID", $module, $mode); $module->list_modules('ucp');
// Select the active module
$module->set_active($id, $mode);
// Load and execute the relevant module // Load and execute the relevant module
$ucp->load(); $module->load_active();
// Assign data to the template engine for the list of modules
$module->assign_tpl_vars("ucp.$phpEx$SID");
// Generate the page
page_header($user->lang['UCP_MAIN']);
$template->set_filenames(array(
'body' => $module->get_tpl_name())
);
page_footer();
/* Language override function for 'main' module
function main($mode, $langname)
{
if ($mode == 'front')
{
return 'Frontpanel';
}
}
*/
?> ?>