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 chk($username, $accounts_id = NULL) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'traceID' => "session_CFG"); $userKey; //---------------------------------------------------------- $chk = GenFun::error_CHK(array($username)); //---------------------------------------------------------- if ($chk['bool']) { if (is_null(Constants::$mysqli)) { GenFun::hostConnect(); } } else { return $chk; } //---------------------------------------------------------- session_start(); $session_id = GenFun::encrypt(session_id() . self::SALT . $username); //---------------------------------------------------------- if ($chk['bool']) { $chk = MySQL::getTable(SessionLog_const::TBL, array("session_id" => $session_id, "userKey" => $_COOKIE['user'])); } else { return $chk; } //---------------------------------------------------------- $userKey = $username . "-" . rand(0, 13000000); setcookie("user", $userKey); //---------------------------------------------------------- if (sizeof($chk['result']) == 0) { $chk = InsertINTO::go(array("tableID" => SessionLog_const::TBL, "setArr" => array("userKey" => $userKey, "accounts_id" => $accounts_id, "session_id" => $session_id))); } else { $chk = Update::go(SessionLog_const::TBL, array("userKey" => $userKey), array("session_id" => $session_id)); if ($chk['bool']) { $chk['message'] = "session for this user has already been established!!!"; } } //---------------------------------------------------------- return $chk; }
public function addAccountRow() { Trace::output($this->traceID, "addRow"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'traceID' => "subscribe"); //---------------------------------------------------------- $password = GenFun::encrypt($this->password . $this->salt); //---------------------------------------------------------- $chk = InsertINTO::go(array("tableID" => Accounts_const::TBL, "setArr" => array(Accounts_const::EMAIL => $this->email, Accounts_const::PASSWORD => $password))); //---------------------------------------------------------- return $chk; }
private function _register_business($set, $business, $reDirect = NULL, $logo_files_id = NULL, $returnQuery = NULL) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'result' => array(), "func" => "_register_business"); //---------------------------------------------------------- $account = new Account_v0(); $chk = $account->registerUser(array("set" => $set, "reDirect" => $reDirect)); if ($chk['bool']) { $chk = InsertINTO::go("business", array("name" => $business, "accounts_id" => $account->accounts_id, "logo_files_id" => $logo_files_id)); } return $chk; }
public static function insertFile($name, $uploadResult = NULL) { Trace::output(self::$traceID, "insertFile", func_get_args()); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'result' => array(), "func" => "insertFile"); $date = date("Y-m-d H:i:s"); //---------------------------------------------------------- if (!$chk['bool']) { return $chk; } else { $chk = InsertINTO::go("files", array('name' => $name, "hash" => '{hash}' . $date, "uploadResult" => $uploadResult), array("returnRow" => true, "resetQueries" => true)); } //---------------------------------------------------------- return $chk; }
public static function ignore($tableID, $setArr, $obj = array()) { $obj['insertType'] = "INSERT IGNORE"; $api = new InsertINTO($tableID, $setArr, $obj); return $api->insertINTO(); }
public function createCampaign($obj) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'result' => array(), "func" => "getCampaigns"); //---------------------------------------------------------- $chk = InsertINTO::go("campaigns", array("hash" => "{hash}", "name" => $obj['input'])); //--------------------------------------------------------- if ($chk['bool']) { $chk = $this->getCampaigns(); } return $chk; }
public function newAsset($id) { Trace::output($this->traceID, "newAsset"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'traceID' => "newAsset"); //---------------------------------------------------------- $result = $this->uploadClass->post(false); //---------------------------------------------------------- $chk = InsertINTO::go(array("tableID" => Assets_const::TBL, "setArr" => array(Assets_const::CLM_URL => $result["files"][0]->url, "uploadresult" => json_encode($result["files"])))); //---------------------------------------------------------- if ($chk[bool]) { $chk = $this->updateAssets($id); } else { return $chk; } //---------------------------------------------------------- $chk['output'] = Trace::$output; //---------------------------------------------------------- return $chk; }
public function addAccountRow() { Trace::output($this->traceID, "addRow"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'traceID' => "subscribe"); //---------------------------------------------------------- $chk = InsertINTO::go(Accounts_const::TBL, $this->set); //---------------------------------------------------------- $this->accounts_id = Constants::$mysqli->insert_id; //---------------------------------------------------------- return $chk; }
private function process($table, $row, $format) { $chk = array("bool" => true); if (!empty($row[$format])) { $chk = InsertINTO::go('files', array("name" => $row[$format], 'hash' => GenFun::encrypt($row[$format] . $row['id'])), array("ignore" => true)); } if ($chk['bool'] && !empty($row[$format])) { $chk = Update::go("videos", array($format => Constants::$mysqli->insert_id), array("id" => $row['id'])); } print_r($chk); return $chk; }
public function getRating($content_id, $rating) { $accounts_id = 163; $chk = InsertINTO::go($this->setRating_tbl, array('accounts_id' => $accounts_id, 'content_id' => $content_id, "rating" => $rating)); return $chk; }
public function addAccountRow() { Trace::output($this->traceID, "addRow"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'traceID' => "subscribe"); //---------------------------------------------------------- $chk = InsertINTO::go(Accounts_const::TBL, $this->set); //---------------------------------------------------------- $this->accounts_id = $chk['insert_id']; //---------------------------------------------------------- $geoip = GenFun::getGeoIP(); //---------------------------------------------------------- if ($chk['bool']) { $geoResult = InsertINTO::go("geoip", $geoip); } //---------------------------------------------------------- if (!$geoResult['error']) { Update::go("accounts", array("geoip_id" => $geoResult['insert_id'])); } else { return $geoResult; } //---------------------------------------------------------- return $chk; }
public function confirmLink_CFG($id, $type, $reDirect = NULL) { Trace::output($this->traceID, "confirmLink_CFG"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, "traceID" => "confirmLink_CFG"); //---------------------------------------------------------- date_default_timezone_set('America/New_York'); //---------------------------------------------------------- $date = date("Y-m-d H:i:s"); //---------------------------------------------------------- $expDate = strtotime(date("Y-m-d H:i:s", strtotime($date)) . " +1 day"); $expDate = date('Y-m-d H:i:s', $expDate); //---------------------------------------------------------- $chk = InsertINTO::go($this->confirmLinkTbl, array("confirming_id" => $id, "exp_date" => $expDate, "type" => $type, "reDirect" => !is_null($reDirect) ? $reDirect : "DEFAULT")); //---------------------------------------------------------- if ($chk['bool']) { $chk = $this->confirmLink_hash_CFG(Constants::$mysqli->insert_id); } //---------------------------------------------------------- $chk['output'] = Trace::$output; //---------------------------------------------------------- return $chk; }
public function newTeam($team_name) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $logo_images_id = "DEFAULT"; $chk = array("bool" => true, 'traceID' => "newTeam"); //---------------------------------------------------------- if ($chk['bool'] && sizeof($_FILES) > 0) { $this->uploadClass = new UploadHandler(false); //------------------------------------------------------ $chk = GenFun::error_CHK(array($team_name)); //------------------------------------------------------ $result = $this->uploadClass->post(false); //------------------------------------------------------ if (is_null($result["files"][0]->error)) { $chk = InsertINTO::go(array("tableID" => "images", "setArr" => array('url' => $result['files'][0]->url, 'accounts_id' => GlobalMas::$loggedIN['accounts_id'], "uploadresult" => "'" . json_encode($result["files"]) . "'"))); } //------------------------------------------------------ if (is_null($result["files"][0]->error)) { $logo_images_id = GlobalMas::$mysqli->insert_id; } } //---------------------------------------------------------- if ($chk['bool']) { $chk = InsertINTO::go(array("tableID" => "teams", "setArr" => array("name" => $team_name, 'logo_images_id' => $logo_images_id, "team_organizer_accounts_id" => GlobalMas::$loggedIN['accounts_id']))); } //---------------------------------------------------------- $chk['result']['team_name'] = $team_name; $chk['result']['team_id'] = GlobalMas::$mysqli->insert_id; //---------------------------------------------------------- return $chk; }
public function savePlaylist($id, $idArr = NULL, $onDuplicate = true) { Trace::output($this->traceID, "savePlaylist"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, "traceID" => "savePlaylist"); //---------------------------------------------------------- $idArr = GenFun::varCHK($idArr); //---------------------------------------------------------- $chk = GetTable::go("playlist_videos", array("playlist_id" => $id, "disabled" => "{ignore} IS NULL")); //---------------------------------------------------------- if ($chk['bool']) { for ($i = 0; $i < sizeof($chk['result']); $i++) { $idArr[] = $chk['result'][$i]['videos_id']; } } //---------------------------------------------------------- if (!$chk['bool']) { return $chk; } else { $chk = GenFun::ifAllNumeric($idArr, false); } //---------------------------------------------------------- if ($onDuplicate) { $chk = Update::go("playlist_videos", array('disabled' => "{function}NOW()"), array('disabled' => '{ignore} IS NULL', 'playlist_id' => $id), array("returnTable" => true)); } //---------------------------------------------------------- $setArr['playlist_id'] = $id; $setArr['videos_id'] = $idArr; //---------------------------------------------------------- if ($chk['bool']) { $queryString = InsertINTO::go('playlist_videos', $setArr, array("returnQuery" => true)); } else { return $chk; } //---------------------------------------------------------- if ($onDuplicate) { $queryString .= " ON DUPLICATE KEY UPDATE playlist_videos.disabled = NULL"; } //---------------------------------------------------------- $chk = Result::go($queryString); //---------------------------------------------------------- $queryString = "SELECT playlist.* FROM playlist WHERE playlist.id = {$id}"; //---------------------------------------------------------- $chk = Result::go($queryString); //---------------------------------------------------------- $chk['result'] = $chk['result'][0]; //---------------------------------------------------------- if ($chk['bool']) { $chk['message'] = "Playlist has successfully been saved!!!"; } //---------------------------------------------------------- if ($chk['bool']) { $playlistVideos = $this->_getPlaylistVideos($chk['result']['hash']); if ($playlistVideos['bool']) { $chk['result']['videosInfo'] = $playlistVideos['result']; } else { return $playlistVideos; } } //---------------------------------------------------------- if ($chk['bool']) { $this->resetQueries(); } //---------------------------------------------------------- return $chk; }
public function _agreeWith_comment($accounts_id, $comments_id, $agree = "1", $returnQuery = NULL) { $chk = GenFun::error_chk(array($accounts_id, $comments_id)); if ($chk['bool']) { $chk = InsertINTO::go("agreeWith", array("accounts_id" => $accounts_id, "comments_id" => $comments_id, "agree" => $agree)); //---------------------------------------------------------- if ($chk['bool']) { $chk = Result::resetQueries(); } //---------------------------------------------------------- } return $chk; }