various minor fixes
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Fri, 10 Dec 2010 21:33:12 +0000 (21:33 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Fri, 10 Dec 2010 21:33:12 +0000 (21:33 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@655 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

src/mwin/acltabs.cpp
www/inc/machine/muser.php

index 04a6998..2767a37 100644 (file)
@@ -72,12 +72,17 @@ MUserTab::MUserTab(QString pk)
        }
 }
 
+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());
index 11f6585..6928f35 100644 (file)
@@ -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;
                }