From b283f9c3b2d16e6c29eaf5240607f21c580ce8d2 Mon Sep 17 00:00:00 2001
From: Falko Timme <ft@falkotimme.com>
Date: Wed, 30 Apr 2014 04:26:25 -0400
Subject: [PATCH] - Re-enabled "Remember Password"- function on login screen.

---
 interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php |   82 +++++++++++++++++++++-------------------
 1 files changed, 43 insertions(+), 39 deletions(-)

diff --git a/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php b/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php
index e4de54a..c417033 100644
--- a/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php
+++ b/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php
@@ -1,21 +1,22 @@
 <?php
 /**
  * sites_web_domain_plugin plugin
- * 
+ *
  * @author Marius Cramer <m.cramer@pixcept.de> pixcept KG 2012, copied and adapted from web_domain plugin by:
  * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
  */
- 
+
+
 class sites_web_vhost_subdomain_plugin {
 
 	var $plugin_name        = 'sites_web_vhost_subdomain_plugin';
 	var $class_name         = 'sites_web_vhost_subdomain_plugin';
-	
+
 	// TODO: This function is a duplicate from the one in interface/web/sites/web_vhost_subdomain_edit.php
 	//       There should be a single "token replacement" function to be called from modules and
-	//	 from the main code.
+	//  from the main code.
 	// Returna a "3/2/1" path hash from a numeric id '123'
-	function id_hash($id,$levels) {
+	function id_hash($id, $levels) {
 		$hash = "" . $id % 10 ;
 		$id /= 10 ;
 		$levels -- ;
@@ -27,40 +28,43 @@
 		return $hash;
 	}
 
-    /*
+	/*
             This function is called when the plugin is loaded
     */
-    function onLoad() {
-        global $app;
-        //Register for the events        
-        // both event call the same function as the things to do do not differ here
-        $app->plugin->registerEvent('sites:web_vhost_subdomain:on_after_insert','sites_web_vhost_subdomain_plugin','sites_web_vhost_subdomain_edit');
-        $app->plugin->registerEvent('sites:web_vhost_subdomain:on_after_update','sites_web_vhost_subdomain_plugin','sites_web_vhost_subdomain_edit');
-    }
-
-    /*
-		Function to create the sites_web_vhost_subdomain rule and insert it into the custom rules           
-    */
-    function sites_web_vhost_subdomain_edit($event_name, $page_form) {
-        global $app, $conf;   
-        
-		// Get configuration for the web system
-        $app->uses("getconf");        
-		$web_config = $app->getconf->get_server_config($app->functions->intval($page_form->dataRecord['server_id']),'web');            
-        
-        $parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = '" . $app->functions->intval($page_form->dataRecord['parent_domain_id']) . "'");
-        
-		// Set the values for document_root, system_user and system_group
-		$system_user = $app->db->quote($parent_domain['system_user']);
-		$system_group = $app->db->quote($parent_domain['system_group']);
-		$document_root = $app->db->quote($parent_domain['document_root']);
-		$php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$page_form->dataRecord['web_folder'],$web_config["php_open_basedir"]);
-		$php_open_basedir = str_replace("[website_domain]/web",$page_form->dataRecord['domain'].'/'.$page_form->dataRecord['web_folder'],$php_open_basedir);
-		$php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
-		$php_open_basedir = $app->db->quote(str_replace("[website_domain]",$page_form->dataRecord['domain'],$php_open_basedir));
-		$htaccess_allow_override = $app->db->quote($parent_domain['allow_override']);
-
-		$sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($parent_domain['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE domain_id = ".$page_form->id;
-		$app->db->query($sql);
+	function onLoad() {
+		global $app;
+		//Register for the events
+		// both event call the same function as the things to do do not differ here
+		$app->plugin->registerEvent('sites:web_vhost_subdomain:on_after_insert', 'sites_web_vhost_subdomain_plugin', 'sites_web_vhost_subdomain_edit');
+		$app->plugin->registerEvent('sites:web_vhost_subdomain:on_after_update', 'sites_web_vhost_subdomain_plugin', 'sites_web_vhost_subdomain_edit');
 	}
-}              	
\ No newline at end of file
+
+	/*
+		Function to create the sites_web_vhost_subdomain rule and insert it into the custom rules
+    */
+	function sites_web_vhost_subdomain_edit($event_name, $page_form) {
+		global $app, $conf;
+		
+		if(isset($page_form->dataRecord["parent_domain_id"]) && $page_form->dataRecord["parent_domain_id"] != $page_form->oldDataRecord["parent_domain_id"]) {
+			// Get configuration for the web system
+			$app->uses("getconf");
+			$web_config = $app->getconf->get_server_config($app->functions->intval($page_form->dataRecord['server_id']), 'web');
+
+			$parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = '" . $app->functions->intval($page_form->dataRecord['parent_domain_id']) . "'");
+
+			// Set the values for document_root, system_user and system_group
+			$system_user = $app->db->quote($parent_domain['system_user']);
+			$system_group = $app->db->quote($parent_domain['system_group']);
+			$document_root = $app->db->quote($parent_domain['document_root']);
+			$php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$page_form->dataRecord['web_folder'], $web_config["php_open_basedir"]);
+			$php_open_basedir = str_replace("[website_domain]/web", $page_form->dataRecord['domain'].'/'.$page_form->dataRecord['web_folder'], $php_open_basedir);
+			$php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir);
+			$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $page_form->dataRecord['domain'], $php_open_basedir));
+			$htaccess_allow_override = $app->db->quote($parent_domain['allow_override']);
+
+			$sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($parent_domain['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE domain_id = ".$page_form->id;
+			$app->db->query($sql);
+		}
+	}
+
+}

--
Gitblit v1.9.1