From dce3bb513b06dbec8923d661b44aaa7a82ae4fe1 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Tue, 19 Nov 2013 02:59:37 -0500
Subject: [PATCH] Improved sql queries in VM module.

---
 interface/web/vm/openvz_template_edit.php |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/interface/web/vm/openvz_template_edit.php b/interface/web/vm/openvz_template_edit.php
index 73d004e..ec520d0 100644
--- a/interface/web/vm/openvz_template_edit.php
+++ b/interface/web/vm/openvz_template_edit.php
@@ -54,8 +54,8 @@
 	function onAfterInsert() {
 		global $app, $conf;
 
-		$guar_ram = $this->dataRecord['ram']*256;
-		$burst_ram = $this->dataRecord['ram_burst']*256;
+		$guar_ram = $app->functions->intval($this->dataRecord['ram']*256);
+		$burst_ram = $app->functions->intval($this->dataRecord['ram_burst']*256);
 		$sql = "UPDATE openvz_template SET shmpages = '$guar_ram:$guar_ram',vmguarpages = '$guar_ram:$guar_ram', oomguarpages = '$guar_ram:$guar_ram',privvmpages = '$burst_ram:$burst_ram' WHERE template_id = $this->id";
 		$app->db->query($sql);
 	}
@@ -63,8 +63,8 @@
 	function onAfterUpdate() {
 		global $app, $conf;
 
-		$guar_ram = $this->dataRecord['ram']*256;
-		$burst_ram = $this->dataRecord['ram_burst']*256;
+		$guar_ram = $app->functions->intval($this->dataRecord['ram']*256);
+		$burst_ram = $app->functions->intval($this->dataRecord['ram_burst']*256);
 		$sql = "UPDATE openvz_template SET shmpages = '$guar_ram:$guar_ram',vmguarpages = '$guar_ram:$guar_ram', oomguarpages = '$guar_ram:$guar_ram',privvmpages = '$burst_ram:$burst_ram' WHERE template_id = $this->id";
 		$app->db->query($sql);
 	}

--
Gitblit v1.9.1