BolmerCMS.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php namespace kcfinder\cms;
  2. /** This file is part of KCFinder project
  3. *
  4. * @desc CMS integration code: BolmerCMS
  5. * @package KCFinder
  6. * @version 3.12
  7. * @author Borisov Evgeniy <modx@agel-nash.ru>
  8. * @copyright 2010-2014 KCFinder Project
  9. * @license http://opensource.org/licenses/GPL-3.0 GPLv3
  10. * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
  11. * @link http://kcfinder.sunhater.com
  12. */
  13. class BolmerCMS{
  14. protected static $authenticated = false;
  15. static function checkAuth() {
  16. $current_cwd = getcwd();
  17. if ( ! self::$authenticated) {
  18. define('BOLMER_API_MODE', true);
  19. define('IN_MANAGER_MODE', true);
  20. $init = realpath(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))))."/index.php");
  21. include_once($init);
  22. $type = getService('user', true)->getLoginUserType();
  23. if($type=='manager'){
  24. self::$authenticated = true;
  25. if (!isset($_SESSION['KCFINDER'])) {
  26. $_SESSION['KCFINDER'] = array();
  27. }
  28. if(!isset($_SESSION['KCFINDER']['disabled'])) {
  29. $_SESSION['KCFINDER']['disabled'] = false;
  30. }
  31. $_SESSION['KCFINDER']['_check4htaccess'] = false;
  32. $_SESSION['KCFINDER']['uploadURL'] = '/assets/';
  33. $_SESSION['KCFINDER']['uploadDir'] = BOLMER_BASE_PATH.'assets/';
  34. $_SESSION['KCFINDER']['theme'] = 'default';
  35. }
  36. }
  37. chdir($current_cwd);
  38. return self::$authenticated;
  39. }
  40. }
  41. \kcfinder\cms\BolmerCMS::checkAuth();