Exemple #1
0
             if ($res == 'invalid') {
                 $err['name'] = t('Username Invalid. No uppercase, not starting with number, less than 7 chars.');
                 $break = true;
             }
         }
         if (ZFtp::checkExistence($ftpuser)) {
             $err['name'] = t('Username Occupied.');
             $break = true;
         }
         // check password
         if (true !== ($res = ZUser::chkPassword($passwd))) {
             $err['password'] = t('Password can not be empty.');
             $break = true;
         }
         // check ftp
         if (true !== ($res = ZFtp::chkFtpRoot($docroot, $owner))) {
             $err['docroot'] = t('Directory must be inside $HOME.');
             $break = true;
         }
         if ($break) {
             break;
         }
         //var_dump($ftpuser, $accounts);break;
         if (ZFtp::addFtpAccount($owner, $ftpuser, $passwd, $docroot, $writable)) {
             setmsg(t("Added."), 'notice');
         }
     }
     break;
 case 'edit':
     $name = isset($_REQUEST['name']) ? $_REQUEST['name'] : '';
     $name = preg_replace("/[^a-z0-9_]+/i", "", $name);
function chkFtpRoot($path, $owner)
{
    return ZFtp::chkFtpRoot($path, $owner);
}