/deploy/referenzvideos/index.php
PHP | 384 lines | 341 code | 32 blank | 11 comment | 22 complexity | 9b8b984c3610c31e51285a3a435c6714 MD5 | raw file
Possible License(s): GPL-3.0
- <?php
- /*
- * Created on Mar 8, 2011
- *
- * To change the template for this generated file go to
- * Window - Preferences - PHPeclipse - PHP - Code Templates
- */
- define("VIDEOS", "http://kloepfer.rushnewmedia.de/video-n66Q2/distribution-12998/stream/");
- define("THUMBS", "/video-n66Q2/distribution-12998/thumbs/");
- define("THUMB_POSTFIX", "_thumbsmall.jpg");
- define('BASE','http://kloepfer.rushnewmedia.de');
- define('PASS','q45RT50pLxt12vwmA');
- define ('CNET','193.228.149');
- require_once ('dbinclude.php');
- $domain=CNET;
- $allowed=false;
- $pass=$_REQUEST['pass'];
- $origin=$_SERVER['REMOTE_ADDR'];
- $pos=strpos ($origin ,CNET);
- if( $pass==PASS)
- {
- $allowed=true;
- }
- else
- {
- if(strpos ($origin ,CNET)!==false)
- $allowed=true;
- }
- if(!$allowed)
- {
- exit();
- }
- $script=$_SERVER['SCRIPT_NAME'];
- $formaction="$script";
- $categories=getCategories();
- $cat=$_REQUEST['cat'];
- $catname=$_REQUEST['Kategorie'];
- $reference=$_REQUEST['reference'];
- if(!isset($cat))$cat=$categories[0]['ID'];
- if(isset($catname))
- {
- foreach($categories as $catrecord)
- {
- if($catrecord['Name']==$catname)
- {
- $cat=$catrecord['ID'];
- break;
- }
- }
- }
- if(!isset($reference))
- {
- $ref=true;
- }
- else
- {
- $ref=false;
- }
- if(!isset($cat))$cat=$categories[0]['ID'];
$videos=getVideos($cat,$ref);
- $amount=count($videos);
- /*
if($amount==0)
{
$title=$website['Title'];
echo makeNoVideo($title);
exit;
}
- */
- $catdropdown='<tr><td></td><td>Kategorie <select name="Kategorie" size="1">{OPTIONS}</select> <input type="submit" name="submit" id="submit" value="Zeigen" /></td></tr>';
- foreach($categories as $category)
- {
- $id= $category['ID'];
- $name= $category['Name'];
- if($cat==$id)
- {
- $options.="<option selected=\"selected\" value=\"$name\">$name</option>";
- }
- else
- {
- $options.="<option value=\"$name\">$name</option>";
- }
- }
- $catdropdown=str_replace("{OPTIONS}",$options,$catdropdown);
-
- function formatTS($ts)
- {
- return substr($ts,6,2).'.'.substr($ts,4,2).'.'.substr($ts,0,4);
- }
- function formatDuration($ts)
- {
- if($ts==0)
- return "";
- return $ts. " Sek.";
- }
- function getVideos($cat,$ref) {
- global $db;
- $refclause="";
- if($ref)
- {
- $refclause=" AND video.ReferenceVideo = 1 ";
- }
-
- $sql = "SELECT video.ID as id,video.FileName as videoname,video.Length as duration,video.UserRating as rating,video.UpdateTimestamp as timestamp,theme.ThemaText as theme,theme.ID as ThID,theme.DetailText as detail ,people.FirstName as firstname, people.LastName as lastname , category.Name as category FROM video,theme,people, category WHERE theme.ID=video.ThemeID AND people.ID=video.peopleID AND category.ID=theme.KategorieID AND Video.ACtive=1 AND category.ID=$cat $refclause ORDER BY `UpdateTimestamp` DESC " ;
- $sqlresult = mysql_query($sql, $db);
- if (!$sqlresult) {
- $error = mysql_error($db);
- sendRequestError($request, 'select all videos' . $error.$sql);
- };
- while($record = mysql_fetch_assoc($sqlresult) )
- {
- $filename=$record['videoname'];
- $thumb=array_shift(explode(".",$filename));
- $thumb=THUMBS.$thumb.THUMB_POSTFIX;
- if(!file_exists('..'.$thumb))
- {
- //continue;
- }
- $record['lastname']=htmlentities($record['lastname']);
- $record['firstname']=htmlentities($record['firstname']);
- $record['category']=htmlentities($record['category']);
- $record['theme']=htmlentities($record['theme']);
- $record['detail']=htmlentities($record['detail']);
- if($record['detail']=="0")
- $record['detail']="";
-
- $record['detail']=abreviate($record['detail'],80);
- $record['thumb']=BASE.$thumb;
- $record['videofile']=VIDEOS.$record['videoname'];
- $record['timestamp']=formatTS($record['timestamp']);
- $record['duration']=formatDuration($record['duration']);
- $records[]=$record;
- }
- return $records;
- }
- function getCategories() {
- global $db;
- $sql = "SELECT ID,Name FROM category " ;
- $sqlresult = mysql_query($sql, $db);
- if (!$sqlresult) {
- $error = mysql_error($db);
- sendRequestError($request, 'select all categories' . $error);
- };
- while($record = mysql_fetch_assoc($sqlresult) )
- {
- $records[]=$record;
- }
- return $records;
- }
- function abreviate($test,$len)
- {
- if(strlen($test)<=80)
- return $test;
- $newText="";
- $words=explode( " ",$test);
- foreach($words as $word)
- {
- $tmpText.=$word." ";
- if(strlen($tmpText)<$len)
- {
- $newText=$tmpText;
- }
- else
- {
- break;
- }
-
- }
- return $newText.'…';
- }
- $thumbRow =<<<TROW
- <tr>
- <td width="100"></td>
- <td align='left'>{THUMB1}</td><td align='left' >{THUMB2}</td>
- <tr height="40"></tr>
- </tr>
- TROW;
- $thumbBlock =<<<TBLK
- <table border="0" cellpadding="0" cellspacing="2" align='left'>
- <tr>
- <td width="135" height="96" rowspan="8" align='left' valign="top"><div style="position:relative;"><img src="{THUMBIMAGE}" width="128" height="96" />
- <div style="position:absolute;top:0px;left:0px;">
- <a class="movieSmallPlay" href='javascript:showMovie({MOVIE});'> </a>
- </div></div></td>
- </tr>
- <tr class="theme">
- <td width="59" valign="top" align='left'>Thema<br /></td>
- <td width="308" valign="top">{THEME}</td>
- </tr>
- <tr class="detail">
- <td width="59" valign="top" >Detail<br /></td>
- <td width="308" valign="top" >{DETAIL}</td>
- </tr>
- <tr class="detail">
- <td width="59" valign="top" >Bereich<br /></td>
- <td width="308" valign="top" >{BEREICH}</td>
- </tr>
- <tr class="detail">
- <td width="59" valign="top" >Name<br /></td>
- <td width="308" valign="top" >{NAME}</td>
- </tr>
- <tr class="detail">
- <td width="59" valign="top" >Länge<br /></td>
- <td width="308" valign="top" >{DURATION}</td>
- </tr>
- <tr class="detail">
- <td width="59" valign="top" >Datum<br /></td>
- <td width="308" valign="top" >{DATE}</td>
- </tr>
-
- <tr>
- </table>
- TBLK;
- $thumbsInRow=0;
- foreach($videos as $record)
- {
- $id=$record['id'];
- $theme=$record['theme'];
- $thumbimage =$record['thumb'];
- $videofile=$record['videofile'];
- $detail=$record['detail'];
- $duration=$record['duration'];
- $name=$record['firstname'].' '.$record['lastname'];
- $bereich=$record['category'];
- $date=$record['timestamp'];
- $rating= $record['rating'];
- $thumb=$thumbBlock;
- $thumb=str_replace("{THUMBIMAGE}",$thumbimage,$thumb);
- $thumb=str_replace("{THEME}",$theme,$thumb);
- $thumb=str_replace("{DETAIL}",$detail,$thumb);
- $thumb=str_replace("{BEREICH}",$bereich,$thumb);
- $thumb=str_replace("{NAME}",$name,$thumb);
- $thumb=str_replace("{DURATION}",$duration,$thumb);
- $thumb=str_replace("{DATE}",$date,$thumb);
- $thumb=str_replace("{MOVIE}",enquote($videofile),$thumb);
- $thumb=str_replace("{SELECT}",$select,$thumb);
-
- $thumb=str_replace("{ID}",$id,$thumb);
- if($thumbsInRow==0)
- {
- $rowofthumbs=str_replace("{THUMB1}",$thumb,$thumbRow);
- }
- if($thumbsInRow==1)
- {
- $rowofthumbs=str_replace("{THUMB2}",$thumb,$rowofthumbs);
- }
- $thumbsInRow++;
- if($thumbsInRow>1)
- {
- $rows.=$rowofthumbs;
- $thumbsInRow=0;
- }
- }
- if($thumbsInRow==1)
- {
- $rowofthumbs=str_replace("{THUMB2}","",$rowofthumbs);
- $rows.=$rowofthumbs;
- }
-
- if($amount==0)
- {
- $rows='<tr><td width="100"></td><td > Keine Videos</td><td ></td><tr height="40"></tr></tr>';
- ;
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8" />
- <meta name="generator" content="Adobe GoLive" />
- <title>Kloepfer Filmstudio - Referenz-Videos</title>
- <script type='text/javascript' src='js/jwplayer.js'></script>
- <script type='text/javascript' src='js/jquery-1.7.2.min.js'></script>
- <script type="text/javascript" src="js/jquery.DOMWindow.js"></script>
- <script type="text/javascript">
- function showMovie(sFilename){
- $.openDOMWindow({
- windowSourceID:'#FilmDiv' ,
- height:'445',
- width:590 ,
- windowPadding:5,
- windowBGColor:'#222222',
- modal:1,
- overlay:1
- });
- playMovie(sFilename);
- }
-
-
- function closeit() {
- $.closeDOMWindow({
- windowSourceID:'#FilmDiv'
- });
- document.getElementById("mediaplayerContainer").innerHTML = '<div id="mediaplayer"></div>';
- }
-
- function playMovie(sFilename) {
- jwplayer('mediaplayer').setup({
'flashplayer': 'player.swf',
'id': 'playerID',
'width': '566',
'height': '424',
- autostart : true,
modes : [ {
type : "flash",
src : "player.swf",
config : {
file : sFilename }
}, {
type : "html5",
config : {
file : sFilename
}
}, ]
}); }
-
- </script>
- <style type="text/css" media="all">
- body {
- color: #fff;
- font-size: 9pt;
- font-family: Arial, Verdana, Helvetica, sans-serif;
- background-color: #262626;
- }
- .genTitle {
- font-size: 14pt;
- }
- .theme {
- font-size: 10pt;
- }
- .detail {
- font-size: 8pt;
- }
- a.movieSmallPlay {
- background-image: url("img/smallplay.png");
- display: block;
- height: 35px;
- text-decoration: none;
- width: 35px;
- }
- a.movieSmallPlay:hover {
- background-image:url("img/smallplay_hover.png");
-
- }
- </style>
- <script type="text/javascript">
- </script>
- </head>
- <body>
- <form id="catform" name="catform" method="get" action="<?php echo $formaction;?>">
- <table cellspacing="2" cellpadding="0" border="0" width="100%" align="left">
- <tr>
- <td colspan="1"><h2><strong><em><img src="logo.jpg" alt="" height="166"
- width="148" border="0" /></em></strong></h2></td> <td class="dsR13" colspan="3" valign="top"></td>
- </tr>
- <tr>
- <td height="20"> </td>
- <td colspan="2" valign="top"><p class="genTitle">Willkommen im Klöpfer Filmstudio. </p></td>
- </tr>
- <tr>
- <td height="20"> </td>
- <td colspan="2" valign="top">Ihre Filme im Überblick. Zum Starten der Videos bitte auf den Play-Knopf klicken. </td>
- </tr>
- <?php echo "$catdropdown";?>
- <tr><td></td>
- <td colspan="3" align="center" valign="middle"><hr /></td>
- </tr>
- <?php echo "$rows";?>
- </table>
- </form>
- <style type="text/css">
- #gc {
- margin: 0 auto;
- width: 566px;
-
- }
- </style>
- <div style="DISPLAY:none; visibility:hidden; height:1px;" id="FilmDiv">
- <div style="text-align:right;"><a href="javascript:closeit();" ><img src="img/cross.gif" border="0" title="Fenster schließen"></a></div>
-
- <div class="gencontainer" id="gc">
-
-
- <div id="mediaplayerContainer">
- <div id="mediaplayer">JW Player goes here</div>
- </div>
- </div>
- </div>
- </body>
- </html>