Преглед изворни кода

Fixed, bug in the image of a template, has changed the directory CT#601

Carlos Vargas пре 15 година
родитељ
комит
fe535c4b8a
2 измењених фајлова са 6 додато и 8 уклоњено
  1. 4 7
      main/document/document.php
  2. 2 1
      main/inc/lib/fckeditor/fcktemplates.xml.php

+ 4 - 7
main/document/document.php

@@ -140,9 +140,6 @@ $dbl_click_id = 0; // used to avoid double-click
 $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
 $group_member_with_upload_rights = false;
 
-
-
-
 //if the group id is set, we show them group documents
 if(isset($_SESSION['_gid']) && $_SESSION['_gid']!='')
 {
@@ -640,10 +637,10 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 		$user_id = api_get_user_id();
 
 		// create the template_thumbnails folder in the upload folder (if needed)
-		if (!is_dir(api_get_path(SYS_CODE_PATH).'upload/template_thumbnails/')) {
-			@mkdir(api_get_path(SYS_CODE_PATH).'upload/template_thumbnails/', api_get_permissions_for_new_directories());
+		if (!is_dir(api_get_path(SYS_PATH).'courses/'.$_course['path'].'/upload/template_thumbnails/')) {
+			@mkdir(api_get_path(SYS_PATH).'courses/'.$_course['path'].'/upload/template_thumbnails/', api_get_permissions_for_new_directories());
 		}
-
+	var_dump(api_get_path(SYS_PATH).'courses/'.$_course['path'].'/upload/template_thumbnails/');
 		// upload the file
 		if (!empty($_FILES['template_image']['name'])) {
 
@@ -655,7 +652,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 				$new_file_name = $_course['sysCode'].'-'.add_ext_on_mime(stripslashes($_FILES['template_image']['name']), $_FILES['template_image']['type']);
 
 				// upload dir
-				$upload_dir = api_get_path(SYS_CODE_PATH).'upload/template_thumbnails/';
+				$upload_dir = api_get_path(SYS_PATH).'courses/'.$_course['path'].'/upload/template_thumbnails/';
 
 				// resize image to max default and end upload
 				require_once (api_get_path(LIBRARY_PATH).'image.lib.php');

+ 2 - 1
main/inc/lib/fckeditor/fcktemplates.xml.php

@@ -164,6 +164,7 @@ function load_personal_templates($user_id=0) {
 			WHERE user_id='".Database::escape_string($user_id)."'
 			AND course_code='".Database::escape_string(api_get_course_id())."'
 			AND document.id = template.ref_doc";
+
 	$result_template = Database::query($sql);
 	while ($row = Database::fetch_array($result_template))
 	{
@@ -172,7 +173,7 @@ function load_personal_templates($user_id=0) {
 
 		if (!empty($row['image']))
 		{
-			$image = api_get_path(WEB_CODE_PATH).'upload/template_thumbnails/'.$row['image'];
+			$image = api_get_path(WEB_PATH).'courses/'.$_course['path'].'/upload/template_thumbnails/'.$row['image'];
 		} else {
 			$image = api_get_path(WEB_PATH).'home/default_platform_document/template_thumb/noimage.gif';
 		}