[svn r11081] fixing security problem

skala
Patrick Cool 19 years ago
parent e727d2edb8
commit 0c8612b5fb
  1. 46
      main/inc/lib/add_course.lib.inc.php

@ -1368,20 +1368,20 @@ function fill_course_repository($courseRepository)
{
$img_code_path = api_get_path(SYS_CODE_PATH)."img/default_courses_img/";
$course_documents_folder=$sys_course_path.$courseRepository.'/document/images/examples/';
$files=array();
$files=browse_folders($img_code_path,$files);
$pictures_array = sort_pictures($files,"dir");
$pictures_array = array_merge($pictures_array,sort_pictures($files,"file"));
mkdir($course_documents_folder,0777);
$handle = opendir($img_code_path);
foreach($pictures_array as $key => $value){
if($value["dir"]!=""){
mkdir($course_documents_folder.$value["dir"],0777);
}
@ -1389,9 +1389,9 @@ function fill_course_repository($courseRepository)
copy($img_code_path.$value["file"],$course_documents_folder.$value["file"]);
chmod($course_documents_folder.$value["file"],0777);
}
}
}
return $pictures_array;
}
@ -1443,19 +1443,19 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$pictures_ar
$TABLEQUIZQUESTION = $courseDbName . "quiz_rel_question";
$TABLEQUIZQUESTIONLIST = $courseDbName . "quiz_question";
$TABLEQUIZANSWERSLIST = $courseDbName . "quiz_answer";
$TABLESETTING = $courseDbName . "course_setting";
$TABLESETTING = $courseDbName . "course_setting";
$TABLEFORUMCATEGORIES = $courseDbName . "forum_category";
$TABLEFORUMS = $courseDbName . "forum_forum";
$TABLEFORUMTHREADS = $courseDbName . "forum_thread";
$TABLEFORUMPOSTS = $courseDbName . "forum_post";
$nom = $_user['lastName'];
$prenom = $_user['firstName'];
include ($clarolineRepositorySys . "lang/english/create_course.inc.php");
include ($clarolineRepositorySys . "lang/".$language . "/create_course.inc.php");
include (api_get_path(SYS_CODE_PATH) . "lang/english/create_course.inc.php");
include (api_get_path(SYS_CODE_PATH) . "lang/".$language . "/create_course.inc.php");
mysql_select_db("$courseDbName");
@ -1572,9 +1572,9 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$pictures_ar
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$img_documents='/images/examples/';
$course_documents_folder=$sys_course_path.$courseRepository.'/document/images/examples/';
foreach($pictures_array as $key => $value){
if($value["dir"]!=""){
$folder_path=substr($value["dir"],0,strlen($value["dir"])-1);
@ -1590,7 +1590,7 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$pictures_ar
$image_id = Database :: get_last_insert_id();
api_sql_query("INSERT INTO `".$TABLEITEMPROPERTY . "` (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('document',1,NOW(),NOW(),$image_id,'DocumentAdded',1,0,NULL,0)");
}
}
/*
@ -1665,8 +1665,8 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$pictures_ar
-----------------------------------------------------------
*/
api_sql_query("INSERT INTO `".$TABLEGROUPCATEGORIES . "` ( id , title , description , max_student , self_reg_allowed , self_unreg_allowed , groups_per_user , display_order ) VALUES ('2', '".lang2db(get_lang('DefaultGroupCategory')) . "', '', '8', '0', '0', '0', '0');");
/*
-----------------------------------------------------------
Forum tool
@ -1675,17 +1675,17 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$pictures_ar
api_sql_query("INSERT INTO `$TABLEFORUMCATEGORIES` VALUES (1,'".lang2db(get_lang('ExampleForumCategory'))."', '', 1, 0)");
$insert_id = Database :: get_last_insert_id();
api_sql_query("INSERT INTO `".$TABLEITEMPROPERTY . "` (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('forum_category',1,NOW(),NOW(),$insert_id,'ForumCategoryAdded',1,0,NULL,1)");
api_sql_query("INSERT INTO `$TABLEFORUMS` VALUES (1,'".lang2db(get_lang('ExampleForum'))."', '', 0, 0, 0, 1, 0, 1, '0', 1, 1, 'flat', '0', 'public', 1, 0)");
$insert_id = Database :: get_last_insert_id();
api_sql_query("INSERT INTO `".$TABLEITEMPROPERTY . "` (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('" . TOOL_FORUM . "',1,NOW(),NOW(),$insert_id,'ForumAdded',1,0,NULL,1)");
api_sql_query("INSERT INTO `$TABLEFORUMTHREADS` VALUES (1, '".lang2db(get_lang('ExampleThread'))."', 1, 0, 1, '', 0, 1, NOW(), 0, 0)");
$insert_id = Database :: get_last_insert_id();
api_sql_query("INSERT INTO `".$TABLEITEMPROPERTY . "` (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('forum_thread',1,NOW(),NOW(),$insert_id,'ForumThreadAdded',1,0,NULL,1)");
api_sql_query("INSERT INTO `$TABLEFORUMPOSTS` VALUES (1, '".lang2db(get_lang('ExampleThread'))."', '".lang2db(get_lang('ExampleThreadContent'))."', 1, 1, 1, '', NOW(), 0, 0, 1)");
}
return 0;

Loading…
Cancel
Save