function execute(ActionMapping $map, ActionForm $form, Request $req) { global $papyrine; $papyrine->entries =& $papyrine->getEntries(); // Instantiate the HTML_QuickForm object require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/group.php'; $form = new HTML_QuickForm('create_entry'); $form->addElement('text', 'title', 'Title:'); $form->addElement('text', 'date', 'Date:'); $form->addElement('text', 'status', 'Status:'); // Get the default handler $form->addElement('text', 'body', 'Body:'); $form->addElement('submit', null, 'Create'); // Define filters and validation rules $form->applyFilter('name', 'trim'); $form->addRule('name', 'Please enter your name', 'required', null, 'client'); //get classes registered for entry //call method $plugin = new PapyrinePlugin(BASE . 'plugins/categories/'); $object = $plugin->getInstance(); $object->recieveNewEntryForm($form); $plugin = new PapyrinePlugin(BASE . 'plugins/comments/'); $object = $plugin->getInstance(); $object->recieveNewEntryForm($form); // Output the form $papyrine->form = $form->toHTML(); header("Content-Type: application/xhtml+xml;charset=UTF-8"); $papyrine->display('admin/header.html'); $papyrine->display($map->getParameter()); $papyrine->display('admin/footer.html'); }
function execute(ActionMapping $map, ActionForm $form, Request $req) { global $papyrine; $papyrine->categories =& $papyrine->getCategories(); header("Content-Type: application/xhtml+xml;charset=UTF-8"); $papyrine->display('admin/header.html'); $papyrine->display($map->getParameter()); $papyrine->display('admin/footer.html'); }
function execute(ActionMapping $map, ActionForm $form, Request $req) { global $papyrine; $sections = array("Entries" => SITE . 'administration/entries', "Users" => SITE . 'administration/users', "Plugin Manager" => SITE . 'administration/plugins'); $plugin = new PapyrinePlugin(BASE . 'plugins/categories/'); $object = $plugin->getInstance(); $object->recieveSectionArray($sections); $plugin = new PapyrinePlugin(BASE . 'plugins/comments/'); $object = $plugin->getInstance(); $object->recieveSectionArray($sections); $papyrine->sections =& $sections; header("Content-Type: application/xhtml+xml;charset=UTF-8"); $papyrine->display('admin/header.html'); $papyrine->display($map->getParameter()); $papyrine->display('admin/footer.html'); }
/** * Metodo responsavel por criar o array de objetos ActionMapping * @return : void */ private function createActionsMappings() { $actionsList = $this->_document->getElementsByTagName('action'); foreach ($actionsList as $action) { $actionMapping = new ActionMapping(); if ($action->hasAttribute("ssl")) { if ($action->getAttribute("ssl") == "false") { $actionMapping->setSSL(0); } else { $actionMapping->setSSL(1); } } if ($action->hasAttribute("authentication")) { if ($action->getAttribute("authentication") == "false") { $actionMapping->setAuthentication(0); } else { $actionMapping->setAuthentication(1); } } if ($action->hasChildNodes()) { $actionChildNode = $action->childNodes; foreach ($actionChildNode as $actionChild) { if ($actionChild->nodeName == "name") { $actionMapping->setName($actionChild->nodeValue); } if ($actionChild->nodeName == "type") { $actionMapping->setType($actionChild->nodeValue); } if ($actionChild->nodeName == "role") { $actionMapping->setRole($actionChild->nodeValue); } if ($actionChild->nodeName == "forwards") { $actionMapping->setForwards($this->createForwards($actionChild)); } if ($actionChild->nodeName == "validation") { $actionMapping->setValidations($this->createValidation($actionChild)); } } $this->_actionsMapping[] = $actionMapping; } } }
public function getAction($name) { if (!empty($name)) { foreach ($this->getConfiguration()->actions->action as $action) { if ($action["name"] == $name) { $map = new ActionMapping(); try { $map->setInput($action["input"]); $map->setClass($action["class"]); $map->setName($action["name"]); $map->setFormName($action["form"]); if ($this->getForward($action["forward"])) { $map->setForward($this->getForward($action["forward"])); } $map->setPath($action["path"]); $map->setValidate((bool) $action["validate"]); $map->setRoles($action["roles"]); $map->setParameter($action["parameter"]); $forwards = array(); foreach ($action->forward as $key => $forward) { $forwards[] = new ActionForward($forward["name"], $forward["path"]); } $map->setForwards($forwards); return $map; } catch (Exception $e) { throw new ConfigurationException("Action: {$action['name']}"); } } } throw new ActionNotFoundException("Action: {$name}"); } else { throw new EmptyStringException(); } }
$roons = $_REQUEST["roons"]; if (count($roons) > 0) { foreach ($roons as $room) { //If the room doesn't belong to the user and it isn't active, nothing will be printed if (!($room->getUserId() != $_SESSION['id'] && $room->getActive() == 0)) { // Instantiates the permissions of the room $_POST['currentRoom'] = $room->getRoomId(); $action = new ActionMapping(); $action->setName("listPermissions"); $action->setType("ListPermissionsAction"); $action->setRole(""); $listPermissionsAction = new ListPermissionsAction(); $listPermissionsAction->execute($action); $permissions = $_REQUEST["permissions"]; // List users $action = new ActionMapping(); $action->setName("listUsers"); $action->setType("ListUsersAction"); $action->setRole(""); $listUsersAction = new ListUsersAction(); $listUsersAction->execute($action); $listUsers = $_REQUEST['users']; if (isset($listEnableUsers) || isset($listAllowedUsers)) { unset($listEnableUsers); unset($listAllowedUsers); } // Coloca em um vetor os usuários que ainda não tem permissão na sala corrente foreach ($listUsers as $user) { if ($user->getUserId() != $_SESSION['id']) { foreach ($permissions as $permission) { if ($user->getUserId() == $permission->getUserId()) {
function execute(ActionMapping $map, ActionForm $form, Request $req) { global $papyrine; header("Content-Type: application/xhtml+xml;charset=UTF-8"); $papyrine->display($map->getParameter()); }
public function execute($action) { //error_reporting(E_ALL); //ini_set("display_errors", 1); $forwards = $action->getForwards(); $strJson = str_replace('\\', '', $_POST['json']); $json = json_decode(utf8_encode($strJson)); $data = $json->{'logindata'}; $sucess = false; $createdUser = false; if (!is_null($data->{'email'})) { $user = $this->dao->getUserByEmail($data->{'email'}); if (!$user) { // Store a new user $user = new User(); $user->setName($data->{'name'}); $user->setEmail($data->{'email'}); $user->setPassword($data->{'passoword'}); if ($data->{'roomCreator'} == 'F0') { $user->setRoomcreator(true); } else { $user->setRoomcreator(false); } // Saving a new user $this->dao->saveNewUser($user); $createdUser = true; } //else{ //TODO verificar a senha //} // Store data in PHP SESSION if ($user) { $sucess = true; $_SESSION['id'] = $user->getUserId(); $_SESSION['name'] = $user->getName(); $_SESSION['roomCreator'] = $user->getRoomcreator(); $_SESSION['email'] = $user->getEmail(); $_SESSION['user'] = $user; } else { //TODO ajustar quando o login nao funciona $sucess = false; $_REQUEST["errorMsg"] = $this->message->getText("error.loginFail"); $this->pageController->run($forwards['error']); } } else { //TODO ajustar quando o login nao funciona $sucess = false; $_REQUEST["errorMsg"] = $this->message->getText("error.loginFail"); $this->pageController->run($forwards['error']); } if ($createdUser == true) { // Verifica se o usuario foi criado, se sim, manda para uma pagina de sucesso $action = new ActionMapping(); $action->setName("createdUserSuccess"); $action->setType("ForwardAction"); $action->setRole(""); $action->setForwards(array("success" => ".createdUserSuccess")); $forwardAction = new ForwardAction(); $forwardAction->execute($action); } else { if ($sucess) { $_REQUEST["msg"] = "Sua conta foi criada com sucesso no Quadro Branco, por favor, volte e entre novamente"; $action = new ActionMapping(); $action->setName("listRoons"); $action->setType("ListRoonsAction"); $action->setRole(""); $action->setForwards(array("success" => ".showUserPage", "error" => ".error")); $listRoonsAction = new ListRoonsAction(); $listRoonsAction->execute($action); } } }
/** * Returns true if the current user is the owner of the room. * * @param : Nothing * @return Boolean : True to the owner of the room */ function isRoomOwner() { if (!isset($_GET['idRoom'])) { $_GET['idRoom'] = $_SESSION['idRoomAux']; unset($_SESSION['idRoomAux']); } $action = new ActionMapping(); $action->setName("listRoons"); $action->setType("ListRoonsAction"); $action->setRole(""); $listRoonsAction = new ListRoonsAction(); $listRoonsAction->execute($action); $roons = $_REQUEST["roons"]; foreach ($roons as $room) { if ($room->getRoomId() == $_GET['idRoom'] && $room->getUserId() == $_SESSION['id']) { $control = true; $_SESSION['roomOwner'] = $room->getUserId(); } } return $control; }
public function execute($action) { if (isset($_SESSION["idRoom"])) { // Setting the room state to off $this->dao->updateRoomState($_SESSION["idRoom"], false, 0); } unset($_SESSION['id']); unset($_SESSION['name']); unset($_SESSION['user']); session_destroy(); $action = new ActionMapping(); $action->setName("loginForm"); $action->setType("ForwardAction"); $action->setRole(""); $action->setForwards(array("success" => ".showLoginForm", "error" => ".error")); $forwardAction = new ForwardAction(); $forwardAction->execute($action); }
?> <?php $msgs = Localization::getInstance(); // List users $action = new ActionMapping(); $action->setName("listUsers"); $action->setType("ListUsersAction"); $action->setRole(""); $listUsersAction = new ListUsersAction(); $listUsersAction->execute($action); $listUsers = $_REQUEST['users']; $listUsers2 = $_REQUEST['users']; // List permissions $_POST['currentRoom'] = $_GET['idRoom']; $action = new ActionMapping(); $action->setName("listPermissions"); $action->setType("ListPermissionsAction"); $action->setRole(""); $listPermissionsAction = new ListPermissionsAction(); $listPermissionsAction->execute($action); $listPermissions = $_REQUEST["permissions"]; ?> <script type="text/javascript"> $('#textBtnLeft3').focus(function(){ $('#textInviteFriendSubmit').focus(); }) $('#selectelectedUsers3').focus(function(){ $('#selectAllUsers3').focus(); })