From 5845b40a1034ffb4d206b3f89a285adfa810004c Mon Sep 17 00:00:00 2001
From: Laurent Giovannoni <laurent.giovannoni@maarch.org>
Date: Wed, 30 Mar 2011 10:46:41 +0000
Subject: [PATCH] fix : pb with notices

---
 core/trunk/core/class/docservers_controler.php | 9 ++++++---
 core/trunk/core/docservers_tools.php           | 6 +++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/core/trunk/core/class/docservers_controler.php b/core/trunk/core/class/docservers_controler.php
index 92673c72380..f60d1deb731 100644
--- a/core/trunk/core/class/docservers_controler.php
+++ b/core/trunk/core/class/docservers_controler.php
@@ -1212,8 +1212,8 @@ class docservers_controler
         $history = new history();
         $coreTools = new core_tools();
         $whereClause = '';
-        if ($_SESSION['origin'] <> 'basket' 
-            && $_SESSION['origin'] <> 'workflow'
+        if (isset($_SESSION['origin']) && ($_SESSION['origin'] <> 'basket' 
+            && $_SESSION['origin'] <> 'workflow')
         ) {
             if (isset(
                 $_SESSION['user']['security']
@@ -1405,6 +1405,7 @@ class docservers_controler
                                 $ent = new entity();
                                 $ent->increaseListinstanceViewed($gedId);
                             }
+                            $encodedContent = '';
                             if (file_exists($file) && !$error) {
                                 if ($calledByWS) {
                                     $content = '';
@@ -1438,7 +1439,9 @@ class docservers_controler
                                     'called_by_ws' => $calledByWS, 
                                     'error' => '',
                                 );
-                                if (file_exists($extract['tmpArchive'])) {
+                                if (isset($extract) 
+                                    && file_exists($extract['tmpArchive'])
+                                ) {
                                     Ds_washTmp($extract['tmpArchive']);
                                 }
                                 return $result;
diff --git a/core/trunk/core/docservers_tools.php b/core/trunk/core/docservers_tools.php
index 9d2538e1f74..5d65ea431ce 100644
--- a/core/trunk/core/docservers_tools.php
+++ b/core/trunk/core/docservers_tools.php
@@ -167,7 +167,7 @@ function Ds_createPathOnDocServer($docServer)
 function Ds_extractArchive($fileInfos, $fingerprintMode) 
 {
     //var_dump($fileInfos);
-    if ($fileInfos['tmpDir'] == '') {
+    if (!isset($fileInfos['tmpDir']) || $fileInfos['tmpDir'] == '') {
         $tmp = $_SESSION['config']['tmppath'];
     } else {
         $tmp = $fileInfos['tmpDir'];
@@ -275,7 +275,7 @@ function Ds_extractArchive($fileInfos, $fingerprintMode)
                     continue;
                 } else {
                     preg_match("'CI|.tar'", $fileScan, $out);
-                    if (count($out[0]) == 1) {
+                    if (isset($out[0]) && count($out[0]) == 1) {
                         $execError = '';
                         $tmpArchiveBis = uniqid(rand());
                         if (mkdir(
@@ -323,7 +323,7 @@ function Ds_extractArchive($fileInfos, $fingerprintMode)
                             }
                             $tmpCmd = '';
                             exec($commandBis, $tmpCmd, $execError);
-							//echo $commandBis;exit;
+                            //echo $commandBis;exit;
                             if ($execError > 0) {
                                 $result = array(
                                     'status' => 'ko', 
-- 
GitLab