function execute($caveID, $caves) { // get model $model = new Contacts_Model($caveID, $caves); // init error $error = CONTACTS_NOERROR; // add contact $contact = Request::getVar('contact', ''); $error = $model->addContact($contact); // return Show Controller $controller = new Contacts_Show_Controller($error); return $controller->execute($caveID, $caves); }
function execute($caveID, $caves) { // get model $model = new Contacts_Model($caveID, $caves); // init error $error = CONTACTS_NOERROR; // delete contact $contactID = Request::getVar('contactID', 0); $error = $model->deleteContact($contactID); // return Show Controller $controller = new Contacts_Show_Controller($error); return $controller->execute($caveID, $caves); }
function execute($caveID, $caves) { global $params, $config; // get model $model = new Contacts_Model($caveID, $caves); // init error $error = CONTACTS_NOERROR; // add contact $contact = $params->POST->contact; $error = $model->addContact($contact); // return Show Controller $controller = new Contacts_Show_Controller($error); return $controller->execute($caveID, $caves); }
function execute($caveID, $caves) { // get model $model = new Contacts_Model(); // create View $view = new Contacts_Show_View($_SESSION['player']->language, $_SESSION['player']->template); // set tmpl data $view->setContacts($model->getContacts()); if ($this->error) { $view->setError($this->error); } // return view //return $view->toString(); // FIXME return array($view->getTitle(), $view->getContent()); }
function messages_sendMessage($caveID) { global $template; // init messages class $messagesClass = new Messages(); $zeichen = 16384; $subject = Request::isPost('subject', true) ? Request::getVar('subject', '', true) : _('Kein Betreff'); $nachricht = Request::isPost('nachricht', true) ? Request::getVar('nachricht', '', true) : ''; // **** get recipient **** $contactID = Request::getVar('contactID', 0); // get recipient from contactlist $recipient = ""; if ($contactID > 0) { // get contacts model $contacts_model = new Contacts_Model(); $contact = $contacts_model->getContact($contactID); $recipient = $contact['contactname']; // get recipient from textfield } else { $recipient = Request::getVar('recipient', ''); } // open template $template->setFile('messageDialogue.tmpl'); $template->setShowResource(false); if (strlen($nachricht) > $zeichen || empty($nachricht)) { $message = array('type' => 'error', 'message' => sprintf(_('Fehler! Nachricht konnte nicht verschickt werden! Stellen Sie sicher, dass die Nachricht nicht länger als %d Zeichen oder leer ist.'), $zeichen)); $template->addVars(array('box' => Request::getVar('box', BOX_INCOMING), 'status_msg' => $message, 'sender' => $_SESSION['player']->name, 'recipient' => $recipient, 'subject' => $subject, 'nachricht' => $nachricht, 'hidden' => array(array('arg' => "box", 'value' => Request::getVar('box', BOX_INCOMING)), array('arg' => "caveID", 'value' => $caveID), array('arg' => "modus", 'value' => NEW_MESSAGE_RESPONSE)))); return; } if ($messagesClass->insertMessageIntoDB($recipient, $subject, $nachricht)) { $template->addVar('status_msg', array('type' => 'success', 'message' => _('Ihre Nachricht wurde verschickt!'))); messages_getMessages($caveID, 0, BOX_INCOMING); return; } else { $message = array('type' => 'error', 'message' => _('Fehler! Nachricht konnte nicht verschickt werden! Stellen Sie sicher, dass es den angegebenen Empfänger gibt.')); $template->addVars(array('box' => Request::getVar('box', BOX_INCOMING), 'status_msg' => $message, 'sender' => $_SESSION['player']->name, 'recipient' => $recipient, 'subject' => $subject, 'nachricht' => $nachricht, 'hidden' => array(array('arg' => "box", 'value' => Request::getVar('box', BOX_INCOMING)), array('arg' => "caveID", 'value' => $caveID), array('arg' => "modus", 'value' => NEW_MESSAGE_RESPONSE)))); } }
function messages_sendMessage($caveID) { global $no_resource_flag, $params, $config; $no_resource_flag = 1; $zeichen = 16384; $betreff = $params->POST->betreff; $nachricht = $_POST["nachricht"]; $nachricht = preg_replace("/(<)/", "_THIS_MUST_BE_LOWER_THEN_", $nachricht); $nachricht = preg_replace("/(>)/", "_THIS_MUST_BE_GREATER_THEN_", $nachricht); $nachricht = nl2br(clean($nachricht)); $nachricht = preg_replace("/(_THIS_MUST_BE_LOWER_THEN_)/", "<", $nachricht); $nachricht = preg_replace("/_THIS_MUST_BE_GREATER_THEN_/", ">", $nachricht); // **** get recipient **** $contactID = $params->POST->contactID; // get recipient from contactlist $empfaenger = ""; if ($contactID > 0) { // get contacts model $contacts_model = new Contacts_Model(); $contact = $contacts_model->getContact($contactID); $empfaenger = $contact['contactname']; // get recipient from textfield } else { $empfaenger = $params->POST->empfaenger; } if ($betreff == "") { $betreff = _('<leer>'); } $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'messageResponse.ihtml'); if (strlen($nachricht) > $zeichen) { tmpl_set($template, 'success', sprintf(_('Fehler! Nachricht konnte nicht verschickt werden! Stellen Sie sicher, dass die Nachricht nicht länger als %d Zeichen ist.'), $zeichen)); } if (messages_insertMessageIntoDB($empfaenger, $betreff, $nachricht)) { tmpl_set($template, 'success', _('Ihre Nachricht wurde verschickt!')); } else { tmpl_set($template, 'success', _('Fehler! Nachricht konnte nicht verschickt werden! Stellen Sie sicher, dass es den angegebenen Empfänger gibt.')); } tmpl_set($template, 'linkbackparams', '?modus=messages&box=' . $params->POST->box); return tmpl_parse($template); }