fantu
2008-12-29 f7b32b76cce0cca2dcd5a31b41cd9e4b3bdd5d69
interface/web/client/client_edit.php
@@ -1,6 +1,6 @@
<?php
/*
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
Copyright (c) 2005 - 2008, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -72,7 +72,7 @@
      $text = '';
      foreach($tplAdd as $item){
         if (trim($item) != ''){
            if ($text != '') $text .= '<br>';
            if ($text != '') $text .= '<br />';
            $text .= $tpl[$item];
         }
      }
@@ -132,18 +132,21 @@
      global $app;
      
      // username changed
      if($this->oldDataRecord['username'] != $this->dataRecord['username']) {
      if(isset($this->dataRecord['username']) && $this->dataRecord['username'] != '' && $this->oldDataRecord['username'] != $this->dataRecord['username']) {
         $username = mysql_real_escape_string($this->dataRecord["username"]);
         $client_id = $this->id;
         $app->db->datalogUpdate('sys_user', "username = '$username'", 'client_id', $client_id);
         $app->db->datalogUpdate('sys_group', "name = '$username'", 'client_id', $client_id);
         $sql = "UPDATE sys_user SET username = '$username' WHERE client_id = $client_id";
         $app->db->query($sql);
         $sql = "UPDATE sys_group SET name = '$username' WHERE client_id = $client_id";
         $app->db->query($sql);
      }
      
      // password changed
      if(isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
         $password = mysql_real_escape_string($this->dataRecord["password"]);
         $client_id = $this->id;
         $app->db->datalogUpdate('sys_user', "passwort = md5('$password')", 'client_id', $client_id);
         $sql = "UPDATE sys_user SET passwort = md5('$password') WHERE client_id = $client_id";
         $app->db->query($sql);
      }
      
      // reseller status changed
@@ -152,7 +155,8 @@
         if($this->dataRecord["limit_client"] > 0) $modules .= ',client';
         $modules = mysql_real_escape_string($modules);
         $client_id = $this->id;
         $app->db->datalogUpdate('sys_user', "modules = '$modules'", 'client_id', $client_id);
         $sql = "UPDATE sys_user SET modules = '$modules' WHERE client_id = $client_id";
         $app->db->query($sql);
      }
      /*
       *  If there is a client-template, process it */