Merge pull request #1797 from chamilo/scrutinizer-patch-1

Scrutinizer Auto-Fixes
remotes/angel/1.11.x
Julio Montoya 8 years ago committed by GitHub
commit 8a0b1faf1b
  1. 2
      custompages/language.inc.php
  2. 2
      main/auth/ldap/login.php
  3. 2
      main/document/document_slideshow.inc.php
  4. 6
      main/inc/lib/event_email_template.class.php
  5. 4
      main/inc/lib/gradebook.lib.php
  6. 10
      main/lp/scormItem.class.php
  7. 2
      main/lp/scormMetadata.class.php
  8. 2
      main/lp/scormOrganization.class.php
  9. 2
      main/lp/scormResource.class.php
  10. 6
      plugin/add_cas_logout_button/index.php
  11. 4
      plugin/add_cas_logout_button/plugin.php
  12. 6
      plugin/add_shibboleth_login_button/index.php
  13. 2
      plugin/customfooter/index.php
  14. 2
      plugin/show_user_info/lang/spanish.php
  15. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php
  16. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Project.php
  17. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectCommentStudent.php
  18. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectStudent.php
  19. 14
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Wiki.php
  20. 12
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Announcement.php
  21. 20
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyLearnpath.php
  22. 2
      src/Chamilo/ThemeBundle/Controller/BreadcrumbController.php
  23. 2
      src/Chamilo/ThemeBundle/Controller/DefaultController.php
  24. 4
      src/Chamilo/ThemeBundle/Event/SidebarMenuEvent.php
  25. 4
      src/Chamilo/ThemeBundle/Event/TaskListEvent.php
  26. 18
      src/Chamilo/ThemeBundle/Event/ThemeEvents.php
  27. 6
      src/Chamilo/ThemeBundle/EventListener/NavbarMessageListDemoListener.php
  28. 2
      src/Chamilo/ThemeBundle/EventListener/NavbarNotificationListDemoListener.php
  29. 2
      src/Chamilo/ThemeBundle/EventListener/NavbarTaskListDemoListener.php
  30. 6
      src/Chamilo/ThemeBundle/EventListener/SidebarSetupMenuDemoListener.php
  31. 2
      src/Chamilo/ThemeBundle/Form/FormDemoModelType.php
  32. 4
      src/Chamilo/ThemeBundle/Model/MessageModel.php
  33. 4
      src/Chamilo/ThemeBundle/Model/UserModel.php
  34. 12
      src/Chamilo/ThemeBundle/Theme/ThemeManager.php
  35. 4
      user.php

@ -28,7 +28,7 @@ function get_preferred_language($available_langs) {
}
krsort($langs, SORT_NUMERIC);
// Choosing the best match
foreach($langs as $weight => $codes) {
foreach ($langs as $weight => $codes) {
foreach ($codes as $code) {
if (in_array($code, $available_langs)) {
return $code;

@ -31,7 +31,7 @@ if ($loginLdapSucces) {
$loginFailed = false;
$uidReset = true;
$_user['user_id'] = $uData['user_id'];
Session::write('_uid',$_uid);
Session::write('_uid', $_uid);
// Jand: copied from event_login in events.lib.php to enable login statistics:
Event::event_login($uData['user_id']);
} else {

@ -71,7 +71,7 @@ $_SESSION['image_files_only'] = $image_files_only;
function sort_files($table)
{
$tablename_direction = isset($_GET['tablename_direction']) ? Security::remove_XSS($_GET['tablename_direction']) : 'ASC';
$accepted_extensions = array('.jpg', '.jpeg', '.gif', '.png', '.bmp','.svg');
$accepted_extensions = array('.jpg', '.jpeg', '.gif', '.png', '.bmp', '.svg');
$temp = array();
foreach ($table as & $file_array) {

@ -20,7 +20,7 @@ class EventEmailTemplate extends Model
*/
public function __construct()
{
$this->table = Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE);
$this->table = Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE);
}
/**
@ -44,7 +44,7 @@ class EventEmailTemplate extends Model
// action links
$content = Display::actions(array(
array(
'url' => 'event_type.php' ,
'url' => 'event_type.php',
'content' => Display::return_icon(
'new_document.png',
get_lang('Add'),
@ -132,7 +132,7 @@ class EventEmailTemplate extends Model
public function get_count()
{
$row = Database::select('count(*) as count', $this->table, array(),'first');
$row = Database::select('count(*) as count', $this->table, array(), 'first');
return $row['count'];
}

@ -57,7 +57,7 @@ class Gradebook extends Model
}
$c_id = $c_id ? intval($c_id) : api_get_course_int_id();
$table = Database::get_course_table(TABLE_TOOL_LIST);
$table = Database::get_course_table(TABLE_TOOL_LIST);
$sql = "SELECT * from $table
WHERE c_id = $c_id and name='$name'
LIMIT 1";
@ -194,7 +194,7 @@ class Gradebook extends Model
$selected_skills = self::get_skills_by_gradebook($gradebook_id);
$clean_selected_skills = array();
if (!empty($selected_skills)) {
foreach($selected_skills as $skill) {
foreach ($selected_skills as $skill) {
$clean_selected_skills[] = $skill['id'];
}
}

@ -100,7 +100,7 @@ class scormItem extends learnpathItem
}
break;
case 'item':
$oItem = new scormItem('manifest',$child);
$oItem = new scormItem('manifest', $child);
if ($oItem->identifier != '') {
$this->sub_items[$oItem->identifier] = $oItem;
}
@ -119,7 +119,7 @@ class scormItem extends learnpathItem
$attributes = $element->attributes;
//$keep_href = '';
foreach ($attributes as $attrib) {
switch($attrib->name){
switch ($attrib->name) {
case 'identifier':
$this->identifier = $attrib->value;
break;
@ -172,8 +172,8 @@ class scormItem extends learnpathItem
);
$abs_order++;
$i = 1;
foreach($this->sub_items as $id => $dummy) {
$oSubitem =& $this->sub_items[$id];
foreach ($this->sub_items as $id => $dummy) {
$oSubitem = & $this->sub_items[$id];
$oSubitem->get_flat_list($list, $abs_order, $i, $level + 1);
$i++;
}
@ -188,7 +188,7 @@ class scormItem extends learnpathItem
parent::save($from_outside, $prereqs_complete);
// Under certain conditions, the scorm_contact should not be set, because no scorm signal was sent.
$this->scorm_contact = true;
if (!$this->scorm_contact){
if (!$this->scorm_contact) {
//error_log('New LP - was expecting SCORM message but none received', 0);
}
}

@ -88,7 +88,7 @@ class scormMetadata
//$keep_href = '';
if (is_array($attributes)) {
foreach ($attributes as $attrib) {
if (trim($attrib->value) != ''){
if (trim($attrib->value) != '') {
$this->attribs[$attrib->name] = $attrib->value;
}
}

@ -98,7 +98,7 @@ class scormOrganization
foreach ($this->items as $id => $dummy) {
$abs_order = 0;
// Passes the array as a pointer so it is modified in $list directly.
$this->items[$id]->get_flat_list($list,$abs_order, $i, 0);
$this->items[$id]->get_flat_list($list, $abs_order, $i, 0);
$i++;
}

@ -69,7 +69,7 @@ class scormResource
}
}
//$keep_href = '';
if ($element->hasAttributes()){ //in some cases we get here with an empty attributes array
if ($element->hasAttributes()) { //in some cases we get here with an empty attributes array
// TODO: Find when and why we get such a case (empty array).
$attributes = $element->attributes;
foreach ($attributes as $attrib) {

@ -1,20 +1,20 @@
<?php
// Show the CAS button to logout to your CAS session
global $_user;
$_template['show_message'] = false;
$_template['show_message'] = false;
if (!api_is_anonymous() &&
api_get_setting('cas_activate') == 'true' &&
$_user['auth_source'] == CAS_AUTH_SOURCE
) {
$_template['show_message'] = true;
$_template['show_message'] = true;
// the default title
$logout_label = "Deconnexion de CAS";
if (!empty($plugin_info['settings']['add_cas_logout_button_cas_logout_label'])) {
$logout_label = api_htmlentities($plugin_info['settings']['add_cas_logout_button_cas_logout_label']);
}
// the comm
$logout_comment = api_htmlentities($plugin_info['settings']['add_cas_logout_button_cas_logout_comment']);;
$logout_comment = api_htmlentities($plugin_info['settings']['add_cas_logout_button_cas_logout_comment']); ;
// URL of the image
$logout_image_url = $plugin_info['settings']['add_cas_logout_button_cas_logout_image_url'];

@ -10,7 +10,7 @@
*/
//the plugin title
$plugin_info['title'] = 'Add a button to logout from CAS';
$plugin_info['title'] = 'Add a button to logout from CAS';
//the comments that go with the plugin
$plugin_info['comment'] = "If CAS is activated, this plugin add a text and a button on the user page to logout from a CAS session. Configure plugin to add title, comment and logo.";
@ -36,4 +36,4 @@ $form->setDefaults($defaults);
$plugin_info['settings_form'] = $form;
// Set the templates that are going to be used
$plugin_info['templates'] = array('template.tpl');
$plugin_info['templates'] = array('template.tpl');

@ -1,17 +1,17 @@
<?php
// Show the Shibboleth button to login using SHIBBOLETH
$_template['show_message'] = false;
$_template['show_message'] = false;
if (api_is_anonymous()) {
$_template['show_message'] = true;
$_template['show_message'] = true;
// the default title
$button_label = "Connexion via Shibboleth";
if (!empty($plugin_info['settings']['add_shibboleth_login_button_shibboleth_button_label'])) {
$button_label = api_htmlentities($plugin_info['settings']['add_shibboleth_login_button_shibboleth_button_label']);
}
// the comm
$comm_label = api_htmlentities($plugin_info['settings']['add_shibboleth_login_button_shibboleth_button_comment']);;
$comm_label = api_htmlentities($plugin_info['settings']['add_shibboleth_login_button_shibboleth_button_comment']); ;
// URL of the image
$url_label = $plugin_info['settings']['add_shibboleth_login_button_shibboleth_image_url'];

@ -4,7 +4,7 @@
*/
if (isset($plugin_info['current_region'])) {
switch($plugin_info['current_region']) {
switch ($plugin_info['current_region']) {
case 'footer_left':
echo $plugin_info['settings']['customfooter_footer_left'];
break;

@ -1,3 +1,3 @@
<?php
$strings['WelcomeToChamiloUserX'] = "Bienvenido a Chamilo %s!";
$strings['WelcomeToChamiloUserX'] = "Bienvenido a Chamilo %s!";

@ -109,7 +109,7 @@ class Documents extends Basic
],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
[ 'Styles',
['Styles',
'Format',
'Font',
'FontSize',

@ -90,7 +90,7 @@ class Project extends Basic
return [
$this->getNewPageBlock(),
['Undo', 'Redo'],
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor', 'BGColor', 'Source'],

@ -89,7 +89,7 @@ class ProjectCommentStudent extends Basic
return [
$this->getNewPageBlock(),
['Undo', 'Redo'],
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'],

@ -90,7 +90,7 @@ class ProjectStudent extends Basic
return [
$this->getNewPageBlock(),
['Undo', 'Redo'],
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'],

@ -56,11 +56,11 @@ class Wiki extends Basic
'-',
'Find'
],
['Wikilink','Link','Unlink','Anchor'],
['Image','Video','Flash','Oembed','Youtube','Audio','Asciimath'],
['Table','HorizontalRule','Smiley','SpecialChar','leaflet'],
['Format','Font','FontSize'],
['Bold','Italic','Underline'],
['Wikilink', 'Link', 'Unlink', 'Anchor'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio', 'Asciimath'],
['Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'leaflet'],
['Format', 'Font', 'FontSize'],
['Bold', 'Italic', 'Underline'],
[
'Subscript',
'Superscript',
@ -94,10 +94,10 @@ class Wiki extends Basic
return [
$this->getNewPageBlock(),
['Undo', 'Redo'],
['Wikilink', 'Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
['Wikilink', 'Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Styles','Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
['Toolbarswitch']
];

@ -59,13 +59,13 @@ class Announcement extends Resource
$size,
$comment
) {
parent::__construct($id,RESOURCE_ANNOUNCEMENT);
parent::__construct($id, RESOURCE_ANNOUNCEMENT);
$this->content = $content;
$this->title = $title;
$this->date = $date;
$this->display_order = $display_order;
$this->email_sent = $email_sent;
$this->content = $content;
$this->title = $title;
$this->date = $date;
$this->display_order = $display_order;
$this->email_sent = $email_sent;
$this->attachment_path = $path;
$this->attachment_filename = $filename;

@ -155,18 +155,18 @@ class CourseCopyLearnpath extends Resource
$this->js_lib = $js_lib;
$this->content_license = $content_license;
$this->debug = $debug;
$this->visibility=$visibility;
$this->visibility = $visibility;
$this->use_max_score=$use_max_score;
$this->autolaunch=$autolaunch;
$this->created_on=$created_on;
$this->modified_on=$modified_on;
$this->publicated_on=$publicated_on;
$this->expired_on=$expired_on;
$this->session_id=$session_id;
$this->use_max_score = $use_max_score;
$this->autolaunch = $autolaunch;
$this->created_on = $created_on;
$this->modified_on = $modified_on;
$this->publicated_on = $publicated_on;
$this->expired_on = $expired_on;
$this->session_id = $session_id;
$this->author= $author;
$this->preview_image= $preview_image;
$this->author = $author;
$this->preview_image = $preview_image;
$this->items = $items;
}

@ -58,7 +58,7 @@ class BreadcrumbController extends Controller {
$list = array();
if ($active) {
$list[] = $active;
while(null !== ($item = $active->getActiveChild())) {
while (null !== ($item = $active->getActiveChild())) {
$list[] = $item;
$active = $item;
}

@ -43,7 +43,7 @@ class DefaultController extends Controller
}
public function formAction() {
$form =$this->createForm( new FormDemoModelType());
$form = $this->createForm(new FormDemoModelType());
return $this->render('ChamiloThemeBundle:Default:form.html.twig', array(
'form' => $form->createView()
));

@ -74,9 +74,9 @@ class SidebarMenuEvent extends ThemeEvent
*/
public function getActive() {
foreach($this->getItems() as $item) {
foreach ($this->getItems() as $item) {
/** @var $item MenuItemInterface */
if($item->isActive()) return $item;
if ($item->isActive()) return $item;
}
return null;
}

@ -30,8 +30,8 @@ class TaskListEvent extends ThemeEvent {
*
* @return $this
*/
public function addTask(TaskInterface $taskInterface){
$this->tasks[] = $taskInterface;
public function addTask(TaskInterface $taskInterface) {
$this->tasks[] = $taskInterface;
return $this;
}

@ -19,40 +19,40 @@ class ThemeEvents
/**
* Used to receive notification data
*/
const THEME_NOTIFICATIONS = 'theme.notifications';
const THEME_NOTIFICATIONS = 'theme.notifications';
/**
* Used to receive message data
*/
const THEME_MESSAGES = 'theme.messages';
const THEME_MESSAGES = 'theme.messages';
/**
* Used to receive task data
*/
const THEME_TASKS = 'theme.tasks';
const THEME_TASKS = 'theme.tasks';
/**
*
*/
const THEME_NAVBAR_USER = 'theme.navbar_user';
const THEME_NAVBAR_USER = 'theme.navbar_user';
/**
* used to receive breadcrumb data
*/
const THEME_BREADCRUMB = 'theme.breadcrumb';
const THEME_BREADCRUMB = 'theme.breadcrumb';
/**
* used to receive the current user for the sidebar
*/
const THEME_SIDEBAR_USER = 'theme.sidebar_user';
const THEME_SIDEBAR_USER = 'theme.sidebar_user';
/**
* Used for searching
* @unused
*/
const THEME_SIDEBAR_SEARCH = 'theme.sidebar_search';
const THEME_SIDEBAR_SEARCH = 'theme.sidebar_search';
/**
* Used to receive the sidebar menu data
*/
const THEME_SIDEBAR_SETUP_MENU = 'theme.sidebar_setup_menu';
const THEME_SIDEBAR_SETUP_MENU = 'theme.sidebar_setup_menu';
/**
* Used to receive the sidebar menu data
*/
const THEME_SIDEBAR_SETUP_MENU_KNP = 'theme.sidebar_setup_menu_knp';
const THEME_SIDEBAR_SETUP_MENU_KNP = 'theme.sidebar_setup_menu_knp';
/**
*
*/

@ -16,15 +16,15 @@ class NavbarMessageListDemoListener {
public function onListMessages(MessageListEvent $event) {
foreach($this->getMessages() as $msg) {
foreach ($this->getMessages() as $msg) {
$event->addMessage($msg);
}
}
protected function getMessages() {
return array(
new MessageModel(new UserModel('Karl kettenkit'),'Dude! do something!', new \DateTime('-3 days')),
new MessageModel(new UserModel('Jack Trockendoc'),'This is some subject', new \DateTime('-10 month')),
new MessageModel(new UserModel('Karl kettenkit'), 'Dude! do something!', new \DateTime('-3 days')),
new MessageModel(new UserModel('Jack Trockendoc'), 'This is some subject', new \DateTime('-10 month')),
);
}

@ -16,7 +16,7 @@ class NavbarNotificationListDemoListener {
public function onListNotifications(NotificationListEvent $event) {
foreach($this->getNotifications() as $notify){
foreach ($this->getNotifications() as $notify) {
$event->addNotification($notify);
}

@ -17,7 +17,7 @@ class NavbarTaskListDemoListener
public function onListTasks(TaskListEvent $event)
{
foreach($this->getTasks() as $task) {
foreach ($this->getTasks() as $task) {
$event->addTask($task);
}

@ -45,12 +45,12 @@ class SidebarSetupMenuDemoListener
protected function activateByRoute($route, $items) {
foreach($items as $item) { /** @var $item MenuItemModel */
if($item->hasChildren()) {
foreach ($items as $item) { /** @var $item MenuItemModel */
if ($item->hasChildren()) {
$this->activateByRoute($route, $item->getChildren());
}
else {
if($item->getRoute() == $route) {
if ($item->getRoute() == $route) {
$item->setIsActive(true);
}
}

@ -34,7 +34,7 @@ class FormDemoModelType extends AbstractType
->add('someChoices', 'choice', array('choices' => $choices, 'expanded' => true, 'multiple' => true))
->add('username')
->add('email')
->add('termsAccepted','checkbox')
->add('termsAccepted', 'checkbox')
->add('message', 'textarea')
->add('price')
->add('date', 'date', array('widget' => 'single_text'))

@ -51,11 +51,11 @@ class MessageModel implements MessageInterface
* @param null $sentAt
* @param UserInterface $to
*/
function __construct(UserInterface $from = null, $subject= '', $sentAt = null, UserInterface $to = null)
function __construct(UserInterface $from = null, $subject = '', $sentAt = null, UserInterface $to = null)
{
$this->to = $to;
$this->subject = $subject;
$this->sentAt = $sentAt ? : new \DateTime();
$this->sentAt = $sentAt ?: new \DateTime();
$this->from = $from;
}

@ -31,11 +31,11 @@ class UserModel implements UserInterface
*/
protected $isOnline = false;
function __construct($username='', $avatar = '', $memberSince = null, $isOnline = true)
function __construct($username = '', $avatar = '', $memberSince = null, $isOnline = true)
{
$this->avatar = $avatar;
$this->isOnline = $isOnline;
$this->memberSince = $memberSince ?:new \DateTime();
$this->memberSince = $memberSince ?: new \DateTime();
$this->username = $username;
}

@ -36,7 +36,7 @@ class ThemeManager
function __construct($container, $resolverClass = null)
{
$this->container = $container;
$this->resolverClass = $resolverClass?: 'Chamilo\ThemeBundle\Util\DependencyResolver';
$this->resolverClass = $resolverClass ?: 'Chamilo\ThemeBundle\Util\DependencyResolver';
}
public function registerScript($id, $src, $deps = array(), $location = "bottom")
@ -54,7 +54,7 @@ class ThemeManager
public function registerStyle($id, $src, $deps = array())
{
if(!isset($this->stylesheets[$id])) {
if (!isset($this->stylesheets[$id])) {
$this->stylesheets[$id] = array(
'src' => $src,
'deps' => $deps,
@ -66,14 +66,14 @@ class ThemeManager
{
$unsorted = array(); $srcList = array(); $assetList = array();
foreach($this->javascripts as $id => $scriptDefinition) {
if($scriptDefinition['location'] == $location) {
foreach ($this->javascripts as $id => $scriptDefinition) {
if ($scriptDefinition['location'] == $location) {
$unsorted[$id] = $scriptDefinition;
}
}
$queue = $this->getResolver()->register($unsorted)->resolveAll();
foreach($queue as $def) {
foreach ($queue as $def) {
$srcList[] = $def['src'];
}
return $srcList;
@ -83,7 +83,7 @@ class ThemeManager
{
$srcList = array();
$queue = $this->getResolver()->register($this->stylesheets)->resolveAll();
foreach($queue as $def) {
foreach ($queue as $def) {
$srcList[] = $def['src'];
}
return $srcList;

@ -32,8 +32,8 @@ if (empty($array_keys)) {
exit;
}
$username = substr($array_keys[0],0,20); // max len of an username
$friend_id = UserManager::get_user_id_from_username($username);
$username = substr($array_keys[0], 0, 20); // max len of an username
$friend_id = UserManager::get_user_id_from_username($username);
if (!$friend_id) {
// we cant find your friend

Loading…
Cancel
Save