Exemplo n.º 1
0
		function getFile($fID) {
			Loader::model('file');
			$mf = new File();

			$file_obj = $mf->getByID($fID);
			$fileversion_obj = $file_obj->getVersion();
				
			$bf = new LibraryFileBlockController;

			$ftype = FileTypeList::getType($fileversion_obj->getExtension());
			$this->generictype = strtolower($ftype->getGenericTypeText($ftype->getGenericType()));
			$this->filename = $fileversion_obj->getFileName();
			$this->type = $fileversion_obj->getType();
			$this->url = $fileversion_obj->getURL();
			$this->filepath = $fileversion_obj->getPath();
			$this->relpath = $fileversion_obj->getRelativePath();
			$this->origfilename = $fileversion_obj->getRelativePath();
			$this->filesize = $fileversion_obj->getFullSize();
			
			$len = strlen(REL_DIR_FILES_UPLOADED);
			$fh = Loader::helper('concrete/file');
			
			$bf->bID 			= $fileversion_obj->getFileID();
			$bf->generictype 	= $this->generictype;
			$bf->type 			= $this->type;
			$bf->url 			= $this->url;
			$bf->filepath  		= $this->filepath;
			$bf->relpath  		= $this->relpath;
			$bf->filename 		= substr($this->relpath, $len); // for backwards compatibility this must include the prefixes
			$bf->filesize		= $this->filesize;
			return $bf;
		}
Exemplo n.º 2
0
		<table id="incoming_file_table" class="table table-bordered" width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<th width="10%" valign="middle" class="center theader"><input type="checkbox" id="check_all_imports" name="check_all_imports" onclick="ccm_alSelectMultipleIncomingFiles(this);" value="" /></td>
				<th width="20%" valign="middle" class="center theader"></td>
				<th width="45%" valign="middle" class="theader"><?php 
    echo t('Filename');
    ?>
</td>
				<th width="25%" valign="middle" class="center theader"><?php 
    echo t('Size');
    ?>
</td>
			</tr>
		<?php 
    foreach ($incoming_contents as $filenum => $file_array) {
        $ft = FileTypeList::getType($file_array['name']);
        ?>
			<tr>
				<td width="10%" valign="middle" class="center">
					<?php 
        if ($fh->extension($file_array['name'])) {
            ?>
						<input type="checkbox" name="send_file<?php 
            echo $filenum;
            ?>
" class="ccm-file-select-incoming" value="<?php 
            echo $file_array['name'];
            ?>
" />
					<?php 
        }
Exemplo n.º 3
0
	/** 
	 * Responsible for taking a particular version of a file and rescanning all its attributes
	 * This will run any type-based import routines, and store those attributes, generate thumbnails,
	 * etc...
	 */
	public function refreshAttributes($firstRun = false) {
		$fh = Loader::helper('file');
		$ext = $fh->getExtension($this->fvFilename);
		$ftl = FileTypeList::getType($ext);
		$db = Loader::db();
		
		if (!file_exists($this->getPath())) {
			return File::F_ERROR_FILE_NOT_FOUND;
		}
		
		$size = filesize($this->getPath());
		
		$title = ($firstRun) ? $this->getFilename() : $this->getTitle();
		
		$db->Execute('update FileVersions set fvExtension = ?, fvType = ?, fvTitle = ?, fvSize = ? where fID = ? and fvID = ?',
			array($ext, $ftl->getGenericType(), $title, $size, $this->getFileID(), $this->getFileVersionID())
		);
		if (is_object($ftl)) {
			if ($ftl->getCustomImporter() != false) {
				Loader::library('file/inspector');
				
				$db->Execute('update FileVersions set fvGenericType = ? where fID = ? and fvID = ?',
					array($ftl->getGenericType(), $this->getFileID(), $this->getFileVersionID())
				);
				
				// we have a custom library script that handles this stuff
				$cl = $ftl->getCustomInspector();
				$cl->inspect($this);
				
			}
		}
		$this->refreshThumbnails(false);
		$f = $this->getFile();
		$f->refreshCache();
		$f->reindex();
	}