Ejemplo n.º 1
0
 /**
  * Get the HTML source to show an image
  *
  * @param string $file Filename
  * @param array $prm @see helper_mage config
  * @return string The HTML image tag
  */
 public function view($file, array $prm = array())
 {
     $this->cfg->file = $this->addFilesRootIfNeeded($file);
     $this->cfg->setA($prm);
     $this->cfg->html = true;
     if ($this->cfg->originalView) {
         $this->cfg->fileSave = $this->cfg->file;
         $ret = $this->html();
     } else {
         $this->cfg->fileSave = $this->makePath($this->cfg->file, $this->cfg->fileSaveAdd);
         $ret = $this->build();
     }
     $fileWeb = str_replace($this->cfg->filesRoot, '', $this->cfg->fileSave);
     return str_replace($this->cfg->fileSave, $this->cfg->webUri ? request::webUri($fileWeb) : request::uploadedUri($fileWeb), $ret);
 }
Ejemplo n.º 2
0
 /**
  * Get the view for the uploaded element
  *
  * @return string
  */
 public function getView()
 {
     $ret = null;
     if ($current = $this->getCurrent()) {
         if (!($ret = $this->callHelper('view', $current, null))) {
             $ret = utils::htmlTag('a', array_merge($this->cfg->previewPrm, array('href' => request::uploadedUri($current))), $this->cfg->previewText ? $this->cfg->previewText : basename($current));
         }
     }
     return $ret;
 }
Ejemplo n.º 3
0
	protected function execIndex(array $prm = array()) {
		$this->prepare();
		
		$pattern = FILESROOT.$this->dir.DS.'*';
		$search = http_vars::getInstance()->get('search');
		if ($search) {
			$pattern.= strtolower($search).'*';
			$this->uri.= 'search='.$search.'&';
		}
		
		$delete = http_vars::getInstance()->get('delete');
		if ($delete) {
			$file = FILESROOT.urldecode($delete);
			if (file::exists($file)) {
				file::delete($file);
				file::multipleDelete(substr($file, 0, -strlen(file::getExt($file))-1).'_*');
				response::getInstance()->redirect($this->uri);
			}
		}
		
		$form = $this->getForm();
		
		if (request::isPost()) {
			$form->refill();
			if ($form->isValid())
				response::getInstance()->sendText('ok');
		}
		
		$files = array();
		foreach(file::search($pattern) as $f) {
			if (strpos($f, 'nyroBrowserThumb') === false) {
				$name = basename($f);
				if ($this->type == 'image' && strlen($name) > 15)
					$name = substr($name, 0, 15).'...'.file::getExt($f);
				$files[] = array(
					$f,
					request::uploadedUri(str_replace(FILESROOT, '', $f), $this->myCfg['uploadedUri']),
					$name,
					file::humanSize($f),
					utils::formatDate(filemtime($f)),
					$this->uri.'delete='.urlencode(str_replace(FILESROOT, '', $f)).'&'
				);
			}
		}
		
		$this->setViewVars(array(
			'uri'=>$this->uri,
			'form'=>$form,
			'config'=>$this->config,
			'type'=>$this->type,
			'files'=>$files,
			'searchButton'=>$this->myCfg['search'],
			'search'=>$search,
			'imgHelper'=>$this->myCfg['imgHelper'],
			'filesTitle'=>$this->myCfg['filesTitle'],
			'noFiles'=>$this->myCfg['noFiles'],
			'name'=>$this->myCfg['name'],
			'size'=>$this->myCfg['size'],
			'date'=>$this->myCfg['date'],
			'delete'=>$this->myCfg['delete'],
		));
	}
Ejemplo n.º 4
0
<?php
$tinybrowser['sessioncheck'] = 'dummySessionStuffforTinyBrowser';
$_SESSION[$tinybrowser['sessioncheck']] = true;

$tinybrowser['language'] = request::get('lang');

$tinybrowser['docroot'] = FILESROOT.'tinyBrowser';

if (isset($_GET['subdir']))
	$tinybrowser['docroot'].= '/'.$_GET['subdir'];

// File upload paths (set to absolute by default)
$tinybrowser['path']['image'] = '/images/'; // Image files location - also creates a '_thumbs' subdirectory within this path to hold the image thumbnails
$tinybrowser['path']['media'] = '/media/'; // Media files location
$tinybrowser['path']['file']  = '/'; // Other files location

$tinybrowser['thumbsrc'] = 'link';
// File link paths - these are the paths that get passed back to TinyMCE or your application (set to equal the upload path by default)
$tinybrowser['link']['image'] = request::uploadedUri('tinyBrowser/images/', array('controller'=>false)); //$tinybrowser['path']['image']; // Image links
$tinybrowser['link']['media'] = request::uploadedUri('tinyBrowser/media/', array('controller'=>false)); //$tinybrowser['path']['media']; // Media links
$tinybrowser['link']['file']  = request::uploadedUri('tinyBrowser/', array('controller'=>false)); //$tinybrowser['path']['file']; // Other file links

$tinybrowser['imagequality'] = 100;
$tinybrowser['thumbquality'] = 100;