From: konrad Date: Fri, 10 Dec 2010 21:33:12 +0000 (+0000) Subject: various minor fixes X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=085683fe274cdac1bcb604883ebd8d70db2aee6c;p=web%2Fkonrad%2Fsmoke.git various minor fixes git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@655 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/src/mwin/acltabs.cpp b/src/mwin/acltabs.cpp index 04a6998..2767a37 100644 --- a/src/mwin/acltabs.cpp +++ b/src/mwin/acltabs.cpp @@ -72,12 +72,17 @@ MUserTab::MUserTab(QString pk) } } +static bool MOUser_Less(const MOUser&u1,const MOUser&u2) +{ + return u1.name().value()queryGetAllUsers(); if(au.hasError())return; QListusl=au.getusers(); + qSort(usl.begin(),usl.end(),MOUser_Less); usermodel->clear(); usermodel->insertColumns(0,2); usermodel->insertRows(0,usl.size()); diff --git a/www/inc/machine/muser.php b/www/inc/machine/muser.php index 11f6585..6928f35 100644 --- a/www/inc/machine/muser.php +++ b/www/inc/machine/muser.php @@ -26,7 +26,7 @@ class MachineUser return; } //verify syntax - if(!ereg("^[a-zA-Z]([a-zA-Z_\\.-]*)$",$trans->getusername())){ + if(!preg_match("/^[a-zA-Z]([a-zA-Z_\\.-]*)$/",$trans->getusername())){ $trans->abortWithError(tr("Username is invalid.")); return; } @@ -37,7 +37,7 @@ class MachineUser $hsh=sha1($slt.$trans->getpassword()); $usr->passwd=$slt." ".$hsh; $usr->insert(); - $trans->setuser(MOUser::fromTableuser($usr)); + $trans->setuser(WOUser::fromTableuser($usr)); } /**deletes or merges a user*/ @@ -277,7 +277,7 @@ class MachineUser { //check for syntax $rnm=trim($trans->getrole().""); - if(ereg("^[a-zA-Z][a-zA-z0-9_\\.-]*$",$rnm)===false){ + if(!preg_match("/^[a-zA-Z][a-zA-z0-9_\\.-]*$/",$rnm)){ $trans->abortWithError(tr("Illegal role name.")); return; } @@ -354,7 +354,7 @@ class MachineUser $trans->abortWithError(tr("Cannot set/create special hosts.")); return; } - if(ereg("^[a-zA-Z][a-zA-z0-9_\\.-]*$",$hname)===false){ + if(!preg_match("/^[a-zA-Z][a-zA-z0-9_\\.-]*$/",$hname)){ $trans->abortWithError(tr("Illegal host name.")); return; }