/**
  * Add info on the user who uploaded the file and the date it was uploaded, and create thumb if it doesn't exist
  */
 protected function get_file_object($file_name)
 {
     // Create the thumb if it doesn't exist
     $thumb = $this->options['upload_dir'] . 'thumb/' . $file_name;
     if (!file_exists(jQueryUpload::thumbFilename($thumb))) {
         $this->create_scaled_image($file_name, $this->options['image_versions']['thumbnail']);
     }
     // Call the parent method to create the file object
     $file = parent::get_file_object($file_name);
     // Add the meta data to the object
     if (is_object($file)) {
         $meta = $this->options['upload_dir'] . 'meta/' . $file_name;
         $file->info = $file->desc = "";
         // If the meta data file exists, extract and render the content
         if (is_file($meta)) {
             $data = unserialize(file_get_contents($meta));
             $file->info = self::renderData($data);
             $file->desc = array_key_exists(2, $data) ? $data[2] : '';
         } elseif (is_link($this->options['upload_dir'] . $file_name)) {
             $title = Title::newFromText($file_name, NS_FILE);
             if (is_object($title) && $title->exists()) {
                 list($uid, $ts, $file->desc) = self::getUploadedFileInfo($title);
                 $file->info = self::renderData(array($uid, wfTimestamp(TS_UNIX, $ts)));
             }
         }
     }
     return $file;
 }
 protected function get_file_object($file_name)
 {
     if (!($file = parent::get_file_object($file_name))) {
         $file = new \stdClass();
         $file->name = $file_name;
         $file->size = 0;
         $file->url = $this->get_download_url($file->name);
         $this->set_additional_file_properties($file);
     }
     return $file;
 }
Example #3
0
 }
 $rs = db_query($queryObj->gSQLWhere($strWhereClause), $conn);
 if ($isDBFile) {
     if ($rs && ($data = db_fetch_array($rs))) {
         $value = db_stripslashesbinary($data[$field]);
     }
 } else {
     $cipherer = new RunnerCipherer($strTableName, $pSet);
     $row = $cipherer->DecryptFetchedArray($rs);
     if (!is_null($row)) {
         $filesArray = my_json_decode($row[$field]);
         if (!is_array($filesArray) || count($filesArray) == 0) {
             if ($row[$field] == "") {
                 $filesArray = array();
             } else {
                 $uploadedFile = $upload_handler->get_file_object($row[$field]);
                 if (is_null($uploadedFile)) {
                     $filesArray = array();
                 } else {
                     $filesArray = array(my_json_decode(my_json_encode($uploadedFile)));
                 }
             }
         }
         foreach ($filesArray as $uploadedFile) {
             if ($uploadedFile["usrName"] == $fileName) {
                 $sessionFile = $uploadedFile;
                 break;
             }
         }
     }
 }