|
@@ -1,13 +1,13 @@
|
|
<?php
|
|
<?php
|
|
/* For licensing terms, see /license.txt */
|
|
/* For licensing terms, see /license.txt */
|
|
/**
|
|
/**
|
|
-* This file displays the user's profile,
|
|
|
|
-* optionally it allows users to modify their profile as well.
|
|
|
|
-*
|
|
|
|
-* See inc/conf/profile.conf.php to modify settings
|
|
|
|
-*
|
|
|
|
-* @package chamilo.auth
|
|
|
|
-*/
|
|
|
|
|
|
+ * This file displays the user's profile,
|
|
|
|
+ * optionally it allows users to modify their profile as well.
|
|
|
|
+ *
|
|
|
|
+ * See inc/conf/profile.conf.php to modify settings
|
|
|
|
+ *
|
|
|
|
+ * @package chamilo.auth
|
|
|
|
+ */
|
|
/**
|
|
/**
|
|
* Code
|
|
* Code
|
|
*/
|
|
*/
|
|
@@ -17,6 +17,10 @@ $language_file = array('registration', 'messages', 'userInfo');
|
|
$cidReset = true;
|
|
$cidReset = true;
|
|
require_once '../inc/global.inc.php';
|
|
require_once '../inc/global.inc.php';
|
|
|
|
|
|
|
|
+if (api_is_profile_readable() == false) {
|
|
|
|
+ api_not_allowed(true);
|
|
|
|
+}
|
|
|
|
+
|
|
if (api_get_setting('allow_social_tool') == 'true') {
|
|
if (api_get_setting('allow_social_tool') == 'true') {
|
|
$this_section = SECTION_SOCIAL;
|
|
$this_section = SECTION_SOCIAL;
|
|
} else {
|
|
} else {
|
|
@@ -42,23 +46,23 @@ function confirmation(name) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function show_image(image,width,height) {
|
|
function show_image(image,width,height) {
|
|
- width = parseInt(width) + 20;
|
|
|
|
- height = parseInt(height) + 20;
|
|
|
|
- window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\');
|
|
|
|
|
|
+ width = parseInt(width) + 20;
|
|
|
|
+ height = parseInt(height) + 20;
|
|
|
|
+ window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\');
|
|
|
|
|
|
}
|
|
}
|
|
function generate_open_id_form() {
|
|
function generate_open_id_form() {
|
|
- $.ajax({
|
|
|
|
- contentType: "application/x-www-form-urlencoded",
|
|
|
|
- beforeSend: function(objeto) {
|
|
|
|
- /*$("#div_api_key").html("Loading...");*/ },
|
|
|
|
- type: "POST",
|
|
|
|
- url: "'.api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=generate_api_key",
|
|
|
|
- data: "num_key_id="+"",
|
|
|
|
- success: function(datos) {
|
|
|
|
- $("#div_api_key").html(datos);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ $.ajax({
|
|
|
|
+ contentType: "application/x-www-form-urlencoded",
|
|
|
|
+ beforeSend: function(objeto) {
|
|
|
|
+ /*$("#div_api_key").html("Loading...");*/ },
|
|
|
|
+ type: "POST",
|
|
|
|
+ url: "'.api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=generate_api_key",
|
|
|
|
+ data: "num_key_id="+"",
|
|
|
|
+ success: function(datos) {
|
|
|
|
+ $("#div_api_key").html(datos);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
function hide_icon_edit(element_html) {
|
|
function hide_icon_edit(element_html) {
|
|
@@ -71,7 +75,6 @@ function show_icon_edit(element_html) {
|
|
}
|
|
}
|
|
</script>';
|
|
</script>';
|
|
|
|
|
|
-//$interbreadcrumb[] = array('url' => '../auth/profile.php', 'name' => get_lang('ModifyProfile'));
|
|
|
|
if (!empty ($_GET['coursePath'])) {
|
|
if (!empty ($_GET['coursePath'])) {
|
|
$course_url = api_get_path(WEB_COURSE_PATH).htmlentities(strip_tags($_GET['coursePath'])).'/index.php';
|
|
$course_url = api_get_path(WEB_COURSE_PATH).htmlentities(strip_tags($_GET['coursePath'])).'/index.php';
|
|
$interbreadcrumb[] = array('url' => $course_url, 'name' => Security::remove_XSS($_GET['courseCode']));
|
|
$interbreadcrumb[] = array('url' => $course_url, 'name' => Security::remove_XSS($_GET['courseCode']));
|
|
@@ -86,20 +89,18 @@ if (!empty($_GET['fe'])) {
|
|
$jquery_ready_content = '';
|
|
$jquery_ready_content = '';
|
|
if (api_get_setting('allow_message_tool') == 'true') {
|
|
if (api_get_setting('allow_message_tool') == 'true') {
|
|
$jquery_ready_content = <<<EOF
|
|
$jquery_ready_content = <<<EOF
|
|
- $(".message-content .message-delete").click(function(){
|
|
|
|
- $(this).parents(".message-content").animate({ opacity: "hide" }, "slow");
|
|
|
|
- $(".message-view").animate({ opacity: "show" }, "slow");
|
|
|
|
- });
|
|
|
|
|
|
+ $(".message-content .message-delete").click(function(){
|
|
|
|
+ $(this).parents(".message-content").animate({ opacity: "hide" }, "slow");
|
|
|
|
+ $(".message-view").animate({ opacity: "show" }, "slow");
|
|
|
|
+ });
|
|
EOF;
|
|
EOF;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
// Libraries
|
|
// Libraries
|
|
-
|
|
|
|
-$tool_name = is_profile_editable() ? get_lang('ModifProfile') : get_lang('ViewProfile');
|
|
|
|
|
|
+$tool_name = api_is_profile_editable() ? get_lang('ModifProfile') : get_lang('ViewProfile');
|
|
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
|
|
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
|
|
|
|
|
|
-/* Form */
|
|
|
|
|
|
+/* Form */
|
|
|
|
|
|
/*
|
|
/*
|
|
* Get initial values for all fields.
|
|
* Get initial values for all fields.
|
|
@@ -119,15 +120,19 @@ if ($user_data !== false) {
|
|
/*
|
|
/*
|
|
* Initialize the form.
|
|
* Initialize the form.
|
|
*/
|
|
*/
|
|
-$form = new FormValidator('profile', 'post', api_get_self()."?".str_replace('&fe=1', '', $_SERVER['QUERY_STRING']), null, array('style' => 'width: 70%; float: '.($text_dir == 'rtl' ? 'right;' : 'left;')));
|
|
|
|
|
|
+$form = new FormValidator('profile', 'post', api_get_self()."?".str_replace(
|
|
|
|
+ '&fe=1',
|
|
|
|
+ '',
|
|
|
|
+ $_SERVER['QUERY_STRING']
|
|
|
|
+), null, array('style' => 'width: 70%; float: '.($text_dir == 'rtl' ? 'right;' : 'left;')));
|
|
|
|
|
|
if (api_is_western_name_order()) {
|
|
if (api_is_western_name_order()) {
|
|
- // FIRST NAME and LAST NAME
|
|
|
|
|
|
+ // FIRST NAME and LAST NAME
|
|
$form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40));
|
|
$form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40));
|
|
- $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40));
|
|
|
|
|
|
+ $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40));
|
|
} else {
|
|
} else {
|
|
- // LAST NAME and FIRST NAME
|
|
|
|
- $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40));
|
|
|
|
|
|
+ // LAST NAME and FIRST NAME
|
|
|
|
+ $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40));
|
|
$form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40));
|
|
$form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40));
|
|
}
|
|
}
|
|
if (api_get_setting('profile', 'name') !== 'true') {
|
|
if (api_get_setting('profile', 'name') !== 'true') {
|
|
@@ -135,11 +140,16 @@ if (api_get_setting('profile', 'name') !== 'true') {
|
|
}
|
|
}
|
|
$form->applyFilter(array('lastname', 'firstname'), 'stripslashes');
|
|
$form->applyFilter(array('lastname', 'firstname'), 'stripslashes');
|
|
$form->applyFilter(array('lastname', 'firstname'), 'trim');
|
|
$form->applyFilter(array('lastname', 'firstname'), 'trim');
|
|
-$form->addRule('lastname' , get_lang('ThisFieldIsRequired'), 'required');
|
|
|
|
|
|
+$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
|
|
$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
|
|
$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
|
|
|
|
|
|
-// USERNAME
|
|
|
|
-$form->addElement('text', 'username', get_lang('UserName'), array('id' => 'username', 'maxlength' => USERNAME_MAX_LENGTH, 'size' => USERNAME_MAX_LENGTH));
|
|
|
|
|
|
+// USERNAME
|
|
|
|
+$form->addElement(
|
|
|
|
+ 'text',
|
|
|
|
+ 'username',
|
|
|
|
+ get_lang('UserName'),
|
|
|
|
+ array('maxlength' => USERNAME_MAX_LENGTH, 'size' => USERNAME_MAX_LENGTH)
|
|
|
|
+);
|
|
if (api_get_setting('profile', 'login') !== 'true') {
|
|
if (api_get_setting('profile', 'login') !== 'true') {
|
|
$form->freeze('username');
|
|
$form->freeze('username');
|
|
}
|
|
}
|
|
@@ -149,7 +159,7 @@ $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
|
|
$form->addRule('username', get_lang('UsernameWrong'), 'username');
|
|
$form->addRule('username', get_lang('UsernameWrong'), 'username');
|
|
$form->addRule('username', get_lang('UserTaken'), 'username_available', $user_data['username']);
|
|
$form->addRule('username', get_lang('UserTaken'), 'username_available', $user_data['username']);
|
|
|
|
|
|
-// OFFICIAL CODE
|
|
|
|
|
|
+// OFFICIAL CODE
|
|
if (CONFVAL_ASK_FOR_OFFICIAL_CODE) {
|
|
if (CONFVAL_ASK_FOR_OFFICIAL_CODE) {
|
|
$form->addElement('text', 'official_code', get_lang('OfficialCode'), array('size' => 40));
|
|
$form->addElement('text', 'official_code', get_lang('OfficialCode'), array('size' => 40));
|
|
if (api_get_setting('profile', 'officialcode') !== 'true') {
|
|
if (api_get_setting('profile', 'officialcode') !== 'true') {
|
|
@@ -157,18 +167,22 @@ if (CONFVAL_ASK_FOR_OFFICIAL_CODE) {
|
|
}
|
|
}
|
|
$form->applyFilter('official_code', 'stripslashes');
|
|
$form->applyFilter('official_code', 'stripslashes');
|
|
$form->applyFilter('official_code', 'trim');
|
|
$form->applyFilter('official_code', 'trim');
|
|
- if (api_get_setting('registration', 'officialcode') == 'true' && api_get_setting('profile', 'officialcode') == 'true') {
|
|
|
|
|
|
+ if (api_get_setting('registration', 'officialcode') == 'true' && api_get_setting(
|
|
|
|
+ 'profile',
|
|
|
|
+ 'officialcode'
|
|
|
|
+ ) == 'true'
|
|
|
|
+ ) {
|
|
$form->addRule('official_code', get_lang('ThisFieldIsRequired'), 'required');
|
|
$form->addRule('official_code', get_lang('ThisFieldIsRequired'), 'required');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// EMAIL
|
|
|
|
|
|
+// EMAIL
|
|
$form->addElement('email', 'email', get_lang('Email'), array('size' => 40));
|
|
$form->addElement('email', 'email', get_lang('Email'), array('size' => 40));
|
|
if (api_get_setting('profile', 'email') !== 'true') {
|
|
if (api_get_setting('profile', 'email') !== 'true') {
|
|
$form->freeze('email');
|
|
$form->freeze('email');
|
|
}
|
|
}
|
|
|
|
|
|
-if (api_get_setting('registration', 'email') == 'true' && api_get_setting('profile', 'email') == 'true') {
|
|
|
|
|
|
+if (api_get_setting('registration', 'email') == 'true' && api_get_setting('profile', 'email') == 'true') {
|
|
$form->applyFilter('email', 'stripslashes');
|
|
$form->applyFilter('email', 'stripslashes');
|
|
$form->applyFilter('email', 'trim');
|
|
$form->applyFilter('email', 'trim');
|
|
$form->addRule('email', get_lang('ThisFieldIsRequired'), 'required');
|
|
$form->addRule('email', get_lang('ThisFieldIsRequired'), 'required');
|
|
@@ -176,18 +190,18 @@ if (api_get_setting('registration', 'email') == 'true' && api_get_setting('prof
|
|
}
|
|
}
|
|
|
|
|
|
// OPENID URL
|
|
// OPENID URL
|
|
-if (is_profile_editable() && api_get_setting('openid_authentication') == 'true') {
|
|
|
|
|
|
+if (api_is_profile_editable() && api_get_setting('openid_authentication') == 'true') {
|
|
$form->addElement('text', 'openid', get_lang('OpenIDURL'), array('size' => 40));
|
|
$form->addElement('text', 'openid', get_lang('OpenIDURL'), array('size' => 40));
|
|
if (api_get_setting('profile', 'openid') !== 'true') {
|
|
if (api_get_setting('profile', 'openid') !== 'true') {
|
|
$form->freeze('openid');
|
|
$form->freeze('openid');
|
|
}
|
|
}
|
|
$form->applyFilter('openid', 'trim');
|
|
$form->applyFilter('openid', 'trim');
|
|
//if (api_get_setting('registration', 'openid') == 'true') {
|
|
//if (api_get_setting('registration', 'openid') == 'true') {
|
|
- // $form->addRule('openid', get_lang('ThisFieldIsRequired'), 'required');
|
|
|
|
|
|
+ // $form->addRule('openid', get_lang('ThisFieldIsRequired'), 'required');
|
|
//}
|
|
//}
|
|
}
|
|
}
|
|
|
|
|
|
-// PHONE
|
|
|
|
|
|
+// PHONE
|
|
$form->addElement('text', 'phone', get_lang('phone'), array('size' => 20));
|
|
$form->addElement('text', 'phone', get_lang('phone'), array('size' => 20));
|
|
if (api_get_setting('profile', 'phone') !== 'true') {
|
|
if (api_get_setting('profile', 'phone') !== 'true') {
|
|
$form->freeze('phone');
|
|
$form->freeze('phone');
|
|
@@ -195,77 +209,107 @@ if (api_get_setting('profile', 'phone') !== 'true') {
|
|
$form->applyFilter('phone', 'stripslashes');
|
|
$form->applyFilter('phone', 'stripslashes');
|
|
$form->applyFilter('phone', 'trim');
|
|
$form->applyFilter('phone', 'trim');
|
|
/*if (api_get_setting('registration', 'phone') == 'true') {
|
|
/*if (api_get_setting('registration', 'phone') == 'true') {
|
|
- $form->addRule('phone', get_lang('ThisFieldIsRequired'), 'required');
|
|
|
|
|
|
+ $form->addRule('phone', get_lang('ThisFieldIsRequired'), 'required');
|
|
}
|
|
}
|
|
$form->addRule('phone', get_lang('EmailWrong'), 'email');*/
|
|
$form->addRule('phone', get_lang('EmailWrong'), 'email');*/
|
|
|
|
|
|
-// PICTURE
|
|
|
|
-if (is_profile_editable() && api_get_setting('profile', 'picture') == 'true') {
|
|
|
|
- $form->addElement('file', 'picture', ($user_data['picture_uri'] != '' ? get_lang('UpdateImage') : get_lang('AddImage')));
|
|
|
|
|
|
+// PICTURE
|
|
|
|
+if (api_is_profile_editable() && api_get_setting('profile', 'picture') == 'true') {
|
|
|
|
+ $form->addElement(
|
|
|
|
+ 'file',
|
|
|
|
+ 'picture',
|
|
|
|
+ ($user_data['picture_uri'] != '' ? get_lang('UpdateImage') : get_lang('AddImage'))
|
|
|
|
+ );
|
|
$form->add_progress_bar();
|
|
$form->add_progress_bar();
|
|
if (!empty($user_data['picture_uri'])) {
|
|
if (!empty($user_data['picture_uri'])) {
|
|
$form->addElement('checkbox', 'remove_picture', null, get_lang('DelImage'));
|
|
$form->addElement('checkbox', 'remove_picture', null, get_lang('DelImage'));
|
|
}
|
|
}
|
|
- $allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif');
|
|
|
|
- $form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
|
|
|
|
|
|
+ $allowed_picture_types = array('jpg', 'jpeg', 'png', 'gif');
|
|
|
|
+ $form->addRule(
|
|
|
|
+ 'picture',
|
|
|
|
+ get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')',
|
|
|
|
+ 'filetype',
|
|
|
|
+ $allowed_picture_types
|
|
|
|
+ );
|
|
}
|
|
}
|
|
|
|
|
|
-// LANGUAGE
|
|
|
|
|
|
+// LANGUAGE
|
|
$form->addElement('select_language', 'language', get_lang('Language'));
|
|
$form->addElement('select_language', 'language', get_lang('Language'));
|
|
if (api_get_setting('profile', 'language') !== 'true') {
|
|
if (api_get_setting('profile', 'language') !== 'true') {
|
|
$form->freeze('language');
|
|
$form->freeze('language');
|
|
}
|
|
}
|
|
|
|
|
|
//THEME
|
|
//THEME
|
|
-if (is_profile_editable() && api_get_setting('user_selected_theme') == 'true') {
|
|
|
|
|
|
+if (api_is_profile_editable() && api_get_setting('user_selected_theme') == 'true') {
|
|
$form->addElement('select_theme', 'theme', get_lang('Theme'));
|
|
$form->addElement('select_theme', 'theme', get_lang('Theme'));
|
|
if (api_get_setting('profile', 'theme') !== 'true') {
|
|
if (api_get_setting('profile', 'theme') !== 'true') {
|
|
$form->freeze('theme');
|
|
$form->freeze('theme');
|
|
}
|
|
}
|
|
$form->applyFilter('theme', 'trim');
|
|
$form->applyFilter('theme', 'trim');
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-// EXTENDED PROFILE this make the page very slow!
|
|
|
|
|
|
+// EXTENDED PROFILE this make the page very slow!
|
|
if (api_get_setting('extended_profile') == 'true') {
|
|
if (api_get_setting('extended_profile') == 'true') {
|
|
if (!isset($_GET['type']) || (isset($_GET['type']) && $_GET['type'] == 'extended')) {
|
|
if (!isset($_GET['type']) || (isset($_GET['type']) && $_GET['type'] == 'extended')) {
|
|
$width_extended_profile = 500;
|
|
$width_extended_profile = 500;
|
|
//$form->addElement('html', '<a href="javascript: void(0);" onclick="javascript: show_extend();"> show_extend_profile</a>');
|
|
//$form->addElement('html', '<a href="javascript: void(0);" onclick="javascript: show_extend();"> show_extend_profile</a>');
|
|
//$form->addElement('static', null, '<em>'.get_lang('OptionalTextFields').'</em>');
|
|
//$form->addElement('static', null, '<em>'.get_lang('OptionalTextFields').'</em>');
|
|
- // MY COMPETENCES
|
|
|
|
- $form->add_html_editor('competences', get_lang('MyCompetences'), false, false, array('ToolbarSet' => 'Profile', 'Width' => $width_extended_profile, 'Height' => '130'));
|
|
|
|
- // MY DIPLOMAS
|
|
|
|
- $form->add_html_editor('diplomas', get_lang('MyDiplomas'), false, false, array('ToolbarSet' => 'Profile', 'Width' => $width_extended_profile, 'Height' => '130'));
|
|
|
|
- // WHAT I AM ABLE TO TEACH
|
|
|
|
- $form->add_html_editor('teach', get_lang('MyTeach'), false, false, array('ToolbarSet' => 'Profile', 'Width' => $width_extended_profile, 'Height' => '130'));
|
|
|
|
-
|
|
|
|
- // MY PRODUCTIONS
|
|
|
|
|
|
+ // MY COMPETENCES
|
|
|
|
+ $form->add_html_editor(
|
|
|
|
+ 'competences',
|
|
|
|
+ get_lang('MyCompetences'),
|
|
|
|
+ false,
|
|
|
|
+ false,
|
|
|
|
+ array('ToolbarSet' => 'Profile', 'Width' => $width_extended_profile, 'Height' => '130')
|
|
|
|
+ );
|
|
|
|
+ // MY DIPLOMAS
|
|
|
|
+ $form->add_html_editor(
|
|
|
|
+ 'diplomas',
|
|
|
|
+ get_lang('MyDiplomas'),
|
|
|
|
+ false,
|
|
|
|
+ false,
|
|
|
|
+ array('ToolbarSet' => 'Profile', 'Width' => $width_extended_profile, 'Height' => '130')
|
|
|
|
+ );
|
|
|
|
+ // WHAT I AM ABLE TO TEACH
|
|
|
|
+ $form->add_html_editor(
|
|
|
|
+ 'teach',
|
|
|
|
+ get_lang('MyTeach'),
|
|
|
|
+ false,
|
|
|
|
+ false,
|
|
|
|
+ array('ToolbarSet' => 'Profile', 'Width' => $width_extended_profile, 'Height' => '130')
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ // MY PRODUCTIONS
|
|
$form->addElement('file', 'production', get_lang('MyProductions'));
|
|
$form->addElement('file', 'production', get_lang('MyProductions'));
|
|
if ($production_list = UserManager::build_production_list(api_get_user_id(), '', true)) {
|
|
if ($production_list = UserManager::build_production_list(api_get_user_id(), '', true)) {
|
|
$form->addElement('static', 'productions_list', null, $production_list);
|
|
$form->addElement('static', 'productions_list', null, $production_list);
|
|
}
|
|
}
|
|
- // MY PERSONAL OPEN AREA
|
|
|
|
- $form->add_html_editor('openarea', get_lang('MyPersonalOpenArea'), false, false, array('ToolbarSet' => 'Profile', 'Width' => $width_extended_profile, 'Height' => '350'));
|
|
|
|
|
|
+ // MY PERSONAL OPEN AREA
|
|
|
|
+ $form->add_html_editor(
|
|
|
|
+ 'openarea',
|
|
|
|
+ get_lang('MyPersonalOpenArea'),
|
|
|
|
+ false,
|
|
|
|
+ false,
|
|
|
|
+ array('ToolbarSet' => 'Profile', 'Width' => $width_extended_profile, 'Height' => '350')
|
|
|
|
+ );
|
|
$form->applyFilter(array('competences', 'diplomas', 'teach', 'openarea'), 'stripslashes');
|
|
$form->applyFilter(array('competences', 'diplomas', 'teach', 'openarea'), 'stripslashes');
|
|
- $form->applyFilter(array('competences', 'diplomas', 'teach'), 'trim'); // openarea is untrimmed for maximum openness
|
|
|
|
|
|
+ $form->applyFilter(
|
|
|
|
+ array('competences', 'diplomas', 'teach'),
|
|
|
|
+ 'trim'
|
|
|
|
+ ); // openarea is untrimmed for maximum openness
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// PASSWORD, if auth_source is platform
|
|
|
|
-if (is_platform_authentication() && is_profile_editable() && api_get_setting('profile', 'password') == 'true') {
|
|
|
|
|
|
+// PASSWORD, if auth_source is platform
|
|
|
|
+if (is_platform_authentication() && api_is_profile_editable() && api_get_setting('profile', 'password') == 'true') {
|
|
$form->addElement(
|
|
$form->addElement(
|
|
'password',
|
|
'password',
|
|
'password0',
|
|
'password0',
|
|
array(get_lang('Pass'), get_lang('Enter2passToChange')),
|
|
array(get_lang('Pass'), get_lang('Enter2passToChange')),
|
|
- array('id'=> 'password1', 'size' => 40)
|
|
|
|
|
|
+ array('size' => 40)
|
|
);
|
|
);
|
|
-
|
|
|
|
- if (isset($_configuration['allow_strength_pass_checker']) && $_configuration['allow_strength_pass_checker']) {
|
|
|
|
- $form->addElement('label', null, '<div id="password_progress"></div>');
|
|
|
|
- }
|
|
|
|
$form->addElement('password', 'password1', get_lang('NewPass'), array('size' => 40));
|
|
$form->addElement('password', 'password1', get_lang('NewPass'), array('size' => 40));
|
|
$form->addElement('password', 'password2', get_lang('Confirmation'), array('size' => 40));
|
|
$form->addElement('password', 'password2', get_lang('Confirmation'), array('size' => 40));
|
|
- // user must enter identical password twice so we can prevent some user errors
|
|
|
|
|
|
+ // user must enter identical password twice so we can prevent some user errors
|
|
$form->addRule(array('password1', 'password2'), get_lang('PassTwo'), 'compare');
|
|
$form->addRule(array('password1', 'password2'), get_lang('PassTwo'), 'compare');
|
|
if (CHECK_PASS_EASY_TO_FIND) {
|
|
if (CHECK_PASS_EASY_TO_FIND) {
|
|
$form->addRule('password1', get_lang('CurrentPasswordEmptyOrIncorrect'), 'callback', 'api_check_password');
|
|
$form->addRule('password1', get_lang('CurrentPasswordEmptyOrIncorrect'), 'callback', 'api_check_password');
|
|
@@ -279,20 +323,30 @@ $return_params = $extraField->set_extra_fields_in_form($form, $extra_data, 'prof
|
|
$jquery_ready_content = $return_params['jquery_ready_content'];
|
|
$jquery_ready_content = $return_params['jquery_ready_content'];
|
|
|
|
|
|
// the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function
|
|
// the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function
|
|
-$htmlHeadXtra[] ='<script>
|
|
|
|
|
|
+$htmlHeadXtra[] = '<script>
|
|
$(document).ready(function(){
|
|
$(document).ready(function(){
|
|
- '.$jquery_ready_content.'
|
|
|
|
|
|
+ '.$jquery_ready_content.'
|
|
});
|
|
});
|
|
</script>';
|
|
</script>';
|
|
|
|
|
|
if (api_get_setting('profile', 'apikeys') == 'true') {
|
|
if (api_get_setting('profile', 'apikeys') == 'true') {
|
|
$form->addElement('html', '<div id="div_api_key">');
|
|
$form->addElement('html', '<div id="div_api_key">');
|
|
- $form->addElement('text', 'api_key_generate', get_lang('MyApiKey'), array('size' => 40, 'id' => 'id_api_key_generate'));
|
|
|
|
|
|
+ $form->addElement(
|
|
|
|
+ 'text',
|
|
|
|
+ 'api_key_generate',
|
|
|
|
+ get_lang('MyApiKey'),
|
|
|
|
+ array('size' => 40, 'id' => 'id_api_key_generate')
|
|
|
|
+ );
|
|
$form->addElement('html', '</div>');
|
|
$form->addElement('html', '</div>');
|
|
- $form->addElement('button', 'generate_api_key', get_lang('GenerateApiKey'), array('id' => 'id_generate_api_key', 'onclick' => 'generate_open_id_form(); return false;')); //generate_open_id_form()
|
|
|
|
-}
|
|
|
|
-// SUBMIT
|
|
|
|
-if (is_profile_editable()) {
|
|
|
|
|
|
+ $form->addElement(
|
|
|
|
+ 'button',
|
|
|
|
+ 'generate_api_key',
|
|
|
|
+ get_lang('GenerateApiKey'),
|
|
|
|
+ array('id' => 'id_generate_api_key', 'onclick' => 'generate_open_id_form()')
|
|
|
|
+ ); //generate_open_id_form()
|
|
|
|
+}
|
|
|
|
+// SUBMIT
|
|
|
|
+if (api_is_profile_editable()) {
|
|
$form->addElement('style_submit_button', 'apply_change', get_lang('SaveSettings'), 'class="save"');
|
|
$form->addElement('style_submit_button', 'apply_change', get_lang('SaveSettings'), 'class="save"');
|
|
} else {
|
|
} else {
|
|
$form->freeze();
|
|
$form->freeze();
|
|
@@ -301,7 +355,7 @@ if (is_profile_editable()) {
|
|
$user_data = array_merge($user_data, $extra_data);
|
|
$user_data = array_merge($user_data, $extra_data);
|
|
$form->setDefaults($user_data);
|
|
$form->setDefaults($user_data);
|
|
|
|
|
|
-/* FUNCTIONS */
|
|
|
|
|
|
+/* FUNCTIONS */
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -312,22 +366,12 @@ $form->setDefaults($user_data);
|
|
function is_platform_authentication()
|
|
function is_platform_authentication()
|
|
{
|
|
{
|
|
$tab_user_info = api_get_user_info();
|
|
$tab_user_info = api_get_user_info();
|
|
- return $tab_user_info['auth_source'] == PLATFORM_AUTH_SOURCE;
|
|
|
|
-}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
- * Returns whether a user can edit his/her profile. Defaults to false if
|
|
|
|
- * profileIsEditable is not set in $GLOBALS.
|
|
|
|
- *
|
|
|
|
- * @return boolean Editability of the profile
|
|
|
|
- */
|
|
|
|
-function is_profile_editable()
|
|
|
|
-{
|
|
|
|
- return isset($GLOBALS['profileIsEditable']) ? $GLOBALS['profileIsEditable'] : false;
|
|
|
|
|
|
+ return $tab_user_info['auth_source'] == PLATFORM_AUTH_SOURCE;
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
- PRODUCTIONS FUNCTIONS
|
|
|
|
|
|
+ PRODUCTIONS FUNCTIONS
|
|
*/
|
|
*/
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -353,6 +397,7 @@ function upload_user_production($user_id)
|
|
return $filename;
|
|
return $filename;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
return false; // this should be returned if anything went wrong with the upload
|
|
return false; // this should be returned if anything went wrong with the upload
|
|
}
|
|
}
|
|
|
|
|
|
@@ -373,8 +418,10 @@ function check_user_password($password)
|
|
$password = api_get_encrypted_password($password);
|
|
$password = api_get_encrypted_password($password);
|
|
$sql_password = "SELECT * FROM $table_user WHERE user_id='".$user_id."' AND password='".$password."'";
|
|
$sql_password = "SELECT * FROM $table_user WHERE user_id='".$user_id."' AND password='".$password."'";
|
|
$result = Database::query($sql_password);
|
|
$result = Database::query($sql_password);
|
|
|
|
+
|
|
return Database::num_rows($result) != 0;
|
|
return Database::num_rows($result) != 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Check current user's current password
|
|
* Check current user's current password
|
|
* @param char email
|
|
* @param char email
|
|
@@ -391,20 +438,21 @@ function check_user_email($email)
|
|
$email = Database::escape_string($email);
|
|
$email = Database::escape_string($email);
|
|
$sql_password = "SELECT * FROM $table_user WHERE user_id='".$user_id."' AND email='".$email."'";
|
|
$sql_password = "SELECT * FROM $table_user WHERE user_id='".$user_id."' AND email='".$email."'";
|
|
$result = Database::query($sql_password);
|
|
$result = Database::query($sql_password);
|
|
|
|
+
|
|
return Database::num_rows($result) != 0;
|
|
return Database::num_rows($result) != 0;
|
|
}
|
|
}
|
|
|
|
|
|
-/* MAIN CODE */
|
|
|
|
-$filtered_extension = false;
|
|
|
|
-$update_success = false;
|
|
|
|
-$upload_picture_success = false;
|
|
|
|
-$upload_production_success = false;
|
|
|
|
-$msg_fail_changue_email = false;
|
|
|
|
-$msg_is_not_password = false;
|
|
|
|
|
|
+/* MAIN CODE */
|
|
|
|
+$filtered_extension = false;
|
|
|
|
+$update_success = false;
|
|
|
|
+$upload_picture_success = false;
|
|
|
|
+$upload_production_success = false;
|
|
|
|
+$msg_fail_changue_email = false;
|
|
|
|
+$msg_is_not_password = false;
|
|
|
|
|
|
if (is_platform_authentication()) {
|
|
if (is_platform_authentication()) {
|
|
if (!empty($_SESSION['change_email'])) {
|
|
if (!empty($_SESSION['change_email'])) {
|
|
- $msg_fail_changue_email= ($_SESSION['change_email'] == 'success');
|
|
|
|
|
|
+ $msg_fail_changue_email = ($_SESSION['change_email'] == 'success');
|
|
unset($_SESSION['change_email']);
|
|
unset($_SESSION['change_email']);
|
|
} elseif (!empty($_SESSION['is_not_password'])) {
|
|
} elseif (!empty($_SESSION['is_not_password'])) {
|
|
$msg_is_not_password = ($_SESSION['is_not_password'] == 'success');
|
|
$msg_is_not_password = ($_SESSION['is_not_password'] == 'success');
|
|
@@ -424,7 +472,7 @@ if (is_platform_authentication()) {
|
|
if ($form->validate()) {
|
|
if ($form->validate()) {
|
|
|
|
|
|
$wrong_current_password = false;
|
|
$wrong_current_password = false;
|
|
-// $user_data = $form->exportValues();
|
|
|
|
|
|
+// $user_data = $form->exportValues();
|
|
$user_data = $form->getSubmitValues();
|
|
$user_data = $form->getSubmitValues();
|
|
|
|
|
|
// set password if a new one was provided
|
|
// set password if a new one was provided
|
|
@@ -448,24 +496,21 @@ if ($form->validate()) {
|
|
$allow_users_to_change_email_with_no_password = false;
|
|
$allow_users_to_change_email_with_no_password = false;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
//If user sending the email to be changed (input available and not frozen )
|
|
//If user sending the email to be changed (input available and not frozen )
|
|
if (api_get_setting('profile', 'email') == 'true') {
|
|
if (api_get_setting('profile', 'email') == 'true') {
|
|
|
|
+
|
|
if ($allow_users_to_change_email_with_no_password) {
|
|
if ($allow_users_to_change_email_with_no_password) {
|
|
if (!check_user_email($user_data['email'])) {
|
|
if (!check_user_email($user_data['email'])) {
|
|
$changeemail = $user_data['email'];
|
|
$changeemail = $user_data['email'];
|
|
//$_SESSION['change_email'] = 'success';
|
|
//$_SESSION['change_email'] = 'success';
|
|
}
|
|
}
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
//Normal behaviour
|
|
//Normal behaviour
|
|
if (!check_user_email($user_data['email']) && !empty($user_data['password0']) && !$wrong_current_password) {
|
|
if (!check_user_email($user_data['email']) && !empty($user_data['password0']) && !$wrong_current_password) {
|
|
$changeemail = $user_data['email'];
|
|
$changeemail = $user_data['email'];
|
|
}
|
|
}
|
|
|
|
|
|
- if (!check_user_email($user_data['email']) && empty($user_data['password0'])){
|
|
|
|
|
|
+ if (!check_user_email($user_data['email']) && empty($user_data['password0'])) {
|
|
$_SESSION['change_email'] = 'success';
|
|
$_SESSION['change_email'] = 'success';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -474,7 +519,12 @@ if ($form->validate()) {
|
|
|
|
|
|
// Upload picture if a new one is provided
|
|
// Upload picture if a new one is provided
|
|
if ($_FILES['picture']['size']) {
|
|
if ($_FILES['picture']['size']) {
|
|
- if ($new_picture = UserManager::update_user_picture(api_get_user_id(), $_FILES['picture']['name'], $_FILES['picture']['tmp_name'])) {
|
|
|
|
|
|
+ if ($new_picture = UserManager::update_user_picture(
|
|
|
|
+ api_get_user_id(),
|
|
|
|
+ $_FILES['picture']['name'],
|
|
|
|
+ $_FILES['picture']['tmp_name']
|
|
|
|
+ )
|
|
|
|
+ ) {
|
|
$user_data['picture_uri'] = $new_picture;
|
|
$user_data['picture_uri'] = $new_picture;
|
|
$_SESSION['image_uploaded'] = 'success';
|
|
$_SESSION['image_uploaded'] = 'success';
|
|
}
|
|
}
|
|
@@ -490,7 +540,10 @@ if ($form->validate()) {
|
|
UserManager::remove_user_production(api_get_user_id(), urldecode($production));
|
|
UserManager::remove_user_production(api_get_user_id(), urldecode($production));
|
|
}
|
|
}
|
|
if ($production_list = UserManager::build_production_list(api_get_user_id(), true, true)) {
|
|
if ($production_list = UserManager::build_production_list(api_get_user_id(), true, true)) {
|
|
- $form->insertElementBefore($form->createElement('static', null, null, $production_list), 'productions_list');
|
|
|
|
|
|
+ $form->insertElementBefore(
|
|
|
|
+ $form->createElement('static', null, null, $production_list),
|
|
|
|
+ 'productions_list'
|
|
|
|
+ );
|
|
}
|
|
}
|
|
$form->removeElement('productions_list');
|
|
$form->removeElement('productions_list');
|
|
$file_deleted = true;
|
|
$file_deleted = true;
|
|
@@ -508,8 +561,8 @@ if ($form->validate()) {
|
|
}
|
|
}
|
|
|
|
|
|
// remove values that shouldn't go in the database
|
|
// remove values that shouldn't go in the database
|
|
- unset($user_data['password0'],$user_data['password1'], $user_data['password2'], $user_data['MAX_FILE_SIZE'],
|
|
|
|
- $user_data['remove_picture'], $user_data['apply_change'],$user_data['email'] );
|
|
|
|
|
|
+ unset($user_data['password0'], $user_data['password1'], $user_data['password2'], $user_data['MAX_FILE_SIZE'],
|
|
|
|
+ $user_data['remove_picture'], $user_data['apply_change'], $user_data['email']);
|
|
|
|
|
|
// Following RFC2396 (http://www.faqs.org/rfcs/rfc2396.html), a URI uses ':' as a reserved character
|
|
// Following RFC2396 (http://www.faqs.org/rfcs/rfc2396.html), a URI uses ':' as a reserved character
|
|
// we can thus ensure the URL doesn't contain any scheme name by searching for ':' in the string
|
|
// we can thus ensure the URL doesn't contain any scheme name by searching for ':' in the string
|
|
@@ -531,9 +584,9 @@ if ($form->validate()) {
|
|
//Adding missing variables
|
|
//Adding missing variables
|
|
|
|
|
|
$available_values_to_modify = array();
|
|
$available_values_to_modify = array();
|
|
- foreach($profile_list as $key => $status) {
|
|
|
|
|
|
+ foreach ($profile_list as $key => $status) {
|
|
if ($status == 'true') {
|
|
if ($status == 'true') {
|
|
- switch($key) {
|
|
|
|
|
|
+ switch ($key) {
|
|
case 'login':
|
|
case 'login':
|
|
$available_values_to_modify[] = 'username';
|
|
$available_values_to_modify[] = 'username';
|
|
break;
|
|
break;
|
|
@@ -552,7 +605,10 @@ if ($form->validate()) {
|
|
}
|
|
}
|
|
|
|
|
|
//Fixing missing variables
|
|
//Fixing missing variables
|
|
- $available_values_to_modify = array_merge($available_values_to_modify, array('competences', 'diplomas', 'openarea', 'teach', 'openid'));
|
|
|
|
|
|
+ $available_values_to_modify = array_merge(
|
|
|
|
+ $available_values_to_modify,
|
|
|
|
+ array('competences', 'diplomas', 'openarea', 'teach', 'openid')
|
|
|
|
+ );
|
|
|
|
|
|
// build SQL query
|
|
// build SQL query
|
|
$sql = "UPDATE $table_user SET";
|
|
$sql = "UPDATE $table_user SET";
|
|
@@ -564,12 +620,12 @@ if ($form->validate()) {
|
|
if (is_array($value) && isset($value['Y']) && isset($value['F']) && isset($value['d'])) {
|
|
if (is_array($value) && isset($value['Y']) && isset($value['F']) && isset($value['d'])) {
|
|
if (isset($value['H']) && isset($value['i'])) {
|
|
if (isset($value['H']) && isset($value['i'])) {
|
|
// extra field date time
|
|
// extra field date time
|
|
- $time = mktime($value['H'],$value['i'],0,$value['F'],$value['d'],$value['Y']);
|
|
|
|
- $extras[$new_key] = date('Y-m-d H:i:s',$time);
|
|
|
|
|
|
+ $time = mktime($value['H'], $value['i'], 0, $value['F'], $value['d'], $value['Y']);
|
|
|
|
+ $extras[$new_key] = date('Y-m-d H:i:s', $time);
|
|
} else {
|
|
} else {
|
|
// extra field date
|
|
// extra field date
|
|
- $time = mktime(0,0,0,$value['F'],$value['d'],$value['Y']);
|
|
|
|
- $extras[$new_key] = date('Y-m-d',$time);
|
|
|
|
|
|
+ $time = mktime(0, 0, 0, $value['F'], $value['d'], $value['Y']);
|
|
|
|
+ $extras[$new_key] = date('Y-m-d', $time);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
$extras[$new_key] = $value;
|
|
$extras[$new_key] = $value;
|
|
@@ -594,13 +650,21 @@ if ($form->validate()) {
|
|
$sql = rtrim($sql, ',');
|
|
$sql = rtrim($sql, ',');
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
|
|
+ //normal behaviour
|
|
|
|
+ if (empty($changeemail) && isset($password)) {
|
|
|
|
+ $sql .= " email = y@u.com";
|
|
|
|
+ }
|
|
if (isset($changeemail) && !isset($password) && in_array('email', $available_values_to_modify)) {
|
|
if (isset($changeemail) && !isset($password) && in_array('email', $available_values_to_modify)) {
|
|
$sql .= " email = '".Database::escape_string($changeemail)."'";
|
|
$sql .= " email = '".Database::escape_string($changeemail)."'";
|
|
- } else {
|
|
|
|
- if (isset($password) && in_array('password', $available_values_to_modify)) {
|
|
|
|
- if (isset($changeemail) && in_array('email', $available_values_to_modify)) {
|
|
|
|
|
|
+ } elseif (isset($password) && isset($changeemail) && in_array('email', $available_values_to_modify) && in_array(
|
|
|
|
+ 'password',
|
|
|
|
+ $available_values_to_modify
|
|
|
|
+ )
|
|
|
|
+ ) {
|
|
$sql .= " email = '".Database::escape_string($changeemail)."',";
|
|
$sql .= " email = '".Database::escape_string($changeemail)."',";
|
|
- }
|
|
|
|
|
|
+ $password = api_get_encrypted_password($password);
|
|
|
|
+ $sql .= " password = '".Database::escape_string($password)."'";
|
|
|
|
+ } elseif (isset($password) && in_array('password', $available_values_to_modify)) {
|
|
$password = api_get_encrypted_password($password);
|
|
$password = api_get_encrypted_password($password);
|
|
$sql .= " password = '".Database::escape_string($password)."'";
|
|
$sql .= " password = '".Database::escape_string($password)."'";
|
|
} else {
|
|
} else {
|
|
@@ -611,7 +675,6 @@ if ($form->validate()) {
|
|
if (api_get_setting('profile', 'officialcode') == 'true' && isset($user_data['official_code'])) {
|
|
if (api_get_setting('profile', 'officialcode') == 'true' && isset($user_data['official_code'])) {
|
|
$sql .= ", official_code = '".Database::escape_string($user_data['official_code'])."'";
|
|
$sql .= ", official_code = '".Database::escape_string($user_data['official_code'])."'";
|
|
}
|
|
}
|
|
-
|
|
|
|
$sql .= " WHERE user_id = '".api_get_user_id()."'";
|
|
$sql .= " WHERE user_id = '".api_get_user_id()."'";
|
|
Database::query($sql);
|
|
Database::query($sql);
|
|
|
|
|
|
@@ -620,7 +683,7 @@ if ($form->validate()) {
|
|
//1. Deleting all user tags
|
|
//1. Deleting all user tags
|
|
$list_extra_field_type_tag = UserManager::get_all_extra_field_by_type(ExtraField::FIELD_TYPE_TAG);
|
|
$list_extra_field_type_tag = UserManager::get_all_extra_field_by_type(ExtraField::FIELD_TYPE_TAG);
|
|
|
|
|
|
- if (is_array($list_extra_field_type_tag) && count($list_extra_field_type_tag)>0) {
|
|
|
|
|
|
+ if (is_array($list_extra_field_type_tag) && count($list_extra_field_type_tag) > 0) {
|
|
foreach ($list_extra_field_type_tag as $id) {
|
|
foreach ($list_extra_field_type_tag as $id) {
|
|
UserManager::delete_user_tags(api_get_user_id(), $id);
|
|
UserManager::delete_user_tags(api_get_user_id(), $id);
|
|
}
|
|
}
|
|
@@ -628,7 +691,7 @@ if ($form->validate()) {
|
|
|
|
|
|
//2. Update the extra fields and user tags if available
|
|
//2. Update the extra fields and user tags if available
|
|
|
|
|
|
- if (is_array($extras) && count($extras)> 0) {
|
|
|
|
|
|
+ if (is_array($extras) && count($extras) > 0) {
|
|
foreach ($extras as $key => $value) {
|
|
foreach ($extras as $key => $value) {
|
|
//3. Tags are process in the UserManager::update_extra_field_value by the UserManager::process_tags function
|
|
//3. Tags are process in the UserManager::update_extra_field_value by the UserManager::process_tags function
|
|
UserManager::update_extra_field_value(api_get_user_id(), $key, $value);
|
|
UserManager::update_extra_field_value(api_get_user_id(), $key, $value);
|
|
@@ -639,13 +702,16 @@ if ($form->validate()) {
|
|
$_SESSION['_user']['uidReset'] = true;
|
|
$_SESSION['_user']['uidReset'] = true;
|
|
$_SESSION['noredirection'] = true;
|
|
$_SESSION['noredirection'] = true;
|
|
$_SESSION['profile_update'] = 'success';
|
|
$_SESSION['profile_update'] = 'success';
|
|
- $url = api_get_self()."?{$_SERVER['QUERY_STRING']}".($filtered_extension && strpos($_SERVER['QUERY_STRING'], '&fe=1') === false ? '&fe=1' : '');
|
|
|
|
|
|
+ $url = api_get_self()."?{$_SERVER['QUERY_STRING']}".($filtered_extension && strpos(
|
|
|
|
+ $_SERVER['QUERY_STRING'],
|
|
|
|
+ '&fe=1'
|
|
|
|
+ ) === false ? '&fe=1' : '');
|
|
header("Location: ".$url);
|
|
header("Location: ".$url);
|
|
exit;
|
|
exit;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-/* MAIN DISPLAY SECTION */
|
|
|
|
|
|
+/* MAIN DISPLAY SECTION */
|
|
// the header
|
|
// the header
|
|
Display::display_header(get_lang('ModifyProfile'));
|
|
Display::display_header(get_lang('ModifyProfile'));
|
|
|
|
|
|
@@ -655,17 +721,33 @@ if (api_get_setting('allow_social_tool') != 'true') {
|
|
echo '<div class="actions">';
|
|
echo '<div class="actions">';
|
|
|
|
|
|
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
|
|
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
|
|
- echo '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'</a>';
|
|
|
|
|
|
+ echo '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon(
|
|
|
|
+ 'shared_profile.png',
|
|
|
|
+ get_lang('ViewSharedProfile')
|
|
|
|
+ ).'</a>';
|
|
}
|
|
}
|
|
if (api_get_setting('allow_message_tool') == 'true') {
|
|
if (api_get_setting('allow_message_tool') == 'true') {
|
|
- echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png', get_lang('Messages')).'</a>';
|
|
|
|
|
|
+ echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon(
|
|
|
|
+ 'inbox.png',
|
|
|
|
+ get_lang('Messages')
|
|
|
|
+ ).'</a>';
|
|
}
|
|
}
|
|
$show = isset($_GET['show']) ? '&show='.Security::remove_XSS($_GET['show']) : '';
|
|
$show = isset($_GET['show']) ? '&show='.Security::remove_XSS($_GET['show']) : '';
|
|
|
|
|
|
if (isset($_GET['type']) && $_GET['type'] == 'extended') {
|
|
if (isset($_GET['type']) && $_GET['type'] == 'extended') {
|
|
- echo '<a href="profile.php?type=reduced'.$show.'">'.Display::return_icon('edit.png', get_lang('EditNormalProfile'),'',16).'</a>';
|
|
|
|
|
|
+ echo '<a href="profile.php?type=reduced'.$show.'">'.Display::return_icon(
|
|
|
|
+ 'edit.png',
|
|
|
|
+ get_lang('EditNormalProfile'),
|
|
|
|
+ '',
|
|
|
|
+ 16
|
|
|
|
+ ).'</a>';
|
|
} else {
|
|
} else {
|
|
- echo '<a href="profile.php?type=extended'.$show.'">'.Display::return_icon('edit.png', get_lang('EditExtendProfile'),'',16).'</a>';
|
|
|
|
|
|
+ echo '<a href="profile.php?type=extended'.$show.'">'.Display::return_icon(
|
|
|
|
+ 'edit.png',
|
|
|
|
+ get_lang('EditExtendProfile'),
|
|
|
|
+ '',
|
|
|
|
+ 16
|
|
|
|
+ ).'</a>';
|
|
}
|
|
}
|
|
echo '</div>';
|
|
echo '</div>';
|
|
}
|
|
}
|
|
@@ -681,18 +763,18 @@ if (!empty($file_deleted)) {
|
|
}
|
|
}
|
|
|
|
|
|
if ($upload_production_success) {
|
|
if ($upload_production_success) {
|
|
- $message.='<br />'.get_lang('ProductionUploaded');
|
|
|
|
|
|
+ $message .= '<br />'.get_lang('ProductionUploaded');
|
|
}
|
|
}
|
|
Display :: display_confirmation_message($message, false);
|
|
Display :: display_confirmation_message($message, false);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-if (!empty($msg_fail_changue_email)){
|
|
|
|
- $errormail=get_lang('ToChangeYourEmailMustTypeYourPassword');
|
|
|
|
|
|
+if (!empty($msg_fail_changue_email)) {
|
|
|
|
+ $errormail = get_lang('ToChangeYourEmailMustTypeYourPassword');
|
|
Display :: display_error_message($errormail, false);
|
|
Display :: display_error_message($errormail, false);
|
|
}
|
|
}
|
|
|
|
|
|
-if (!empty($msg_is_not_password)){
|
|
|
|
|
|
+if (!empty($msg_is_not_password)) {
|
|
$warning_msg = get_lang('CurrentPasswordEmptyOrIncorrect');
|
|
$warning_msg = get_lang('CurrentPasswordEmptyOrIncorrect');
|
|
Display :: display_warning_message($warning_msg, false);
|
|
Display :: display_warning_message($warning_msg, false);
|
|
}
|
|
}
|
|
@@ -701,6 +783,8 @@ if (!empty($msg_is_not_password)){
|
|
$image_syspath = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'system', false, true);
|
|
$image_syspath = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'system', false, true);
|
|
$image_syspath['dir'].$image_syspath['file'];
|
|
$image_syspath['dir'].$image_syspath['file'];
|
|
|
|
|
|
|
|
+//$image_size = api_getimagesize($image_syspath['dir'].$image_syspath['file']);
|
|
|
|
+
|
|
//Web path
|
|
//Web path
|
|
$image_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'web', false, true);
|
|
$image_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'web', false, true);
|
|
$image_dir = $image_path['dir'];
|
|
$image_dir = $image_path['dir'];
|
|
@@ -709,27 +793,33 @@ $image_file = $image_dir.$image;
|
|
$img_attributes = 'src="'.$image_file.'?rand='.time().'" '
|
|
$img_attributes = 'src="'.$image_file.'?rand='.time().'" '
|
|
.'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
|
|
.'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
|
|
.'style="float:'.($text_dir == 'rtl' ? 'left' : 'right').'; margin-top:0px;padding:5px;" ';
|
|
.'style="float:'.($text_dir == 'rtl' ? 'left' : 'right').'; margin-top:0px;padding:5px;" ';
|
|
|
|
+/*
|
|
|
|
+if ($image_size['width'] > 300) {
|
|
|
|
+ //limit display width to 300px
|
|
|
|
+ $img_attributes .= 'width="300" ';
|
|
|
|
+}*/
|
|
|
|
|
|
// get the path,width and height from original picture
|
|
// get the path,width and height from original picture
|
|
$big_image = $image_dir.'big_'.$image;
|
|
$big_image = $image_dir.'big_'.$image;
|
|
|
|
|
|
-$big_image_size = api_getimagesize($big_image);
|
|
|
|
-$big_image_width = $big_image_size['width'];
|
|
|
|
-$big_image_height = $big_image_size['height'];
|
|
|
|
-$url_big_image = $big_image.'?rnd='.time();
|
|
|
|
|
|
+$big_image_size = api_getimagesize($big_image);
|
|
|
|
+$big_image_width = $big_image_size['width'];
|
|
|
|
+$big_image_height = $big_image_size['height'];
|
|
|
|
+$url_big_image = $big_image.'?rnd='.time();
|
|
|
|
|
|
$show_delete_account_button = api_get_setting('platform_unsubscribe_allowed') == 'true' ? true : false;
|
|
$show_delete_account_button = api_get_setting('platform_unsubscribe_allowed') == 'true' ? true : false;
|
|
|
|
|
|
if (api_get_setting('allow_social_tool') == 'true') {
|
|
if (api_get_setting('allow_social_tool') == 'true') {
|
|
echo '<div class="row-fluid">';
|
|
echo '<div class="row-fluid">';
|
|
- echo '<div class="span3">';
|
|
|
|
- echo SocialManager::show_social_menu('home', null, api_get_user_id(), false, $show_delete_account_button);
|
|
|
|
- echo '</div>';
|
|
|
|
- echo '<div class="span9">';
|
|
|
|
- $form->display();
|
|
|
|
|
|
+ echo '<div class="span3">';
|
|
|
|
+ echo SocialManager::show_social_menu('home', null, api_get_user_id(), false, $show_delete_account_button);
|
|
|
|
+ echo '</div>';
|
|
|
|
+ echo '<div class="span9">';
|
|
|
|
+ $form->display();
|
|
echo '</div>';
|
|
echo '</div>';
|
|
} else {
|
|
} else {
|
|
// Style position:absolute has been removed for Opera-compatibility.
|
|
// Style position:absolute has been removed for Opera-compatibility.
|
|
|
|
+ //echo '<div id="image-message-container" style="float:right;display:inline;position:absolute;padding:3px;width:250px;" >';
|
|
echo '<div id="image-message-container" style="float:right;display:inline;padding:3px;width:230px;" >';
|
|
echo '<div id="image-message-container" style="float:right;display:inline;padding:3px;width:230px;" >';
|
|
|
|
|
|
if ($image == 'unknown.jpg') {
|
|
if ($image == 'unknown.jpg') {
|