jakCheckrestlogged($userid, $loginhash); if ($usr) { // Get the user fields $jakuser = new JAK_user($usr); // Check if a sibling has logged in if ($jakuser->getVar("opid") != 0) { $opcacheid = $jakuser->getVar("opid"); } else { $opcacheid = $jakuser->getVar("id"); } // Cache stuff if (file_exists(APP_PATH.JAK_CACHE_DIRECTORY.'/opcache'.$opcacheid.'.php')) include_once APP_PATH.JAK_CACHE_DIRECTORY.'/opcache'.$opcacheid.'.php'; // timezone from server date_default_timezone_set(JAK_TIMEZONESERVER); $jakdb->query('SET time_zone = "'.date("P").'"'); if (!empty($contactid)) $rowi = $jakdb->get("contacts", ["name", "email", "message", "latitude", "longitude"], ["id" => $contactid]); if ($sendform && !empty($contactid)) { if (empty($_REQUEST['subject'])) { $errors['subject'] = true; } if (empty($_REQUEST['message'])) { $errors['message'] = true; } if (count($errors) == 0) { // Ok, we send the email // email address, cc email address, reply to, subject, message, attachment if (jak_send_email($rowi['email'], "", "", trim($_REQUEST['subject']), trim(nl2br($_REQUEST['message'])), "")) { // Get the operator details $jakuser = new JAK_user($usr); // Insert the stuff into the database $jakdb->insert("contactsreply", [ "contactid" => $contactid, "operatorid" => $jakuser->getVar("id"), "operatorname" => $jakuser->getVar("username"), "subject" => trim($_REQUEST['subject']), "message" => trim($_REQUEST['message']), "sent" => $jakdb->raw("NOW()")]); $jakdb->update("contacts", ["reply" => 1, "answered" => $jakdb->raw("NOW()")], ["id" => $contactid]); // Write the log file JAK_base::jakWhatslog('', $opcacheid, $userid, 0, 32, $lastid, (isset($_COOKIE['WIOgeoData']) ? $_COOKIE['WIOgeoData'] : ''), $jakuser->getVar("username"), $_SERVER['REQUEST_URI'], $ipa, $valid_agent); // Form has been sent, let's send the success status die(json_encode(array('status' => true))); } } else { die(json_encode(array('status' => false, 'errors' => $errors))); } } // Display the message content and location from the client die(json_encode(array('status' => true, 'data' => $rowi))); } else { die(json_encode(array('status' => false, 'errorcode' => 1, 'errorcode' => false))); } } die(json_encode(array('status' => false, 'errorcode' => 7, 'errorcode' => false))); ?>