}
}
+static bool MOUser_Less(const MOUser&u1,const MOUser&u2)
+{
+ return u1.name().value()<u2.name().value();
+}
void MUserTab::updateUsers()
{
MTGetAllUsers au=req->queryGetAllUsers();
if(au.hasError())return;
QList<MOUser>usl=au.getusers();
+ qSort(usl.begin(),usl.end(),MOUser_Less);
usermodel->clear();
usermodel->insertColumns(0,2);
usermodel->insertRows(0,usl.size());
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;
}
$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*/
{
//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;
}
$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;
}