diff --git a/plugin/AD_Server/Objects/VastCampaignsVideos.php b/plugin/AD_Server/Objects/VastCampaignsVideos.php index 880be678a..88ce1974f 100644 --- a/plugin/AD_Server/Objects/VastCampaignsVideos.php +++ b/plugin/AD_Server/Objects/VastCampaignsVideos.php @@ -1,174 +1,174 @@ $value) { $this->$key = $value; } return true; } static protected function getCampainVideo($vast_campaigns_id, $videos_id) { global $global; $vast_campaigns_id = intval($vast_campaigns_id); $videos_id = intval($videos_id); $sql = "SELECT * FROM " . static::getTableName() . " WHERE vast_campaigns_id = ? , videos_id = ? LIMIT 1"; // I had to add this because the about from customize plugin was not loading on the about page http://127.0.0.1/YouPHPTube/about $res = sqlDAL::readSql($sql,"ii",array($vast_campaigns_id, $videos_id)); $data = sqlDAL::fetchAssoc($res); sqlDAL::close($res); if ($res) { $row = $data; } else { $row = false; } return $row; } static function getRandomCampainVideo($vast_campaigns_id) { global $global; $vast_campaigns_id = intval($vast_campaigns_id); if(empty($vast_campaigns_id)){ $campaings = VastCampaigns::getValidCampaigns(); $vast_campaigns_id = $campaings[0]['id']; } $sql = "SELECT * FROM " . static::getTableName() . " WHERE vast_campaigns_id = ? ORDER BY RAND() LIMIT 1"; // I had to add this because the about from customize plugin was not loading on the about page http://127.0.0.1/YouPHPTube/about - $res = sqlDAL::readSql($sql,"ii",array($vast_campaigns_id, $videos_id)); + $res = sqlDAL::readSql($sql,"i",array($vast_campaigns_id)); $data = sqlDAL::fetchAssoc($res); sqlDAL::close($res); if ($res) { $row = $data; } else { $row = false; } return $row; } static function getAllFromCampaign($vast_campaigns_id, $getImages = false) { global $global; $vast_campaigns_id = intval($vast_campaigns_id); $sql = "SELECT v.*, c.* FROM " . static::getTableName() . " c " . " LEFT JOIN videos v ON videos_id = v.id WHERE 1=1 "; if(!empty($vast_campaigns_id)){ $sql .= " AND vast_campaigns_id=$vast_campaigns_id "; } $sql .= self::getSqlFromPost(); $res = sqlDAL::readSql($sql); $fullData = sqlDAL::fetchAllAssoc($res); sqlDAL::close($res); $rows = array(); if ($res!=false) { foreach ($fullData as $row) { if($getImages){ $row['poster'] = Video::getImageFromID($row['videos_id']); } $row['data'] = VastCampaignsLogs::getDataFromCampaign($row['vast_campaigns_id']); $rows[] = $row; } } else { die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); } return $rows; } static public function getValidVideos($vast_campaigns_id){ global $global; $sql = "SELECT v.*, c.* from " . static::getTableName() . " c LEFT JOIN videos v ON v.id = videos_id WHERE vast_campaigns_id = ? AND c.status = 'a' "; $res = sqlDAL::readSql($sql,"i",array($vast_campaigns_id)); $rows = sqlDAL::fetchAllAssoc($res); sqlDAL::close($res); $r = array(); if ($res!=false) { foreach($rows as $row) { $r[] = $row; } } return $r; } function getId() { return $this->id; } function getVast_campaigns_id() { return $this->vast_campaigns_id; } function getVideos_id() { return $this->videos_id; } function getStatus() { return $this->status; } function setId($id) { $this->id = $id; } function setVast_campaigns_id($vast_campaigns_id) { $this->vast_campaigns_id = $vast_campaigns_id; } function setVideos_id($videos_id) { $this->videos_id = $videos_id; } function setStatus($status) { $this->status = $status; } function getLink() { return $this->link; } function getAd_title() { return $this->ad_title; } function setLink($link) { $this->link = $link; } function setAd_title($ad_title) { $this->ad_title = $ad_title; } function delete() { global $global; if (!empty($this->id)) { $sql = "DELETE FROM vast_campaigns_logs "; $sql .= " WHERE vast_campaigns_has_videos_id = ?"; $global['lastQuery'] = $sql; //error_log("Delete Query: ".$sql); $campaigns_video_log = sqlDAL::writeSql($sql,"i",array($this->id)); } return parent::delete(); } }