$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } /* Check if the form data comes for a trusted request */ if(!checkFormKey('extensionmgr')) { UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token")); } if (isset($_POST["action"])) $action=$_POST["action"]; else $action=NULL; // add new attribute definition --------------------------------------------- if ($action == "download") { if (!isset($_POST["extname"])) { UI::exitError(getMLText("admin_tools"),getMLText("unknown_id")); } $extname = trim($_POST["extname"]); if (!file_exists($settings->_rootDir.'/ext/'.$extname) ) { UI::exitError(getMLText("admin_tools"),getMLText("missing_extension")); } $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir); $controller->setParam('extmgr', $extMgr); $controller->setParam('extname', $extname); if (!$controller($_POST)) { echo json_encode(array('success'=>false, 'error'=>'Could not download extension')); } add_log_line(); } /* }}} */ elseif ($action == "refresh") { $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir); $extMgr->createExtensionConf(); $controller->setParam('extmgr', $extMgr); if (!$controller($_POST)) { UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); } add_log_line(); header("Location:../out/out.ExtensionMgr.php"); } elseif ($action == "upload") { if($_FILES['userfile']['error']) { UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); } if($_FILES['userfile']['type'] != 'application/zip') { UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); } $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir); $controller->setParam('extmgr', $extMgr); $controller->setParam('file', $_FILES['userfile']['tmp_name']); if (!$controller($_POST)) { UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); } add_log_line(); header("Location:../out/out.ExtensionMgr.php"); } ?>