1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-15 13:34:41 +01:00

More functions added ...

git-svn-id: file:///svn/phpbb/trunk@4025 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-05-20 12:16:25 +00:00
parent d43770db28
commit 208a3b96bf
10 changed files with 153 additions and 42 deletions

View File

@ -199,9 +199,9 @@ switch ($mode)
case 'default':
$style_select = style_select($new['default_style'], 'default_style', '../templates');
$lang_select = language_select($new['default_lang'], 'default_lang', '../language');
$timezone_select = tz_select($new['board_timezone'], 'board_timezone');
$style_select = style_select($new['default_style']);
$lang_select = language_select($new['default_lang']);
$timezone_select = tz_select($new['board_timezone']);
$override_user_style_yes = ($new['override_user_style']) ? 'checked="checked"' : '';
$override_user_style_no = (!$new['override_user_style']) ? 'checked="checked"' : '';
@ -227,6 +227,9 @@ switch ($mode)
$sig_yes = ($new['allow_sig']) ? 'checked="checked"' : '';
$sig_no = (!$new['allow_sig']) ? 'checked="checked"' : '';
$censors_yes = ($new['allow_nocensors']) ? 'checked="checked"' : '';
$censors_no = (!$new['allow_nocensors']) ? 'checked="checked"' : '';
$namechange_yes = ($new['allow_namechange']) ? 'checked="checked"' : '';
$namechange_no = (!$new['allow_namechange']) ? 'checked="checked"' : '';
@ -306,6 +309,10 @@ switch ($mode)
<td class="row1"><?php echo $user->lang['MAX_SIG_LENGTH']; ?>: <br /><span class="gensmall"><?php echo $user->lang['MAX_SIG_LENGTH_EXPLAIN']; ?></span></td>
<td class="row2"><input type="text" size="5" maxlength="4" name="max_sig_chars" value="<?php echo $new['max_sig_chars']; ?>" /></td>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['ALLOW_NO_CENSORS']; ?>: <br /><span class="gensmall"><?php echo $user->lang['ALLOW_NO_CENSORS_EXPLAIN']; ?></span></td>
<td class="row2"><input type="radio" name="allow_nocensors" value="1" <?php echo $censors_yes; ?> /> <?php echo $user->lang['YES']; ?>&nbsp;&nbsp;<input type="radio" name="allow_nocensors" value="0" <?php echo $censors_no; ?> /> <?php echo $user->lang['NO']; ?></td>
</tr>
<?php
break;

View File

@ -728,11 +728,16 @@ function on_page($num_items, $per_page, $start)
// to return both sets of arrays
function obtain_word_list(&$censors)
{
global $db, $cache;
global $db, $cache, $user;
if (!$user->data['user_viewcensors'] && !$user->data['coppa'] && $config['allow_nocensors'])
{
return;
}
if ($cache->exists('word_censors'))
{
$censors = $cache->get('word_censors'); // transfer to just if (!(...)) ? works fine for me
$censors = $cache->get('word_censors');
}
else
{

View File

@ -345,29 +345,6 @@ class ucp extends user
}
function check_image_type(&$type)
{
global $user;
switch ($type)
{
case 'jpeg':
case 'pjpeg':
case 'jpg':
return '.jpg';
case 'gif':
return '.gif';
case 'png':
return '.png';
case 'bmp':
return '.bmp';
}
$this->error[] = $user->lang['INVALID_IMAGETYPE'];
return false;
}
}
?>

View File

@ -134,6 +134,102 @@ class ucp_prefs extends ucp
break;
case 'view':
if (isset($_POST['submit']))
{
$data = array();
$normalise = array(
'string' => array(
'sk' => '1,1',
'sd' => '1,1',
),
'int' => array('st'),
'bool' => array('images', 'flash', 'smilies', 'sigs', 'avatars', 'wordcensor'),
);
$data = $this->normalise_data($_POST, $normalise);
if (!sizeof($this->error))
{
$sql_ary = array(
'user_viewimg' => $data['images'],
'user_viewflash' => $data['flash'],
'user_viewsmilies' => $data['smilies'],
'user_viewsigs' => $data['sigs'],
'user_viewavatars' => $data['avatars'],
'user_viewcensors' => $data['wordcensor'],
'user_sortby_type' => $data['sk'],
'user_sortby_dir' => $data['sd'],
'user_show_days' => $data['st'],
);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
meta_refresh(3, "ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode");
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode\">", '</a>');
trigger_error($message);
}
//
extract($data);
unset($data);
}
$sk = (isset($sk)) ? $sk : ((!empty($user->data['user_sortby_type'])) ? $user->data['user_sortby_type'] : 't');
$sd = (isset($sd)) ? $sd : ((!empty($user->data['user_sortby_dir'])) ? $user->data['user_sortby_dir'] : 'd');
$st = (isset($st)) ? $st : ((!empty($user->data['user_show_days'])) ? $user->data['user_show_days'] : 0);
// Topic ordering display
$limit_days = array(0 => $user->lang['ALL_TOPICS'], 0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
$s_limit_days = $s_sort_key = $s_sort_dir = '';
gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, &$s_limit_days, &$s_sort_key, &$s_sort_dir);
$images = (isset($images)) ? $images : $user->data['user_viewimg'];
$images_yes = ($images) ? ' checked="checked"' : '';
$images_no = (!$images) ? ' checked="checked"' : '';
$flash = (isset($flash)) ? $flash : $user->data['user_viewflash'];
$flash_yes = ($flash) ? ' checked="checked"' : '';
$flash_no = (!$flash) ? ' checked="checked"' : '';
$smilies = (isset($smilies)) ? $smilies : $user->data['user_viewsmilies'];
$smilies_yes = ($smilies) ? ' checked="checked"' : '';
$smilies_no = (!$smilies) ? ' checked="checked"' : '';
$sigs = (isset($sigs)) ? $sigs : $user->data['user_viewsigs'];
$sigs_yes = ($sigs) ? ' checked="checked"' : '';
$sigs_no = (!$sigs) ? ' checked="checked"' : '';
$avatars = (isset($avatars)) ? $avatars : $user->data['user_viewavatars'];
$avatars_yes = ($avatars) ? ' checked="checked"' : '';
$avatars_no = (!$avatars) ? ' checked="checked"' : '';
$wordcensor = (isset($wordcensor)) ? $wordcensor : $user->data['user_viewcensors'];
$wordcensor_yes = ($wordcensor) ? ' checked="checked"' : '';
$wordcensor_no = (!$wordcensor) ? ' checked="checked"' : '';
$template->assign_vars(array(
'ERROR' => (sizeof($this->error)) ? implode('<br />', $this->error) : '',
'VIEW_IMAGES_YES' => $images_yes,
'VIEW_IMAGES_NO' => $images_no,
'VIEW_FLASH_YES' => $flash_yes,
'VIEW_FLASH_NO' => $flash_no,
'VIEW_SMILIES_YES' => $smilies_yes,
'VIEW_SMILIES_NO' => $smilies_no,
'VIEW_SIGS_YES' => $sigs_yes,
'VIEW_SIGS_NO' => $sigs_no,
'VIEW_AVATARS_YES' => $avatars_yes,
'VIEW_AVATARS_NO' => $avatars_no,
'DISABLE_CENSORS_YES'=> $wordcensor_yes,
'DISABLE_CENSORS_NO'=> $wordcensor_no,
'S_SELECT_SORT_DAYS' => $s_limit_days,
'S_SELECT_SORT_KEY' => $s_sort_key,
'S_SELECT_SORT_DIR' => $s_sort_dir)
);
break;
case 'post':

View File

@ -26,6 +26,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_forum_notify
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_nocensors','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_style','1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_dateformat','D M d, Y g:i a');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_timezone','0');

View File

@ -838,7 +838,6 @@ CREATE TABLE phpbb_users (
user_lastpage varchar(100) DEFAULT '' NOT NULL,
user_karma tinyint(1) DEFAULT '3' NOT NULL,
user_min_karma tinyint(1) DEFAULT '3' NOT NULL,
user_startpage varchar(100) DEFAULT '',
user_colour varchar(6) DEFAULT '' NOT NULL,
user_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
user_lang varchar(30) DEFAULT '' NOT NULL,
@ -847,17 +846,19 @@ CREATE TABLE phpbb_users (
user_dateformat varchar(15) DEFAULT 'd M Y H:i' NOT NULL,
user_style tinyint(4) DEFAULT '0' NOT NULL,
user_rank int(11) DEFAULT '0',
user_new_privmsg smallint(5) UNSIGNED DEFAULT '0' NOT NULL,
user_unread_privmsg smallint(5) UNSIGNED DEFAULT '0' NOT NULL,
user_new_privmsg tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
user_unread_privmsg tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
user_last_privmsg int(11) DEFAULT '0' NOT NULL,
user_emailtime int(11) DEFAULT '0' NOT NULL,
user_sortby_type varchar(1) DEFAULT 'l' NOT NULL,
user_sortby_dir varchar(1) DEFAULT 'd' NOT NULL,
user_show_days tinyint(1) DEFAULT '0' NOT NULL,
user_viewemail tinyint(1) DEFAULT '1' NOT NULL,
user_sortby_type varchar(1) DEFAULT '' NOT NULL,
user_sortby_dir varchar(1) DEFAULT '' NOT NULL,
user_show_days tinyint(1) DEFAULT '' NOT NULL,
user_viewimg tinyint(1) DEFAULT '1' NOT NULL,
user_viewflash tinyint(1) DEFAULT '1' NOT NULL,
user_viewsmilies tinyint(1) DEFAULT '1' NOT NULL,
user_viewsigs tinyint(1) DEFAULT '1' NOT NULL,
user_viewavatars tinyint(1) DEFAULT '1' NOT NULL,
user_viewimg tinyint(1) DEFAULT '1' NOT NULL,
user_viewcensors tinyint(1) DEFAULT '1' NOT NULL,
user_attachsig tinyint(1) DEFAULT '1' NOT NULL,
user_allowhtml tinyint(1) DEFAULT '1' NOT NULL,
user_allowbbcode tinyint(1) DEFAULT '1' NOT NULL,
@ -884,7 +885,7 @@ CREATE TABLE phpbb_users (
user_website varchar(100) DEFAULT '' NOT NULL,
user_actkey varchar(32) DEFAULT '' NOT NULL,
user_newpasswd varchar(32) DEFAULT '' NOT NULL,
user_occ varchar(100) DEFAULT '' NOT NULL,
user_occ varchar(255) DEFAULT '' NOT NULL,
user_interests varchar(255) DEFAULT '' NOT NULL,
PRIMARY KEY (user_id)
);

View File

@ -600,6 +600,8 @@ $lang = array_merge($lang, array(
'ALLOW_SIG' => 'Allow Signatures',
'MAX_SIG_LENGTH' => 'Maximum signature length',
'MAX_SIG_LENGTH_EXPLAIN' => 'Maximum number of characters in user signatures',
'ALLOW_NO_CENSORS' => 'Allow Disable of Censors',
'ALLOW_NO_CENSORS_EXPLAINS' => 'User can disable word censoring.',
'PHP_INFO_EXPLAIN' => 'This page lists information on the version of PHP installed on this server. It includes details of loaded modules, available variables and default settings. This information may be useful when diagnosing problems. Please be aware that some hosting companies will limit what information is displayed here for security reasons. You are advised to not give out any details on this page except when asked by support or other Team Member on the support forums.',

View File

@ -720,7 +720,10 @@ $lang = array(
'VIEW_SMILIES' => 'Display Smileys as images',
'VIEW_SIGS' => 'Display Signatures',
'VIEW_AVATARS' => 'Display Avatars',
'DISABLE_CENSORS' => 'Disable Word censoring',
'DISABLE_CENSORS' => 'Enable Word censoring',
'VIEW_TOPICS_DAYS' => 'Display topics from previous days',
'VIEW_TOPICS_KEY' => 'Display topics ordering by',
'VIEW_TOPICS_DIR' => 'Display topic order direction',
'UCP_POST' => 'Posting Messages',
'DEFAULT_SMILE' => 'Enable smilies by default',

View File

@ -30,12 +30,14 @@
<th colspan="2" height="25" valign="middle">{L_TITLE}</th>
</tr>
<!-- IF ERROR -->
<tr>
<td class="row3" colspan="2" align="center"><span class="gensmall" style="color:red">{ERROR}</span></td>
</tr>
<!-- ENDIF -->
<!-- IF S_DISPLAY_PERSONAL -->
<tr>
<td class="row1"><b class="genmed">{L_SHOW_EMAIL}:</b></td>
@ -75,6 +77,7 @@
</tr>
<!-- ENDIF -->
<!-- IF S_DISPLAY_VIEW -->
<tr>
<td class="row1"><b class="genmed">{L_VIEW_IMAGES}:</b></td>
@ -100,8 +103,21 @@
<td class="row1"><b class="genmed">{L_DISABLE_CENSORS}:</b></td>
<td class="row2"><input type="radio" name="wordcensor" value="1"{DISABLE_CENSORS_YES} /><span class="gen">{L_YES}</span>&nbsp; &nbsp;<input type="radio" name="wordcensor" value="0"{DISABLE_CENSORS_NO} /><span class="gen">{L_NO}</span></td>
</tr>
<tr>
<td class="row1"><b class="genmed">{L_VIEW_TOPICS_DAYS}:</b></td>
<td class="row2">{S_SELECT_SORT_DAYS}</td>
</tr>
<tr>
<td class="row1"><b class="genmed">{L_VIEW_TOPICS_KEY}:</b></td>
<td class="row2">{S_SELECT_SORT_KEY}</td>
</tr>
<tr>
<td class="row1"><b class="genmed">{L_VIEW_TOPICS_DIR}:</b></td>
<td class="row2">{S_SELECT_SORT_DIR}</td>
</tr>
<!-- ENDIF -->
<!-- IF S_DISPLAY_POST -->
<tr>
<td class="row1"><b class="genmed">{L_DEFAULT_BBCODE}:</b></td>
@ -125,6 +141,7 @@
</tr>
<!-- ENDIF -->
<tr>
<td class="cat" colspan="2" align="center" height="28">{S_HIDDEN_FIELDS}<input class="mainoption" type="submit" name="submit" value="{L_SUBMIT}" />&nbsp;&nbsp;<input class="liteoption" type="reset" value="{L_RESET}" name="reset" /></td>
</tr>

View File

@ -30,16 +30,18 @@ $forum_id = (isset($_REQUEST['f'])) ? max(intval($_REQUEST['f']), 0) : 0;
$start = (isset($_GET['start'])) ? max(intval($_GET['start']), 0) : 0;
$mark_read = (!empty($_GET['mark'])) ? $_GET['mark'] : '';
$sort_days = (!empty($_REQUEST['st'])) ? max(intval($_REQUEST['st']), 0) : 0;
$sort_key = (!empty($_REQUEST['sk'])) ? htmlspecialchars($_REQUEST['sk']) : 't';
$sort_dir = (!empty($_REQUEST['sd'])) ? htmlspecialchars($_REQUEST['sd']) : 'd';
// Start session
$user->start();
$auth->acl($user->data);
// Put these here so we can use user defaults if set
$sort_days = (!empty($_REQUEST['st'])) ? max(intval($_REQUEST['st']), 0) : ((!empty($user->data['user_show_days'])) ? $user->data['user_show_days'] : 0);
$sort_key = (!empty($_REQUEST['sk'])) ? htmlspecialchars($_REQUEST['sk']) : ((!empty($user->data['user_sortby_type'])) ? $user->data['user_sortby_type'] : 't');
$sort_dir = (!empty($_REQUEST['sd'])) ? htmlspecialchars($_REQUEST['sd']) : ((!empty($user->data['user_sortby_dir'])) ? $user->data['user_sortby_dir'] : 'd');
// Check if the user has actually sent a forum ID with his/her request
// If not give them a nice error page.
if (!$forum_id)