Feature #272 - "Registration" and "Registration settings": Adding code for managing possible encoding differencies between the system and the stored in files html-snippets.

skala
Ivan Tcholakov 16 years ago
parent b78bdf3e58
commit 5223bbadce
  1. 7
      main/admin/configure_homepage.php
  2. 32
      main/admin/configure_inscription.php
  3. 21
      main/auth/inscription.php

@ -101,7 +101,6 @@ if ($_configuration['multiple_access_urls']) {
$homep = api_get_path(SYS_PATH).'home/'; //homep for Home Path
}
$menuf = 'home_menu'; //menuf for Menu File
$newsf = 'home_news'; //newsf for News File
$topf = 'home_top'; //topf for Top File
@ -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"));
}
// -------------------------
// ---- Display section ----
// -------------------------
// Display section
Display::display_header($tool_name);
@ -583,7 +580,7 @@ switch ($action) {
}
break;
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;">
<div class="row"><div class="form_header"><?php echo $tool_name; ?></div></div>

@ -76,8 +76,9 @@ if ($_configuration['multiple_access_urls']) {
$clean_url = replace_dangerous_char($url);
$clean_url = str_replace('/', '-', $clean_url);
$clean_url .= '/';
$homep = '../../home/'; //homep for Home Path
$homep_new = '../../home/'.$clean_url; //homep for Home Path added the url
$homep = api_get_path(SYS_PATH).'home/'; //homep for Home Path
$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;
//we create the new dir for the new sites
if (!is_dir($new_url_dir)){
@ -86,11 +87,9 @@ if ($_configuration['multiple_access_urls']) {
}
} else {
$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
$ext = '.html'; //ext for HTML Extension - when used frequently, variables are
$homef = array($topf);
@ -146,12 +145,13 @@ if (!empty($action)) {
// This request is only the preparation for the update of the home_top
$home_top = '';
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)) {
$home_top = file_get_contents($homep.$topf.$lang.$ext);
$home_top = @(string)file_get_contents($homep.$topf.$lang.$ext);
} else {
$errorMsg = get_lang('HomePageFilesNotReadable');
}
$home_top = api_to_system_encoding($home_top, api_detect_encoding(strip_tags($home_top)));
break;
}
}
@ -372,7 +372,7 @@ if ($display_all_form) {
}
//------------ Terms and conditions
// Terms and conditions
if (get_setting('allow_terms_conditions') == 'true') {
$language = api_get_interface_language();
$language = api_get_language_id($language);
@ -449,8 +449,8 @@ switch ($action){
$open = $home_top;
} else {
$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)) {
@ -484,14 +484,16 @@ switch ($action){
//Form of language
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 '<div class="note">';
$home_notice = '';
//echo '<div class="note">';
echo '<div style="border:1px solid #E1E1E1; padding:2px;">';
$open = '';
if (file_exists($homep.$topf.'_'.$lang.$ext)) {
$home_notice = @file_get_contents($homep.$topf.'_'.$lang.$ext);
$open = @(string)file_get_contents($homep.$topf.'_'.$lang.$ext);
} 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>';
$form->display();
break;

@ -53,9 +53,7 @@ echo '<div class="actions-title">';
echo $tool_name;
echo '</div>';
//Header of Configure Inscription
$home = '../../home/';
$home = api_get_path(SYS_PATH).'home/';
if ($_configuration['multiple_access_urls']) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
@ -64,8 +62,8 @@ if ($_configuration['multiple_access_urls']) {
$clean_url = replace_dangerous_char($url);
$clean_url = str_replace('/','-',$clean_url);
$clean_url .= '/';
$home_old = '../../home/';
$home= '../../home/'.$clean_url;
$home_old = api_get_path(SYS_PATH).'home/';
$home = api_get_path(SYS_PATH).'home/'.$clean_url;
}
}
@ -78,8 +76,9 @@ if (!empty($_SESSION['user_language_choice'])) {
}
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 = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
echo '<div style="border:1px solid #E1E1E1; padding:2px;">'.$open.'</div>';
}
@ -302,13 +301,12 @@ if ($display_all_form) {
}
}
//------------ Terms and conditions
// Terms and conditions
if (api_get_setting('allow_terms_conditions') == 'true') {
//$language = api_get_setting('platformLanguage');
$language = api_get_interface_language();
$language = api_get_language_id($language);
$term_preview = LegalManager::get_last_condition($language);
if (!$term_preview) {
//we load from the platform
$language = api_get_setting('platformLanguage');
@ -320,9 +318,10 @@ if (api_get_setting('allow_terms_conditions') == 'true') {
$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_info', $term_preview['legal_id'].':'.$term_preview['language_id']);
// Password
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', 'password', $_SESSION['info_current_user'][2]);
@ -588,7 +587,5 @@ if (!isset($_POST['username'])) {
</div>
<?php
}
?>
<?php
Display :: display_footer();

Loading…
Cancel
Save