Kaynağa Gözat

Feature #272 - Course restorer: Cleaning line endings in the source file.

Ivan Tcholakov 15 yıl önce
ebeveyn
işleme
99446510cc
1 değiştirilmiş dosya ile 19 ekleme ve 19 silme
  1. 19 19
      main/coursecopy/classes/CourseRestorer.class.php

+ 19 - 19
main/coursecopy/classes/CourseRestorer.class.php

@@ -145,7 +145,7 @@ class CourseRestorer
 		if (!empty($session_id)) {
 			$condition_session = " , id_session='".intval($session_id)."'";
 		}
-		
+
 		foreach ($this->course->resources as $type => $resources) {
 			if (is_array($resources)) {
 				foreach ($resources as $id => $resource) {
@@ -212,10 +212,10 @@ class CourseRestorer
 				$perm = api_get_setting('permissions_for_new_directories');
 			    $perm = octdec(!empty($perm)?$perm:0770);
 			    $dirs = explode('/', dirname($document->path));
-				
+
 				//if (count($dirs)==1) {
-				
-		    	if ($document->file_type==FOLDER) {		
+
+		    	if ($document->file_type==FOLDER) {
 		    		$visibility = $document->item_properties[0]['visibility'];
 		    		$new = substr($document->path, 8);
 		    		if (!is_dir($path.'document/'.$new)) {
@@ -223,11 +223,11 @@ class CourseRestorer
 						$res = Database::query($sql, __FILE__, __LINE__);
 						$num_result = Database::num_rows($res);
 						if ($num_result==0) {
-							$created_dir = create_unexisting_directory($destination_course,api_get_user_id(),0, 0 ,$path.'document',$new,basename($new),$visibility);	
-						}		    		
+							$created_dir = create_unexisting_directory($destination_course,api_get_user_id(),0, 0 ,$path.'document',$new,basename($new),$visibility);
+						}
 		    		}
 		    	}
-		    	
+
 			    //}
 			    /*
 			    else {
@@ -892,18 +892,18 @@ class CourseRestorer
 			$sql = "INSERT INTO ".$table_que." SET question = '".addslashes($question->question)."', description = '".addslashes($question->description)."', ponderation = '".addslashes($question->ponderation)."', position = '".addslashes($question->position)."', type='".addslashes($question->quiz_type)."', picture='".addslashes($question->picture)."', level='".addslashes($question->level)."'";
 			Database::query($sql, __FILE__, __LINE__);
 			$new_id = Database::insert_id();
-			
+
 
 			if ($question->quiz_type == 4) { // for answer type matching
 				foreach ($question->answers as $index => $answer) {
 				$sql = "INSERT INTO ".$table_ans." SET id= '".$answer['id']."',question_id = '".$new_id."', answer = '".Database::escape_string($answer['answer'])."', correct = '".$answer['correct']."', comment = '".Database::escape_string($answer['comment'])."', ponderation='".$answer['ponderation']."', position = '".$answer['position']."', hotspot_coordinates = '".$answer['hotspot_coordinates']."', hotspot_type = '".$answer['hotspot_type']."'";
 				Database::query($sql, __FILE__, __LINE__);
-				}	
+				}
 			} else {
 				foreach ($question->answers as $index => $answer) {
 					$sql = "INSERT INTO ".$table_ans." SET id= '". ($index +1)."',question_id = '".$new_id."', answer = '".Database::escape_string($answer['answer'])."', correct = '".$answer['correct']."', comment = '".Database::escape_string($answer['comment'])."', ponderation='".$answer['ponderation']."', position = '".$answer['position']."', hotspot_coordinates = '".$answer['hotspot_coordinates']."', hotspot_type = '".$answer['hotspot_type']."'";
 					Database::query($sql, __FILE__, __LINE__);
-				}	
+				}
 			}
 			$this->course->resources[RESOURCE_QUIZQUESTION][$id]->destination_id = $new_id;
 		}
@@ -1460,7 +1460,7 @@ class CourseRestorer
 			}
 		}
 	}
-	
+
 	function restore_wiki($session_id = 0)
 	{
 		if ($this->course->has_resources(RESOURCE_WIKI))
@@ -1486,23 +1486,23 @@ class CourseRestorer
 							'".intval($wiki->user_id)."',
 							'".intval($wiki->group_id)."',
 							'".Database::escape_string($wiki->dtime)."',
-							'".Database::escape_string($wiki->progress)."',								
+							'".Database::escape_string($wiki->progress)."',
 							'".intval($wiki->version)."',
 							'".(!empty($session_id)?intval($session_id):0)."')";
 				$rs2 = Database::query($sql, __FILE__, __LINE__);
-				$new_id = Database::insert_id();				
+				$new_id = Database::insert_id();
 				$this->course->resources[RESOURCE_WIKI][$id]->destination_id = $new_id;
 				$sql = "UPDATE $table_wiki set page_id = '$new_id' WHERE id = '$new_id'";
 				Database::query($sql, __FILE__, __LINE__);
-				
+
 				// we also add an entry in wiki_conf
-				$sql = "INSERT INTO $table_wiki_conf 
-						(page_id, task, feedback1, feedback2, feedback3, fprogress1, fprogress2, fprogress3, max_size, max_text, max_version, startdate_assig, enddate_assig, delayedsubmit) 
+				$sql = "INSERT INTO $table_wiki_conf
+						(page_id, task, feedback1, feedback2, feedback3, fprogress1, fprogress2, fprogress3, max_size, max_text, max_version, startdate_assig, enddate_assig, delayedsubmit)
 						VALUES
 						('".intval($new_id)."', '', '', '', '', '', '', '', NULL, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0)";
-				$rs1 = Database::query($sql, __FILE__, __LINE__);		
-			}			
+				$rs1 = Database::query($sql, __FILE__, __LINE__);
+			}
 		}
-	}	
+	}
 }
 ?>