// // // //------------------------------------------------------------------------- // logging() // // Returns 'true' if the local 'page log' is enabled, else 'false'. // These method is useful to avoid logging a lot of data on a page // when the page log is not going to be visible to the user anyway. // // function logging() // { // return $this->loggingEnabled; // } function getVideoList($companyID) { $query = "SELECT company_videos.* ,companies.name " . "FROM company_videos LEFT JOIN companies ON (companies.company_id = company_videos.company_id) " . "WHERE company_videos.company_id = '".$companyID."';"; return db_query_all($query); } function showQuery() { return $this->query; } function extractVideoID($swfName) { $finalName = substr(strrchr($swfName, "/"), 1); $finalName = rtrim($finalName, ".swf"); return $finalName; } function deleteVideoFile($videoID,$companyID) { $prepQuery = "SELECT swf_file, flv_file FROM company_videos WHERE id = '".$videoID."' AND company_id = '".$companyID."';"; $company = db_query_one($prepQuery); $flv = $company['flv_file']; $swf = $company['swf_file']; $trueFlv = strpos($flv, ".flv"); $trueSwf = strpos($swf, ".swf"); if ($trueFlv !== false) ( $flvFile = substr(strchr($flv, ".."), 1); unlink($this->baseVidDir.$flvFile); ) if ($trueSwf !== false) ( $swfFile = substr(strchr($swf, ".."), 1); unlink($this->baseVidDir.$swfFile); ) return deleteVideoRecord($videoID, $companyID); } function deleteVideoRecord($videoID, $companyID) { if (isset($videoID) && isset($companyID)) { $delQuery = "DELETE FROM company_videos WHERE id = '".$videoID."' AND company_id = '".$companyID."'"; db_exec($delQuery); return true; } else { return false; } } function UnMarkActive($videoID, $companyID) { $query = "UPDATE company_videos SET active = '0' WHERE id = '".$videoID."' AND company_id = '".$companyID."'"; db_exec($query); } function markActive($videoID, $companyID) { $query = "UPDATE company_videos SET active = '1' WHERE id = '".$videoID."' AND company_id = '".$companyID."'"; db_exec($query); } function unMarkPremier($videoID, $companyID) { $query = "UPDATE company_videos SET premier = '0' WHERE id = '".$videoID."' AND company_id = '".$companyID."'"; db_exec($query); } function markPremier($videoID, $companyID) { $query = "UPDATE company_videos SET premier = '1' WHERE id = '".$videoID."' AND company_id = '".$companyID."'"; db_exec($query); } function setStartDate($videoID, $companyID, $startdate) { $query = "UPDATE company_videos SET start_date = '".$startdate."' WHERE id = '".$videoID."' AND company_id = '".$companyID."'"; db_exec($query); } function setEndDate($videoID, $companyID, $enddate) { $query = "UPDATE company_videos SET end_date = '".$enddate."' WHERE id = '".$videoID."' AND company_id = '".$companyID."'"; db_exec($query); } } // End class VideoFunctions //---------------------------------------------------------------------------- // Page Global Stuff // // Here we set up a 'user session' and define a global 'VideoFunctions' object, // so it will always be available anywhere is is needed. //---------------------------------------------------------------------------- // Create a global 'VideoFunctions' instance $VideoObject = new VideoObject(); ?>