public function testHasMethods() { foreach ($this->messages as $message) { $m = new Message(); $m->setMessage($message['message']); $m->setPriority($message['priority']); $this->assertFalse($m->hasTitle()); $this->assertFalse($m->hasUrl()); $this->assertFalse($m->hasUrlTitle()); $this->assertFalse($m->hasSound()); $this->assertFalse($m->hasHtml()); $this->assertFalse($m->hasDate()); } foreach ($this->messages as $message) { $m = new Message(); $m->setTitle($message['title']); $m->setMessage($message['message']); $m->setUrl($message['url']); $m->setUrlTitle($message['url_title']); $m->setPriority($message['priority']); $m->setSound($message['sound']); $m->setHtml($message['html']); $m->setDate(new \DateTime($message['date'])); $this->assertTrue($m->hasTitle()); $this->assertTrue($m->hasUrl()); $this->assertTrue($m->hasUrlTitle()); $this->assertTrue($m->hasSound()); $this->assertTrue($m->hasHtml()); $this->assertTrue($m->hasDate()); } }
public function testSetGet() { $now = new \DateTime(); $testCase = ['id' => 123, 'level' => 2, 'subject' => 'TEST SUBJECT', 'message' => 'TEST MESSAGE', 'source' => 'TEST_SOURCE', 'dateCreated' => $now, 'dateCreatedString' => $now->format(\DateTime::ISO8601)]; $unit = new Message(); $unit->setId($testCase['id']); $this->assertEquals($testCase['id'], $unit->getId()); $unit->setLevel(0); $this->assertEquals(Message::LEVEL_DEFAULT, $unit->getLevel()); $unit->setLevel($testCase['level']); $this->assertEquals($testCase['level'], $unit->getLevel()); $unit->setSubject($testCase['subject']); $this->assertEquals($testCase['subject'], $unit->getSubject()); $unit->setMessage($testCase['message']); $this->assertEquals($testCase['message'], $unit->getMessage()); $unit->setSource(''); $this->assertNull($unit->getSource()); $unit->setSource($testCase['source']); $this->assertEquals($testCase['source'], $unit->getSource()); $unit->setDateCreated(null); $this->assertNull($unit->getDateCreatedString()); $unit->setDateCreated($testCase['dateCreated']); $this->assertEquals($testCase['dateCreated'], $unit->getDateCreated()); $unit->setDateCreatedString($testCase['dateCreatedString']); $this->assertEquals($testCase['dateCreatedString'], $unit->getDateCreatedString()); $this->assertEquals($testCase['id'], $unit->toArray()['id']); $this->assertTrue(is_array($unit->toArray())); }
/** * Logs out a user and resets the complete session * @author Clemens John <*****@*****.**> * @return boolean true if the logout was successfull */ public function user_logout() { if (!isset($_SESSION['user_id'])) { $messages[] = array("Sie können sich nicht ausloggen, wenn Sie nicht eingeloggt sind", 2); Message::setMessage($messages); return false; } else { //destroy current session //to correctly destroy a session look at http://php.net/manual/de/function.session-destroy.php $stmt = DB::getInstance()->prepare("UPDATE users SET session_id = ? WHERE id = ?"); $stmt->execute(array('', $_SESSION['user_id'])); //delete all Remember-Mes from the database (TODO: this could be improved by storing //the current session id along with the remember me and then delete only the remember me //coresponding to the current session. $user_remember_me_list = new UserRememberMeList($_SESSION['user_id']); $user_remember_me_list->delete(); unset($_SESSION); unset($_COOKIE); setcookie("remember_me", "", time() - 60 * 60 * 24 * 14); setcookie(session_name(), '', time() - 3600, '/'); if (ini_get("session.use_cookies")) { $params = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]); } session_destroy(); session_start(); $messages[] = array("Sie wurden ausgeloggt und ihre Benutzersession wurde gelöscht!", 1); Message::setMessage($messages); return true; } }
static function setWarningMessage($msg = null) { if ($msg == null) { $msg = "This action can cause this."; } $class = "warning"; Message::setMessage($class, $msg); }
function convertToMessage($msg) { $message = new Message(); $message->setId($msg['id']); $message->setDate($msg['sent_date']); $message->setFrom($msg['msg_from']); $message->setMessage($msg['message']); $message->setSubject($msg['subject']); return $message; }
private function parse() { switch ($this->messageElement->getAttribute('type')) { case 'error': $this->message = new Error(); break; case 'warning': $this->message = new Warning(); $this->message->setLevel($this->messageElement->getAttribute('level')); break; default: return false; } $this->message->setRef($this->messageElement->getAttribute('ref')); $contextNode = $this->messageElement->getElementsByTagName('context')->item(0); $this->message->setContext($contextNode->nodeValue); $this->message->setLineNumber($contextNode->getAttribute('line')); $this->message->setMessage(trim($this->messageElement->getElementsByTagName('title')->item(0)->nodeValue)); }
public function testSetGet() { $message = new Message('success', true); $this->assertEquals('success', $message->getMessage()); $this->assertEquals(true, $message->hasSuccess()); $message = new Message('failure', false); $this->assertEquals('failure', $message->getMessage()); $this->assertEquals(false, $message->hasSuccess()); $message->setMessage('success'); $message->setSuccess(true); $this->assertEquals('success', $message->getMessage()); $this->assertEquals(true, $message->hasSuccess()); $record = $message->getRecordInfo(); $this->assertEquals(array('message' => 'success', 'success' => true), $record->getData()); }
public function postTwitterMessage($statusMessage) { //Send Message to twitter $config_line = ConfigLine::configByName('twitter_token'); if (ConfigLine::configByName('twitter_username') and $config_line) { $config = array('callbackUrl' => 'http://example.com/callback.php', 'siteUrl' => 'http://twitter.com/oauth', 'consumerKey' => ConfigLine::configByName('twitter_consumer_key'), 'consumerSecret' => ConfigLine::configByName('twitter_consumer_secret')); $token = unserialize($config_line); $client = $token->getHttpClient($config); $client->setUri('https://api.twitter.com/1.1/statuses/update.json'); $client->setMethod(Zend_Http_Client::POST); $client->setParameterPost('status', $statusMessage); $response = $client->request(); if ($response->getStatus() == 200) { $message[] = array("Folgendes wurde auf dem Twitteraccount von <a href=\"http://twitter.com/" . ConfigLine::configByName('twitter_username') . "\">" . ConfigLine::configByName('twitter_username') . "</a> angekündigt: <i>\"{$statusMessage}\"</i>", 1); } else { $message[] = array("Beim senden der Twitternachricht ist folgender Fehler aufgetreten: " . $response->getStatus(), 0); } Message::setMessage($message); } }
function view($file, $data = false) { if ($data) { extract($data); } include $file; } // Load todo class $todo = new Todo(); // Add todo if (isset($_POST['addTodo'])) { if ($_POST['description'] !== '') { $description = $_POST['description']; $todo->add($description); } else { Message::setMessage('Ahh, damn. Lege todos zijn niet toegestaan...', 'error'); } } // Check activation if (isset($_POST['toggleTodo'])) { $id = $_POST['toggleTodo']; $todo->toggle($id); } // Delete todo if (isset($_POST['deleteTodo'])) { $id = $_POST['deleteTodo']; $todo->delete($id); } // Load todos $todoItems = $todo->getActiveItems(false); $doneItems = $todo->getActiveItems(true);
} else { Permission::denyAccess(PERM_USER); } } elseif ($_GET['section'] == 'insert_add') { if (Permission::checkPermission(PERM_USER)) { $dns_ressource_record = new DnsRessourceRecord(false, (int) $_POST['dns_zone_id'], (int) $_SESSION['user_id'], $_POST['host'], $_POST['type'], $_POST['pri'], (int) $_POST['destination']); if ($dns_ressource_record->store()) { $message[] = array('Der Ressource Record ' . $dns_ressource_record->getHost() . ' wurde gespeichert.', 1); } else { $message[] = array('Der Ressource Record konnte nicht gespeichert werden.', 2); } Message::setMessage($message); header('Location: ./dns_zone.php?dns_zone_id=' . $_POST['dns_zone_id']); } else { Permission::denyAccess(PERM_USER); } } elseif ($_GET['section'] == 'delete') { $dns_ressource_record = new DnsRessourceRecord((int) $_GET['dns_ressource_record_id']); $dns_ressource_record->fetch(); if (permission::checkIfUserIsOwnerOrPermitted(PERM_ROOT, $dns_ressource_record->getUserId())) { if ($dns_ressource_record->delete()) { $message[] = array('Der Ressource Record ' . $dns_ressource_record->getHost() . ' wurde gelöscht.', 1); } else { $message[] = array('Der Ressource Record ' . $dns_ressource_record->getHost() . ' konnte nicht gelöscht werden.', 2); } Message::setMessage($message); header('Location: ./dns_zone.php?dns_zone_id=' . $dns_ressource_record->getDnsZoneId()); } else { Permission::denyAccess(PERM_ROOT, $dns_ressource_record->getUserId()); } }
<?php require_once 'autoload.php'; include 'checksession.php'; if (!checksession()) { header('Location: login.php'); } if (isset($_POST['message'])) { $msg = new Message(); $msg->setFrom($_SESSION['operatorid']); $msg->setMessage($_POST['message']); $msg->sendMessagesTo($_POST['opid']); if ($_FILES['mfile']['size'][0] > 0) { ///put all files held in $_FILE[mfile] in to a new array $new_arr $new_arr = array(); $files = $_FILES['mfile']; $num = count($files["name"]); for ($i = 0; $i < $num; $i++) { $new_arr[$i] = array(); } foreach ($files as $key => $row) { for ($i = 0; $i < $num; $i++) { $new_arr[$i][$key] = $files[$key][$i]; } } ///create a new upload object and upload each file foreach ($new_arr as $key => $value) { $params['upload_path'] = 'messages/'; $params['max_file_size'] = 1000000; $params['linkid'] = $msg->getLinkID(); $params['tablename'] = 'Message_Image';
/** * get Message with customized content * * shorthand for getting a customized message * * @param string $message A localized string * @param integer $type A numeric representation of the type of message * * @return Message * @static */ public static function raw($message, $type = Message::NOTICE) { $r = new Message('', $type); $r->setMessage($message); return $r; }
/** * Deny acces to a special section. Sets a deny message and forwards the user to the login site. * @author Clemens John <*****@*****.**> */ public static function denyAccess($permission = false, $owner = false) { // if $permission is != false, then get the Names of the Roles that are wrapped into $permission if ($permission) { $role_string = ""; foreach (Permission::getRolesByPermission($permission) as $key => $role) { if ($key) { $role_string .= ", "; } $role_string .= permission::getRoleNameByRoleNumber($role); } } if ($owner) { $user = new User($owner); $user->fetch(); } // prepare the "permission denied"-message for the user based on the combination of $permission and $owner if ($permission and !$owner) { $message[] = array("Auf diesen Bereich dürfen nur Benutzer mit den folgenden Rechten zugreifen: " . $role_string, 2); } elseif (!$permission and $owner) { $message[] = array("Auf diesen Bereich darf nur der Benutzer " . $user->getNickname() . " zugreifen.", 2); } elseif ($permission and $owner) { $message[] = array("Auf diesen Bereich dürfen nur der Benutzer " . $user->getNickname() . " oder Benutzer mit den folgenden Rechten zugreifen: " . $role_string, 2); } else { $message[] = array("Du darfst auf diesen Bereich nicht zugreifen.", 2); } // set the message Message::setMessage($message); // redirect the user to the last page he visited if it was a page inside netmon // if the page was not inside netmon, redirect to the default path if (!empty($_SESSION['last_page']) and $_SESSION['last_page'] != $_SESSION['current_page']) { header('Location: ' . $_SESSION['last_page']); } else { header('Location: ./'); } }
/** * Insert the changes on a user into the database * @author Clemens John <*****@*****.**> * @param $user_id * @param $changepassword * @param $permission * @param $oldpassword * @param $newpassword * @param $newpasswordchk * @param $openid * @param $vorname * @param $nachname * @param $strasse * @param $plz * @param $ort * @param $telefon * @param $email * @param $jabber * @param $icq * @param $website * @param $about * @param $notification_method * @return boolean if the user was edited successfull */ public function userInsertEdit($user_id, $changepassword, $permission, $oldpassword, $newpassword, $newpasswordchk, $openid, $vorname, $nachname, $strasse, $plz, $ort, $telefon, $email, $jabber, $icq, $website, $about, $notification_method) { $user_data = User_old::getUserByID($user_id); $message = array(); //check weatcher the given data is valid $phpass = new PasswordHash(8, false); if ($changepassword and !$phpass->CheckPassword($oldpassword, $user_data['password'])) { $message[] = array("Dein altes Passwort ist nicht richtig.", 2); } elseif ($changepassword and empty($newpassword)) { $message[] = array("Du musst ein neues Passwort angeben.", 2); } elseif ($changepassword and $newpassword != $newpasswordchk) { $message[] = array("Deine beiden neuen Passwörter stimmen nicht überein.", 2); } elseif (empty($email)) { $message[] = array("Du musst eine Emailadresse angeben.", 2); } elseif (!User_old::isUniqueEmail($email, $user_id)) { $message[] = array("Es existiert bereits ein Benutzer mit der ausgewhälten Emailadresse <i>{$email}</i>.", 2); } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $message[] = array("Die ausgewählte Emailadresse " . $email . " ist keine gültige Emailadresse.", 2); } elseif (!empty($jabber) and !filter_var($jabber, FILTER_VALIDATE_EMAIL)) { $message[] = array("Die ausgewählte Jabberadresse " . $jabber . " ist keine gültige Jabberadresse.", 2); } elseif (!empty($openid) and !User_old::isUniqueOpenID($openid, $user_id)) { $message[] = array("Die ausgewählte OpenID <i>" . $openid . "</i> ist bereits mit einem Benutzer verknüpft.", 2); } //if the user data is not valid, return false if (count($message) > 0) { Message::setMessage($message); return false; } //if user wants to set a new password, encrypt new password if ($changepassword) { $newpassword = $phpass->HashPassword($newpassword); if (strlen($newpassword) < 20) { $message[] = array("Beim Hashen des neuen Passworts trat ein Fehler auf.", 2); Message::setMessage($message); return false; } } else { $newpassword = $user_data['password']; } if (!$permission) { $newpermission = $user_data['permission']; } else { $newpermission = 0; foreach ($permission as $dual) { $newpermission += $dual; } } //if all checks are okay, update the data into the database $stmt = DB::getInstance()->prepare("UPDATE users SET \n\t\t\t\t\t\t\t permission = ?, password = ?, openid = ?, vorname = ?, nachname = ?,\n\t\t\t\t\t\t\t strasse = ?, plz = ?, ort = ?, telefon = ?, email = ?, jabber = ?,\n\t\t\t\t\t\t\t icq = ?, website = ?, about = ?, notification_method = ?\n\t\t\t\t\t\t WHERE id = ?"); $stmt->execute(array($newpermission, $newpassword, $openid, $vorname, $nachname, $strasse, $plz, $ort, $telefon, $email, $jabber, $icq, $website, $about, $notification_method, $user_id)); $message[] = array("Die Daten von {$user_data['nickname']} wurden geändert", 1); message::setMessage($message); return true; }
/** */ public function updateMessageIfNewest(Project $project, $bundle, $key, $language, $catalog, $lastModification, $message) { if (!$bundle || !$language || !$key || !$lastModification || !$message) { return $this->exception('Validation exceptions, missing parameters'); } /** @var Key $keyRecord */ $keyRecord = $this->getKeyRepository()->findOneBy(array('project' => $project, 'bundle' => $bundle, 'key' => $key, 'catalog' => $catalog)); if (!$keyRecord) { $keyRecord = new Key(); $keyRecord->setProject($project); $keyRecord->setKey($key); $keyRecord->setBundle($bundle); $keyRecord->setCatalog($catalog); $this->em->persist($keyRecord); $this->em->flush(); } /** @var Message $messageRecord */ $messageRecord = $this->getMessageRepository()->findOneBy(array('key' => $keyRecord, 'language' => $language)); if (!$messageRecord) { $messageRecord = new Message(); $messageRecord->setKey($keyRecord); $messageRecord->setLanguage($language); } else { if ($messageRecord->getUpdatedAt() >= $lastModification) { return $this->resultOk(array('updated' => false, 'message' => $messageRecord->getMessage(), 'updatedAt' => $messageRecord->getUpdatedAt()->format('c'))); } } $messageRecord->setMessage($message); $messageRecord->setUpdatedAt($lastModification); $this->em->persist($messageRecord); $this->em->flush($messageRecord); return $this->resultOk(array('updated' => true, 'message' => $messageRecord->getMessage(), 'updatedAt' => $messageRecord->getUpdatedAt()->format('c'))); }
/** * Compose a new message, and process new message submissions * @parm int $reply message ID this message is in reply to [optional] only used to pre-populate subject and recipient * @return void */ private function newMessage($reply = 0) { $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'messages/create.tpl.php', 'footer.tpl.php'); require_once FRAMEWORK_PATH . 'models/relationships.php'; $relationships = new Relationships($this->registry); if (isset($_POST) && count($_POST) > 0) { $network = $relationships->getNetwork($this->registry->getObject('authenticate')->getUser()->getUserID()); $recipient = intval($_POST['recipient']); if (in_array($recipient, $network)) { // this additional check may not be something we require for private messages? require_once FRAMEWORK_PATH . 'models/message.php'; $message = new Message($this->registry, 0); $message->setSender($this->registry->getObject('authenticate')->getUser()->getUserID()); $message->setRecipient($recipient); $message->setSubject($this->registry->getObject('db')->sanitizeData($_POST['subject'])); $message->setMessage($this->registry->getObject('db')->sanitizeData($_POST['message'])); $message->save(); // email notification to the recipient perhaps?? // confirm, and redirect $url = $this->registry->getObject('url')->buildURL(array('messages'), '', false); $this->registry->redirectUser($url, 'Message sent', 'The message has been sent'); } else { $this->registry->errorPage('Invalid recipient', 'Sorry, you can only send messages to your recipients'); } } else { $cache = $relationships->getByUser($this->registry->getObject('authenticate')->getUser()->getUserID()); $this->registry->getObject('template')->getPage()->addTag('recipients', array('SQL', $cache)); if ($reply > 0) { require_once FRAMEWORK_PATH . 'models/message.php'; $message = new Message($this->registry, $reply); if ($message->getRecipient() == $this->registry->getObject('authenticate')->getUser()->getUserID()) { $this->registry->getObject('template')->getPage()->addAdditionalParsingData('recipients', 'ID', $message->getSender(), 'opt', "selected='selected'"); $this->registry->getObject('template')->getPage()->addTag('subject', 'Re: ' . $message->getSubject()); } else { $this->registry->getObject('template')->getPage()->addTag('subject', ''); } } else { $this->registry->getObject('template')->getPage()->addTag('subject', ''); } } }
public function sendMessage() { if (isset($_POST['send-msg'])) { $to = $_POST['msgTo']; $msg = new Message(); $msg->setTo($to); $currentUser = wp_get_current_user(); $msg->setFrom($currentUser->ID); $msg->setSubject($_POST['subject']); $msg->setMessage($_POST['message']); $msg->send(); $this->redirect(admin_url('admin.php?page=vmp-msgs')); } }
if ($phpass->CheckPassword($password, $user_remember_me->getPassword())) { //if a remember me matches, then login and set a new random password on the remember me //store the session-id to the database $stmt = DB::getInstance()->prepare("UPDATE users SET session_id = ? WHERE id = ?"); $stmt->execute(array(session_id(), $user_data['id'])); //store the $_SESSION['user_id'] = $user_data['id']; //generate long random password $random_password = Helper::randomPassword(56); //hash the random password like a normal password $random_password_hash = $phpass->HashPassword($random_password); $user_remember_me->setPassword($random_password_hash); $user_remember_me->store(); setcookie("remember_me", $user_id . "," . $random_password, time() + 60 * 60 * 24 * 14); $messages[] = array("Herzlich willkommen zurück " . $user_data['nickname'] . ".", 1); Message::setMessage($messages); break; } } } } } //load menus if ($GLOBALS['installed']) { $smarty->assign('top_menu', Menus::topMenu()); $smarty->assign('loginOutMenu', Menus::loginOutMenu()); $smarty->assign('normal_menu', Menus::normalMenu()); $smarty->assign('object_menu', Menus::objectMenu()); $smarty->assign('admin_menu', Menus::adminMenu()); $smarty->assign('root_menu', Menus::rootMenu()); $smarty->assign('menu_community_homepage', ConfigLine::configByName('community_homepage'));
/** * Sends a mail to a user who forgot his password with a new password and a link that lets the user set this new password * @author Clemens John <*****@*****.**> * @param $user_id id of the user that wants to set a new password * @param $email email of the user that wants to set a new password * @param $nickname nickname of the user that wants to set a new password * @param $newpassword new plain text password for the user * @param $new_password_hash the hash of the new password. This hash is used to generate a link wich makes * the user able to set this hash for his new password * @param $old_password_hash the hash of the old password. This hash is used to generate a link wich makes * the user able to set this hash for his new password * @return boolean true if the mail was sent successfull */ public function sendPassword($user_id, $email, $nickname, $newpassword, $new_password_hash, $old_password_hash) { $text = "Hallo {$nickname},\n\n"; $text .= "du hast ein neues Passwort fuer die Netmon-Installation von " . ConfigLine::configByName('community_name') . " angefordert. Deine neuen Logindaten lauten:\n\n"; $text .= "Nickname: {$nickname}\n"; $text .= "Passwort: {$newpassword}\n\n"; $text .= "Bitte bestaetige die Aenderungen mit einem Klick auf diesen Link:\n"; $text .= ConfigLine::configByName('url_to_netmon') . "/set_new_password.php?user_id={$user_id}&new_passwordhash={$new_password_hash}&oldpassword_hash={$old_password_hash}\n\n"; $text .= "Hinweis: sollte das Anklicken des Links nicht funktionieren musst du den link vollstaendig in die Adressleiste deines Webbrowsers kopieren.\n\n"; $text .= "Liebe Gruesse\n"; $text .= ConfigLine::configByName('community_name'); if ($GLOBALS['mail_sending_type'] == 'smtp') { $config = array('username' => $GLOBALS['mail_smtp_username'], 'password' => $GLOBALS['mail_smtp_password']); if (!empty($GLOBALS['mail_smtp_ssl'])) { $config['ssl'] = $GLOBALS['mail_smtp_ssl']; } if (!empty($GLOBALS['mail_smtp_login_auth'])) { $config['auth'] = $GLOBALS['mail_smtp_login_auth']; } $transport = new Zend_Mail_Transport_Smtp($GLOBALS['mail_smtp_server'], $config); } $mail = new Zend_Mail(); $mail->setFrom($GLOBALS['mail_sender_adress'], $GLOBALS['mail_sender_name']); $mail->addTo($email); $mail->setSubject("Neues Netmon Passwort fuer " . ConfigLine::configByName('community_name')); $mail->setBodyText($text); $mail->send($transport); $message[] = array("Dir wurde ein neues Passwort zugesendet.", 1); Message::setMessage($message); return true; }
NOW()) '; $placeholders = array(":inhoud" => $inhoud, ":email" => $user); // Query uitvoeren $db->query($insertQuery, $placeholders); Helper::redirect('application.php'); } if (isset($_POST['delete'])) { $verwijder = $_POST['delete']; $deleteQuery = "DELETE FROM todo\n WHERE todo.id_todo = :id_todo\n LIMIT 1"; $deleteQueryPlaceholders = array(':id_todo' => $verwijder); $db->query($deleteQuery, $deleteQueryPlaceholders); Helper::redirect('application.php'); } } catch (Exception $e) { Message::setMessage($e->getMessage(), 'error'); } $message = Message::getMessage(); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="css/global.css"> <title>Labo-applicatieapp</title> </head> <body> <nav>
include "ContentManager/Managers/ManageAdmin.php"; include "WebObjects/HTMLContainer.php"; include "WebObjects/HTMLPage.php"; include "WebObjects/Login.php"; include "WebObjects/Page.php"; include "WebObjects/AdminPage.php"; include "WebObjects/Panels/MainPanel.php"; include "WebObjects/Panels/Left/DuomenuAnalizePanel.php"; include "WebObjects/Panels/Left/Prognozes.php"; include "WebObjects/Panels/Left/Filters.php"; include "WebObjects/Panels/Left/UserManage.php"; include "WebObjects/Panels/Left/TvarkymoPrognozavimas.php"; include "WebObjects/Panels/Right/Lenteles.php"; include "WebObjects/Panels/Right/Lenteles1.php"; include "WebObjects/Panels/Right/Import.php"; include "WebObjects/Panels/Right/Help.php"; include "WebObjects/Panels/Right/Users.php"; include "WebObjects/Panels/Right/AddUser.php"; // if(ErrorMessages::isErrors()){ // p(ErrorMessages::getErrors()); // } $GLOBALS['login'] = new Session(); $pageManager = new Manager(); if (!$GLOBALS['login']->isLogedin()) { if (!in_array($pageManager->method, array("login", "logout"))) { $pageManager->class = "home"; $pageManager->method = "login"; Message::setMessage("Neteisingi prisijungimo duomenys!"); } } $pageManager->open();
$nick = $_POST['nick']; } else { Message::setMessage("Vartotojas vardu " . $_POST['nick'] . " jau egzistuoja!"); redirect(); exit; } } else { Message::setMessage("Vartotojas nepaskirtas!"); redirect(); exit; } if (isset($_POST['isAdmin'])) { $isAdmin = (int) $_POST['isAdmin']; } else { Message::setMessage("Nepaskirtas vartotojo tipas!"); redirect(); exit; } if ($pass == $pass1) { if (User::insertToDB($nick, $pass, $isAdmin)) { Message::setMessage("Vartotojas įtrauktas sėkmingai!"); } else { Message::setMessage("Nepavyko įtraukti vartotojos! " . User::$error); } redirect(); exit; } else { Message::setMessage("Slaptažodžiai nesutampa!"); redirect(); exit; }
public function insertEditHash($router_id, $hash) { try { $stmt = DB::getInstance()->prepare("UPDATE routers SET\n\t\t\t\t\t\t\t\trouter_auto_assign_hash=?\n\t\t\t\t\t\t\tWHERE id = ?"); $stmt->execute(array($hash, $router_id)); $result = $stmt->rowCount(); } catch (PDOException $e) { echo $e->getMessage(); echo $e->getTraceAsString(); } if ($result) { $message[] = array("Der geänderte Hash wurde gespeichert.", 1); Message::setMessage($message); return true; } else { $message[] = array("Beim Ändern des Hashes ist ein Fehler aufgetreten.", 2); Message::setMessage($message); return false; } }