1<?php 2/** 3 * 4 * Copyright 2001-2017 Horde LLC (http://www.horde.org/) 5 * 6 * See the enclosed file LICENSE for license information (ASL). If you 7 * did not receive this file, see http://www.horde.org/licenses/apache. 8 * 9 * @package @Mnemo 10 */ 11 12@define('MNEMO_BASE', dirname(__DIR__)); 13require_once MNEMO_BASE . '/lib/Application.php'; 14Horde_Registry::appInit('mnemo'); 15 16// Exit if this isn't an authenticated user or if the user can't 17// create new notepads (default share is locked). 18if (!$GLOBALS['registry']->getAuth() || $prefs->isLocked('default_notepad')) { 19 Horde::url('', true)->redirect(); 20} 21 22$vars = Horde_Variables::getDefaultVariables(); 23$form = new Mnemo_Form_CreateNotepad($vars); 24 25// Execute if the form is valid. 26if ($form->validate($vars)) { 27 try { 28 $notepad = $form->execute(); 29 $notification->push(sprintf(_("The notepad \"%s\" has been created."), $vars->get('name')), 'horde.success'); 30 Horde::url('notepads/edit.php') 31 ->add('n', $notepad->getName()) 32 ->redirect(); 33 } catch (Exception $e) { 34 $notification->push($e); 35 } 36} 37 38$page_output->header(array( 39 'title' => $form->getTitle() 40)); 41$notification->notify(); 42echo $form->renderActive($form->getRenderer(), $vars, Horde::url('notepads/create.php'), 'post'); 43$page_output->footer(); 44