From 453c088c0547bae6a319872553b5ece64cbab793 Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Thu, 28 Jun 2012 12:07:39 +0000
Subject: [PATCH] 2012-06-28 Miguel de Dios <miguel.dedios@artica.es>

	* include/functions.php: fixed into the function "copy_dir" when
	pass a empty string or bad directory for source.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6722 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog             |  5 +++++
 pandora_console/include/functions.php | 18 +++++++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index 5fe39464ad..8555279b0d 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-28 Miguel de Dios <miguel.dedios@artica.es>
+	
+	* include/functions.php: fixed into the function "copy_dir" when
+	pass a empty string or bad directory for source.
+
 2012-06-27 Koichio Kikuchi <koichiro@rworks.jp>
 
 	* pandora_console.redhat.spec: Changed php dependencies so that the
diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php
index 55d8f5e9f1..b2b9a7aca0 100644
--- a/pandora_console/include/functions.php
+++ b/pandora_console/include/functions.php
@@ -1537,18 +1537,22 @@ function get_periods () {
  * Recursive copy directory
  */
 function copy_dir($src, $dst) { 
-	$dir = opendir($src); 
+	$dir = opendir($src);
+	
+	if (!$dir)
+		return false;
+	
 	@mkdir($dst); 
-	while(false !== ( $file = readdir($dir)) ) { 
-		if (( $file != '.' ) && ( $file != '..' )) { 
-			if ( is_dir($src . '/' . $file) ) { 
+	while(false !== ( $file = readdir($dir)) ) {
+		if (( $file != '.' ) && ( $file != '..' )) {
+			if ( is_dir($src . '/' . $file) ) {
 				copy_dir($src . '/' . $file,$dst . '/' . $file); 
 			}
-			else { 
+			else {
 				copy($src . '/' . $file,$dst . '/' . $file); 
 			}
 		}
 	}
 	closedir($dir); 
-} 
-?>
+}
+?>
\ No newline at end of file