public function output() { $this->parseUrl(); if (isset($_COOKIE['relo_backend']) && beuser::verifyCookie($_COOKIE['relo_backend']) !== false || isset($_SESSION['beuser_id']) && $_SESSION['beuser']->isAdmin() === true) { // logged in $user = new beuser($_SESSION['beuser_id']); beuser::setCookie($user->get('id'), $user->get('password')); $_SESSION['beuser'] = $user; $_SESSION['beuserId'] = $user->get('id'); $this->user = $user; if ($this->requestedView == 'login') { header('Location: ' . config::get('system')['startpage']); } } else { // Not Logged In if ($this->requestedView == 'ajax' && (isset($_POST['module']) && $_POST['module'] == 'login')) { } else { if ($this->requestedView != 'login') { header('Location: login'); exit; } } } switch ($this->requestedView) { case 'imagemanager': $image = new Image(request::get(1), request::get(2)); break; case 'upload': include 'classes/util/upload.class.php'; $upload_handler = new UploadHandler(); break; case 'ajax': if ($_POST['module'] == 'system') { include 'classes/basic/system.ajaxhandler.php'; } elseif ($_POST['module'] == 'autofill') { include 'classes/util/autofill.php'; } elseif ($_POST['module'] == 'user') { include '../data/classes/basic/user.ajaxhandler.php'; } else { include 'classes/custom/' . $_POST['module'] . '/' . $_POST['module'] . '.ajaxhandler.php'; } break; case 'code': $this->requestedView = 'default'; default: $this->renderContent($this->requestedView); /* if module is requested, execute it */ if ($this->requestedModule != '') { $this->processModule(); } $this->OutputContainer = implode($this->container); //load view-specific template include './data/template/standard.tmpl.php'; break; } }
public static function getChat($clientid) { $return = ''; $user = new beuser($_SESSION['beuser_id']); $RS = $user->getChat(0, $clientid); $client = new user($clientid); foreach ($RS as $msg) { if ($msg['recipient_id'] == 0) { // FROM client $return .= '<div class="row chat_entry chat_relo" data-msgid="' . $msg['id'] . '"> <div class="col-xs-1"> <img class="chat_userimg" src="../data/img/_users/_thumbs/' . $client->get('profilepic') . '"> </div> <div class="col-xs-6 chat_message"> <div class="chat_time"> ' . $client->get('firstname') . ' ' . $client->get('lastname') . ' | ' . date('d.m.Y H:i', $msg['time']) . ' </div> ' . $msg['text'] . ' </div> </div>'; } else { if ($msg['recipient_id'] == $clientid) { //FROM RELO $messenger = new beuser($msg['sender_id']); $return .= '<div class="row chat_entry chat_client" data-msgid="' . $msg['id'] . '"> <div class="col-xs-6 col-xs-offset-5 text-right chat_message"> <div class="chat_time text-right"> ' . $user->get('firstname') . ' ' . $user->get('lastname') . ' | ' . date('d.m.Y H:i', $msg['time']) . ' </div> ' . $msg['text'] . ' </div> <div class="col-xs-1"> <img class="chat_userimg" src="../data/img/_users/_thumbs/' . $user->get('profilepic') . '"> </div> </div>'; } } } //end foreach return $return; }
if ($return['success'] === 1) { if (isset($_COOKIE['relo_backend']) === true) { $this->user->verifyPassword($this->user->get('mail'), $_POST['values']['password_new1'], 1); } else { $this->user->verifyPassword($this->user->get('mail'), $_POST['values']['password_new1'], 0); } } else { $errmsg = $return['errmsg']; } } if ($return['success'] === 0 || $errmsg !== false) { echo json_encode(array('success' => 0, 'errmsg' => $errmsg)); } else { echo json_encode(array('success' => 1)); } break; case 'makeAdmin': $user = new beuser($_POST['values']['clientId']); if ($user->isAdmin() === true) { $user->set('is_admin', 0); } else { $user->set('is_admin', 1); } $user->save(); echo json_encode(array('txt' => Texter::get('client|makeAdmin|' . $user->get('is_admin')))); break; default: echo json_encode(array('errmsg' => 'Unknown request on module ' . $_POST['module'])); break; } //end switch