protected function _validPerform($request, $response) { $mail_data = $this->dataspace->export(); if (isset($mail_data['sender_name'])) { $sender_name = $mail_data['sender_name']; } else { $sender_name = $mail_data['sender_firstname'] . ' ' . $mail_data['sender_lastname']; } $body = sprintf(Strings::get('body_template', 'feedback'), $sender_name, $mail_data['sender_email'], $mail_data['body']); $body = str_replace('<br>', "\n", $body); $subject = $this->_getMailSubject(); $recipient_email = $this->_getEmail(); $mailer = $this->_getMailer(); $headers['From'] = $mail_data['sender_email']; $headers['To'] = $recipient_email; $headers['Subject'] = $subject; if (!$recipient_email || !$mailer->send($recipient_email, $headers, $body)) { MessageBox::writeNotice(Strings::get('mail_not_sent', 'feedback')); $request->setStatus(Request::STATUS_FAILUER); return; } MessageBox::writeNotice(Strings::get('message_was_sent', 'feedback')); $request->setStatus(Request::STATUS_FORM_SUBMITTED); $response->redirect($_SERVER['PHP_SELF']); }
protected function _validPerform($request, $response) { $data = $this->dataspace->export(); $request->setStatus(Request::STATUS_FAILURE); if ($request->hasAttribute('popup')) { $response->write(closePopupResponse($request)); } if (!isset($data['ids']) || !is_array($data['ids'])) { return; } $objects = $this->_getObjectsToDelete(array_keys($data['ids'])); foreach ($objects as $id => $item) { if ($item['delete_status'] !== 0) { continue; } $site_object = wrapWithSiteObject($item); try { $site_object->delete(); } catch (LimbException $e) { MessageBox::writeNotice("object {$id} - {$item['title']} couldn't be deleted!"); $request->setStatus(Request::STATUS_FAILURE); throw $e; } } $request->setStatus(Request::STATUS_SUCCESS); $response->write(closePopupResponse($request)); }
function _applyAccessPolicy($object, $action) { $access_policy = new AccessPolicy(); $access_policy->applyAccessTemplates($object, $action); if (catch_error('LimbException', $e)) { } MessageBox::writeNotice("Access template of " . get_class($object) . " for action '{$action}' not defined!!!"); }
protected function _applyAccessPolicy($object, $action) { try { $access_policy = new AccessPolicy(); $access_policy->applyAccessTemplates($object, $action); } catch (LimbException $e) { MessageBox::writeNotice("Access template of " . get_class($object) . " for action '{$action}' not defined!!!"); } }
public function perform($request, $response) { $object = Limb::toolkit()->createSiteObject('UserObject'); if (!$object->activatePassword()) { MessageBox::writeNotice('Password activation failed!'); $request->setStatus(Request::STATUS_FAILED); $response->redirect('/'); } }
protected function _updateObjectOperation() { $this->object->set('files_data', $_FILES[$this->name]); try { $this->object->updateVariations(); } catch (SQLException $e) { throw $e; } catch (LimbException $e) { MessageBox::writeNotice('Some variations were not resized'); } }
function _updateObjectOperation() { $this->object->set('files_data', $_FILES[$this->name]); $this->object->updateVariations(); if (catch_error('SQLException', $e)) { return throw_error($e); } elseif (catch_error('LimbException', $e)) { MessageBox::writeNotice('Some variations were not resized'); } elseif (catch_error('LimbException', $e)) { return throw_error($e); } }
protected function _validPerform($request, $response) { $object = Limb::toolkit()->createSiteObject('PollContainer'); $data = $this->dataspace->export(); $request->setStatus(Request::STATUS_FAILURE); if (!isset($data['answer'])) { MessageBox::writeNotice(Strings::get('no_answer', 'poll')); return; } $object->registerAnswer($data['answer']); $request->setStatus(Request::STATUS_FORM_SUBMITTED); }
function _validPerform(&$request, &$response) { $params = array(); $params['identifier'] = $this->dataspace->get('identifier'); $params['parent_path'] = $this->dataspace->get('parent_path'); $params['class'] = $this->dataspace->get('class_name'); $params['title'] = $this->dataspace->get('title'); $toolkit =& Limb::toolkit(); $object =& $toolkit->createSiteObject($params['Class']); $datasource =& $toolkit->getDatasource('SingleObjectDatasource'); $datasource->setPath($params['parent_path']); $is_root = false; if (!($parent_data = $datasource->fetch())) { if ($params['parent_path'] == '/') { $is_root = true; } else { MessageBox::writeNotice('parent wasn\'t retrieved by path ' . $params['parent_path']); $request->setStatus(Request::STATUS_FAILURE); return; } } if (!$is_root) { $params['parent_node_id'] = $parent_data['node_id']; } else { $params['parent_node_id'] = 0; } $object->merge($params); $object->create($is_root); if (catch_error($e, 'LimbException')) { MessageBox::writeNotice('object wasn\'t registered!'); $request->setStatus(Request::STATUS_FAILURE); return; } elseif (catch_error($e, 'LimbException')) { return throw_error($e); } if (!$is_root) { $parent_object =& $toolkit->createSiteObject($parent_data['ClassName']); $parent_object->merge($parent_data); $controller =& $parent_object->getController(); $action = $controller->determineAction(); $access_policy = new AccessPolicy(); $access_policy->saveNewObjectAccess($object, $parent_object, $action); } $request->setStatus(Request::STATUS_FORM_SUBMITTED); if ($request->hasAttribute('popup')) { $response->write(closePopupResponse($request)); } }