代碼: 選擇全部
<?php
/***************************************************************************
* profilcp_prefer.php
* -------------------
* begin : 08/05/2003
* copyright : Ptirhiik
* email : admin@rpgnet-fr.com
*
* version : 1.0.1 - 08/06/2003
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
***************************************************************************/
if ( !defined('IN_PHPBB') )
{
die('Hacking attempt');
exit;
}
if ( !empty($setmodules) ) return;
// check access
if ( ($userdata['user_id'] != $view_userdata['user_id']) && (!is_admin($userdata) || ($level_prior[get_user_level($userdata)] <= $level_prior[get_user_level($view_userdata)])) ) return;
// define a set of date presentation
$timeset = array(
'D m d, Y g:i a',
'D d-m-Y, G:i',
'M Y, D d, g:i a',
'D d M Y, G:i',
'd M Y h:i a',
'd M Y, G:i',
'D M d, Y g:i a',
'D M d, Y G:i',
);
// validation
if ($submit)
{
$view_userdata['user_viewemail'] = intval($HTTP_POST_VARS['user_viewemail']);
$view_userdata['user_allow_viewonline'] = intval($HTTP_POST_VARS['user_allow_viewonline']);
$view_userdata['user_viewpm'] = intval($HTTP_POST_VARS['user_viewpm']);
$view_userdata['user_notify'] = intval($HTTP_POST_VARS['user_notify']);
$view_userdata['user_notify_pm'] = intval($HTTP_POST_VARS['user_notify_pm']);
$view_userdata['user_popup_pm'] = intval($HTTP_POST_VARS['user_popup_pm']);
$view_userdata['user_attachsig'] = intval($HTTP_POST_VARS['user_attachsig']);
$view_userdata['user_allowbbcode'] = intval($HTTP_POST_VARS['user_allowbbcode']);
$view_userdata['user_allowhtml'] = intval($HTTP_POST_VARS['user_allowhtml']);
$view_userdata['user_allowsmile'] = intval($HTTP_POST_VARS['user_allowsmile']);
$view_userdata['user_viewavatar'] = intval($HTTP_POST_VARS['user_viewavatar']);
$view_userdata['user_viewsig'] = intval($HTTP_POST_VARS['user_viewsig']);
$view_userdata['user_viewimg'] = intval($HTTP_POST_VARS['user_viewimg']);
$view_userdata['user_lang'] = trim(htmlspecialchars($HTTP_POST_VARS['user_lang']));
$view_userdata['user_style'] = intval($HTTP_POST_VARS['user_style']);
$view_userdata['user_timezone'] = doubleval($HTTP_POST_VARS['user_timezone']);
$view_userdata['user_dateformat'] = trim(htmlspecialchars($HTTP_POST_VARS['user_dateformat']));
$view_userdata['user_summer_time'] = intval($HTTP_POST_VARS['user_summer_time']);
if (!$error && !empty($view_userdata['user_id']) )
{
//
// field added (last first) :
//
$sql = "UPDATE " . USERS_TABLE . "
SET
user_allow_viewonline = " . $view_userdata['user_allow_viewonline'] . ",
user_viewemail = " . $view_userdata['user_viewemail'] . ",
user_viewpm = " . $view_userdata['user_viewpm'] . ",
user_notify = " . $view_userdata['user_notify'] . ",
user_notify_pm = " . $view_userdata['user_notify_pm'] . ",
user_popup_pm = " . $view_userdata['user_popup_pm'] . ",
user_attachsig = " . $view_userdata['user_attachsig'] . ",
user_allowbbcode = " . $view_userdata['user_allowbbcode'] . ",
user_allowhtml = " . $view_userdata['user_allowhtml'] . ",
user_allowsmile = " . $view_userdata['user_allowsmile'] . ",
user_viewavatar = " . $view_userdata['user_viewavatar'] . ",
user_viewsig = " . $view_userdata['user_viewsig'] . ",
user_viewimg = " . $view_userdata['user_viewimg'] . ",
user_lang ='" . $view_userdata['user_lang'] . "',
user_style = " . $view_userdata['user_style'] . ",
user_timezone = " . $view_userdata['user_timezone'] . ",
user_dateformat ='" . $view_userdata['user_dateformat'] . "',
user_summer_time = " . $view_userdata['user_summer_time'] . "
WHERE
user_id = " . $view_userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update user table', '', __LINE__, __FILE__, $sql);
}
}
}
else
{
//
// template file
$template->set_filenames(array(
'body' => 'profilcp/profil_prefer_body.tpl')
);
// constants
$template->assign_vars( array(
'L_SUBMIT' => $lang['Submit'],
'L_RESET' => $lang['Reset'],
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
'L_FRIEND_ONLY' => $lang['Friend_only'],
'YES' => YES,
'NO' => NO,
'FRIEND_ONLY' => FRIEND_ONLY,
'L_PREFERENCES' => $lang['Preferences'],
'L_VIEW_USER' => $lang['View_user'],
'L_PUBLIC_VIEW_EMAIL' => $lang['Public_view_email'],
'L_PUBLIC_VIEW_PM' => $lang['Public_view_pm'],
'L_NOTIFY_ON_REPLY' => $lang['Always_notify'],
'L_NOTIFY_ON_REPLY_EXPLAIN' => $lang['Always_notify_explain'],
'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'],
'L_POPUP_ON_PRIVMSG' => $lang['Popup_on_privmsg'],
'L_POPUP_ON_PRIVMSG_EXPLAIN' => $lang['Popup_on_privmsg_explain'],
'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'],
'L_ALWAYS_ALLOW_BBCODE' => $lang['Always_bbcode'],
'L_ALWAYS_ALLOW_HTML' => $lang['Always_html'],
'L_ALWAYS_ALLOW_SMILIES' => $lang['Always_smile'],
'L_VIEW_AVATAR' => $lang['Public_view_avatar'],
'L_VIEW_SIG' => $lang['Public_view_sig'],
'L_VIEW_IMG' => $lang['Public_view_img'],
'L_BOARD_LANGUAGE' => $lang['Board_lang'],
'L_BOARD_STYLE' => $lang['Board_style'],
'L_TIMEZONE' => $lang['Timezone'],
'L_DATE_FORMAT' => $lang['Date_format'],
'L_DATE_FORMAT_EXPLAIN' => $lang['Date_format_explain'],
'L_SUMMER_TIME' => $lang['summer_time'],
)
);
$view_user_friend_only = ( $view_userdata['user_allow_viewonline'] == FRIEND_ONLY ) ? ' checked="checked"' : '';
$view_user_yes = ( $view_userdata['user_allow_viewonline'] == YES ) ? ' checked="checked"' : '';
$view_user_no = ( $view_userdata['user_allow_viewonline'] == NO ) ? ' checked="checked"' : '';
$view_email_friend_only = ( $view_userdata['user_viewemail'] == FRIEND_ONLY ) ? ' checked="checked"' : '';
$view_email_yes = ( $view_userdata['user_viewemail'] == YES ) ? ' checked="checked"' : '';
$view_email_no = ( $view_userdata['user_viewemail'] == NO ) ? ' checked="checked"' : '';
$view_pm_friend_only = ( $view_userdata['user_viewpm'] == FRIEND_ONLY ) ? ' checked="checked"' : '';
$view_pm_yes = ( $view_userdata['user_viewpm'] == YES ) ? ' checked="checked"' : '';
$view_pm_no = ( $view_userdata['user_viewpm'] == NO ) ? ' checked="checked"' : '';
$notify_reply_yes = ( $view_userdata['user_notify'] == YES ) ? ' checked="checked"' : '';
$notify_reply_no = ( $view_userdata['user_notify'] != YES ) ? ' checked="checked"' : '';
$notify_pm_yes = ( $view_userdata['user_notify_pm'] == YES ) ? ' checked="checked"' : '';
$notify_pm_no = ( $view_userdata['user_notify_pm'] != YES ) ? ' checked="checked"' : '';
$popup_pm_yes = ( $view_userdata['user_popup_pm'] == YES ) ? ' checked="checked"' : '';
$popup_pm_no = ( $view_userdata['user_popup_pm'] != YES ) ? ' checked="checked"' : '';
$add_signature_yes = ( $view_userdata['user_attachsig'] == YES ) ? ' checked="checked"' : '';
$add_signature_no = ( $view_userdata['user_attachsig'] != YES ) ? ' checked="checked"' : '';
$allow_bbcode_yes = ( $view_userdata['user_allowbbcode'] == YES ) ? ' checked="checked"' : '';
$allow_bbcode_no = ( $view_userdata['user_allowbbcode'] != YES ) ? ' checked="checked"' : '';
$allow_html_yes = ( $view_userdata['user_allowhtml'] == YES ) ? ' checked="checked"' : '';
$allow_html_no = ( $view_userdata['user_allowhtml'] != YES ) ? ' checked="checked"' : '';
$allow_smilies_yes = ( $view_userdata['user_allowsmile'] == YES ) ? ' checked="checked"' : '';
$allow_smilies_no = ( $view_userdata['user_allowsmile'] != YES ) ? ' checked="checked"' : '';
$view_avatar_yes = ( $view_userdata['user_viewavatar'] == YES ) ? ' checked="checked"' : '';
$view_avatar_no = ( $view_userdata['user_viewavatar'] != YES ) ? ' checked="checked"' : '';
$view_sig_yes = ( $view_userdata['user_viewsig'] == YES ) ? ' checked="checked"' : '';
$view_sig_no = ( $view_userdata['user_viewsig'] != YES ) ? ' checked="checked"' : '';
$view_img_yes = ( $view_userdata['user_viewimg'] == YES ) ? ' checked="checked"' : '';
$view_img_no = ( $view_userdata['user_viewimg'] != YES ) ? ' checked="checked"' : '';
$user_lang = $view_userdata['user_lang'];
$user_style = $view_userdata['user_style'];
$user_timezone = $view_userdata['user_timezone'];
$user_dateformat = $view_userdata['user_dateformat'];
$summer_time_yes = ( $view_userdata['user_summer_time'] == YES ) ? 'checked="checked"' : '';
$summer_time_no = ( $view_userdata['user_summer_time'] != YES ) ? 'checked="checked"' : '';
// build the date format list
$s_time = '<select name="timeformat" onChange="select_dateformat(this.options[this.selectedIndex].value);">';
$time = time();
$found = false;
for ($i=0; $i < count($timeset); $i++)
{
$selected = ($user_dateformat == $timeset[$i]) ? ' selected="selected"' : '';
if ($selected != '') $found = true;
$s_time .= '<option value="' . $timeset[$i] . '"' . $selected . '>' . create_date($timeset[$i], $time, $user_timezone) . '</option>';
}
$selected = ( !$found ) ? ' selected="selected"' : '';
$s_time .= '<option value=""' . $selected . '>' . $lang['Other'] . '</option></select>';
// value
$template->assign_vars( array(
'VIEW_USER_YES' => $view_user_yes,
'VIEW_USER_NO' => $view_user_no,
'VIEW_USER_FRIEND_ONLY' => $view_user_friend_only,
'VIEW_EMAIL_YES' => $view_email_yes,
'VIEW_EMAIL_NO' => $view_email_no,
'VIEW_EMAIL_FRIEND_ONLY' => $view_email_friend_only,
'VIEW_PM_YES' => $view_pm_yes,
'VIEW_PM_NO' => $view_pm_no,
'VIEW_PM_FRIEND_ONLY' => $view_pm_friend_only,
'NOTIFY_REPLY_YES' => $notify_reply_yes,
'NOTIFY_REPLY_NO' => $notify_reply_no,
'NOTIFY_PM_YES' => $notify_pm_yes,
'NOTIFY_PM_NO' => $notify_pm_no,
'POPUP_PM_YES' => $popup_pm_yes,
'POPUP_PM_NO' => $popup_pm_no,
'ALWAYS_ADD_SIGNATURE_YES' => $add_signature_yes,
'ALWAYS_ADD_SIGNATURE_NO' => $add_signature_no,
'ALWAYS_ALLOW_BBCODE_YES' => $allow_bbcode_yes,
'ALWAYS_ALLOW_BBCODE_NO' => $allow_bbcode_no,
'ALWAYS_ALLOW_HTML_YES' => $allow_html_yes,
'ALWAYS_ALLOW_HTML_NO' => $allow_html_no,
'ALWAYS_ALLOW_SMILIES_YES' => $allow_smilies_yes,
'ALWAYS_ALLOW_SMILIES_NO' => $allow_smilies_no,
'VIEW_AVATAR_YES' => $view_avatar_yes,
'VIEW_AVATAR_NO' => $view_avatar_no,
'VIEW_SIG_YES' => $view_sig_yes,
'VIEW_SIG_NO' => $view_sig_no,
'VIEW_IMG_YES' => $view_img_yes,
'VIEW_IMG_NO' => $view_img_no,
'LANGUAGE_SELECT' => language_select($user_lang, 'user_lang'),
'STYLE_SELECT' => style_select($user_style, 'user_style'),
'TIMEZONE_SELECT' => tz_select($user_timezone, 'user_timezone'),
'DATE_FORMAT' => $user_dateformat,
'S_DATE_FORMAT' => $s_time,
'SUMMER_TIME_YES' => $summer_time_yes,
'SUMMER_TIME_NO' => $summer_time_no,
)
);
// footer
$template->assign_vars(array(
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_PROFILCP_ACTION' => append_sid("profile.$phpEx"),
)
);
// page
$template->pparse('body');
}
?>