mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 12:28:52 +00:00
- 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:
parent
95ff1f3b64
commit
5449c591a9
17 changed files with 174 additions and 348 deletions
|
@ -13,9 +13,9 @@
|
|||
* ucp_activate
|
||||
* 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;
|
||||
|
||||
|
|
|
@ -13,16 +13,19 @@
|
|||
* ucp_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;
|
||||
|
||||
$start = request_var('start', 0);
|
||||
$delete = (isset($_POST['delete'])) ? true : false;
|
||||
$confirm = (isset($_POST['confirm'])) ? true : false;
|
||||
$delete_ids = isset($_REQUEST['attachment']) ? array_keys(array_map('intval', $_REQUEST['attachment'])) : array();
|
||||
$start = request_var('start', 0);
|
||||
$sort_key = request_var('sk', 'a');
|
||||
$sort_dir = request_var('sd', 'a');
|
||||
|
||||
$delete = (isset($_POST['delete'])) ? true : false;
|
||||
$confirm = (isset($_POST['confirm'])) ? true : false;
|
||||
$delete_ids = isset($_REQUEST['attachment']) ? array_keys(array_map('intval', $_REQUEST['attachment'])) : array();
|
||||
|
||||
if ($delete && sizeof($delete_ids))
|
||||
{
|
||||
|
@ -49,9 +52,6 @@ class ucp_attachments extends module
|
|||
}
|
||||
}
|
||||
|
||||
$sort_key = request_var('sk', 'a');
|
||||
$sort_dir = request_var('sd', 'a');
|
||||
|
||||
// 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_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');
|
||||
|
@ -72,7 +72,7 @@ class ucp_attachments extends module
|
|||
$s_sort_dir .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
||||
}
|
||||
|
||||
$order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC');
|
||||
$order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC');
|
||||
|
||||
$sql = 'SELECT COUNT(*) as num_attachments
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
|
@ -104,7 +104,7 @@ class ucp_attachments extends module
|
|||
}
|
||||
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(
|
||||
|
@ -155,7 +155,7 @@ class ucp_attachments extends module
|
|||
'S_ORDER_SELECT' => $s_sort_dir)
|
||||
);
|
||||
|
||||
$this->display($user->lang['UCP_ATTACHMENTS'], 'ucp_attachments.html');
|
||||
$this->tpl_name = 'ucp_attachments';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
* released or distributed in any way under a licence other
|
||||
* 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;
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
* @package ucp
|
||||
* 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;
|
||||
|
||||
|
@ -367,7 +367,7 @@ class ucp_groups extends module
|
|||
break;
|
||||
}
|
||||
|
||||
$this->display($user->lang['UCP_GROUPS_' . strtoupper($mode)], 'ucp_groups_' . $mode . '.html');
|
||||
$this->tpl_name = 'ucp_groups_' . $mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,16 @@
|
|||
* ucp_main
|
||||
* 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;
|
||||
|
||||
|
@ -653,9 +660,8 @@ class ucp_main extends module
|
|||
break;
|
||||
|
||||
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');
|
||||
|
||||
|
@ -820,7 +826,7 @@ class ucp_main extends module
|
|||
$template->assign_var('S_DRAFT_ROWS', $row_count);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
@ -832,27 +838,8 @@ class ucp_main extends module
|
|||
'S_UCP_ACTION' => $phpbb_root_path . "ucp.$phpEx$SID&i=$id&mode=$mode")
|
||||
);
|
||||
|
||||
$this->display($user->lang['UCP_MAIN'], 'ucp_main_' . $mode . '.html');
|
||||
}
|
||||
|
||||
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;
|
||||
// Set desired template
|
||||
$this->tpl_name = 'ucp_main_' . $mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
/**
|
||||
* @package ucp
|
||||
* @version $Id$
|
||||
* @copyright (c) 2005 phpBB Group
|
||||
|
@ -8,9 +7,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* @package ucp
|
||||
* ucp_pm
|
||||
*
|
||||
* Private Message Class
|
||||
*
|
||||
|
@ -19,8 +17,8 @@
|
|||
*
|
||||
*
|
||||
* Display Unread Messages - mode=unread
|
||||
* Display Messages (default to inbox) - mode=view_messages
|
||||
* Display single message - mode=view_messages&action=view_message&p=[msg_id] or &p=[msg_id] (short linkage)
|
||||
* Display Messages (default to inbox) - mode=view
|
||||
* 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
|
||||
* 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):
|
||||
* To specific user (u=[user_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])
|
||||
* 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;
|
||||
|
||||
|
@ -73,21 +66,20 @@ class ucp_pm extends module
|
|||
|
||||
if (!$folder_specified)
|
||||
{
|
||||
$mode = (!$mode) ? request_var('mode', 'view_messages') : $mode;
|
||||
$mode = (!$mode) ? request_var('mode', 'view') : $mode;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mode = 'view_messages';
|
||||
$mode = 'view';
|
||||
}
|
||||
|
||||
include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
|
||||
|
||||
$tpl_file = 'ucp_pm_' . $mode . '.html';
|
||||
switch ($mode)
|
||||
{
|
||||
// New private messages popup
|
||||
case 'popup':
|
||||
|
||||
|
||||
$l_new_message = '';
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
|
@ -109,7 +101,7 @@ class ucp_pm extends module
|
|||
);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
// Compose message
|
||||
case 'compose':
|
||||
$action = request_var('action', 'post');
|
||||
|
@ -123,10 +115,10 @@ class ucp_pm extends module
|
|||
|
||||
include($phpbb_root_path . 'includes/ucp/ucp_pm_compose.'.$phpEx);
|
||||
compose_pm($id, $mode, $action);
|
||||
|
||||
$tpl_file = 'posting_body.html';
|
||||
|
||||
$tpl_file = 'posting_body';
|
||||
break;
|
||||
|
||||
|
||||
case 'options':
|
||||
$sql = 'SELECT group_message_limit
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
|
@ -141,18 +133,28 @@ class ucp_pm extends module
|
|||
|
||||
include($phpbb_root_path . 'includes/ucp/ucp_pm_options.'.$phpEx);
|
||||
message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions);
|
||||
|
||||
$tpl_file = 'ucp_pm_options';
|
||||
break;
|
||||
|
||||
case 'drafts':
|
||||
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);
|
||||
$module = new ucp_main($id, $mode);
|
||||
|
||||
$module = new ucp_main($this);
|
||||
$module->main($id, $mode);
|
||||
$this->tpl_name = $module->tpl_name;
|
||||
|
||||
unset($module);
|
||||
exit;
|
||||
break;
|
||||
return;
|
||||
|
||||
break;
|
||||
|
||||
case 'unread':
|
||||
case 'view_messages':
|
||||
case 'view':
|
||||
|
||||
$sql = 'SELECT group_message_limit
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
|
@ -176,8 +178,9 @@ class ucp_pm extends module
|
|||
|
||||
$msg_id = request_var('p', 0);
|
||||
$view = request_var('view', '');
|
||||
|
||||
if ($msg_id && $action == 'view_folder')
|
||||
|
||||
// if ($msg_id && $action == 'view_folder')
|
||||
if ($msg_id)
|
||||
{
|
||||
$action = 'view_message';
|
||||
}
|
||||
|
@ -243,15 +246,15 @@ class ucp_pm extends module
|
|||
if (!($row = $db->sql_fetchrow($result)))
|
||||
{
|
||||
trigger_error('NO_MESSAGE');
|
||||
}
|
||||
}
|
||||
$folder_id = (int) $row['folder_id'];
|
||||
}
|
||||
|
||||
|
||||
$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
|
||||
|
||||
|
||||
if ($view == 'next' || $view == 'previous')
|
||||
{
|
||||
$sql_condition = ($view == 'next') ? '>' : '<';
|
||||
|
@ -277,7 +280,7 @@ class ucp_pm extends module
|
|||
$msg_id = $row['msg_id'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$sql = 'SELECT t.*, p.*, u.*
|
||||
FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u
|
||||
WHERE t.user_id = ' . $user->data['user_id'] . "
|
||||
|
@ -295,7 +298,7 @@ class ucp_pm extends module
|
|||
// Update unread status
|
||||
update_unread_status($message_row['unread'], $message_row['msg_id'], $user->data['user_id'], $folder_id);
|
||||
}
|
||||
|
||||
|
||||
get_folder($user->data['user_id'], $folder, $folder_id);
|
||||
|
||||
$s_folder_options = $s_to_folder_options = '';
|
||||
|
@ -307,11 +310,11 @@ class ucp_pm extends module
|
|||
$s_folder_options .= $option;
|
||||
}
|
||||
clean_sentbox($folder[PRIVMSGS_SENTBOX]['num_messages']);
|
||||
|
||||
|
||||
// Header for message view - folder and so on
|
||||
$folder_status = get_folder_status($folder_id, $folder);
|
||||
$url = "{$phpbb_root_path}ucp.$phpEx$SID&i=$id";
|
||||
|
||||
$url = "{$phpbb_root_path}ucp.$phpEx$SID&i=$id&mode=$mode";
|
||||
|
||||
$template->assign_vars(array(
|
||||
'CUR_FOLDER_ID' => $folder_id,
|
||||
'CUR_FOLDER_NAME' => $folder_status['folder_name'],
|
||||
|
@ -321,9 +324,9 @@ class ucp_pm extends module
|
|||
|
||||
'S_FOLDER_OPTIONS' => $s_folder_options,
|
||||
'S_TO_FOLDER_OPTIONS' => $s_to_folder_options,
|
||||
'S_FOLDER_ACTION' => "$url&mode=view_messages&action=view_folder",
|
||||
'S_PM_ACTION' => "$url&mode=$mode&action=$action",
|
||||
|
||||
'S_FOLDER_ACTION' => "$url&action=view_folder",
|
||||
'S_PM_ACTION' => "$url&action=$action",
|
||||
|
||||
'U_INBOX' => "$url&folder=inbox",
|
||||
'U_OUTBOX' => "$url&folder=outbox",
|
||||
'U_SENTBOX' => "$url&folder=sentbox",
|
||||
|
@ -332,20 +335,20 @@ class ucp_pm extends module
|
|||
'S_IN_INBOX' => ($folder_id == PRIVMSGS_INBOX) ? true : false,
|
||||
'S_IN_OUTBOX' => ($folder_id == PRIVMSGS_OUTBOX) ? true : false,
|
||||
'S_IN_SENTBOX' => ($folder_id == PRIVMSGS_SENTBOX) ? true : false,
|
||||
|
||||
|
||||
'FOLDER_STATUS' => $folder_status['message'],
|
||||
'FOLDER_MAX_MESSAGES' => $folder_status['max'],
|
||||
'FOLDER_CUR_MESSAGES' => $folder_status['cur'],
|
||||
'FOLDER_REMAINING_MESSAGES' => $folder_status['remaining'],
|
||||
'FOLDER_PERCENT' => $folder_status['percent'])
|
||||
);
|
||||
|
||||
|
||||
if ($mode == 'unread' || $action == 'view_folder')
|
||||
{
|
||||
include($phpbb_root_path . 'includes/ucp/ucp_pm_viewfolder.'.$phpEx);
|
||||
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')
|
||||
{
|
||||
|
@ -353,7 +356,7 @@ class ucp_pm extends module
|
|||
'S_VIEW_MESSAGE'=> true,
|
||||
'MSG_ID' => $msg_id)
|
||||
);
|
||||
|
||||
|
||||
if (!$msg_id)
|
||||
{
|
||||
trigger_error('NO_MESSAGE');
|
||||
|
@ -362,21 +365,22 @@ class ucp_pm extends module
|
|||
include($phpbb_root_path . 'includes/ucp/ucp_pm_viewmessage.'.$phpEx);
|
||||
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;
|
||||
|
||||
default:
|
||||
trigger_error('NO_ACTION_MODE');
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
$template->assign_vars(array(
|
||||
'L_TITLE' => $user->lang['UCP_PM_' . strtoupper($mode)],
|
||||
'S_UCP_ACTION' => "{$phpbb_root_path}ucp.$phpEx$SID&i=$id&mode=$mode" . ((isset($action)) ? "&action=$action" : ''))
|
||||
);
|
||||
|
||||
$this->display($user->lang['UCP_PM'], $tpl_file);
|
||||
// Set desired template
|
||||
$this->tpl_name = $tpl_file;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,13 +14,14 @@
|
|||
*/
|
||||
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');
|
||||
|
||||
// Grab icons
|
||||
$icons = array();
|
||||
obtain_icons($icons);
|
||||
$cache->obtain_icons($icons);
|
||||
|
||||
$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 ...
|
||||
$message_author = "<a href=\"{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['author_id'] . '">' . $row['username'] . '</a>';
|
||||
$view_message_url = "$url&i=$id&f=$folder_id&p=$message_id";
|
||||
$view_message_url = "$url&i=$id&mode=$mode&f=$folder_id&p=$message_id";
|
||||
$remove_message_url = "$url&i=compose&action=delete&p=$message_id";
|
||||
|
||||
$row_indicator = '';
|
||||
|
|
|
@ -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
|
||||
WHERE t.msg_id = p.msg_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";
|
||||
|
||||
if (!$message_row['root_level'])
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
* ucp_prefs
|
||||
* 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;
|
||||
|
||||
|
@ -413,7 +413,7 @@ class ucp_prefs extends module
|
|||
'S_UCP_ACTION' => "ucp.$phpEx$SID&i=$id&mode=$mode")
|
||||
);
|
||||
|
||||
$this->display($user->lang['UCP_PROFILE'], 'ucp_prefs_' . $mode . '.html');
|
||||
$this->tpl_name = 'ucp_prefs_' . $mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
* ucp_profile
|
||||
* 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;
|
||||
|
||||
|
@ -649,7 +649,8 @@ class ucp_profile extends module
|
|||
'S_UCP_ACTION' => "ucp.$phpEx$SID&i=$id&mode=$mode")
|
||||
);
|
||||
|
||||
$this->display($user->lang['UCP_PROFILE'], 'ucp_profile_' . $mode . '.html');
|
||||
// Set desired template
|
||||
$this->tpl_name = 'ucp_profile_' . $mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
* ucp_register
|
||||
* 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;
|
||||
|
||||
|
@ -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(
|
||||
|
@ -480,7 +481,7 @@ class ucp_register extends module
|
|||
$cp->generate_profile_fields('register', $user->get_iso_lang_id());
|
||||
|
||||
//
|
||||
$this->display($user->lang['REGISTER'], 'ucp_register.html');
|
||||
$this->tpl_name = 'ucp_register';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
* ucp_remind
|
||||
* 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;
|
||||
|
||||
|
@ -95,7 +95,7 @@ class ucp_remind extends module
|
|||
'EMAIL' => $email)
|
||||
);
|
||||
|
||||
$this->display($user->lang['UCP_REMIND'], 'ucp_remind.html');
|
||||
$this->tpl_name = 'ucp_remind';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
* ucp_resend
|
||||
* 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;
|
||||
|
||||
|
@ -143,7 +143,7 @@ class ucp_resend extends module
|
|||
'EMAIL' => $email)
|
||||
);
|
||||
|
||||
$this->display($user->lang['UCP_RESEND'], 'ucp_resend.html');
|
||||
$this->tpl_name = 'ucp_resend';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
* @package ucp
|
||||
* 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;
|
||||
|
||||
|
@ -125,7 +125,7 @@ class ucp_zebra extends module
|
|||
case 'mssql':
|
||||
case 'sqlite':
|
||||
$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);
|
||||
break;
|
||||
|
||||
|
@ -201,7 +201,7 @@ class ucp_zebra extends module
|
|||
'S_UCP_ACTION' => "ucp.$phpEx$SID&i=$id&mode=$mode")
|
||||
);
|
||||
|
||||
$this->display($user->lang['UCP_ZEBRA'], 'ucp_zebra_' . $mode . '.html');
|
||||
$this->tpl_name = 'ucp_zebra_' . $mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -345,7 +345,7 @@ $lang += array(
|
|||
'UCP_PM_OPTIONS' => 'Options',
|
||||
'UCP_PM_POPUP' => 'Private Messages',
|
||||
'UCP_PM_UNREAD' => 'Unread Messages',
|
||||
'UCP_PM_VIEW_MESSAGES' => 'View Messages',
|
||||
'UCP_PM_VIEW' => 'View Messages',
|
||||
|
||||
'UCP_PROFILE' => 'Profile',
|
||||
'UCP_PROFILE_AVATAR' => 'Your avatar',
|
||||
|
|
|
@ -51,24 +51,25 @@
|
|||
<tr>
|
||||
<th>{L_OPTIONS}</th>
|
||||
</tr>
|
||||
<!-- BEGIN ucp_section -->
|
||||
|
||||
<!-- BEGIN l_block1 -->
|
||||
<tr>
|
||||
<!-- IF ucp_section.S_SELECTED -->
|
||||
<td class="row1"><b class="nav">{ucp_section.L_TITLE}</b>
|
||||
<!-- IF l_block1.S_SELECTED -->
|
||||
<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%;">
|
||||
<!-- BEGIN ucp_subsection -->
|
||||
<li>» <!-- 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>
|
||||
<!-- END ucp_subsection -->
|
||||
<!-- BEGIN l_block2 -->
|
||||
<li>» <!-- 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 l_block2 -->
|
||||
</ul>
|
||||
|
||||
<!-- 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 -->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END ucp_section -->
|
||||
</table>
|
||||
<!-- END l_block1 -->
|
||||
|
||||
</table>
|
||||
|
||||
<div style="padding: 2px;"></div>
|
||||
|
||||
|
|
271
phpBB/ucp.php
271
phpBB/ucp.php
|
@ -13,13 +13,13 @@
|
|||
define('IN_PHPBB', true);
|
||||
$phpbb_root_path = './';
|
||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
||||
|
||||
include($phpbb_root_path . 'common.'.$phpEx);
|
||||
include($phpbb_root_path . '/includes/functions_user.'.$phpEx);
|
||||
require($phpbb_root_path . 'common.'.$phpEx);
|
||||
require($phpbb_root_path . 'includes/functions_user.'.$phpEx);
|
||||
require($phpbb_root_path . 'includes/functions_module.'.$phpEx);
|
||||
|
||||
// Basic parameter data
|
||||
$id = request_var('i', '');
|
||||
$mode = request_var('mode', '');
|
||||
$module = request_var('i', '');
|
||||
|
||||
if ($mode == 'login' || $mode == 'logout')
|
||||
{
|
||||
|
@ -27,225 +27,31 @@ if ($mode == 'login' || $mode == 'logout')
|
|||
}
|
||||
|
||||
// Start session management
|
||||
$user->start();
|
||||
$user->session_begin();
|
||||
$auth->acl($user->data);
|
||||
$user->setup('ucp');
|
||||
|
||||
$ucp = new module();
|
||||
|
||||
/**
|
||||
* @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 . '&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 . '&i=' . $module_id . '&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;
|
||||
}
|
||||
}
|
||||
$module = new p_master();
|
||||
|
||||
// Basic "global" modes
|
||||
switch ($mode)
|
||||
{
|
||||
case 'activate':
|
||||
$ucp->load('ucp', 'activate');
|
||||
$ucp->module->ucp_activate();
|
||||
$module->load('ucp', 'activate');
|
||||
$module->display($user->lang['UCP_ACTIVATE']);
|
||||
redirect("index.$phpEx$SID");
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
case 'resend_act':
|
||||
$ucp->load('ucp', 'resend');
|
||||
$ucp->module->ucp_resend();
|
||||
break;
|
||||
$module->load('ucp', 'resend');
|
||||
$module->display($user->lang['UCP_RESEND']);
|
||||
break;
|
||||
|
||||
case 'sendpassword':
|
||||
$ucp->load('ucp', 'remind');
|
||||
$ucp->module->ucp_remind();
|
||||
break;
|
||||
$module->load('ucp', 'remind');
|
||||
$module->display($user->lang['UCP_REMIND']);
|
||||
break;
|
||||
|
||||
case 'register':
|
||||
if ($user->data['is_registered'] || isset($_REQUEST['not_agreed']))
|
||||
|
@ -253,14 +59,15 @@ switch ($mode)
|
|||
redirect("index.$phpEx$SID");
|
||||
}
|
||||
|
||||
$ucp->load('ucp', 'register');
|
||||
$ucp->module->ucp_register();
|
||||
break;
|
||||
$module->load('ucp', 'register');
|
||||
$module->display($user->lang['UCP_REGISTER']);
|
||||
break;
|
||||
|
||||
case 'confirm':
|
||||
$ucp->load('ucp', 'confirm');
|
||||
$ucp->module->ucp_confirm();
|
||||
break;
|
||||
|
||||
$module->load('ucp', 'confirm');
|
||||
exit;
|
||||
break;
|
||||
|
||||
case 'login':
|
||||
if ($user->data['is_registered'])
|
||||
|
@ -279,7 +86,7 @@ switch ($mode)
|
|||
|
||||
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);
|
||||
break;
|
||||
|
||||
|
@ -321,7 +128,6 @@ switch ($mode)
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
// Only registered users can go beyond this point
|
||||
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
|
||||
$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
|
||||
$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';
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
?>
|
Loading…
Add table
Reference in a new issue