4875: add error detection to IMS CC import; set default error values
authorTJ <acontent@iam.tj>
Fri, 7 Oct 2011 19:57:34 +0000 (20:57 +0100)
committerTJ <acontent@iam.tj>
Fri, 21 Oct 2011 15:23:34 +0000 (16:23 +0100)
home/ims/ims_import.php
include/classes/HTTPRequest.class.php

index a1cd1e3..b02f8ac 100644 (file)
@@ -810,7 +810,8 @@ if(isset($_POST['ignore_validation']) && $_POST['ignore_validation']==1) {
 
 if (isset($_REQUEST['url']) && ($_REQUEST['url'] != 'http://') ) {
        $http_req = new HTTPRequest($_REQUEST['url'], array());
-       if ($content = $http_req->DownloadToString()) {
+       $content = $http_req->DownloadToString();
+       if (!$http_req->_errno && $content) {
                $filename = substr(time(), -6). '.zip';
                $full_filename = TR_CONTENT_DIR . $filename;
 
index d77e15c..5158231 100644 (file)
@@ -15,8 +15,8 @@ class HTTPRequest
     var $_uri;        // request URI
     var $_port;        // port
     var $_cookies = array();    // array of cookies
-    var $_errstr;
-    var $_errno;
+    var $_errstr = '';
+    var $_errno = 0;
 
     // scan url
     function _scan_url()
@@ -126,7 +126,7 @@ class HTTPRequest
             }
         } catch (Exception $exception) {
             $this->_errstr = $exception->getMessage();
-            $this->_errno  =  $exception->getCode();
+            $this->_errno  = $exception->getCode();
             return(FALSE);
         }
     }