Example #1
0
 /**
  *
  * Admin updates users data
  */
 public function adminActions()
 {
     $account = isset($_GET['account']) ? rawurldecode($_GET['account']) : false;
     $password = isset($_POST['password']) ? rawurldecode($_POST['password']) : false;
     $homedir = isset($_POST['homedir']) ? $_POST['homedir'] : false;
     $email = isset($_POST['email']) ? $_POST['email'] : false;
     $read = isset($_POST['read']) && $_POST['read'] == 'true' ? 'r' : '';
     $write = isset($_POST['write']) && $_POST['write'] == 'true' ? 'w' : '';
     $upload = isset($_POST['upload']) && $_POST['upload'] == 'true' ? 'u' : '';
     $permissions = $read . $write . $upload;
     if ($account == 'admin') {
         $permissions = 'rwu';
     }
     if (gatorconf::get('mask_repository_path')) {
         $homedir = gatorconf::get('repository') . DS . $homedir;
         // do not allow dirs up to reposiroty
         if (strstr($homedir, gatorconf::get('repository')) == false) {
             $homedir = gatorconf::get('repository');
         }
     }
     // fix homedir slashes
     $homedir = rtrim($homedir, "/\\");
     $homedir = str_replace('\\', '/', $homedir);
     // remove consecutive dots and slashes
     $homedir = preg_replace('~\\.\\.+~', '/', $homedir);
     $homedir = preg_replace('~/+~', '/', $homedir);
     // delete user
     if (isset($_GET['delete']) && $_GET['delete'] == 'yes') {
         gator::deleteUser($account);
         header('Location: ' . gatorconf::get('base_url'));
         die;
     }
     // new user account
     if (isset($_POST['is_new']) && $_POST['is_new'] == 'yes') {
         gator::addUser($account, array('password' => $password, 'permissions' => $permissions, 'homedir' => $homedir, 'akey' => '', 'email' => $email));
         return;
     }
     // update user
     gator::updateUser($account, array('password' => $password, 'permissions' => $permissions, 'homedir' => $homedir, 'email' => $email));
     return;
 }