- completely reworked and extended the user profiles

- some other  minor fixes and enhancements
parent 8c82544b
......@@ -100,32 +100,10 @@ class ACP3_Auth
static $user_info = array();
if (empty($user_info[$user_id])) {
$countries = ACP3_Lang::worldCountries();
$info = ACP3_CMS::$db2->fetchAssoc('SELECT * FROM ' . DB_PRE . 'users WHERE id = ?', array($user_id), array(\PDO::PARAM_INT));
if (!empty($info)) {
$pos = strrpos($info['realname'], ':');
$info['realname_display'] = substr($info['realname'], $pos + 1);
$info['realname'] = substr($info['realname'], 0, $pos);
$pos = strrpos($info['gender'], ':');
$info['gender_display'] = substr($info['gender'], $pos + 1);
$info['gender'] = substr($info['gender'], 0, $pos);
$pos = strrpos($info['birthday'], ':');
$info['birthday_display'] = substr($info['birthday'], $pos + 1);
$info['birthday'] = substr($info['birthday'], 0, $pos);
$pos = strrpos($info['mail'], ':');
$info['mail_display'] = substr($info['mail'], $pos + 1);
$info['mail'] = substr($info['mail'], 0, $pos);
$pos = strrpos($info['website'], ':');
$info['website_display'] = substr($info['website'], $pos + 1);
$info['website'] = substr($info['website'], 0, $pos);
$pos = strrpos($info['icq'], ':');
$info['icq_display'] = substr($info['icq'], $pos + 1);
$info['icq'] = substr($info['icq'], 0, $pos);
$pos = strrpos($info['msn'], ':');
$info['msn_display'] = substr($info['msn'], $pos + 1);
$info['msn'] = substr($info['msn'], 0, $pos);
$pos = strrpos($info['skype'], ':');
$info['skype_display'] = substr($info['skype'], $pos + 1);
$info['skype'] = substr($info['skype'], 0, $pos);
$info['country_formatted'] = !empty($info['country']) && isset($countries[$info['country']]) ? $countries[$info['country']] : '';
$user_info[$user_id] = $info;
}
}
......
......@@ -123,6 +123,261 @@ class ACP3_Lang
return !preg_match('=/=', $lang) && is_file(ACP3_ROOT . 'languages/' . $lang . '/info.xml') === true;
}
/**
* Gibt ein Array mit allen Nationen auf der Erde zurück
*/
public static function worldCountries()
{
return array(
'AU' => 'Australia',
'AF' => 'Afghanistan',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
'AI' => 'Anguilla',
'AQ' => 'Antarctica',
'AG' => 'Antigua & Barbuda',
'AR' => 'Argentina',
'AM' => 'Armenia',
'AW' => 'Aruba',
'AT' => 'Austria',
'AZ' => 'Azerbaijan',
'BS' => 'Bahamas',
'BH' => 'Bahrain',
'BD' => 'Bangladesh',
'BB' => 'Barbados',
'BY' => 'Belarus',
'BE' => 'Belgium',
'BZ' => 'Belize',
'BJ' => 'Benin',
'BM' => 'Bermuda',
'BT' => 'Bhutan',
'BO' => 'Bolivia',
'BA' => 'Bosnia/Hercegovina',
'BW' => 'Botswana',
'BV' => 'Bouvet Island',
'BR' => 'Brazil',
'IO' => 'British Indian Ocean Territory',
'BN' => 'Brunei Darussalam',
'BG' => 'Bulgaria',
'BF' => 'Burkina Faso',
'BI' => 'Burundi',
'KH' => 'Cambodia',
'CM' => 'Cameroon',
'CA' => 'Canada',
'CV' => 'Cape Verde',
'KY' => 'Cayman Is',
'CF' => 'Central African Republic',
'TD' => 'Chad',
'CL' => 'Chile',
'CN' => 'China, People\'s Republic of',
'CX' => 'Christmas Island',
'CC' => 'Cocos Islands',
'CO' => 'Colombia',
'KM' => 'Comoros',
'CG' => 'Congo',
'CD' => 'Congo, Democratic Republic',
'CK' => 'Cook Islands',
'CR' => 'Costa Rica',
'CI' => 'Cote d\'Ivoire',
'HR' => 'Croatia',
'CU' => 'Cuba',
'CY' => 'Cyprus',
'CZ' => 'Czech Republic',
'DK' => 'Denmark',
'DJ' => 'Djibouti',
'DM' => 'Dominica',
'DO' => 'Dominican Republic',
'TP' => 'East Timor',
'EC' => 'Ecuador',
'EG' => 'Egypt',
'SV' => 'El Salvador',
'GQ' => 'Equatorial Guinea',
'ER' => 'Eritrea',
'EE' => 'Estonia',
'ET' => 'Ethiopia',
'FK' => 'Falkland Islands',
'FO' => 'Faroe Islands',
'FJ' => 'Fiji',
'FI' => 'Finland',
'FR' => 'France',
'FX' => 'France, Metropolitan',
'GF' => 'French Guiana',
'PF' => 'French Polynesia',
'TF' => 'French South Territories',
'GA' => 'Gabon',
'GM' => 'Gambia',
'GE' => 'Georgia',
'DE' => 'Germany',
'GH' => 'Ghana',
'GI' => 'Gibraltar',
'GR' => 'Greece',
'GL' => 'Greenland',
'GD' => 'Grenada',
'GP' => 'Guadeloupe',
'GU' => 'Guam',
'GT' => 'Guatemala',
'GN' => 'Guinea',
'GW' => 'Guinea-Bissau',
'GY' => 'Guyana',
'HT' => 'Haiti',
'HM' => 'Heard Island And Mcdonald Island',
'HN' => 'Honduras',
'HK' => 'Hong Kong',
'HU' => 'Hungary',
'IS' => 'Iceland',
'IN' => 'India',
'ID' => 'Indonesia',
'IR' => 'Iran',
'IQ' => 'Iraq',
'IE' => 'Ireland',
'IL' => 'Israel',
'IT' => 'Italy',
'JM' => 'Jamaica',
'JP' => 'Japan',
'JT' => 'Johnston Island',
'JO' => 'Jordan',
'KZ' => 'Kazakhstan',
'KE' => 'Kenya',
'KI' => 'Kiribati',
'KP' => 'Korea, Democratic Peoples Republic',
'KR' => 'Korea, Republic of',
'KW' => 'Kuwait',
'KG' => 'Kyrgyzstan',
'LA' => 'Lao People\'s Democratic Republic',
'LV' => 'Latvia',
'LB' => 'Lebanon',
'LS' => 'Lesotho',
'LR' => 'Liberia',
'LY' => 'Libyan Arab Jamahiriya',
'LI' => 'Liechtenstein',
'LT' => 'Lithuania',
'LU' => 'Luxembourg',
'MO' => 'Macau',
'MK' => 'Macedonia',
'MG' => 'Madagascar',
'MW' => 'Malawi',
'MY' => 'Malaysia',
'MV' => 'Maldives',
'ML' => 'Mali',
'MT' => 'Malta',
'MH' => 'Marshall Islands',
'MQ' => 'Martinique',
'MR' => 'Mauritania',
'MU' => 'Mauritius',
'YT' => 'Mayotte',
'MX' => 'Mexico',
'FM' => 'Micronesia',
'MD' => 'Moldavia',
'MC' => 'Monaco',
'MN' => 'Mongolia',
'MS' => 'Montserrat',
'MA' => 'Morocco',
'MZ' => 'Mozambique',
'MM' => 'Union Of Myanmar',
'NA' => 'Namibia',
'NR' => 'Nauru Island',
'NP' => 'Nepal',
'NL' => 'Netherlands',
'AN' => 'Netherlands Antilles',
'NC' => 'New Caledonia',
'NZ' => 'New Zealand',
'NI' => 'Nicaragua',
'NE' => 'Niger',
'NG' => 'Nigeria',
'NU' => 'Niue',
'NF' => 'Norfolk Island',
'MP' => 'Mariana Islands, Northern',
'NO' => 'Norway',
'OM' => 'Oman',
'PK' => 'Pakistan',
'PW' => 'Palau Islands',
'PS' => 'Palestine',
'PA' => 'Panama',
'PG' => 'Papua New Guinea',
'PY' => 'Paraguay',
'PE' => 'Peru',
'PH' => 'Philippines',
'PN' => 'Pitcairn',
'PL' => 'Poland',
'PT' => 'Portugal',
'PR' => 'Puerto Rico',
'QA' => 'Qatar',
'RE' => 'Reunion Island',
'RO' => 'Romania',
'RU' => 'Russian Federation',
'RW' => 'Rwanda',
'WS' => 'Samoa',
'SH' => 'St Helena',
'KN' => 'St Kitts & Nevis',
'LC' => 'St Lucia',
'PM' => 'St Pierre & Miquelon',
'VC' => 'St Vincent',
'SM' => 'San Marino',
'ST' => 'Sao Tome & Principe',
'SA' => 'Saudi Arabia',
'SN' => 'Senegal',
'SC' => 'Seychelles',
'SL' => 'Sierra Leone',
'SG' => 'Singapore',
'SK' => 'Slovakia',
'SI' => 'Slovenia',
'SB' => 'Solomon Islands',
'SO' => 'Somalia',
'ZA' => 'South Africa',
'GS' => 'South Georgia and South Sandwich',
'ES' => 'Spain',
'LK' => 'Sri Lanka',
'XX' => 'Stateless Persons',
'SD' => 'Sudan',
'SR' => 'Suriname',
'SJ' => 'Svalbard and Jan Mayen',
'SZ' => 'Swaziland',
'SE' => 'Sweden',
'CH' => 'Switzerland',
'SY' => 'Syrian Arab Republic',
'TW' => 'Taiwan, Republic of China',
'TJ' => 'Tajikistan',
'TZ' => 'Tanzania',
'TH' => 'Thailand',
'TL' => 'Timor Leste',
'TG' => 'Togo',
'TK' => 'Tokelau',
'TO' => 'Tonga',
'TT' => 'Trinidad & Tobago',
'TN' => 'Tunisia',
'TR' => 'Turkey',
'TM' => 'Turkmenistan',
'TC' => 'Turks And Caicos Islands',
'TV' => 'Tuvalu',
'UG' => 'Uganda',
'UA' => 'Ukraine',
'AE' => 'United Arab Emirates',
'GB' => 'United Kingdom',
'UM' => 'US Minor Outlying Islands',
'US' => 'USA',
'HV' => 'Upper Volta',
'UY' => 'Uruguay',
'UZ' => 'Uzbekistan',
'VU' => 'Vanuatu',
'VA' => 'Vatican City State',
'VE' => 'Venezuela',
'VN' => 'Vietnam',
'VG' => 'Virgin Islands (British)',
'VI' => 'Virgin Islands (US)',
'WF' => 'Wallis And Futuna Islands',
'EH' => 'Western Sahara',
'YE' => 'Yemen Arab Rep.',
'YD' => 'Yemen Democratic',
'YU' => 'Yugoslavia',
'ZR' => 'Zaire',
'ZM' => 'Zambia',
'ZW' => 'Zimbabwe'
);
}
/**
* Parst den ACCEPT-LANGUAGE Header des Browsers
* und selektiert die präferierte Sprache
......
......@@ -73,7 +73,7 @@ class ACP3_Validate
$regex = '/^(\d{4})-(\d{2})-(\d{2})$/';
$matches = array();
if (preg_match($regex, $var, $matches)) {
if (checkdate($matches[2], $matches[3], $matches[1]) && ($format == 1 || $format == 2)) {
if (checkdate($matches[2], $matches[3], $matches[1]) && in_array($format, array(0, 1, 2))) {
return true;
}
}
......
......@@ -272,7 +272,7 @@ function splitTextIntoPages($text, $path)
$currentPage = ACP3_Validate::isNumber(ACP3_CMS::$uri->page) === true && ACP3_CMS::$uri->page <= $c_pages ? ACP3_CMS::$uri->page : 1;
$next_page = !empty($pages[$currentPage]) ? ACP3_CMS::$uri->route($path) . 'page_' . ($currentPage + 1) . '/' : '';
$previous_page = $currentPage > 1 ? ACP3_CMS::$uri->route($path) . 'page_' . ($currentPage - 1) . '/' : '';
$previous_page = $currentPage > 1 ? ACP3_CMS::$uri->route($path) . ($currentPage - 1 > 1 ? 'page_' . ($currentPage - 1) . '/' : '') : '';
if (!empty($next_page))
ACP3_SEO::setNextPage($next_page);
......
......@@ -20,7 +20,7 @@
<item key="db_connection_failed"><![CDATA[Aus folgenden Gründen konnte keine Verbindung zur Datenbank hergestellt werden:<br /><pre>%s</pre>]]></item>
<item key="db_connection_settings">Verbindungsdaten zur Datenbank</item>
<item key="db_hostname">Hostname</item>
<item key="db_hostname_description">Mmeistens &quot;localhost&quot;.</item>
<item key="db_hostname_description">Meistens &quot;localhost&quot;.</item>
<item key="db_name">Datenbankname</item>
<item key="db_password">Passwort</item>
<item key="db_table_prefix">Tabellenpräfix</item>
......
......@@ -101,7 +101,7 @@ if (isset($_POST['submit'])) {
$news_mod_id = ACP3_CMS::$db2->fetchColumn('SELECT id FROM ' . DB_PRE . 'modules WHERE name = ?', array('news'));
$queries = array(
'INSERT INTO `{pre}users` VALUES (\'\', 1, ' . ACP3_CMS::$db2->quote($_POST['user_name']) . ', \'' . generateSaltedPassword($salt, $_POST['user_pwd']) . ':' . $salt . '\', \'0\', \':1\', \'1:1\', \':1\', \'1\', \'' . $_POST['mail'] . ':1\', \':1\', \':1\', \':1\', \':1\', ' . ACP3_CMS::$db2->quote($_POST['date_format_long']) . ', ' . ACP3_CMS::$db2->quote($_POST['date_format_short']) . ', \'' . $_POST['date_time_zone'] . '\', \'' . LANG . '\', \'20\', \'\');',
"INSERT INTO `{pre}users` VALUES ('', 1, " . ACP3_CMS::$db2->quote($_POST["user_name"]) . ", '" . generateSaltedPassword($salt, $_POST["user_pwd"]) . ":" . $salt . "', 0, '', '1', '', 0, '" . $_POST["mail"] . "', 0, '', '', '', '', '', '', '', '', 0, 0, " . ACP3_CMS::$db2->quote($_POST["date_format_long"]) . ", " . ACP3_CMS::$db2->quote($_POST["date_format_short"]) . ", '" . $_POST["date_time_zone"] . "', '" . LANG . "', '20', '');",
'INSERT INTO `{pre}categories` VALUES (\'\', \'' . $lang->t('category_name') . '\', \'\', \'' . $lang->t('category_description') . '\', \'' . $news_mod_id . '\');',
'INSERT INTO `{pre}news` VALUES (\'\', \'' . $current_date . '\', \'' . $current_date . '\', \'' . $lang->t('news_headline') . '\', \'' . $lang->t('news_text') . '\', \'1\', \'1\', \'1\', \'\', \'\', \'\', \'\');',
'INSERT INTO `{pre}menu_items` VALUES (\'\', 1, 1, 1, 0, 1, 4, 1, \'' . $lang->t('pages_news') . '\', \'news\', 1);',
......
......@@ -5,21 +5,29 @@
<item key="acp_delete">Benutzer löschen</item>
<item key="acp_edit">Benutzer bearbeiten</item>
<item key="acp_settings">Einstellungen</item>
<item key="drafts">Entwürfe</item>
<item key="address">Adresse</item>
<item key="address_street">Straße</item>
<item key="address_house_number">Hausnummer</item>
<item key="address_zip">Postleitzahl</item>
<item key="address_city">Stadt</item>
<item key="administration">Verwaltung</item>
<item key="admin_user_undeletable">Der Administrator kann nicht gelöscht werden.</item>
<item key="allow_language_override">Benutzern erlauben, Sprache selber festzulegen</item>
<item key="allow_entries_override">Benutzern erlauben, angezeigte Datensätze pro Seite selber festzulegen</item>
<item key="birthday">Geburtstag</item>
<item key="birthday_hide">Geburtstag verstecken</item>
<item key="birthday_display_completely">Geburtstag vollständig anzeigen</item>
<item key="birthday_hide_year">Geburtsjahr verstecken</item>
<item key="contact">Kontakt</item>
<item key="country">Land</item>
<item key="deleted_user">Gelöschter Benutzer</item>
<item key="display_profile_field">Ein Profilfeld kann versteckt werden, indem der Haken links neben dem jeweiligen Feld entfernt wird.</item>
<item key="display_address">Adresse im öffentlichen Profil anzeigen</item>
<item key="display_country">Land im öffentlichen Profil anzeigen</item>
<item key="display_profile_field_info">Ein Profilfeld kann versteckt werden, indem der Haken links neben dem jeweiligen Feld entfernt wird.</item>
<item key="drafts">Entwürfe</item>
<item key="edit_profile">Profil bearbeiten</item>
<item key="edit_settings">Einstellungen bearbeiten</item>
<item key="enable_registration">Registrierung neuer Benutzer erlauben</item>
<item key="female">Weiblich</item>
<item key="forgot_pwd">Passwort vergessen?</item>
<item key="forgot_pwd_error">Beim Versenden der E-Mail-Adresse mit Ihrem neuen Passwort ist ein Fehler aufgetreten.</item>
<item key="forgot_pwd_description">Bitte geben Sie ihren Benutzernamen bzw. die E-Mail-Adresse Ihres Benutzerkontos ein.</item>
......@@ -36,6 +44,9 @@ Passwort: {password}
Bitte ändern Sie, nachdem Sie sich mit obrigem Passwort angemeldet haben, das Passwort zu einem Ihrer Wahl ab.</item>
<item key="forgot_pwd_success">Das neue Passwort wurde erfolgreich an Ihre E-Mail-Adresse versendet.</item>
<item key="gender">Geschlecht</item>
<item key="gender_female">Frau</item>
<item key="gender_male">Mann</item>
<item key="gender_not_specified">Keine Angabe</item>
<item key="home">Kontrollzentrum</item>
<item key="icq">ICQ-Nummer</item>
<item key="invalid_birthday">Bitte geben Sie ein gültiges Geburtsdatum an und wie dieses dargestellt werden soll.</item>
......@@ -45,9 +56,7 @@ Bitte ändern Sie, nachdem Sie sich mit obrigem Passwort angemeldet haben, das P
<item key="log_in">Einloggen</item>
<item key="login">Login</item>
<item key="logout">Abmelden</item>
<item key="male">Männlich</item>
<item key="mod_description">Mit diesem Modul können die Benutzer verwaltet werden.</item>
<item key="msn">MSN</item>
<item key="new_pwd">Neues Passwort</item>
<item key="new_pwd_repeat">Neues Passwort wiederholen</item>
<item key="nickname_or_email">Benutzername oder E-Mail-Adresse</item>
......
......@@ -5,21 +5,29 @@
<item key="acp_delete">Delete users</item>
<item key="acp_edit">Edit user</item>
<item key="acp_settings">Settings</item>
<item key="address">Address</item>
<item key="address_street">Street</item>
<item key="address_house_number">House number</item>
<item key="address_zip">Zip code</item>
<item key="address_city">City</item>
<item key="administration">Administration</item>
<item key="admin_user_undeletable">The administrator can't be deleted.</item>
<item key="allow_language_override">Allow users to override the default language</item>
<item key="allow_entries_override">Allow users to override the number of displayed resultsets per page</item>
<item key="birthday">Birthday</item>
<item key="birthday_hide">Hide birthday</item>
<item key="birthday_display_completely">Display birthday completely</item>
<item key="birthday_hide_year">Hide year of birth</item>
<item key="contact">Contact</item>
<item key="country">Country</item>
<item key="deleted_user">Deleted user</item>
<item key="display_profile_field">If you don't want to display a certain profile field, just untick the respective field.</item>
<item key="display_address">Display address in public profile</item>
<item key="display_country">Display country in public profile</item>
<item key="display_profile_field_info">If you don't want to display a certain profile field, just untick the respective field.</item>
<item key="drafts">Drafts</item>
<item key="edit_profile">Edit profile</item>
<item key="edit_settings">Edit settings</item>
<item key="enable_registration">Enable registration of new users</item>
<item key="female">Female</item>
<item key="forgot_pwd">Forgot password?</item>
<item key="forgot_pwd_error">While sending the E-mail with your new password an error has occured.</item>
<item key="forgot_pwd_description">Please enter your user name or E-mail address of your user account.</item>
......@@ -34,8 +42,11 @@ E-mail address: {mail}
Password: {password}
Please change the password again, after you logged in to your account.</item>
<item key="forgot_pwd_success">An E-mail with your new password has been successfully sent.</item>
<item key="forgot_pwd_success">An E-mail with your new password has been successfully sent to your E-mail address.</item>
<item key="gender">Gender</item>
<item key="gender_female">Female</item>
<item key="gender_male">Male</item>
<item key="gender_not_specified">Not specified</item>
<item key="home">Control center</item>
<item key="icq">ICQ-Number</item>
<item key="invalid_birthday">Please type in a valid birthday and how it should look like.</item>
......@@ -45,9 +56,7 @@ Please change the password again, after you logged in to your account.</item>
<item key="log_in">Log in</item>
<item key="login">Login</item>
<item key="logout">Logout</item>
<item key="male">Male</item>
<item key="mod_description">With this module you can administer the users.</item>
<item key="msn">MSN</item>
<item key="new_pwd">New password</item>
<item key="new_pwd_repeat">Repeat new password</item>
<item key="nickname_or_email">User name or E-mail address</item>
......
......@@ -2,7 +2,7 @@
<li class="nav-header">{lang t="newsletter|subscribe_newsletter"}</li>
<li>
<form action="{uri args="newsletter"}" method="post" accept-charset="UTF-8">
<input type="email" name="mail" id="mail" maxlength="120" placeholder="{lang t="system|email_address"}" required style="width:auto">
<input type="email" name="mail" maxlength="120" placeholder="{lang t="system|email_address"}" required style="width:auto">
{if isset($captcha)}
{$captcha}
{/if}
......
......@@ -15,6 +15,10 @@ if (isset($_POST['submit']) === true) {
if (empty($_POST['nickname']))
$errors['nickname'] = ACP3_CMS::$lang->t('system', 'name_to_short');
if (ACP3_Validate::gender($_POST['gender']) === false)
$errors['gender'] = ACP3_CMS::$lang->t('users', 'select_gender');
if (!isset($_POST['birthday_display']) || !empty($_POST['birthday']) && ACP3_Validate::birthday($_POST['birthday'], $_POST['birthday_display']) === false)
$errors[] = ACP3_CMS::$lang->t('users', 'invalid_birthday');
if (userNameExists($_POST['nickname']) === true)
$errors['nickname'] = ACP3_CMS::$lang->t('users', 'user_name_already_exists');
if (ACP3_Validate::email($_POST['mail']) === false)
......@@ -33,6 +37,8 @@ if (isset($_POST['submit']) === true) {
$errors[] = ACP3_CMS::$lang->t('system', 'type_in_date_format');
if (ACP3_Validate::timeZone($_POST['date_time_zone']) === false)
$errors['time-zone'] = ACP3_CMS::$lang->t('system', 'select_time_zone');
if (!empty($_POST['icq']) && ACP3_Validate::icq($_POST['icq']) === false)
$errors['icq'] = ACP3_CMS::$lang->t('users', 'invalid_icq_number');
if (empty($_POST['pwd']) || empty($_POST['pwd_repeat']) || $_POST['pwd'] != $_POST['pwd_repeat'])
$errors[] = ACP3_CMS::$lang->t('users', 'type_in_pwd');
......@@ -48,15 +54,22 @@ if (isset($_POST['submit']) === true) {
'super_user' => (int) $_POST['super_user'],
'nickname' => str_encode($_POST['nickname']),
'pwd' => generateSaltedPassword($salt, $_POST['pwd']) . ':' . $salt,
'realname' => str_encode($_POST['realname']) . ':1',
'gender' => ':1',
'birthday' => ':1',
'birthday_format' => '1',
'mail' => $_POST['mail'] . ':1',
'website' => str_encode($_POST['website']) . ':1',
'icq' => ':1',
'msn' => ':1',
'skype' => ':1',
'realname' => str_encode($_POST['realname']),
'gender' => (int) $_POST['gender'],
'birthday' => $_POST['birthday'],
'birthday_display' => (int) $_POST['birthday_display'],
'mail' => $_POST['mail'],
'mail_display' => isset($_POST['mail_display']) ? 1 : 0,
'website' => str_encode($_POST['website']),
'icq' => $_POST['icq'],
'skype' => str_encode($_POST['skype']),
'street' => str_encode($_POST['street']),
'house_number' => str_encode($_POST['house_number']),
'zip' => str_encode($_POST['zip']),
'city' => str_encode($_POST['city']),
'address_display' => isset($_POST['address_display']) ? 1 : 0,
'country' => str_encode($_POST['country']),
'country_display' => isset($_POST['country_display']) ? 1 : 0,
'date_format_long' => str_encode($_POST['date_format_long']),
'date_format_short' => str_encode($_POST['date_format_short']),
'time_zone' => $_POST['date_time_zone'],
......@@ -125,11 +138,85 @@ if (isset($_POST['submit']) === false || isset($errors) === true && is_array($er
// Zeitzonen
ACP3_CMS::$view->assign('time_zones', ACP3_CMS::$date->getTimeZones(CONFIG_DATE_TIME_ZONE));
// Geschlecht
$gender = array();
$gender[0]['value'] = '1';
$gender[0]['selected'] = selectEntry('gender', 1);
$gender[0]['lang'] = ACP3_CMS::$lang->t('users', 'gender_not_specified');
$gender[1]['value'] = '2';
$gender[1]['selected'] = selectEntry('gender', 2);
$gender[1]['lang'] = ACP3_CMS::$lang->t('users', 'gender_female');
$gender[2]['value'] = '3';
$gender[2]['selected'] = selectEntry('gender', 3);
$gender[2]['lang'] = ACP3_CMS::$lang->t('users', 'gender_male');
ACP3_CMS::$view->assign('gender', $gender);
// Geburtstag
ACP3_CMS::$view->assign('birthday_datepicker', ACP3_CMS::$date->datepicker('birthday', '', 'Y-m-d', array('constrainInput' => 'true', 'changeMonth' => 'true', 'changeYear' => 'true', 'yearRange' => '\'-50:+0\''), 0, 1, false, true));
$birthday_display = array();
$birthday_display[0]['name'] = 'hide';
$birthday_display[0]['value'] = '0';
$birthday_display[0]['checked'] = selectEntry('birthday_display', '0', '', 'checked');
$birthday_display[0]['lang'] = ACP3_CMS::$lang->t('users', 'birthday_hide');
$birthday_display[1]['name'] = 'full';
$birthday_display[1]['value'] = '1';
$birthday_display[1]['checked'] = selectEntry('birthday_display', '1', '', 'checked');
$birthday_display[1]['lang'] = ACP3_CMS::$lang->t('users', 'birthday_display_completely');
$birthday_display[2]['name'] = 'hide_year';
$birthday_display[2]['value'] = '2';
$birthday_display[2]['checked'] = selectEntry('birthday_display', '2', '', 'checked');
$birthday_display[2]['lang'] = ACP3_CMS::$lang->t('users', 'birthday_hide_year');
ACP3_CMS::$view->assign('birthday_display', $birthday_display);
// Kontaktangaben
$contact = array();
$contact[0]['name'] = 'mail';
$contact[0]['lang'] = ACP3_CMS::$lang->t('system', 'email_address');
$contact[0]['value'] = isset($_POST['submit']) ? $_POST['mail'] : '';
$contact[0]['maxlength'] = '120';
$contact[1]['name'] = 'website';
$contact[1]['lang'] = ACP3_CMS::$lang->t('system', 'website');
$contact[1]['value'] = isset($_POST['submit']) ? $_POST['website'] : '';
$contact[1]['maxlength'] = '120';
$contact[2]['name'] = 'icq';
$contact[2]['lang'] = ACP3_CMS::$lang->t('users', 'icq');
$contact[2]['value'] = isset($_POST['submit']) ? $_POST['icq'] : '';
$contact[2]['maxlength'] = '9';
$contact[3]['name'] = 'skype';
$contact[3]['lang'] = ACP3_CMS::$lang->t('users', 'skype');
$contact[3]['value'] = isset($_POST['submit']) ? $_POST['skype'] : '';
$contact[3]['maxlength'] = '28';
ACP3_CMS::$view->assign('contact', $contact);
$address = array();
$address[0]['name'] = 'address_display';
$address[0]['checked'] = selectEntry('address_display', '1', '', 'checked');
$address[0]['lang'] = ACP3_CMS::$lang->t('users', 'display_address');
$address[1]['name'] = 'country_display';
$address[1]['checked'] = selectEntry('country_display', '1', '', 'checked');
$address[1]['lang'] = ACP3_CMS::$lang->t('users', 'display_country');
ACP3_CMS::$view->assign('address_checkboxes', $address);
$countries = ACP3_LANG::worldCountries();
$countries_select = array();
foreach ($countries as $key => $value) {
$countries_select[] = array(
'value' => $key,
'lang' => $value,
'selected' => selectEntry('countries', $key),
);
}
ACP3_CMS::$view->assign('countries', $countries_select);
$defaults = array(
'nickname' => '',
'realname' => '',
'mail' => '',
'website' => '',
'street' => '',
'house_number' => '',
'zip' => '',
'city' => '',
'date_format_long' => CONFIG_DATE_FORMAT_LONG,
'date_format_short' => CONFIG_DATE_FORMAT_SHORT
);
......
......@@ -19,6 +19,10 @@ if (ACP3_Validate::isNumber(ACP3_CMS::$uri->id) === true &&
if (empty($_POST['nickname']))
$errors['nickname'] = ACP3_CMS::$lang->t('system', 'name_to_short');
if (ACP3_Validate::gender($_POST['gender']) === false)
$errors['gender'] = ACP3_CMS::$lang->t('users', 'select_gender');
if (!isset($_POST['birthday_display']) || !empty($_POST['birthday']) && ACP3_Validate::birthday($_POST['birthday'], $_POST['birthday_display']) === false)
$errors[] = ACP3_CMS::$lang->t('users', 'invalid_birthday');
if (userNameExists($_POST['nickname'], ACP3_CMS::$uri->id))
$errors['nickname'] = ACP3_CMS::$lang->t('users', 'user_name_already_exists');
if (ACP3_Validate::email($_POST['mail']) === false)
......@@ -37,6 +41,8 @@ if (ACP3_Validate::isNumber(ACP3_CMS::$uri->id) === true &&
$errors[] = ACP3_CMS::$lang->t('system', 'type_in_date_format');
if (ACP3_Validate::timeZone($_POST['date_time_zone']) === false)
$errors['time-zone'] = ACP3_CMS::$lang->t('system', 'select_time_zone');
if (!empty($_POST['icq']) && ACP3_Validate::icq($_POST['icq']) === false)
$errors['icq'] = ACP3_CMS::$lang->t('users', 'invalid_icq_number');
if (!empty($_POST['new_pwd']) && !empty($_POST['new_pwd_repeat']) && $_POST['new_pwd'] != $_POST['new_pwd_repeat'])
$errors[] = ACP3_CMS::$lang->t('users', 'type_in_pwd');
......@@ -48,9 +54,22 @@ if (ACP3_Validate::isNumber(ACP3_CMS::$uri->id) === true &&
$update_values = array(
'super_user' => (int) $_POST['super_user'],
'nickname' => str_encode($_POST['nickname']),
'realname' => str_encode($_POST['realname']) . ':' . $user['realname_display'],
'mail' => $_POST['mail'] . ':' . $user['mail_display'],
'website' => str_encode($_POST['website']) . ':' . $user['website_display'],
'realname' => str_encode($_POST['realname']),
'gender' => (int) $_POST['gender'],
'birthday' => $_POST['birthday'],
'birthday_display' => (int) $_POST['birthday_display'],
'mail' => $_POST['mail'],
'mail_display' => isset($_POST['mail_display']) ? 1 : 0,
'website' => str_encode($_POST['website']),
'icq' => $_POST['icq'],
'skype' => str_encode($_POST['skype']),
'street' => str_encode($_POST['street']),
'house_number' => str_encode($_POST['house_number']),
'zip' => str_encode($_POST['zip']),
'city' => str_encode($_POST['city']),
'address_display' => isset($_POST['address_display']) ? 1 : 0,
'country' => str_encode($_POST['country']),
'country_display' => isset($_POST['country_display']) ? 1 : 0,
'date_format_long' => str_encode($_POST['date_format_long']),
'date_format_short' => str_encode($_POST['date_format_short']),
'time_zone' => $_POST['date_time_zone'],
......@@ -133,6 +152,77 @@ if (ACP3_Validate::isNumber(ACP3_CMS::$uri->id) === true &&
// Zeitzonen
ACP3_CMS::$view->assign('time_zones', ACP3_CMS::$date->getTimeZones($user['time_zone']));
// Geschlecht
$gender = array();
$gender[0]['value'] = '1';
$gender[0]['selected'] = selectEntry('gender', 1, $user['gender']);
$gender[0]['lang'] = ACP3_CMS::$lang->t('users', 'gender_not_specified');
$gender[1]['value'] = '2';
$gender[1]['selected'] = selectEntry('gender', 2, $user['gender']);
$gender[1]['lang'] = ACP3_CMS::$lang->t('users', 'gender_female');
$gender[2]['value'] = '3';
$gender[2]['selected'] = selectEntry('gender', 3, $user['gender']);
$gender[2]['lang'] = ACP3_CMS::$lang->t('users', 'gender_male');
ACP3_CMS::$view->assign('gender', $gender);
// Geburtstag
ACP3_CMS::$view->assign('birthday_datepicker', ACP3_CMS::$date->datepicker('birthday', $user['birthday'], 'Y-m-d', array('constrainInput' => 'true', 'changeMonth' => 'true', 'changeYear' => 'true', 'yearRange' => '\'-50:+0\''), 0, 1, false, true));
$birthday_display = array();
$birthday_display[0]['name'] = 'hide';
$birthday_display[0]['value'] = '0';
$birthday_display[0]['checked'] = selectEntry('birthday_display', '0', $user['birthday_display'], 'checked');
$birthday_display[0]['lang'] = ACP3_CMS::$lang->t('users', 'birthday_hide');
$birthday_display[1]['name'] = 'full';
$birthday_display[1]['value'] = '1';
$birthday_display[1]['checked'] = selectEntry('birthday_display', '1', $user['birthday_display'], 'checked');
$birthday_display[1]['lang'] = ACP3_CMS::$lang->t('users', 'birthday_display_completely');
$birthday_display[2]['name'] = 'hide_year';
$birthday_display[2]['value'] = '2';
$birthday_display[2]['checked'] = selectEntry('birthday_display', '2', $user['birthday_display'], 'checked');
$birthday_display[2]['lang'] = ACP3_CMS::$lang->t('users', 'birthday_hide_year');
ACP3_CMS::$view->assign('birthday_display', $birthday_display);
// Kontaktangaben
$contact = array();
$contact[0]['name'] = 'mail';
$contact[0]['lang'] = ACP3_CMS::$lang->t('system', 'email_address');
$contact[0]['value'] = isset($_POST['submit']) ? $_POST['mail'] : $user['mail'];
$contact[0]['maxlength'] = '120';
$contact[1]['name'] = 'website';
$contact[