$_SESSION['current_path'] = ""; } if (!is_file($_SESSION['upload_root_path'] . 'index.html')) { file_put_contents($_SESSION['upload_root_path'] . 'index.html', ' '); } if (!is_dir('private')) { mkdir('private', 0744); } if (!is_writable('private')) { echo '<p class="error">auto_restrict error: token folder is not writeable</p>'; } if (!is_file('private/.htaccess')) { file_put_contents('private/.htaccess', 'deny from all'); } if (!is_file($_SESSION['folder_share_file'])) { save_folder_share(array()); } if (!is_file('private/salt.php')) { file_put_contents('private/salt.php', '<?php define("BOZON_SALT",' . var_export(generate_bozon_salt(), true) . '); ?>'); } else { include 'private/salt.php'; } if (!file_exists($_SESSION['id_file'])) { $ids = array(); store($ids); } if (!is_file($_SESSION['upload_root_path'] . '.htaccess')) { file_put_contents($_SESSION['upload_root_path'] . '.htaccess', 'deny from all'); } if (!is_file($_SESSION['stats_file'])) { file_put_contents($_SESSION['stats_file'], array());
$users = $auto_restrict['users']; unset($users[$_SESSION['login']]); $shared_with = load_folder_share(); $sent = array_flip($_POST['users']); foreach ($users as $login => $data) { if (isset($sent[$login])) { # User checked: add share $shared_with[$login][$folder_id] = array('folder' => id2file($folder_id), 'from' => $_SESSION['login']); } else { # User not checked: remove share if exists if (isset($shared_with[$login][$folder_id])) { unset($shared_with[$login][$folder_id]); } } } save_folder_share($shared_with); header('location:index.php?p=admin&token=' . TOKEN); exit; } # Handle users rights if (isset($_POST['user_right']) && is_allowed('change status rights')) { foreach ($_POST['user_right'] as $key => $user_nb) { $users_rights[$_POST['user_name'][$key]] = $user_nb; } save_users_rights($users_rights); header('location:index.php?p=users&token=' . TOKEN . '&msg=' . e('Changes saved', false)); exit; } # Handle superadmin request for users pass change if (isset($_POST['user_pass']) && is_allowed('change passes')) { foreach ($_POST['user_pass'] as $key => $pass) {