1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 01:19:44 +01:00

Make custom title a general field (rather than forum), more work on usersettings

This commit is contained in:
e107steved 2008-01-06 21:16:37 +00:00
parent 92ad2b1d2e
commit 982a65736d
8 changed files with 82 additions and 94 deletions

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/prefs.php,v $
| $Revision: 1.8 $
| $Date: 2007-11-07 22:34:47 $
| $Revision: 1.9 $
| $Date: 2008-01-06 21:16:16 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -580,8 +580,8 @@ $text .= "<div id='signup' style='display:none; text-align:center'>
<td class='forumheader'>".CUSTSIG_14."</td>
</tr>";
$signup_option_title = array(CUSTSIG_2, CUSTSIG_6, CUSTSIG_7, CUSTSIG_8, CUSTSIG_17);
$signup_option_names = array("signup_option_realname", "signup_option_signature", "signup_option_image", "signup_option_timezone", "signup_option_class");
$signup_option_title = array(CUSTSIG_2, CUSTSIG_6, CUSTSIG_7, CUSTSIG_8, CUSTSIG_17, CUSTSIG_20);
$signup_option_names = array("signup_option_realname", "signup_option_signature", "signup_option_image", "signup_option_timezone", "signup_option_class", 'signup_option_customtitle');
foreach($signup_option_names as $key => $value)
{

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
| $Revision: 1.14 $
| $Date: 2007-12-30 18:20:54 $
| $Revision: 1.15 $
| $Date: 2008-01-06 21:16:16 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -183,7 +183,7 @@ function update_706_to_800($type='')
global $sql,$ns, $pref;
// List of unwanted $pref values which can go
$obs_prefs = array('frontpage_type','rss_feeds', 'log_lvcount', 'zone', 'upload_allowedfiletype', 'real');
$obs_prefs = array('frontpage_type','rss_feeds', 'log_lvcount', 'zone', 'upload_allowedfiletype', 'real', 'forum_user_customtitle');
// List of DB tables not required (includes a few from 0.6xx)
$obs_tables = array('flood', 'headlines', 'stat_info', 'stat_counter', 'stat_last');
@ -208,11 +208,20 @@ function update_706_to_800($type='')
'chatbox' => 'cb_ip'
);
$db_parser = new db_table_admin; // Class to read table defs and process them
$do_save = FALSE;
$db_parser = new db_table_admin; // Class to read table defs and process them
$do_save = FALSE; // Set TRUE to update prefs when update complete
$just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing if an update is needed
if (isset($pref['forum_user_customtitle']) && !isset($pref['signup_option_customtitle']))
{
if ($just_check) return update_needed();
$pref['signup_option_customtitle'] = $pref['forum_user_customtitle'];
unset($pref['forum_user_customtitle']);
$do_save = TRUE;
}
//change menu_path for usertheme_menu
if($sql->db_Select("menus", "menu_path", "menu_path='usertheme_menu' || menu_path='usertheme_menu/'"))
{

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_files/shortcode/batch/usersettings_shortcodes.php,v $
| $Revision: 1.6 $
| $Date: 2007-07-23 20:05:46 $
| $Revision: 1.7 $
| $Date: 2008-01-06 21:16:23 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -49,7 +49,7 @@ SC_END
SC_BEGIN CUSTOMTITLE
global $rs, $curVal, $pref;
if ($pref['forum_user_customtitle'] || ADMIN)
if ($pref['signup_option_customtitle'] || ADMIN)
{
return $rs->form_text("customtitle", 40, $curVal['user_customtitle'], 100, "tbox");
}

View File

@ -12,8 +12,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_prefs.php,v $
| $Revision: 1.9 $
| $Date: 2007-12-29 19:05:59 $
| $Revision: 1.10 $
| $Date: 2008-01-06 21:16:30 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -99,6 +99,7 @@ define("CUSTSIG_16", "Minimum Length for Passwords");
define("CUSTSIG_17", "Subscribe to content/mailouts");
define("CUSTSIG_18", "Disallow usernames");
define("CUSTSIG_19", "usernames containing the following text will be rejected, separate entries by commas");
define('CUSTSIG_20', 'User Custom Title');
define("PRFLAN_91", "If someone is attacking your site by multiple requests to your server, his IP will be automatically banned ! Best done with server config if possible!!!");
define("PRFLAN_92", "Secure signup verification -- hide password in email?");

View File

@ -4,8 +4,8 @@
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_usersettings.php,v $
| $Revision: 1.10 $
| $Date: 2007-12-15 15:06:40 $
| $Revision: 1.11 $
| $Date: 2008-01-06 21:16:30 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -113,7 +113,7 @@ define("LAN_USET_15", "Display name too long. Please choose another");
define("LAN_USET_16", "Tick box to delete existing photo without uploading another");
define("LAN_USET_17", "Display name already used. Please choose another");
define('LAN_USET_18', 'User data changed by admin: --ID--, login name: --LOGNAME--');
define('LAN_USET_19', '');
define('LAN_USET_19', 'Custom Title');
define('LAN_USET_20', '');
?>

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_admin.php,v $
| $Revision: 1.2 $
| $Date: 2007-07-23 21:13:34 $
| $Revision: 1.3 $
| $Date: 2008-01-06 21:16:37 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -218,7 +218,6 @@ if (isset($_POST['updateoptions']))
$pref['html_post'] = $_POST['html_post'];
$pref['forum_attach'] = $_POST['forum_attach'];
$pref['forum_redirect'] = $_POST['forum_redirect'];
$pref['forum_user_customtitle'] = $_POST['forum_user_customtitle'];
$pref['reported_post_email'] = $_POST['reported_post_email'];
$pref['forum_tooltip'] = $_POST['forum_tooltip'];
$pref['forum_tiplength'] = $_POST['forum_tiplength'];
@ -1071,11 +1070,6 @@ class forum
<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_redirect'] ? "<input type='checkbox' name='forum_redirect' value='1' checked='checked' />" : "<input type='checkbox' name='forum_redirect' value='1' />")."</td>
</tr>
<tr>
<td style='width:75%' class='forumheader3'>".FORLAN_114."<br /><span class='smalltext'>".FORLAN_115."</span></td>
<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_user_customtitle'] ? "<input type='checkbox' name='forum_user_customtitle' value='1' checked='checked' />" : "<input type='checkbox' name='forum_user_customtitle' value='1' />")."</td>
</tr>
<tr>
<td style='width:75%' class='forumheader3'>".FORLAN_116."<br /><span class='smalltext'>".FORLAN_122."</span></td>
<td style='width:25%;text-align:center' class='forumheader3' >".($pref['reported_post_email'] ? "<input type='checkbox' name='reported_post_email' value='1' checked='checked' />" : "<input type='checkbox' name='reported_post_email' value='1' />")."</td>

View File

@ -4,9 +4,9 @@
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/languages/English/lan_forum_admin.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:17 $
| $Author: mcfly_e107 $
| $Revision: 1.2 $
| $Date: 2008-01-06 21:16:37 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
define("FORLAN_1", "You must enter the number of days you wish to prune.");
@ -127,8 +127,8 @@ define("FORLAN_111", "deactivate");
define("FORLAN_112", "Enable Redirect");
define("FORLAN_113", "Tick this to make browser redirect to forum page after replying");
define("FORLAN_114", "User Custom Title");
define("FORLAN_115", "Tick this to allow users to change their Custom Title");
//define("FORLAN_114", "User Custom Title");
//define("FORLAN_115", "Tick this to allow users to change their Custom Title");
define("FORLAN_116", "Reported Posts");
define("FORLAN_117", "This will delete the record of the reported post. Not the post itself.");
define("FORLAN_118", "Reported post deleted");

View File

@ -11,35 +11,16 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/usersettings.php,v $
| $Revision: 1.18 $
| $Date: 2007-12-15 15:06:40 $
| $Revision: 1.19 $
| $Date: 2008-01-06 21:16:16 $
| $Author: e107steved $
Mods to give a uniform interface.
To do:
1. Check that photo can be updated/deleted OK
3. Make sure all $_POST values go through $tp->toDB - currently display name, login name don't - that's the way it was
4. Make sure displayname and loginname kept in sync where not permitted to be different
5. Check whether customtitle needs a special look to obey an option - currently updated in two places; check which is required
6. XUP update - there's a bit of code which calls userlogin::update_xup() which looks relevant - BUT:
a) It allows update of user_login field
b) Possible error on {EMAILHIDE} - should it be {$EMAILHIDE} ?
c) That code will update the user record regardless of whether there are values in the XUP file - so could become null
7. When restoring $_POST values after an error (just before display) they should all have been vetted - should be done, but double check
8. Check the use of 'class' around line 190 - if left, the message doesn't make total sense. Not sure the feature makes sense anyway.
9. No means of retaining name of photo file through an error?
10. Can get editable classes from the userclass object in 0.8
11. Check its acceptable to, on the whole, not update a field which is empty but for which $_POST[] value exists
12. Run through list of fields in DB; make sure all can be updated where needed
14. Add admin log entry for when admin changing data
15. Check class memberships - possible that main admin made a member of all (may be an inherited userclass issue)
+----------------------------------------------------------------------------+
Notes:
$pref['forum_user_customtitle'] - used and saved in central record; set in forum interface
Uses $udata initially, later curVal to hold current user data
+----------------------------------------------------------------------------+
Admin log events:
USET_01 - admin changed user data
*/
//echo "Starting usersettings<br />";
@ -51,8 +32,6 @@ $ue = new e107_user_extended;
//define("US_DEBUG",TRUE);
define("US_DEBUG",FALSE);
//echo "Loaded includes<br />";
/*
These links look redundant
@ -119,6 +98,26 @@ $changed_user_data = array();
require_once(HEADERF);
// Given an array of user data, return a comma separated string which includes public, admin, member classes etc as appropriate.
function addCommonClasses($udata)
{
$tmp = array();
if ($udata['user_class'] != "") $tmp = explode(",", $udata['user_class']);
$tmp[] = e_UC_MEMBER;
$tmp[] = e_UC_READONLY;
$tmp[] = e_UC_PUBLIC;
if($udata['user_admin'] == 1)
{
$tmp[] = e_UC_ADMIN;
}
if (strpos($udata['user_perms'],'0') === 0)
{
$tmp[] = e_UC_MAINADMIN;
}
return implode(",", $tmp);
}
// Save user settings (changes only)
//-----------------------------------
$error = "";
@ -149,9 +148,14 @@ if (isset($_POST['updatesettings']))
$udata = get_user_data($inp); // Get all the existing user data, including any extended fields
$udata['user_classlist'] = addCommonClasses($udata);
$peer = ($inp == USERID ? false : true);
/*
echo "<pre>";
var_dump($udata);
echo "</pre>";
*/
// Check external avatar
@ -199,8 +203,8 @@ if (isset($_POST['updatesettings']))
// $signup_option_title = array(LAN_308, LAN_120, LAN_121, LAN_122);
// $signup_option_names = array("realname", "signature", "image", "timezone");
$signup_option_title = array(LAN_308, LAN_120, LAN_121, LAN_122, LAN_USET_6);
$signup_option_names = array("realname", "signature", "image", "timezone", "class");
$signup_option_title = array(LAN_308, LAN_120, LAN_121, LAN_122, LAN_USET_6, LAN_USET_19);
$signup_option_names = array("realname", "signature", "image", "timezone", "class", 'signup_option_customtitle');
foreach($signup_option_names as $key => $value)
{ // Check required signup fields
if ($pref['signup_option_'.$value] == 2 && !$_POST[$value] && !$_uid)
@ -233,20 +237,20 @@ if (isset($_POST['updatesettings']))
unset($loginname);
}
}
if (isset($loginname)) $_POST['loginname'] = $loginname; else unset($_POST['loginname']); // Make sure no change of the $_POST value staying set inappropriately
if (isset($loginname)) $_POST['loginname'] = $loginname; else unset($_POST['loginname']); // Make sure no chance of the $_POST value staying set inappropriately
// Display name checks
// If display name == login name, it has to meet the criteria for both login name and display name
echo "Check_class: {$pref['displayname_class']}; {$udata['user_class']}; {$peer}<br />";
if (check_class($pref['displayname_class'], $udata['user_class'], $peer))
// echo "Check_class: {$pref['displayname_class']}; {$udata['user_classlist']}; {$peer}<br />";
if (check_class($pref['displayname_class'], $udata['user_classlist'], $peer))
{ // Display name can be different to login name - check display name if its been entered
if (isset($_POST['username']))
{
$username = trim(strip_tags($_POST['username']));
$_POST['username'] = $username;
echo "Found new display name: {$username}<br />";
// echo "Found new display name: {$username}<br />";
}
}
else
@ -258,7 +262,6 @@ if (isset($_POST['updatesettings']))
if (varsettrue($username))
{
echo "Checking user name<br />";
// Impose a minimum length on display name
if (strlen($username) < 2)
{
@ -452,7 +455,7 @@ if (isset($_POST['updatesettings']))
{
// Either delete this block, or delete user_customtitle from the later loop for non-vetted fields
$new_customtitle = "";
if(isset($_POST['customtitle']) && ($pref['forum_user_customtitle'] || ADMIN))
if(isset($_POST['customtitle']) && ($pref['signup_option_customtitle'] || ADMIN))
{
$new_customtitle = $tp->toDB($_POST['customtitle']);
if ($new_customtitle != $udata['user_customtitle']) $changed_user_data['user_customtitle'] = $new_customtitle;
@ -476,7 +479,6 @@ if (isset($_POST['updatesettings']))
'user_login' => 'realname',
'user_email' => 'email',
'user_timezone' => 'timezone',
'user_customtitle' => 'customtitle',
'user_hideemail' =>'hideemail',
'user_xup' => 'user_xup');
@ -540,14 +542,8 @@ if (isset($_POST['updatesettings']))
// We can update the basic user record now - can just update fields from $changed_user_data
$new_data = array();
foreach ($changed_user_data as $fn => $fv)
{
$new_data[] = "`{$fn}`='{$fv}'";
}
if (US_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Usersettings test","Changed data:<br> ".var_export($changed_user_data,TRUE),FALSE,LOG_TO_ROLLING);
$sql->db_Update("user",implode(', ',$new_data)." WHERE user_id='".intval($inp)."' ");
$sql->db_UpdateArray("user",$changed_user_data," WHERE user_id='".intval($inp)."' ");
// Now see if we need to log anything. First check the options and class membership
// (Normally we would leave logging decision to the log class. But this one's a bit more complicated)
@ -555,8 +551,8 @@ if (isset($_POST['updatesettings']))
$do_log = array();
$log_action = '';
if ($_uid)
{ // Its an admin changing someone elses data - add an admin log entry here
echo "Admin changing user data<br />";
{ // Its an admin changing someone elses data - make an admin log entry here
$admin_log->log_event('LAN_ADMIN_LOG_001',"UID: {$udata['user_id']}. UName: {$udata['user_name']}",E_LOG_INFORMATIVE,'USET_01');
// Check against the class of the target user, not the admin!
if (!check_class(varset($pref['user_audit_class'],''),$udata['user_class'])) $user_logging_opts = array();
}
@ -651,14 +647,13 @@ if (isset($_POST['updatesettings']))
}
/*
Needed - but check bits of the file first
// Update XUP data if file name changed.
if(isset($changed_user_data['user_xup']))
{
require_once(e_HANDLER."login.php");
userlogin::update_xup($inp, $changed_user_data['user_xup']);
}
*/
$e_event->trigger("postuserset", $_POST);
@ -708,19 +703,8 @@ WHERE u.user_id='".intval($uuid)."'
$sql->db_Select_gen($qry);
$curVal=$sql->db_Fetch();
$tmp = ($curVal['user_class'] != "" ? explode(",", $curVal['user_class']) : "");
$tmp[] = e_UC_MEMBER;
$tmp[] = e_UC_READONLY;
$tmp[] = e_UC_PUBLIC;
if($curVal['user_admin'] == 1)
{
$tmp[] = e_UC_ADMIN;
}
if (strpos($curVal['user_perms'],'0') === 0)
{
$tmp[] = e_UC_MAINADMIN;
}
$curVal['userclass_list'] = implode(",", $tmp);
$curVal['userclass_list'] = addCommonClasses($curVal);
if($_POST)
{ // Fix for all the values being lost when there was an error in a field - restore from the latest $_POST values