From 7fe908c50c8dbc5cc05f571dbe11d66141caacd4 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 14 Nov 2013 09:01:22 -0500
Subject: [PATCH] Cleaning up code to match coding guidelines

---
 interface/web/vm/openvz_action.php |  134 ++++++++++++++++++++++----------------------
 1 files changed, 67 insertions(+), 67 deletions(-)

diff --git a/interface/web/vm/openvz_action.php b/interface/web/vm/openvz_action.php
index b62ca33..31c23ac 100644
--- a/interface/web/vm/openvz_action.php
+++ b/interface/web/vm/openvz_action.php
@@ -4,8 +4,8 @@
 All rights reserved.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -26,110 +26,110 @@
 
 $app->tpl->newTemplate('form.tpl.htm');
 $app->tpl->setInclude('content_tpl', 'templates/openvz_action.htm');
-	
-//* load language file 
-$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_openvz_action.lng';
-include_once($lng_file);
-$app->tpl->setVar($wb);
-	
-$app->tpl->setVar('id',$vm_id);
-$app->tpl->setVar('veid',$veid);
 
-$options = array('start_option_enabled'=>'','stop_option_enabled'=>'','restart_option_enabled'=>'','ostemplate_option_enabled'=>'');
+//* load language file
+$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_openvz_action.lng';
+include_once $lng_file;
+$app->tpl->setVar($wb);
+
+$app->tpl->setVar('id', $vm_id);
+$app->tpl->setVar('veid', $veid);
+
+$options = array('start_option_enabled'=>'', 'stop_option_enabled'=>'', 'restart_option_enabled'=>'', 'ostemplate_option_enabled'=>'');
 
 
 //* Show the action select page
 if($action == 'show') {
 
-$options['start_option_enabled'] = 'checked="checked"';
-	
+	$options['start_option_enabled'] = 'checked="checked"';
+
 } elseif ($action == 'start') {
-	
+
 	//* Start the virtual machine
 	$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-			"VALUES (".
-			(int)$server_id . ", ".
-			time() . ", ".
-			"'openvz_start_vm', ".
-			$veid.", ".
-			"'pending', ".
-			"''".
-			")";
+		"VALUES (".
+		(int)$server_id . ", ".
+		time() . ", ".
+		"'openvz_start_vm', ".
+		$veid.", ".
+		"'pending', ".
+		"''".
+		")";
 	$app->db->query($sql);
-	
-	$app->tpl->setVar('msg',$wb['start_exec_txt']);
+
+	$app->tpl->setVar('msg', $wb['start_exec_txt']);
 	$options['start_option_enabled'] = 'checked="checked"';
-	
+
 } elseif ($action == 'stop') {
-	
+
 	//* Stop the virtual machine
 	$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-			"VALUES (".
-			(int)$server_id . ", ".
-			time() . ", ".
-			"'openvz_stop_vm', ".
-			$veid.", ".
-			"'pending', ".
-			"''".
-			")";
+		"VALUES (".
+		(int)$server_id . ", ".
+		time() . ", ".
+		"'openvz_stop_vm', ".
+		$veid.", ".
+		"'pending', ".
+		"''".
+		")";
 	$app->db->query($sql);
-	
-	$app->tpl->setVar('msg',$wb['stop_exec_txt']);
+
+	$app->tpl->setVar('msg', $wb['stop_exec_txt']);
 	$options['stop_option_enabled'] = 'checked="checked"';
 
 } elseif ($action == 'restart') {
-	
+
 	//* Restart the virtual machine
 	$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-			"VALUES (".
-			(int)$server_id . ", ".
-			time() . ", ".
-			"'openvz_restart_vm', ".
-			$veid.", ".
-			"'pending', ".
-			"''".
-			")";
+		"VALUES (".
+		(int)$server_id . ", ".
+		time() . ", ".
+		"'openvz_restart_vm', ".
+		$veid.", ".
+		"'pending', ".
+		"''".
+		")";
 	$app->db->query($sql);
-	
-	$app->tpl->setVar('msg',$wb['restart_exec_txt']);
+
+	$app->tpl->setVar('msg', $wb['restart_exec_txt']);
 	$options['restart_option_enabled'] = 'checked="checked"';
 
 } elseif ($action == 'ostemplate') {
-	
+
 	$ostemplate_name = $_POST['ostemplate_name'];
-	
+
 	if(!preg_match("/^[a-zA-Z0-9\.\-\_]{1,50}$/i", $ostemplate_name)) {
 		$error_msg .= $wb['ostemplate_name_error'].'<br />';
-		$app->tpl->setVar('ostemplate_name',$ostemplate_name);
+		$app->tpl->setVar('ostemplate_name', $ostemplate_name);
 	}
-	
+
 	//* Quote name
 	$ostemplate_name = $app->db->quote($ostemplate_name);
-	
+
 	//* Check for duplicates
 	$tmp = $app->db->queryOneRecord("SELECT count(ostemplate_id) as number FROM openvz_ostemplate WHERE template_file = '$ostemplate_name'");
 	if($tmp['number'] > 0) $error_msg .= $wb['ostemplate_name_unique_error'].'<br />';
 	unset($tmp);
-	
+
 	if($error_msg == '') {
 		//* Create ostemplate action
 		$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-				"VALUES (".
-				(int)$server_id . ", ".
-				time() . ", ".
-				"'openvz_create_ostpl', ".
-				"'".$veid.":".$ostemplate_name."', ".
-				"'pending', ".
-				"''".
-				")";
+			"VALUES (".
+			(int)$server_id . ", ".
+			time() . ", ".
+			"'openvz_create_ostpl', ".
+			"'".$veid.":".$ostemplate_name."', ".
+			"'pending', ".
+			"''".
+			")";
 		$app->db->query($sql);
-		
+
 		//* Create a record in the openvz_ostemplate table
-		$sql = "INSERT INTO `openvz_ostemplate` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`) 
+		$sql = "INSERT INTO `openvz_ostemplate` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`)
 		VALUES(1, 1, 'riud', 'riud', '', '$ostemplate_name', '$ostemplate_name', $server_id, 'n', 'y', '')";
 		$app->db->query($sql);
-		
-		$app->tpl->setVar('msg',$wb['ostemplate_exec_txt']);
+
+		$app->tpl->setVar('msg', $wb['ostemplate_exec_txt']);
 		$options['ostemplate_option_enabled'] = 'checked="checked"';
 	}
 
@@ -139,11 +139,11 @@
 }
 
 $app->tpl->setVar($options);
-$app->tpl->setVar('error',$error_msg);
+$app->tpl->setVar('error', $error_msg);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
 
-?>
\ No newline at end of file
+?>

--
Gitblit v1.9.1