Feature #576 - Applying the new function api_get_permissions_for_new_files().

skala
Ivan Tcholakov 15 years ago
parent d37ef44978
commit 46952d872f
  1. 4
      main/document/create_document.php
  2. 2
      main/gradebook/lib/fe/flatviewtable.class.php
  3. 10
      main/inc/lib/add_course.lib.inc.php
  4. 19
      main/inc/lib/fckeditor/repository.php
  5. 3
      main/inc/lib/fileUpload.lib.php
  6. 4
      main/mySpace/myspace.lib.php

@ -467,9 +467,7 @@ if ($form->validate()) {
//$content = preg_replace("|(flashvars=\"file=)([^/]+)/|","$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/',$content);
fputs($fp, $content);
fclose($fp);
$files_perm = api_get_setting('permissions_for_new_files');
$files_perm = octdec(!empty($files_perm)?$files_perm:'0770');
chmod($filepath.$filename.'.'.$extension,$files_perm);
chmod($filepath.$filename.'.'.$extension, api_get_permissions_for_new_files());
if (!is_dir($filepath.'css')) {
mkdir($filepath.'css', api_get_permissions_for_new_directories());
$doc_id = add_document($_course, $dir.'css', 'folder', 0, 'css');

@ -387,7 +387,7 @@ class FlatViewTable extends SortableTable
$user_id = api_get_user_id();
$img_file_generated_name = $key.uniqid('').'gradebook.png';
$Test->Render($tmp_path.$img_file_generated_name);
chmod($tmp_path.$img_file_generated_name, 0777);
chmod($tmp_path.$img_file_generated_name, api_get_permissions_for_new_files());
if ($i % 2 == 0 && $i!= 0) {
echo '<br>';

@ -191,8 +191,8 @@ function define_course_keys($wantedCode, $prefix4all = "", $prefix4baseName = ""
function prepare_course_repository($courseRepository, $courseId)
{
$perm = api_get_permissions_for_new_directories();
$perm_file = api_get_setting('permissions_for_new_files');
$perm_file = octdec(!empty($perm_file)?$perm_file:'0660');
$perm_file = api_get_permissions_for_new_files();
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository, $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/document", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/document/images", $perm);
@ -242,8 +242,6 @@ function prepare_course_repository($courseRepository, $courseId)
include(\"../../main/course_home/course_home.php\");
?>");
fwrite($fd,$string);
$perm_file = api_get_setting('permissions_for_new_files');
$perm_file = octdec(!empty($perm_file)?$perm_file:'0660');
@chmod(api_get_path(SYS_COURSE_PATH).$courseRepository . '/index.php',$perm_file);
$fd = fopen(api_get_path(SYS_COURSE_PATH).$courseRepository . '/group/index.html', 'w');
$string = "<html></html>";
@ -1842,6 +1840,7 @@ function fill_course_repository($courseRepository)
$web_code_path = api_get_path(WEB_CODE_PATH);
$perm = api_get_permissions_for_new_directories();
$perm_file = api_get_permissions_for_new_files();
/*doc_html = file(api_get_path(SYS_CODE_PATH).'document/example_document.html');
@ -1878,8 +1877,6 @@ function fill_course_repository($courseRepository)
$pictures_array = sort_pictures($files,"dir");
$pictures_array = array_merge($pictures_array,sort_pictures($files,"file"));
$perm_file = api_get_setting('permissions_for_new_files');
$perm_file = octdec(!empty($perm_file)?$perm_file:'0660');
if(!is_dir($course_documents_folder_images))
{
mkdir($course_documents_folder_images,$perm);
@ -2024,6 +2021,7 @@ function lang2db($string)
$string = Database::escape_string($string);
return $string;
}
/**
* Fills the course database with some required content and example content.
* @version 1.2

@ -7,11 +7,8 @@
require_once api_get_path(LIBRARY_PATH).'/fileUpload.lib.php';
$permissions_for_new_directories = api_get_setting('permissions_for_new_directories');
$permissions_for_new_directories = octdec(!empty($permissions_for_new_directories) ? $permissions_for_new_directories : '0777');
$permissions_for_new_files = api_get_setting('permissions_for_new_files');
$permissions_for_new_files = octdec(!empty($permissions_for_new_files) ? $permissions_for_new_files : '0777');
$permissions_for_new_directories = api_get_permissions_for_new_directories();
$permissions_for_new_files = api_get_permissions_for_new_files();
if (!empty($_course['path'])) {
require_once api_get_path(LIBRARY_PATH).'/document.lib.php';
@ -30,16 +27,14 @@ $user_folder = api_get_path(SYS_PATH).'main/upload/users/'.api_get_user_id().'/m
// Creation of a user owned folder if it does not exist.
if (!file_exists($user_folder)) {
// A recursive call of mkdir function.
@mkdir($user_folder, 0777, true);
chmod($user_folder, $permissions_for_new_directories);
@mkdir($user_folder, $permissions_for_new_directories, true);
}
// Creation of repository used by paltform administrators if it does not exist.
if (api_is_platform_admin()) {
$homepage_folder = api_get_path(SYS_PATH).'home/default_platform_document/';
if (!file_exists($homepage_folder)) {
@mkdir($homepage_folder);
chmod($homepage_folder, $permissions_for_new_directories);
@mkdir($homepage_folder, $permissions_for_new_directories);
}
}
$current_session_id = api_get_session_id();
@ -47,8 +42,7 @@ $current_session_id = api_get_session_id();
if (api_is_in_course()) {
$course_shared_folder = api_get_path(SYS_PATH).'courses/'.$_course['path'].'/document/shared_folder/';
if (!file_exists($course_shared_folder)) {
@mkdir($course_shared_folder);
chmod($course_shared_folder, $permissions_for_new_directories);
@mkdir($course_shared_folder, $permissions_for_new_directories);
$doc_id = add_document($_course, '/shared_folder', 'folder', 0, 'shared_folder');
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', api_get_user_id(),null,null,null,null,$current_session_id);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', api_get_user_id(),null,null,null,null,$current_session_id);
@ -59,8 +53,7 @@ if (api_is_in_course()) {
if (!file_exists($course_shared_folder.'sf_user_'.api_get_user_id())) {
//@todo call the create_unexisting_directory function and replace this code Julio Montoya
$new_user_dir = api_get_path(SYS_PATH).'courses/'.$_course['path'].'/document/shared_folder/sf_user_'.api_get_user_id().'/';
@mkdir($new_user_dir);
chmod($new_user_dir,$permissions_for_new_directories);
@mkdir($new_user_dir, $permissions_for_new_directories);
$doc_id = add_document($_course, '/shared_folder/sf_user_'.api_get_user_id(), 'folder', 0, api_get_person_name($_user['firstName'], $_user['lastName']));
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', api_get_user_id(),null,null,null,null,$current_session_id);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', api_get_user_id(),null,null,null,null,$current_session_id);

@ -285,8 +285,7 @@ function handle_uploaded_document($_course,$uploaded_file,$base_work_dir,$upload
//size of the uploaded file (in bytes)
$file_size = $uploaded_file['size'];
$files_perm = api_get_setting('permissions_for_new_files');
$files_perm = octdec(!empty($files_perm)?$files_perm:'0770');
$files_perm = api_get_permissions_for_new_files();
//what to do if the target file exists
switch ($what_if_file_exists)

@ -33,9 +33,7 @@ function export_csv($header, $data, $file_name = 'export.csv') {
fwrite($open, $info);
fclose($open);
$perm = api_get_setting('permissions_for_new_files');
$perm = octdec(!empty($perm) ? $perm : '0660');
@chmod($file_name, $perm);
@chmod($file_name, api_get_permissions_for_new_files());
header("Location:".$archive_url.$file_name);
}

Loading…
Cancel
Save