Author: Alexey Krupskiy (admin@inji.ru)
Inheritance: extends adminController
Example #1
0
 function gc($maxlifetime)
 {
     global $sess_save_path;
     foreach (glob("{$sess_save_path}/sess_*") as $filename) {
         if (filemtime($filename) + $maxlifetime < time()) {
             @unlink($filename);
         }
     }
     FilesController::auto_checkin();
     return true;
 }
Example #2
0
 protected function _initialize()
 {
     defined('Ueditor') or define('Ueditor', true);
     if (IS_POST) {
         $authkey = I('get.authkey');
         $sess_id = I('get.sessid', 0);
         $userid = I('get.uid');
         $this->isadmin = I('get.isadmin', 0, 'intval');
         $key = md5(C("AUTHCODE") . $sess_id . $userid . $this->isadmin);
         if ($key != $authkey) {
             exit(json_encode(array('state' => '身份认证失败!')));
         } else {
             $this->uid = $userid;
             $this->groupid = I('get.groupid');
         }
     }
     parent::_initialize();
     if ($this->isadmin) {
         //上传大小
         $this->confing['imageMaxSize'] = $this->confing['scrawlMaxSize'] = $this->confing['catcherMaxSize'] = $this->confing['videoMaxSize'] = $this->confing['fileMaxSize'] = self::$Cache['Config']['uploadmaxsize'] * 1024;
         //上传文件类型
         $uploadallowext = explode('|', self::$Cache['Config']['uploadallowext']);
         foreach ($uploadallowext as $k => $rs) {
             $uploadallowext[$k] = ".{$rs}";
         }
         $this->confing['fileAllowFiles'] = $uploadallowext;
     } else {
         $this->confing['imageMaxSize'] = $this->confing['scrawlMaxSize'] = $this->confing['catcherMaxSize'] = $this->confing['videoMaxSize'] = $this->confing['fileMaxSize'] = self::$Cache['Config']['qtuploadmaxsize'] * 1024;
         //上传文件类型
         $uploadallowext = explode('|', self::$Cache['Config']['qtuploadallowext']);
         foreach ($uploadallowext as $k => $rs) {
             $uploadallowext[$k] = ".{$rs}";
         }
         $this->confing['fileAllowFiles'] = $uploadallowext;
     }
 }
 /**
  * @PublicPage
  * @NoCSRFRequired
  *
  * Sends the file matching the fileId
  *
  * @inheritDoc
  *
  * @param int $fileId the ID of the file we want to download
  * @param string|null $filename
  */
 public function download($fileId, $filename = null)
 {
     return parent::download($fileId, $filename);
 }
 public function filelist()
 {
     global $varChecker;
     if ($varChecker->getValue('publish') == 'publish') {
         $fileController = new FilesController($this->dRep);
         $fileController->publishfiles();
     }
     $folder = $this->getCurrentFolder();
     $getVar = strpos($this->INK_User->getCustomer()->getSite()->getUrl(), 'localhost') === false ? '' : '?rt=';
     $siteurl = trim($this->INK_User->getCustomer()->getSite()->getUrl(), '/') . '/' . $getVar;
     foreach ($folder->getFiles() as $index => $image) {
         $id = $image->getId();
         $alter = $index % 2 == 0 ? 'tralt' : '';
         $extension = $image->getFiletype()->getName();
         $filename = $image->getFilename();
         $source = $siteurl . $image->getFoldername() . '/' . $image->getId() . '.' . $image->getExtension();
         $timestamp = $image->getTimestamp('M d Y @ h:i');
         $size = $image->getSize('kb');
         $checkbox = true;
         include 'view/files/filelist.files.php';
     }
 }
 function display_content()
 {
     $user = $this->loginUserByToken('user_id');
     $fc = new FilesController();
     $fc->display_content();
 }
 /**
  * @PublicPage
  *
  * Returns a list of all images from the folder the link gives access to
  *
  * @inheritDoc
  *
  * @param string $location a path representing the current album in the app
  * @param string $features the list of supported features
  * @param string $etag the last known etag in the client
  */
 public function getFiles($location, $features, $etag)
 {
     return parent::getFiles($location, $features, $etag);
 }
Example #7
0
    return csrf_token();
});
Route::group(array('before' => 'auth'), function () {
    /**
     * Get images for project x
     *
     */
    Route::get('/api/v1/getImageFromImageableItem/{imageable_type}/{imageable_id}', 'ImagesController@getImageFromImageableItem');
    Route::post('/api/v1/getImageFromImageableItem/{imageable_type}/{imageable_id}', function () {
        return Image::create(Input::all());
    });
    Route::resource('/api/v1/images', 'ImagesController');
    Route::get('images/projects', 'ImagesController@uploadProject');
    Route::post('images/projects', 'ImagesController@uploadProject');
    Route::post('/api/v1/ckeditor/images', function () {
        $files = new FilesController();
        return $files->postImage();
    });
    Route::post('/api/v1/ckeditor/files', function () {
        $files = new FilesController();
        return $files->postFile();
    });
    Route::get('/api/v1/ckeditor/files', function () {
        $files = new FilesController();
        return $files->getFiles();
    });
    Route::get('/api/v1/ckeditor/gallery', function () {
        $images = new FilesController();
        return $images->getImageswysiwyg();
    });
});