$post_check = Post::Check(array("msg", "to")); if ($post_check) { /** * If variables are passed we set the $html variable. This defines * if html is allowed or not. We don't allow html for messages, but * we will have to allow it when administrator sends a file to the user. */ $html = isset($_GET['html']) && $_GET['html'] == 1 ? true : false; if ($_POST['to'] > 0) { /** * Add message if there is someone to pass it */ $post = new AddMsg($_POST['msg'], $_POST['to'], $html); } } /** * Start Messaging class */ $msg = new Messaging(); /** * Delete all messages older that 520 minutes. This can be adjusted, but must * be adjusted in the client area as well, because all the users trigger this * function. */ $msg->DeleteOld(520); /** * Get the message by the users respectivly */ $to_user = isset($_GET['to']) ? $_GET['to'] : $_POST['to']; $messages = $msg->GetMsgs($to_user); include 'views/template/messages.tpl';
*/ if (isset($_POST['msg'])) { /** * If message is posted, start an AddMsg class and pass the post variable. * Class AddMsg inserts the message in the database. */ $html = isset($_GET['html']) && $_GET['html'] == 1 ? true : false; $post = new AddMsg($_POST['msg'], $html); } /** * Start the Messaging class for operation with functions available. */ $msg = new Messaging(); /** * Here we delete all messages in the database that are older than 520 minutes. * With this we ensure, that messages are not hold to long in the database, * because larger databases are slower and consume more system resources. */ $msg->DeleteOld(520); /** * Get all current user messages between the user and administrator */ $messages = $msg->GetMsgs(); /** * Load the current registered user id from session to variable */ $current_user = $_SESSION['visitor_chat_user']; /** * Output the view template file */ include 'views/template/messages.tpl';