<?
//----------------------------------------------------------------------------
// Title: Video edit functions
//
//
// Author: Gene Hyatt
//
// Description:
//
//----------------------------------------------------------------------------
require_once('db.php');
class VideoObject
{
// Declare class data members
var $query = "N/A";
var $baseVidDir = "/home/rjdir/htdocs-devel";
//-------------------------------------------------------------------------
// VideoObject() - Default Constructor
//
// Initializes a new instance of a VideoObject
//
//
function VideoObject()
{
}
// <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="300" height="278" id="barrygrant2" align="middle">
// <param name="allowScriptAccess" value="sameDomain" />
// <param name="movie" value="barrygrant2.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="barrygrant2.swf" quality="high" bgcolor="#ffffff" width="300" height="278" name="barrygrant2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
// </object>
//-------------------------------------------------------------------------
// 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();
?>