Improve code precision as suggested by #scrutinizer

pull/2487/head
Yannick Warnier 9 years ago
parent 59ee624414
commit 6320a48196
  1. 2
      main/auth/inscription.php
  2. 28
      main/document/create_document.php
  3. 6
      main/document/document_quota.php
  4. 7
      main/exercise/export/scorm/scorm_classes.php
  5. 2
      main/inc/ajax/course.ajax.php
  6. 1
      main/inc/lib/formvalidator/Rule/MultipleRequired.php
  7. 8
      main/webservices/additional_webservices.php
  8. 2
      plugin/openmeetings/lib/openmeetings.class.php
  9. 2
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php

@ -669,7 +669,7 @@ if ($form->validate()) {
//update the extra fields
$count_extra_field = count($extras);
if ($count_extra_field > 0) {
if ($count_extra_field > 0 && is_integer($user_id)) {
foreach ($extras as $key => $value) {
// For array $value -> if exists key 'tmp_name' then must not be empty
// This avoid delete from user field value table when doesn't upload a file

@ -404,19 +404,21 @@ if (!$is_certificate_mode &&
}
}
} else {
foreach ($folders as & $folder) {
$selected = (substr($dir,0,-1)==$folder) ? ' selected="selected"' : '';
$label = $folder_titles[$folder];
if ($folder == $group_dir) {
$label = '/ ('.get_lang('HomeDirectory').')';
} else {
$path_parts = explode('/', str_replace($group_dir, '', $folder));
$label = cut($label, 80);
$label = str_repeat('   ', count($path_parts) - 2).' — '.$label;
}
$parent_select -> addOption($label, $folder);
if ($selected != '') {
$parent_select->setSelected($folder);
if (is_array($folders) && !empty($folders)) {
foreach ($folders as & $folder) {
$selected = (substr($dir, 0, -1) == $folder) ? ' selected="selected"' : '';
$label = $folder_titles[$folder];
if ($folder == $group_dir) {
$label = '/ (' . get_lang('HomeDirectory') . ')';
} else {
$path_parts = explode('/', str_replace($group_dir, '', $folder));
$label = cut($label, 80);
$label = str_repeat('   ', count($path_parts) - 2) . ' — ' . $label;
}
$parent_select->addOption($label, $folder);
if ($selected != '') {
$parent_select->setSelected($folder);
}
}
}
}

@ -94,8 +94,10 @@ if (is_array($document_list)) {
if (!empty($course_list)) {
$total_courses_quota = 0;
$total_quota_bytes = 0;
foreach ($course_list as $course_data) {
$total_quota_bytes += DocumentManager::get_course_quota($course_data['id']);
if (is_array($course_list) && !empty($course_list)) {
foreach ($course_list as $course_data) {
$total_quota_bytes += DocumentManager::get_course_quota($course_data['id']);
}
}
if ($quota_bytes != 0) {
$quota_percentage = round($quota_bytes/$total_quota_bytes, 2)*100;

@ -401,7 +401,12 @@ class ScormAnswerFillInBlanks extends Answer
($endlocations-$startlocations)+1
);
$jstmp .= $i.',';
$jstmpc .= "'".api_htmlentities(api_substr($texstring, 1, -1), ENT_QUOTES, $charset)."',";
if (!empty($texstring)) {
$sub = api_substr($texstring, 1, -1);
if (!empty($sub)) {
$jstmpc .= "'" . api_htmlentities($sub, ENT_QUOTES, $charset) . "',";
}
}
$my_weight = explode('@', $weights[$i - 1]);
if (count($my_weight) == 2) {
$weight_db = $my_weight[0];

@ -112,7 +112,7 @@ switch ($action) {
if (api_is_platform_admin()) {
$results = SessionManager::get_course_list_by_session_id($_GET['session_id'], $_GET['q']);
$results2 = array();
if (!empty($results)) {
if (is_array($results) && !empty($results)) {
foreach ($results as $item) {
$item2 = array();
foreach ($item as $id => $internal) {

@ -44,4 +44,3 @@ class HTML_QuickForm_Rule_MultipleRequired extends HTML_QuickForm_Rule
} // end func getValidationScript
} // end class HTML_QuickForm_Rule_MultipleRequired
?>

@ -62,9 +62,11 @@ function wsConvertPpt($pptData)
if ($return === 0) {
$images = array();
foreach ($files as $file) {
$imageData = explode('||', $file);
$images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles . $fileName . '/' . $imageData[1]));
if (is_array($files) && !empty($files)) {
foreach ($files as $file) {
$imageData = explode('||', $file);
$images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles . $fileName . '/' . $imageData[1]));
}
}
$data = array(
'files' => $files,

@ -44,7 +44,7 @@ class OpenMeetings
// initialize video server settings from global settings
$plugin = \OpenMeetingsPlugin::create();
$om_plugin = $plugin->get('tool_enable');
$om_plugin = (bool) $plugin->get('tool_enable');
$om_host = $plugin->get('host');
$om_user = $plugin->get('user');
$om_pass = $plugin->get('pass');

@ -95,7 +95,7 @@ class CourseRestorer
}
/**
* @param string $status
* @param bool $status
*/
public function set_add_text_in_items($status)
{

Loading…
Cancel
Save