Sergio Cambra
2014-06-30 b91328b225502a9fd9d871bae4529b6ea04b9b67
interface/web/client/domain_edit.php
@@ -147,9 +147,10 @@
         }
         else {
            /*
             * We edit a existing one, but there is nothing to edit
             * We edit a existing one, but domain name can't be changed
            */
            $this->dataRecord = $app->tform->getDataRecord($this->id);
            $oldData = $app->tform->getDataRecord($this->id);
            $this->dataRecord["domain"] = $oldData["domain"];
         }
      } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
         if ($this->id == 0) {
@@ -199,6 +200,19 @@
      }
   }
   function onAfterUpdate() {
      global $app, $conf;
      // make sure that the record belongs to the client group and not the admin group when admin inserts it
      // also make sure that the user can not delete domain created by a admin
      if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
         $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
         $app->db->query("UPDATE domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
         $lng_text = $app->lng("domain_owner_changed");
         $_SESSION['show_info_msg'] = str_replace("{domain}", $this->dataRecord["domain"], $lng_text);
      }
   }
}
$page = new page_action;