Minor - remove unused code

pull/3984/head
Julio 4 years ago
parent b3a0007240
commit e56d8b9b6f
  1. 244
      public/main/inc/lib/template.lib.php
  2. 47
      public/main/install/configuration.dist.php
  3. 2
      src/CoreBundle/Entity/ExtraFieldValues.php
  4. 2
      tests/CourseBundle/Repository/CWikiRepositoryTest.php

@ -119,9 +119,6 @@ class Template
//$this->set_footer($show_footer);
//$this->set_header($show_header);
//$this->set_header_parameters($sendHeaders);
//$this->set_footer_parameters();
$defaultStyle = api_get_setting('display.default_template');
if (!empty($defaultStyle)) {
$this->templateFolder = $defaultStyle;
@ -1076,247 +1073,6 @@ class Template
$this->assign('_c', $_c);
}
/**
* Set header parameters.
*
* @deprecated
*
* @param bool $sendHeaders send headers
*/
private function set_header_parameters($sendHeaders)
{
global $httpHeadXtra, $interbreadcrumb, $language_file, $_configuration, $this_section;
$_course = api_get_course_info();
$nameTools = $this->title;
$navigation = return_navigation_array();
$this->menu_navigation = $navigation['menu_navigation'];
$this->assign('system_charset', api_get_system_encoding());
if (isset($httpHeadXtra) && $httpHeadXtra) {
foreach ($httpHeadXtra as &$thisHttpHead) {
//header($thisHttpHead);
}
}
$this->assign(
'online_button',
Display::return_icon('statusonline.png', null, [], ICON_SIZE_ATOM)
);
$this->assign(
'offline_button',
Display::return_icon('statusoffline.png', null, [], ICON_SIZE_ATOM)
);
// Get language iso-code for this page - ignore errors
$this->assign('document_language', api_get_language_isocode());
$course_title = isset($_course['name']) ? $_course['name'] : null;
$title_list = [];
$title_list[] = api_get_setting('Institution');
$title_list[] = api_get_setting('siteName');
if (!empty($course_title)) {
$title_list[] = $course_title;
}
if ('' != $nameTools) {
$title_list[] = $nameTools;
}
$title_string = '';
for ($i = 0; $i < count($title_list); $i++) {
$title_string .= $title_list[$i];
if (isset($title_list[$i + 1])) {
$item = trim($title_list[$i + 1]);
if (!empty($item)) {
$title_string .= ' - ';
}
}
}
$this->assign('title_string', $title_string);
// Setting the theme and CSS files
//$this->setCssFiles();
$this->set_js_files();
$this->setCssCustomFiles();
/*$browser = api_browser_support('check_browser');
if ('Internet Explorer' == $browser[0] && $browser[1] >= '11') {
$browser_head = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />';
$this->assign('browser_specific_head', $browser_head);
}*/
// Implementation of prefetch.
// See http://cdn.chamilo.org/main/img/online.png for details
$prefetch = '';
if (!empty($_configuration['cdn_enable'])) {
$prefetch .= '<meta http-equiv="x-dns-prefetch-control" content="on">';
foreach ($_configuration['cdn'] as $host => $exts) {
$prefetch .= '<link rel="dns-prefetch" href="'.$host.'">';
}
}
$this->assign('prefetch', $prefetch);
$this->assign('text_direction', api_get_text_direction());
$this->assign('section_name', 'section-'.$this_section);
$this->assignFavIcon();
$this->setHelp();
$this->assignBugNotification(); //Prepare the 'bug_notification' var for the template
$this->assignAccessibilityBlock(); //Prepare the 'accessibility' var for the template
// Preparing values for the menu
// Logout link
$hideLogout = api_get_setting('hide_logout_button');
if ('true' === $hideLogout) {
$this->assign('logout_link', null);
} else {
$this->assign('logout_link', api_get_path(WEB_PATH).'index.php?logout=logout&uid='.api_get_user_id());
}
// Profile link
if ('true' == api_get_setting('allow_social_tool')) {
$profile_url = api_get_path(WEB_CODE_PATH).'social/home.php';
} else {
$profile_url = api_get_path(WEB_CODE_PATH).'auth/profile.php';
}
$this->assign('profile_url', $profile_url);
//Message link
$message_link = null;
$message_url = null;
if ('true' == api_get_setting('allow_message_tool')) {
$message_url = api_get_path(WEB_CODE_PATH).'messages/inbox.php';
$message_link = '<a href="'.api_get_path(WEB_CODE_PATH).'messages/inbox.php">'.get_lang('Inbox').'</a>';
}
$this->assign('message_link', $message_link);
$this->assign('message_url', $message_url);
$pendingSurveyLink = '';
$show = api_get_configuration_value('show_pending_survey_in_menu');
if ($show) {
$pendingSurveyLink = api_get_path(WEB_CODE_PATH).'survey/pending.php';
}
$this->assign('pending_survey_url', $pendingSurveyLink);
// Certificate Link
$allow = api_get_configuration_value('certificate.hide_my_certificate_link');
if (false === $allow) {
$certificateUrl = api_get_path(WEB_CODE_PATH).'gradebook/my_certificates.php';
$certificateLink = Display::url(
get_lang('My certificates'),
$certificateUrl
);
$this->assign('certificate_link', $certificateLink);
$this->assign('certificate_url', $certificateUrl);
}
$institution = api_get_setting('Institution');
$portal_name = empty($institution) ? api_get_setting('siteName') : $institution;
$this->assign('portal_name', $portal_name);
//Menu
//$menu = menuArray();
//$this->assign('menu', $menu);
$breadcrumb = '';
// Hide breadcrumb in LP
if (false == $this->show_learnpath) {
$breadcrumb = return_breadcrumb(
$interbreadcrumb,
$language_file,
$nameTools
);
}
$this->assign('breadcrumb', $breadcrumb);
//Extra content
$extra_header = null;
if (!api_is_platform_admin()) {
$extra_header = trim(api_get_setting('header_extra_content'));
}
$this->assign('header_extra_content', $extra_header);
if ($sendHeaders) {
/*header('Content-Type: text/html; charset='.api_get_system_encoding());
header(
'X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'], 0, 1)
);
self::addHTTPSecurityHeaders();*/
$responseCode = $this->getResponseCode();
if (!empty($responseCode)) {
switch ($responseCode) {
case '404':
header("HTTP/1.0 404 Not Found");
break;
}
}
}
$socialMeta = '';
$metaTitle = api_get_setting('meta_title');
if (!empty($metaTitle)) {
$socialMeta .= '<meta name="twitter:card" content="summary" />'."\n";
$metaSite = api_get_setting('meta_twitter_site');
if (!empty($metaSite)) {
$socialMeta .= '<meta name="twitter:site" content="'.$metaSite.'" />'."\n";
$metaCreator = api_get_setting('meta_twitter_creator');
if (!empty($metaCreator)) {
$socialMeta .= '<meta name="twitter:creator" content="'.$metaCreator.'" />'."\n";
}
}
// The user badge page emits its own meta tags, so if this is
// enabled, ignore the global ones
$userId = isset($_GET['user']) ? intval($_GET['user']) : 0;
$skillId = isset($_GET['skill']) ? intval($_GET['skill']) : 0;
if (!$userId && !$skillId) {
// no combination of user and skill ID has been defined,
// so print the normal OpenGraph meta tags
$socialMeta .= '<meta property="og:title" content="'.$metaTitle.'" />'."\n";
$socialMeta .= '<meta property="og:url" content="'.api_get_path(WEB_PATH).'" />'."\n";
$metaDescription = api_get_setting('meta_description');
if (!empty($metaDescription)) {
$socialMeta .= '<meta property="og:description" content="'.$metaDescription.'" />'."\n";
}
$metaImage = api_get_setting('meta_image_path');
if (!empty($metaImage)) {
if (is_file(api_get_path(SYS_PATH).$metaImage)) {
$path = api_get_path(WEB_PATH).$metaImage;
$socialMeta .= '<meta property="og:image" content="'.$path.'" />'."\n";
}
}
}
}
$this->assign('social_meta', $socialMeta);
}
/**
* Set footer parameters.
*/
private function set_footer_parameters()
{
// Loading footer extra content
if (!api_is_platform_admin()) {
$extra_footer = trim(api_get_setting('footer_extra_content'));
if (!empty($extra_footer)) {
$this->assign('footer_extra_content', $extra_footer);
}
}
}
/**
* Manage specific HTTP headers security.
*/

@ -47,43 +47,6 @@ $_configuration[1]['hosting_limit_active_courses'] = 0;
// Check main/cron/hosting_total_size_limit.php for how to use this limit.
$_configuration['hosting_total_size_limit'] = 0;
/**
* Content Delivery Network (CDN) settings. Only use if you need a separate
* server to serve your static data. If you don't know what a CDN is, you
* don't need it. These settings are for simple Origin Pull CDNs and are
* experimental. Enable only if you really know what you're doing.
* This might conflict with multiple-access urls.
* Please note that recent browsers forbid the loading of resources from
* a different portal URL then where they are, due to CORS rules.
* To allow for CDN usage with different URLs, you need to specifically
* allow CORS Access-Control-Allow-Origin for your main Chamilo URL.
* This has to be done at the web server level, because Chamilo's PHP code
* doesn't change HTTP headers of all files served from the Chamilo directory.
* To do that on Apache, use
* Header set Access-Control-Allow-Origin "http(s)://main-chamilo-url"
* in Nginx:
* add_header 'Access-Control-Allow-Origin' 'http(s)://main-chamilo-url';.
*/
// Set the following setting to true to start using the CDN
$_configuration['cdn_enable'] = false;
// The following setting will be ignored if the previous one is set to false
$_configuration['cdn'] = [
// You can define several CDNs and split them by extensions
// Replace the following by your full CDN URL, which should point to
// your Chamilo's root directory. DO NOT INCLUDE a final slash! (won't work)
'http://cdn.chamilo.org' => [
'.css',
'.js',
'.jpg',
'.jpeg',
'.png',
'.gif',
'.avi',
'.flv',
],
// copy the line above and modify following your needs
];
// Security word for password recovery
$_configuration['security_key'] = '{SECURITY_KEY}';
// Activation for multi-url access
@ -159,9 +122,6 @@ $_configuration['deny_delete_users'] = false;
// be reflected on the https://version.chamilo.org/stats page in the future.
//$_configuration['packager'] = 'chamilo';
// List of driver to plugin in ckeditor
//$_configuration['editor_driver_list'] = ['PersonalDriver', 'CourseDriver'];
// Hide header and footer in certificate pdf
//$_configuration['hide_header_footer_in_certificate'] = false;
@ -283,7 +243,6 @@ $_configuration['agenda_colors'] = [
'student_publication' => '#FF8C00'
];
*/
// ------
//
// Save some tool titles with HTML editor
// $_configuration['save_titles_as_html'] = false;
@ -409,12 +368,8 @@ VALUES (12, 13, 'is_mandatory', 'IsMandatory', 1, 1, NOW());
//$_configuration['survey_additional_teacher_modify_actions'] = [];
// Allow show answers in anonymous surveys
//$_configuration['survey_anonymous_show_answered'] = false;
// ------
// Allow career diagram, requires a DB change:
//UPDATE extra_field_values SET created_at = NULL WHERE CAST(created_at AS CHAR(20)) = '0000-00-00 00:00:00';
//UPDATE extra_field_values SET updated_at = NULL WHERE CAST(updated_at AS CHAR(20)) = '0000-00-00 00:00:00';
//ALTER TABLE extra_field_values modify column value longtext null;
// Allow career diagram
//$_configuration['allow_career_diagram'] = false;
// Allow scheduled emails to session users.
// sudo mkdir app/upload/scheduled_announcement

@ -11,8 +11,6 @@ use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Class ExtraFieldValues.
*
* @ORM\Table(
* name="extra_field_values",
* indexes={

@ -6,9 +6,7 @@ declare(strict_types=1);
namespace Chamilo\Tests\CourseBundle\Repository;
use Chamilo\CourseBundle\Entity\CThematic;
use Chamilo\CourseBundle\Entity\CWiki;
use Chamilo\CourseBundle\Repository\CThematicRepository;
use Chamilo\CourseBundle\Repository\CWikiRepository;
use Chamilo\Tests\AbstractApiTest;
use Chamilo\Tests\ChamiloTestTrait;

Loading…
Cancel
Save