mirror of
https://github.com/e107inc/e107.git
synced 2025-04-22 13:41:52 +02:00
Add 'predefined list' type to extended user fields; uses a list of values and display text in e107_admin/sql directory.
Create 'timezone' type of extended user field as predefined list. Move user timezone to extended user fields. Update routine only transfers existing data if its enabled in prefs. Delete the existing user_timezone, user_new fields from user table. Add timezone data file
This commit is contained in:
parent
48f844fc97
commit
01356e34fa
e107_admin
e107_files
e107_handlers
e107_languages/English
e107_themes/templates
signup.phpusersettings.php@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $
|
||||
| $Revision: 1.7 $
|
||||
| $Date: 2008-01-11 22:13:43 $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2008-01-15 21:57:10 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -67,7 +67,7 @@ CREATE TABLE audit_log (
|
||||
dblog_remarks text NOT NULL,
|
||||
PRIMARY KEY (dblog_id),
|
||||
KEY dblog_datestamp (dblog_datestamp)
|
||||
) TYPE=MyISAM;
|
||||
) TYPE=MyISAM AUTO_INCREMENT=1;
|
||||
# --------------------------------------------------------
|
||||
|
||||
|
||||
@ -161,7 +161,7 @@ CREATE TABLE dblog (
|
||||
dblog_remarks text NOT NULL,
|
||||
PRIMARY KEY (dblog_id),
|
||||
KEY dblog_datestamp (dblog_datestamp)
|
||||
) TYPE=MyISAM;
|
||||
) TYPE=MyISAM AUTO_INCREMENT=1;
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
@ -499,7 +499,6 @@ CREATE TABLE user (
|
||||
user_email varchar(100) NOT NULL default '',
|
||||
user_signature text NOT NULL,
|
||||
user_image varchar(100) NOT NULL default '',
|
||||
user_timezone varchar(3) NOT NULL default '',
|
||||
user_hideemail tinyint(3) unsigned NOT NULL default '0',
|
||||
user_join int(10) unsigned NOT NULL default '0',
|
||||
user_lastvisit int(10) unsigned NOT NULL default '0',
|
||||
@ -511,7 +510,6 @@ CREATE TABLE user (
|
||||
user_ip varchar(45) NOT NULL default '',
|
||||
user_ban tinyint(3) unsigned NOT NULL default '0',
|
||||
user_prefs text NOT NULL,
|
||||
user_new text NOT NULL,
|
||||
user_viewed text NOT NULL,
|
||||
user_visits int(10) unsigned NOT NULL default '0',
|
||||
user_admin tinyint(3) unsigned NOT NULL default '0',
|
||||
|
78
e107_admin/sql/extended_timezones.php
Normal file
78
e107_admin/sql/extended_timezones.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| ©Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/sql/extended_timezones.php,v $
|
||||
| $Revision: 1.1 $
|
||||
| $Date: 2008-01-15 21:57:15 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
/*
|
||||
This file is used with the extended user field 'predefined list' type. Its invoked when the value field is 'timezones'.
|
||||
The variable name must be 'timezones_list', and is an array of possible values, each of which is a value => text pair
|
||||
The text is displayed in a drop-down; the value is returned.
|
||||
If function timezones_value() exists, it is called to create the displayed text
|
||||
*/
|
||||
global $timezones_list;
|
||||
if (!is_array($timezones_list))
|
||||
{
|
||||
$timezones_list = array(
|
||||
array('-12', "International DateLine West"),
|
||||
array('-11', "Samoa"),
|
||||
array('-10', "Hawaii"),
|
||||
array( '-9', "Alaska"),
|
||||
array( '-8', "Pacific Time (US and Canada)"),
|
||||
array( '-7', "Mountain Time (US and Canada)"),
|
||||
array( '-6', "Central Time (US and Canada), Central America"),
|
||||
array( '-5', "Eastern Time (US and Canada)"),
|
||||
array( '-4', "Atlantic Time (Canada)"),
|
||||
array( '-3.30', 'Newfoundland'),
|
||||
array( '-3', "Greenland, Brasilia, Buenos Aires, Georgetown"),
|
||||
array( '-2', "Mid-Atlantic"),
|
||||
array( '-1', "Azores, Cape Verde Islands"),
|
||||
array( '+0', "UK, Ireland, Lisbon"),
|
||||
array( '+1', "West Central Africa, Western Europe"),
|
||||
array( '+2', "Greece, Egypt, parts of Africa"),
|
||||
array( '+3', "Russia, Baghdad, Kuwait, Nairobi"),
|
||||
array( '+3.30', 'Tehran, Iran'),
|
||||
array( '+4', "Abu Dhabi, Kabul"),
|
||||
array( '+4.30', 'Afghanistan'),
|
||||
array( '+5', "Islamabad, Karachi"),
|
||||
array( '+5.30', "Mumbai, Delhi, Calcutta"),
|
||||
array( '+5.45', 'Kathmandu'),
|
||||
array( '+6', "Astana, Dhaka"),
|
||||
array( '+7', "Bangkok, Rangoon"),
|
||||
array( '+8', "Hong Kong, Singapore, Perth, Beijing"),
|
||||
array( '+9', "Tokyo, Seoul"),
|
||||
array( '+9.30', 'Darwin, Adelaide'),
|
||||
array('+10', "Brisbane, Canberra, Sydney, Melbourne"),
|
||||
array('+10.30', 'Lord Howe Island'),
|
||||
array('+11', "Soloman Islands"),
|
||||
array('+11.30', 'Norfolk Island'),
|
||||
array('+12', "New Zealand, Fiji, Marshall Islands"),
|
||||
array('+13', "Tonga, Nuku'alofa, Rawaki Islands"),
|
||||
array('+13.45', 'Chatham Island'),
|
||||
array('+14', 'Kiribati: Line Islands')
|
||||
);
|
||||
}
|
||||
|
||||
if (!function_exists('timezones_value'))
|
||||
{
|
||||
function timezones_value($key, $value)
|
||||
{
|
||||
return 'GMT'.$key.' - '.$value;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -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.18 $
|
||||
| $Date: 2008-01-12 16:51:43 $
|
||||
| $Revision: 1.19 $
|
||||
| $Date: 2008-01-15 21:57:15 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -184,7 +184,7 @@ function update_706_to_800($type='')
|
||||
|
||||
// List of unwanted $pref values which can go
|
||||
$obs_prefs = array('frontpage_type','rss_feeds', 'log_lvcount', 'zone', 'upload_allowedfiletype', 'real', 'forum_user_customtitle',
|
||||
'utf-compatmode','frontpage_method','standards_mode','image_owner','im_quality');
|
||||
'utf-compatmode','frontpage_method','standards_mode','image_owner','im_quality', 'signup_option_timezone');
|
||||
|
||||
// List of DB tables not required (includes a few from 0.6xx)
|
||||
$obs_tables = array('flood', 'headlines', 'stat_info', 'stat_counter', 'stat_last');
|
||||
@ -196,7 +196,7 @@ function update_706_to_800($type='')
|
||||
|
||||
// List of changed DB tables (defined in core_sql.php)
|
||||
// (primarily those which have changed significantly; for the odd field write some explicit code - it'll run faster)
|
||||
$changed_tables = array('dblog','admin_log', 'userclass_classes', 'banlist');
|
||||
$changed_tables = array('user', 'dblog','admin_log', 'userclass_classes', 'banlist');
|
||||
|
||||
|
||||
// List of DB tables (key) and field (value) which need changing to accommodate IPV6 addresses
|
||||
@ -205,7 +205,6 @@ function update_706_to_800($type='')
|
||||
'online' => 'online_ip',
|
||||
'submitnews' => 'submitnews_ip',
|
||||
'tmp' => 'tmp_ip',
|
||||
'user' => 'user_ip',
|
||||
'chatbox' => 'cb_ip'
|
||||
);
|
||||
|
||||
@ -337,18 +336,6 @@ function update_706_to_800($type='')
|
||||
}
|
||||
|
||||
|
||||
// Obsolete prefs (list at top)
|
||||
foreach ($obs_prefs as $p)
|
||||
{
|
||||
if (isset($pref[$p]))
|
||||
{
|
||||
if ($just_check) return update_needed('Remove obsolete prefs');
|
||||
unset($pref[$p]);
|
||||
$do_save = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (mysql_table_exists('linkwords'))
|
||||
{ // Need to extend field linkword_link varchar(200) NOT NULL default ''
|
||||
if ($sql -> db_Query("SHOW FIELDS FROM ".MPREFIX."linkwords LIKE 'linkword_link'"))
|
||||
@ -364,6 +351,20 @@ function update_706_to_800($type='')
|
||||
}
|
||||
|
||||
|
||||
// Check need for user timezone before we delete the field
|
||||
if (varsettrue($pref['signup_option_timezone']))
|
||||
{
|
||||
if ($sql->db_Field('user', 'user_timezone', '', TRUE) && !$sql->db_Field('user_extended','user_timezone','',TRUE))
|
||||
{
|
||||
if ($just_check) return update_needed('Move user timezone info');
|
||||
if (!copy_user_timezone())
|
||||
{ // Error doing the transfer
|
||||
echo "Error transferring user timezone data - aborted<br />";
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tables defined in core_sql.php
|
||||
//---------------------------------
|
||||
|
||||
@ -468,6 +469,18 @@ function update_706_to_800($type='')
|
||||
}
|
||||
}
|
||||
|
||||
// Obsolete prefs (list at top)
|
||||
// Intentionally do this last - we may check some of them during the update
|
||||
foreach ($obs_prefs as $p)
|
||||
{
|
||||
if (isset($pref[$p]))
|
||||
{
|
||||
if ($just_check) return update_needed('Remove obsolete prefs');
|
||||
unset($pref[$p]);
|
||||
$do_save = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($do_save) save_prefs();
|
||||
|
||||
@ -558,6 +571,33 @@ function update_70x_to_706($type='')
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Carries out the copy of timezone data from the user record to an extended user field
|
||||
// Return TRUE on success, FALSE on failure
|
||||
function copy_user_timezone()
|
||||
{
|
||||
global $sql, $sql2, $tp;
|
||||
require_once(e_HANDLER.'user_extended_class.php');
|
||||
$ue = new e107_user_extended;
|
||||
$tmp = $ue->parse_extended_xml('getfile');
|
||||
$tmp['timezone']['parms'] = $tp->toDB($tmp['timezone']['parms']);
|
||||
if(!$ue->user_extended_add($tmp['timezone']))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Created the field - now copy existing data
|
||||
if ($sql->db_Select('user','user_id, user_timezone'))
|
||||
{
|
||||
while ($row = $sql->db_Fetch())
|
||||
{
|
||||
$sql2->db_Update('user_extended',"`user_timezone`='{$row['user_timezone']}' WHERE `user_extended_id`={$row['user_id']}");
|
||||
}
|
||||
}
|
||||
return TRUE; // All done!
|
||||
}
|
||||
|
||||
|
||||
function update_needed($message='')
|
||||
{
|
||||
global $ns, $update_debug;
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/users_extended.php,v $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2007-04-14 17:24:22 $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2008-01-15 21:57:16 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -65,6 +65,7 @@ if (isset($_POST['up_x']))
|
||||
$sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order-1 WHERE user_extended_struct_type > 0 AND user_extended_struct_parent = {$_parent} AND user_extended_struct_id='".$_id."'");
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['down_x']))
|
||||
{
|
||||
$qs = explode(".", $_POST['id']);
|
||||
@ -85,6 +86,7 @@ if (isset($_POST['catup_x']))
|
||||
$sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order-1 WHERE user_extended_struct_type = 0 AND user_extended_struct_id='".$_id."'");
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['catdown_x']))
|
||||
{
|
||||
$qs = explode(".", $_POST['id']);
|
||||
@ -94,6 +96,7 @@ if (isset($_POST['catdown_x']))
|
||||
$sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order+1 WHERE user_extended_struct_type = 0 AND user_extended_struct_id='".$_id."'");
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['add_field']))
|
||||
{
|
||||
$ue_field_name = str_replace(' ','_',trim($_POST['user_field'])); // Replace space with underscore - better security
|
||||
@ -126,7 +129,9 @@ if (isset($_POST['add_field']))
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['update_field'])) {
|
||||
|
||||
if (isset($_POST['update_field']))
|
||||
{
|
||||
if($_POST['user_type']==4){
|
||||
$_POST['user_values'] = array($_POST['table_db'],$_POST['field_id'],$_POST['field_value'],$_POST['field_order']);
|
||||
}
|
||||
@ -135,18 +140,21 @@ if (isset($_POST['update_field'])) {
|
||||
admin_update($ue->user_extended_modify($sub_action, $_POST['user_field'], $_POST['user_text'], $_POST['user_type'], $upd_parms, $upd_values, $_POST['user_default'], $_POST['user_required'], $_POST['user_read'], $_POST['user_write'], $_POST['user_applicable'], $_POST['user_parent']), 'update', EXTLAN_29);
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['update_category']))
|
||||
{
|
||||
$name = trim($tp->toHTML($_POST['user_field']));
|
||||
admin_update($sql->db_Update("user_extended_struct","user_extended_struct_name = '{$name}', user_extended_struct_read = '{$_POST['user_read']}', user_extended_struct_write = '{$_POST['user_write']}', user_extended_struct_applicable = '{$_POST['user_applicable']}' WHERE user_extended_struct_id = '{$sub_action}'"), 'update', EXTLAN_43);
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['add_category']))
|
||||
{
|
||||
$name = $tp->toHTML($_POST['user_field']);
|
||||
admin_update($sql->db_Insert("user_extended_struct","'0', '$name', '', 0, '', '', '', '{$_POST['user_read']}', '{$_POST['user_write']}', '0', '0', '{$_POST['user_applicable']}', '0', '0'"), 'insert', EXTLAN_40);
|
||||
}
|
||||
|
||||
|
||||
if ($_POST['eu_action'] == "delext")
|
||||
{
|
||||
list($_id, $_name) = explode(",",$_POST['key']);
|
||||
@ -627,6 +635,7 @@ class users_ext
|
||||
$ns->tablerender(EXTLAN_9, $text);
|
||||
}
|
||||
|
||||
|
||||
function show_categories($current)
|
||||
{
|
||||
global $sql, $ns, $ue;
|
||||
@ -764,12 +773,13 @@ class users_ext
|
||||
$ns->tablerender(EXTLAN_9, $text);
|
||||
}
|
||||
|
||||
function show_options($action) {
|
||||
// ##### Display options ---------------------------------------------------------------------------------------------------------
|
||||
if ($action == "") {
|
||||
|
||||
function show_options($action)
|
||||
{
|
||||
if ($action == "")
|
||||
{
|
||||
$action = "main";
|
||||
}
|
||||
// ##### Display options ---------------------------------------------------------------------------------------------------------
|
||||
$var['main']['text'] = EXTLAN_34;
|
||||
$var['main']['link'] = e_SELF;
|
||||
|
||||
@ -786,6 +796,7 @@ class users_ext
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function users_extended_adminmenu() {
|
||||
global $user, $action, $ns, $curtype, $action;
|
||||
$user->show_options($action);
|
||||
@ -813,6 +824,7 @@ function make_delimited($var)
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
function show_predefined()
|
||||
{
|
||||
global $tp, $ns, $ue, $sql;
|
||||
@ -876,6 +888,7 @@ function show_predefined()
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
function show_field($var, $type='activate')
|
||||
{
|
||||
global $tp;
|
||||
@ -884,12 +897,11 @@ function show_field($var, $type='activate')
|
||||
// $showlist = array('type','text', 'values', 'include_text', 'regex');
|
||||
if($head_shown != 1)
|
||||
{
|
||||
|
||||
$txt .= "
|
||||
<tr>
|
||||
<td class='forumheader'>".UE_LAN_9."</td>
|
||||
<td class='forumheader'>".UE_LAN_10."</td>
|
||||
<td class='forumheader'>".UE_LAN_11."</td>
|
||||
<td class='forumheader'>".UE_LAN_21."</td>
|
||||
<td class='forumheader'>".UE_LAN_22."</td>
|
||||
<td class='forumheader'>".UE_LAN_23."</td>
|
||||
<td class='forumheader' style='width: 5%'> </td>
|
||||
</tr>
|
||||
";
|
||||
@ -916,6 +928,7 @@ function show_field($var, $type='activate')
|
||||
return $txt;
|
||||
}
|
||||
|
||||
|
||||
function field_activate()
|
||||
{
|
||||
global $ue, $ns, $tp;
|
||||
@ -943,6 +956,7 @@ function field_activate()
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
function field_deactivate()
|
||||
{
|
||||
global $ue, $ns, $tp,$sql;
|
||||
@ -965,7 +979,8 @@ function field_deactivate()
|
||||
}
|
||||
|
||||
|
||||
function process_sql($f){
|
||||
function process_sql($f)
|
||||
{
|
||||
global $sql;
|
||||
$filename = e_ADMIN."sql/extended_".$f.".php";
|
||||
$fd = fopen ($filename, "r");
|
||||
@ -1007,7 +1022,7 @@ function headerjs()
|
||||
var ftype;
|
||||
var helptext;
|
||||
";
|
||||
for($i=1; $i<=8; $i++)
|
||||
for($i=1; $i<=9; $i++)
|
||||
{
|
||||
$type_const = "UE_LAN_{$i}";
|
||||
$help_const = "EXTLAN_HELP_{$i}";
|
||||
|
8
e107_files/cache/user_extended.xml
vendored
8
e107_files/cache/user_extended.xml
vendored
@ -64,4 +64,12 @@
|
||||
<read>253</read>
|
||||
<write>253</write>
|
||||
</item>
|
||||
<item name="timezone">
|
||||
<type>list</type>
|
||||
<values>timezones</values>
|
||||
<default>+0</default>
|
||||
<applicable>253</applicable>
|
||||
<read>253</read>
|
||||
<write>253</write>
|
||||
</item>
|
||||
</e107_extended_user_fields>
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_files/def_e107_prefs.php,v $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2008-01-13 10:52:20 $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2008-01-15 21:57:24 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -105,7 +105,6 @@ City, State, Country
|
||||
'signup_option_realname' => '1',
|
||||
'signup_option_signature' => '1',
|
||||
'signup_option_image' => '1',
|
||||
'signup_option_timezone' => '1',
|
||||
'signup_option_class' => '1',
|
||||
'newsposts_archive' => '0',
|
||||
'newsposts_archive_title' => '',
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_files/shortcode/batch/signup_shortcodes.php,v $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2008-01-09 22:44:13 $
|
||||
| $Revision: 1.10 $
|
||||
| $Date: 2008-01-15 21:57:31 $
|
||||
| $Author: e107steved $
|
||||
|
|
||||
| Mods to show extended field categories
|
||||
@ -275,34 +275,6 @@ if($pref['signup_option_image'])
|
||||
}
|
||||
SC_END
|
||||
|
||||
SC_BEGIN SIGNUP_TIMEZONE
|
||||
global $pref;
|
||||
if ($pref['signup_option_timezone'])
|
||||
{
|
||||
$timezone = array("-12", "-11", "-10", "-9", "-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1", "GMT", "+1", "+2", "+3", "+4", "+5", "+5.30", "+6", "+7", "+8", "+9", "+10", "+11", "+12", "+13");
|
||||
$timearea = array("International DateLine West", "Samoa", "Hawaii", "Alaska", "Pacific Time (US and Canada)", "Mountain Time (US and Canada)", "Central Time (US and Canada), Central America", "Eastern Time (US and Canada)", "Atlantic Time (Canada)", "Greenland, Brasilia, Buenos Aires, Georgetown", "Mid-Atlantic", "Azores", "GMT - UK, Ireland, Lisbon", "West Central Africa, Western Europe", "Greece, Egypt, parts of Africa", "Russia, Baghdad, Kuwait, Nairobi", "Abu Dhabi, Kabul", "Islamabad, Karachi", "Mumbai, Delhi, Calcutta", "Astana, Dhaka", "Bangkok, Rangoon", "Hong Kong, Singapore, Perth, Beijing", "Tokyo, Seoul", "Brisbane, Canberra, Sydney, Melbourne", "Soloman Islands", "New Zealand", "Nuku'alofa");
|
||||
$text .= "
|
||||
<select style='width:99%' name='timezone' class='tbox'>\n";
|
||||
|
||||
$count = 0;
|
||||
while ($timezone[$count])
|
||||
{
|
||||
if ($timezone[$count] == $user_timezone)
|
||||
{
|
||||
$text .= "<option value='".$timezone[$count]."' selected>(GMT".$timezone[$count].") ".$timearea[$count]."</option>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= "<option value='".$timezone[$count]."'>(GMT".$timezone[$count].") ".$timearea[$count]."</option>\n";
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
$text .= "</select>";
|
||||
return $text;
|
||||
}
|
||||
return "";
|
||||
SC_END
|
||||
|
||||
|
||||
SC_BEGIN SIGNUP_IMAGECODE
|
||||
global $signup_imagecode, $rs, $sec_img;
|
||||
|
@ -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.8 $
|
||||
| $Date: 2008-01-08 22:24:14 $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2008-01-15 21:57:31 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -145,28 +145,6 @@ return display_help("", 2);
|
||||
SC_END
|
||||
|
||||
|
||||
SC_BEGIN TIMEZONE
|
||||
global $curVal;
|
||||
$ret = "<select name='timezone' class='tbox'>\n";
|
||||
$timezone = array("-12", "-11", "-10", "-9", "-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1", "GMT", "+1", "+2", "+3", "+4", "+5", "+6", "+7", "+8", "+9", "+10", "+11", "+12", "+13");
|
||||
$timearea = array("International DateLine West", "Samoa", "Hawaii", "Alaska", "Pacific Time (US and Canada)", "Mountain Time (US and Canada)", "Central Time (US and Canada), Central America", "Eastern Time (US and Canada)", "Atlantic Time (Canada)", "Greenland, Brasilia, Buenos Aires, Georgetown", "Mid-Atlantic", "Azores", "GMT - UK, Ireland, Lisbon", "West Central Africa, Western Europe", "Greece, Egypt, parts of Africa", "Russia, Baghdad, Kuwait, Nairobi", "Abu Dhabi, Kabul", "Islamabad, Karachi", "Astana, Dhaka", "Bangkok, Rangoon", "Hong Kong, Singapore, Perth, Beijing", "Tokyo, Seoul", "Brisbane, Canberra, Sydney, Melbourne", "Soloman Islands", "New Zealand", "Nuku'alofa");
|
||||
$count = 0;
|
||||
while ($timezone[$count])
|
||||
{
|
||||
if ($timezone[$count] == $curVal['user_timezone'])
|
||||
{
|
||||
$ret .= "<option value='".$timezone[$count]."' selected='selected'>(GMT".$timezone[$count].") ".$timearea[$count]."</option>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret .= "<option value='".$timezone[$count]."'>(GMT".$timezone[$count].") ".$timearea[$count]."</option>\n";
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
|
||||
$ret .= "</select>";
|
||||
return $ret;
|
||||
SC_END
|
||||
|
||||
SC_BEGIN AVATAR_UPLOAD
|
||||
global $pref;
|
||||
|
@ -91,28 +91,28 @@ if ($parms[1] == 'icon')
|
||||
if ($parms[1] == 'value')
|
||||
{
|
||||
$uVal = str_replace(chr(1), "", $udata['user_'.$parms[0]]);
|
||||
// check for db_lookup type
|
||||
if($ueStruct["user_".$parms[0]]['user_extended_struct_type'] == '4')
|
||||
switch ($ueStruct["user_".$parms[0]]['user_extended_struct_type'])
|
||||
{
|
||||
// check for db_lookup type
|
||||
case EUF_DB_FIELD :
|
||||
$tmp = explode(",",$ueStruct["user_".$parms[0]]['user_extended_struct_values']);
|
||||
if($sql->db_Select($tmp[0],"{$tmp[1]}, {$tmp[2]}","{$tmp[1]} = '{$uVal}'"))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
$ret_data = $row[$tmp[2]];
|
||||
$row = $sql->db_Fetch();
|
||||
$ret_data = $row[$tmp[2]];
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret_data = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//check for 0000-00-00 in date field
|
||||
if($ueStruct["user_".$parms[0]]['user_extended_struct_type'] == '7')
|
||||
{
|
||||
if($uVal == "0000-00-00") { $uVal = ""; }
|
||||
$ret_data = FALSE;
|
||||
}
|
||||
break;
|
||||
case EUF_DATE ; //check for 0000-00-00 in date field
|
||||
if($uVal == "0000-00-00") { $uVal = ""; }
|
||||
$ret_data = $uVal;
|
||||
break;
|
||||
case EUF_PREDEFINED : // Predefined field - have to look up display string in relevant file
|
||||
$ret_data = e107_user_extended::user_extended_display_text($ueStruct["user_".$parms[0]]['user_extended_struct_values'],$uVal);
|
||||
break;
|
||||
}
|
||||
if($ret_data != "")
|
||||
{
|
||||
|
@ -12,8 +12,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/login.php,v $
|
||||
| $Revision: 1.14 $
|
||||
| $Date: 2008-01-12 16:51:43 $
|
||||
| $Revision: 1.15 $
|
||||
| $Date: 2008-01-15 21:57:38 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -259,8 +259,7 @@ class userlogin
|
||||
'user_hideemail'=>'EMAILHIDE',
|
||||
'user_signature'=>'SIG',
|
||||
'user_sess'=>'PHOTO',
|
||||
'user_image'=>'AV',
|
||||
'user_timezone'=>'TZ');
|
||||
'user_image'=>'AV');
|
||||
|
||||
$new_values = array();
|
||||
foreach ($main_fields as $f => $v)
|
||||
@ -282,6 +281,7 @@ class userlogin
|
||||
"MSN" => "msn",
|
||||
"YAHOO" => "yahoo",
|
||||
"GEO" => "location",
|
||||
"TZ" => 'timezone',
|
||||
"BDAY" => "birthday");
|
||||
include_once(e_HANDLER."user_extended_class.php");
|
||||
$usere = new e107_user_extended;
|
||||
|
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/user_extended_class.php,v $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2007-11-13 07:45:12 $
|
||||
| $Author: e107coders $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2008-01-15 21:57:38 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@ -41,16 +41,17 @@ class e107_user_extended
|
||||
|
||||
function e107_user_extended()
|
||||
{
|
||||
// 1 = text
|
||||
// 2 = radio
|
||||
// 3 = dropdown
|
||||
// 4 = db field
|
||||
// 5 = textarea
|
||||
// 6 = integer
|
||||
// 7 = date
|
||||
// 8 = language
|
||||
define('EUF_TEXT',1);
|
||||
define('EUF_RADIO',2);
|
||||
define('EUF_DROPDOWN',3);
|
||||
define('EUF_DB_FIELD',4);
|
||||
define('EUF_TEXTAREA',5);
|
||||
define('EUF_INTEGER',6);
|
||||
define('EUF_DATE',7);
|
||||
define('EUF_LANGUAGE',8);
|
||||
define('EUF_PREDEFINED',9);
|
||||
|
||||
$this->typeArray = array(
|
||||
$this->typeArray = array(
|
||||
'text' => 1,
|
||||
'radio' => 2,
|
||||
'dropdown' => 3,
|
||||
@ -58,9 +59,11 @@ class e107_user_extended
|
||||
'textarea' => 5,
|
||||
'integer' => 6,
|
||||
'date' => 7,
|
||||
'language' => 8
|
||||
);
|
||||
$this->user_extended_types = array(
|
||||
'language' => 8,
|
||||
'list' => 9
|
||||
);
|
||||
|
||||
$this->user_extended_types = array(
|
||||
1 => UE_LAN_1,
|
||||
2 => UE_LAN_2,
|
||||
3 => UE_LAN_3,
|
||||
@ -68,15 +71,17 @@ class e107_user_extended
|
||||
5 => UE_LAN_5,
|
||||
6 => UE_LAN_6,
|
||||
7 => UE_LAN_7,
|
||||
8 => UE_LAN_8
|
||||
);
|
||||
8 => UE_LAN_8,
|
||||
9 => UE_LAN_9
|
||||
);
|
||||
|
||||
//load array with field names from main user table, so we can disallow these
|
||||
// user_new, user_timezone deleted for 0.8
|
||||
$this->reserved_names = array (
|
||||
'id', 'name', 'loginname', 'customtitle', 'password',
|
||||
'sess', 'email', 'signature', 'image', 'timezone', 'hideemail',
|
||||
'sess', 'email', 'signature', 'image', 'hideemail',
|
||||
'join', 'lastvisit', 'currentvisit', 'lastpost', 'chats',
|
||||
'comments', 'forums', 'ip', 'ban', 'prefs', 'new', 'viewed',
|
||||
'comments', 'forums', 'ip', 'ban', 'prefs', 'viewed',
|
||||
'visits', 'admin', 'login', 'class', 'perms', 'realm', 'pwchange',
|
||||
'xup'
|
||||
);
|
||||
@ -85,16 +90,16 @@ class e107_user_extended
|
||||
|
||||
function user_extended_reserved($name)
|
||||
{
|
||||
return (in_array($name, $this->reserved_names));
|
||||
return (in_array($name, $this->reserved_names));
|
||||
}
|
||||
|
||||
|
||||
function user_extended_get_categories($byID = TRUE)
|
||||
{
|
||||
$ret = array();
|
||||
global $sql;
|
||||
if($sql->db_Select("user_extended_struct", "*", "user_extended_struct_type = 0 ORDER BY user_extended_struct_order ASC"))
|
||||
{
|
||||
|
||||
if($byID == TRUE)
|
||||
{
|
||||
while($row = $sql->db_Fetch())
|
||||
@ -141,95 +146,98 @@ class e107_user_extended
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
function user_extended_type_text($type, $default)
|
||||
{
|
||||
global $tp;
|
||||
switch ($type)
|
||||
{
|
||||
global $tp;
|
||||
switch ($type)
|
||||
{
|
||||
case EUF_INTEGER :
|
||||
$db_type = 'INT(11)';
|
||||
break;
|
||||
|
||||
case 6:
|
||||
// integer,
|
||||
$db_type = 'INT(11)';
|
||||
break;
|
||||
case EUF_DATE :
|
||||
$db_type = 'DATE NOT NULL';
|
||||
break;
|
||||
|
||||
case 7:
|
||||
// date,
|
||||
$db_type = 'DATE NOT NULL';
|
||||
break;
|
||||
case EUF_TEXTAREA:
|
||||
$db_type = 'TEXT';
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 8:
|
||||
//text, dropdown, radio, db_field, language
|
||||
$db_type = 'VARCHAR(255)';
|
||||
break;
|
||||
case EUF_TEXT :
|
||||
case EUF_RADIO :
|
||||
case EUF_DROPDOWN :
|
||||
case EUF_DB_FIELD :
|
||||
case EUF_LANGUAGE :
|
||||
case EUF_PREDEFINED :
|
||||
$db_type = 'VARCHAR(255)';
|
||||
break;
|
||||
|
||||
case 5:
|
||||
//textarea
|
||||
$db_type = 'TEXT';
|
||||
break;
|
||||
}
|
||||
if($type != 4 && $default != '')
|
||||
{
|
||||
$default_text = " DEFAULT '".$tp -> toDB($default, true)."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$default_text = '';
|
||||
}
|
||||
return $db_type.$default_text;
|
||||
}
|
||||
if($type != EUF_DB_FIELD && $default != '')
|
||||
{
|
||||
$default_text = " DEFAULT '".$tp -> toDB($default, true)."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$default_text = '';
|
||||
}
|
||||
return $db_type.$default_text;
|
||||
}
|
||||
|
||||
|
||||
function user_extended_field_exist($name)
|
||||
{
|
||||
global $sql, $tp;
|
||||
return $sql->db_Count('user_extended_struct','(*)', "WHERE user_extended_struct_name = '".$tp -> toDB($name, true)."'");
|
||||
global $sql, $tp;
|
||||
return $sql->db_Count('user_extended_struct','(*)', "WHERE user_extended_struct_name = '".$tp -> toDB($name, true)."'");
|
||||
}
|
||||
|
||||
|
||||
// For use by plugins to add extended user fields and won't be visible anywhere else
|
||||
function user_extended_add_system($name, $type, $default = '')
|
||||
{
|
||||
return $this->user_extended_add($name, '_system_', $type, '', '', $default, 0, 255, 255, 255, 0, 0);
|
||||
return $this->user_extended_add($name, '_system_', $type, '', '', $default, 0, 255, 255, 255, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
function user_extended_add($name, $text, $type, $parms, $values, $default, $required, $read, $write, $applicable, $order='', $parent)
|
||||
{
|
||||
global $sql, $tp;
|
||||
if(is_array($name))
|
||||
{
|
||||
extract($name);
|
||||
}
|
||||
if(!is_numeric($type))
|
||||
{
|
||||
$type = $this->typeArray[$type];
|
||||
}
|
||||
global $sql, $tp;
|
||||
if(is_array($name))
|
||||
{
|
||||
extract($name);
|
||||
}
|
||||
if(!is_numeric($type))
|
||||
{
|
||||
$type = $this->typeArray[$type];
|
||||
}
|
||||
|
||||
if (!$this->user_extended_field_exist($name) && !$this->user_extended_reserved($name))
|
||||
if (!$this->user_extended_field_exist($name) && !$this->user_extended_reserved($name))
|
||||
{
|
||||
$field_info = $this->user_extended_type_text($type, $default);
|
||||
if($order === '')
|
||||
{
|
||||
$field_info = $this->user_extended_type_text($type, $default);
|
||||
if($order === '')
|
||||
if($sql->db_Select("user_extended_struct","MAX(user_extended_struct_order) as maxorder","1"))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
if(is_numeric($row['maxorder']))
|
||||
{
|
||||
if($sql->db_Select("user_extended_struct","MAX(user_extended_struct_order) as maxorder","1"))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
if(is_numeric($row['maxorder']))
|
||||
{
|
||||
$order = $row['maxorder']+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql->db_Select_gen("ALTER TABLE #user_extended ADD user_".$tp -> toDB($name, true)." ".$field_info);
|
||||
$sql->db_Insert("user_extended_struct","0,'".$tp -> toDB($name, true)."','".$tp -> toDB($text, true)."','".intval($type)."','".$tp -> toDB($parms, true)."','".$tp -> toDB($values, true)."', '".$tp -> toDB($default, true)."', '".intval($read)."', '".intval($write)."', '".intval($required)."', '0', '".intval($applicable)."', '".intval($order)."', '".intval($parent)."'");
|
||||
if ($this->user_extended_field_exist($name))
|
||||
{
|
||||
return TRUE;
|
||||
$order = $row['maxorder']+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
$sql->db_Select_gen("ALTER TABLE #user_extended ADD user_".$tp -> toDB($name, true)." ".$field_info);
|
||||
$sql->db_Insert("user_extended_struct","0,'".$tp -> toDB($name, true)."','".$tp -> toDB($text, true)."','".intval($type)."','".$tp -> toDB($parms, true)."','".$tp -> toDB($values, true)."', '".$tp -> toDB($default, true)."', '".intval($read)."', '".intval($write)."', '".intval($required)."', '0', '".intval($applicable)."', '".intval($order)."', '".intval($parent)."'");
|
||||
if ($this->user_extended_field_exist($name))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function user_extended_modify($id, $name, $text, $type, $parms, $values, $default, $required, $read, $write, $applicable, $parent)
|
||||
{
|
||||
global $sql, $tp;
|
||||
@ -279,59 +287,96 @@ class e107_user_extended
|
||||
return "<input type='checkbox' {$chk} value='1' name='{$name}' /> ".UE_LAN_HIDE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function user_extended_edit($struct, $curval)
|
||||
{
|
||||
global $cal, $tp;
|
||||
$choices = explode(",",$struct['user_extended_struct_values']);
|
||||
if(trim($curval) == "" && $struct['user_extended_struct_default'] != "")
|
||||
{
|
||||
$curval = $struct['user_extended_struct_default'];
|
||||
}
|
||||
foreach($choices as $k => $v)
|
||||
{
|
||||
$choices[$k] = str_replace("[E_COMMA]", ",", $choices[$k]);
|
||||
}
|
||||
$parms = explode("^,^",$struct['user_extended_struct_parms']);
|
||||
$include = preg_replace("/\n/", " ", $tp->toHtml($parms[0]));
|
||||
$regex = $tp->toText($parms[1]);
|
||||
$regexfail = $tp->toText($parms[2]);
|
||||
$fname = "ue[user_".$struct['user_extended_struct_name']."]";
|
||||
if(strpos($include, 'class') === FALSE) {
|
||||
$include .= " class='tbox' ";
|
||||
}
|
||||
global $cal, $tp;
|
||||
if(trim($curval) == "" && $struct['user_extended_struct_default'] != "")
|
||||
{
|
||||
$curval = $struct['user_extended_struct_default'];
|
||||
}
|
||||
$choices = explode(",",$struct['user_extended_struct_values']);
|
||||
foreach($choices as $k => $v)
|
||||
{
|
||||
$choices[$k] = str_replace("[E_COMMA]", ",", $choices[$k]);
|
||||
}
|
||||
$parms = explode("^,^",$struct['user_extended_struct_parms']);
|
||||
$include = preg_replace("/\n/", " ", $tp->toHtml($parms[0]));
|
||||
$regex = $tp->toText($parms[1]);
|
||||
$regexfail = $tp->toText($parms[2]);
|
||||
$fname = "ue[user_".$struct['user_extended_struct_name']."]";
|
||||
if(strpos($include, 'class') === FALSE)
|
||||
{
|
||||
$include .= " class='tbox' ";
|
||||
}
|
||||
|
||||
switch($struct['user_extended_struct_type'])
|
||||
{
|
||||
case 1: //textbox
|
||||
case 6: //integer
|
||||
$ret = "<input name='{$fname}' value='{$curval}' {$include} />";
|
||||
return $ret;
|
||||
break;
|
||||
|
||||
case 2: //radio
|
||||
foreach($choices as $choice)
|
||||
{
|
||||
$choice = trim($choice);
|
||||
$chk = ($curval == $choice)? " checked='checked' " : "";
|
||||
$ret .= "<input {$include} type='radio' name='{$fname}' value='{$choice}' {$chk} /> {$choice}";
|
||||
}
|
||||
return $ret;
|
||||
break;
|
||||
/*
|
||||
define('EUF_TEXT',1);
|
||||
define('EUF_RADIO',2);
|
||||
define('EUF_DROPDOWN',3);
|
||||
define('EUF_DB_FIELD',4);
|
||||
define('EUF_TEXTAREA',5);
|
||||
define('EUF_INTEGER',6);
|
||||
define('EUF_DATE',7);
|
||||
define('EUF_LANGUAGE',8);
|
||||
define('EUF_PREDEFINED',9);
|
||||
*/
|
||||
switch($struct['user_extended_struct_type'])
|
||||
{
|
||||
case EUF_TEXT : //textbox
|
||||
case EUF_INTEGER : //integer
|
||||
$ret = "<input name='{$fname}' value='{$curval}' {$include} />";
|
||||
return $ret;
|
||||
break;
|
||||
|
||||
case 3: //dropdown
|
||||
$ret = "<select {$include} name='{$fname}'>\n";
|
||||
$ret .= "<option value=''> </option>\n"; // ensures that the user chose it.
|
||||
foreach($choices as $choice)
|
||||
{
|
||||
$choice = trim($choice);
|
||||
$sel = ($curval == $choice) ? " selected='selected' " : "";
|
||||
$ret .= "<option value='{$choice}' {$sel}>{$choice}</option>\n";
|
||||
}
|
||||
$ret .= "</select>\n";
|
||||
return $ret;
|
||||
break;
|
||||
case EUF_RADIO : //radio
|
||||
foreach($choices as $choice)
|
||||
{
|
||||
$choice = trim($choice);
|
||||
$chk = ($curval == $choice)? " checked='checked' " : "";
|
||||
$ret .= "<input {$include} type='radio' name='{$fname}' value='{$choice}' {$chk} /> {$choice}";
|
||||
}
|
||||
return $ret;
|
||||
break;
|
||||
|
||||
case 4: //db_field
|
||||
case EUF_DROPDOWN : //dropdown
|
||||
$ret = "<select {$include} name='{$fname}'>\n";
|
||||
$ret .= "<option value=''> </option>\n"; // ensures that the user chose it.
|
||||
foreach($choices as $choice)
|
||||
{
|
||||
$choice = trim($choice);
|
||||
$sel = ($curval == $choice) ? " selected='selected' " : "";
|
||||
$ret .= "<option value='{$choice}' {$sel}>{$choice}</option>\n";
|
||||
}
|
||||
$ret .= "</select>\n";
|
||||
return $ret;
|
||||
break;
|
||||
|
||||
case EUF_PREDEFINED : // predefined list, shown in dropdown
|
||||
$filename = e_ADMIN.'sql/extended_'.trim($struct['user_extended_struct_values']).'.php';
|
||||
if (!is_readable($filename)) return 'No file: '.$filename;
|
||||
require($filename);
|
||||
$list_name = $struct['user_extended_struct_values'].'_list';
|
||||
$display_func = $struct['user_extended_struct_values'].'_value';
|
||||
if (!function_exists($display_func)) $display_func = '';
|
||||
$source_data = $$list_name;
|
||||
$ret = "<select {$include} name='{$fname}'>\n";
|
||||
$ret .= "<option value=''> </option>\n"; // ensures that the user chose it.
|
||||
foreach($source_data as $v)
|
||||
{
|
||||
$val = $v[0];
|
||||
$choice = trim($v[1]);
|
||||
if ($display_func) $choice = $display_func($val,$choice);
|
||||
$sel = ($curval == $val) ? " selected='selected' " : "";
|
||||
$ret .= "<option value='{$val}' {$sel}>{$choice}</option>\n";
|
||||
}
|
||||
$ret .= "</select>\n";
|
||||
return $ret;
|
||||
break;
|
||||
|
||||
case EUF_DB_FIELD : //db_field
|
||||
global $sql;
|
||||
$order = ($choices[3]) ? "ORDER BY ".$tp -> toDB($choices[3], true) : "";
|
||||
|
||||
@ -353,11 +398,11 @@ class e107_user_extended
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: //textarea
|
||||
case EUF_TEXTAREA : //textarea
|
||||
return "<textarea {$include} name='{$fname}' >{$curval}</textarea>";
|
||||
break;
|
||||
|
||||
case 7: //date
|
||||
case EUF_DATE : //date
|
||||
return $cal->make_input_field(
|
||||
array(
|
||||
'ifFormat' => '%Y-%m-%d'
|
||||
@ -370,7 +415,7 @@ class e107_user_extended
|
||||
);
|
||||
break;
|
||||
|
||||
case 8: // language
|
||||
case EUF_LANGUAGE : // language
|
||||
require_once(e_HANDLER."file_class.php");
|
||||
$fl = new e_file;
|
||||
$lanlist = $fl->get_dirs(e_LANGUAGEDIR);
|
||||
@ -415,6 +460,7 @@ class e107_user_extended
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
function parse_extended_xml($contents, $no_cache = FALSE)
|
||||
{
|
||||
if($no_cache == FALSE && $this->extended_xml)
|
||||
@ -442,11 +488,11 @@ class e107_user_extended
|
||||
"default" => $item->default[0],
|
||||
"required" => $item->required[0],
|
||||
"read" => $item->read[0],
|
||||
"write" => $item->write[0],
|
||||
"write" => $item->write[0],
|
||||
"applicable" => $item->applicable[0],
|
||||
"include_text" => $item->include_text[0],
|
||||
"parms" => $item->include_text[0],
|
||||
"regex" => $item->regex[0]
|
||||
"regex" => $item->regex[0]
|
||||
);
|
||||
if(is_array($item->default) && $item->default[0] == '')
|
||||
{
|
||||
@ -529,7 +575,30 @@ class e107_user_extended
|
||||
$field_name = 'user_'.$field_name;
|
||||
}
|
||||
$uinfo = get_user_data($uid);
|
||||
return (isset($uinfo[$field_name]) ? $uinfo[$field_name] : $ifnotset);
|
||||
if (!isset($uinfo[$field_name])) return $ifnotset;
|
||||
return $uinfo[$field_name];
|
||||
}
|
||||
|
||||
// Given a predefined list field, returns the display text corresponding to the passed value
|
||||
function user_extended_display_text($table,$value)
|
||||
{
|
||||
$filename = e_ADMIN.'sql/extended_'.$table.'.php';
|
||||
if (!is_readable($filename)) return 'No file: '.$filename;
|
||||
require_once($filename);
|
||||
$list_name = $table.'_list';
|
||||
$display_func = $table.'_value';
|
||||
if (!function_exists($display_func)) $display_func = '';
|
||||
$source_data = $$list_name;
|
||||
foreach($source_data as $v)
|
||||
{
|
||||
if ($value == $v[0])
|
||||
{
|
||||
if ($display_func) return $display_func($v[0],$v[1]);
|
||||
return $v[1];
|
||||
}
|
||||
}
|
||||
return '????';
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -4,8 +4,8 @@
|
||||
| e107 website system - Language File.
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_users_extended.php,v $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2007-04-14 17:24:29 $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2008-01-15 21:57:46 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -108,5 +108,7 @@ define("EXTLAN_HELP_6", "Allow user to enter a numeric value");
|
||||
define("EXTLAN_HELP_7", "Require user to enter a date");
|
||||
// Language
|
||||
define("EXTLAN_HELP_8", "Allow user to select from installed languages");
|
||||
// Predefined list
|
||||
define('EXTLAN_HELP_9', 'Specify a predefined list. The value field selects the type of list - at present only \'timezones\' is a valid entry');
|
||||
|
||||
?>
|
@ -4,11 +4,12 @@
|
||||
| e107 website system - Language File.
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_user_extended.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2007-04-17 19:29:56 $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2008-01-15 21:57:46 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
// The LAN numbers correspond directly to the field types
|
||||
define("UE_LAN_1", "Text Box");
|
||||
define("UE_LAN_2", "Radio Buttons");
|
||||
define("UE_LAN_3", "Drop-Down Menu");
|
||||
@ -17,10 +18,11 @@ define("UE_LAN_5", "Textarea");
|
||||
define("UE_LAN_6", "Integer");
|
||||
define("UE_LAN_7", "Date");
|
||||
define("UE_LAN_8", "Language");
|
||||
|
||||
define("UE_LAN_9", "Name");
|
||||
define("UE_LAN_10", "Type");
|
||||
define("UE_LAN_11", "Use");
|
||||
define('UE_LAN_9', 'Predefined list');
|
||||
// Leave a gap to allow for more field types
|
||||
define("UE_LAN_21", "Name");
|
||||
define("UE_LAN_22", "Type");
|
||||
define("UE_LAN_23", "Use");
|
||||
|
||||
define("UE_LAN_HIDE", "Hide from users");
|
||||
|
||||
@ -42,6 +44,8 @@ define("UE_LAN_LANGUAGE", "Language");
|
||||
define("UE_LAN_LANGUAGE_DESC", "User Language");
|
||||
define("UE_LAN_COUNTRY", "Country");
|
||||
define("UE_LAN_COUNTRY_DESC", "User Country (includes db table)");
|
||||
define('UE_LAN_TIMEZONE', 'Timezone');
|
||||
define('UE_LAN_TIMEZONE_DESC', 'User Timezone (from predefined list)');
|
||||
|
||||
define("LAN_UE_FAIL_HOMEPAGE", "Invalid entry for home page setting");
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
| e107 website system - Language File.
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_usersettings.php,v $
|
||||
| $Revision: 1.11 $
|
||||
| $Date: 2008-01-06 21:16:30 $
|
||||
| $Revision: 1.12 $
|
||||
| $Date: 2008-01-15 21:57:47 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -23,14 +23,14 @@ define("LAN_106", "That doesn't appear to be a valid email address");
|
||||
define("LAN_112", "Email Address: ");
|
||||
define("LAN_113", "Hide email address?: ");
|
||||
define("LAN_114", "This will prevent your email address from being displayed on site");
|
||||
define("LAN_115", "ICQ Number: ");
|
||||
define("LAN_116", "AIM Address: ");
|
||||
define("LAN_117", "MSN Messenger: ");
|
||||
define("LAN_118", "Birthday: ");
|
||||
//define("LAN_115", "ICQ Number: ");
|
||||
//define("LAN_116", "AIM Address: ");
|
||||
//define("LAN_117", "MSN Messenger: ");
|
||||
//define("LAN_118", "Birthday: ");
|
||||
define("LAN_119", "Location: ");
|
||||
define("LAN_120", "Signature: ");
|
||||
define("LAN_121", "Avatar: ");
|
||||
define("LAN_122", "Timezone:");
|
||||
//define("LAN_122", "Timezone:");
|
||||
define("LAN_144", "Website URL: ");
|
||||
define("LAN_150", "Settings updated and saved into database.");
|
||||
define("LAN_151", "OK");
|
||||
@ -102,7 +102,7 @@ define("LAN_USET_4", "Maximum allowable height is");
|
||||
define("LAN_USET_5", "Subscribed to");
|
||||
define("LAN_USET_6", "Subscribe to our mailing-list(s) and/or sections of this site.");
|
||||
define("LAN_USET_7", "Miscellaneous");
|
||||
define("LAN_USET_8", "Signature / Timezone");
|
||||
define("LAN_USET_8", "User Signature");
|
||||
define("LAN_USET_9", "Some of the required fields (marked with a *) are missing from your settings.");
|
||||
define("LAN_USET_10","Please update your settings now, in order to proceed.");
|
||||
define("LAN_USET_11", "That user name cannot be accepted as valid, please choose a different user name");
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_themes/templates/signup_template.php,v $
|
||||
| $Revision: 1.7 $
|
||||
| $Date: 2008-01-09 22:44:19 $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2008-01-15 21:57:52 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -134,16 +134,6 @@ $sc_style['SIGNUP_IMAGES']['post'] = "
|
||||
</tr>
|
||||
";
|
||||
|
||||
$sc_style['SIGNUP_TIMEZONE']['pre'] = "
|
||||
<tr>
|
||||
<td class='forumheader3' style='width:30%' >".LAN_122.req($pref['signup_option_timezone'])."</td>
|
||||
<td class='forumheader3' style='width:70%;white-space:nowrap'>
|
||||
";
|
||||
$sc_style['SIGNUP_TIMEZONE']['post'] = "
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
|
||||
|
||||
$sc_style['SIGNUP_IMAGECODE']['pre'] = "
|
||||
<tr>
|
||||
@ -307,7 +297,6 @@ $SIGNUP_BODY = "
|
||||
{SIGNUP_EXTENDED_USER_FIELDS}
|
||||
{SIGNUP_SIGNATURE}
|
||||
{SIGNUP_IMAGES}
|
||||
{SIGNUP_TIMEZONE}
|
||||
{SIGNUP_IMAGECODE}
|
||||
<tr style='vertical-align:top'>
|
||||
<td class='forumheader' colspan='2' style='text-align:center'>
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_themes/templates/usersettings_template.php,v $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2007-08-12 21:40:49 $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2008-01-15 21:57:53 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -162,13 +162,6 @@ $USERSETTINGS_EDIT = "
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:40%' class='forumheader3'>".LAN_122.req($pref['signup_option_timezone'])."</td>
|
||||
<td style='width:60%' class='forumheader2'>
|
||||
{TIMEZONE}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan='2' class='forumheader'>".LAN_420."</td>
|
||||
</tr>
|
||||
|
47
signup.php
47
signup.php
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/signup.php,v $
|
||||
| $Revision: 1.14 $
|
||||
| $Date: 2008-01-06 22:16:37 $
|
||||
| $Author: mcfly_e107 $
|
||||
| $Revision: 1.15 $
|
||||
| $Date: 2008-01-15 21:57:16 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@ -187,7 +187,6 @@ if(!$_POST) // Notice Removal.
|
||||
$email = ""; // Used in shortcodes
|
||||
$loginname = "";
|
||||
$realname = "";
|
||||
$user_timezone = "";
|
||||
$image = "";
|
||||
$avatar_upload = "";
|
||||
$photo_upload = "";
|
||||
@ -385,10 +384,10 @@ if (isset($_POST['register']))
|
||||
$_POST['email'] = $xup['EMAIL'];
|
||||
$_POST['signature'] = $xup['SIG'];
|
||||
$_POST['hideemail'] = $xup['EMAILHIDE'];
|
||||
$_POST['timezone'] = $xup['TZ'];
|
||||
$_POST['realname'] = $xup['FN'];
|
||||
$_POST['image'] = $xup['AV'];
|
||||
|
||||
$_POST['ue']['user_timezone'] = $xup['TZ'];
|
||||
$_POST['ue']['user_homepage'] = $xup['URL'];
|
||||
$_POST['ue']['user_icq'] = $xup['ICQ'];
|
||||
$_POST['ue']['user_aim'] = $xup['AIM'];
|
||||
@ -536,8 +535,8 @@ global $db_debug;
|
||||
|
||||
|
||||
// ========== Verify Custom Signup options if selected ========================
|
||||
$signup_option_title = array(LAN_308, LAN_120, LAN_121, LAN_122, LAN_SIGNUP_28);
|
||||
$signup_option_names = array("realname", "signature", "image", "timezone", "class");
|
||||
$signup_option_title = array(LAN_308, LAN_120, LAN_121, LAN_SIGNUP_28);
|
||||
$signup_option_names = array("realname", "signature", "image", "class");
|
||||
|
||||
foreach($signup_option_names as $key => $value)
|
||||
{
|
||||
@ -696,17 +695,37 @@ global $db_debug;
|
||||
|
||||
$u_key = md5(uniqid(rand(), 1));
|
||||
// ************* Possible class insert
|
||||
$nid = $sql->db_Insert("user", "0, '{$username}', '{$loginname}', '', '".md5($_POST['password1'])."', '{$u_key}', '".$tp -> toDB($_POST['email'])."', '".$tp -> toDB($_POST['signature'])."', '".$tp -> toDB($_POST['image'])."', '".$tp -> toDB($_POST['timezone'])."', '".$tp -> toDB($_POST['hideemail'])."', '".$time."', '0', '".$time."', '0', '0', '0', '0', '".$ip."', '2', '0', '', '', '0', '0', '".$tp -> toDB($_POST['realname'])."', '', '', '', '0', '".$tp -> toDB($_POST['xupexist'])."' ");
|
||||
|
||||
// Log to user audit log if enabled
|
||||
$admin_log->user_audit(USER_AUDIT_SIGNUP,array(
|
||||
|
||||
// Following array will be logged to both admin log and user's entry
|
||||
$signup_data = array(
|
||||
'user_id' => $nid,
|
||||
'user_name' => $username,
|
||||
'user_loginname' => $loginname,
|
||||
'user_email' => $tp -> toDB($_POST['email']),
|
||||
'user_realname' => $tp -> toDB($_POST['realname']),
|
||||
'signup_key' => $u_key
|
||||
));
|
||||
'user_ip' => $ip);
|
||||
|
||||
// Following array is logged to user's entry only
|
||||
$new_data = array(
|
||||
'user_password' => md5($_POST['password1']),
|
||||
'user_sess' => $u_key,
|
||||
'user_signature' => $tp -> toDB($_POST['signature']),
|
||||
'user_image' => $tp -> toDB($_POST['image']),
|
||||
'user_hideemail' => $tp -> toDB($_POST['hideemail']),
|
||||
'user_join' => time(),
|
||||
'user_currentvisit' => time(),
|
||||
'user_ban' => 2,
|
||||
'user_login' => $tp -> toDB($_POST['realname']),
|
||||
'user_xup' => $tp -> toDB($_POST['xupexist'])
|
||||
);
|
||||
|
||||
$nid = $sql->db_Insert("user", array_merge($signup_data,$new_data));
|
||||
// $nid = $sql->db_Insert("user", "0, '{$username}', '{$loginname}', '', '".md5($_POST['password1'])."', '{$u_key}', '".$tp -> toDB($_POST['email'])."', '".$tp -> toDB($_POST['signature'])."', '".$tp -> toDB($_POST['image'])."', '".$tp -> toDB($_POST['hideemail'])."', '".$time."', '0', '".$time."', '0', '0', '0', '0', '".$ip."', '2', '0', '', '', '0', '0', '".$tp -> toDB($_POST['realname'])."', '', '', '', '0', '".$tp -> toDB($_POST['xupexist'])."' ");
|
||||
|
||||
// Log to user audit log if enabled
|
||||
$signup_data['signup_key'] = $u_key;
|
||||
$signup_data['user_realname'] = $tp -> toDB($_POST['realname']));
|
||||
|
||||
$admin_log->user_audit(USER_AUDIT_SIGNUP,$signup_data);
|
||||
|
||||
if(!$nid)
|
||||
{
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/usersettings.php,v $
|
||||
| $Revision: 1.20 $
|
||||
| $Date: 2008-01-08 22:24:14 $
|
||||
| $Revision: 1.21 $
|
||||
| $Date: 2008-01-15 21:57:17 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
|
||||
@ -170,11 +170,11 @@ if (isset($_POST['updatesettings']))
|
||||
|
||||
|
||||
// The 'class' option doesn't really make sense to me, but left it for now
|
||||
// $signup_option_title = array(LAN_308, LAN_120, LAN_121, LAN_122);
|
||||
// $signup_option_title = array(LAN_308, LAN_120, LAN_121, LAN_USET_19);
|
||||
// $signup_option_names = array("realname", "signature", "image", "timezone");
|
||||
|
||||
$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');
|
||||
$signup_option_title = array(LAN_308, LAN_120, LAN_121, LAN_USET_6, LAN_USET_19);
|
||||
$signup_option_names = array("realname", "signature", "image", "class", 'signup_option_customtitle');
|
||||
foreach($signup_option_names as $key => $value)
|
||||
{ // Check required signup fields
|
||||
if ($pref['signup_option_'.$value] == 2 && !$_POST[$value] && !$_uid)
|
||||
@ -448,7 +448,6 @@ if (isset($_POST['updatesettings']))
|
||||
$copy_list = array('user_signature' => 'signature',
|
||||
'user_login' => 'realname',
|
||||
'user_email' => 'email',
|
||||
'user_timezone' => 'timezone',
|
||||
'user_hideemail' =>'hideemail',
|
||||
'user_xup' => 'user_xup');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user