public function insertComment($obj) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $resultObj = array_merge(array('returnQuery' => $returnQuery), $this->resultObj); $chk = array("bool" => true, "traceID" => "insertComments"); //---------------------------------------------------------- $chk = GenFun::errorKey_CHK($obj['set'], array("comment", "content_id")); //---------------------------------------------------------- if (!$chk['bool']) { return $chk; } //---------------------------------------------------------- $obj['set']['comment'] = stripslashes($obj['set']['comment']); //---------------------------------------------------------- $chk = InsertINTO::go("comments", array("comment" => $obj['set']['comment'], "accounts_id" => is_null(Constants::$loggedIN) ? 164 : Constants::$loggedIN['result'][0]['accounts_id'])); //---------------------------------------------------------- if ($chk['bool']) { $comment_id = $chk['insert_id']; } //---------------------------------------------------------- $setArr = array('reply_comments_id' => $obj['set']['reply_comments_id'], "comments_id" => $comment_id, "content_id" => $obj['set']['content_id']); //---------------------------------------------------------- if ($chk['bool']) { $chk = InsertINTO::go($this->contentComments_tbl, $setArr, array('resetQueries' => true)); } //---------------------------------------------------------- if ($chk['bool']) { $chk = $this->_getComments(NULL, $comment_id); } //---------------------------------------------------------- return $chk; }
public static function sendDefault($obj) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, "traceID" => "sendDefault"); $emailObj; //---------------------------------------------------------- GenFun::errorKey_CHK($obj, array("emailTo", "message")); //---------------------------------------------------------- $message = '<div style = "padding:20px; width:500px; background-color:#999999; font-family: arial; font-size:12px; color: #FFFFFF;">'; $message .= $obj['message'] . ' <br><br>'; //---------------------------------------------------------- if (!is_null($obj['link'])) { $message .= '<a href = "' . $obj['link'] . '">' . $obj['linkTxt'] . '</a>'; } //---------------------------------------------------------- $message .= '</div>'; $message = GenFun::html($message); $emailObj = array("emailTo" => $obj['emailTo'], "nameFrom" => GlobalMas::$name, "emailFrom" => GlobalMas::$email, "message" => $message, "subject" => $obj['subject']); //---------------------------------------------------------- $chk = $chk["bool"] ? SendEmail_v0::go($emailObj) : $chk; //---------------------------------------------------------- return $chk; }
public function sendLink($obj) { Trace::output($this->traceID, "sendLink"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, "traceID" => "sendLink"); //---------------------------------------------------------- //$arr = explode("#v-", $obj['url']); //---------------------------------------------------------- $chk = GenFun::error_CHK($obj); //---------------------------------------------------------- $chk = InsertInto::go('suggestions', array('hash' => $obj['hash'], 'sender' => $obj['sender'], "broken" => $obj['broken'], "subject" => $subject, 'message' => $obj['message'])); //---------------------------------------------------------- if (!empty($chk['duplicate'])) { $chk['message'] = "This video has already been suggested to you by '" . $chk["duplicate"]['result'][0]["sender"] . "'."; } //---------------------------------------------------------- $emailObj = array("emailTo" => GlobalMas::EMAIL, 'link' => $obj['url'] . "?suggestion_id=" . GlobalMas::$mysqli->insert_id, 'linkTxt' => "Click here to see video", "message" => $obj['message'], "subject" => $subject = $obj['sender'] . " sent you a youtube link!!!"); //---------------------------------------------------------- if ($chk['bool']) { $chk = SendEmail_v0::sendDefault($emailObj); } else { return $chk; } //---------------------------------------------------------- if ($chk['bool']) { $chk = GenFun::errorKey_CHK($obj, array("url", "sender")); } else { return $chk; } //---------------------------------------------------------- if ($chk['bool']) { $chk['message'] = "Link was successfully sent to Wilmer"; } //---------------------------------------------------------- if ($chk['bool']) { $this->resetQueries(); } //---------------------------------------------------------- return $chk; }