Beispiel #1
0
 /**
  * The import of files
  *
  * @param  $import_info	array
  * @param  $field_info	 array
  * @return bool|array
  */
 public static function fileImport($import_info, $field_info, $complexParent = false)
 {
     if ($complexParent && !empty($field_info) && $field_info['type'] == 'complexfile') {
         if (empty($import_info[$complexParent][$field_info['id']]) || !is_array($import_info[$complexParent][$field_info['id']])) {
             return false;
         } else {
             $temp = null;
             foreach ($import_info[$complexParent][$field_info['id']] as $key => $file_name) {
                 $data = SJB_UploadFileManager::getDataForImportListing($file_name);
                 $_FILES[$complexParent]['name'][$field_info['id']][$key] = $data['name'];
                 $_FILES[$complexParent]['type'][$field_info['id']][$key] = $data['type'];
                 $_FILES[$complexParent]['tmp_name'][$field_info['id']][$key] = $data['tmp_name'];
                 $_FILES[$complexParent]['error'][$field_info['id']][$key] = $data['error'];
                 $_FILES[$complexParent]['size'][$field_info['id']][$key] = $data['size'];
                 $_FILES[$complexParent]['import'][$field_info['id']][$key] = 1;
                 if (strpos($data['tmp_name'], '/temp/import/') !== false) {
                     $temp = true;
                 }
             }
             return $temp;
         }
     } elseif (empty($import_info[$field_info['id']])) {
         return false;
     } elseif (in_array($field_info['type'], array('file', 'logo', 'video'))) {
         $data = SJB_UploadFileManager::getDataForImportListing($import_info[$field_info['id']]);
         if (empty($data)) {
             return false;
         }
         $_FILES[$field_info['id']] = array('name' => $data['name'], 'type' => $data['type'], 'tmp_name' => $data['tmp_name'], 'error' => $data['error'], 'size' => $data['size'], 'import' => 1);
         if (strpos($data['tmp_name'], '/temp/import/') !== false) {
             return true;
         }
     }
     return false;
 }