private function contact_listing_user() { $fullname = wpl_request::getVar('fullname', ''); $phone = wpl_request::getVar('phone', ''); $email = wpl_request::getVar('email', ''); $message = wpl_request::getVar('message', ''); $property_id = wpl_request::getVar('pid', ''); $parameters = array('fullname' => $fullname, 'phone' => $phone, 'email' => $email, 'message' => $message, 'property_id' => $property_id, 'user_id' => wpl_property::get_property_user($property_id)); $returnData = array(); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $returnData['success'] = 0; $returnData['message'] = __('Your email is not a valid email!', WPL_TEXTDOMAIN); } else { wpl_events::trigger('contact_agent', $parameters); $returnData['success'] = 1; $returnData['message'] = __('Information sent to agent.', WPL_TEXTDOMAIN); } echo json_encode($returnData); exit; }
/** * Calls proeprty visit actions * @author Howard <*****@*****.**> * @static * @param int $property_id * @return boolean */ public static function property_visited($property_id) { /** first validation **/ if (!trim($property_id)) { return false; } $current_user_id = wpl_users::get_cur_user_id(); $property_user = wpl_property::get_property_user($property_id); /** checking if the property user himself viewing not adding the counter **/ if ($current_user_id != $property_user) { $query = "UPDATE `#__wpl_properties` SET `visit_time`=visit_time+1, `visit_date`='" . date("Y-m-d H:i:s") . "' WHERE `id`='{$property_id}'"; wpl_db::q($query, 'update'); } return true; }