skala
Julio Montoya 16 years ago
commit 4655987d03
  1. 9
      main/admin/access_url_edit.php
  2. 11
      main/admin/configure_homepage.php
  3. 591
      main/admin/configure_inscription.php
  4. 4
      main/admin/dashboard_add_users_to_user.php
  5. 2
      main/attendance/attendance_calendar.php
  6. 123
      main/auth/inscription.php
  7. 11
      main/lang/english/trad4all.inc.php
  8. 11
      main/lang/spanish/trad4all.inc.php

@ -79,11 +79,20 @@ $form->addElement('text','url',get_lang('URL'),array('size'=>'30'));
$form->addRule('url', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('url', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('url', '', 'maxlength',254); $form->addRule('url', '', 'maxlength',254);
$form->addElement('textarea','description',get_lang('Description')); $form->addElement('textarea','description',get_lang('Description'));
<<<<<<< /www/chamilodev.beeznest.com/www/main/admin/access_url_edit.php
if ($_GET['url_id'] != 1) {
$form->addElement('checkbox','active',get_lang('Active'));
}
//$form->addRule('checkbox', get_lang('ThisFieldIsRequired'), 'required');
=======
//the first url with id = 1 will be always active //the first url with id = 1 will be always active
if ($_GET['url_id'] != 1) { if ($_GET['url_id'] != 1) {
$form->addElement('checkbox','active',get_lang('Active')); $form->addElement('checkbox','active',get_lang('Active'));
} }
>>>>>>> /tmp/access_url_edit.php~other.zY-an1
$defaults['url']='http://'; $defaults['url']='http://';
$form->setDefaults($defaults); $form->setDefaults($defaults);

@ -101,7 +101,6 @@ if ($_configuration['multiple_access_urls']) {
$homep = api_get_path(SYS_PATH).'home/'; //homep for Home Path $homep = api_get_path(SYS_PATH).'home/'; //homep for Home Path
} }
$menuf = 'home_menu'; //menuf for Menu File $menuf = 'home_menu'; //menuf for Menu File
$newsf = 'home_news'; //newsf for News File $newsf = 'home_news'; //newsf for News File
$topf = 'home_top'; //topf for Top File $topf = 'home_top'; //topf for Top File
@ -115,11 +114,11 @@ $homef = array($menuf, $newsf, $topf, $noticef, $menutabs);
foreach ($homef as $my_file) { foreach ($homef as $my_file) {
if ($_configuration['multiple_access_urls']) { if ($_configuration['multiple_access_urls']) {
if (!file_exists($homep_new.$my_file.'_'.$lang.$ext)) { if (!file_exists($homep_new.$my_file.'_'.$lang.$ext)) {
copy($homep.$my_file.$ext,$homep_new.$my_file.'_'.$lang.$ext); copy($homep.$my_file.$ext, $homep_new.$my_file.'_'.$lang.$ext);
} }
} else { } else {
if (!file_exists($homep.$my_file.'_'.$lang.$ext)) { if (!file_exists($homep.$my_file.'_'.$lang.$ext)) {
copy($homep.$my_file.$ext,$homep.$my_file.'_'.$lang.$ext); copy($homep.$my_file.$ext, $homep.$my_file.'_'.$lang.$ext);
} }
} }
} }
@ -565,9 +564,7 @@ if (!empty($action)) {
$Categories = Database::store_result(Database::query("SELECT name FROM $tbl_category WHERE parent_id IS NULL ORDER BY tree_pos")); $Categories = Database::store_result(Database::query("SELECT name FROM $tbl_category WHERE parent_id IS NULL ORDER BY tree_pos"));
} }
// ------------------------- // Display section
// ---- Display section ----
// -------------------------
Display::display_header($tool_name); Display::display_header($tool_name);
@ -583,7 +580,7 @@ switch ($action) {
} }
break; break;
case 'edit_notice': case 'edit_notice':
//------------ Display for edit_notice case -------------- // Display for edit_notice case
?> ?>
<form action="<?php echo api_get_self(); ?>?action=<?php echo $action; ?>" method="post" style="margin:0px;"> <form action="<?php echo api_get_self(); ?>?action=<?php echo $action; ?>" method="post" style="margin:0px;">
<div class="row"><div class="form_header"><?php echo $tool_name; ?></div></div> <div class="row"><div class="form_header"><?php echo $tool_name; ?></div></div>

@ -1,36 +1,30 @@
<?php <?php
/* For licensing terms, see /dokeos_license.txt */ /* For licensing terms, see /license.txt */
/** /**
============================================================================== * This script displays a form for registering new users.
* This script displays a form for registering new users. * @package chamilo.admin
* @package dokeos.auth */
==============================================================================
*/
// name of the language file that needs to be included
$language_file = array('registration','admin');
$cidReset = true;
include ("../inc/global.inc.php");
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); $language_file = array('registration', 'admin');
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php'); $cidReset = true;
require_once (api_get_path(CONFIGURATION_PATH).'profile.conf.php'); include '../inc/global.inc.php';
require_once(api_get_path(INCLUDE_PATH).'lib/mail.lib.inc.php');
require_once(api_get_path(INCLUDE_PATH).'lib/legal.lib.php');
//require_once(api_get_path(LIBRARY_PATH).'fileManage.lib.php'); require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
//require_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php'); require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
//require_once (api_get_path(LIBRARY_PATH).'image.lib.php'); require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';
require_once api_get_path(INCLUDE_PATH).'lib/mail.lib.inc.php';
require_once api_get_path(INCLUDE_PATH).'lib/legal.lib.php';
// Load terms & conditions from the current lang // Load terms & conditions from the current lang
if (get_setting('allow_terms_conditions')=='true') { if (get_setting('allow_terms_conditions') == 'true') {
$get = array_keys($_GET); $get = array_keys($_GET);
if (isset($get)) { if (isset($get)) {
if ($get[0]=='legal'){ if ($get[0] == 'legal') {
//$language = api_get_setting('platformLanguage');
$language = api_get_interface_language(); $language = api_get_interface_language();
$language = api_get_language_id($language); $language = api_get_language_id($language);
$term_preview= LegalManager::get_last_condition($language); $term_preview = LegalManager::get_last_condition($language);
if ($term_preview==false) { if ($term_preview == false) {
//look for the default language //look for the default language
$language = api_get_setting('platformLanguage'); $language = api_get_setting('platformLanguage');
$language = api_get_language_id($language); $language = api_get_language_id($language);
@ -41,51 +35,50 @@ if (get_setting('allow_terms_conditions')=='true') {
echo '<div class="actions-title">'; echo '<div class="actions-title">';
echo $tool_name; echo $tool_name;
echo '</div>'; echo '</div>';
if (!empty($term_preview['content'])) if (!empty($term_preview['content'])) {
echo $term_preview['content']; echo $term_preview['content'];
else } else {
echo get_lang('ComingSoon'); echo get_lang('ComingSoon');
}
Display :: display_footer(); Display :: display_footer();
exit; exit;
} }
} }
} }
$action=Security::remove_XSS($_GET['action']); $action = Security::remove_XSS($_GET['action']);
$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin')); $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$tool_name = get_lang('ConfigureInscription'); $tool_name = get_lang('ConfigureInscription');
if(!empty($action)){ if (!empty($action)) {
$interbreadcrumb[]=array('url' => 'configure_inscription.php',"name" => get_lang('ConfigureInscription')); $interbreadcrumb[] = array('url' => 'configure_inscription.php', 'name' => get_lang('ConfigureInscription'));
switch($action){ switch($action) {
case "edit_top": case 'edit_top':
$tool_name=get_lang("EditTopRegister"); $tool_name = get_lang('EditTopRegister');
break; break;
} }
} }
$lang = ''; //el for "Edit Language" $lang = ''; //el for "Edit Language"
if(!empty($_SESSION['user_language_choice'])) { if (!empty($_SESSION['user_language_choice'])) {
$lang=$_SESSION['user_language_choice']; $lang = $_SESSION['user_language_choice'];
} elseif(!empty($_SESSION['_user']['language'])) { } elseif (!empty($_SESSION['_user']['language'])) {
$lang=$_SESSION['_user']['language']; $lang = $_SESSION['_user']['language'];
} else { } else {
$lang=get_setting('platformLanguage'); $lang = get_setting('platformLanguage');
} }
// ----- Ensuring availability of main files in the corresponding language ----- // ----- Ensuring availability of main files in the corresponding language -----
if ($_configuration['multiple_access_urls']==true) { if ($_configuration['multiple_access_urls']) {
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){ if ($access_url_id != -1) {
$url_info = api_get_access_url($access_url_id); $url_info = api_get_access_url($access_url_id);
// "http://" and the final "/" replaced
//$url = substr($url_info['url'],7,strlen($url_info['url'])-8);
$url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url']));
$clean_url = replace_dangerous_char($url); $clean_url = replace_dangerous_char($url);
$clean_url = str_replace('/','-',$clean_url); $clean_url = str_replace('/', '-', $clean_url);
$clean_url .= '/'; $clean_url .= '/';
$homep = '../../home/'; //homep for Home Path $homep = api_get_path(SYS_PATH).'home/'; //homep for Home Path
$homep_new = '../../home/'.$clean_url; //homep for Home Path added the url $homep_new = api_get_path(SYS_PATH).'home/'.$clean_url; //homep for Home Path added the url
$new_url_dir = api_get_path(SYS_PATH).'home/'.$clean_url; $new_url_dir = api_get_path(SYS_PATH).'home/'.$clean_url;
//we create the new dir for the new sites //we create the new dir for the new sites
if (!is_dir($new_url_dir)){ if (!is_dir($new_url_dir)){
@ -93,73 +86,72 @@ if ($_configuration['multiple_access_urls']==true) {
} }
} }
} else { } else {
$homep_new =''; $homep_new = '';
$homep = '../../home/'; //homep for Home Path $homep = api_get_path(SYS_PATH).'home/'; //homep for Home Path
} }
$topf = 'register_top'; //topf for Top File $topf = 'register_top'; //topf for Top File
$ext = '.html'; //ext for HTML Extension - when used frequently, variables are $ext = '.html'; //ext for HTML Extension - when used frequently, variables are
$homef = array($topf); $homef = array($topf);
// If language-specific file does not exist, create it by copying default file // If language-specific file does not exist, create it by copying default file
foreach($homef as $my_file) { foreach ($homef as $my_file) {
if ($_configuration['multiple_access_urls']==true) { if ($_configuration['multiple_access_urls']) {
if (!file_exists($homep_new.$my_file.'_'.$lang.$ext)) { if (!file_exists($homep_new.$my_file.'_'.$lang.$ext)) {
copy($homep.$my_file.$ext,$homep_new.$my_file.'_'.$lang.$ext); copy($homep.$my_file.$ext, $homep_new.$my_file.'_'.$lang.$ext);
} }
} else { } else {
if (!file_exists($homep.$my_file.'_'.$lang.$ext)) { if (!file_exists($homep.$my_file.'_'.$lang.$ext)) {
copy($homep.$my_file.$ext,$homep.$my_file.'_'.$lang.$ext); copy($homep.$my_file.$ext, $homep.$my_file.'_'.$lang.$ext);
} }
} }
} }
if(!empty($action)) { if (!empty($action)) {
if($_POST['formSent']) { if ($_POST['formSent']) {
switch($action) { switch ($action) {
case 'edit_top': case 'edit_top':
// Filter // Filter
$home_top=''; $home_top = '';
if (api_get_setting('wcag_anysurfer_public_pages')=='true') { if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
$home_top=WCAG_Rendering::prepareXHTML(); $home_top = WCAG_Rendering::prepareXHTML();
} else { } else {
$home_top=trim(stripslashes($_POST['register_top'])); $home_top = trim(stripslashes($_POST['register_top']));
} }
// Write // Write
if (file_exists($homep.$topf.'_'.$lang.$ext)) { if (file_exists($homep.$topf.'_'.$lang.$ext)) {
if(is_writable($homep.$topf.'_'.$lang.$ext)) { if (is_writable($homep.$topf.'_'.$lang.$ext)) {
$fp=fopen($homep.$topf.'_'.$lang.$ext,"w"); $fp = fopen($homep.$topf.'_'.$lang.$ext, 'w');
fputs($fp,$home_top); fputs($fp, $home_top);
fclose($fp); fclose($fp);
} else { } else {
$errorMsg=get_lang('HomePageFilesNotWritable'); $errorMsg = get_lang('HomePageFilesNotWritable');
} }
} else { } else {
//File does not exist //File does not exist
$fp=fopen($homep.$topf.'_'.$lang.$ext,"w"); $fp = fopen($homep.$topf.'_'.$lang.$ext, 'w');
fputs($fp,$home_top); fputs($fp, $home_top);
fclose($fp); fclose($fp);
} }
break; break;
} }
if(empty($errorMsg)) { if (empty($errorMsg)) {
header('Location: '.api_get_self()); header('Location: '.api_get_self());
exit(); exit();
} }
} else { } else {
switch($action) { switch ($action) {
case 'edit_top': case 'edit_top':
// This request is only the preparation for the update of the home_top // This request is only the preparation for the update of the home_top
$home_top = ''; $home_top = '';
if(is_file($homep.$topf.'_'.$lang.$ext) && is_readable($homep.$topf.'_'.$lang.$ext)) { if (is_file($homep.$topf.'_'.$lang.$ext) && is_readable($homep.$topf.'_'.$lang.$ext)) {
$home_top=file_get_contents($homep.$topf.'_'.$lang.$ext); $home_top = @(string)file_get_contents($homep.$topf.'_'.$lang.$ext);
} elseif(is_file($homep.$topf.$lang.$ext) && is_readable($homep.$topf.$lang.$ext)) { } elseif (is_file($homep.$topf.$lang.$ext) && is_readable($homep.$topf.$lang.$ext)) {
$home_top=file_get_contents($homep.$topf.$lang.$ext); $home_top = @(string)file_get_contents($homep.$topf.$lang.$ext);
} else { } else {
$errorMsg=get_lang('HomePageFilesNotReadable'); $errorMsg = get_lang('HomePageFilesNotReadable');
} }
$home_top = api_to_system_encoding($home_top, api_detect_encoding(strip_tags($home_top)));
break; break;
} }
} }
@ -176,7 +168,7 @@ if (get_setting('allow_registration') == 'false') {
api_not_allowed(); api_not_allowed();
} }
//api_display_tool_title($tool_name); //api_display_tool_title($tool_name);
if (get_setting('allow_registration')=='approval') { if (get_setting('allow_registration') == 'approval') {
Display::display_normal_message(get_lang('YourAccountHasToBeApproved')); Display::display_normal_message(get_lang('YourAccountHasToBeApproved'));
} }
//if openid was not found //if openid was not found
@ -185,231 +177,232 @@ if (!empty($_GET['openid_msg']) && $_GET['openid_msg'] == 'idnotfound') {
} }
$form = new FormValidator('registration'); $form = new FormValidator('registration');
if (get_setting('allow_terms_conditions')=='true') { if (get_setting('allow_terms_conditions') == 'true') {
if (!isset($_SESSION['update_term_and_condition'][1])) { $display_all_form = !isset($_SESSION['update_term_and_condition'][1]);
$display_all_form=true;
} else {
$display_all_form=false;
}
} else { } else {
$display_all_form=true; $display_all_form = true;
}
if ($display_all_form===true) {
// LAST NAME and FIRST NAME
$form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled'));
$form->applyFilter('lastname','trim');
$form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40, 'disabled' => 'disabled'));
$form->applyFilter('firstname','trim');
$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
// EMAIL
$form->addElement('text', 'email', get_lang('Email'), array('size' => 40, 'disabled' => 'disabled'));
if (api_get_setting('registration', 'email') == 'true')
$form->addRule('email', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('email', get_lang('EmailWrong'), 'email');
if (api_get_setting('openid_authentication')=='true') {
$form->addElement('text', 'openid', get_lang('OpenIDURL'), array('size' => 40, 'disabled' => 'disabled'));
} }
// USERNAME if ($display_all_form) {
$form->addElement('text', 'username', get_lang('UserName'), array('size' => 20, 'disabled' => 'disabled'));
$form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('username', get_lang('UsernameWrong'), 'username');
$form->addRule('username', get_lang('UserTaken'), 'username_available');
$form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'),'20'), 'maxlength',20);
// PASSWORD
$form->addElement('password', 'pass1', get_lang('Pass'), array('size' => 40, 'disabled' => 'disabled'));
$form->addElement('password', 'pass2', get_lang('Confirmation'), array('size' => 40, 'disabled' => 'disabled'));
$form->addRule('pass1', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('pass2', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule(array('pass1', 'pass2'), get_lang('PassTwo'), 'compare');
if (CHECK_PASS_EASY_TO_FIND)
$form->addRule('password1', get_lang('PassTooEasy').': '.api_generate_password(), 'callback', 'api_check_password');
// PHONE
$form->addElement('text', 'phone', get_lang('Phone'), array('size' => 40, 'disabled' => 'disabled'));
if (api_get_setting('registration', 'phone') == 'true')
$form->addRule('phone', get_lang('ThisFieldIsRequired'), 'required');
// LANGUAGE
if (get_setting('registration', 'language') == 'true') {
$form->addElement('select_language', 'language', get_lang('Language'), '', array('disabled' => 'disabled'));
}
// STUDENT/TEACHER
if (get_setting('allow_registration_as_teacher') <> 'false') {
$form->addElement('radio', 'status', get_lang('Status'), get_lang('RegStudent'), STUDENT, array('disabled' => 'disabled'));
$form->addElement('radio', 'status', null, get_lang('RegAdmin'), COURSEMANAGER, array('disabled' => 'disabled'));
}
// EXTENDED FIELDS if (api_is_western_name_order()) {
if (api_get_setting('extended_profile') == 'true' AND api_get_setting('extendedprofile_registration','mycomptetences') == 'true') // FIRST NAME and LAST NAME
{ $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled'));
$form->add_html_editor('competences', get_lang('MyCompetences'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130')); $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40, 'disabled' => 'disabled'));
} } else {
if (api_get_setting('extended_profile') == 'true' AND api_get_setting('extendedprofile_registration','mydiplomas') == 'true') // LAST NAME and FIRST NAME
{ $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled'));
$form->add_html_editor('diplomas', get_lang('MyDiplomas'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130')); $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40, 'disabled' => 'disabled'));
}
if (api_get_setting('extended_profile') == 'true' AND api_get_setting('extendedprofile_registration','myteach') == 'true')
{
$form->add_html_editor('teach', get_lang('MyTeach'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
}
if (api_get_setting('extended_profile') == 'true' AND api_get_setting('extendedprofile_registration','mypersonalopenarea') == 'true')
{
$form->add_html_editor('openarea', get_lang('MyPersonalOpenArea'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
}
if (api_get_setting('extended_profile') == 'true')
{
if (api_get_setting('extendedprofile_registrationrequired','mycomptetences') == 'true')
{
$form->addRule('competences', get_lang('ThisFieldIsRequired'), 'required');
} }
if (api_get_setting('extendedprofile_registrationrequired','mydiplomas') == 'true') $form->applyFilter('firstname', 'trim');
{ $form->applyFilter('lastname', 'trim');
$form->addRule('diplomas', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
// EMAIL
$form->addElement('text', 'email', get_lang('Email'), array('size' => 40, 'disabled' => 'disabled'));
if (api_get_setting('registration', 'email') == 'true') {
$form->addRule('email', get_lang('ThisFieldIsRequired'), 'required');
} }
if (api_get_setting('extendedprofile_registrationrequired','myteach') == 'true') $form->addRule('email', get_lang('EmailWrong'), 'email');
{ if (api_get_setting('openid_authentication') == 'true') {
$form->addRule('teach', get_lang('ThisFieldIsRequired'), 'required'); $form->addElement('text', 'openid', get_lang('OpenIDURL'), array('size' => 40, 'disabled' => 'disabled'));
} }
if (api_get_setting('extendedprofile_registrationrequired','mypersonalopenarea') == 'true')
{ // USERNAME
$form->addRule('openarea', get_lang('ThisFieldIsRequired'), 'required'); $form->addElement('text', 'username', get_lang('UserName'), array('size' => USERNAME_MAX_LENGTH, 'disabled' => 'disabled'));
$form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('username', get_lang('UsernameWrong'), 'username');
$form->addRule('username', get_lang('UserTaken'), 'username_available');
$form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
// PASSWORD
$form->addElement('password', 'pass1', get_lang('Pass'), array('size' => 40, 'disabled' => 'disabled'));
$form->addElement('password', 'pass2', get_lang('Confirmation'), array('size' => 40, 'disabled' => 'disabled'));
$form->addRule('pass1', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('pass2', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule(array('pass1', 'pass2'), get_lang('PassTwo'), 'compare');
if (CHECK_PASS_EASY_TO_FIND) {
$form->addRule('password1', get_lang('PassTooEasy').': '.api_generate_password(), 'callback', 'api_check_password');
} }
}
// EXTRA FIELDS // PHONE
$extra = UserManager::get_extra_fields(0,50,5,'ASC'); $form->addElement('text', 'phone', get_lang('Phone'), array('size' => 40, 'disabled' => 'disabled'));
$extra_data = UserManager::get_extra_user_data(api_get_user_id(),true); if (api_get_setting('registration', 'phone') == 'true') {
foreach ($extra as $id => $field_details) { $form->addRule('phone', get_lang('ThisFieldIsRequired'), 'required');
if ($field_details[6] == 0) { }
continue;
// LANGUAGE
if (get_setting('registration', 'language') == 'true') {
$form->addElement('select_language', 'language', get_lang('Language'), '', array('disabled' => 'disabled'));
}
// STUDENT/TEACHER
if (get_setting('allow_registration_as_teacher') != 'false') {
$form->addElement('radio', 'status', get_lang('Status'), get_lang('RegStudent'), STUDENT, array('disabled' => 'disabled'));
$form->addElement('radio', 'status', null, get_lang('RegAdmin'), COURSEMANAGER, array('disabled' => 'disabled'));
} }
switch($field_details[2]) {
case USER_FIELD_TYPE_TEXT:
$form->addElement('text', 'extra_'.$field_details[1], $field_details[3], array('size' => 40));
$form->applyFilter('extra_'.$field_details[1], 'stripslashes');
$form->applyFilter('extra_'.$field_details[1], 'trim');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
case USER_FIELD_TYPE_TEXTAREA:
$form->add_html_editor('extra_'.$field_details[1], $field_details[3], false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
//$form->addElement('textarea', 'extra_'.$field_details[1], $field_details[3], array('size' => 80));
$form->applyFilter('extra_'.$field_details[1], 'stripslashes');
$form->applyFilter('extra_'.$field_details[1], 'trim');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
case USER_FIELD_TYPE_RADIO:
$group = array();
foreach ($field_details[9] as $option_id => $option_details) {
$options[$option_details[1]] = $option_details[2];
$group[] =& HTML_QuickForm::createElement('radio', 'extra_'.$field_details[1], $option_details[1],$option_details[2].'<br />',$option_details[1]);
}
$form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], '');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
case USER_FIELD_TYPE_SELECT:
$options = array();
foreach($field_details[9] as $option_id => $option_details) {
$options[$option_details[1]] = $option_details[2];
}
$form->addElement('select','extra_'.$field_details[1],$field_details[3],$options,'');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
case USER_FIELD_TYPE_SELECT_MULTIPLE:
$options = array();
foreach ($field_details[9] as $option_id => $option_details) {
$options[$option_details[1]] = $option_details[2];
}
$form->addElement('select','extra_'.$field_details[1],$field_details[3],$options,array('multiple' => 'multiple'));
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
case USER_FIELD_TYPE_DATE:
$form->addElement('datepickerdate', 'extra_'.$field_details[1], $field_details[3],array('form_name'=>'registration'));
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
$form->applyFilter('theme', 'trim');
break;
case USER_FIELD_TYPE_DATETIME:
$form->addElement('datepicker', 'extra_'.$field_details[1], $field_details[3],array('form_name'=>'registration'));
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
$form->applyFilter('theme', 'trim');
break;
case USER_FIELD_TYPE_DOUBLE_SELECT:
foreach ($field_details[9] as $key=>$element) {
if ($element[2][0] == '*') {
$values['*'][$element[0]] = str_replace('*','',$element[2]);
} else {
$values[0][$element[0]] = $element[2];
}
}
$group=''; // EXTENDED FIELDS
$group[] =& HTML_QuickForm::createElement('select', 'extra_'.$field_details[1],'',$values[0],''); if (api_get_setting('extended_profile') == 'true' && api_get_setting('extendedprofile_registration','mycomptetences') == 'true') {
$group[] =& HTML_QuickForm::createElement('select', 'extra_'.$field_details[1].'*','',$values['*'],''); $form->add_html_editor('competences', get_lang('MyCompetences'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
$form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], '&nbsp;'); }
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]); if (api_get_setting('extended_profile') == 'true' && api_get_setting('extendedprofile_registration','mydiplomas') == 'true') {
$form->add_html_editor('diplomas', get_lang('MyDiplomas'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
// recoding the selected values for double : if the user has selected certain values, we have to assign them to the correct select form }
if (key_exists('extra_'.$field_details[1], $extra_data)) { if (api_get_setting('extended_profile') == 'true' && api_get_setting('extendedprofile_registration','myteach') == 'true') {
// exploding all the selected values (of both select forms) $form->add_html_editor('teach', get_lang('MyTeach'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
$selected_values = explode(';',$extra_data['extra_'.$field_details[1]]); }
$extra_data['extra_'.$field_details[1]] =array(); if (api_get_setting('extended_profile') == 'true' && api_get_setting('extendedprofile_registration','mypersonalopenarea') == 'true') {
$form->add_html_editor('openarea', get_lang('MyPersonalOpenArea'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
// looping through the selected values and assigning the selected values to either the first or second select form }
foreach ($selected_values as $key=>$selected_value) { if (api_get_setting('extended_profile') == 'true') {
if (key_exists($selected_value,$values[0])) { if (api_get_setting('extendedprofile_registrationrequired', 'mycomptetences') == 'true') {
$extra_data['extra_'.$field_details[1]]['extra_'.$field_details[1]] = $selected_value; $form->addRule('competences', get_lang('ThisFieldIsRequired'), 'required');
}
if (api_get_setting('extendedprofile_registrationrequired', 'mydiplomas') == 'true') {
$form->addRule('diplomas', get_lang('ThisFieldIsRequired'), 'required');
}
if (api_get_setting('extendedprofile_registrationrequired', 'myteach') == 'true') {
$form->addRule('teach', get_lang('ThisFieldIsRequired'), 'required');
}
if (api_get_setting('extendedprofile_registrationrequired', 'mypersonalopenarea') == 'true') {
$form->addRule('openarea', get_lang('ThisFieldIsRequired'), 'required');
}
}
// EXTRA FIELDS
$extra = UserManager::get_extra_fields(0, 50, 5, 'ASC');
$extra_data = UserManager::get_extra_user_data(api_get_user_id(), true);
foreach ($extra as $id => $field_details) {
if ($field_details[6] == 0) {
continue;
}
switch($field_details[2]) {
case USER_FIELD_TYPE_TEXT:
$form->addElement('text', 'extra_'.$field_details[1], $field_details[3], array('size' => 40));
$form->applyFilter('extra_'.$field_details[1], 'stripslashes');
$form->applyFilter('extra_'.$field_details[1], 'trim');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
case USER_FIELD_TYPE_TEXTAREA:
$form->add_html_editor('extra_'.$field_details[1], $field_details[3], false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
//$form->addElement('textarea', 'extra_'.$field_details[1], $field_details[3], array('size' => 80));
$form->applyFilter('extra_'.$field_details[1], 'stripslashes');
$form->applyFilter('extra_'.$field_details[1], 'trim');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
case USER_FIELD_TYPE_RADIO:
$group = array();
foreach ($field_details[9] as $option_id => $option_details) {
$options[$option_details[1]] = $option_details[2];
$group[] =& HTML_QuickForm::createElement('radio', 'extra_'.$field_details[1], $option_details[1],$option_details[2].'<br />',$option_details[1]);
}
$form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], '');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
case USER_FIELD_TYPE_SELECT:
$options = array();
foreach($field_details[9] as $option_id => $option_details) {
$options[$option_details[1]] = $option_details[2];
}
$form->addElement('select','extra_'.$field_details[1], $field_details[3], $options, '');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
case USER_FIELD_TYPE_SELECT_MULTIPLE:
$options = array();
foreach ($field_details[9] as $option_id => $option_details) {
$options[$option_details[1]] = $option_details[2];
}
$form->addElement('select','extra_'.$field_details[1], $field_details[3], $options, array('multiple' => 'multiple'));
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
case USER_FIELD_TYPE_DATE:
$form->addElement('datepickerdate', 'extra_'.$field_details[1], $field_details[3], array('form_name' => 'registration'));
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear', 1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
$form->applyFilter('theme', 'trim');
break;
case USER_FIELD_TYPE_DATETIME:
$form->addElement('datepicker', 'extra_'.$field_details[1], $field_details[3], array('form_name' => 'registration'));
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear', 1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
$form->applyFilter('theme', 'trim');
break;
case USER_FIELD_TYPE_DOUBLE_SELECT:
foreach ($field_details[9] as $key => $element) {
if ($element[2][0] == '*') {
$values['*'][$element[0]] = str_replace('*', '', $element[2]);
} else { } else {
$extra_data['extra_'.$field_details[1]]['extra_'.$field_details[1].'*'] = $selected_value; $values[0][$element[0]] = $element[2];
} }
} }
}
break; $group = '';
case USER_FIELD_TYPE_DIVIDER: $group[] =& HTML_QuickForm::createElement('select', 'extra_'.$field_details[1], '', $values[0], '');
$form->addElement('static',$field_details[1], '<br /><strong>'.$field_details[3].'</strong>'); $group[] =& HTML_QuickForm::createElement('select', 'extra_'.$field_details[1].'*', '', $values['*'], '');
break; $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], '&nbsp;');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
// recoding the selected values for double : if the user has selected certain values, we have to assign them to the correct select form
if (key_exists('extra_'.$field_details[1], $extra_data)) {
// exploding all the selected values (of both select forms)
$selected_values = explode(';', $extra_data['extra_'.$field_details[1]]);
$extra_data['extra_'.$field_details[1]] = array();
// looping through the selected values and assigning the selected values to either the first or second select form
foreach ($selected_values as $key => $selected_value) {
if (key_exists($selected_value,$values[0])) {
$extra_data['extra_'.$field_details[1]]['extra_'.$field_details[1]] = $selected_value;
} else {
$extra_data['extra_'.$field_details[1]]['extra_'.$field_details[1].'*'] = $selected_value;
}
}
}
break;
case USER_FIELD_TYPE_DIVIDER:
$form->addElement('static', $field_details[1], '<br /><strong>'.$field_details[3].'</strong>');
break;
}
} }
}
} }
//------------ Terms and conditions
if (get_setting('allow_terms_conditions')=='true') { // Terms and conditions
//$language = api_get_setting('platformLanguage'); if (get_setting('allow_terms_conditions') == 'true') {
$language = api_get_interface_language(); $language = api_get_interface_language();
$language = api_get_language_id($language); $language = api_get_language_id($language);
$term_preview= LegalManager::get_last_condition($language); $term_preview = LegalManager::get_last_condition($language);
if ($term_preview==false) { if (!$term_preview) {
//we load from the platform //we load from the platform
$language = api_get_setting('platformLanguage'); $language = api_get_setting('platformLanguage');
$language = api_get_language_id($language); $language = api_get_language_id($language);
$term_preview= LegalManager::get_last_condition($language); $term_preview = LegalManager::get_last_condition($language);
//if is false we load from english //if is false we load from english
if ($term_preview==false){ if (!$term_preview) {
$language = api_get_language_id('english'); //this must work $language = api_get_language_id('english'); //this must work
$term_preview= LegalManager::get_last_condition($language); $term_preview = LegalManager::get_last_condition($language);
} }
} }
// Version and language //password // Version and language //password
$form->addElement('hidden', 'legal_accept_type',$term_preview['version'].':'.$term_preview['language_id']); $form->addElement('hidden', 'legal_accept_type', $term_preview['version'].':'.$term_preview['language_id']);
$form->addElement('hidden', 'legal_info',$term_preview['legal_id'].':'.$term_preview['language_id']); $form->addElement('hidden', 'legal_info', $term_preview['legal_id'].':'.$term_preview['language_id']);
if (isset($_SESSION['info_current_user'][1]) && isset($_SESSION['info_current_user'][2])) { if (isset($_SESSION['info_current_user'][1]) && isset($_SESSION['info_current_user'][2])) {
$form->addElement('hidden', 'login',$_SESSION['info_current_user'][1]); $form->addElement('hidden', 'login', $_SESSION['info_current_user'][1]);
$form->addElement('hidden', 'password',$_SESSION['info_current_user'][2]); $form->addElement('hidden', 'password', $_SESSION['info_current_user'][2]);
} }
if($term_preview['type'] == 1) { if ($term_preview['type'] == 1) {
$form->addElement('checkbox', 'legal_accept', null, get_lang('IHaveReadAndAgree').'&nbsp;<a href="inscription.php?legal" target="_blank">'.get_lang('TermsAndConditions').'</a>'); $form->addElement('checkbox', 'legal_accept', null, get_lang('IHaveReadAndAgree').'&nbsp;<a href="inscription.php?legal" target="_blank">'.get_lang('TermsAndConditions').'</a>');
$form->addRule('extra_legal_accept', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('extra_legal_accept', get_lang('ThisFieldIsRequired'), 'required');
} else { } else {
if (!empty($term_preview['content'])) { if (!empty($term_preview['content'])) {
$preview = LegalManager::show_last_condition($term_preview); $preview = LegalManager::show_last_condition($term_preview);
$term_preview = '<div class="row"> $term_preview = '<div class="row">
<div class="label">'.get_lang('TermsAndConditions').'</div> <div class="label">'.get_lang('TermsAndConditions').'</div>
<div class="formw"> <div class="formw">
'.$preview.' '.$preview.'
@ -421,58 +414,58 @@ if (get_setting('allow_terms_conditions')=='true') {
} }
} }
$form->addElement('style_submit_button', 'submit', get_lang('RegisterUser'),array('class' => 'save', 'disabled' => 'disabled')); $form->addElement('style_submit_button', 'submit', get_lang('RegisterUser'), array('class' => 'save', 'disabled' => 'disabled'));
$defaults['status'] = STUDENT; $defaults['status'] = STUDENT;
$form->setDefaults($defaults);
if(isset($_SESSION["user_language_choice"]) && $_SESSION["user_language_choice"]!=""){ if (isset($_SESSION['user_language_choice']) && $_SESSION['user_language_choice'] != '') {
$defaults['language'] = $_SESSION["user_language_choice"]; $defaults['language'] = $_SESSION['user_language_choice'];
} } else {
else{
$defaults['language'] = api_get_setting('platformLanguage'); $defaults['language'] = api_get_setting('platformLanguage');
} }
if(!empty($_GET['username']))
{ if (!empty($_GET['username'])) {
$defaults['username'] = Security::remove_XSS($_GET['username']); $defaults['username'] = Security::remove_XSS($_GET['username']);
} }
if(!empty($_GET['email']))
{ if (!empty($_GET['email'])) {
$defaults['email'] = Security::remove_XSS($_GET['email']); $defaults['email'] = Security::remove_XSS($_GET['email']);
} }
if(!empty($_GET['phone'])) if (!empty($_GET['phone'])) {
{
$defaults['phone'] = Security::remove_XSS($_GET['phone']); $defaults['phone'] = Security::remove_XSS($_GET['phone']);
} }
if (api_get_setting('openid_authentication')=='true' && !empty($_GET['openid'])) if (api_get_setting('openid_authentication') == 'true' && !empty($_GET['openid'])) {
{
$defaults['openid'] = Security::remove_XSS($_GET['openid']); $defaults['openid'] = Security::remove_XSS($_GET['openid']);
} }
switch($action){ $form->setDefaults($defaults);
switch ($action){
case 'edit_top': case 'edit_top':
if($action == 'edit_top') { if ($action == 'edit_top') {
$name= $topf; $name = $topf;
$open = $home_top; $open = $home_top;
} else { } else {
$name = $newsf; $name = $newsf;
$open=@file_get_contents($homep.$newsf.'_'.$lang.$ext); $open = @(string)file_get_contents($homep.$newsf.'_'.$lang.$ext);
$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
} }
if(!empty($errorMsg)) { if (!empty($errorMsg)) {
Display::display_normal_message($errorMsg); //main API Display::display_normal_message($errorMsg);
} }
$default = array(); $default = array();
$form = new FormValidator('configure_homepage_'.$action, 'post', api_get_self().'?action='.$action, '', array('style' => 'margin: 0px;')); $form = new FormValidator('configure_inscription_'.$action, 'post', api_get_self().'?action='.$action, '', array('style' => 'margin: 0px;'));
$renderer =& $form->defaultRenderer(); $renderer =& $form->defaultRenderer();
$renderer->setHeaderTemplate(''); $renderer->setHeaderTemplate('');
$renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>'); $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>');
$renderer->setElementTemplate('<tr><td>{element}</td></tr>'); $renderer->setElementTemplate('<tr><td>{element}</td></tr>');
$renderer->setRequiredNoteTemplate(''); $renderer->setRequiredNoteTemplate('');
$form->addElement('hidden', 'formSent', '1'); $form->addElement('hidden', 'formSent', '1');
if (api_get_setting('wcag_anysurfer_public_pages')=='true') { if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
//TODO: review these lines //TODO: review these lines
// Print WCAG-specific HTML editor // Print WCAG-specific HTML editor
$html = '<tr><td>'; $html = '<tr><td>';
@ -488,30 +481,22 @@ switch($action){
$form->display(); $form->display();
break; break;
default: default:
/*******************************/
//Form of language //Form of language
api_display_language_form(); api_display_language_form();
echo '&nbsp;&nbsp;<a href="'.api_get_self().'?action=edit_top">'.Display::display_icon('edit.gif', get_lang('Edit')).'</a> <a href="'.api_get_self().'?action=edit_top">'.get_lang('EditNotice').'</a>'; echo '&nbsp;&nbsp;<a href="'.api_get_self().'?action=edit_top">'.Display::display_icon('edit.gif', get_lang('Edit')).'</a> <a href="'.api_get_self().'?action=edit_top">'.get_lang('EditNotice').'</a>';
echo '<div class="note">'; //echo '<div class="note">';
$home_notice = ''; echo '<div style="border:1px solid #E1E1E1; padding:2px;">';
if(file_exists($homep.$topf.'_'.$lang.$ext)) { $open = '';
$home_notice = @file_get_contents($homep.$topf.'_'.$lang.$ext); if (file_exists($homep.$topf.'_'.$lang.$ext)) {
$open = @(string)file_get_contents($homep.$topf.'_'.$lang.$ext);
} else { } else {
$home_notice = @file_get_contents($homep.$topf.$ext); $open = @(string)file_get_contents($homep.$topf.$ext);
} }
echo $home_notice; $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
echo $open;
echo '</div>'; echo '</div>';
/*******************************/
$form->display(); $form->display();
break; break;
} }
/*
==============================================================================
FOOTER
==============================================================================
*/
Display :: display_footer(); Display :: display_footer();
?>

@ -72,7 +72,7 @@ function search_users($needle,$type) {
} }
$sql = "SELECT user_id, username, lastname, firstname FROM $tbl_user user $sql = "SELECT user_id, username, lastname, firstname FROM $tbl_user user
WHERE ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND user_id NOT IN ($user_anonymous, $current_user_id, $hrm_id) $without_assigned_users"; WHERE ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND status<>".DRH." AND user_id NOT IN ($user_anonymous, $current_user_id, $hrm_id) $without_assigned_users";
$rs = Database::query($sql); $rs = Database::query($sql);
$return .= '<select id="origin" name="NoAssignedUsersList[]" multiple="multiple" size="20" style="width:340px;">'; $return .= '<select id="origin" name="NoAssignedUsersList[]" multiple="multiple" size="20" style="width:340px;">';
@ -179,7 +179,7 @@ if (isset($_POST['firstLetterUser'])) {
} }
$sql = "SELECT user_id, username, lastname, firstname FROM $tbl_user user $sql = "SELECT user_id, username, lastname, firstname FROM $tbl_user user
WHERE $without_assigned_users user_id NOT IN ($user_anonymous, $current_user_id, $hrm_id) $search_user "; WHERE $without_assigned_users user_id NOT IN ($user_anonymous, $current_user_id, $hrm_id) AND status<>".DRH." $search_user ";
$result = Database::query($sql); $result = Database::query($sql);
?> ?>

@ -21,7 +21,7 @@ if ($action == 'calendar_add') {
} }
echo '</div>'; echo '</div>';
$message_information = get_lang('informationAttendanceCalendar'); $message_information = get_lang('AttendanceCalendarDescription');
if (!empty($message_information)) { if (!empty($message_information)) {
$message = '<strong>'.get_lang('Information').'</strong><br />'; $message = '<strong>'.get_lang('Information').'</strong><br />';

@ -1,12 +1,11 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
============================================================================== * This script displays a form for registering new users.
* This script displays a form for registering new users. * @package chamilo.auth
* @package dokeos.auth */
==============================================================================
*/
// name of the language file that needs to be included
$language_file = array('registration', 'admin'); $language_file = array('registration', 'admin');
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
@ -17,16 +16,11 @@ require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php'; require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'legal.lib.php'; require_once api_get_path(LIBRARY_PATH).'legal.lib.php';
//require_once(api_get_path(LIBRARY_PATH).'fileManage.lib.php');
//require_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
//require_once (api_get_path(LIBRARY_PATH).'image.lib.php');
// Load terms & conditions from the current lang // Load terms & conditions from the current lang
if (api_get_setting('allow_terms_conditions') == 'true') { if (api_get_setting('allow_terms_conditions') == 'true') {
$get = array_keys($_GET); $get = array_keys($_GET);
if (isset($get)) { if (isset($get)) {
if ($get[0] == 'legal'){ if ($get[0] == 'legal'){
//$language = api_get_setting('platformLanguage');
$language = api_get_interface_language(); $language = api_get_interface_language();
$language = api_get_language_id($language); $language = api_get_language_id($language);
$term_preview = LegalManager::get_last_condition($language); $term_preview = LegalManager::get_last_condition($language);
@ -59,40 +53,34 @@ echo '<div class="actions-title">';
echo $tool_name; echo $tool_name;
echo '</div>'; echo '</div>';
/****************/ $home = api_get_path(SYS_PATH).'home/';
if ($_configuration['multiple_access_urls']) {
//Header of Configure Inscription
$home= '../../home/';
if ($_configuration['multiple_access_urls']==true) {
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){ if ($access_url_id != -1) {
$url_info = api_get_access_url($access_url_id); $url_info = api_get_access_url($access_url_id);
// "http://" and the final "/" replaced
//$url = substr($url_info['url'],7,strlen($url_info['url'])-8);
$url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url']));
$clean_url = replace_dangerous_char($url); $clean_url = replace_dangerous_char($url);
$clean_url = str_replace('/','-',$clean_url); $clean_url = str_replace('/','-',$clean_url);
$clean_url .= '/'; $clean_url .= '/';
$home_old = '../../home/'; $home_old = api_get_path(SYS_PATH).'home/';
$home= '../../home/'.$clean_url; $home = api_get_path(SYS_PATH).'home/'.$clean_url;
} }
} }
if (!empty($_SESSION['user_language_choice'])) { if (!empty($_SESSION['user_language_choice'])) {
$user_selected_language=$_SESSION['user_language_choice']; $user_selected_language = $_SESSION['user_language_choice'];
} elseif(!empty($_SESSION['_user']['language'])) { } elseif (!empty($_SESSION['_user']['language'])) {
$user_selected_language=$_SESSION['_user']['language']; $user_selected_language = $_SESSION['_user']['language'];
} else { } else {
$user_selected_language=get_setting('platformLanguage'); $user_selected_language = get_setting('platformLanguage');
} }
if(file_exists($home.'register_top_'.$user_selected_language.'.html')) { if (file_exists($home.'register_top_'.$user_selected_language.'.html')) {
$home_top_temp = file_get_contents($home.'register_top_'.$user_selected_language.'.html'); $home_top_temp = @(string)file_get_contents($home.'register_top_'.$user_selected_language.'.html');
$open=str_replace('{rel_path}',api_get_path(REL_PATH),$home_top_temp); $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
echo '<div style="border:1px solid #E1E1E1; padding:2px;">'.$open.'</div>'; echo '<div style="border:1px solid #E1E1E1; padding:2px;">'.$open.'</div>';
} }
/****************/
// Forbidden to self-register // Forbidden to self-register
if (api_get_setting('allow_registration') == 'false') { if (api_get_setting('allow_registration') == 'false') {
@ -110,15 +98,12 @@ if (!empty($_GET['openid_msg']) && $_GET['openid_msg'] == 'idnotfound') {
$form = new FormValidator('registration'); $form = new FormValidator('registration');
if (api_get_setting('allow_terms_conditions') == 'true') { if (api_get_setting('allow_terms_conditions') == 'true') {
if (!isset($_SESSION['update_term_and_condition'][1])) { $display_all_form = !isset($_SESSION['update_term_and_condition'][1]);
$display_all_form = true;
} else {
$display_all_form = false;
}
} else { } else {
$display_all_form = true; $display_all_form = true;
} }
if ($display_all_form === true) {
if ($display_all_form) {
if (api_is_western_name_order()) { if (api_is_western_name_order()) {
// FIRST NAME and LAST NAME // FIRST NAME and LAST NAME
@ -141,14 +126,14 @@ if ($display_all_form === true) {
if (api_get_setting('openid_authentication') == 'true') { if (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));
} }
/* // Enabled by Ivan Tcholakov, 06-APR-2009. CONFVAL_ASK_FOR_OFFICIAL_CODE = false by default.
// 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('registration', 'officialcode') == 'true') if (api_get_setting('registration', 'officialcode') == 'true')
$form->addRule('official_code', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('official_code', get_lang('ThisFieldIsRequired'), 'required');
} }
*/ //
// USERNAME // USERNAME
$form->addElement('text', 'username', get_lang('UserName'), array('size' => USERNAME_MAX_LENGTH)); $form->addElement('text', 'username', get_lang('UserName'), array('size' => USERNAME_MAX_LENGTH));
$form->applyFilter('username','trim'); $form->applyFilter('username','trim');
@ -316,13 +301,12 @@ if ($display_all_form === true) {
} }
} }
//------------ Terms and conditions
// Terms and conditions
if (api_get_setting('allow_terms_conditions') == 'true') { if (api_get_setting('allow_terms_conditions') == 'true') {
//$language = api_get_setting('platformLanguage');
$language = api_get_interface_language(); $language = api_get_interface_language();
$language = api_get_language_id($language); $language = api_get_language_id($language);
$term_preview = LegalManager::get_last_condition($language); $term_preview = LegalManager::get_last_condition($language);
if (!$term_preview) { if (!$term_preview) {
//we load from the platform //we load from the platform
$language = api_get_setting('platformLanguage'); $language = api_get_setting('platformLanguage');
@ -334,14 +318,15 @@ if (api_get_setting('allow_terms_conditions') == 'true') {
$term_preview = LegalManager::get_last_condition($language); $term_preview = LegalManager::get_last_condition($language);
} }
} }
// Version and language //password // Version and language
$form->addElement('hidden', 'legal_accept_type', $term_preview['version'].':'.$term_preview['language_id']); $form->addElement('hidden', 'legal_accept_type', $term_preview['version'].':'.$term_preview['language_id']);
$form->addElement('hidden', 'legal_info', $term_preview['legal_id'].':'.$term_preview['language_id']); $form->addElement('hidden', 'legal_info', $term_preview['legal_id'].':'.$term_preview['language_id']);
// Password
if (isset($_SESSION['info_current_user'][1]) && isset($_SESSION['info_current_user'][2])) { if (isset($_SESSION['info_current_user'][1]) && isset($_SESSION['info_current_user'][2])) {
$form->addElement('hidden', 'login',$_SESSION['info_current_user'][1]); $form->addElement('hidden', 'login', $_SESSION['info_current_user'][1]);
$form->addElement('hidden', 'password',$_SESSION['info_current_user'][2]); $form->addElement('hidden', 'password', $_SESSION['info_current_user'][2]);
} }
if($term_preview['type'] == 1) { if ($term_preview['type'] == 1) {
$form->addElement('checkbox', 'legal_accept', null, get_lang('IHaveReadAndAgree').'&nbsp;<a href="inscription.php?legal" target="_blank">'.get_lang('TermsAndConditions').'</a>'); $form->addElement('checkbox', 'legal_accept', null, get_lang('IHaveReadAndAgree').'&nbsp;<a href="inscription.php?legal" target="_blank">'.get_lang('TermsAndConditions').'</a>');
$form->addRule('extra_legal_accept', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('extra_legal_accept', get_lang('ThisFieldIsRequired'), 'required');
} else { } else {
@ -389,9 +374,9 @@ if (is_array($extra_data)) {
$form->setDefaults($defaults); $form->setDefaults($defaults);
if ($form->validate()) { if ($form->validate()) {
/*----------------------------------------------------- /*
STORE THE NEW USER DATA INSIDE THE MAIN DOKEOS DATABASE STORE THE NEW USER DATA INSIDE THE MAIN DOKEOS DATABASE
-----------------------------------------------------*/ */
$values = $form->exportValues(); $values = $form->exportValues();
$values['username'] = api_substr($values['username'], 0, USERNAME_MAX_LENGTH); //make *sure* the login isn't too long $values['username'] = api_substr($values['username'], 0, USERNAME_MAX_LENGTH); //make *sure* the login isn't too long
@ -399,6 +384,11 @@ if ($form->validate()) {
if (api_get_setting('allow_registration_as_teacher') == 'false') { if (api_get_setting('allow_registration_as_teacher') == 'false') {
$values['status'] = STUDENT; $values['status'] = STUDENT;
} }
// Added by Ivan Tcholakov, 06-MAR-2008.
if (empty($values['official_code'])) {
$values['official_code'] = api_strtoupper($values['username']);
}
//
// creating a new user // creating a new user
$user_id = UserManager::create_user($values['firstname'], $values['lastname'], $values['status'], $values['email'], $values['username'], $values['pass1'], $values['official_code'], $values['language'], $values['phone'], $picture_uri); $user_id = UserManager::create_user($values['firstname'], $values['lastname'], $values['status'], $values['email'], $values['username'], $values['pass1'], $values['official_code'], $values['language'], $values['phone'], $picture_uri);
@ -416,7 +406,7 @@ if ($form->validate()) {
} }
} }
/****** register extra fields*************/ // Register extra fields
$extras = array(); $extras = array();
foreach ($values as $key => $value) { foreach ($values as $key => $value) {
if (substr($key, 0, 6) == 'extra_') { //an extra field if (substr($key, 0, 6) == 'extra_') { //an extra field
@ -433,7 +423,6 @@ if ($form->validate()) {
} }
} }
/********************************************/
if ($user_id) { if ($user_id) {
// storing the extended profile // storing the extended profile
$store_extended = false; $store_extended = false;
@ -510,9 +499,9 @@ if ($form->validate()) {
exit; exit;
} }
/*-------------------------------------- /*
SESSION REGISTERING SESSION REGISTERING
--------------------------------------*/ */
$_user['firstName'] = stripslashes($values['firstname']); $_user['firstName'] = stripslashes($values['firstname']);
$_user['lastName'] = stripslashes($values['lastname']); $_user['lastName'] = stripslashes($values['lastname']);
$_user['mail'] = $values['email']; $_user['mail'] = $values['email'];
@ -529,9 +518,9 @@ if ($form->validate()) {
api_session_register('user_last_login_datetime'); api_session_register('user_last_login_datetime');
/*-------------------------------------- /*
EMAIL NOTIFICATION EMAIL NOTIFICATION
--------------------------------------*/ */
if (strpos($values['email'], '@') !== false) { if (strpos($values['email'], '@') !== false) {
// Let us predefine some variables. Be sure to change the from address! // Let us predefine some variables. Be sure to change the from address!
@ -539,7 +528,7 @@ if ($form->validate()) {
$email = $values['email']; $email = $values['email'];
$emailfromaddr = api_get_setting('emailAdministrator'); $emailfromaddr = api_get_setting('emailAdministrator');
$emailfromname = api_get_setting('siteName'); $emailfromname = api_get_setting('siteName');
$emailsubject = "[".api_get_setting('siteName')."] ".get_lang('YourReg')." ".api_get_setting('siteName'); $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
// The body can be as long as you wish, and any combination of text and variables // The body can be as long as you wish, and any combination of text and variables
$portal_url = $_configuration['root_web']; $portal_url = $_configuration['root_web'];
@ -551,7 +540,7 @@ if ($form->validate()) {
} }
} }
$emailbody = get_lang('Dear')." ".stripslashes(Security::remove_XSS($recipient_name)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName')." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ".$values['username']."\n".get_lang('Pass')." : ".stripslashes($values['pass1'])."\n\n".get_lang('Address')." ".api_get_setting('siteName')." ".get_lang('Is')." : ".$portal_url."\n\n".get_lang('Problem')."\n\n".get_lang('Formula').",\n\n".api_get_setting('administratorName')." ".api_get_setting('administratorSurname')."\n".get_lang('Manager')." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email')." : ".api_get_setting('emailAdministrator'); $emailbody = get_lang('Dear').' '.stripslashes(Security::remove_XSS($recipient_name)).",\n\n".get_lang('YouAreReg').' '.api_get_setting('siteName').' '.get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username').' : '.$values['username']."\n".get_lang('Pass').' : '.stripslashes($values['pass1'])."\n\n".get_lang('Address').' '.api_get_setting('siteName').' '.get_lang('Is').' : '.$portal_url."\n\n".get_lang('Problem')."\n\n".get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager').' '.api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email').' : '.api_get_setting('emailAdministrator');
// Here we are forming one large header line // Here we are forming one large header line
// Every header must be followed by a \n except the last // Every header must be followed by a \n except the last
@ -561,29 +550,29 @@ if ($form->validate()) {
} }
} }
echo "<p>".get_lang('Dear')." ".stripslashes(Security::remove_XSS($recipient_name)).",<br /><br />".get_lang('PersonalSettings').".</p>\n"; echo '<p>'.get_lang('Dear').' '.stripslashes(Security::remove_XSS($recipient_name)).',<br /><br />'.get_lang('PersonalSettings').".</p>\n";
if (!empty ($values['email'])) { if (!empty ($values['email'])) {
echo "<p>".get_lang('MailHasBeenSent').".</p>"; echo '<p>'.get_lang('MailHasBeenSent').'.</p>';
} }
$button_text = ""; $button_text = '';
if ($is_allowedCreateCourse) { if ($is_allowedCreateCourse) {
echo "<p>", get_lang('NowGoCreateYourCourse'), ".</p>\n"; echo '<p>', get_lang('NowGoCreateYourCourse'), ".</p>\n";
$action_url = "../create_course/add_course.php"; $action_url = '../create_course/add_course.php';
$button_text = get_lang('CourseCreate'); $button_text = get_lang('CourseCreate');
} else { } else {
if (api_get_setting('allow_students_to_browse_courses') == 'true') if (api_get_setting('allow_students_to_browse_courses') == 'true')
$action_url = "courses.php?action=subscribe"; $action_url = 'courses.php?action=subscribe';
else else
$action_url = api_get_path(WEB_PATH).'user_portal.php'; $action_url = api_get_path(WEB_PATH).'user_portal.php';
echo "<p>", get_lang('NowGoChooseYourCourses'), ".</p>\n"; echo '<p>', get_lang('NowGoChooseYourCourses'), ".</p>\n";
$button_text = get_lang('Next'); $button_text = get_lang('Next');
} }
// ?uidReset=true&uidReq=$_user['user_id'] // ?uidReset=true&uidReq=$_user['user_id']
echo "<form action=\"", $action_url, "\" method=\"post\">\n", "<button type=\"submit\" class=\"next\" name=\"next\" value=\"", get_lang('Next'), "\" validationmsg=\" ", get_lang('Next'), " \">".$button_text."</button>\n", "</form><br />\n"; echo '<form action="', $action_url, '" method="post">', "\n", '<button type="submit" class="next" name="next" value="', get_lang('Next'), '" validationmsg=" ', get_lang('Next'), ' ">', $button_text, '</button>', "\n", '</form><br />', "\n";
} else { } else {
$form->display(); $form->display();
@ -598,13 +587,5 @@ if (!isset($_POST['username'])) {
</div> </div>
<?php <?php
} }
?>
<?php
/*
==============================================================================
FOOTER
==============================================================================
*/
Display :: display_footer(); Display :: display_footer();
?>

@ -803,4 +803,15 @@ $AssignUsers = "Assign users";
$AssignCourses = "Assign courses"; $AssignCourses = "Assign courses";
$AssignSessions = "Assign sessions"; $AssignSessions = "Assign sessions";
$Timezone = "Timezone"; $Timezone = "Timezone";
$Attendance = "Attendance";
$CreateANewAttendance = "Create a new attendance list";
$QualifyAttendanceGradebook = "Qualify the attendance list in the gradebook";
$AttendanceCalendar = "Attendance calendar";
$GoToAttendanceCalendar = "Ir al calendario de asistencias";
$AttendanceSheet = "Attendance sheet";
$AddDateAndTime = "Add a date and time";
$CleanCalendar = "Clean the calendar of all lists";
$AttendanceCalendarDescription = "The attendance calendar allows you to register attendance lists (one per real session the students need to attend). Add new attendance lists here.";
$CalendarList = "Calendar list of attendances";
$ThereAreNoRegisteredDatetimeYet = "There is no date/time registered yet";
?> ?>

@ -803,4 +803,15 @@ $AssignUsers = "Asignar usuarios";
$AssignCourses = "Asignar cursos"; $AssignCourses = "Asignar cursos";
$AssignSessions = "Asignar sesiones de formación"; $AssignSessions = "Asignar sesiones de formación";
$Timezone = "Zona horaria"; $Timezone = "Zona horaria";
$Attendance = "Asistencia";
$CreateANewAttendance = "Crear una nueva lista de asistencias";
$QualifyAttendanceGradebook = "Calificar la lista de asistencias";
$AttendanceCalendar = "Calendario de asistencias";
$GoToAttendanceCalendar = "Ir al calendario de asistencias para agregar fechas";
$AttendanceSheet = "Hoja de asistencia";
$AddDateAndTime = "Agregar fecha y hora";
$CleanCalendar = "Limpiar calendario";
$AttendanceCalendarDescription = "Descripción de calendario de asistencia";
$CalendarList = "Lista de calendario";
$ThereAreNoRegisteredDatetimeYet = "No hay fecha/hora registrada todavía";
?> ?>
Loading…
Cancel
Save