예제 #1
0
     }
     break;
 case 'edit':
     $name = isset($_REQUEST['name']) ? $_REQUEST['name'] : '';
     $name = preg_replace("/[^a-z0-9_]+/i", "", $name);
     if (!$name) {
         redirect('ftp.php');
     }
     $password = $_REQUEST['password'];
     $owner = strtok($name, '_');
     $users = ZUser::getUsers();
     $account = ZFtp::getFtpAccount($name);
     if (!$account) {
         setmsg(t('No such user.'));
     }
     $myuid = ZUser::getuid($owner);
     $dirs = ZFile::getUserDirs($owner);
     $docroot = trim($account->home);
     $docroot = str_replace("/home/{$owner}", '~', $docroot);
     if (checktoken()) {
         $op = $_REQUEST['op'];
         if ($op == 'remove') {
             if (ZFtp::removeFtpAccount($name)) {
                 setmsg(t('Ftp Account Deleted.'), 'notice', 'ftp.php');
             }
         } else {
             if ('suspend' == $op) {
                 if (ZFtp::suspendFtpUser($name, !intval($_REQUEST['suspend']))) {
                     setmsg('', 'notice');
                 } else {
                     setmsg(t('Error'));