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 7ee764c997
commit 2830976b65
  1. 10
      main/admin/access_urls.php
  2. 292
      main/admin/configure_homepage.php
  3. 32
      main/admin/ldap_import_students.php
  4. 2
      main/admin/system_announcements.php
  5. 2
      main/admin/user_export.php
  6. 8
      main/course_home/course_home.php
  7. 24
      main/exercise/exercise_result.class.php
  8. 2
      main/exercise/fill_blanks.class.php
  9. 12
      main/exercise/hotpotatoes_exercise_report.php
  10. 2
      main/gradebook/lib/be/surveylink.class.php
  11. 12
      main/inc/lib/banner.lib.php
  12. 220
      main/inc/lib/exercise.lib.php
  13. 8
      main/inc/lib/exercise_show_functions.lib.php
  14. 46
      main/messages/outbox.php
  15. 60
      main/permissions/user_permissions.inc.php
  16. 223
      main/survey/surveyUtil.class.php
  17. 2
      main/webservices/cm_webservice_user.php
  18. 4
      main/webservices/user_import/import.lib.php
  19. 38
      src/Chamilo/CoreBundle/Component/Editor/Finder.php

@ -19,7 +19,7 @@ if (!api_get_multiple_access_url()) {
exit;
}
$interbreadcrumb[] = array ("url" => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array("url" => 'index.php', 'name' => get_lang('PlatformAdmin'));
$tool_name = get_lang('MultipleAccessURLs');
Display :: display_header($tool_name);
@ -51,12 +51,12 @@ if (isset($_GET['action'])) {
case 'register':
// we are going to register the admin
if (api_is_platform_admin()) {
if ($current_access_url_id!=-1) {
if ($current_access_url_id != -1) {
$url_str = '';
foreach ($url_list as $my_url) {
if (!in_array($my_url['id'], $my_user_url_list)) {
UrlManager::add_user_to_url(api_get_user_id(), $my_url['id']);
$url_str.=$my_url['url'].' <br />';
$url_str .= $my_url['url'].' <br />';
}
}
Display::addFlash(
@ -155,7 +155,7 @@ foreach ($sortable_data as $row) {
$image = 'wrong';
}
// you cannot lock the default
if ($row['id']=='1') {
if ($row['id'] == '1') {
$status = Display::return_icon($image.'.gif', get_lang(ucfirst($action)));
} else {
$status = '<a href="access_urls.php?action='.$action.'&amp;url_id='.$row['id'].'">'.
@ -165,7 +165,7 @@ foreach ($sortable_data as $row) {
$url_id = $row['id'];
$actions = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "access_url_edit.php?url_id=$url_id");
if ($url_id != '1') {
$actions .= '<a href="access_urls.php?action=delete_url&amp;url_id='.$url_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.
$actions .= '<a href="access_urls.php?action=delete_url&amp;url_id='.$url_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'.
Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
}
$urls[] = array($url, $description, $status, $actions);

@ -49,7 +49,7 @@ function home_tabs($file_logged_in)
}
$cidReset = true;
require_once __DIR__ . '/../inc/global.inc.php';
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
$_SESSION['this_section'] = $this_section;
@ -150,8 +150,8 @@ if (api_is_multiple_url_enabled()) {
$clean_url .= '/';
$homep = $homePath; //homep for Home Path
$homep_new = $homePath . $clean_url; //homep for Home Path added the url
$new_url_dir = $homePath . $clean_url;
$homep_new = $homePath.$clean_url; //homep for Home Path added the url
$new_url_dir = $homePath.$clean_url;
//we create the new dir for the new sites
if (!is_dir($new_url_dir)) {
mkdir($new_url_dir, api_get_permissions_for_new_directories());
@ -175,18 +175,18 @@ $homef = array($menuf, $newsf, $topf, $noticef, $menutabs, $mtloggedin);
// If language-specific file does not exist, create it by copying default file
foreach ($homef as $my_file) {
if (api_is_multiple_url_enabled()) {
if (!file_exists($homep_new . $my_file . '_' . $lang . $ext)) {
if (!file_exists($homep . $my_file . $ext)) {
touch($homep . $my_file . $ext);
if (!file_exists($homep_new.$my_file.'_'.$lang.$ext)) {
if (!file_exists($homep.$my_file.$ext)) {
touch($homep.$my_file.$ext);
}
@copy($homep . $my_file . $ext, $homep_new . $my_file . '_' . $lang . $ext);
@copy($homep.$my_file.$ext, $homep_new.$my_file.'_'.$lang.$ext);
}
} else {
if (!file_exists($homep . $my_file . '_' . $lang . $ext)) {
if (!file_exists($homep . $my_file . $ext)) {
touch($homep . $my_file . $ext);
if (!file_exists($homep.$my_file.'_'.$lang.$ext)) {
if (!file_exists($homep.$my_file.$ext)) {
touch($homep.$my_file.$ext);
}
@copy($homep . $my_file . $ext, $homep . $my_file . '_' . $lang . $ext);
@copy($homep.$my_file.$ext, $homep.$my_file.'_'.$lang.$ext);
}
}
}
@ -224,8 +224,8 @@ if (!empty($action)) {
// Write
if (is_writable($homep)) {
// Default
if (is_writable($homep . $topf . '_' . $lang . $ext)) {
$fp = fopen($homep . $topf . '_' . $lang . $ext, 'w');
if (is_writable($homep.$topf.'_'.$lang.$ext)) {
$fp = fopen($homep.$topf.'_'.$lang.$ext, 'w');
fputs($fp, $home_top);
fclose($fp);
@ -233,7 +233,7 @@ if (!empty($action)) {
foreach ($_languages['name'] as $key => $value) {
$lang_name = $_languages['folder'][$key];
if (isset($_POST[$lang_name])) {
$fp = fopen($homep . $topf . '_' . $lang_name . $ext, 'w');
$fp = fopen($homep.$topf.'_'.$lang_name.$ext, 'w');
fputs($fp, $home_top);
fclose($fp);
}
@ -243,15 +243,15 @@ if (!empty($action)) {
}
} else {
//File does not exist
$fp = fopen($homep . $topf . '_' . $lang . $ext, 'w');
$fp = fopen($homep.$topf.'_'.$lang.$ext, 'w');
fputs($fp, $home_top);
fclose($fp);
foreach ($_languages['name'] as $key => $value) {
$lang_name = $_languages['folder'][$key];
if (isset($_POST[$lang_name])) {
if (file_exists($homep . $topf . '_' . $lang_name . $ext)) {
$fp = fopen($homep . $topf . '_' . $lang_name . $ext, 'w');
if (file_exists($homep.$topf.'_'.$lang_name.$ext)) {
$fp = fopen($homep.$topf.'_'.$lang_name.$ext, 'w');
fputs($fp, $home_top);
fclose($fp);
}
@ -278,18 +278,18 @@ if (!empty($action)) {
$errorMsg = get_lang('NoticeWillBeNotDisplayed');
}
// Write
if (file_exists($homep . $noticef . '_' . $lang . $ext)) {
if (is_writable($homep . $noticef . '_' . $lang . $ext)) {
$fp = fopen($homep . $noticef . '_' . $lang . $ext, 'w');
if (file_exists($homep.$noticef.'_'.$lang.$ext)) {
if (is_writable($homep.$noticef.'_'.$lang.$ext)) {
$fp = fopen($homep.$noticef.'_'.$lang.$ext, 'w');
if ($errorMsg == '') {
fputs($fp, "<h5>$notice_title</h5><p>\n$notice_text");
foreach ($_languages['name'] as $key => $value) {
$lang_name = $_languages['folder'][$key];
if (isset($_POST[$lang_name])) {
if (file_exists($homep . $noticef . '_' . $lang_name . $ext)) {
if (is_writable($homep . $noticef . '_' . $lang_name . $ext)) {
$fp = fopen($homep . $noticef . '_' . $lang_name . $ext, 'w');
if (file_exists($homep.$noticef.'_'.$lang_name.$ext)) {
if (is_writable($homep.$noticef.'_'.$lang_name.$ext)) {
$fp = fopen($homep.$noticef.'_'.$lang_name.$ext, 'w');
fputs($fp, "<h5>$notice_title</h5><p>\n$notice_text");
fclose($fp);
}
@ -302,8 +302,8 @@ if (!empty($action)) {
foreach ($_languages['name'] as $key => $value) {
$lang_name = $_languages['folder'][$key];
if (isset($_POST[$lang_name])) {
if (file_exists($homep . $noticef . '_' . $lang_name . $ext)) {
$fp1 = fopen($homep . $noticef . '_' . $lang_name . $ext, 'w');
if (file_exists($homep.$noticef.'_'.$lang_name.$ext)) {
$fp1 = fopen($homep.$noticef.'_'.$lang_name.$ext, 'w');
fputs($fp1, '');
fclose($fp1);
}
@ -312,11 +312,11 @@ if (!empty($action)) {
}
fclose($fp);
} else {
$errorMsg .= "<br/>\n" . get_lang('HomePageFilesNotWritable');
$errorMsg .= "<br/>\n".get_lang('HomePageFilesNotWritable');
}
} else {
//File does not exist
$fp = fopen($homep . $noticef . '_' . $lang . $ext, 'w');
$fp = fopen($homep.$noticef.'_'.$lang.$ext, 'w');
fputs($fp, "<h5>$notice_title</h5><p>\n$notice_text");
fclose($fp);
}
@ -334,9 +334,9 @@ if (!empty($action)) {
//Write
if ($s_languages_news != 'all') {
if (file_exists($homep . $newsf . '_' . $s_languages_news . $ext)) {
if (is_writable($homep . $newsf . '_' . $s_languages_news . $ext)) {
$fp = fopen($homep . $newsf . '_' . $s_languages_news . $ext, 'w');
if (file_exists($homep.$newsf.'_'.$s_languages_news.$ext)) {
if (is_writable($homep.$newsf.'_'.$s_languages_news.$ext)) {
$fp = fopen($homep.$newsf.'_'.$s_languages_news.$ext, 'w');
fputs($fp, $home_news);
fclose($fp);
} else {
@ -344,7 +344,7 @@ if (!empty($action)) {
}
} else {
// File does not exist
$fp = fopen($homep . $newsf . '_' . $s_languages_news . $ext, 'w');
$fp = fopen($homep.$newsf.'_'.$s_languages_news.$ext, 'w');
fputs($fp, $home_news);
fclose($fp);
}
@ -352,9 +352,9 @@ if (!empty($action)) {
// We update all the news file
foreach ($_languages['name'] as $key => $value) {
$english_name = $_languages['folder'][$key];
if (file_exists($homep . $newsf . '_' . $english_name . $ext)) {
if (is_writable($homep . $newsf . '_' . $english_name . $ext)) {
$fp = fopen($homep . $newsf . '_' . $english_name . $ext, 'w');
if (file_exists($homep.$newsf.'_'.$english_name.$ext)) {
if (is_writable($homep.$newsf.'_'.$english_name.$ext)) {
$fp = fopen($homep.$newsf.'_'.$english_name.$ext, 'w');
fputs($fp, $home_news);
fclose($fp);
} else {
@ -362,7 +362,7 @@ if (!empty($action)) {
}
} else {
// File does not exist
$fp = fopen($homep . $newsf . '_' . $english_name . $ext, 'w');
$fp = fopen($homep.$newsf.'_'.$english_name.$ext, 'w');
fputs($fp, $home_news);
fclose($fp);
}
@ -392,18 +392,18 @@ if (!empty($action)) {
if ($link_url == 'http://' || $link_url == 'https://') {
$link_url = '';
} elseif (!empty($link_url) && !strstr($link_url, '://')) {
$link_url = 'http://' . $link_url;
$link_url = 'http://'.$link_url;
}
$menuf = ($action == 'insert_tabs' || $action == 'edit_tabs') ? $mtloggedin : $menuf;
if (!is_writable($homep . $menuf . '_' . $lang . $ext)) {
if (!is_writable($homep.$menuf.'_'.$lang.$ext)) {
$errorMsg = get_lang('HomePageFilesNotWritable');
} elseif (empty($link_name)) {
$errorMsg = get_lang('PleaseEnterLinkName');
} else {
// New links are added as new files in the home/ directory
if ($action == 'insert_link' || $action == 'insert_tabs' || empty($filename) || strstr($filename, '/') || !strstr($filename, '.html')) {
$filename = api_replace_dangerous_char($link_name) . '.html';
$filename = api_replace_dangerous_char($link_name).'.html';
}
// "home_" prefix for links are renamed to "user_" prefix (to avoid name clash with existing home page files)
@ -412,12 +412,12 @@ if (!empty($action)) {
}
// If the typical language suffix is not found in the file name,
// replace the ".html" suffix by "_en.html" or the active menu language
if (!strstr($filename, '_' . $lang . $ext)) {
$filename = str_replace($ext, '_' . $lang . $ext, $filename);
if (!strstr($filename, '_'.$lang.$ext)) {
$filename = str_replace($ext, '_'.$lang.$ext, $filename);
}
// Get the contents of home_menu_en.html (or active menu language
// version) into $home_menu as an array of one entry per line
$home_menu = file($homep . $menuf . '_' . $lang . $ext);
$home_menu = file($homep.$menuf.'_'.$lang.$ext);
$home_menu = implode("\n", $home_menu);
$home_menu = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
$home_menu = explode("\n", $home_menu);
@ -435,18 +435,18 @@ if (!empty($action)) {
// If the given link url is empty, then replace the link url by a link to the link file created
if (empty($link_url) || $link_url == 'http://' || $link_url == 'https://') {
$link_url = api_get_path(WEB_PATH) . 'index.php?include=' . urlencode($filename);
$link_url = api_get_path(WEB_PATH).'index.php?include='.urlencode($filename);
// If the file doesn't exist, then create it and
// fill it with default text
$fp = @fopen($homep . $filename, 'w');
$fp = @fopen($homep.$filename, 'w');
if ($fp) {
if (empty($link_html)) {
fputs($fp, get_lang('MyTextHere'));
home_tabs($homep . $filename);
home_tabs($homep.$filename);
} else {
fputs($fp, $link_html);
home_tabs($homep . $filename);
home_tabs($homep.$filename);
}
fclose($fp);
}
@ -454,10 +454,10 @@ if (!empty($action)) {
// If the requested action is to edit a link, open the file and
// write to it (if the file doesn't exist, create it)
if (in_array($action, array('edit_link')) && !empty($link_html)) {
$fp = @fopen($homep . $filename, 'w');
$fp = @fopen($homep.$filename, 'w');
if ($fp) {
fputs($fp, $link_html);
home_tabs($homep . $filename);
home_tabs($homep.$filename);
fclose($fp);
}
}
@ -480,36 +480,36 @@ if (!empty($action)) {
break;
}
}
$home_menu[$insert_where + 1] = '<li ' . $class_add_in_tab . '><a href="' . $link_url . '" target="' . ($target_blank ? '_blank' : '_self') . '">' . $link_name . '</a></li>';
$home_menu[$insert_where + 1] = '<li '.$class_add_in_tab.'><a href="'.$link_url.'" target="'.($target_blank ? '_blank' : '_self').'">'.$link_name.'</a></li>';
} else {
// If the request is about a link edition, change the link
$home_menu[$link_index] = '<li ' . $class_add_in_tab . '><a href="' . $link_url . '" target="' . ($target_blank ? '_blank' : '_self') . '">' . $link_name . '</a></li>';
$home_menu[$link_index] = '<li '.$class_add_in_tab.'><a href="'.$link_url.'" target="'.($target_blank ? '_blank' : '_self').'">'.$link_name.'</a></li>';
}
// Re-build the file from the home_menu array
$home_menu = implode("\n", $home_menu);
// Write
if (file_exists($homep . $menuf . '_' . $lang . $ext)) {
if (is_writable($homep . $menuf . '_' . $lang . $ext)) {
$fp = fopen($homep . $menuf . '_' . $lang . $ext, 'w');
if (file_exists($homep.$menuf.'_'.$lang.$ext)) {
if (is_writable($homep.$menuf.'_'.$lang.$ext)) {
$fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w');
fputs($fp, $home_menu);
home_tabs($homep . $menuf . '_' . $lang . $ext);
home_tabs($homep.$menuf.'_'.$lang.$ext);
fclose($fp);
foreach ($_languages['name'] as $key => $value) {
$lang_name = $_languages['folder'][$key];
if (isset($_POST[$lang_name])) {
$fp = fopen($homep . $menuf . '_' . $lang_name . $ext, 'w');
$fp = fopen($homep.$menuf.'_'.$lang_name.$ext, 'w');
fputs($fp, $home_menu);
home_tabs($homep . $menuf . '_' . $lang_name . $ext);
home_tabs($homep.$menuf.'_'.$lang_name.$ext);
fclose($fp);
}
}
if (file_exists($homep . $menuf . $ext)) {
if (is_writable($homep . $menuf . $ext)) {
$fpo = fopen($homep . $menuf . $ext, 'w');
if (file_exists($homep.$menuf.$ext)) {
if (is_writable($homep.$menuf.$ext)) {
$fpo = fopen($homep.$menuf.$ext, 'w');
fputs($fpo, $home_menu);
home_tabs($homep . $menuf . $ext);
home_tabs($homep.$menuf.$ext);
fclose($fpo);
}
}
@ -518,17 +518,17 @@ if (!empty($action)) {
}
} else {
//File does not exist
$fp = fopen($homep . $menuf . '_' . $lang . $ext, 'w');
$fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w');
fputs($fp, $home_menu);
home_tabs($homep . $menuf . '_' . $lang . $ext);
home_tabs($homep.$menuf.'_'.$lang.$ext);
fclose($fp);
foreach ($_languages['name'] as $key => $value) {
$lang_name = $_languages['folder'][$key];
if (isset($_POST[$lang_name])) {
$fp = fopen($homep . $menuf . '_' . $lang_name . $ext, 'w');
$fp = fopen($homep.$menuf.'_'.$lang_name.$ext, 'w');
fputs($fp, $home_menu);
home_tabs($homep . $menuf . '_' . $lang_name . $ext);
home_tabs($homep.$menuf.'_'.$lang_name.$ext);
fclose($fp);
}
}
@ -537,7 +537,7 @@ if (!empty($action)) {
Event::addEvent(
LOG_HOMEPAGE_CHANGED,
$action,
cut($link_name . ':' . $link_url, 254),
cut($link_name.':'.$link_url, 254),
api_get_utc_datetime(),
api_get_user_id()
);
@ -545,7 +545,7 @@ if (!empty($action)) {
} //end of switch($action)
if (empty($errorMsg)) {
header('Location: ' . $selfUrl . '?language=' . $languageGet);
header('Location: '.$selfUrl.'?language='.$languageGet);
exit();
}
} else {
@ -561,7 +561,7 @@ if (!empty($action)) {
// link and re-writing the array to the file
$link_index = intval($_GET['link_index']);
$menuf = ($action == 'delete_tabs') ? $mtloggedin : $menuf;
$home_menu = @file($homep . $menuf . '_' . $lang . $ext);
$home_menu = @file($homep.$menuf.'_'.$lang.$ext);
if (empty($home_menu)) {
$home_menu = array();
}
@ -575,28 +575,28 @@ if (!empty($action)) {
$home_menu = implode("\n", $home_menu);
$home_menu = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
$fp = fopen($homep . $menuf . '_' . $lang . $ext, 'w');
$fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w');
fputs($fp, $home_menu);
home_tabs($homep . $menuf . '_' . $lang . $ext);
home_tabs($homep.$menuf.'_'.$lang.$ext);
fclose($fp);
if (file_exists($homep . $menuf . $ext)) {
if (is_writable($homep . $menuf . $ext)) {
$fpo = fopen($homep . $menuf . $ext, 'w');
if (file_exists($homep.$menuf.$ext)) {
if (is_writable($homep.$menuf.$ext)) {
$fpo = fopen($homep.$menuf.$ext, 'w');
fputs($fpo, $home_menu);
home_tabs($homep . $menuf . $ext);
home_tabs($homep.$menuf.$ext);
fclose($fpo);
}
}
header('Location: ' . $selfUrl);
header('Location: '.$selfUrl);
exit();
break;
case 'edit_top':
// This request is only the preparation for the update of the home_top
$home_top = '';
if (is_file($homep . $topf . '_' . $lang . $ext) && is_readable($homep . $topf . '_' . $lang . $ext)) {
$home_top = @(string)file_get_contents($homep . $topf . '_' . $lang . $ext);
} elseif (is_file($homep . $topf . $lang . $ext) && is_readable($homep . $topf . $lang . $ext)) {
$home_top = @(string)file_get_contents($homep . $topf . $lang . $ext);
if (is_file($homep.$topf.'_'.$lang.$ext) && is_readable($homep.$topf.'_'.$lang.$ext)) {
$home_top = @(string) file_get_contents($homep.$topf.'_'.$lang.$ext);
} elseif (is_file($homep.$topf.$lang.$ext) && is_readable($homep.$topf.$lang.$ext)) {
$home_top = @(string) file_get_contents($homep.$topf.$lang.$ext);
} else {
$errorMsg = get_lang('HomePageFilesNotReadable');
}
@ -605,10 +605,10 @@ if (!empty($action)) {
case 'edit_notice':
// This request is only the preparation for the update of the home_notice
$home_notice = '';
if (is_file($homep . $noticef . '_' . $lang . $ext) && is_readable($homep . $noticef . '_' . $lang . $ext)) {
$home_notice = @file($homep . $noticef . '_' . $lang . $ext);
} elseif (is_file($homep . $noticef . $lang . $ext) && is_readable($homep . $noticef . $lang . $ext)) {
$home_notice = @file($homep . $noticef . $lang . $ext);
if (is_file($homep.$noticef.'_'.$lang.$ext) && is_readable($homep.$noticef.'_'.$lang.$ext)) {
$home_notice = @file($homep.$noticef.'_'.$lang.$ext);
} elseif (is_file($homep.$noticef.$lang.$ext) && is_readable($homep.$noticef.$lang.$ext)) {
$home_notice = @file($homep.$noticef.$lang.$ext);
} else {
$errorMsg = get_lang('HomePageFilesNotReadable');
}
@ -623,10 +623,10 @@ if (!empty($action)) {
case 'edit_news':
// This request is the preparation for the update of the home_news page
$home_news = '';
if (is_file($homep . $newsf . '_' . $lang . $ext) && is_readable($homep . $newsf . '_' . $lang . $ext)) {
$home_news = @(string)file_get_contents($homep . $newsf . '_' . $lang . $ext);
} elseif (is_file($homep . $newsf . $lang . $ext) && is_readable($homep . $newsf . $lang . $ext)) {
$home_news = @(string)file_get_contents($homep . $newsf . $lang . $ext);
if (is_file($homep.$newsf.'_'.$lang.$ext) && is_readable($homep.$newsf.'_'.$lang.$ext)) {
$home_news = @(string) file_get_contents($homep.$newsf.'_'.$lang.$ext);
} elseif (is_file($homep.$newsf.$lang.$ext) && is_readable($homep.$newsf.$lang.$ext)) {
$home_news = @(string) file_get_contents($homep.$newsf.$lang.$ext);
} else {
$errorMsg = get_lang('HomePageFilesNotReadable');
}
@ -636,10 +636,10 @@ if (!empty($action)) {
// This request is the preparation for the addition of an item in home_menu
$home_menu = '';
$menuf = ($action == 'edit_tabs') ? $mtloggedin : $menuf;
if (is_file($homep . $menuf . '_' . $lang . $ext) && is_readable($homep . $menuf . '_' . $lang . $ext)) {
$home_menu = @file($homep . $menuf . '_' . $lang . $ext);
} elseif (is_file($homep . $menuf . $lang . $ext) && is_readable($homep . $menuf . $lang . $ext)) {
$home_menu = @file($homep . $menuf . $lang . $ext);
if (is_file($homep.$menuf.'_'.$lang.$ext) && is_readable($homep.$menuf.'_'.$lang.$ext)) {
$home_menu = @file($homep.$menuf.'_'.$lang.$ext);
} elseif (is_file($homep.$menuf.$lang.$ext) && is_readable($homep.$menuf.$lang.$ext)) {
$home_menu = @file($homep.$menuf.$lang.$ext);
} else {
$errorMsg = get_lang('HomePageFilesNotReadable');
}
@ -656,12 +656,12 @@ if (!empty($action)) {
case 'insert_tabs':
// This request is the preparation for the addition of an item in home_menu
$home_menu = '';
if (is_file($homep . $mtloggedin . '_' . $lang . $ext) && is_readable($homep . $mtloggedin . '_' . $lang . $ext)) {
$home_menu = @file($homep . $mtloggedin . '_' . $lang . $ext);
} elseif (is_file($homep . $mtloggedin . $lang . $ext) && is_readable($homep . $mtloggedin . $lang . $ext)) {
$home_menu = @file($homep . $mtloggedin . $lang . $ext);
} elseif (touch($homep . $mtloggedin . '_' . $lang . $ext)) {
$home_menu = @file($homep . $mtloggedin . '_' . $lang . $ext);
if (is_file($homep.$mtloggedin.'_'.$lang.$ext) && is_readable($homep.$mtloggedin.'_'.$lang.$ext)) {
$home_menu = @file($homep.$mtloggedin.'_'.$lang.$ext);
} elseif (is_file($homep.$mtloggedin.$lang.$ext) && is_readable($homep.$mtloggedin.$lang.$ext)) {
$home_menu = @file($homep.$mtloggedin.$lang.$ext);
} elseif (touch($homep.$mtloggedin.'_'.$lang.$ext)) {
$home_menu = @file($homep.$mtloggedin.'_'.$lang.$ext);
} else {
$errorMsg = get_lang('HomePageFilesNotReadable');
}
@ -680,17 +680,17 @@ if (!empty($action)) {
// This request is the preparation for the edition of the links array
$home_menu = '';
$menuf = ($action == 'edit_tabs') ? $mtloggedin : $menuf;
if (is_file($homep . $menuf . '_' . $lang . $ext) && is_readable($homep . $menuf . '_' . $lang . $ext)) {
$home_menu = @file($homep . $menuf . '_' . $lang . $ext);
} elseif (is_file($homep . $menuf . $lang . $ext) && is_readable($homep . $menuf . $lang . $ext)) {
$home_menu = @file($homep . $menuf . $lang . $ext);
if (is_file($homep.$menuf.'_'.$lang.$ext) && is_readable($homep.$menuf.'_'.$lang.$ext)) {
$home_menu = @file($homep.$menuf.'_'.$lang.$ext);
} elseif (is_file($homep.$menuf.$lang.$ext) && is_readable($homep.$menuf.$lang.$ext)) {
$home_menu = @file($homep.$menuf.$lang.$ext);
} else {
$errorMsg = get_lang('HomePageFilesNotReadable');
}
if (empty($home_menu)) {
if (file_exists($homep . $menutabs . '_' . $lang . $ext)) {
$home_menu = @file($homep . $menutabs . '_' . $lang . $ext);
if (file_exists($homep.$menutabs.'_'.$lang.$ext)) {
$home_menu = @file($homep.$menutabs.'_'.$lang.$ext);
}
}
@ -757,7 +757,7 @@ if (!empty($action)) {
if (!strstr($filename, '/') && strstr($filename, '.html')) {
// Get oonly the contents of the link file
$link_html = @file($homep . $filename);
$link_html = @file($homep.$filename);
$link_html = implode('', $link_html);
$link_url = '';
} else {
@ -783,7 +783,7 @@ switch ($action) {
case 'open_link':
if (!empty($link)) {
// $link is only set in case of action=open_link and is filtered
$open = @(string)file_get_contents($homep . $link);
$open = @(string) file_get_contents($homep.$link);
$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
echo $open;
}
@ -850,8 +850,8 @@ switch ($action) {
Display::addFlash(Display::return_message($errorMsg, 'normal'));
}
$default = array();
$form = new FormValidator('configure_homepage_' . $action, 'post', $selfUrl . '?action=' . $action, '', array('style' => 'margin: 0px;'));
$renderer =& $form->defaultRenderer();
$form = new FormValidator('configure_homepage_'.$action, 'post', $selfUrl.'?action='.$action, '', array('style' => 'margin: 0px;'));
$renderer = & $form->defaultRenderer();
$form->addElement('header', '', $tool_name);
$form->addElement('hidden', 'formSent', '1');
@ -863,7 +863,7 @@ switch ($action) {
$default['link_name'] = $link_name;
}
$default['link_url'] = empty($link_url) ? 'http://' : api_htmlentities($link_url, ENT_QUOTES);
$linkUrlComment = ($action == 'insert_tabs') ? get_lang('Optional') . '<br />' . get_lang('GlobalLinkUseDoubleColumnPrivateToShowPrivately') : '';
$linkUrlComment = ($action == 'insert_tabs') ? get_lang('Optional').'<br />'.get_lang('GlobalLinkUseDoubleColumnPrivateToShowPrivately') : '';
$form->addElement('text', 'link_url', array(get_lang('LinkURL'), $linkUrlComment), array('size' => '30', 'maxlength' => '100', 'style' => 'width: 350px;'));
$options = array('-1' => get_lang('FirstPlace'));
@ -875,7 +875,7 @@ switch ($action) {
if (is_array($home_menu)) {
foreach ($home_menu as $key => $enreg) {
if (strlen($enreg = trim(strip_tags($enreg))) > 0) {
$options[$key] = get_lang('After') . ' &quot;' . $enreg . '&quot;';
$options[$key] = get_lang('After').' &quot;'.$enreg.'&quot;';
$formSentCheck = (!empty($_POST['formSent']) ? true : false);
$selected = $formSentCheck && $insert_where == $key ? $key : '';
}
@ -913,7 +913,7 @@ switch ($action) {
$i++;
$lang_name = $_languages['folder'][$key];
$html_langs = '<td width="300">';
$html_langs .= '<label><input type="checkbox" id="lang" name="' . $lang_name . '" />&nbsp;' . $lang_name . '<label/>';
$html_langs .= '<label><input type="checkbox" id="lang" name="'.$lang_name.'" />&nbsp;'.$lang_name.'<label/>';
$html_langs .= '</td>';
if ($i % 5 == 0) {
$html_langs .= '</tr><tr>';
@ -935,7 +935,7 @@ switch ($action) {
$open = $home_top;
} else {
$name = $newsf;
$open = @(string)file_get_contents($homep . $newsf . '_' . $lang . $ext);
$open = @(string) file_get_contents($homep.$newsf.'_'.$lang.$ext);
}
$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
@ -945,13 +945,13 @@ switch ($action) {
$default = array();
$form = new FormValidator(
'configure_homepage_' . $action,
'configure_homepage_'.$action,
'post',
$selfUrl . '?action=' . $action,
$selfUrl.'?action='.$action,
'',
array('style' => 'margin: 0px;')
);
$renderer =& $form->defaultRenderer();
$renderer = & $form->defaultRenderer();
$renderer->setHeaderTemplate('');
$renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>');
$renderer->setCustomElementTemplate('<tr><td>{element}</td></tr>');
@ -960,15 +960,15 @@ switch ($action) {
if ($action == 'edit_news') {
$_languages = api_get_languages();
$html = '<tr><td>' . get_lang('ChooseNewsLanguage') . ' : ';
$html = '<tr><td>'.get_lang('ChooseNewsLanguage').' : ';
$html .= '<select name="news_languages">';
$html .= '<option value="all">' . get_lang('ApplyAllLanguages') . '</option>';
$html .= '<option value="all">'.get_lang('ApplyAllLanguages').'</option>';
foreach ($_languages['name'] as $key => $value) {
$english_name = $_languages['folder'][$key];
if ($language == $english_name) {
$html .= '<option value="' . $english_name . '" selected="selected">' . $value . '</option>';
$html .= '<option value="'.$english_name.'" selected="selected">'.$value.'</option>';
} else {
$html .= '<option value="' . $english_name . '">' . $value . '</option>';
$html .= '<option value="'.$english_name.'">'.$value.'</option>';
}
}
$html .= '</select></td></tr>';
@ -991,7 +991,7 @@ switch ($action) {
$checked = "checked";
}
$html_langs = '<td width="300">';
$html_langs .= '<label><input type="checkbox" ' . $checked . ' id="lang" name="' . $lang_name . '" />&nbsp;' . $value . '<label/>';
$html_langs .= '<label><input type="checkbox" '.$checked.' id="lang" name="'.$lang_name.'" />&nbsp;'.$value.'<label/>';
$html_langs .= '</td>';
if ($i % 5 == 0) {
$html_langs .= '</tr><tr>';
@ -1056,10 +1056,10 @@ switch ($action) {
<div class="panel-body">
<?php
$home_notice = '';
if (file_exists($homep . $noticef . '_' . $lang . $ext)) {
$home_notice = @(string)file_get_contents($homep . $noticef . '_' . $lang . $ext);
if (file_exists($homep.$noticef.'_'.$lang.$ext)) {
$home_notice = @(string) file_get_contents($homep.$noticef.'_'.$lang.$ext);
} else {
$home_notice = @(string)file_get_contents($homep . $noticef . $ext);
$home_notice = @(string) file_get_contents($homep.$noticef.$ext);
}
$home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice)));
echo '<div class="homepage_notice">';
@ -1086,15 +1086,15 @@ switch ($action) {
<div id="links-list" class="panel-collapse collapse in" role="tabpanel"
aria-labelledby="headingOne">
<div class="panel-body">
<a href="<?php echo $selfUrl; ?>?action=insert_link"><?php echo Display::return_icon('add.png', get_lang('InsertLink')) . '&nbsp;' . get_lang('InsertLink'); ?>
<a href="<?php echo $selfUrl; ?>?action=insert_link"><?php echo Display::return_icon('add.png', get_lang('InsertLink')).'&nbsp;'.get_lang('InsertLink'); ?>
</a>
<ul class="menulist">
<?php
$home_menu = '';
if (file_exists($homep . $menuf . '_' . $lang . $ext)) {
$home_menu = @file($homep . $menuf . '_' . $lang . $ext);
if (file_exists($homep.$menuf.'_'.$lang.$ext)) {
$home_menu = @file($homep.$menuf.'_'.$lang.$ext);
} else {
$home_menu = @file($homep . $menuf . $ext);
$home_menu = @file($homep.$menuf.$ext);
}
if (empty($home_menu)) {
$home_menu = array();
@ -1108,9 +1108,9 @@ switch ($action) {
foreach ($home_menu as $enreg) {
$enreg = trim($enreg);
if (!empty($enreg)) {
$edit_link = '<a href="' . $selfUrl . '?action=edit_link&amp;link_index=' . $i . '">' . Display::return_icon('edit.png', get_lang('Edit')) . '</a>';
$delete_link = '<a href="' . $selfUrl . '?action=delete_link&amp;link_index=' . $i . '" onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . '\')) return false;">' . Display::return_icon('delete.png', get_lang('Delete')) . '</a>';
echo str_replace(array('href="' . api_get_path(WEB_PATH) . 'index.php?include=', '</li>'), array('href="' . api_get_path(WEB_CODE_PATH) . 'admin/' . basename($selfUrl) . '?action=open_link&link=', $edit_link . ' ' . $delete_link . '</li>'), $enreg);
$edit_link = '<a href="'.$selfUrl.'?action=edit_link&amp;link_index='.$i.'">'.Display::return_icon('edit.png', get_lang('Edit')).'</a>';
$delete_link = '<a href="'.$selfUrl.'?action=delete_link&amp;link_index='.$i.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete')).'</a>';
echo str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'), array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.' '.$delete_link.'</li>'), $enreg);
$i++;
}
}
@ -1125,16 +1125,16 @@ switch ($action) {
<div class="col-md-9">
<div class="actions">
<a href="<?php echo $selfUrl; ?>?action=edit_top&language=<?php echo $languageGet; ?>">
<?php echo Display::return_icon('edit.png', get_lang('EditHomePage'), null, ICON_SIZE_SMALL) . '&nbsp;' . get_lang('EditHomePage'); ?>
<?php echo Display::return_icon('edit.png', get_lang('EditHomePage'), null, ICON_SIZE_SMALL).'&nbsp;'.get_lang('EditHomePage'); ?>
</a>
</div>
<section id="homepage-home">
<?php
//print home_top contents
if (file_exists($homep . $topf . '_' . $lang . $ext)) {
$home_top_temp = @(string)file_get_contents($homep . $topf . '_' . $lang . $ext);
if (file_exists($homep.$topf.'_'.$lang.$ext)) {
$home_top_temp = @(string) file_get_contents($homep.$topf.'_'.$lang.$ext);
} else {
$home_top_temp = @(string)file_get_contents($homep . $topf . $ext);
$home_top_temp = @(string) file_get_contents($homep.$topf.$ext);
}
$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
@ -1151,14 +1151,14 @@ switch ($action) {
if ($access_url_id == 1) {
echo '<div class="actions">';
echo '<a href="course_category.php">' . Display::return_icon('edit.png', get_lang('Edit')) . '&nbsp;' . get_lang('EditCategories') . '</a>';
echo '<a href="course_category.php">'.Display::return_icon('edit.png', get_lang('Edit')).'&nbsp;'.get_lang('EditCategories').'</a>';
echo '</div>';
}
echo '<ul class="list-group">';
if ($access_url_id == 1) {
if (sizeof($Categories)) {
foreach ($Categories as $enreg) {
echo '<li class="list-group-item">' . Display::return_icon('folder.png', $enreg['name']) . '&nbsp;' . $enreg['name'] . '</li>';
echo '<li class="list-group-item">'.Display::return_icon('folder.png', $enreg['name']).'&nbsp;'.$enreg['name'].'</li>';
}
unset($Categories);
} else {
@ -1169,12 +1169,12 @@ switch ($action) {
?>
<?php
if (file_exists($homep . $newsf . '_' . $lang . $ext)) {
$open = @(string)file_get_contents($homep . $newsf . '_' . $lang . $ext);
if (file_exists($homep.$newsf.'_'.$lang.$ext)) {
$open = @(string) file_get_contents($homep.$newsf.'_'.$lang.$ext);
$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
echo $open;
} else {
$open = @(string)file_get_contents($homep . $newsf . $ext);
$open = @(string) file_get_contents($homep.$newsf.$ext);
$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
echo $open;
}
@ -1183,14 +1183,14 @@ switch ($action) {
<?php
// Add new page
$home_menu = '';
if (file_exists($homep . $mtloggedin . '_' . $lang . $ext)) {
$home_menu = @file($homep . $mtloggedin . '_' . $lang . $ext);
if (file_exists($homep.$mtloggedin.'_'.$lang.$ext)) {
$home_menu = @file($homep.$mtloggedin.'_'.$lang.$ext);
} else {
$home_menu = @file($homep . $mtloggedin . $ext);
$home_menu = @file($homep.$mtloggedin.$ext);
}
if (empty($home_menu)) {
if (file_exists($homep . $menutabs . '_' . $lang . $ext)) {
$home_menu = @file($homep . $menutabs . '_' . $lang . $ext);
if (file_exists($homep.$menutabs.'_'.$lang.$ext)) {
$home_menu = @file($homep.$menutabs.'_'.$lang.$ext);
}
}
if (empty($home_menu)) {
@ -1206,11 +1206,11 @@ switch ($action) {
foreach ($home_menu as $enreg) {
$enreg = trim($enreg);
if (!empty($enreg)) {
$edit_link = ' <a href="' . $selfUrl . '?action=edit_tabs&amp;link_index=' . $tab_counter . '" ><span>' . Display::return_icon('edit.png', get_lang('Edit')) . '</span></a>';
$delete_link = ' <a href="' . $selfUrl . '?action=delete_tabs&amp;link_index=' . $tab_counter . '" onclick="javascript: if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . '\')) return false;"><span>' . Display::return_icon('delete.png', get_lang('Delete')) . '</span></a>';
$edit_link = ' <a href="'.$selfUrl.'?action=edit_tabs&amp;link_index='.$tab_counter.'" ><span>'.Display::return_icon('edit.png', get_lang('Edit')).'</span></a>';
$delete_link = ' <a href="'.$selfUrl.'?action=delete_tabs&amp;link_index='.$tab_counter.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;"><span>'.Display::return_icon('delete.png', get_lang('Delete')).'</span></a>';
$tab_string = str_replace(
array('href="' . api_get_path(WEB_PATH) . 'index.php?include=', '</li>'),
array('href="' . api_get_path(WEB_CODE_PATH) . 'admin/' . basename($selfUrl) . '?action=open_link&link=', $edit_link . $delete_link . '</li>'),
array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'),
array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.$delete_link.'</li>'),
$enreg
);
$tab_string = str_replace([' class="hide_menu"', ' class="show_menu"'], '', $tab_string);
@ -1222,7 +1222,7 @@ switch ($action) {
?>
<div class="actions">
<a href="<?php echo $selfUrl; ?>?action=insert_tabs">
<?php echo Display::return_icon('add.png', get_lang('InsertLink')) . '&nbsp;' . get_lang('InsertLink'); ?>
<?php echo Display::return_icon('add.png', get_lang('InsertLink')).'&nbsp;'.get_lang('InsertLink'); ?>
</a>
</div>
<?php

@ -6,7 +6,7 @@
* Copyright (c) 2007 Mustapha Alouani (supervised by Michel Moreau-Belliard)
*/
// resetting the course id
$cidReset=true;
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
@ -15,11 +15,11 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
require('../auth/ldap/authldap.php');
$annee_base=date('Y');
$annee_base = date('Y');
$tool_name = get_lang('LDAPImport');
// setting breadcrumbs
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
var buttoncheck = 1;
@ -45,7 +45,7 @@ function checkAll() {
$annee = $_GET['annee'];
$composante = $_GET['composante'];
$etape = $_GET['etape'];
$etape = $_GET['etape'];
$course = $_POST['course'];
@ -195,7 +195,7 @@ elseif ($annee <> "" && $composante <> "" && $etape == "") // form3 :annee!=0com
echo '</div>';
}
*/
elseif(!empty($annee) && empty($course))
elseif (!empty($annee) && empty($course))
{
Display::display_header($tool_name);
echo '<div style="align:center">';
@ -203,7 +203,7 @@ elseif(!empty($annee) && empty($course))
echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
echo '<select name="course">';
$courses = CourseManager::get_courses_list();
foreach($courses as $row)
foreach ($courses as $row)
{
echo '<option value="'.$row['code'].'">'.api_htmlentities($row['title']).'</option>';
}
@ -236,7 +236,7 @@ elseif (!empty($annee) && !empty($course) && empty($_POST['confirmed']))
$info = ldap_get_entries($ds, $sr);
for ($key = 0; $key < $info["count"]; $key ++) {
for ($key = 0; $key < $info["count"]; $key++) {
$nom_form[] = $info[$key]["sn"][0];
$prenom_form[] = $info[$key]["givenname"][0];
$email_form[] = $info[$key]["mail"][0];
@ -256,7 +256,7 @@ elseif (!empty($annee) && !empty($course) && empty($_POST['confirmed']))
asort($nom_form);
reset($nom_form);
$statut=5;
$statut = 5;
include ('ldap_form_add_users_group.php');
} else {
echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
@ -267,25 +267,25 @@ elseif (!empty($annee) && !empty($course) && empty($_POST['confirmed']))
echo '</div>';
}
elseif (!empty($annee) && !empty($course) && ($_POST['confirmed']=='yes'))
elseif (!empty($annee) && !empty($course) && ($_POST['confirmed'] == 'yes'))
{
$id=$_POST['username_form'];
$UserList=array();
$id = $_POST['username_form'];
$UserList = array();
$userid_match_login = array();
foreach ($id as $form_index=>$user_id)
{
if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes'])))
{
$tmp = ldap_add_user($user_id);
$UserList[]= $tmp;
$UserList[] = $tmp;
$userid_match_login[$tmp] = $user_id;
}
}
if (!empty($_POST['course']))
{
foreach($UserList as $user_id)
foreach ($UserList as $user_id)
{
CourseManager::add_user_to_course($user_id,$_POST['course']);
CourseManager::add_user_to_course($user_id, $_POST['course']);
}
header('Location: course_information.php?code='.Security::remove_XSS($_POST['course']));
}
@ -311,7 +311,7 @@ elseif (!empty($annee) && !empty($course) && ($_POST['confirmed']=='yes'))
else
{
Display::display_header($tool_name);
$message=get_lang('NoUserAdded');
$message = get_lang('NoUserAdded');
Display::addFlash(Display::return_message($message, 'normal', false));
}
echo '<br /><br />';

@ -116,7 +116,7 @@ switch ($action) {
$values['content'] = $announcement->content;
$values['start'] = api_get_local_time($announcement->date_start);
$values['end'] = api_get_local_time($announcement->date_end);
$values['range'] =substr(api_get_local_time($announcement->date_start), 0, 16).' / '.
$values['range'] = substr(api_get_local_time($announcement->date_start), 0, 16).' / '.
substr(api_get_local_time($announcement->date_end), 0, 16);
$data = (array) $announcement;

@ -132,7 +132,7 @@ if ($form->validate()) {
$extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', false);
if (!empty($export['addcsvheader'])) {
if ($export['addcsvheader'] == '1' && ($export['file_type'] == 'csv' || $export['file_type'] == 'xls' )) {
if ($export['addcsvheader'] == '1' && ($export['file_type'] == 'csv' || $export['file_type'] == 'xls')) {
if ($_configuration['password_encryption'] != 'none') {
$data[] = array(
'UserId',

@ -32,7 +32,7 @@ use ChamiloSession as Session;
$use_anonymous = true;
require_once __DIR__.'/../inc/global.inc.php';
$htmlHeadXtra[] ='<script>
$htmlHeadXtra[] = '<script>
/* option show/hide thematic-block */
$(document).ready(function(){
$("#thematic-show").click(function(){
@ -192,13 +192,13 @@ if (!empty($auto_launch)) {
$course_id = api_get_course_int_id();
$condition = '';
if (!empty($session_id)) {
$condition = api_get_session_condition($session_id);
$condition = api_get_session_condition($session_id);
$sql = "SELECT id FROM $lp_table
WHERE c_id = $course_id AND autolaunch = 1 $condition
LIMIT 1";
$result = Database::query($sql);
// If we found nothing in the session we just called the session_id = 0 autolaunch
if (Database::num_rows($result) == 0) {
if (Database::num_rows($result) == 0) {
$condition = '';
}
}
@ -207,7 +207,7 @@ if (!empty($auto_launch)) {
WHERE c_id = $course_id AND autolaunch = 1 $condition
LIMIT 1";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
if (Database::num_rows($result) > 0) {
$lp_data = Database::fetch_array($result, 'ASSOC');
if (!empty($lp_data['id'])) {
if (api_is_platform_admin() || api_is_allowed_to_edit()) {

@ -56,7 +56,7 @@ class ExerciseResult
$course_id = api_get_course_int_id();
$user_id = intval($user_id);
$sessionId = api_get_session_id();
$session_id_and = ' AND te.session_id = ' . $sessionId . ' ';
$session_id_and = ' AND te.session_id = '.$sessionId.' ';
$exercise_id = intval($exercise_id);
if (!empty($exercise_id)) {
@ -92,7 +92,7 @@ class ExerciseResult
te.c_id = ce.c_id $user_id_and $session_id_and AND
ce.active <>-1";
} else {
$user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
$user_id_and = ' AND te.exe_user_id = '.api_get_user_id().' ';
// get only this user's results
$sql = "SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").",
official_code,
@ -349,7 +349,7 @@ class ExerciseResult
$data .= get_lang('Title').';';
$data .= get_lang('StartDate').';';
$data .= get_lang('EndDate').';';
$data .= get_lang('Duration'). ' ('.get_lang('MinMinutes').') ;';
$data .= get_lang('Duration').' ('.get_lang('MinMinutes').') ;';
$data .= get_lang('Score').';';
$data .= get_lang('Total').';';
$data .= get_lang('Status').';';
@ -360,11 +360,11 @@ class ExerciseResult
//results
foreach ($this->results as $row) {
if (api_is_western_name_order()) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
} else {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
}
// Official code
@ -373,8 +373,8 @@ class ExerciseResult
}
// Email
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n",' ',implode(", ", GroupManager::get_user_group_name($row['user_id']))).';';
$data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n", ' ', implode(", ", GroupManager::get_user_group_name($row['user_id']))).';';
if ($export_user_fields) {
//show user fields data, if any, for this user
@ -386,14 +386,14 @@ class ExerciseResult
true
);
if (!empty($user_fields_values)) {
foreach($user_fields_values as $value) {
$data .= '"'.str_replace('"','""',api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";';
foreach ($user_fields_values as $value) {
$data .= '"'.str_replace('"', '""', api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";';
}
}
}
$duration = !empty($row['duration']) ? round($row['duration'] / 60) : 0;
$data .= str_replace("\r\n",' ', api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n", ' ', $row['start_date']).';';
$data .= str_replace("\r\n", ' ', $row['end_date']).';';
$data .= str_replace("\r\n", ' ', $duration).';';

@ -639,7 +639,7 @@ class FillBlanks extends Question
// the answer must be one of the choice made
$listSeveral = self::getFillTheBlankSeveralAnswers($correctAnswer);
$listSeveral = array_map(function ($item) {
$listSeveral = array_map(function($item) {
return self::trimOption($item);
}, $listSeveral);

@ -73,11 +73,11 @@ if ($is_allowedToEdit && $origin != 'learnpath') {
// the form
if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
$actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&path='.$hotpotatoes_path.' ">'.
Display::return_icon('save.png', get_lang('Export'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'</a>';
}
} else {
$actions .= '<a href="exercise.php">' .
Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
$actions .= '<a href="exercise.php">'.
Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
}
if ($is_allowedToEdit) {
@ -99,13 +99,13 @@ $nameTools = get_lang('Results');
if ($is_allowedToEdit || $is_tutor) {
$nameTools = get_lang('StudentScore');
$interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises'));
$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
$objExerciseTmp = new Exercise();
/*if ($objExerciseTmp->read($exercise_id)) {
$interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$exercise_id, "name" => $objExerciseTmp->name);
}*/
} else {
$interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises'));
$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
$objExerciseTmp = new Exercise();
/*if ($objExerciseTmp->read($exercise_id)) {
$nameTools = get_lang('Results').': '.$objExerciseTmp->name;
@ -168,7 +168,7 @@ $action_links = '';
// Generating group list
$group_list = GroupManager::get_group_list();
$group_parameters = array('group_all:'.get_lang('All'),'group_none:'.get_lang('None'));
$group_parameters = array('group_all:'.get_lang('All'), 'group_none:'.get_lang('None'));
foreach ($group_list as $group) {
$group_parameters[] = $group['id'].':'.$group['name'];

@ -80,7 +80,7 @@ class SurveyLink extends AbstractLink
$links[] = array(
$data['survey_id'],
api_trunc_str(
$data['code'] . ': ' . self::html_to_text($data['title']),
$data['code'].': '.self::html_to_text($data['title']),
80
)
);

@ -455,9 +455,9 @@ function menuArray()
$pageContent = '';
// Get the extra page content, containing the links to add to the tabs
if (is_file($homepath.$menuTabs.'_'.$lang.$ext) && is_readable($homepath.$menuTabs.'_'.$lang.$ext)) {
$pageContent = @(string)file_get_contents($homepath.$menuTabs.'_'.$lang.$ext);
$pageContent = @(string) file_get_contents($homepath.$menuTabs.'_'.$lang.$ext);
} elseif (is_file($homepath.$menuTabs.$lang.$ext) && is_readable($homepath.$menuTabs.$lang.$ext)) {
$pageContent = @(string)file_get_contents($homepath.$menuTabs.$lang.$ext);
$pageContent = @(string) file_get_contents($homepath.$menuTabs.$lang.$ext);
}
// Sanitize page content
$pageContent = api_to_system_encoding($pageContent, api_detect_encoding(strip_tags($pageContent)));
@ -471,13 +471,13 @@ function menuArray()
$homepath.$menuTabsLoggedIn.'_'.$lang.$ext
)
) {
$pageContent = @(string)file_get_contents($homepath.$menuTabsLoggedIn.'_'.$lang.$ext);
$pageContent = @(string) file_get_contents($homepath.$menuTabsLoggedIn.'_'.$lang.$ext);
$pageContent = str_replace('::private', '', $pageContent);
} elseif (is_file($homepath.$menuTabsLoggedIn.$lang.$ext) && is_readable(
$homepath.$menuTabsLoggedIn.$lang.$ext
)
) {
$pageContent = @(string)file_get_contents($homepath.$menuTabsLoggedIn.$lang.$ext);
$pageContent = @(string) file_get_contents($homepath.$menuTabsLoggedIn.$lang.$ext);
$pageContent = str_replace('::private', '', $pageContent);
}
@ -738,7 +738,7 @@ function return_breadcrumb($interbreadcrumb, $language_file, $nameTools)
/** @var learnpath $learnPath */
$learnPath = Session::read('oLP');
if (!empty($learnPath) && !empty($view_as_student_link)) {
if ((int)$learnPath->get_lp_session_id() != (int)api_get_session_id()) {
if ((int) $learnPath->get_lp_session_id() != (int) api_get_session_id()) {
$view_as_student_link = '';
}
}
@ -788,7 +788,7 @@ function return_breadcrumb($interbreadcrumb, $language_file, $nameTools)
}
}
return $html . $additonalBlocks;
return $html.$additonalBlocks;
}
/**

@ -122,7 +122,7 @@ class ExerciseLib
id="question-'.$questionId.'" data-question="'.$questionId.'">
';
} else {
$s .= '<div id="drag' . $questionId . '_question" class="drag_question">
$s .= '<div id="drag'.$questionId.'_question" class="drag_question">
<table class="data_table">';
}
@ -168,7 +168,7 @@ class ExerciseLib
$num_suggestions = ($nbrAnswers - $x) + 1;
} elseif ($answerType == FREE_ANSWER) {
$fck_content = isset($user_choice[0]) && !empty($user_choice[0]['answer']) ? $user_choice[0]['answer'] : null;
$form = new FormValidator('free_choice_' . $questionId);
$form = new FormValidator('free_choice_'.$questionId);
$config = array(
'ToolbarSet' => 'TestFreeAnswer'
);
@ -208,7 +208,7 @@ class ExerciseLib
echo $objQuestionTmp->returnRecorder();
}
$form = new FormValidator('free_choice_' . $questionId);
$form = new FormValidator('free_choice_'.$questionId);
$config = array(
'ToolbarSet' => 'TestFreeAnswer'
);
@ -317,7 +317,7 @@ class ExerciseLib
case UNIQUE_ANSWER_IMAGE:
//no break
case READING_COMPREHENSION:
$input_id = 'choice-' . $questionId . '-' . $answerId;
$input_id = 'choice-'.$questionId.'-'.$answerId;
if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
$attributes = array(
@ -343,14 +343,14 @@ class ExerciseLib
if ($answerType == UNIQUE_ANSWER_IMAGE) {
if ($show_comment) {
if (empty($comment)) {
$s .= '<div id="answer' . $questionId . $numAnswer . '" '
$s .= '<div id="answer'.$questionId.$numAnswer.'" '
. 'class="exercise-unique-answer-image" style="text-align: center">';
} else {
$s .= '<div id="answer' . $questionId . $numAnswer . '" '
$s .= '<div id="answer'.$questionId.$numAnswer.'" '
. 'class="exercise-unique-answer-image col-xs-6 col-sm-12" style="text-align: center">';
}
} else {
$s .= '<div id="answer' . $questionId . $numAnswer . '" '
$s .= '<div id="answer'.$questionId.$numAnswer.'" '
. 'class="exercise-unique-answer-image col-xs-6 col-md-3" style="text-align: center">';
}
}
@ -358,7 +358,7 @@ class ExerciseLib
$answer = Security::remove_XSS($answer, STUDENT);
$s .= Display::input(
'hidden',
'choice2[' . $questionId . ']',
'choice2['.$questionId.']',
'0'
);
@ -366,13 +366,13 @@ class ExerciseLib
if ($answerType == UNIQUE_ANSWER_IMAGE) {
$attributes['style'] = 'display: none;';
$answer = '<div class="thumbnail">' . $answer . '</div>';
$answer = '<div class="thumbnail">'.$answer.'</div>';
}
$answer_input .= '<label class="radio '.$hidingClass.'">';
$answer_input .= Display::input(
'radio',
'choice[' . $questionId . ']',
'choice['.$questionId.']',
$numAnswer,
$attributes
);
@ -399,7 +399,7 @@ class ExerciseLib
case MULTIPLE_ANSWER_TRUE_FALSE:
//no break
case GLOBAL_MULTIPLE_ANSWER:
$input_id = 'choice-' . $questionId . '-' . $answerId;
$input_id = 'choice-'.$questionId.'-'.$answerId;
$answer = Security::remove_XSS($answer, STUDENT);
if (in_array($numAnswer, $user_choice_array)) {
@ -420,12 +420,12 @@ class ExerciseLib
}
if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) {
$s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />';
$s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
$answer_input = '<label class="checkbox">';
$answer_input .= Display::input(
'checkbox',
'choice[' . $questionId . '][' . $numAnswer . ']',
'choice['.$questionId.']['.$numAnswer.']',
$numAnswer,
$attributes
);
@ -476,7 +476,7 @@ class ExerciseLib
'td',
Display::input(
'radio',
'choice[' . $questionId . '][' . $numAnswer . ']',
'choice['.$questionId.']['.$numAnswer.']',
$id,
$attributes
),
@ -495,7 +495,7 @@ class ExerciseLib
break;
case MULTIPLE_ANSWER_COMBINATION:
// multiple answers
$input_id = 'choice-' . $questionId . '-' . $answerId;
$input_id = 'choice-'.$questionId.'-'.$answerId;
if (in_array($numAnswer, $user_choice_array)) {
$attributes = array(
@ -515,11 +515,11 @@ class ExerciseLib
}
$answer = Security::remove_XSS($answer, STUDENT);
$answer_input = '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />';
$answer_input = '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
$answer_input .= '<label class="checkbox">';
$answer_input .= Display::input(
'checkbox',
'choice[' . $questionId . '][' . $numAnswer . ']',
'choice['.$questionId.']['.$numAnswer.']',
1,
$attributes
);
@ -540,7 +540,7 @@ class ExerciseLib
}
break;
case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE:
$s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />';
$s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
$my_choice = array();
if (!empty($user_choice_array)) {
@ -574,7 +574,7 @@ class ExerciseLib
'td',
Display::input(
'radio',
'choice[' . $questionId . '][' . $numAnswer . ']',
'choice['.$questionId.']['.$numAnswer.']',
$key,
$attributes
)
@ -625,7 +625,7 @@ class ExerciseLib
// may be "" if student viewed the question, but did not fill the blanks
$correctItem = $studentAnswerList[$i];
}
$attributes['style'] = "width:" . $listAnswerInfo['tabinputsize'][$i] . "px";
$attributes['style'] = "width:".$listAnswerInfo['tabinputsize'][$i]."px";
$answer .= FillBlanks::getFillTheBlankHtml(
$current_item,
$questionId,
@ -646,7 +646,7 @@ class ExerciseLib
// display the common words
$answer .= $listAnswerInfo['commonwords'][$i];
// display the blank word
$attributes["style"] = "width:" . $listAnswerInfo['tabinputsize'][$i] . "px";
$attributes["style"] = "width:".$listAnswerInfo['tabinputsize'][$i]."px";
$answer .= FillBlanks::getFillTheBlankHtml(
$current_item,
$questionId,
@ -675,8 +675,8 @@ class ExerciseLib
if ($origin !== null) {
global $exe_id;
$trackAttempts = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql = 'SELECT answer FROM ' . $trackAttempts . '
WHERE exe_id=' . $exe_id . ' AND question_id=' . $questionId;
$sql = 'SELECT answer FROM '.$trackAttempts.'
WHERE exe_id=' . $exe_id.' AND question_id='.$questionId;
$rsLastAttempt = Database::query($sql);
$rowLastAttempt = Database::fetch_array($rsLastAttempt);
$answer = $rowLastAttempt['answer'];
@ -733,7 +733,7 @@ class ExerciseLib
'',
$answerCorrected
);
$answerCorrected = '[' . $answerCorrected . ']';
$answerCorrected = '['.$answerCorrected.']';
$studentAnswerList[] = $answerCorrected;
}
}
@ -754,7 +754,7 @@ class ExerciseLib
*/
$tabComments = api_preg_split(
'/\[[^]]+\]/',
' ' . $answer . ' '
' '.$answer.' '
);
if (!empty($correctAnswerList) && !empty($studentAnswerList)) {
$answer = "";
@ -771,7 +771,7 @@ class ExerciseLib
$size
);
$answer .= $tabComments[$i] .
$answer .= $tabComments[$i].
Display::input(
'text',
"choice[$questionId][]",
@ -817,12 +817,12 @@ class ExerciseLib
$s .= '<tr><td width="45%" valign="top">';
$parsed_answer = $answer;
// Left part questions
$s .= '<p class="indent">' . $lines_count . '.&nbsp;' . $parsed_answer . '</p></td>';
$s .= '<p class="indent">'.$lines_count.'.&nbsp;'.$parsed_answer.'</p></td>';
// Middle part (matches selects)
// Id of select is # question + # of option
$s .= '<td width="10%" valign="top" align="center">
<div class="select-matching">
<select id="choice_id_'.$current_item.'_'.$lines_count.'" name="choice[' . $questionId . '][' . $numAnswer . ']">';
<select id="choice_id_'.$current_item.'_'.$lines_count.'" name="choice['.$questionId.']['.$numAnswer.']">';
// fills the list-box
foreach ($select_items as $key => $val) {
@ -838,14 +838,14 @@ class ExerciseLib
if (isset($user_choice_array_position[$numAnswer]) && $val['id'] == $user_choice_array_position[$numAnswer]) {
$selected = 'selected="selected"';
}
$s .= '<option value="' . $val['id'] . '" ' . $selected . '>' . $val['letter'] . '</option>';
$s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>';
} // end foreach()
$s .= '</select></div></td><td width="5%" class="separate">&nbsp;</td>';
$s .= '<td width="40%" valign="top" >';
if (isset($select_items[$lines_count])) {
$s .= '<div class="text-right"><p class="indent">' . $select_items[$lines_count]['letter'] . '.&nbsp; ' . $select_items[$lines_count]['answer'] . '</p></div>';
$s .= '<div class="text-right"><p class="indent">'.$select_items[$lines_count]['letter'].'.&nbsp; '.$select_items[$lines_count]['answer'].'</p></div>';
} else {
$s .= '&nbsp;';
}
@ -860,7 +860,7 @@ class ExerciseLib
$s .= '<tr>
<td colspan="2"></td>
<td valign="top">';
$s .= '<b>' . $select_items[$lines_count]['letter'] . '.</b> ' . $select_items[$lines_count]['answer'];
$s .= '<b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'];
$s .= "</td>
</tr>";
$lines_count++;
@ -876,8 +876,8 @@ class ExerciseLib
$data = $objAnswerTmp->getAnswerByAutoId($numAnswer);
$data = $objAnswerTmp->getAnswerByAutoId($data['correct']);
$lines_count = $data['answer'];*/
$windowId = $questionId . '_' . $lines_count;
$s .= '<li class="touch-items" id="' . $windowId . '">';
$windowId = $questionId.'_'.$lines_count;
$s .= '<li class="touch-items" id="'.$windowId.'">';
$s .= Display::div(
$parsed_answer,
[
@ -941,7 +941,7 @@ class ExerciseLib
Display::tag(
'b',
$select_items[$lines_count]['letter']
) . $select_items[$lines_count]['answer'],
).$select_items[$lines_count]['answer'],
[
'id' => "window_{$windowId}_answer",
'class' => 'hidden'
@ -1112,7 +1112,7 @@ HTML;
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$windowId = $questionId . '_' . $counterAnswer;
$windowId = $questionId.'_'.$counterAnswer;
if ($answerCorrect) {
$s .= $isVertical ? '<div class="row">' : '';
$s .= '
@ -1191,7 +1191,7 @@ HTML;
if ($answerType != HOT_SPOT_DELINEATION) {
$answerList = '
<div class="well well-sm">
<h5 class="page-header">' . get_lang('HotspotZones') . '</h5>
<h5 class="page-header">' . get_lang('HotspotZones').'</h5>
<ol>
';
@ -1226,7 +1226,7 @@ HTML;
</div>
</div>
<script>
new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion") . "({
new ".($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion")."({
questionId: $questionId,
exerciseId: $exerciseId,
selector: '#hotspot-preview-$questionId',
@ -1260,7 +1260,7 @@ HOTSPOT;
<div class=\"hotspot-image\"></div>
<script>
$(document).on('ready', function () {
new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion') . "({
new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion')."({
questionId: $questionId,
exerciseId: $exe_id,
selector: '#question_div_' + $questionId + ' .hotspot-image',
@ -1284,7 +1284,7 @@ HOTSPOT;
global $exe_id;
$relPath = api_get_path(WEB_CODE_PATH);
if (api_is_platform_admin() || api_is_course_admin()) {
$docId = DocumentManager::get_document_id($course, '/images/' . $pictureName);
$docId = DocumentManager::get_document_id($course, '/images/'.$pictureName);
if ($docId) {
$images_folder_visibility = api_get_item_visibility(
$course,
@ -1459,11 +1459,11 @@ HOTSPOT;
$lp_id = intval($lp_id);
$lp_item_id = intval($lp_item_id);
return
api_get_course_int_id() . '_' .
api_get_session_id() . '_' .
$exercise_id . '_' .
api_get_user_id() . '_' .
$lp_id . '_' .
api_get_course_int_id().'_'.
api_get_session_id().'_'.
$exercise_id.'_'.
api_get_user_id().'_'.
$lp_id.'_'.
$lp_item_id;
}
@ -1579,14 +1579,14 @@ HOTSPOT;
$res = Database::query($sql);
$result = array();
$apiIsAllowedToEdit = api_is_allowed_to_edit();
$urlBase = api_get_path(WEB_CODE_PATH) .
'exercise/hotpotatoes_exercise_report.php?action=delete&' .
api_get_cidreq() . '&id=';
$urlBase = api_get_path(WEB_CODE_PATH).
'exercise/hotpotatoes_exercise_report.php?action=delete&'.
api_get_cidreq().'&id=';
while ($data = Database::fetch_array($res)) {
$actions = null;
if ($apiIsAllowedToEdit) {
$url = $urlBase . $data['id'] . '&path=' . $data['exe_name'];
$url = $urlBase.$data['id'].'&path='.$data['exe_name'];
$actions = Display::url(
Display::return_icon('delete.png', get_lang('Delete')),
$url
@ -1602,7 +1602,7 @@ HOTSPOT;
GroupManager::get_user_group_name($data['user_id'])
),
'exe_date' => $data['exe_date'],
'score' => $data['exe_result'] . ' / ' . $data['exe_weighting'],
'score' => $data['exe_result'].' / '.$data['exe_weighting'],
'actions' => $actions,
);
}
@ -1685,18 +1685,18 @@ HOTSPOT;
$TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_TRACK_ATTEMPT_RECORDING = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$session_id_and = ' AND te.session_id = ' . $sessionId . ' ';
$session_id_and = ' AND te.session_id = '.$sessionId.' ';
$exercise_id = intval($exercise_id);
$exercise_where = '';
if (!empty($exercise_id)) {
$exercise_where .= ' AND te.exe_exo_id = ' . $exercise_id . ' ';
$exercise_where .= ' AND te.exe_exo_id = '.$exercise_id.' ';
}
$hotpotatoe_where = '';
if (!empty($_GET['path'])) {
$hotpotatoe_path = Database::escape_string($_GET['path']);
$hotpotatoe_where .= ' AND exe_name = "' . $hotpotatoe_path . '" ';
$hotpotatoe_where .= ' AND exe_name = "'.$hotpotatoe_path.'" ';
}
// sql for chamilo-type tests for teacher / tutor view
@ -1708,7 +1708,7 @@ HOTSPOT;
WHERE
c_id = $course_id AND
exe_exo_id = $exercise_id AND
ttte.session_id = " . $sessionId . "
ttte.session_id = ".$sessionId."
)";
if ($is_allowedToEdit) {
@ -1729,9 +1729,9 @@ HOTSPOT;
g.id as group_id
FROM $TBL_USER u
INNER JOIN $TBL_GROUP_REL_USER gru
ON (gru.user_id = u.user_id AND gru.c_id=" . $course_id . ")
ON (gru.user_id = u.user_id AND gru.c_id=".$course_id.")
INNER JOIN $TBL_GROUP g
ON (gru.group_id = g.id AND g.c_id=" . $course_id . ")
ON (gru.group_id = g.id AND g.c_id=".$course_id.")
)";
}
@ -1792,9 +1792,9 @@ HOTSPOT;
g.id as group_id
FROM $TBL_USER u
LEFT OUTER JOIN $TBL_GROUP_REL_USER gru
ON ( gru.user_id = u.user_id AND gru.c_id=" . $course_id . " )
ON ( gru.user_id = u.user_id AND gru.c_id=".$course_id." )
LEFT OUTER JOIN $TBL_GROUP g
ON (gru.group_id = g.id AND g.c_id = " . $course_id . ")
ON (gru.group_id = g.id AND g.c_id = ".$course_id.")
)";
}
@ -1806,12 +1806,12 @@ HOTSPOT;
(
SELECT u.user_id, firstname, lastname, email, username, ' ' as group_name, '' as group_id, official_code
FROM $TBL_USER u
WHERE u.status NOT IN(" . api_get_users_status_ignored_in_reports('string') . ")
WHERE u.status NOT IN(".api_get_users_status_ignored_in_reports('string').")
)";
}
$sqlFromOption = " , $TBL_GROUP_REL_USER AS gru ";
$sqlWhereOption = " AND gru.c_id = " . $course_id . " AND gru.user_id = user.user_id ";
$sqlWhereOption = " AND gru.c_id = ".$course_id." AND gru.user_id = user.user_id ";
$first_and_last_name = api_is_western_name_order() ? "firstname, lastname" : "lastname, firstname";
if ($get_count) {
@ -1849,9 +1849,9 @@ HOTSPOT;
INNER JOIN $sql_inner_join_tbl_user AS user
ON (user.user_id = exe_user_id)
WHERE
te.c_id = " . $course_id . " $session_id_and AND
te.c_id = ".$course_id." $session_id_and AND
ce.active <>-1 AND
ce.c_id = " . $course_id . "
ce.c_id = ".$course_id."
$exercise_where
$extra_where_conditions
";
@ -1877,10 +1877,10 @@ HOTSPOT;
$sqlFromOption
WHERE
user.user_id=tth.exe_user_id
AND tth.c_id = " . $course_id . "
AND tth.c_id = ".$course_id."
$hotpotatoe_where
$sqlWhereOption
AND user.status NOT IN(" . api_get_users_status_ignored_in_reports('string') . ")
AND user.status NOT IN(".api_get_users_status_ignored_in_reports('string').")
ORDER BY
tth.c_id ASC,
tth.exe_date DESC";
@ -1979,12 +1979,12 @@ HOTSPOT;
if ($from_gradebook && ($is_allowedToEdit)) {
if (in_array(
$results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'],
$results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'],
$users_array_id
)) {
continue;
}
$users_array_id[] = $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'];
$users_array_id[] = $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'];
}
$lp_obj = isset($results[$i]['orig_lp_id']) && isset($lp_list[$results[$i]['orig_lp_id']]) ? $lp_list[$results[$i]['orig_lp_id']] : null;
@ -1997,7 +1997,7 @@ HOTSPOT;
}
$lp_name = null;
if ($lp_obj) {
$url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq() . '&action=view&lp_id=' . $results[$i]['orig_lp_id'];
$url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$results[$i]['orig_lp_id'];
$lp_name = Display::url(
$lp_obj['lp_name'],
$url,
@ -2014,7 +2014,7 @@ HOTSPOT;
);
foreach ($group_list as $id) {
$group_name_list .= $clean_group_list[$id] . '<br/>';
$group_name_list .= $clean_group_list[$id].'<br/>';
}
$results[$i]['group_name'] = $group_name_list;
}
@ -2068,7 +2068,7 @@ HOTSPOT;
switch ($revised) {
case 0:
$actions .= "<a href='exercise_show.php?" . api_get_cidreq() . "&action=qualify&id=$id'>" .
$actions .= "<a href='exercise_show.php?".api_get_cidreq()."&action=qualify&id=$id'>".
Display:: return_icon(
'quiz.png',
get_lang('Qualify')
@ -2080,7 +2080,7 @@ HOTSPOT;
);
break;
case 1:
$actions .= "<a href='exercise_show.php?" . api_get_cidreq() . "&action=edit&id=$id'>" .
$actions .= "<a href='exercise_show.php?".api_get_cidreq()."&action=edit&id=$id'>".
Display:: return_icon(
'edit.png',
get_lang('Edit'),
@ -2100,7 +2100,7 @@ HOTSPOT;
. $exercise_id
. '&a=close&id='
. $id
. '">' .
. '">'.
Display:: return_icon(
'lock.png',
get_lang('MarkAttemptAsClosed'),
@ -2114,7 +2114,7 @@ HOTSPOT;
);
break;
case 3: //still ongoing
$actions .= "" .
$actions .= "".
Display:: return_icon(
'clock.png',
get_lang('AttemptStillOngoingPleaseWait'),
@ -2130,11 +2130,11 @@ HOTSPOT;
}
if ($filter == 2) {
$actions .= ' <a href="exercise_history.php?' . api_get_cidreq() . '&exe_id=' . $id . '">' .
$actions .= ' <a href="exercise_history.php?'.api_get_cidreq().'&exe_id='.$id.'">'.
Display:: return_icon(
'history.png',
get_lang('ViewHistoryChange')
) . '</a>';
).'</a>';
}
//Admin can always delete the attempt
@ -2144,13 +2144,13 @@ HOTSPOT;
api_get_utc_datetime(),
false
);
$actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank">'
$actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip='.$ip.'" target="_blank">'
. Display::return_icon('info.png', $ip)
.'</a>';
$recalculateUrl = api_get_path(WEB_CODE_PATH) . 'exercise/recalculate.php?' .
api_get_cidreq() . '&' .
$recalculateUrl = api_get_path(WEB_CODE_PATH).'exercise/recalculate.php?'.
api_get_cidreq().'&'.
http_build_query([
'id' => $id,
'exercise' => $exercise_id,
@ -2167,15 +2167,15 @@ HOTSPOT;
]
);
$delete_link = '<a href="exercise_report.php?' . api_get_cidreq() . '&filter_by_user=' . intval($_GET['filter_by_user']) . '&filter=' . $filter . '&exerciseId=' . $exercise_id . '&delete=delete&did=' . $id . '"
$delete_link = '<a href="exercise_report.php?'.api_get_cidreq().'&filter_by_user='.intval($_GET['filter_by_user']).'&filter='.$filter.'&exerciseId='.$exercise_id.'&delete=delete&did='.$id.'"
onclick="javascript:if(!confirm(\'' . sprintf(
get_lang('DeleteAttempt'),
$results[$i]['username'],
$dt
) . '\')) return false;">' . Display:: return_icon(
).'\')) return false;">'.Display:: return_icon(
'delete.png',
get_lang('Delete')
) . '</a>';
).'</a>';
$delete_link = utf8_encode($delete_link);
if (api_is_drh() && !api_is_platform_admin()) {
@ -2188,7 +2188,7 @@ HOTSPOT;
}
} else {
$attempt_url = api_get_path(WEB_CODE_PATH) . 'exercise/result.php?' . api_get_cidreq() . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId;
$attempt_url = api_get_path(WEB_CODE_PATH).'exercise/result.php?'.api_get_cidreq().'&id='.$results[$i]['exe_id'].'&id_session='.$sessionId;
$attempt_link = Display::url(
get_lang('Show'),
$attempt_url,
@ -2236,7 +2236,7 @@ HOTSPOT;
$hp_result = round(
($hpresults[$i][4] / ($hpresults[$i][5] != 0 ? $hpresults[$i][5] : 1)) * 100,
2
) . '% (' . $hpresults[$i][4] . ' / ' . $hpresults[$i][5] . ')';
).'% ('.$hpresults[$i][4].' / '.$hpresults[$i][5].')';
if ($is_allowedToEdit) {
$list_info[] = array(
$hpresults[$i][0],
@ -2310,13 +2310,13 @@ HOTSPOT;
$html = null;
if ($show_percentage) {
$parent = '(' . $score . ' / ' . $weight . ')';
$html = $percentage . "% $parent";
$parent = '('.$score.' / '.$weight.')';
$html = $percentage."% $parent";
if ($show_only_percentage) {
$html = $percentage . "% ";
$html = $percentage."% ";
}
} else {
$html = $score . ' / ' . $weight;
$html = $score.' / '.$weight;
}
$html = Display::span($html, array('class' => 'score_exercise'));
@ -2410,7 +2410,7 @@ HOTSPOT;
{
$return = '-';
if ($value != '') {
$return = float_format($value * 100, 1) . ' %';
$return = float_format($value * 100, 1).' %';
}
return $return;
}
@ -2489,7 +2489,7 @@ HOTSPOT;
}
$needle_where = !empty($search) ? " AND title LIKE '?' " : '';
$needle = !empty($search) ? "%" . $search . "%" : '';
$needle = !empty($search) ? "%".$search."%" : '';
// Show courses by active status
$active_sql = '';
@ -2504,7 +2504,7 @@ HOTSPOT;
if ($search_all_sessions == true) {
$conditions = array(
'where' => array(
$active_sql . ' c_id = ? ' . $needle_where . $time_conditions => array(
$active_sql.' c_id = ? '.$needle_where.$time_conditions => array(
$course_id,
$needle
)
@ -2515,7 +2515,7 @@ HOTSPOT;
if ($session_id == 0) {
$conditions = array(
'where' => array(
$active_sql . ' session_id = ? AND c_id = ? ' . $needle_where . $time_conditions => array(
$active_sql.' session_id = ? AND c_id = ? '.$needle_where.$time_conditions => array(
$session_id,
$course_id,
$needle
@ -2526,7 +2526,7 @@ HOTSPOT;
} else {
$conditions = array(
'where' => array(
$active_sql . ' (session_id = 0 OR session_id = ? ) AND c_id = ? ' . $needle_where . $time_conditions => array(
$active_sql.' (session_id = 0 OR session_id = ? ) AND c_id = ? '.$needle_where.$time_conditions => array(
$session_id,
$course_id,
$needle
@ -2705,7 +2705,7 @@ HOTSPOT;
if ($return_string) {
if (!empty($position) && !empty($my_ranking)) {
$return_value = $position . '/' . count($my_ranking);
$return_value = $position.'/'.count($my_ranking);
} else {
$return_value = '-';
}
@ -2786,7 +2786,7 @@ HOTSPOT;
if ($return_string) {
if (!empty($position) && !empty($my_ranking)) {
return $position . '/' . count($my_ranking);
return $position.'/'.count($my_ranking);
}
}
return $return_value;
@ -3181,7 +3181,7 @@ HOTSPOT;
$courseCondition = "
INNER JOIN $courseUser cu
ON cu.c_id = c.id AND cu.user_id = exe_user_id";
$courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT;
$courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT;
} else {
$courseCondition = "
INNER JOIN $courseUserSession cu
@ -3257,7 +3257,7 @@ HOTSPOT;
$courseCondition = "
INNER JOIN $courseUser cu
ON cu.c_id = c.id AND cu.user_id = exe_user_id";
$courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT;
$courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT;
} else {
$courseCondition = "
INNER JOIN $courseUserSession cu
@ -3345,7 +3345,7 @@ HOTSPOT;
$courseCondition = "
INNER JOIN $courseUser cu
ON cu.c_id = c.id AND cu.user_id = exe_user_id";
$courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT;
$courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT;
} else {
$courseCondition = "
INNER JOIN $courseUserSession cu
@ -3527,7 +3527,7 @@ HOTSPOT;
}
}
// adds the correct word, followed by ] to close the blank
$answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]';
$answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]';
if (isset ($real_text[$i + 1])) {
$answer .= $real_text[$i + 1];
}
@ -3583,13 +3583,13 @@ HOTSPOT;
// check the default value of option
$tabSelected = array($in_default => " selected='selected' ");
$res = "";
$res .= "<select name='$in_name' id='$in_name' onchange='" . $in_onchange . "' >";
$res .= "<option value='-1'" . $tabSelected["-1"] . ">-- " . get_lang(
$res .= "<select name='$in_name' id='$in_name' onchange='".$in_onchange."' >";
$res .= "<option value='-1'".$tabSelected["-1"].">-- ".get_lang(
'AllGroups'
) . " --</option>";
$res .= "<option value='0'" . $tabSelected["0"] . ">- " . get_lang(
)." --</option>";
$res .= "<option value='0'".$tabSelected["0"].">- ".get_lang(
'NotInAGroup'
) . " -</option>";
)." -</option>";
$tabGroups = GroupManager::get_group_list();
$currentCatId = 0;
for ($i = 0; $i < count($tabGroups); $i++) {
@ -3597,10 +3597,10 @@ HOTSPOT;
$tabGroups[$i]['iid']
);
if ($tabCategory["id"] != $currentCatId) {
$res .= "<option value='-1' disabled='disabled'>" . $tabCategory["title"] . "</option>";
$res .= "<option value='-1' disabled='disabled'>".$tabCategory["title"]."</option>";
$currentCatId = $tabCategory["id"];
}
$res .= "<option " . $tabSelected[$tabGroups[$i]["id"]] . "style='margin-left:40px' value='" . $tabGroups[$i]["id"] . "'>" . $tabGroups[$i]["name"] . "</option>";
$res .= "<option ".$tabSelected[$tabGroups[$i]["id"]]."style='margin-left:40px' value='".$tabGroups[$i]["id"]."'>".$tabGroups[$i]["name"]."</option>";
}
$res .= "</select>";
return $res;
@ -3864,14 +3864,14 @@ HOTSPOT;
if ($show_results) {
$comnt = Event::get_comments($exe_id, $questionId);
if (!empty($comnt)) {
echo '<b>' . get_lang('Feedback') . '</b>';
echo '<div id="question_feedback">' . $comnt . '</div>';
echo '<b>'.get_lang('Feedback').'</b>';
echo '<div id="question_feedback">'.$comnt.'</div>';
}
}
if ($show_results) {
$score = array(
'result' => get_lang('Score') . " : " . self::show_score(
'result' => get_lang('Score')." : ".self::show_score(
$my_total_score,
$my_total_weight,
false,
@ -3936,9 +3936,9 @@ HOTSPOT;
}
if ($show_all_but_expected_answer) {
$exercise_content .= "<div class='normal-message'>" . get_lang(
$exercise_content .= "<div class='normal-message'>".get_lang(
"ExerciseWithFeedbackWithoutCorrectionComment"
) . "</div>";
)."</div>";
}
// Remove audio auto play from questions on results page - refs BT#7939
$exercise_content = preg_replace(
@ -4041,11 +4041,11 @@ HOTSPOT;
$ribbon_total_success_or_error = ' ribbon-total-error';
}
}
$ribbon .= '<div class="total ' . $ribbon_total_success_or_error . '">';
$ribbon .= '<div class="total '.$ribbon_total_success_or_error.'">';
} else {
$ribbon .= '<div class="total">';
}
$ribbon .= '<h3>' . get_lang('YourTotalScore') . ":&nbsp;";
$ribbon .= '<h3>'.get_lang('YourTotalScore').":&nbsp;";
$ribbon .= self::show_score($score, $weight, false, true);
$ribbon .= '</h3>';
$ribbon .= '</div>';

@ -309,11 +309,11 @@ class ExerciseShowFunctions
}
}
$icon = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox';
$icon .= $studentChoice?'_on':'_off';
$icon = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio' : 'checkbox';
$icon .= $studentChoice ? '_on' : '_off';
$icon .= '.gif';
$iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox';
$iconAnswer .= $answerCorrect?'_on':'_off';
$iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio' : 'checkbox';
$iconAnswer .= $answerCorrect ? '_on' : '_off';
$iconAnswer .= '.gif';
?>

@ -9,11 +9,11 @@ require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
if (isset($_GET['messages_page_nr'])) {
if (api_get_setting('allow_social_tool')=='true' &&
api_get_setting('allow_message_tool')=='true'
if (api_get_setting('allow_social_tool') == 'true' &&
api_get_setting('allow_message_tool') == 'true'
) {
$social_link = '';
if ($_REQUEST['f']=='social') {
if ($_REQUEST['f'] == 'social') {
$social_link = '&f=social';
}
header('Location:outbox.php?pager='.Security::remove_XSS($_GET['messages_page_nr']).$social_link.'');
@ -51,41 +51,41 @@ function deselect_all(formita) {
*/
if (isset($_GET['f']) && $_GET['f'] === 'social') {
$this_section = SECTION_SOCIAL;
$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social'));
$interbreadcrumb[]= array ('url' => '#','name' => get_lang('Outbox'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_PATH).'main/social/home.php', 'name' => get_lang('Social'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Outbox'));
} else {
$this_section = SECTION_MYPROFILE;
$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile'));
$interbreadcrumb[]= array ('url' => '#','name' => get_lang('Outbox'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_PATH).'main/auth/profile.php', 'name' => get_lang('Profile'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Outbox'));
}
$actions = '';
if (api_get_setting('extended_profile') == 'true') {
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.
Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'</a>';
}
if (api_get_setting('allow_message_tool') == 'true') {
//echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Messages').'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('message_new.png',get_lang('ComposeMessage')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('inbox.png',get_lang('Inbox')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png',get_lang('Outbox')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('message_new.png', get_lang('ComposeMessage')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('inbox.png', get_lang('Inbox')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png', get_lang('Outbox')).'</a>';
}
}
$info_delete_outbox =array();
$info_delete_outbox = isset($_GET['form_delete_outbox']) ? explode(',',$_GET['form_delete_outbox']) : '';
$info_delete_outbox = array();
$info_delete_outbox = isset($_GET['form_delete_outbox']) ? explode(',', $_GET['form_delete_outbox']) : '';
$count_delete_outbox = count($info_delete_outbox) - 1;
if (isset($info_delete_outbox[0]) && trim($info_delete_outbox[0]) == 'delete') {
for ($i = 1; $i <= $count_delete_outbox; $i++) {
MessageManager::delete_message_by_user_sender(api_get_user_id(),$info_delete_outbox[$i]);
MessageManager::delete_message_by_user_sender(api_get_user_id(), $info_delete_outbox[$i]);
}
$message_box=get_lang('SelectedMessagesDeleted').
$message_box = get_lang('SelectedMessagesDeleted').
'&nbsp
<br><a href="../social/index.php?#remote-tab-3">'.
get_lang('BackToOutbox').
@ -117,23 +117,23 @@ if (api_get_setting('allow_social_tool') == 'true') {
}
//MAIN CONTENT
if ($action == 'delete') {
$delete_list_id=array();
$delete_list_id = array();
if (isset($_POST['out'])) {
$delete_list_id=$_POST['out'];
$delete_list_id = $_POST['out'];
}
if (isset($_POST['id'])) {
$delete_list_id=$_POST['id'];
$delete_list_id = $_POST['id'];
}
for ($i = 0; $i < count($delete_list_id); $i++) {
MessageManager::delete_message_by_user_sender(api_get_user_id(), $delete_list_id[$i]);
}
$delete_list_id=array();
$delete_list_id = array();
$social_right_content .= MessageManager::outbox_display($keyword);
} elseif ($action == 'deleteone') {
$delete_list_id = array();
$id = Security::remove_XSS($_GET['id']);
MessageManager::delete_message_by_user_sender(api_get_user_id(), $id);
$delete_list_id=array();
$delete_list_id = array();
$social_right_content .= MessageManager::outbox_display($keyword);
} else {
$social_right_content .= MessageManager::outbox_display($keyword);

@ -19,13 +19,13 @@ if ($_POST['StoreUserPermissions'] and $setting_visualisation == 'checkbox') {
}
}
if (isset($_GET['action'])) {
if ( isset($_GET['permission']) AND isset($_GET['tool']) AND ($_GET['action']=='grant' OR $_GET['action']=='revoke'))
if (isset($_GET['permission']) AND isset($_GET['tool']) AND ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke'))
{
$result_message=store_one_permission('user', $_GET['action'], $user_id, $_GET['tool'], $_GET['permission']);
$result_message = store_one_permission('user', $_GET['action'], $user_id, $_GET['tool'], $_GET['permission']);
}
if (isset($_GET['role']) AND ($_GET['action']=='grant' OR $_GET['action']=='revoke'))
if (isset($_GET['role']) AND ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke'))
{
$result_message=assign_role('user', $_GET['action'], $user_id, $_GET['role'], $_GET['scope']);
$result_message = assign_role('user', $_GET['action'], $user_id, $_GET['role'], $_GET['scope']);
}
}
@ -36,33 +36,33 @@ if (isset($result_message)) {
// ---------------------------------------------------
// RETRIEVING THE PERMISSIONS OF THE USER
// ---------------------------------------------------
$current_user_permissions=array();
$current_user_permissions=get_permissions('user',$user_id);
$current_user_permissions = array();
$current_user_permissions = get_permissions('user', $user_id);
// INHERITED PERMISSIONS (group permissions, user roles, group roles)
// RETRIEVING THE PERMISSIONS OF THE GROUPS OF THE USER
$groups_of_user=array();
$groups_of_user=GroupManager::get_group_ids($_course['real_id'],$user_id);
$groups_of_user = array();
$groups_of_user = GroupManager::get_group_ids($_course['real_id'], $user_id);
foreach ($groups_of_user as $group)
{
$this_group_permissions=get_permissions('group',$group);
$this_group_permissions = get_permissions('group', $group);
foreach ($this_group_permissions as $tool=>$permissions)
{
foreach ($permissions as $permission)
{
$inherited_group_permissions[$tool][]=$permission;
$inherited_group_permissions[$tool][] = $permission;
}
}
}
$inherited_permissions=$inherited_group_permissions;
$inherited_permissions = $inherited_group_permissions;
// RETRIEVING THE PERMISSIONS OF THE ROLES OF THE USER
if (api_get_setting('user_roles')=='true') {
if (api_get_setting('user_roles') == 'true') {
// course roles that are assigned to the user
$current_user_role_permissions_of_user=get_roles_permissions('user',$user_id);
$inherited_permissions=permission_array_merge($inherited_permissions,$current_user_role_permissions_of_user);
$current_user_role_permissions_of_user = get_roles_permissions('user', $user_id);
$inherited_permissions = permission_array_merge($inherited_permissions, $current_user_role_permissions_of_user);
// NOTE: deze array moet nog gemerged worden met de $inherited_permissions array
// (heet momenteel nog $current_group_permissions_of_user omdat voorlopig enkel de
// groepsge<EFBFBD>rfde permissions in beschouwing worden genomen
@ -72,41 +72,41 @@ if (api_get_setting('user_roles')=='true') {
// NOTE: checken als de rollen brol wel degelijk geactiveerd is voordat we dit allemaal
// ophalen.
// platform roles that are assigned to the user
$current_user_role_permissions_of_user=get_roles_permissions('user',$user_id, 'platform');
$inherited_permissions=permission_array_merge($inherited_permissions,$current_user_role_permissions_of_user);
$current_user_role_permissions_of_user = get_roles_permissions('user', $user_id, 'platform');
$inherited_permissions = permission_array_merge($inherited_permissions, $current_user_role_permissions_of_user);
}
// RETRIEVING THE PERMISSIONS OF THE ROLES OF THE GROUPS OF THE USER
if (api_get_setting('group_roles')=='true')
if (api_get_setting('group_roles') == 'true')
{
// NOTE: DIT MOET NOG VERDER UITGEWERKT WORDEN
foreach ($groups_of_user as $group)
{
$this_current_group_role_permissions_of_user=get_roles_permissions('user',$user_id);
$this_current_group_role_permissions_of_user = get_roles_permissions('user', $user_id);
//$inherited_permissions[$tool][]=$permission;
}
}
// LIMITED OR FULL
$current_user_permissions=limited_or_full($current_user_permissions);
$inherited_permissions=limited_or_full($inherited_permissions);
if (api_get_setting('permissions')=='limited')
$current_user_permissions = limited_or_full($current_user_permissions);
$inherited_permissions = limited_or_full($inherited_permissions);
if (api_get_setting('permissions') == 'limited')
{
$header_array=$rights_limited;
$header_array = $rights_limited;
}
if (api_get_setting('permissions')=='full')
if (api_get_setting('permissions') == 'full')
{
$header_array=$rights_full;
$header_array = $rights_full;
}
echo "<form method=\"post\" action=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."\">";
// DISPLAYING THE ROLES LIST
if (api_get_setting('user_roles')=='true')
if (api_get_setting('user_roles') == 'true')
{
// the list of the roles for the user
echo '<strong>'.get_lang('UserRoles').'</strong><br />';
$current_user_course_roles=get_roles('user',$user_id);
$current_user_platform_roles=get_roles('user',$user_id, 'platform');
$current_user_course_roles = get_roles('user', $user_id);
$current_user_platform_roles = get_roles('user', $user_id, 'platform');
display_role_list($current_user_course_roles, $current_user_platform_roles);
echo '<br />';
}
@ -134,8 +134,8 @@ foreach ($tool_rights as $tool => $rights) {
if (strstr($tool, 'BLOG')) {
// Not dealing with a real tool here, get name of this blog
// Strip blog id
$tmp = strpos($tool,'_')+1;
$blog_id = substr($tool,$tmp,strlen($tool));
$tmp = strpos($tool, '_') + 1;
$blog_id = substr($tool, $tmp, strlen($tool));
// Get title
echo get_lang('Blog').": ".Blog::getBlogTitle($blog_id);
} else {
@ -176,7 +176,7 @@ foreach ($tool_rights as $tool => $rights) {
}
echo "</table>\n";
if ($setting_visualisation=='checkbox') {
if ($setting_visualisation == 'checkbox') {
echo "<input type=\"Submit\" name=\"StoreUserPermissions\" value=\"".get_lang('StorePermissions')."\">";
}
echo "</form><br />";

@ -314,19 +314,19 @@ class SurveyUtil
// Actions bar
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'.
Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>';
if (isset($_GET['user'])) {
if (api_is_allowed_to_edit()) {
// The delete link
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=deleteuserreport&survey_id='.$surveyId.'&'.api_get_cidreq().'&user='.Security::remove_XSS($_GET['user']).'" >'.
Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_MEDIUM).'</a>';
}
// Export the user report
echo '<a href="javascript: void(0);" onclick="document.form1a.submit();">'.
Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> ';
Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> ';
echo '<a href="javascript: void(0);" onclick="document.form1b.submit();">'.
Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> ';
Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> ';
echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'&user_id='.Security::remove_XSS($_GET['user']).'">';
echo '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="csv">';
@ -360,7 +360,7 @@ class SurveyUtil
$name = $person['invited_user'];
}
} else {
$name = get_lang('Anonymous') . ' ' . ($key + 1);
$name = get_lang('Anonymous').' '.($key + 1);
$id = $person;
}
echo '<option value="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&user='.Security::remove_XSS($id).'" ';
@ -502,7 +502,7 @@ class SurveyUtil
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'">'.
Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
if ($survey_data['number_of_questions'] > 0) {
@ -510,18 +510,18 @@ class SurveyUtil
if (!$singlePage) {
echo '<div id="question_report_questionnumbers" class="pagination">';
if ($currentQuestion != 0) {
echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($offset - 1) . '">' . get_lang('PreviousQuestion') . '</a></li>';
echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&'.api_get_cidreq().'&survey_id='.$surveyId.'&question='.($offset - 1).'">'.get_lang('PreviousQuestion').'</a></li>';
}
for ($i = 1; $i <= $survey_data['number_of_questions']; $i++) {
if ($offset != $i - 1) {
echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($i - 1) . '">' . $i . '</a></li>';
echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&'.api_get_cidreq().'&survey_id='.$surveyId.'&question='.($i - 1).'">'.$i.'</a></li>';
} else {
echo '<li class="disabled"s><a href="#">' . $i . '</a></li>';
echo '<li class="disabled"s><a href="#">'.$i.'</a></li>';
}
}
if ($currentQuestion < ($survey_data['number_of_questions'] - 1)) {
echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($offset + 1) . '">' . get_lang('NextQuestion') . '</li></a>';
echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&'.api_get_cidreq().'&survey_id='.$surveyId.'&question='.($offset + 1).'">'.get_lang('NextQuestion').'</li></a>';
}
echo '</ul>';
echo '</div>';
@ -559,19 +559,19 @@ class SurveyUtil
$sql = "SELECT * FROM $table_survey_answer
WHERE
c_id = $course_id AND
survey_id='" . intval($_GET['survey_id']) . "' AND
question_id = '" . intval($question['question_id']) . "'";
survey_id='".intval($_GET['survey_id'])."' AND
question_id = '" . intval($question['question_id'])."'";
$result = Database::query($sql);
while ($row = Database::fetch_array($result, 'ASSOC')) {
echo $row['option_id'] . '<hr noshade="noshade" size="1" />';
echo $row['option_id'].'<hr noshade="noshade" size="1" />';
}
} else {
// Getting the options ORDER BY sort ASC
$sql = "SELECT * FROM $table_survey_question_option
WHERE
c_id = $course_id AND
survey_id='" . intval($_GET['survey_id']) . "'
AND question_id = '" . intval($question['question_id']) . "'
survey_id='".intval($_GET['survey_id'])."'
AND question_id = '" . intval($question['question_id'])."'
ORDER BY sort ASC";
$result = Database::query($sql);
while ($row = Database::fetch_array($result, 'ASSOC')) {
@ -581,8 +581,8 @@ class SurveyUtil
$sql = "SELECT *, count(answer_id) as total FROM $table_survey_answer
WHERE
c_id = $course_id AND
survey_id='" . intval($_GET['survey_id']) . "'
AND question_id = '" . intval($question['question_id']) . "'
survey_id='".intval($_GET['survey_id'])."'
AND question_id = '" . intval($question['question_id'])."'
GROUP BY option_id, value";
$result = Database::query($sql);
$number_of_answers = array();
@ -599,8 +599,7 @@ class SurveyUtil
$optionText = strip_tags($option['option_text']);
$optionText = html_entity_decode($optionText);
$votes = isset($data[$option['question_option_id']]['total']) ?
$data[$option['question_option_id']]['total'] :
'0';
$data[$option['question_option_id']]['total'] : '0';
array_push($chartData, array('option' => $optionText, 'votes' => $votes));
}
$chartContainerId = 'chartContainer'.$question['question_id'];
@ -612,9 +611,9 @@ class SurveyUtil
echo '<table class="display-survey table">';
echo ' <tr>';
echo ' <th>&nbsp;</th>';
echo ' <th>' . get_lang('AbsoluteTotal') . '</th>';
echo ' <th>' . get_lang('Percentage') . '</th>';
echo ' <th>' . get_lang('VisualRepresentation') . '</th>';
echo ' <th>'.get_lang('AbsoluteTotal').'</th>';
echo ' <th>'.get_lang('Percentage').'</th>';
echo ' <th>'.get_lang('VisualRepresentation').'</th>';
echo ' <tr>';
// Displaying the table: the content
@ -634,22 +633,22 @@ class SurveyUtil
$answers_number = $absolute_number / $number_of_answers[$option['question_id']] * 100;
}
echo ' <tr>';
echo ' <td class="center">' . $value['option_text'] . '</td>';
echo ' <td class="center">'.$value['option_text'].'</td>';
echo ' <td class="center">';
if ($absolute_number != 0) {
echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&survey_id=' . $surveyId . '&question=' . $offset . '&viewoption=' . $value['question_option_id'] . '">' . $absolute_number . '</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&survey_id='.$surveyId.'&question='.$offset.'&viewoption='.$value['question_option_id'].'">'.$absolute_number.'</a>';
} else {
echo '0';
}
echo ' </td>';
echo ' <td class="center">' . round($answers_number, 2) . ' %</td>';
echo ' <td class="center">'.round($answers_number, 2).' %</td>';
echo ' <td class="center">';
$size = $answers_number * 2;
if ($size > 0) {
echo '<div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:' . $size . 'px">&nbsp;</div>';
echo '<div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:'.$size.'px">&nbsp;</div>';
} else {
echo '<div style="text-align: left;">' . get_lang("NoDataAvailable") . '</div>';
echo '<div style="text-align: left;">'.get_lang("NoDataAvailable").'</div>';
}
echo ' </td>';
echo ' </tr>';
@ -657,8 +656,8 @@ class SurveyUtil
}
// displaying the table: footer (totals)
echo ' <tr>';
echo ' <td class="total"><b>' . get_lang('Total') . '</b></td>';
echo ' <td class="total"><b>' . ($number_of_answers[$option['question_id']] == 0 ? '0' : $number_of_answers[$option['question_id']]) . '</b></td>';
echo ' <td class="total"><b>'.get_lang('Total').'</b></td>';
echo ' <td class="total"><b>'.($number_of_answers[$option['question_id']] == 0 ? '0' : $number_of_answers[$option['question_id']]).'</b></td>';
echo ' <td class="total">&nbsp;</td>';
echo ' <td class="total">&nbsp;</td>';
echo ' </tr>';
@ -774,9 +773,9 @@ class SurveyUtil
echo ' <td>'.$value['option_text'].'</td>';
echo ' <td>'.$i.'</td>';
echo ' <td><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&question='.Security::remove_XSS($offset).'&viewoption='.$value['question_option_id'].'&value='.$i.'">'.$absolute_number.'</a></td>';
echo ' <td>'.round($absolute_number/$number_of_answers*100, 2).' %</td>';
echo ' <td>'.round($absolute_number / $number_of_answers * 100, 2).' %</td>';
echo ' <td>';
$size = ($absolute_number/$number_of_answers*100*2);
$size = ($absolute_number / $number_of_answers * 100 * 2);
if ($size > 0) {
echo ' <div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:'.$size.'px">&nbsp;</div>';
}
@ -816,11 +815,11 @@ class SurveyUtil
// Actions bar
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'">
'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>';
'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1a.submit();">
'.Display::return_icon('export_csv.png',get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>';
'.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1b.submit();">
'.Display::return_icon('export_excel.png',get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a>';
'.Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
// The form
@ -855,8 +854,8 @@ class SurveyUtil
// Show user fields section with a big th colspan that spans over all fields
$extra_user_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', false, true);
$num = count($extra_user_fields);
if ($num > 0 ) {
echo '<th '.($num>0?' colspan="'.$num.'"':'').'>';
if ($num > 0) {
echo '<th '.($num > 0 ? ' colspan="'.$num.'"' : '').'>';
echo '<label><input type="checkbox" name="fields_filter" value="1" checked="checked"/> ';
echo get_lang('UserFields');
echo '</label>';
@ -912,7 +911,7 @@ class SurveyUtil
if (!(isset($_POST['submit_question_filter']) && $_POST['submit_question_filter'] ||
isset($_POST['export_report']) && $_POST['export_report']) || !empty($_POST['fields_filter'])) {
//show the fields names for user fields
foreach($extra_user_fields as & $field) {
foreach ($extra_user_fields as & $field) {
echo '<th>'.$field[3].'</th>';
}
}
@ -994,7 +993,7 @@ class SurveyUtil
$questions,
$display_extra_user_fields
);
$answers_of_user=array();
$answers_of_user = array();
}
if (isset($questions[$row['question_id']]) && $questions[$row['question_id']]['type'] != 'open') {
$answers_of_user[$row['question_id']][$row['option_id']] = $row;
@ -1056,7 +1055,7 @@ class SurveyUtil
echo '<th>'.$user.'</th>'; // the user column
}
} else {
echo '<th>' . get_lang('Anonymous') . ' ' . $user . '</th>';
echo '<th>'.get_lang('Anonymous').' '.$user.'</th>';
}
if ($display_extra_user_fields) {
@ -1159,10 +1158,10 @@ class SurveyUtil
// We do not show comment and pagebreak question types
if ($row['type'] != 'comment' && $row['type'] != 'pagebreak') {
if ($row['number_of_options'] == 0 && $row['type'] == 'open') {
$return .= str_replace("\r\n",' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';';
$return .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';';
} else {
for ($ii = 0; $ii < $row['number_of_options']; $ii++) {
$return .= str_replace("\r\n",' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';';
$return .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';';
}
}
}
@ -1176,7 +1175,7 @@ class SurveyUtil
// Show the fields names for user fields
if (!empty($extra_user_fields)) {
foreach ($extra_user_fields as & $field) {
$return .= '"'.str_replace("\r\n",' ',api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES)).'";';
$return .= '"'.str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES)).'";';
}
}
@ -1212,7 +1211,7 @@ class SurveyUtil
) {
// We do not show comment and pagebreak question types
if ($row['type'] != 'comment' && $row['type'] != 'pagebreak') {
$row['option_text'] = str_replace(array("\r","\n"),array('',''),$row['option_text']);
$row['option_text'] = str_replace(array("\r", "\n"), array('', ''), $row['option_text']);
$return .= api_html_entity_decode(strip_tags($row['option_text']), ENT_QUOTES).';';
$possible_answers[$row['question_id']][$row['question_option_id']] = $row['question_option_id'];
$possible_answers_type[$row['question_id']] = $row['type'];
@ -1242,9 +1241,9 @@ class SurveyUtil
$old_user,
true
);
$answers_of_user=array();
$answers_of_user = array();
}
if($possible_answers_type[$row['question_id']] == 'open') {
if ($possible_answers_type[$row['question_id']] == 'open') {
$temp_id = 'open'.$open_question_iterator;
$answers_of_user[$row['question_id']][$temp_id] = $row;
$open_question_iterator++;
@ -1430,7 +1429,7 @@ class SurveyUtil
);
$column++;
} else {
for ($ii = 0; $ii < $row['number_of_options']; $ii ++) {
for ($ii = 0; $ii < $row['number_of_options']; $ii++) {
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
@ -1511,7 +1510,7 @@ class SurveyUtil
}
// Getting all the answers of the users
$line ++;
$line++;
$column = 0;
$old_user = '';
$answers_of_user = array();
@ -1520,7 +1519,7 @@ class SurveyUtil
if ($user_id != 0) {
$sql .= " AND user='".intval($user_id)."' ";
}
$sql .= " ORDER BY user ASC";
$sql .= " ORDER BY user ASC";
$open_question_iterator = 1;
$result = Database::query($sql);
@ -1675,7 +1674,7 @@ class SurveyUtil
// Actions bar
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
// Displaying an information message that only the questions with predefined answers can be used in a comparative report
@ -1739,17 +1738,17 @@ class SurveyUtil
$tableHtml .= '<tr>';
for ($ii = 0; $ii <= count($question_x['answers']); $ii++) {
if ($ii == 0) {
$tableHtml .= '<th>&nbsp;</th>';
$tableHtml .= '<th>&nbsp;</th>';
} else {
if ($question_x['type'] == 'score') {
for ($x = 1; $x <= $question_x['maximum_score']; $x++) {
$tableHtml .= '<th>'.$question_x['answers'][($ii-1)].'<br />'.$x.'</th>';
$tableHtml .= '<th>'.$question_x['answers'][($ii - 1)].'<br />'.$x.'</th>';
}
$x = '';
} else {
$tableHtml .= '<th>'.$question_x['answers'][($ii-1)].'</th>';
$tableHtml .= '<th>'.$question_x['answers'][($ii - 1)].'</th>';
}
$optionText = strip_tags($question_x['answers'][$ii-1]);
$optionText = strip_tags($question_x['answers'][$ii - 1]);
$optionText = html_entity_decode($optionText);
array_push($xOptions, trim($optionText));
}
@ -1764,15 +1763,15 @@ class SurveyUtil
// The Y axis is a scoring question type so we have more rows than the options (actually options * maximum score)
if ($question_y['type'] == 'score') {
for ($y = 1; $y <= $question_y['maximum_score']; $y++) {
$tableHtml .= '<tr>';
$tableHtml .= '<tr>';
for ($ii = 0; $ii <= count($question_x['answers']); $ii++) {
if ($question_x['type'] == 'score') {
for ($x = 1; $x <= $question_x['maximum_score']; $x++) {
if ($ii == 0) {
$tableHtml .= '<th>'.$question_y['answers'][($ij)].' '.$y.'</th>';
$tableHtml .= '<th>'.$question_y['answers'][($ij)].' '.$y.'</th>';
break;
} else {
$tableHtml .= '<td align="center">';
$tableHtml .= '<td align="center">';
$votes = self::comparative_check(
$answers_x,
$answers_y,
@ -1781,16 +1780,16 @@ class SurveyUtil
$x,
$y
);
$tableHtml .= $votes;
$tableHtml .= $votes;
array_push(
$chartData,
array(
'serie' => array($currentYQuestion, $xOptions[$ii-1]),
'serie' => array($currentYQuestion, $xOptions[$ii - 1]),
'option' => $x,
'votes' => $votes
)
);
$tableHtml .= '</td>';
$tableHtml .= '</td>';
}
}
} else {
@ -1810,33 +1809,33 @@ class SurveyUtil
array_push(
$chartData,
array(
'serie' => array($currentYQuestion, $xOptions[$ii-1]),
'serie' => array($currentYQuestion, $xOptions[$ii - 1]),
'option' => $y,
'votes' => $votes
)
);
$tableHtml .= '</td>';
$tableHtml .= '</td>';
}
}
}
$tableHtml .= '</tr>';
$tableHtml .= '</tr>';
}
}
// The Y axis is NOT a score question type so the number of rows = the number of options
else {
$tableHtml .= '<tr>';
$tableHtml .= '<tr>';
for ($ii = 0; $ii <= count($question_x['answers']); $ii++) {
if ($question_x['type'] == 'score') {
for ($x = 1; $x <= $question_x['maximum_score']; $x++) {
if ($ii == 0) {
$tableHtml .= '<th>'.$question_y['answers'][$ij].'</th>';
$tableHtml .= '<th>'.$question_y['answers'][$ij].'</th>';
break;
} else {
$tableHtml .= '<td align="center">';
$votes = self::comparative_check(
$tableHtml .= '<td align="center">';
$votes = self::comparative_check(
$answers_x,
$answers_y,
$question_x['answersid'][($ii-1)],
$question_x['answersid'][($ii - 1)],
$question_y['answersid'][($ij)],
$x,
0
@ -1845,25 +1844,25 @@ class SurveyUtil
array_push(
$chartData,
array(
'serie' => array($currentYQuestion, $xOptions[$ii-1]),
'serie' => array($currentYQuestion, $xOptions[$ii - 1]),
'option' => $x,
'votes' => $votes
)
);
$tableHtml .= '</td>';
$tableHtml .= '</td>';
}
}
} else {
if ($ii == 0) {
$tableHtml .= '<th>'.$question_y['answers'][($ij)].'</th>';
$tableHtml .= '<th>'.$question_y['answers'][($ij)].'</th>';
} else {
$tableHtml .= '<td align="center">';
$votes = self::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)]);
$tableHtml .= '<td align="center">';
$votes = self::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii - 1)], $question_y['answersid'][($ij)]);
$tableHtml .= $votes;
array_push(
$chartData,
array(
'serie' => $xOptions[$ii-1],
'serie' => $xOptions[$ii - 1],
'option' => $currentYQuestion,
'votes' => $votes
)
@ -1875,7 +1874,7 @@ class SurveyUtil
$tableHtml .= '</tr>';
}
}
$tableHtml .= '</table>';
$tableHtml .= '</table>';
echo '<div id="chartContainer" class="col-md-12">';
echo self::drawChart($chartData, true);
echo '</div>';
@ -2024,7 +2023,7 @@ class SurveyUtil
survey_id='".intval($_GET['survey_id'])."' AND
session_id='".api_get_session_id()."' ";
$res = Database::query($sql);
$row = Database::fetch_array($res,'ASSOC');
$row = Database::fetch_array($res, 'ASSOC');
return $row['total'];
}
@ -2104,7 +2103,7 @@ class SurveyUtil
$exclude_users = SurveyManager::get_people_who_filled_survey($_GET['survey_id']);
}
$counter = 0; // Nr of invitations "sent" (if sendmail option)
$counter = 0; // Nr of invitations "sent" (if sendmail option)
$course_id = api_get_course_int_id();
$session_id = api_get_session_id();
@ -2264,7 +2263,7 @@ class SurveyUtil
$text_link = '<a href="'.$survey_link.'">'.get_lang('ClickHereToAnswerTheSurvey')."</a><br />\r\n<br />\r\n".get_lang('OrCopyPasteTheFollowingUrl')." <br />\r\n ".$survey_link;
$replace_count = 0;
$full_invitation_text = api_str_ireplace('**link**', $text_link ,$invitation_text, $replace_count);
$full_invitation_text = api_str_ireplace('**link**', $text_link, $invitation_text, $replace_count);
if ($replace_count < 1) {
$full_invitation_text = $full_invitation_text."<br />\r\n<br />\r\n".$text_link;
}
@ -2570,7 +2569,7 @@ class SurveyUtil
public static function display_survey_list_for_coach()
{
$parameters = array();
$parameters['cidReq']=api_get_course_id();
$parameters['cidReq'] = api_get_course_id();
if (isset($_GET['do_search'])) {
$message = get_lang('DisplaySearchResults').'<br />';
$message .= '<a href="'.api_get_self().'?'.api_get_cidreq().'">'.get_lang('DisplayAll').'</a>';
@ -2619,17 +2618,17 @@ class SurveyUtil
if ($drh) {
return '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.
Display::return_icon('stats.png', get_lang('Reporting'),'',ICON_SIZE_SMALL).'</a>';
Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL).'</a>';
}
// Coach can see that only if the survey is in his session
if (api_is_allowed_to_edit() ||
api_is_element_in_the_session(TOOL_SURVEY, $survey_id)
) {
$return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_new_survey.php?'.api_get_cidreq().'&action=edit&survey_id='.$survey_id.'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
$return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_new_survey.php?'.api_get_cidreq().'&action=edit&survey_id='.$survey_id.'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
if (SurveyManager::survey_generation_hash_available()) {
$return .= Display::url(
Display::return_icon('new_link.png', get_lang('GenerateSurveyAccessLink'),'',ICON_SIZE_SMALL),
$return .= Display::url(
Display::return_icon('new_link.png', get_lang('GenerateSurveyAccessLink'), '', ICON_SIZE_SMALL),
api_get_path(WEB_CODE_PATH).'survey/generate_link.php?survey_id='.$survey_id.'&'.api_get_cidreq()
);
}
@ -2639,20 +2638,20 @@ class SurveyUtil
);
$return .= ' <a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=empty&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?')).'\')) return false;">'.
Display::return_icon('clean.png', get_lang('EmptySurvey'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
Display::return_icon('clean.png', get_lang('EmptySurvey'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
}
$return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.
Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
$return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.
Display::return_icon('mail_send.png', get_lang('Publish'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
$return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.
Display::return_icon('stats.png', get_lang('Reporting'),'',ICON_SIZE_SMALL).'</a>';
Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL).'</a>';
if (api_is_allowed_to_edit() ||
api_is_element_in_the_session(TOOL_SURVEY, $survey_id)
) {
$return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=delete&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurvey").'?', ENT_QUOTES)).'\')) return false;">'.
Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
}
return $return;
@ -2665,9 +2664,9 @@ class SurveyUtil
//$return .= '<a href="survey_list.php?'.api_get_cidreq().'&action=delete&survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurvey").'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
//$return .= '<a href="create_survey_in_another_language.php?id_survey='.$survey_id.'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>';
//$return .= '<a href="survey.php?survey_id='.$survey_id.'">'.Display::return_icon('add.gif', get_lang('Add')).'</a>';
$return = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
$return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('mail_send.png', get_lang('Publish'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
$return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=empty&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('clean.png', get_lang('EmptySurvey'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
$return = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
$return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
$return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=empty&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('clean.png', get_lang('EmptySurvey'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
return $return;
}
@ -2825,7 +2824,7 @@ class SurveyUtil
// Validation when belonging to a session
$session_img = api_get_session_image($survey['session_id'], $_user['status']);
$array[2] = $survey[2] . $session_img;
$array[2] = $survey[2].$session_img;
$array[3] = $survey[3];
$array[4] = $survey[4];
$array[5] = $survey[5];
@ -2870,7 +2869,7 @@ class SurveyUtil
$list[] = $survey['id'];
}
if (count($list) > 0) {
$list_condition = " AND survey.survey_id IN (".implode(',',$list).") ";
$list_condition = " AND survey.survey_id IN (".implode(',', $list).") ";
} else {
$list_condition = '';
}
@ -2978,7 +2977,7 @@ class SurveyUtil
echo '<tr>';
if ($row['answered'] == 0) {
echo '<td>';
echo Display::return_icon('statistics.png', get_lang('CreateNewSurvey'), array(),ICON_SIZE_TINY);
echo Display::return_icon('statistics.png', get_lang('CreateNewSurvey'), array(), ICON_SIZE_TINY);
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/fillsurvey.php?course='.$_course['sysCode'].'&invitationcode='.$row['invitation_code'].'&cidReq='.$_course['sysCode'].'">'.$row['title'].'</a></td>';
} else {
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh($user_id, $_course);
@ -3143,7 +3142,7 @@ class SurveyUtil
if ($field_details[7] == 0) {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 0;
} else {
$field_list_array['extra_'.$field_details[1]]['visibility']=1;
$field_list_array['extra_'.$field_details[1]]['visibility'] = 1;
}
break;
case UserManager::USER_FIELD_TYPE_DIVIDER:
@ -3229,7 +3228,7 @@ class SurveyUtil
$htmlChart = '';
if (api_browser_support("svg")) {
$htmlChart .= api_get_js("d3/d3.v3.5.4.min.js");
$htmlChart .= api_get_js("dimple.v2.1.2.min.js") . '
$htmlChart .= api_get_js("dimple.v2.1.2.min.js").'
<script type="text/javascript">
var svg = dimple.newSvg("#'.$chartContainerId.'", "100%", 400);
var data = [';
@ -3238,40 +3237,40 @@ class SurveyUtil
foreach ($chartData as $chartDataElement) {
$htmlChart .= '{"';
if (!$hasSerie) {
$htmlChart .= get_lang("Option") . '":"' . $chartDataElement['option'] . '", "';
$htmlChart .= get_lang("Option").'":"'.$chartDataElement['option'].'", "';
array_push($order, $chartDataElement['option']);
} else {
if (!is_array($chartDataElement['serie'])) {
$htmlChart .= get_lang("Option") . '":"' . $chartDataElement['serie'] . '", "' .
get_lang("Score") . '":"' . $chartDataElement['option'] . '", "';
$htmlChart .= get_lang("Option").'":"'.$chartDataElement['serie'].'", "'.
get_lang("Score").'":"'.$chartDataElement['option'].'", "';
array_push($serie, $chartDataElement['serie']);
} else {
$htmlChart .= get_lang("Serie") . '":"' . $chartDataElement['serie'][0] . '", "' .
get_lang("Option") . '":"' . $chartDataElement['serie'][1] . '", "' .
get_lang("Score") . '":"' . $chartDataElement['option'] . '", "';
$htmlChart .= get_lang("Serie").'":"'.$chartDataElement['serie'][0].'", "'.
get_lang("Option").'":"'.$chartDataElement['serie'][1].'", "'.
get_lang("Score").'":"'.$chartDataElement['option'].'", "';
}
}
$htmlChart .= get_lang("Votes") . '":"' . $chartDataElement['votes'] .
$htmlChart .= get_lang("Votes").'":"'.$chartDataElement['votes'].
'"},';
}
rtrim($htmlChart, ",");
$htmlChart .= '];
var myChart = new dimple.chart(svg, data);
myChart.addMeasureAxis("y", "' . get_lang("Votes") . '");';
myChart.addMeasureAxis("y", "' . get_lang("Votes").'");';
if (!$hasSerie) {
$htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", "' . get_lang("Option") . '");
xAxisCategory.addOrderRule(' . json_encode($order) . ');
myChart.addSeries("' . get_lang("Option") . '", dimple.plot.bar);';
$htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", "'.get_lang("Option").'");
xAxisCategory.addOrderRule(' . json_encode($order).');
myChart.addSeries("' . get_lang("Option").'", dimple.plot.bar);';
} else {
if (!is_array($chartDataElement['serie'])) {
$serie = array_values(array_unique($serie));
$htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", ["' . get_lang("Option") . '","' . get_lang("Score") . '"]);
xAxisCategory.addOrderRule(' . json_encode($serie) . ');
xAxisCategory.addGroupOrderRule("' . get_lang("Score") . '");
myChart.addSeries("' . get_lang("Option") . '", dimple.plot.bar);';
$htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", ["'.get_lang("Option").'","'.get_lang("Score").'"]);
xAxisCategory.addOrderRule(' . json_encode($serie).');
xAxisCategory.addGroupOrderRule("' . get_lang("Score").'");
myChart.addSeries("' . get_lang("Option").'", dimple.plot.bar);';
} else {
$htmlChart .= 'myChart.addCategoryAxis("x", ["' . get_lang("Option") . '","' . get_lang("Score") . '"]);
myChart.addSeries("' . get_lang("Serie") . '", dimple.plot.bar);';
$htmlChart .= 'myChart.addCategoryAxis("x", ["'.get_lang("Option").'","'.get_lang("Score").'"]);
myChart.addSeries("' . get_lang("Serie").'", dimple.plot.bar);';
}
}
$htmlChart .= 'myChart.draw();

@ -104,7 +104,7 @@ class WSCMUser extends WSCM
if ($this->verifyUserPass($username, $password) == "valid") {
$user_id = UserManager::get_user_id_from_username($username);
$message_title = get_lang('Invitation');
$count_is_true = SocialManager::send_invitation_friend($user_id,$userfriend_id, $message_title, $content_message);
$count_is_true = SocialManager::send_invitation_friend($user_id, $userfriend_id, $message_title, $content_message);
if ($count_is_true) {
return Display::return_message(

@ -5,12 +5,12 @@
function validate_data($users)
{
global $defined_auth_sources;
$errors = array ();
$errors = array();
$usernames = array();
if (is_array($users)) {
foreach ($users as $index => $user) {
// 1. Check whether mandatory fields have been set.
$mandatory_fields = array ('LastName', 'FirstName');
$mandatory_fields = array('LastName', 'FirstName');
if (api_get_setting('registration', 'email') == 'true') {
$mandatory_fields[] = 'Email';
}

@ -39,16 +39,16 @@ class Finder extends \elFinder
set_error_handler('elFinder::phpErrorHandler', $errLevel);
// convert PATH_INFO to GET query
if (! empty($_SERVER['PATH_INFO'])) {
if (!empty($_SERVER['PATH_INFO'])) {
$_ps = explode('/', trim($_SERVER['PATH_INFO'], '/'));
if (! isset($_GET['cmd'])) {
if (!isset($_GET['cmd'])) {
$_cmd = $_ps[0];
if (isset($this->commands[$_cmd])) {
$_GET['cmd'] = $_cmd;
$_i = 1;
foreach(array_keys($this->commands[$_cmd]) as $_k) {
foreach (array_keys($this->commands[$_cmd]) as $_k) {
if (isset($_ps[$_i])) {
if (! isset($_GET[$_k])) {
if (!isset($_GET[$_k])) {
$_GET[$_k] = $_ps[$_i];
}
} else {
@ -65,11 +65,11 @@ class Finder extends \elFinder
// setup debug mode
$this->debug = (isset($opts['debug']) && $opts['debug'] ? true : false);
if ($this->debug) {
error_reporting(defined('ELFINDER_DEBUG_ERRORLEVEL')? ELFINDER_DEBUG_ERRORLEVEL : -1);
error_reporting(defined('ELFINDER_DEBUG_ERRORLEVEL') ? ELFINDER_DEBUG_ERRORLEVEL : -1);
ini_set('diaplay_errors', '1');
}
if (! interface_exists('elFinderSessionInterface')) {
if (!interface_exists('elFinderSessionInterface')) {
include_once __DIR__.'/elFinderSessionInterface.php';
}
@ -81,10 +81,10 @@ class Finder extends \elFinder
'base64encode' => !empty($opts['base64encodeSessionData']),
'keys' => array(
'default' => !empty($opts['sessionCacheKey']) ? $opts['sessionCacheKey'] : 'elFinderCaches',
'netvolume' => !empty($opts['netVolumesSessionKey'])? $opts['netVolumesSessionKey'] : 'elFinderNetVolumes'
'netvolume' => !empty($opts['netVolumesSessionKey']) ? $opts['netVolumesSessionKey'] : 'elFinderNetVolumes'
)
);
if (! class_exists('elFinderSession')) {
if (!class_exists('elFinderSession')) {
include_once __DIR__.'/elFinderSession.php';
}
$this->session = new elFinderSession($sessionOpts);
@ -102,8 +102,8 @@ class Finder extends \elFinder
self::$volumesCnt = $volumesCntStart;
}
$this->time = $this->utime();
$this->sessionCloseEarlier = isset($opts['sessionCloseEarlier'])? (bool)$opts['sessionCloseEarlier'] : true;
$this->time = $this->utime();
$this->sessionCloseEarlier = isset($opts['sessionCloseEarlier']) ? (bool) $opts['sessionCloseEarlier'] : true;
$this->sessionUseCmds = array_flip($sessionUseCmds);
$this->timeout = (isset($opts['timeout']) ? $opts['timeout'] : 0);
$this->uploadTempPath = (isset($opts['uploadTempPath']) ? $opts['uploadTempPath'] : '');
@ -116,14 +116,14 @@ class Finder extends \elFinder
elFinder::$commonTempPath = '';
}
}
$this->maxArcFilesSize = isset($opts['maxArcFilesSize'])? intval($opts['maxArcFilesSize']) : 0;
$this->optionsNetVolumes = (isset($opts['optionsNetVolumes']) && is_array($opts['optionsNetVolumes']))? $opts['optionsNetVolumes'] : array();
$this->maxArcFilesSize = isset($opts['maxArcFilesSize']) ? intval($opts['maxArcFilesSize']) : 0;
$this->optionsNetVolumes = (isset($opts['optionsNetVolumes']) && is_array($opts['optionsNetVolumes'])) ? $opts['optionsNetVolumes'] : array();
if (isset($opts['itemLockExpire'])) {
$this->itemLockExpire = intval($opts['itemLockExpire']);
}
// deprecated settings
$this->netVolumesSessionKey = !empty($opts['netVolumesSessionKey'])? $opts['netVolumesSessionKey'] : 'elFinderNetVolumes';
$this->netVolumesSessionKey = !empty($opts['netVolumesSessionKey']) ? $opts['netVolumesSessionKey'] : 'elFinderNetVolumes';
self::$sessionCacheKey = !empty($opts['sessionCacheKey']) ? $opts['sessionCacheKey'] : 'elFinderCaches';
// check session cache
@ -147,25 +147,25 @@ class Finder extends \elFinder
$_reqCmd = isset($_req['cmd']) ? $_req['cmd'] : '';
foreach ($opts['bind'] as $cmd => $handlers) {
$doRegist = (strpos($cmd, '*') !== false);
if (! $doRegist) {
if (!$doRegist) {
$_getcmd = create_function('$cmd', 'list($ret) = explode(\'.\', $cmd);return trim($ret);');
$doRegist = ($_reqCmd && in_array($_reqCmd, array_map($_getcmd, explode(' ', $cmd))));
}
if ($doRegist) {
// for backward compatibility
if (! is_array($handlers)) {
if (!is_array($handlers)) {
$handlers = array($handlers);
} else {
if (count($handlers) === 2 && is_object($handlers[0])) {
$handlers = array($handlers);
}
}
foreach($handlers as $handler) {
foreach ($handlers as $handler) {
if ($handler) {
if (is_string($handler) && strpos($handler, '.')) {
list($_domain, $_name, $_method) = array_pad(explode('.', $handler), 3, '');
if (strcasecmp($_domain, 'plugin') === 0) {
if ($plugin = $this->getPluginInstance($_name, isset($opts['plugin'][$_name])? $opts['plugin'][$_name] : array())
if ($plugin = $this->getPluginInstance($_name, isset($opts['plugin'][$_name]) ? $opts['plugin'][$_name] : array())
and method_exists($plugin, $_method)) {
$this->bind($cmd, array($plugin, $_method));
}
@ -186,9 +186,9 @@ class Finder extends \elFinder
// check for net volumes stored in session
$netVolumes = $this->getNetVolumes();
foreach ($netVolumes as $key => $root) {
if (! isset($root['id'])) {
if (!isset($root['id'])) {
// given fixed unique id
if (! $root['id'] = $this->getNetVolumeUniqueId($netVolumes)) {
if (!$root['id'] = $this->getNetVolumeUniqueId($netVolumes)) {
$this->mountErrors[] = 'Netmount Driver "'.$root['driver'].'" : Could\'t given volume id.';
continue;
}

Loading…
Cancel
Save