1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8// initially from https://github.com/Studio-42/elFinder/wiki/Adding-file-description-to-Properties-dialog 9 10class tikiElFinder extends elFinder 11{ 12 function __construct($opts) 13 { 14 parent::__construct($opts); 15 /* Adding new command */ 16 $this->commands['info'] = ['target' => true, 'content' => false]; 17 } 18 19 protected function info($args) 20 { 21 $target = $args['target']; 22 $newDesc = $args['content']; 23 $error = [self::ERROR_UNKNOWN, '#' . $target]; 24 25 if (($volume = $this->volume($target)) == false 26 || ($file = $volume->file($target)) == false) { 27 return ['error' => $this->error($error, self::ERROR_FILE_NOT_FOUND)]; 28 } 29 30 $error[1] = $file['name']; 31 32 if ($volume->commandDisabled('info')) { 33 return ['error' => $this->error($error, self::ERROR_ACCESS_DENIED)]; 34 } 35 36 if (($info = $volume->info($target, $newDesc)) == -1) { 37 return ['error' => $this->error($error, $volume->error())]; 38 } 39 40 return ['info' => $info]; 41 } 42} 43