Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
pull/2487/head
Scrutinizer Auto-Fixer 9 years ago
parent dcbb021a4f
commit 09280de8dc
  1. 14
      bin/doctrine.php
  2. 8
      main/admin/configure_plugin.php
  3. 2
      main/admin/course_request_rejected.php
  4. 22
      main/admin/ldap_form_add_users_group.php
  5. 18
      main/exercise/hotspot_lang_conversion.php
  6. 290
      main/inc/lib/add_course.lib.inc.php
  7. 4
      main/inc/lib/agenda.lib.php
  8. 46
      main/inc/lib/webservices/Rest.php
  9. 26
      main/install/update-configuration.inc.php
  10. 10
      main/install/update-files-1.10.0-1.11.0.inc.php
  11. 6
      main/lp/aicc_hacp.php
  12. 2
      main/lp/lp_ajax_switch_item.php
  13. 18
      main/lp/lp_move_item.php
  14. 12
      main/survey/survey_question.php
  15. 6
      main/ticket/tutor.php
  16. 920
      main/webservices/registration.soap.php
  17. 20
      plugin/buycourses/src/service_process.php
  18. 2
      plugin/google_maps/uninstall.php
  19. 24
      plugin/vchamilo/cli/bulkcreatenodes.php

@ -20,26 +20,26 @@ use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Symfony\Component\Console\Helper\HelperSet;
use Doctrine\DBAL\Types\Type;
(@include_once __DIR__ . '/../vendor/autoload.php') || @include_once __DIR__ . '/../../../autoload.php';
(@include_once __DIR__.'/../vendor/autoload.php') || @include_once __DIR__.'/../../../autoload.php';
$directories = array(getcwd(), getcwd() . DIRECTORY_SEPARATOR . 'config');
$directories = array(getcwd(), getcwd().DIRECTORY_SEPARATOR.'config');
$configFile = null;
foreach ($directories as $directory) {
$configFile = $directory . DIRECTORY_SEPARATOR . 'cli-config.php';
$configFile = $directory.DIRECTORY_SEPARATOR.'cli-config.php';
if (file_exists($configFile)) {
break;
}
}
if ( ! file_exists($configFile)) {
if (!file_exists($configFile)) {
ConsoleRunner::printCliConfigTemplate();
exit(1);
}
if ( ! is_readable($configFile)) {
echo 'Configuration file [' . $configFile . '] does not have read permission.' . "\n";
if (!is_readable($configFile)) {
echo 'Configuration file ['.$configFile.'] does not have read permission.'."\n";
exit(1);
}
@ -65,7 +65,7 @@ $commands = array(
$helperSet = require $configFile;
if ( ! ($helperSet instanceof HelperSet)) {
if (!($helperSet instanceof HelperSet)) {
foreach ($GLOBALS as $helperSetCandidate) {
if ($helperSetCandidate instanceof HelperSet) {
$helperSet = $helperSetCandidate;

@ -24,7 +24,7 @@ if (!in_array($pluginName, $installedPlugins) || empty($pluginInfo)) {
global $_configuration;
$content = '';
$currentUrl = api_get_self() . "?name=$pluginName";
$currentUrl = api_get_self()."?name=$pluginName";
if (isset($pluginInfo['settings_form'])) {
/** @var FormValidator $form */
@ -67,7 +67,7 @@ if (isset($form)) {
$value = trim($value);
api_add_setting(
$value,
Database::escape_string($pluginName . '_' . $key),
Database::escape_string($pluginName.'_'.$key),
$pluginName,
'setting',
'Plugins',
@ -97,11 +97,11 @@ if (isset($form)) {
}
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH) . 'admin/index.php',
'url' => api_get_path(WEB_CODE_PATH).'admin/index.php',
'name' => get_lang('PlatformAdmin')
);
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH) . 'admin/settings.php?category=Plugins',
'url' => api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins',
'name' => get_lang('Plugins')
);

@ -114,7 +114,7 @@ function get_request_data($from, $number_of_items, $column, $direction)
$from = intval($from);
$number_of_items = intval($number_of_items);
$column = intval($column);
$direction = !in_array(strtolower(trim($direction)), ['asc','desc']) ? 'asc' : $direction;
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$sql = "SELECT
id AS col0,

@ -9,7 +9,7 @@
/**
* This form is included by ldap_import_students.php and ldap_import_students_to_session.php
*/
$nbre=0;
$nbre = 0;
echo '<form name="form" method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'">';
if ($statut == 1) {
echo get_lang(
@ -28,23 +28,23 @@ if (!empty($course)) {
$is_western_name_order = api_is_western_name_order();
echo '<input type="hidden" name="confirmed" value="yes">';
echo '<table border="0" cellspacing="0" width="100%">';
echo '<tr align="center" id="header3">' .
'<td width="15%"><input type="button" value="'.get_lang('AllSlashNone').'" onClick="checkAll();"></td>' .
'<td width="40%"><b>'.get_lang('Email').'</b></td>' .
echo '<tr align="center" id="header3">'.
'<td width="15%"><input type="button" value="'.get_lang('AllSlashNone').'" onClick="checkAll();"></td>'.
'<td width="40%"><b>'.get_lang('Email').'</b></td>'.
($is_western_name_order
? '<td width="15%"><b>'.get_lang('FirstName').'</b></td>' .
? '<td width="15%"><b>'.get_lang('FirstName').'</b></td>'.
'<td width="15%"><b>'.get_lang('Name').'</b></td>'
: '<td width="15%"><b>'.get_lang('Name').'</b></td>' .
'<td width="15%"><b>'.get_lang('FirstName').'</b></td>') .
'<td width="15%"><b>'.get_lang('Login').'</b></td>' .
: '<td width="15%"><b>'.get_lang('Name').'</b></td>'.
'<td width="15%"><b>'.get_lang('FirstName').'</b></td>').
'<td width="15%"><b>'.get_lang('Login').'</b></td>'.
'</tr>'."\n";
while (list ($key, $val) = each($nom_form)) {
$nbre=$nbre+1;
if($nbre & 1) $ndiv=2; else $ndiv=3;
$nbre = $nbre + 1;
if ($nbre & 1) $ndiv = 2; else $ndiv = 3;
echo '<tr align="center" id="header'.$ndiv.'">';
echo '<td><input type="checkbox" name="checkboxes[]" value="'.$key.'" checked="checked"></td>';
echo '<td>'.$email_form[$key].'<input type="hidden" name="email_form['.$key.']" size="40" value="'.$email_form[$key].'"></td>';
if ($is_western_name_order) {
if ($is_western_name_order) {
echo '<td>'.$prenom_form[$key].'<input type="hidden" name="prenom_form['.$key.']" size="20" value="'.$prenom_form[$key].'"></td>';
echo '<td>'.$nom_form[$key].'<input type="hidden" name="nom_form['.$key.']" size="20" value="'.$nom_form[$key].'"></td>';
} else {

@ -14,13 +14,13 @@ require_once __DIR__.'/../inc/global.inc.php';
$hotspot_lang_file = api_get_path(SYS_LANG_PATH);
if(isset($_GET['lang'])) {
if (isset($_GET['lang'])) {
//$search = array('../','\\0','\\');
$lang = urldecode($_GET['lang']);
if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) {
//$lang = str_replace($search,$replace,urldecode($_GET['lang']));
if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php'))
$hotspot_lang_file .= $lang . '/hotspot.inc.php';
if (file_exists($hotspot_lang_file.$lang.'/hotspot.inc.php'))
$hotspot_lang_file .= $lang.'/hotspot.inc.php';
else
$hotspot_lang_file .= 'english/hotspot.inc.php';
} else {
@ -34,25 +34,25 @@ $file = file($hotspot_lang_file);
$temp = array();
foreach($file as $value)
foreach ($file as $value)
{
$explode = explode('=', $value);
if(count($explode) > 1)
if (count($explode) > 1)
{
$explode[0] = trim($explode[0]);
$explode[0] = '&' . substr($explode[0], 1, strlen($explode[0]));
$explode[0] = '&'.substr($explode[0], 1, strlen($explode[0]));
$explode[1] = trim($explode[1]);
$explode[1] = substr($explode[1], 0, strlen($explode[1]) - 1);
$explode[1] = str_replace('"', '', $explode[1]);
$temp[] = $explode[0] . '=' . $explode[1];
$temp[] = $explode[0].'='.$explode[1];
}
}
foreach($temp as $value)
foreach ($temp as $value)
{
echo $value . ' ';
echo $value.' ';
}
?>

@ -46,8 +46,8 @@ class AddCourse
$try_new_fsc_id = $try_new_fsc_db = $try_new_fsc_dir = 0;
while (!$keys_are_unique) {
$keys_course_id = $prefix_for_all . $unique_prefix . $wanted_code . $final_suffix['CourseId'];
$keys_course_repository = $prefix_for_path . $unique_prefix . $wanted_code . $final_suffix['CourseDir'];
$keys_course_id = $prefix_for_all.$unique_prefix.$wanted_code.$final_suffix['CourseId'];
$keys_course_repository = $prefix_for_path.$unique_prefix.$wanted_code.$final_suffix['CourseDir'];
$keys_are_unique = true;
// Check whether they are unique.
@ -58,12 +58,12 @@ class AddCourse
if (Database::num_rows($result)) {
$keys_are_unique = false;
$try_new_fsc_id ++;
$try_new_fsc_id++;
$final_suffix['CourseId'] = substr(md5(uniqid(rand())), 0, 4);
}
if (file_exists(api_get_path(SYS_COURSE_PATH).$keys_course_repository)) {
$keys_are_unique = false;
$try_new_fsc_dir ++;
$try_new_fsc_dir++;
$final_suffix['CourseDir'] = substr(md5(uniqid(rand())), 0, 4);
}
@ -91,12 +91,12 @@ class AddCourse
$perm = api_get_permissions_for_new_directories();
$perm_file = api_get_permissions_for_new_files();
$htmlpage = "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <title>Not authorized</title>\n </head>\n <body>\n </body>\n</html>";
$cp = api_get_path(SYS_COURSE_PATH) . $course_repository;
$cp = api_get_path(SYS_COURSE_PATH).$course_repository;
//Creating document folder
mkdir($cp, $perm);
mkdir($cp . '/document', $perm);
$cpt = $cp . '/document/index.html';
mkdir($cp.'/document', $perm);
$cpt = $cp.'/document/index.html';
$fd = fopen($cpt, 'w');
fwrite($fd, $htmlpage);
fclose($fd);
@ -118,49 +118,49 @@ class AddCourse
@copy($cpt, $cp . '/document/video/index.html'); */
//Creatind dropbox folder
mkdir($cp . '/dropbox', $perm);
$cpt = $cp . '/dropbox/index.html';
mkdir($cp.'/dropbox', $perm);
$cpt = $cp.'/dropbox/index.html';
$fd = fopen($cpt, 'w');
fwrite($fd, $htmlpage);
fclose($fd);
@chmod($cpt, $perm_file);
mkdir($cp . '/group', $perm);
@copy($cpt, $cp . '/group/index.html');
mkdir($cp . '/page', $perm);
@copy($cpt, $cp . '/page/index.html');
mkdir($cp . '/scorm', $perm);
@copy($cpt, $cp . '/scorm/index.html');
mkdir($cp . '/upload', $perm);
@copy($cpt, $cp . '/upload/index.html');
mkdir($cp . '/upload/forum', $perm);
@copy($cpt, $cp . '/upload/forum/index.html');
mkdir($cp . '/upload/forum/images', $perm);
@copy($cpt, $cp . '/upload/forum/images/index.html');
mkdir($cp . '/upload/test', $perm);
@copy($cpt, $cp . '/upload/test/index.html');
mkdir($cp . '/upload/blog', $perm);
@copy($cpt, $cp . '/upload/blog/index.html');
mkdir($cp . '/upload/learning_path', $perm);
@copy($cpt, $cp . '/upload/learning_path/index.html');
mkdir($cp . '/upload/learning_path/images', $perm);
@copy($cpt, $cp . '/upload/learning_path/images/index.html');
mkdir($cp . '/upload/calendar', $perm);
@copy($cpt, $cp . '/upload/calendar/index.html');
mkdir($cp . '/upload/calendar/images', $perm);
@copy($cpt, $cp . '/upload/calendar/images/index.html');
mkdir($cp . '/work', $perm);
@copy($cpt, $cp . '/work/index.html');
mkdir($cp . '/upload/announcements', $perm);
@copy($cpt, $cp . '/upload/announcements/index.html');
mkdir($cp . '/upload/announcements/images', $perm);
@copy($cpt, $cp . '/upload/announcements/images/index.html');
mkdir($cp.'/group', $perm);
@copy($cpt, $cp.'/group/index.html');
mkdir($cp.'/page', $perm);
@copy($cpt, $cp.'/page/index.html');
mkdir($cp.'/scorm', $perm);
@copy($cpt, $cp.'/scorm/index.html');
mkdir($cp.'/upload', $perm);
@copy($cpt, $cp.'/upload/index.html');
mkdir($cp.'/upload/forum', $perm);
@copy($cpt, $cp.'/upload/forum/index.html');
mkdir($cp.'/upload/forum/images', $perm);
@copy($cpt, $cp.'/upload/forum/images/index.html');
mkdir($cp.'/upload/test', $perm);
@copy($cpt, $cp.'/upload/test/index.html');
mkdir($cp.'/upload/blog', $perm);
@copy($cpt, $cp.'/upload/blog/index.html');
mkdir($cp.'/upload/learning_path', $perm);
@copy($cpt, $cp.'/upload/learning_path/index.html');
mkdir($cp.'/upload/learning_path/images', $perm);
@copy($cpt, $cp.'/upload/learning_path/images/index.html');
mkdir($cp.'/upload/calendar', $perm);
@copy($cpt, $cp.'/upload/calendar/index.html');
mkdir($cp.'/upload/calendar/images', $perm);
@copy($cpt, $cp.'/upload/calendar/images/index.html');
mkdir($cp.'/work', $perm);
@copy($cpt, $cp.'/work/index.html');
mkdir($cp.'/upload/announcements', $perm);
@copy($cpt, $cp.'/upload/announcements/index.html');
mkdir($cp.'/upload/announcements/images', $perm);
@copy($cpt, $cp.'/upload/announcements/images/index.html');
//Oral expression question type
mkdir($cp . '/exercises', $perm);
@copy($cpt, $cp . '/exercises/index.html');
mkdir($cp.'/exercises', $perm);
@copy($cpt, $cp.'/exercises/index.html');
// Create .htaccess in the dropbox directory.
$fp = fopen($cp . '/dropbox/.htaccess', 'w');
$fp = fopen($cp.'/dropbox/.htaccess', 'w');
fwrite(
$fp,
"AuthName AllowLocalAccess
@ -302,7 +302,7 @@ class AddCourse
{
$list = self::get_course_tables();
foreach ($list as $table) {
$sql = "DROP TABLE IF EXISTS " . DB_COURSE_PREFIX . $table;
$sql = "DROP TABLE IF EXISTS ".DB_COURSE_PREFIX.$table;
Database::query($sql);
}
}
@ -326,47 +326,47 @@ class AddCourse
if ($media == 'images') {
$code_path = api_get_path(
SYS_CODE_PATH
) . 'default_course_document/images/';
).'default_course_document/images/';
}
if ($media == 'audio') {
$code_path = api_get_path(
SYS_CODE_PATH
) . 'default_course_document/audio/';
).'default_course_document/audio/';
}
if ($media == 'flash') {
$code_path = api_get_path(
SYS_CODE_PATH
) . 'default_course_document/flash/';
).'default_course_document/flash/';
}
if ($media == 'video') {
$code_path = api_get_path(
SYS_CODE_PATH
) . 'default_course_document/video/';
).'default_course_document/video/';
}
if ($media == 'certificates') {
$code_path = api_get_path(
SYS_CODE_PATH
) . 'default_course_document/certificates/';
).'default_course_document/certificates/';
}
if (is_dir($path)) {
$handle = opendir($path);
while (false !== ($file = readdir($handle))) {
if (is_dir($path . $file) && strpos($file, '.') !== 0) {
if (is_dir($path.$file) && strpos($file, '.') !== 0) {
$files[]['dir'] = str_replace(
$code_path,
'',
$path . $file . '/'
$path.$file.'/'
);
$files = self::browse_folders(
$path . $file . '/',
$path.$file.'/',
$files,
$media
);
} elseif (is_file($path . $file) && strpos($file, '.') !== 0) {
} elseif (is_file($path.$file) && strpos($file, '.') !== 0) {
$files[]['file'] = str_replace(
$code_path,
'',
$path . $file
$path.$file
);
}
}
@ -441,117 +441,117 @@ class AddCourse
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 1, '" . TOOL_COURSE_DESCRIPTION . "','course_description/','info.gif','" . self::string2binary(
VALUES ($course_id, 1, '".TOOL_COURSE_DESCRIPTION."','course_description/','info.gif','".self::string2binary(
api_get_setting(
'course_create_active_tools',
'course_description'
)
) . "','0','squaregrey.gif', 0,'_self','authoring','0')"
)."','0','squaregrey.gif', 0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 2, '" . TOOL_CALENDAR_EVENT . "','calendar/agenda.php','agenda.gif','" . self::string2binary(
VALUES ($course_id, 2, '".TOOL_CALENDAR_EVENT."','calendar/agenda.php','agenda.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'agenda')
) . "','0','squaregrey.gif',0,'_self','interaction','0')"
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 3, '" . TOOL_DOCUMENT . "','document/document.php','folder_document.gif','" . self::string2binary(
VALUES ($course_id, 3, '".TOOL_DOCUMENT."','document/document.php','folder_document.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'documents')
) . "','0','squaregrey.gif',0,'_self','authoring','0')"
)."','0','squaregrey.gif',0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 4, '" . TOOL_LEARNPATH . "','lp/lp_controller.php','scorms.gif','" . self::string2binary(
VALUES ($course_id, 4, '".TOOL_LEARNPATH."','lp/lp_controller.php','scorms.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'learning_path')
) . "','0','squaregrey.gif',0,'_self','authoring','0')"
)."','0','squaregrey.gif',0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 5, '" . TOOL_LINK . "','link/link.php','links.gif','" . self::string2binary(
VALUES ($course_id, 5, '".TOOL_LINK."','link/link.php','links.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'links')
) . "','0','squaregrey.gif',0,'_self','authoring','0')"
)."','0','squaregrey.gif',0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 6, '" . TOOL_QUIZ . "','exercise/exercise.php','quiz.gif','" . self::string2binary(
VALUES ($course_id, 6, '".TOOL_QUIZ."','exercise/exercise.php','quiz.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'quiz')
) . "','0','squaregrey.gif',0,'_self','authoring','0')"
)."','0','squaregrey.gif',0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 7, '" . TOOL_ANNOUNCEMENT . "','announcements/announcements.php','valves.gif','" . self::string2binary(
VALUES ($course_id, 7, '".TOOL_ANNOUNCEMENT."','announcements/announcements.php','valves.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'announcements')
) . "','0','squaregrey.gif', 0,'_self','authoring','0')"
)."','0','squaregrey.gif', 0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 8, '" . TOOL_FORUM . "','forum/index.php','forum.gif','" . self::string2binary(
VALUES ($course_id, 8, '".TOOL_FORUM."','forum/index.php','forum.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'forums')
) . "','0','squaregrey.gif',0,'_self','interaction','0')"
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 9, '" . TOOL_DROPBOX . "','dropbox/index.php','dropbox.gif','" . self::string2binary(
VALUES ($course_id, 9, '".TOOL_DROPBOX."','dropbox/index.php','dropbox.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'dropbox')
) . "','0','squaregrey.gif',0,'_self','interaction','0')"
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 10, '" . TOOL_USER . "','user/user.php','members.gif','" . self::string2binary(
VALUES ($course_id, 10, '".TOOL_USER."','user/user.php','members.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'users')
) . "','0','squaregrey.gif',0,'_self','interaction','0')"
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 11, '" . TOOL_GROUP . "','group/group.php','group.gif','" . self::string2binary(
VALUES ($course_id, 11, '".TOOL_GROUP."','group/group.php','group.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'groups')
) . "','0','squaregrey.gif',0,'_self','interaction','0')"
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 12, '" . TOOL_CHAT . "','chat/chat.php','chat.gif','" . self::string2binary(
VALUES ($course_id, 12, '".TOOL_CHAT."','chat/chat.php','chat.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'chat')
) . "','0','squaregrey.gif',0,'_self','interaction','0')"
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 13, '" . TOOL_STUDENTPUBLICATION . "','work/work.php','works.gif','" . self::string2binary(
VALUES ($course_id, 13, '".TOOL_STUDENTPUBLICATION."','work/work.php','works.gif','".self::string2binary(
api_get_setting(
'course_create_active_tools',
'student_publications'
)
) . "','0','squaregrey.gif',0,'_self','interaction','0')"
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 14, '" . TOOL_SURVEY . "','survey/survey_list.php','survey.gif','" . self::string2binary(
VALUES ($course_id, 14, '".TOOL_SURVEY."','survey/survey_list.php','survey.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'survey')
) . "','0','squaregrey.gif',0,'_self','interaction','0')"
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 15, '" . TOOL_WIKI . "','wiki/index.php','wiki.gif','" . self::string2binary(
VALUES ($course_id, 15, '".TOOL_WIKI."','wiki/index.php','wiki.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'wiki')
) . "','0','squaregrey.gif',0,'_self','interaction','0')"
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 16, '" . TOOL_GRADEBOOK . "','gradebook/index.php','gradebook.gif','" . self::string2binary(
VALUES ($course_id, 16, '".TOOL_GRADEBOOK."','gradebook/index.php','gradebook.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'gradebook')
) . "','0','squaregrey.gif',0,'_self','authoring','0')"
)."','0','squaregrey.gif',0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 17, '" . TOOL_GLOSSARY . "','glossary/index.php','glossary.gif','" . self::string2binary(
VALUES ($course_id, 17, '".TOOL_GLOSSARY."','glossary/index.php','glossary.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'glossary')
) . "','0','squaregrey.gif',0,'_self','authoring','0')"
)."','0','squaregrey.gif',0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 18, '" . TOOL_NOTEBOOK . "','notebook/index.php','notebook.gif','" . self::string2binary(
VALUES ($course_id, 18, '".TOOL_NOTEBOOK."','notebook/index.php','notebook.gif','".self::string2binary(
api_get_setting('course_create_active_tools', 'notebook')
) . "','0','squaregrey.gif',0,'_self','interaction','0')"
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
$setting = intval(self::string2binary(
@ -560,45 +560,45 @@ class AddCourse
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 19, '" . TOOL_ATTENDANCE . "','attendance/index.php','attendance.gif','" . $setting. "','0','squaregrey.gif',0,'_self','authoring','0')"
VALUES ($course_id, 19, '".TOOL_ATTENDANCE."','attendance/index.php','attendance.gif','".$setting."','0','squaregrey.gif',0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 20, '" . TOOL_COURSE_PROGRESS . "','course_progress/index.php','course_progress.gif','" . self::string2binary(
VALUES ($course_id, 20, '".TOOL_COURSE_PROGRESS."','course_progress/index.php','course_progress.gif','".self::string2binary(
intval(api_get_setting('course_create_active_tools', 'course_progress'))
) . "','0','squaregrey.gif',0,'_self','authoring','0')"
)."','0','squaregrey.gif',0,'_self','authoring','0')"
);
if (api_get_setting('search_enabled') === 'true') {
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 23, '" . TOOL_SEARCH . "','search/','info.gif','" . self::string2binary(
VALUES ($course_id, 23, '".TOOL_SEARCH."','search/','info.gif','".self::string2binary(
api_get_setting(
'course_create_active_tools',
'enable_search'
)
) . "','0','search.gif',0,'_self','authoring','0')"
)."','0','search.gif',0,'_self','authoring','0')"
);
}
$sql = "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 24,'" . TOOL_BLOGS . "','blog/blog_admin.php','blog_admin.gif','" . intval(self::string2binary(
VALUES ($course_id, 24,'".TOOL_BLOGS."','blog/blog_admin.php','blog_admin.gif','".intval(self::string2binary(
api_get_setting('course_create_active_tools', 'blogs'))
) . "','1','squaregrey.gif',0,'_self','admin','0')";
)."','1','squaregrey.gif',0,'_self','admin','0')";
Database::query($sql);
/* Course homepage tools for course admin only */
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 25, '" . TOOL_TRACKING . "','tracking/courseLog.php','statistics.gif','$visible_for_course_admin','1','', 0,'_self','admin','0')"
VALUES ($course_id, 25, '".TOOL_TRACKING."','tracking/courseLog.php','statistics.gif','$visible_for_course_admin','1','', 0,'_self','admin','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 26, '" . TOOL_COURSE_SETTING . "','course_info/infocours.php','reference.gif','$visible_for_course_admin','1','', 0,'_self','admin','0')"
VALUES ($course_id, 26, '".TOOL_COURSE_SETTING."','course_info/infocours.php','reference.gif','$visible_for_course_admin','1','', 0,'_self','admin','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 27, '" . TOOL_COURSE_MAINTENANCE . "','course_info/maintenance.php','backup.gif','$visible_for_course_admin','1','',0,'_self', 'admin','0')"
VALUES ($course_id, 27, '".TOOL_COURSE_MAINTENANCE."','course_info/maintenance.php','backup.gif','$visible_for_course_admin','1','',0,'_self', 'admin','0')"
);
$alert = api_get_setting('email_alert_manager_on_new_quiz');
@ -685,7 +685,7 @@ class AddCourse
$perm = api_get_permissions_for_new_directories();
$perm_file = api_get_permissions_for_new_files();
$chat_path = $sys_course_path . $course_repository . '/document/chat_files';
$chat_path = $sys_course_path.$course_repository.'/document/chat_files';
if (!is_dir($chat_path)) {
@mkdir($chat_path, api_get_permissions_for_new_directories());
@ -717,11 +717,11 @@ class AddCourse
'certificates',
);
$default_course_path = api_get_path(SYS_CODE_PATH) . 'default_course_document/';
$default_course_path = api_get_path(SYS_CODE_PATH).'default_course_document/';
$default_document_array = array();
foreach ($folders_to_copy_from_default_course as $folder) {
$default_course_folder_path = $default_course_path . $folder . '/';
$default_course_folder_path = $default_course_path.$folder.'/';
$files = self::browse_folders(
$default_course_folder_path,
array(),
@ -750,30 +750,30 @@ class AddCourse
//hack until feature #5242 is implemented
if ($media_type == 'images') {
$media_type = 'images/gallery';
$images_folder = $sys_course_path . $course_repository . "/document/images/";
$images_folder = $sys_course_path.$course_repository."/document/images/";
if (!is_dir($images_folder)) {
//Creating index.html
mkdir($images_folder, $perm);
$fd = fopen($images_folder . 'index.html', 'w');
$fd = fopen($images_folder.'index.html', 'w');
fwrite($fd, $htmlpage);
@chmod($images_folder . 'index.html', $perm_file);
@chmod($images_folder.'index.html', $perm_file);
}
}
$course_documents_folder = $sys_course_path . $course_repository . "/document/$media_type/";
$default_course_path = api_get_path(SYS_CODE_PATH) . 'default_course_document' . $path_documents;
$course_documents_folder = $sys_course_path.$course_repository."/document/$media_type/";
$default_course_path = api_get_path(SYS_CODE_PATH).'default_course_document'.$path_documents;
if (!is_dir($course_documents_folder)) {
// Creating index.html
mkdir($course_documents_folder, $perm);
$fd = fopen(
$course_documents_folder . 'index.html',
$course_documents_folder.'index.html',
'w'
);
fwrite($fd, $htmlpage);
@chmod(
$course_documents_folder . 'index.html',
$course_documents_folder.'index.html',
$perm_file
);
}
@ -781,15 +781,15 @@ class AddCourse
if (is_array($array_media) && count($array_media) > 0) {
foreach ($array_media as $key => $value) {
if (isset($value['dir']) && !empty($value['dir'])) {
if (!is_dir($course_documents_folder . $value['dir'])) {
if (!is_dir($course_documents_folder.$value['dir'])) {
//Creating folder
mkdir(
$course_documents_folder . $value['dir'],
$course_documents_folder.$value['dir'],
$perm
);
//Creating index.html (for light protection)
$index_html = $course_documents_folder . $value['dir'] . '/index.html';
$index_html = $course_documents_folder.$value['dir'].'/index.html';
$fd = fopen($index_html, 'w');
fwrite($fd, $htmlpage);
@chmod($index_html, $perm_file);
@ -811,12 +811,12 @@ class AddCourse
}
if ($media_type == 'images/gallery') {
$folder_path = 'gallery/' . $folder_path;
$folder_path = 'gallery/'.$folder_path;
}
Database::query(
"INSERT INTO $TABLETOOLDOCUMENT (c_id, path,title,filetype,size)
VALUES ($course_id,'$path_documents" . $folder_path . "','" . $title . "','folder','0')"
VALUES ($course_id,'$path_documents".$folder_path."','".$title."','folder','0')"
);
$image_id = Database:: insert_id();
@ -841,33 +841,33 @@ class AddCourse
if (isset($value['file']) && !empty($value['file'])) {
if (!file_exists(
$course_documents_folder . $value['file']
$course_documents_folder.$value['file']
)
) {
//Copying file
copy(
$default_course_path . $value['file'],
$course_documents_folder . $value['file']
$default_course_path.$value['file'],
$course_documents_folder.$value['file']
);
chmod(
$course_documents_folder . $value['file'],
$course_documents_folder.$value['file'],
$perm_file
);
//echo $default_course_path.$value['file']; echo ' - '; echo $course_documents_folder.$value['file']; echo '<br />';
$temp = explode('/', $value['file']);
$file_size = filesize(
$course_documents_folder . $value['file']
$course_documents_folder.$value['file']
);
//hack until feature #5242 is implemented
if ($media_type == 'images/gallery') {
$value["file"] = 'gallery/' . $value["file"];
$value["file"] = 'gallery/'.$value["file"];
}
//Inserting file in the DB
Database::query(
"INSERT INTO $TABLETOOLDOCUMENT (c_id, path,title,filetype,size)
VALUES ($course_id,'$path_documents" . $value["file"] . "','" . $temp[count($temp) - 1] . "','file','$file_size')"
VALUES ($course_id,'$path_documents".$value["file"]."','".$temp[count($temp) - 1]."','file','$file_size')"
);
$image_id = Database:: insert_id();
if ($image_id) {
@ -875,7 +875,7 @@ class AddCourse
$sql = "UPDATE $TABLETOOLDOCUMENT SET id = iid WHERE iid = $image_id";
Database::query($sql);
if ($path_documents . $value['file'] == '/certificates/default.html') {
if ($path_documents.$value['file'] == '/certificates/default.html') {
$example_cert_id = $image_id;
}
$docId = Database::insert(
@ -925,7 +925,7 @@ class AddCourse
'c_id' => $course_id,
'url' => 'http://www.google.com',
'title' => 'Google',
'description' => get_lang('Google') ,
'description' => get_lang('Google'),
'category_id' => 0,
'on_homepage' => 0,
'target' => '_self',
@ -935,7 +935,7 @@ class AddCourse
'c_id' => $course_id,
'url' => 'http://www.wikipedia.org',
'title' => 'Wikipedia',
'description' => get_lang('Wikipedia') ,
'description' => get_lang('Wikipedia'),
'category_id' => 0,
'on_homepage' => 0,
'target' => '_self',
@ -943,7 +943,7 @@ class AddCourse
]
];
foreach($links as $params) {
foreach ($links as $params) {
$link->save($params);
}
@ -963,8 +963,8 @@ class AddCourse
/* Introduction text */
$intro_text = '<p style="text-align: center;">
<img src="' . api_get_path(REL_CODE_PATH) . 'img/mascot.png" alt="Mr. Chamilo" title="Mr. Chamilo" />
<h2>' . get_lang('IntroductionText') . '</h2>
<img src="' . api_get_path(REL_CODE_PATH).'img/mascot.png" alt="Mr. Chamilo" title="Mr. Chamilo" />
<h2>' . get_lang('IntroductionText').'</h2>
</p>';
$toolIntro = new Chamilo\CourseBundle\Entity\CToolIntro();
@ -1000,9 +1000,9 @@ class AddCourse
$html = '<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="220" valign="top" align="left">
<img src="' . api_get_path(WEB_CODE_PATH) . 'default_course_document/images/mr_chamilo/doubts.png">
<img src="' . api_get_path(WEB_CODE_PATH).'default_course_document/images/mr_chamilo/doubts.png">
</td>
<td valign="top" align="left">' . get_lang('Antique') . '</td></tr>
<td valign="top" align="left">' . get_lang('Antique').'</td></tr>
</table>';
$exercise->type = 1;
$exercise->setRandom(0);
@ -1254,7 +1254,7 @@ class AddCourse
'https://'
) === false
) {
$department_url = 'http://' . $department_url;
$department_url = 'http://'.$department_url;
}
//just in case
if ($department_url == 'http://') {
@ -1300,12 +1300,12 @@ class AddCourse
$code
);
if (!empty($user_id)) {
$sql = "INSERT INTO " . $TABLECOURSUSER . " SET
c_id = '" . $course_id . "',
user_id = '" . intval($user_id) . "',
$sql = "INSERT INTO ".$TABLECOURSUSER." SET
c_id = '" . $course_id."',
user_id = '" . intval($user_id)."',
status = '1',
is_tutor = '0',
sort = '" . ($i_course_sort) . "',
sort = '" . ($i_course_sort)."',
relation_type = 0,
user_course_cat = '0'";
Database::query($sql);
@ -1324,12 +1324,12 @@ class AddCourse
if (empty($key)) {
continue;
}
$sql = "INSERT INTO " . $TABLECOURSUSER . " SET
c_id = '" . Database::escape_string($course_id) . "',
user_id = '" . Database::escape_string($key) . "',
$sql = "INSERT INTO ".$TABLECOURSUSER." SET
c_id = '" . Database::escape_string($course_id)."',
user_id = '" . Database::escape_string($key)."',
status = '1',
is_tutor = '0',
sort = '" . ($sort + 1) . "',
sort = '" . ($sort + 1)."',
relation_type = 0,
user_course_cat = '0'";
Database::query($sql);
@ -1373,18 +1373,18 @@ class AddCourse
$iname = api_get_setting('Institution');
$subject = get_lang(
'NewCourseCreatedIn'
) . ' ' . $siteName . ' - ' . $iname;
).' '.$siteName.' - '.$iname;
$message = get_lang(
'Dear'
) . ' ' . $recipient_name . ",\n\n" . get_lang(
).' '.$recipient_name.",\n\n".get_lang(
'MessageOfNewCourseToAdmin'
) . ' ' . $siteName . ' - ' . $iname . "\n";
$message .= get_lang('CourseName') . ' ' . $title . "\n";
).' '.$siteName.' - '.$iname."\n";
$message .= get_lang('CourseName').' '.$title."\n";
$message .= get_lang(
'Category'
) . ' ' . $category_code . "\n";
$message .= get_lang('Tutor') . ' ' . $tutor_name . "\n";
$message .= get_lang('Language') . ' ' . $course_language;
).' '.$category_code."\n";
$message .= get_lang('Tutor').' '.$tutor_name."\n";
$message .= get_lang('Language').' '.$course_language;
$userInfo = api_get_user_info($user_id);

@ -3137,12 +3137,12 @@ class Agenda
$end->format('e')
);
$title = api_convert_encoding(
(string)$event->summary,
(string) $event->summary,
$charset,
'UTF-8'
);
$description = api_convert_encoding(
(string)$event->description,
(string) $event->description,
$charset,
'UTF-8'
);

@ -238,7 +238,7 @@ class Rest extends WebService
'urlPicture' => $this->course->getPicturePath(true),
'teachers' => $teachers,
'tools' => array_map(
function ($tool) {
function($tool) {
return ['type' => $tool['name']];
},
$tools
@ -261,7 +261,7 @@ class Rest extends WebService
$results[] = [
'id' => $description->get_description_type(),
'title' => $description->get_title(),
'content' => str_replace('src="/', 'src="' . api_get_path(WEB_PATH), $description->get_content())
'content' => str_replace('src="/', 'src="'.api_get_path(WEB_PATH), $description->get_content())
];
}
@ -294,7 +294,7 @@ class Rest extends WebService
$path = $directory['path'];
}
require_once api_get_path(LIBRARY_PATH) . 'fileDisplay.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php';
$courseInfo = api_get_course_info_by_id($this->course->getId());
$documents = DocumentManager::get_all_document_data(
@ -309,7 +309,7 @@ class Rest extends WebService
$results = [];
if (is_array($documents)) {
$webPath = api_get_path(WEB_CODE_PATH) . 'document/document.php?';
$webPath = api_get_path(WEB_CODE_PATH).'document/document.php?';
/** @var array $document */
foreach ($documents as $document) {
@ -326,7 +326,7 @@ class Rest extends WebService
'type' => $document['filetype'],
'title' => $document['title'],
'path' => $document['path'],
'url' => $webPath . http_build_query([
'url' => $webPath.http_build_query([
'username' => $this->user->getUsername(),
'api_key' => $this->apiKey,
'cidReq' => $this->course->getCode(),
@ -370,7 +370,7 @@ class Rest extends WebService
$sessionId
);
$announcements = array_map(function ($announcement) {
$announcements = array_map(function($announcement) {
return [
'id' => intval($announcement['id']),
'title' => strip_tags($announcement['title']),
@ -456,11 +456,11 @@ class Rest extends WebService
$webPath = api_get_path(WEB_PATH);
return array_map(
function ($event) use ($webPath) {
function($event) use ($webPath) {
return [
'id' => intval($event['unique_id']),
'title' => $event['title'],
'content' => str_replace('src="/', 'src="' . $webPath, $event['description']),
'content' => str_replace('src="/', 'src="'.$webPath, $event['description']),
'startDate' => $event['start_date_localtime'],
'endDate' => $event['end_date_localtime'],
'isAllDay' => $event['allDay'] ? true : false
@ -482,7 +482,7 @@ class Rest extends WebService
$notebooks = $notebooksRepo->findByUser($this->user, $this->course, $this->session);
return array_map(
function (\Chamilo\CourseBundle\Entity\CNotebook $notebook) {
function(\Chamilo\CourseBundle\Entity\CNotebook $notebook) {
return [
'id' => $notebook->getIid(),
'title' => $notebook->getTitle(),
@ -506,9 +506,9 @@ class Rest extends WebService
public function getCourseForumCategories()
{
$sessionId = $this->session ? $this->session->getId() : 0;
$webCoursePath = api_get_path(WEB_COURSE_PATH) . $this->course->getDirectory() . '/upload/forum/images/';
$webCoursePath = api_get_path(WEB_COURSE_PATH).$this->course->getDirectory().'/upload/forum/images/';
require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php';
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$categoriesFullData = get_forum_categories('', $this->course->getId(), $sessionId);
$categories = [];
@ -522,7 +522,7 @@ class Rest extends WebService
'catId' => intval($forumInfo['forum_category']),
'title' => $forumInfo['forum_title'],
'description' => $forumInfo['forum_comment'],
'image' => $forumInfo['forum_image'] ? ($webCoursePath . $forumInfo['forum_image']) : '',
'image' => $forumInfo['forum_image'] ? ($webCoursePath.$forumInfo['forum_image']) : '',
'numberOfThreads' => isset($forumInfo['number_of_threads']) ? intval($forumInfo['number_of_threads']) : 0,
'lastPost' => null
];
@ -545,7 +545,7 @@ class Rest extends WebService
foreach ($categoriesFullData as $category) {
$categoryForums = array_filter(
$forums,
function (array $forum) use ($category) {
function(array $forum) use ($category) {
if ($forum['catId'] != $category['cat_id']) {
return false;
}
@ -574,7 +574,7 @@ class Rest extends WebService
*/
public function getCourseForum($forumId)
{
require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php';
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$forumInfo = get_forums($forumId, $this->course->getCode());
@ -582,12 +582,12 @@ class Rest extends WebService
throw new Exception(get_lang('NoForum'));
}
$webCoursePath = api_get_path(WEB_COURSE_PATH) . $this->course->getDirectory() . '/upload/forum/images/';
$webCoursePath = api_get_path(WEB_COURSE_PATH).$this->course->getDirectory().'/upload/forum/images/';
$forum = [
'id' => $forumInfo['iid'],
'title' => $forumInfo['forum_title'],
'description' => $forumInfo['forum_comment'],
'image' => $forumInfo['forum_image'] ? ($webCoursePath . $forumInfo['forum_image']) : '',
'image' => $forumInfo['forum_image'] ? ($webCoursePath.$forumInfo['forum_image']) : '',
'threads' => []
];
@ -614,7 +614,7 @@ class Rest extends WebService
*/
public function getCourseForumThread($forumId, $threadId)
{
require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php';
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$threadInfo = get_thread_information($forumId, $threadId);
@ -652,7 +652,7 @@ class Rest extends WebService
$pictureInfo = UserManager::get_user_picture_path_by_id($this->user->getId(), 'web');
$result = [
'pictureUri' => $pictureInfo['dir'] . $pictureInfo['file'],
'pictureUri' => $pictureInfo['dir'].$pictureInfo['file'],
'fullName' => $this->user->getCompleteName(),
'username' => $this->user->getUsername(),
'officialCode' => $this->user->getOfficialCode(),
@ -762,7 +762,7 @@ class Rest extends WebService
'id' => $lpId,
'title' => Security::remove_XSS($lpDetails['lp_name']),
'progress' => intval($progress),
'url' => api_get_path(WEB_CODE_PATH) . 'webservices/api/v2.php?' . http_build_query([
'url' => api_get_path(WEB_CODE_PATH).'webservices/api/v2.php?'.http_build_query([
'hash' => $this->encodeParams([
'action' => 'course_learnpath',
'lp_id' => $lpId,
@ -809,7 +809,7 @@ class Rest extends WebService
* @param string $encoded
* @return array
*/
public static function decodeParams($encoded){
public static function decodeParams($encoded) {
$decoded = str_replace(['-', '_', '.'], ['+', '/', '='], $encoded);
$mod4 = strlen($decoded) % 4;
@ -837,7 +837,7 @@ class Rest extends WebService
ChamiloSession::write('_user', $loggedUser);
Login::init_user($this->user->getId(), true);
$url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . http_build_query([
$url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.http_build_query([
'cidReq' => $this->course->getCode(),
'id_session' => $sessionId,
'gidReq' => 0,
@ -859,7 +859,7 @@ class Rest extends WebService
*/
public function saveForumPost(array $postValues, $forumId)
{
require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php';
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$forum = get_forums($forumId, $this->course->getCode());
@ -999,7 +999,7 @@ class Rest extends WebService
*/
public function saveForumThread(array $values, $forumId)
{
require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php';
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$forum = get_forums($forumId, $this->course->getCode());
$courseInfo = api_get_course_info($this->course->getCode());

@ -10,11 +10,11 @@
*/
if (defined('SYSTEM_INSTALLATION')) {
error_log("Starting " . basename(__FILE__));
error_log("Starting ".basename(__FILE__));
$perm = api_get_permissions_for_new_files();
$oldConfFile = api_get_path(SYS_CODE_PATH) . 'inc/conf/configuration.php';
$newConfFile = api_get_path(CONFIGURATION_PATH) . 'configuration.php';
$oldConfFile = api_get_path(SYS_CODE_PATH).'inc/conf/configuration.php';
$newConfFile = api_get_path(CONFIGURATION_PATH).'configuration.php';
if (file_exists($oldConfFile)) {
copy($oldConfFile, $newConfFile);
@ -37,18 +37,18 @@ if (defined('SYSTEM_INSTALLATION')) {
$ignore = false;
if (stripos($line, '$_configuration[\'system_version\']') !== false) {
$found_version = true;
$line = '$_configuration[\'system_version\'] = \'' . $GLOBALS['new_version'] . '\';' . "\r\n";
$line = '$_configuration[\'system_version\'] = \''.$GLOBALS['new_version'].'\';'."\r\n";
} elseif (stripos($line, '$_configuration[\'system_stable\']') !== false) {
$found_stable = true;
$line = '$_configuration[\'system_stable\'] = ' . ($GLOBALS['new_version_stable'] ? 'true' : 'false') . ';' . "\r\n";
$line = '$_configuration[\'system_stable\'] = '.($GLOBALS['new_version_stable'] ? 'true' : 'false').';'."\r\n";
} elseif (stripos($line, '$_configuration[\'software_name\']') !== false) {
$found_software_name = true;
$line = '$_configuration[\'software_name\'] = \'' . $GLOBALS['software_name'] . '\';' . "\r\n";
$line = '$_configuration[\'software_name\'] = \''.$GLOBALS['software_name'].'\';'."\r\n";
} elseif (stripos($line, '$_configuration[\'software_url\']') !== false) {
$found_software_url = true;
$line = '$_configuration[\'software_url\'] = \'' . $GLOBALS['software_url'] . '\';' . "\r\n";
$line = '$_configuration[\'software_url\'] = \''.$GLOBALS['software_url'].'\';'."\r\n";
} elseif (stripos($line, '$userPasswordCrypted') !== false) {
$line = '$_configuration[\'password_encryption\'] = \'' .$userPasswordCrypted.'\';' . "\r\n";
$line = '$_configuration[\'password_encryption\'] = \''.$userPasswordCrypted.'\';'."\r\n";
} elseif (stripos($line, '?>') !== false) {
$ignore = true;
}
@ -58,21 +58,21 @@ if (defined('SYSTEM_INSTALLATION')) {
}
if (!$found_version) {
fwrite($fh, '$_configuration[\'system_version\'] = \'' . $new_version . '\';' . "\r\n");
fwrite($fh, '$_configuration[\'system_version\'] = \''.$new_version.'\';'."\r\n");
}
if (!$found_stable) {
fwrite($fh, '$_configuration[\'system_stable\'] = ' . ($new_version_stable ? 'true' : 'false') . ';' . "\r\n");
fwrite($fh, '$_configuration[\'system_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n");
}
if (!$found_software_name) {
fwrite($fh, '$_configuration[\'software_name\'] = \'' . $software_name . '\';' . "\r\n");
fwrite($fh, '$_configuration[\'software_name\'] = \''.$software_name.'\';'."\r\n");
}
if (!$found_software_url) {
fwrite($fh, '$_configuration[\'software_url\'] = \'' . $software_url . '\';' . "\r\n");
fwrite($fh, '$_configuration[\'software_url\'] = \''.$software_url.'\';'."\r\n");
}
fwrite($fh, '?>');
fclose($fh);
error_log("configuration.php file updated.");
} else {
echo 'You are not allowed here !'. __FILE__;
echo 'You are not allowed here !'.__FILE__;
}

@ -13,7 +13,7 @@ use Symfony\Component\Finder\Finder;
* current configuration file.
* @package chamilo.install
*/
error_log("Starting " . basename(__FILE__));
error_log("Starting ".basename(__FILE__));
global $debug;
@ -24,16 +24,16 @@ if (defined('SYSTEM_INSTALLATION')) {
// The main/exercice path was moved to main/exercise, so the code from 1.11
// should just create the new directory, and we should delete the previous
// one to avoid the web server to use the old
$exercisePath = api_get_path(SYS_CODE_PATH) . 'exercice';
$exercisePath = api_get_path(SYS_CODE_PATH).'exercice';
if (is_dir($exercisePath)) {
@rrmdir($exercisePath);
}
// Same with main/newscorm, renamed main/lp
$lpPath = api_get_path(SYS_CODE_PATH) . 'newscorm';
$lpPath = api_get_path(SYS_CODE_PATH).'newscorm';
if (is_dir($lpPath)) {
@rrmdir($lpPath);
}
$ticketPluginPath = api_get_path(SYS_PLUGIN_PATH) . 'ticket';
$ticketPluginPath = api_get_path(SYS_PLUGIN_PATH).'ticket';
if (is_dir($ticketPluginPath)) {
@rrmdir($ticketPluginPath);
}
@ -42,5 +42,5 @@ if (defined('SYSTEM_INSTALLATION')) {
error_log('Folders cleaned up');
}
} else {
echo 'You are not allowed here !'. __FILE__;
echo 'You are not allowed here !'.__FILE__;
}

@ -57,7 +57,7 @@ if ($debug > 2) { error_log('New LP - '.__FILE__.','.__LINE__.' - Current sessio
//$_user = $_SESSION['_user'];
$file = Session::read('file');
$oLP = unserialize(Session::read('lpobject'));
$oItem =& $oLP->items[$oLP->current];
$oItem = & $oLP->items[$oLP->current];
if (!is_object($oItem)) {
error_log('New LP - aicc_hacp - Could not load oItem item', 0);
exit;
@ -71,8 +71,8 @@ $result = array(
'evaluation' => array(),
'student_data' => array(),
);
$convert_enc = array('%25','%0D','%0A','%09','%20','%2D','%2F','%3B','%3F','%7B','%7D','%7C','%5C','%5E','%7E','%5B','%5D','%60','%23','%3E','%3C','%22');
$convert_dec = array('%',"\r","\n","\t",' ','-','/',';','?','{','}','|','\\','^','~','[',']','`','#','>','<','"');
$convert_enc = array('%25', '%0D', '%0A', '%09', '%20', '%2D', '%2F', '%3B', '%3F', '%7B', '%7D', '%7C', '%5C', '%5E', '%7E', '%5B', '%5D', '%60', '%23', '%3E', '%3C', '%22');
$convert_dec = array('%', "\r", "\n", "\t", ' ', '-', '/', ';', '?', '{', '}', '|', '\\', '^', '~', '[', ']', '`', '#', '>', '<', '"');
$crlf = "\r\n";
//$tab = "\t";
$tab = "";

@ -200,7 +200,7 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
//"lms_progress_bar_mode='".$myprogress_mode."';" .
"olms.lms_view_id=".$view_id.";".
"olms.lms_user_id=".$user_id.";".
"olms.next_item=".$new_item_id.";". // This one is very important to replace possible literal strings.
"olms.next_item=".$new_item_id.";".// This one is very important to replace possible literal strings.
"olms.lms_next_item=".$mynext.";".
"olms.lms_previous_item=".$myprevious.";".
"olms.lms_item_type = '".$myitemtype."';".

@ -17,7 +17,7 @@ api_protect_course_script();
/* Header and action code */
$htmlHeadXtra[] = '<script>'.
$_SESSION['oLP']->get_js_dropdown_array() .
$_SESSION['oLP']->get_js_dropdown_array().
"
function load_cbo(id) {
if (!id) {
@ -41,13 +41,13 @@ $_SESSION['oLP']->get_js_dropdown_array() .
$('#previous').selectpicker('refresh');
}
" .
"\n" .
'$().ready(function() {'."\n" .
'if ($(\'#previous\')) {'."\n" .
"\n".
'$().ready(function() {'."\n".
'if ($(\'#previous\')) {'."\n".
'if(\'parent is\'+$(\'#idParent\').val()) {'.
'load_cbo($(\'#idParent\').val());'."\n" .
'}}'."\n" .
'});</script>'."\n" ;
'load_cbo($(\'#idParent\').val());'."\n".
'}}'."\n".
'});</script>'."\n";
/* Constants and variables */
@ -81,11 +81,11 @@ $therow = Database::fetch_array($result);
/* SHOWING THE ADMIN TOOLS */
if (isset($_SESSION['gradebook'])) {
$gradebook= $_SESSION['gradebook'];
$gradebook = $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array (
$interbreadcrumb[] = array(
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);

@ -64,7 +64,7 @@ class survey_question
if ($surveyData['survey_type'] == 1) {
$table_survey_question_group = Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP);
$sql = 'SELECT id,name FROM '.$table_survey_question_group.'
WHERE survey_id = '.(int)$_GET['survey_id'].'
WHERE survey_id = '.(int) $_GET['survey_id'].'
ORDER BY name';
$rs = Database::query($sql);
$glist = null;
@ -75,15 +75,15 @@ class survey_question
$grouplist = $grouplist1 = $grouplist2 = $glist;
if (!empty($formData['assigned'])) {
$grouplist = str_replace('<option value="'.$formData['assigned'].'"','<option value="'.$formData['assigned'].'" selected',$glist);
$grouplist = str_replace('<option value="'.$formData['assigned'].'"', '<option value="'.$formData['assigned'].'" selected', $glist);
}
if (!empty($formData['assigned1'])) {
$grouplist1 = str_replace('<option value="'.$formData['assigned1'].'"','<option value="'.$formData['assigned1'].'" selected',$glist);
$grouplist1 = str_replace('<option value="'.$formData['assigned1'].'"', '<option value="'.$formData['assigned1'].'" selected', $glist);
}
if (!empty($formData['assigned2'])) {
$grouplist2 = str_replace('<option value="'.$formData['assigned2'].'"','<option value="'.$formData['assigned2'].'" selected',$glist);
$grouplist2 = str_replace('<option value="'.$formData['assigned2'].'"', '<option value="'.$formData['assigned2'].'" selected', $glist);
}
$this->html .= ' <tr><td colspan="">
@ -95,7 +95,7 @@ class survey_question
$this->html .= '
<b>'.get_lang('Secondary').'</b><br />
'.'<input type="radio" name="choose" value="2" '.(($formData['choose']==2)?'checked':'').
'.'<input type="radio" name="choose" value="2" '.(($formData['choose'] == 2) ? 'checked' : '').
'><select name="assigned1">'.$grouplist1.'</select> '.
'<select name="assigned2">'.$grouplist2.'</select>'
.'</fieldset><br />';
@ -131,7 +131,7 @@ class survey_question
<div class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-8">
<div class="alert alert-info">' . get_lang('YouCantNotEditThisQuestionBecauseAlreadyExistAnswers') . '</div>
<div class="alert alert-info">' . get_lang('YouCantNotEditThisQuestionBecauseAlreadyExistAnswers').'</div>
</div>
<div class="col-sm-2"></div>
</div>

@ -14,7 +14,7 @@ $(document).ready(function (){
var url = this.href;
var dialog = $("#dialog");
if ($("#dialog").length == 0) {
dialog = $("' . '<div id="dialog" style="display:hidden"></div>' . '").appendTo("body");
dialog = $("' . '<div id="dialog" style="display:hidden"></div>'.'").appendTo("body");
}
// load remote content
@ -53,7 +53,7 @@ function save() {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("div#confirmation").html("<img src=\"' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/indicator.gif\" />"); },
$("div#confirmation").html("<img src=\"' . api_get_path(WEB_LIBRARY_PATH).'javascript/indicator.gif\" />"); },
type: "POST",
url: "update_report.php",
data: "work_id="+work_id+"&forum_id="+forum_id+"&rs_id="+rs_id,
@ -92,7 +92,7 @@ function save() {
$course_code = api_get_course_id();
$results = initializeReport($course_code);
if (isset($_GET['action'])) {
Export::arrayToXls($results['export'], "COURSE_USER_REPORT" . $course_code);
Export::arrayToXls($results['export'], "COURSE_USER_REPORT".$course_code);
} else {
Display::display_header();
api_protect_course_script();

File diff suppressed because it is too large Load Diff

@ -13,7 +13,7 @@ $cidReset = true;
require_once '../config.php';
if (!isset($_REQUEST['t'], $_REQUEST['i'])) {
header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php');
header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');
}
$currentUserId = api_get_user_id();
@ -38,8 +38,8 @@ if ($includeServices !== 'true') {
$typeUser = intval($_REQUEST['t']) === BuyCoursesPlugin::SERVICE_TYPE_USER;
$typeCourse = intval($_REQUEST['t']) === BuyCoursesPlugin::SERVICE_TYPE_COURSE;
$typeSession = intval($_REQUEST['t']) === BuyCoursesPlugin::SERVICE_TYPE_SESSION;
$typeFinalLp= intval($_REQUEST['t']) === BuyCoursesPlugin::SERVICE_TYPE_LP_FINAL_ITEM;
$queryString = 'i=' . intval($_REQUEST['i']) . '&t=' . intval($_REQUEST['t']).$additionalQueryString;
$typeFinalLp = intval($_REQUEST['t']) === BuyCoursesPlugin::SERVICE_TYPE_LP_FINAL_ITEM;
$queryString = 'i='.intval($_REQUEST['i']).'&t='.intval($_REQUEST['t']).$additionalQueryString;
$serviceInfo = $plugin->getServices(intval($_REQUEST['i']));
$userInfo = api_get_user_info($currentUserId);
@ -53,7 +53,7 @@ if ($form->validate()) {
Display::addFlash(
Display::return_message($plugin->get_lang('NeedToSelectPaymentType'), 'error', false)
);
header('Location:' . api_get_self() . '?' . $queryString);
header('Location:'.api_get_self().'?'.$queryString);
exit;
}
@ -61,7 +61,7 @@ if ($form->validate()) {
Display::addFlash(
Display::return_message($plugin->get_lang('AdditionalInfoRequired'), 'error', false)
);
header('Location:' . api_get_self() . '?' . $queryString);
header('Location:'.api_get_self().'?'.$queryString);
exit;
}
@ -70,7 +70,7 @@ if ($form->validate()) {
if ($serviceSaleId !== false) {
$_SESSION['bc_service_sale_id'] = $serviceSaleId;
header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_process_confirm.php');
header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_process_confirm.php');
}
exit;
@ -101,7 +101,7 @@ $selectOptions = [
if ($typeUser) {
$users = $em->getRepository('ChamiloUserBundle:User')->findAll();
$selectOptions[$userInfo['user_id']] = api_get_person_name($userInfo['firstname'], $userInfo['lastname']) . ' (' . get_lang('Myself') . ')';
$selectOptions[$userInfo['user_id']] = api_get_person_name($userInfo['firstname'], $userInfo['lastname']).' ('.get_lang('Myself').')';
if (!empty($users)) {
foreach ($users as $user) {
if (intval($userInfo['user_id']) !== intval($user->getId())) {
@ -146,7 +146,7 @@ if ($typeUser) {
$thisLpList = $em->getRepository('ChamiloCourseBundle:CLp')->findBy(['cId' => $course->getCourse()->getId()]);
foreach ($thisLpList as $lp) {
$courseLpList[$lp->getCId()] = $lp->getName() . ' (' . $course->getCourse()->getTitle() . ')';;
$courseLpList[$lp->getCId()] = $lp->getName().' ('.$course->getCourse()->getTitle().')'; ;
}
}
@ -163,7 +163,7 @@ if ($typeUser) {
//Now only we need the final item and return the current LP
if ($item->getItemType() == TOOL_LP_FINAL_ITEM) {
$checker = true;
$sessionLpList[$lp->getCId()] = $lp->getName() . ' (' . $session->getSession()->getName() . ')';
$sessionLpList[$lp->getCId()] = $lp->getName().' ('.$session->getSession()->getName().')';
}
}
}
@ -178,7 +178,7 @@ if ($typeUser) {
//Now only we need the final item and return the current LP
if ($item->getItemType() == TOOL_LP_FINAL_ITEM) {
$checker = true;
$sessionLpList[$lp->getCId()] = $lp->getName() . ' (' . $session->getSession()->getName() . ')';
$sessionLpList[$lp->getCId()] = $lp->getName().' ('.$session->getSession()->getName().')';
}
}
}

@ -5,6 +5,6 @@
* @author José Loguercio Silva <jose.loguercio@beeznest.com>
* @package chamilo.plugin.google_maps
*/
require_once __DIR__ . '/config.php';
require_once __DIR__.'/config.php';
GoogleMapsPlugin::create()->uninstall();

@ -13,7 +13,7 @@ echo "Starting tool\n";
echo "Chamilo Bulk Nodes Creation v.1.0\n";
echo "=================================\n";
require_once('../../../main/inc/global.inc.php');
require_once('clilib.php'); // cli only functions
require_once('clilib.php'); // cli only functions
// Ensure errors are well explained
ini_set('debug_display', 1);
ini_set('debug_level', E_ALL);
@ -68,26 +68,26 @@ Example:
if (!empty($options['config'])) {
echo "Loading config : ".$options['config'];
if (!file_exists($options['config'])){
if (!file_exists($options['config'])) {
cli_error('Config file mentioned but not found');
}
$content = file($options['config']);
foreach($content as $l) {
foreach ($content as $l) {
if (preg_match('/^\s+$/', $l)) continue; // Empty lines.
if (preg_match('/^[#\/!;]/', $l)) continue; // Comments (any form).
if (preg_match('/^(.*?)=(.*)$/', $l, $matches)) {
if (in_array($matches[1], $expectedoptions)){
if (in_array($matches[1], $expectedoptions)) {
$options[trim($matches[1])] = trim($matches[2]);
}
}
}
}
require_once($_configuration['root_sys'].'local/classes/database.class.php'); // cli only functions
require_once($_configuration['root_sys'].'local/classes/textlib.class.php'); // cli only functions
require_once($_configuration['root_sys'].'local/classes/mootochamlib.php'); // moodle like API
require_once($_configuration['root_sys'] . '/plugin/vchamilo/lib/vchamilo_plugin.class.php');
require_once($_configuration['root_sys'].'local/classes/database.class.php'); // cli only functions
require_once($_configuration['root_sys'].'local/classes/textlib.class.php'); // cli only functions
require_once($_configuration['root_sys'].'local/classes/mootochamlib.php'); // moodle like API
require_once($_configuration['root_sys'].'/plugin/vchamilo/lib/vchamilo_plugin.class.php');
global $DB;
if ($options['verbose']) echo "building database manager\n";
@ -117,7 +117,7 @@ ctrace('Starting generation');
// Get main admin for further replacement.
$admin = $DB->get_record('user', array('username' => 'admin'));
foreach($nodes as $data) {
foreach ($nodes as $data) {
ctrace('Making node '.$data->root_web);
@ -163,7 +163,7 @@ foreach($nodes as $data) {
$settingrec->access_url = 1;
$settingrec->selected_value = $value;
ctrace("Setting up {$settingrec->variable}|{$settingrec->subkey} to $value\n");
if ($oldrec = $NDB->get_record('settings_current', array('variable' => $settingrec->variable, 'subkey' => $settingrec->subkey, 'type' => $settingrec->type))){
if ($oldrec = $NDB->get_record('settings_current', array('variable' => $settingrec->variable, 'subkey' => $settingrec->subkey, 'type' => $settingrec->type))) {
$settingrec->id = $oldrec->id;
$NDB->update_record('settings_current', $settingrec, 'id');
} else {
@ -208,9 +208,9 @@ foreach($nodes as $data) {
if ($interactive) {
$input = readline("Continue (y/n|r) ?\n");
if ($input == 'r' || $input == 'R'){
if ($input == 'r' || $input == 'R') {
// do nothing, just continue
} elseif ($input == 'n' || $input == 'N'){
} elseif ($input == 'n' || $input == 'N') {
echo "finishing\n";
exit;
}

Loading…
Cancel
Save