diff --git a/www/svs/user/constants.php b/www/svs/user/constants.php index 48a30592..e49458d0 100644 --- a/www/svs/user/constants.php +++ b/www/svs/user/constants.php @@ -123,6 +123,7 @@ define('WRENCHBOARD_JOB_SEND_QUESTION',13036); define('WRENCHBOARD_JOB_MRKTINT_QUEST',13037); define('WRENCHBOARD_JOB_REPLY_QUESTION',13038); +//define('WRENCHBOARD_JOB_SEND_QUESTION',13036); define('WRENCHBOARD_GROUP_START', 12000); diff --git a/www/svs/user/formarter.php b/www/svs/user/formarter.php index 4603a16e..dbc3dfd9 100644 --- a/www/svs/user/formarter.php +++ b/www/svs/user/formarter.php @@ -32,7 +32,45 @@ function formatCreateTranspData($in) { return $in; } +function cleanUpDescription($job_description){ + // $job_description = trim($job_description); // trim it first + /* + * + * $rest = substr("abcdef", -1); // returns "f" +$rest = substr("abcdef", -2); // returns "ef" +$rest = substr("abcdef", -3, 1); // returns "d" + */ + + if ( substr($job_description,0,1)==='"' ){ + // $job_description = substr($job_description,1); + } + $job_description =fixtags($job_description); + + if ( substr($job_description,0,1)==='"' ){ + // $job_description = substr($job_description,2); + } + return $job_description; +} +function fixtags($text){ + $text = htmlspecialchars($text); + $text = preg_replace("/=/", "=\"\"", $text); + $text = preg_replace("/"/", ""\"", $text); + $tags = "/<(\/|)(\w*)(\ |)(\w*)([\\\=]*)(?|(\")\""\"|)(?|(.*)?"(\")|)([\ ]?)(\/|)>/i"; + $replacement = "<$1$2$3$4$5$6$7$8$9$10>"; + $text = preg_replace($tags, $replacement, $text); + $text = preg_replace("/=\"\"/", "=", $text); + $text = str_replace("\\n", "
", $text); + + $text = str_replace('""\"','',$text); + $text = str_replace('"\""','',$text); + $text = str_replace(' ','',$text); + + $text = str_replace('href=\\"\"http://','',$text); + $text = str_replace('href=\\"\"https://','',$text); + + return $text; +} function processOutJson($in, $out) { @@ -121,11 +159,12 @@ function processOutJson($in, $out) { "title" => $out["title_${key}"], "description" => $out["description_${key}"], "id" => $out["id_${key}"], - "job_description" => $out["job_description_${key}"], + "job_description" => cleanUpDescription($out["job_description_${key}"]), "price" => $out["price_${key}"], "timeline_days" => $out["timeline_days_${key}"], "expire" => $out["expire_${key}"], - "sent" => $out["sent_${key}"] + "sent" => $out["sent_${key}"], + "offer_code" => $out["offer_code_${key}"] ); } diff --git a/www/svs/user/userve.php b/www/svs/user/userve.php index cfb37fcc..172963d6 100644 --- a/www/svs/user/userve.php +++ b/www/svs/user/userve.php @@ -39,6 +39,7 @@ $endpoints = array( 'couponhx' => array('POST'), 'couponpending' => array('POST'), 'couponredeem' => array('POST'), + 'sendinterestmessage' => array('POST'), ); $call_backend = true; // sometimes we need to overwite the call to the extenstion API @@ -101,6 +102,16 @@ if ($_SERVER["REQUEST_METHOD"] == "GET") { } $in["loc"] = $_SERVER["REMOTE_ADDR"]; switch ($endpoint) { + case 'sendinterestmessage': + + // $in['offer_code'] = $this->input->get('offer_code'); + $in['yourmessage'] = $in["question"]; + //$in['member_id'] = $_SESSION['member_id']; // just maing sure + $in['msg_type'] = 'JOB'; + // $in['action'] = WRENCHBOARD_JOB_SEND_QUESTION; + + $in["action"] = WRENCHBOARD_JOB_SEND_QUESTION; + break; case 'couponredeem': $in["action"] = WRENCHBOARD_COUPON_REDEEM; break;