Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent e6212ef2b1
commit daede739b6
  1. 10
      index.php
  2. 51
      main/admin/configure_homepage.php
  3. 13
      main/inc/lib/userportal.lib.php

@ -118,8 +118,7 @@ if (!empty($_POST['submitAuth'])) {
}
}
// End login -- if ($_POST['submitAuth'])
}
else {
} else {
// Only if login form was not sent because if the form is sent the user was already on the page.
event_open();
}
@ -142,8 +141,7 @@ if (!api_is_anonymous()) {
if (api_is_platform_admin()) {
$controller->tpl->assign('course_block', $controller->return_course_block());
}
else {
} else {
$controller->tpl->assign('teacher_block', $controller->return_teacher_link());
}
}
@ -163,9 +161,7 @@ if (!isset($_REQUEST['include'])) {
$controller->tpl->assign('hot_courses', $hot_courses);
$controller->tpl->assign('announcements_block', $announcements_block);
$controller->tpl->assign('home_page_block', $controller->return_home_page());
$controller->tpl->assign('navigation_course_links', $controller->return_navigation_links());
$controller->tpl->assign('notice_block', $controller->return_notice());
$controller->tpl->assign('main_navigation_block', $controller->return_navigation_links());
$controller->tpl->assign('help_block', $controller->return_help());
@ -183,7 +179,7 @@ if (isset($_GET['firstpage'])) {
api_set_firstpage_parameter($_GET['firstpage']);
// if we are already logged, go directly to course
if (api_user_is_login()) {
echo "<script type='text/javascript'>self.location.href='index.php?firstpage=".$_GET['firstpage']."'</script>";
echo "<script type='text/javascript'>self.location.href='index.php?firstpage=".Security::remove_XSS($_GET['firstpage'])."'</script>";
}
} else {
api_delete_firstpage_parameter();

@ -1,9 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Configure the portal homepage (manages multi-urls and languages)
* @package chamilo.admin
*/
/**
* Creates menu tabs for logged and anonymous users
*
@ -44,7 +46,7 @@ function home_tabs($file_logged_in)
}
}
$language_file = array('index','admin', 'accessibility');
$language_file = array('index', 'admin', 'accessibility');
$cidReset = true;
require_once '../inc/global.inc.php';
@ -78,10 +80,17 @@ $tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY);
$tool_name = get_lang('ConfigureHomePage');
$_languages = api_get_languages();
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array(
'url' => 'index.php',
'name' => get_lang('PlatformAdmin')
);
if (!empty($action)) {
$interbreadcrumb[] = array('url' => 'configure_homepage.php', 'name' => get_lang('ConfigureHomePage'));
$interbreadcrumb[] = array(
'url' => 'configure_homepage.php',
'name' => get_lang('ConfigureHomePage')
);
switch ($action) {
case 'edit_top':
$tool_name = get_lang('EditHomePage');
@ -165,7 +174,7 @@ $noticef = 'home_notice'; //noticef for Notice File
$menutabs= 'home_tabs'; //menutabs for tabs Menu
$mtloggedin= 'home_tabs_logged_in'; //menutabs for tabs Menu
$ext = '.html'; //ext for HTML Extension - when used frequently, variables are
// faster than hardcoded strings
// faster than hardcoded strings
$homef = array($menuf, $newsf, $topf, $noticef, $menutabs, $mtloggedin);
// If language-specific file does not exist, create it by copying default file
@ -229,7 +238,7 @@ if (!empty($action)) {
$fp = fopen($homep.$topf.'_'.$lang.$ext, 'w');
fputs($fp, $home_top);
fclose($fp);
var_dump($_languages['name']);exit;
foreach ($_languages['name'] as $key => $value) {
$lang_name = $_languages['folder'][$key];
if (isset($_POST[$lang_name])) {
@ -242,7 +251,6 @@ if (!empty($action)) {
}
}
}
} else {
$errorMsg = get_lang('HomePageFilesNotWritable');
}
@ -530,7 +538,13 @@ if (!empty($action)) {
}
}
}
event_system(LOG_HOMEPAGE_CHANGED, $action, cut($link_name.':'.$link_url, 254), api_get_utc_datetime(), api_get_user_id());
event_system(
LOG_HOMEPAGE_CHANGED,
$action,
cut($link_name . ':' . $link_url, 254),
api_get_utc_datetime(),
api_get_user_id()
);
break;
} //end of switch($action)
@ -885,6 +899,7 @@ switch ($action) {
$form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), array('id' => 'all_langs'));
$form->addElement('html','<table id="table_langs" style="margin-left:159px;"><tr>');
$i = 0;
foreach ($_languages['name'] as $key => $value) {
$i++;
$lang_name = $_languages['folder'][$key];
@ -920,7 +935,13 @@ switch ($action) {
}
$default = array();
$form = new FormValidator('configure_homepage_'.$action, 'post', api_get_self().'?action='.$action, '', array('style' => 'margin: 0px;'));
$form = new FormValidator(
'configure_homepage_'.$action,
'post',
api_get_self().'?action='.$action,
'',
array('style' => 'margin: 0px;')
);
$renderer =& $form->defaultRenderer();
$renderer->setHeaderTemplate('');
$renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>');
@ -944,6 +965,7 @@ switch ($action) {
$html .= '</select></td></tr>';
$form->addElement('html', $html);
}
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
//TODO: review these lines
// Print WCAG-specific HTML editor
@ -958,18 +980,17 @@ switch ($action) {
$form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'),array('id' => 'all_langs'));
$form->addElement('html','<table id="table_langs" style="margin-left:5px;"><tr>');
$i = 0;
foreach ($_languages['name'] as $key => $value) {
$i++;
$lang_name = $_languages['folder'][$key];
//if (file_exists($homep.$topf.'_'.$lang_name.$ext)) {
$html_langs = '<td width="300">';
$html_langs .= '<label><input type="checkbox" id="lang" name="'.$lang_name.'" />&nbsp;'.$lang_name.'<label/>';
$html_langs .= '</td>';
if($i%5 == 0) {
if ($i%5 == 0) {
$html_langs .= '</tr><tr>';
}
$form->addElement('html', $html_langs);
//}
}
$form->addElement('html','</tr></table><br/>');
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
@ -983,8 +1004,12 @@ switch ($action) {
<tr>
<td width="70%" valign="top">
<div class="actions">
<a href="<?php echo api_get_self(); ?>?action=edit_top"><?php Display::display_icon('edit.gif', get_lang('EditHomePage')); ?></a>
<a href="<?php echo api_get_self(); ?>?action=edit_top"><?php echo get_lang('EditHomePage'); ?></a>
<a href="<?php echo api_get_self(); ?>?action=edit_top">
<?php Display::display_icon('edit.gif', get_lang('EditHomePage')); ?>
</a>
<a href="<?php echo api_get_self(); ?>?action=edit_top">
<?php echo get_lang('EditHomePage'); ?>
</a>
</div>
<table border="0" cellpadding="5" cellspacing="0" width="100%">

@ -213,11 +213,15 @@ class IndexManager
if (!empty($html)) {
$html = self::show_right_block(get_lang('Courses'), $html, 'teacher_block');
}
return $html;
}
/* Includes a created page */
function return_home_page()
/**
* Includes a created page
* @return string
*/
public function return_home_page()
{
$userId = api_get_user_id();
global $_configuration;
@ -229,7 +233,9 @@ class IndexManager
$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
} else {
// Hiding home top when user not connected.
if (isset($_configuration['hide_home_top_when_connected']) && $_configuration['hide_home_top_when_connected'] && !empty($userId)) {
if (isset($_configuration['hide_home_top_when_connected']) &&
$_configuration['hide_home_top_when_connected'] && !empty($userId)
) {
return $html;
}
@ -240,7 +246,6 @@ class IndexManager
} else {
$user_selected_language = api_get_setting('platformLanguage');
}
if (!file_exists($this->home.'home_news_'.$user_selected_language.'.html')) {
if (file_exists($this->home.'home_top.html')) {
$home_top_temp = file($this->home.'home_top.html');

Loading…
Cancel
Save