} catch (Exception $e) { $paramError = gettext("Error saving new object"); include "error/Error.php"; break; } //show new object $paramMessage = gettext("New Object successfully created"); include "object/ShowObject.php"; break; case "save": //create data for object $status = getHttpPostVar("yourCMDB_active", 'N'); $fields = $config->getObjectTypeConfig()->getFields($paramType); $objectFields = array(); foreach (array_keys($fields) as $field) { $objectFields[$field] = getHttpPostVar($field, ""); } //change object and return the ShowObject page try { $object = $objectController->getObject($paramId, $authUser); //check, if HTTP POST variables are set if (count($_POST) <= 0) { $paramError = gettext("No data were set when saving an object."); include "object/ShowObject.php"; break; } $object = $objectController->updateObject($paramId, $status, $objectFields, $authUser); } catch (CmdbObjectNotFoundException $e) { $paramError = gettext("Error saving object"); include "error/Error.php"; break;
* along with yourCMDB. If not, see <http://www.gnu.org/licenses/>. * *********************************************************************/ /** * WebUI element: authenication with user session */ session_start(); $baseUrl = $config->getViewConfig()->getBaseUrl(); $authProvider = $config->getSecurityConfig()->getAuthProvider("web"); //set defaults $authAuthenticated = false; $authUser = ""; $authAccessgroup = ""; //get HTTP POST vars for authentication $authUserPost = getHttpPostVar("authUser", ""); $authPasswordPost = getHttpPostVar("authPassword", ""); //check, if user is already authenticated if (isset($_SESSION['authAuthenticated'], $_SESSION['authUser'], $_SESSION['authAccessgroup']) && $_SESSION['authAuthenticated'] == true) { //if user is authenticated, set session vars $authAuthenticated = true; $authUser = $_SESSION['authUser']; $authAccessgroup = $_SESSION['authAccessgroup']; } elseif ($authUserPost != "") { //authentication function if ($authProvider->authenticate($authUserPost, $authPasswordPost)) { $authAuthenticated = true; $authUser = $authUserPost; $authAccessgroup = $authProvider->getAccessGroup($authUser); $_SESSION['authAuthenticated'] = true; $_SESSION['authUser'] = $authUser; $_SESSION['authAccessgroup'] = $authAccessgroup;
* You should have received a copy of the GNU General Public License * along with yourCMDB. If not, see <http://www.gnu.org/licenses/>. * *********************************************************************/ /** * WebUI element: import actions * @author Michael Batz <*****@*****.**> */ use yourCMDB\fileimporter\ImportOptions; //get header include "include/bootstrap-web.php"; include "include/auth.inc.php"; //get parameters $paramAction = getHttpPostVar("action", "form"); $paramFormat = getHttpPostVar("format", ""); $paramFilename = getHttpPostVar("filename", ""); //set import options from URL/POST data $importOptions = new ImportOptions(); foreach (array_keys($_POST) as $parameter) { if ($parameter != "action" && $parameter != "format" && $parameter != "filename") { $importOptions->addOption($parameter, $_POST[$parameter]); } } //load page for action switch ($paramAction) { case "form": include "include/htmlheader.inc.php"; include "include/cmdbheader.inc.php"; include "import/Form.php"; include "include/cmdbfooter.inc.php"; include "include/htmlfooter.inc.php";