require_once 'filemanager.config.php'; #NETCAT END require_once 'filemanager.class.php'; // @todo Work on plugins registration // if (isset($config['plugin']) && !empty($config['plugin'])) { // $pluginPath = 'plugins' . DIRECTORY_SEPARATOR . $config['plugin'] . DIRECTORY_SEPARATOR; // require_once($pluginPath . 'filemanager.' . $config['plugin'] . '.config.php'); // require_once($pluginPath . 'filemanager.' . $config['plugin'] . '.class.php'); // $className = 'Filemanager'.strtoupper($config['plugin']); // $fm = new $className($config); // } else { // $fm = new Filemanager($config); // } #NETCAT START $fm = new Filemanager(); $fm->setFileRoot($SUB_FOLDER . $config['rel_path']); #NETCAT END $response = ''; if (!auth()) { $fm->error($fm->lang('AUTHORIZATION_REQUIRED')); } if (!isset($_GET)) { $fm->error($fm->lang('INVALID_ACTION')); } else { if (isset($_GET['mode']) && $_GET['mode'] != '') { switch ($_GET['mode']) { default: $fm->error($fm->lang('MODE_ERROR')); break; case 'getinfo': if ($fm->getvar('path')) {
$laravelAuth = false; } else { // Check if user has all access if ($app['auth']->user()->accessMediasAll()) { $laravelAuth = true; } elseif (method_exists($app['auth']->user(), 'accessMediasFolder')) { // Check if user has access to one folder if ($app['auth']->user()->accessMediasFolder()) { // Folder name with user id $folderPath .= 'user' . $app['auth']->id(); $laravelAuth = true; } else { $laravelAuth = false; } } else { $laravelAuth = false; } } /** * Check if user is authorized * * * @return boolean true if access granted, false if no access */ function auth() { return $GLOBALS['laravelAuth']; } $fm = new Filemanager(); $fm->setFileRoot($folderPath, true);
$laravelAuth = true; } elseif (method_exists($app['auth']->user(), 'accessMediasFolder')) { // Check if user has access to one folder if ($app['auth']->user()->accessMediasFolder()) { // Folder name with user id $folderPath .= 'user' . $app['auth']->id(); // Create folder if doesn't exist if (!is_dir($folderPath)) { mkdir($folderPath); } $laravelAuth = true; } else { $laravelAuth = false; } } else { $laravelAuth = false; } } /** * Check if user is authorized. * * * @return bool true if access granted, false if no access */ function auth() { return $GLOBALS['laravelAuth']; } $fm = new Filemanager(); $fm->setFileRoot($folderPath);
// require_once($pluginPath . 'filemanager.' . $config['plugin'] . '.config.php'); // require_once($pluginPath . 'filemanager.' . $config['plugin'] . '.class.php'); // $className = 'Filemanager'.strtoupper($config['plugin']); // $fm = new $className($config); // } else { // $fm = new Filemanager($config); // } $fm = new Filemanager(); if ($authenticated) { $userDir = $session->get('mautic.imagepath', false); $baseDir = $session->get('mautic.basepath', false); $docRoot = $session->get('mautic.docroot', false); if (substr($userDir, -1) !== '/') { $userDir .= '/'; } if ($baseDir && $baseDir != '/') { if (substr($baseDir, 0, 1) == '/') { $baseDir = substr($baseDir, 1); } if (substr($baseDir, -1) == '/') { $baseDir = substr($baseDir, 0, -1); } if (substr($userDir, 0, 1) == '/') { $userDir = substr($userDir, 1); } $userDir = $baseDir . '/' . $userDir; } elseif (substr($userDir, 0, 1) == '/') { $userDir = substr($userDir, 1); } $fm->setFileRoot($userDir, $docRoot); }
// $pluginPath = 'plugins' . DIRECTORY_SEPARATOR . $config['plugin'] . DIRECTORY_SEPARATOR; // require_once($pluginPath . 'filemanager.' . $config['plugin'] . '.config.php'); // require_once($pluginPath . 'filemanager.' . $config['plugin'] . '.class.php'); // $className = 'Filemanager'.strtoupper($config['plugin']); // $fm = new $className($config); // } else { // $fm = new Filemanager($config); // } $fm = new Filemanager(); if (isset($_SESSION['_sf2_attributes'])) { $userDir = $_SESSION['_sf2_attributes']['mautic.imagepath']; $baseDir = $_SESSION['_sf2_attributes']['mautic.basepath']; if (substr($userDir, -1) !== '/') { $userDir .= '/'; } if ($baseDir && $baseDir != '/') { if (substr($baseDir, 0, 1) == '/') { $baseDir = substr($baseDir, 1); } if (substr($baseDir, -1) == '/') { $baseDir = substr($baseDir, 0, -1); } if (substr($userDir, 0, 1) == '/') { $userDir = substr($userDir, 1); } $userDir = $baseDir . '/' . $userDir; } elseif (substr($userDir, 0, 1) == '/') { $userDir = substr($userDir, 1); } $fm->setFileRoot($userDir); }