Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
remotes/angel/1.11.x
Scrutinizer Auto-Fixer 8 years ago
parent a1b1ee132a
commit abd536364d
  1. 2
      main/auth/gotocourse.php
  2. 2
      main/document/download.php
  3. 68
      main/document/save_pixlr.php
  4. 8
      main/forum/download.php
  5. 8
      main/forum/viewpost.php
  6. 26
      main/mySpace/coaches.php
  7. 8
      main/mySpace/progression.php
  8. 12
      main/mySpace/user_import.php
  9. 4
      main/social/skills_ranking.php
  10. 2
      main/social/skills_wheel.php
  11. 4
      plugin/formLogin_hide_unhide/index.php
  12. 4
      plugin/formLogin_hide_unhide/plugin.php
  13. 4
      src/Chamilo/CoreBundle/Component/Editor/Driver/DropBoxDriver.php
  14. 4
      src/Chamilo/CoreBundle/Component/Editor/Driver/PersonalDriver.php
  15. 2
      src/Chamilo/CoreBundle/Component/Editor/TinyMce/TinyMce.php
  16. 2
      src/Chamilo/CoreBundle/Entity/Repository/ItemPropertyRepository.php
  17. 2
      src/Chamilo/CoreBundle/Entity/Session.php

@ -51,7 +51,7 @@ if (isset($_GET['firstpage'])) {
$msg .= '<div class="well_login">';
$msg .= $form->return_form();
$msg .='</div>';
$msg .= '</div>';
if (api_is_cas_activated()) {
$msg .= "</div>";
}

@ -97,7 +97,7 @@ if (Security::check_abs_path($sys_course_path.$doc_url, $sys_course_path.'/')) {
}
if (!api_is_allowed_to_edit() && !$is_visible) {
Display::display_error_message(get_lang('ProtectedDocument'));//api_not_allowed backbutton won't work.
Display::display_error_message(get_lang('ProtectedDocument')); //api_not_allowed backbutton won't work.
exit; // You shouldn't be here anyway.
}
// Launch event

@ -16,36 +16,36 @@ require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script();
api_block_anonymous_users();
if ($_user['user_id']!= api_get_user_id() || api_get_user_id()==0 || $_user['user_id']==0) {
if ($_user['user_id'] != api_get_user_id() || api_get_user_id() == 0 || $_user['user_id'] == 0) {
api_not_allowed();
die();
}
if(!isset($_GET['title']) || !isset($_GET['type']) || !isset($_GET['image'])) {
if (!isset($_GET['title']) || !isset($_GET['type']) || !isset($_GET['image'])) {
api_not_allowed();
die();
}
if(!isset($_SESSION['paint_dir']) || !isset($_SESSION['whereami']) ){
if (!isset($_SESSION['paint_dir']) || !isset($_SESSION['whereami'])) {
api_not_allowed();
die();
}
//pixlr return
$filename=Security::remove_XSS($_GET['title']);//The user preferred file name of the image.
$extension=Security::remove_XSS($_GET['type']);//The image type, "pdx", "jpg", "bmp" or "png".
$urlcontents=Security::remove_XSS($_GET['image']);//A URL to the image on Pixlr.com server or the raw file post of the saved image.
$filename = Security::remove_XSS($_GET['title']); //The user preferred file name of the image.
$extension = Security::remove_XSS($_GET['type']); //The image type, "pdx", "jpg", "bmp" or "png".
$urlcontents = Security::remove_XSS($_GET['image']); //A URL to the image on Pixlr.com server or the raw file post of the saved image.
//make variables
$title = Database::escape_string(str_replace('_',' ',$filename));
$title = Database::escape_string(str_replace('_', ' ', $filename));
$current_session_id = api_get_session_id();
$groupId= api_get_group_id();
$relativeUrlPath=$_SESSION['paint_dir'];
$currentTool=$_SESSION['whereami'];
$groupId = api_get_group_id();
$relativeUrlPath = $_SESSION['paint_dir'];
$currentTool = $_SESSION['whereami'];
$dirBaseDocuments = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$saveDir=$dirBaseDocuments.$_SESSION['paint_dir'];
$saveDir = $dirBaseDocuments.$_SESSION['paint_dir'];
$contents = file_get_contents($urlcontents);
@ -71,8 +71,8 @@ $filename = Security::remove_XSS($filename);
$filename = api_replace_dangerous_char($filename);
$filename = disable_dangerous_file($filename);
if (strlen(trim($filename))==0) {
echo "The title is empty";//if title is empty, headers Content-Type = application/octet-stream, then not create a new title here please
if (strlen(trim($filename)) == 0) {
echo "The title is empty"; //if title is empty, headers Content-Type = application/octet-stream, then not create a new title here please
exit;
}
@ -83,11 +83,11 @@ if ($contents === false) {
}
// Extension security
if($extension!= 'jpg' && $extension!= 'png' && $extension!= 'pxd'){
if ($extension != 'jpg' && $extension != 'png' && $extension != 'pxd') {
die();
}
if($extension=='pxd') {
echo "pxd file type does not supported";// not secure because check security headers and finfo() return Content-Type = application/octet-stream
if ($extension == 'pxd') {
echo "pxd file type does not supported"; // not secure because check security headers and finfo() return Content-Type = application/octet-stream
exit;
}
@ -101,9 +101,9 @@ if ($content_type[0] != "image") {
//Verify that the file is an image. Fileinfo method
$finfo = new finfo(FILEINFO_MIME);
$current_mime=$finfo->buffer($contents);
$current_mime = $finfo->buffer($contents);
finfo_close($finfo);
if(strpos($current_mime, 'image')===false) {
if (strpos($current_mime, 'image') === false) {
echo "Invalid mime type file";
exit;
}
@ -113,46 +113,46 @@ if(strpos($current_mime, 'image')===false) {
$paintFileName = $filename.'.'.$extension;
$title = $title.'.'.$extension;
if($currentTool=='document/createpaint'){
if ($currentTool == 'document/createpaint') {
//check save as and prevent rewrite an older file with same name
if (0 != $groupId){
$group_properties = GroupManager :: get_group_properties($groupId);
if (0 != $groupId) {
$group_properties = GroupManager :: get_group_properties($groupId);
$groupPath = $group_properties['directory'];
} else {
$groupPath ='';
$groupPath = '';
}
if (file_exists($saveDir.'/'.$filename.'.'.$extension)){
if (file_exists($saveDir.'/'.$filename.'.'.$extension)) {
$i = 1;
while (file_exists($saveDir.'/'.$filename.'_'.$i.'.'.$extension)) $i++;
$paintFileName = $filename . '_' . $i . '.'.$extension;
$title = $filename . '_' . $i . '.'.$extension;
$paintFileName = $filename.'_'.$i.'.'.$extension;
$title = $filename.'_'.$i.'.'.$extension;
}
//
$documentPath = $saveDir.'/'.$paintFileName;
//add new document to disk
file_put_contents( $documentPath, $contents );
file_put_contents($documentPath, $contents);
//add document to database
$doc_id = add_document($_course, $relativeUrlPath.'/'.$paintFileName, 'file', filesize($documentPath), $title);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id);
}elseif($currentTool=='document/editpaint'){
}elseif ($currentTool == 'document/editpaint') {
$documentPath = $saveDir.'/'.$paintFileName;
//add new document to disk
file_put_contents( $documentPath, $contents );
file_put_contents($documentPath, $contents);
//check path
if(!isset($_SESSION['paint_file'])){
if (!isset($_SESSION['paint_file'])) {
api_not_allowed();
die();
}
if($_SESSION['paint_file']==$paintFileName){
if ($_SESSION['paint_file'] == $paintFileName) {
$document_id = DocumentManager::get_document_id($_course, $relativeUrlPath.'/'.$paintFileName);
update_existing_document($_course, $document_id, filesize($documentPath), null);
api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentUpdated', $_user['user_id'], $groupId, null, null, null, $current_session_id);
}else{
} else {
//add a new document
$doc_id = add_document($_course, $relativeUrlPath.'/'.$paintFileName, 'file', filesize($documentPath), $title);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id);
@ -161,7 +161,7 @@ if($currentTool=='document/createpaint'){
//delete temporal file
$temp_file_2delete=$_SESSION['temp_realpath_image'];
$temp_file_2delete = $_SESSION['temp_realpath_image'];
unlink($temp_file_2delete);
//Clean sessions and return to Chamilo file list
@ -171,12 +171,12 @@ unset($_SESSION['whereami']);
unset($_SESSION['temp_realpath_image']);
if (!isset($_SESSION['exit_pixlr'])) {
$location=api_get_path(WEB_CODE_PATH).'document/document.php';
$location = api_get_path(WEB_CODE_PATH).'document/document.php';
echo '<script>window.parent.location.href="'.$location.'"</script>';
api_not_allowed(true);
} else {
echo '<div align="center" style="padding-top:150; font-family:Arial, Helvetica, Sans-serif;font-size:25px;color:#aaa;font-weight:bold;">'.get_lang('PleaseStandBy').'</div>';
$location=api_get_path(WEB_CODE_PATH).'document/document.php?id='.Security::remove_XSS($_SESSION['exit_pixlr']);
$location = api_get_path(WEB_CODE_PATH).'document/document.php?id='.Security::remove_XSS($_SESSION['exit_pixlr']);
echo '<script>window.parent.location.href="'.$location.'"</script>';
unset($_SESSION['exit_pixlr']);
}

@ -32,7 +32,7 @@ $doc_url = str_replace('///', '&', $doc_url);
$doc_url = str_replace(' ', '+', $doc_url);
$doc_url = str_replace('/..', '', $doc_url); //echo $doc_url;
if (! isset($_course)) {
if (!isset($_course)) {
api_not_allowed(true);
}
@ -52,11 +52,11 @@ if (is_dir($full_file_name)) {
exit;
}
$tbl_forum_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
$tbl_forum_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
$tbl_forum_post = Database::get_course_table(TABLE_FORUM_POST);
$course_id = api_get_course_int_id();
$courseInfo = api_get_course_info_by_id($course_id);
$courseInfo = api_get_course_info_by_id($course_id);
// launch event
Event::event_download($doc_url);
@ -86,7 +86,7 @@ $forum_forum_visibility = api_get_item_visibility(
api_get_session_id()
);
if ($forum_thread_visibility==1 && $forum_forum_visibility==1) {
if ($forum_thread_visibility == 1 && $forum_forum_visibility == 1) {
if (Security::check_abs_path(
$full_file_name,
api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/upload/forum/')

@ -29,7 +29,7 @@ $(document).ready(function(){ $(\'.hide-me\').slideUp() });
// Are we in a lp ?
$origin = '';
if (isset($_GET['origin'])) {
$origin = Security::remove_XSS($_GET['origin']);
$origin = Security::remove_XSS($_GET['origin']);
}
/* MAIN DISPLAY SECTION */
@ -46,12 +46,12 @@ $whatsnew_post_info = $_SESSION['whatsnew_post_info'];
/* Header and Breadcrumbs */
if (isset($_SESSION['gradebook'])){
if (isset($_SESSION['gradebook'])) {
$gradebook = $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array (
$interbreadcrumb[] = array(
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
@ -181,7 +181,7 @@ if ($message != 'PostDeletedSpecial') {
echo "\t<tr>\n\t\t<th style=\"padding-left:5px;\" align=\"left\" colspan=\"6\">";
echo '<span class="forum_title">'.prepare4display($current_thread['thread_title']).'</span><br />';
if ($origin!='learnpath') {
if ($origin != 'learnpath') {
echo '<span class="forum_low_description">'.prepare4display($current_forum_category['cat_title']).' - ';
}

@ -16,10 +16,10 @@ $this_section = SECTION_TRACKING;
$nameTools = get_lang('Tutors');
api_block_anonymous_users();
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace'));
if (isset($_GET["id_student"])) {
$interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang('Students'));
$interbreadcrumb[] = array("url" => "student.php", "name" => get_lang('Students'));
}
Display :: display_header($nameTools);
@ -27,14 +27,14 @@ Display :: display_header($nameTools);
api_display_tool_title($nameTools);
// Database Table Definitions
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_rel_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_rel_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
/**
* MAIN PART
@ -214,7 +214,7 @@ if (Database::num_rows($result_coachs) > 0) {
}
echo '</table>';
if (isset($_POST['export'])){
if (isset($_POST['export'])) {
export_csv($header, $data, 'coaches.csv');
}
@ -222,8 +222,8 @@ echo "<br /><br />";
echo "
<br /><br />
<form method='post' action='coaches.php'>
<button type='submit' class='save' name='export' value='" . get_lang('ExportExcel') . "'>
" . get_lang('ExportExcel') . "
<button type='submit' class='save' name='export' value='" . get_lang('ExportExcel')."'>
" . get_lang('ExportExcel')."
</button>
<form>
";

@ -16,14 +16,14 @@ $cidReset = true;
$this_section = SECTION_TRACKING;
api_block_anonymous_users();
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace'));
Display :: display_header($nameTools);
// Database Table Definitions
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_track_exercice = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
/*

@ -15,12 +15,12 @@ $this_section = SECTION_PLATFORM_ADMIN; // TODO: Platform admin section?
$tool_name = get_lang('ImportUserListXMLCSV');
api_block_anonymous_users();
$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace'));
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('MySpace'));
$id_session = '';
if (isset($_GET['id_session']) && $_GET['id_session'] != '') {
$id_session = intval($_GET['id_session']);
$interbreadcrumb[] = array ('url' => 'session.php', 'name' => get_lang('Sessions'));
$interbreadcrumb[] = array ('url' => 'course.php?id_session='.$id_session.'', 'name' => get_lang('Course'));
$interbreadcrumb[] = array('url' => 'session.php', 'name' => get_lang('Sessions'));
$interbreadcrumb[] = array('url' => 'course.php?id_session='.$id_session.'', 'name' => get_lang('Course'));
}
// Set this option to true to enforce strict purification for usenames.
@ -62,7 +62,7 @@ if ($_POST['formSent'] && $_FILES['import_file']['size'] !== 0) {
if (count($errors) == 0) {
if (!empty($id_session)) {
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
// Selecting all the courses from the session id requested.
$sql = "SELECT c_id FROM $tbl_session_rel_course WHERE session_id ='$id_session'";
$result = Database::query($sql);
@ -105,10 +105,10 @@ if (count($errors) != 0) {
$form = new FormValidator('user_import');
$form->addElement('hidden', 'formSent');
$form->addElement('hidden', 'id_session',$id_session);
$form->addElement('hidden', 'id_session', $id_session);
$form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
$form->addRule('import_file', get_lang('ThisFieldIsRequired'), 'required');
$allowed_file_types = array ('xml', 'csv');
$allowed_file_types = array('xml', 'csv');
$form->addRule('import_file', get_lang('InvalidExtension').' ('.implode(',', $allowed_file_types).')', 'filetype', $allowed_file_types);
$form->addElement('radio', 'file_type', get_lang('FileType'), 'XML (<a href="../admin/example.xml" target="_blank">'.get_lang('ExampleXMLFile').'</a>)', 'xml');
$form->addElement('radio', 'file_type', null, 'CSV (<a href="../admin/example.csv" target="_blank">'.get_lang('ExampleCSVFile').'</a>)', 'csv');

@ -13,7 +13,7 @@ require_once __DIR__.'/../inc/global.inc.php';
//Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
$interbreadcrumb[] = array("url" => "index.php","name" => get_lang('Skills'));
$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('Skills'));
//jqgrid will use this URL to do the selects
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_user_skill_ranking';
@ -28,7 +28,7 @@ $columns = array(
get_lang('Rank')
);
$column_model = array(
$column_model = array(
array(
'name' => 'photo',
'index' => 'photo',

@ -57,7 +57,7 @@ $tpl->assign('dialogForm', $dialogForm->returnForm());
$url = api_get_path(WEB_AJAX_PATH)."skill.ajax.php?a=get_skills_tree_json&load_user=$userId";
$tpl->assign('wheel_url', $url);
$url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1';
$url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1';
$tpl->assign('url', $url);
$tpl->assign('user_info', $userInfo);

@ -1,9 +1,9 @@
<?php
$_template['show_message'] = false;
$_template['show_message'] = false;
if (api_is_anonymous()) {
$_template['show_message'] = true;
$_template['show_message'] = true;
// the default title label
$label = "Connexion hors compte universitaire";
if (!empty($plugin_info['settings']['formLogin_hide_unhide_label'])) {

@ -10,7 +10,7 @@
*/
//the plugin title
$plugin_info['title'] = 'Hide/Unhide the Login/Password default form';
$plugin_info['title'] = 'Hide/Unhide the Login/Password default form';
//the comments that go with the plugin
$plugin_info['comment'] = "If you use another way of authentication than local, you may want to hide the Login/Password default Form to avoid users mistakes. This plugin replace the Login/Password form with a text that unhide the Login/Password form if you click on it.";
@ -31,4 +31,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');

@ -464,7 +464,7 @@ class DropBoxDriver extends \elFinderVolumeMySQL implements DriverInterface
* @return resource|false
* @author Dmitry (dio) Levashov
**/
protected function _fopen($path, $mode='rb') {
protected function _fopen($path, $mode = 'rb') {
$fp = $this->tmbPath
? @fopen($this->tmpname($path), 'w+')
: @tmpfile();
@ -491,7 +491,7 @@ class DropBoxDriver extends \elFinderVolumeMySQL implements DriverInterface
* @return bool
* @author Dmitry (dio) Levashov
**/
protected function _fclose($fp, $path='') {
protected function _fclose($fp, $path = '') {
@fclose($fp);
if ($path) {
@unlink($this->tmpname($path));

@ -24,8 +24,8 @@ class PersonalDriver extends Driver implements DriverInterface
mkdir($dir);
}
if (!is_dir($dir . 'my_files')) {
mkdir($dir . 'my_files');
if (!is_dir($dir.'my_files')) {
mkdir($dir.'my_files');
}
}
}

@ -47,7 +47,7 @@ class TinyMce extends Editor
*/
public function editorReplace()
{
$toolbar = new Toolbar\Basic($this->urlGenerator, $this->toolbarSet, $this->config, 'TinyMce');
$toolbar = new Toolbar\Basic($this->urlGenerator, $this->toolbarSet, $this->config, 'TinyMce');
$toolbar->setLanguage($this->getLocale());
$config = $toolbar->getConfig();
$config['selector'] = "#".$this->name;

@ -196,7 +196,7 @@ class ItemPropertyRepository extends EntityRepository
$users = \GroupManager::getStudentsAndTutors($groupId);
$newUserList = array();
if (!empty($users)) {
foreach($users as $user) {
foreach ($users as $user) {
$newUserList[] = $user['user_id'];
}
$this->unsubcribeUsersToItem(

@ -479,7 +479,7 @@ class Session
Criteria::expr()->eq("user", $user)
);
if (!is_null($status)) {
if (!is_null($status)) {
$criteria->andWhere(
Criteria::expr()->eq("status", $status)
);

Loading…
Cancel
Save