Kaynağa Gözat

Changes to Support Pre Start Commands and Environment Variables

own3mall 9 yıl önce
ebeveyn
işleme
411c4e663d

+ 0 - 5
OGP/EHCP/addAccount.php

@@ -1,9 +1,6 @@
 <?php
 <?php
-
 // Adds users to the database
 // Adds users to the database
-
 // Variables
 // Variables
-
 $success = 0;
 $success = 0;
 
 
 if (isset($_GET['username'])) {
 if (isset($_GET['username'])) {
@@ -128,7 +125,5 @@ if ($errorCount > 0) {
 }
 }
 
 
 // Return value:
 // Return value:
-
 echo $success;
 echo $success;
-
 ?>
 ?>

+ 6 - 6
OGP/EHCP/config.php

@@ -1,5 +1,4 @@
 <?php
 <?php
-
 /*
 /*
 This FTP addon works with EHCP (www.ehcp.net)
 This FTP addon works with EHCP (www.ehcp.net)
 It allows OGP - the open game panel - to manage custom FTP user accounts
 It allows OGP - the open game panel - to manage custom FTP user accounts
@@ -22,6 +21,7 @@ if(!isset($dbpass) || empty($dbpass)){
 }
 }
 
 
 $dbName = 'ehcp';
 $dbName = 'ehcp';
+$debug=false;
 
 
 /**********************************
 /**********************************
 *          END DB Creds           *
 *          END DB Creds           *
@@ -31,7 +31,7 @@ $dbName = 'ehcp';
 $logFile = 'ehcp_ftp_log.txt';
 $logFile = 'ehcp_ftp_log.txt';
 
 
 function addToLog($errors) {
 function addToLog($errors) {
-    global $logFile;
+    global $logFile, $debug;
     
     
     if (!file_exists($logFile)) {
     if (!file_exists($logFile)) {
         $createLog = fopen($logFile, 'a+');
         $createLog = fopen($logFile, 'a+');
@@ -53,8 +53,10 @@ function addToLog($errors) {
     
     
     foreach ($errors as $err) {
     foreach ($errors as $err) {
         $logContents.= $err . "\n";
         $logContents.= $err . "\n";
-        trigger_error($err, E_USER_NOTICE);
-        echo $err . "\n";
+        if($debug){
+			trigger_error($err, E_USER_NOTICE);
+			echo $err . "\n";
+		}
     }
     }
     $updateLog = file_put_contents($logFile, $logContents);
     $updateLog = file_put_contents($logFile, $logContents);
     
     
@@ -78,6 +80,4 @@ if(!$connection){
     addToLog($errToLog);
     addToLog($errToLog);
     die('Unable to connect to the EHCP MySQL database using provided credentials! Please update your config.php settings!');
     die('Unable to connect to the EHCP MySQL database using provided credentials! Please update your config.php settings!');
 }
 }
-
 ?>
 ?>
-

+ 7 - 13
OGP/EHCP/delAccount.php

@@ -1,5 +1,4 @@
 <?php
 <?php
-
 if (file_exists("config.php")) {
 if (file_exists("config.php")) {
     include 'config.php';
     include 'config.php';
 } else {
 } else {
@@ -28,23 +27,19 @@ if (!isset($userToDelete)) {
     $SQL = "SELECT ftpusername FROM ftpaccounts WHERE ftpusername = '$userToDelete'";
     $SQL = "SELECT ftpusername FROM ftpaccounts WHERE ftpusername = '$userToDelete'";
 	$Result = execSQL($SQL, $connection);
 	$Result = execSQL($SQL, $connection);
     
     
-    if ($Result !== FALSE) {
+    if ($Result !== FALSE && countSQLResult($Result) == 1) {
 		$row = getSQLRowArray($Result);
 		$row = getSQLRowArray($Result);
         $unameDeleted = $row[0];
         $unameDeleted = $row[0];
-    }
+    }else{
+		$errorCount++;
+        $errors[] = "The specified user $userToDelete does not exist within the databse. No actions were taken!";
+	}
     
     
     if (isset($unameDeleted)) {
     if (isset($unameDeleted)) {
         $SQL = "DELETE FROM ftpaccounts WHERE ftpusername = '$userToDelete'";
         $SQL = "DELETE FROM ftpaccounts WHERE ftpusername = '$userToDelete'";
-		$Result = execSQL($SQL, $connection);
-        
+		$Result = execSQL($SQL, $connection); 
         if ($Result !== FALSE) {
         if ($Result !== FALSE) {
-            
-            if ($unameDeleted === "none") {
-                $errorCount++;
-                $errors[] = "The specified user $userToDelete does not exist within the databse. No actions were taken!";
-            } else {
-                $success = 1;
-            }
+			$success = 1;
         } else {
         } else {
             $errorCount++;
             $errorCount++;
 			$errors[] = getSQLError($connection);			
 			$errors[] = getSQLError($connection);			
@@ -61,5 +56,4 @@ if ($errorCount > 0) {
 
 
 // Return value:
 // Return value:
 echo $success;
 echo $success;
-
 ?>
 ?>

+ 0 - 4
OGP/EHCP/listAllUsers.php

@@ -1,9 +1,6 @@
 <?php
 <?php
-
 // Returns a list of all custom FTP users
 // Returns a list of all custom FTP users
-
 // Only custom users are setup when tying into the EHCP FTP API
 // Only custom users are setup when tying into the EHCP FTP API
-
 $countNotNull = 0;
 $countNotNull = 0;
 $users_list = "";
 $users_list = "";
 $success = 0;
 $success = 0;
@@ -66,5 +63,4 @@ if (!isset($connection)) {
 
 
 // Return the user list
 // Return the user list
 echo $users_list;
 echo $users_list;
-
 ?>
 ?>

+ 0 - 6
OGP/EHCP/showAccount.php

@@ -1,9 +1,4 @@
 <?php
 <?php
-
-// Returns the information of ONE custom ftpuser
-
-// Only custom users are setup when tying into the EHCP FTP API
-
 $countNotNull = 0;
 $countNotNull = 0;
 $user_details = "";
 $user_details = "";
 $success = 0;
 $success = 0;
@@ -68,5 +63,4 @@ if (isset($ftp_account)) {
 
 
 // Return the user list
 // Return the user list
 echo $user_details;
 echo $user_details;
-
 ?>
 ?>

+ 0 - 3
OGP/EHCP/syncftp.php

@@ -1,6 +1,5 @@
 <?php
 <?php
 $curDir = getcwd();
 $curDir = getcwd();
-
 if(chdir("/var/www/new/ehcp/")){
 if(chdir("/var/www/new/ehcp/")){
 	require ("classapp.php");
 	require ("classapp.php");
 	$app = new Application();
 	$app = new Application();
@@ -8,7 +7,5 @@ if(chdir("/var/www/new/ehcp/")){
 
 
 	$app->addDaemonOp('syncftp', '', '', '', 'sync ftp for nonstandard homes');
 	$app->addDaemonOp('syncftp', '', '', '', 'sync ftp for nonstandard homes');
 }
 }
-
 chdir($curDir);
 chdir($curDir);
-
 ?>
 ?>

+ 0 - 2
OGP/EHCP/updateInfo.php

@@ -1,5 +1,4 @@
 <?php
 <?php
-
 if (file_exists("config.php")) {
 if (file_exists("config.php")) {
     include 'config.php';
     include 'config.php';
 } else {
 } else {
@@ -142,5 +141,4 @@ if ($errorCount > 0) {
 
 
 // Return value:
 // Return value:
 echo $success;
 echo $success;
-
 ?>
 ?>

+ 0 - 6
OGP/EHCP/updatePass.php

@@ -1,5 +1,4 @@
 <?php
 <?php
-
 if (file_exists("config.php")) {
 if (file_exists("config.php")) {
     include 'config.php';
     include 'config.php';
 } else {
 } else {
@@ -67,16 +66,11 @@ if (!isset($ftp_username) || !isset($ftp_pass)) {
     }
     }
 }
 }
 
 
-
-
 // Log errors
 // Log errors
-
 if ($errorCount > 0) {
 if ($errorCount > 0) {
     addToLog($errors);
     addToLog($errors);
 }
 }
 
 
 // Return value:
 // Return value:
-
 echo $success;
 echo $success;
-
 ?>
 ?>

+ 1 - 1
OGP/ogp_agent.pl

@@ -688,7 +688,7 @@ sub universal_start_without_decrypt
 			$line = replace_OGP_Env_Vars($home_id, $home_path, $line);
 			$line = replace_OGP_Env_Vars($home_id, $home_path, $line);
 			if($line ne ""){
 			if($line ne ""){
 				logger "Configuring environment variable: $line";
 				logger "Configuring environment variable: $line";
-				$envVarStr .= "$line\n";
+				$envVarStr .= "$line\r\n";
 			}
 			}
 		}
 		}