Advertisement
bondcemil

single.php

Dec 11th, 2012
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 16.37 KB | None | 0 0
  1. <?php
  2. require_once("_inc.php");
  3. require_once("library/video.func.php");
  4. if ($_GET['id'] == "") { die("invalid video id"); }
  5.  
  6. $local_id = $_GET['id'];
  7.  
  8. $sql = dbquery("SELECT * FROM `videos` WHERE `id` = ".$local_id." LIMIT 0, 1");
  9.  
  10. while($row = mysql_fetch_array($sql)){
  11.     $video_id = $row["youtube_id"];
  12.     $meta_description = $row["description"];
  13.     $meta_description = substr($meta_description, 0, 150);  
  14.     $description = $row["description"];
  15.     $catid = $row["category"];
  16.     $video_views = $row["views"];
  17.     $video->title = $row["title"];
  18.     $video_tags = $row["tags"];
  19.     $video_time = $row["duration"];
  20.     $video_likes = $row["liked"];
  21.     $video_dislikes = $row["disliked"];
  22. }
  23. $csql = dbquery("SELECT cat_name FROM `channels` WHERE `cat_id` = ".$catid." LIMIT 0, 30 ");
  24. while($row = mysql_fetch_array($csql)){
  25. $category =  $row["cat_name"];
  26.  
  27. }
  28.  
  29. $canonical = $site_url.''.$local_id.'/'.seo_clean_url($video->title) .'/';
  30. $increasevideo = dbquery("UPDATE videos SET views = views+1 WHERE id = '".$local_id."';");
  31.  
  32.  
  33.  
  34. ?>
  35.  
  36. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  37. <head>
  38.  <title><?php echo $video->title; ?></title>
  39. <!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge" /><![endif]-->
  40. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  41. <base href="<?php print $config->site->url; ?>" />
  42. <meta name="keywords" content="<?php echo $video_tags; ?>">
  43. <meta name="description" content="<?php echo $meta_description?>">
  44. <link rel="shortcut icon" href="<?php print $config->site->url; ?>favicon.ico" />
  45. <link rel="canonical" href="<?php echo $canonical; ?>" />
  46. <link rel="image_src" href="http://i2.ytimg.com/vi/<?php echo $video_id; ?>/0.jpg"/>
  47. <link rel="video_src" href="<?php echo $site_url;?>tpl/player/player.swf?file=http://www.youtube.com/watch?v=<?php echo $video_id; ?>&autostart=true&logo.file=<?php echo $site_url;?>tpl/player/playerlogo.png&logo.link=<?php echo $canonical; ?>&logo.hide=false&logo.position=bottom-left&stretching=fill" />
  48. <link href="<?php print $config->site->url; ?>tpl/css/default.css" media="screen" rel="stylesheet" type="text/css" />
  49. <link href="<?php print $config->site->url; ?>tpl/css/comments.css" media="screen" rel="stylesheet" type="text/css" />
  50.  <link rel="stylesheet" href="<?php print $config->site->url; ?>tpl/css/buttons.css" type="text/css"/>
  51. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  52. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
  53. <script type="text/javascript" src="<?php print $config->site->url; ?>js/comment.js"></script>
  54. <link rel="stylesheet" type="text/css" href="<?php print $config->site->url; ?>tpl/js/lightbox/themes/default/jquery.lightbox.css" />
  55. <!--[if IE 6]><link rel="stylesheet" type="text/css" href="javascript/lightbox/themes/default/jquery.lightbox.ie6.css" /><![endif]-->
  56. <script type="text/javascript" src="<?php print $config->site->url; ?>tpl/js/lightbox/jquery.lightbox.js"></script>
  57. <script type="text/javascript">
  58.   jQuery(document).ready(function($){
  59.     $('#embed').lightbox();
  60.   });
  61. </script>
  62.  <SCRIPT>
  63. function clearDefault(el) {
  64. if (el.defaultValue==el.value) el.value = ""
  65. }
  66. </SCRIPT>
  67. <?php if( $user->isAuthorized() ) { ?>
  68. <script type="text/javascript">
  69. $(document).ready(function(){  
  70.  
  71.     //$('#voting_result').fadeOut();
  72.  
  73.     $('#like, #dislike').click(function(){
  74.  
  75.         var a = $(this).attr("id");
  76.         var b = "<?php echo $local_id;?>";
  77.         var dataString = 'value='+ a + '&val=' + b;
  78.  
  79.          
  80.  
  81.         $.post("req/voting.php?"+ dataString, {
  82.  
  83.         }, function(response){
  84.  
  85.             $('#voting_result').fadeIn();
  86.  
  87.             $('#voting_result').html($(response).fadeIn('slow'));
  88.  
  89.            
  90.            
  91.  
  92.         });
  93.  
  94.     });
  95.  
  96. });
  97.  
  98.  
  99.  
  100. </script>
  101. <?php } ?>
  102.  
  103.  </head>
  104. <body>
  105.    
  106. <div id="top_er" class="clearfix">
  107. <div id="top_left" class="clearfix">
  108. <a href="<?php print $config->site->url; ?>" rel="nofollow"><img src="tpl/images/logo.png" alt="<?php print $config->site->name; ?>"/></a>
  109.  </div>
  110.  
  111.  <div id="top_center" class="clearfix">
  112.  <div id="searchwrap">
  113. <form action="/video_tags.php" method="get" name="thisform-search" id="thisform-search" onsubmit="location.href='<?php print $config->site->url; ?>izle/' + encodeURIComponent(this.tag.value).replace(/%20/g, '+'); return false;">
  114. <input type="text" name="search" id="s" value="Search.." onfocus="if(this.value == 'Search..') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search..';}"/>
  115. <input type="submit" value="" class="go" />
  116. </form>
  117. </div>
  118.  </div>
  119.  <div id="top_right" class="clearfix">
  120.  
  121.  
  122. <?php
  123. if($user->isAuthorized())
  124.     {
  125.     $user_message_module = MK_RecordModuleManager::getFromType('user_message');
  126.  
  127.         $user_messages_inbox = $user_message_module->searchRecords(
  128.             array(
  129.                 array('field' => 'recipient', 'value' => $user->getId()),
  130.                 array('field' => 'type', 'value' => 'inbox_unread')
  131.             )
  132.         );
  133.         $user_messages_inbox_total = count($user_messages_inbox);
  134.  
  135.         $user_messages_drafts = $user_message_module->searchRecords(
  136.             array(
  137.                 array('field' => 'sender', 'value' => $user->getId()),
  138.                 array('field' => 'type', 'value' => 'draft')
  139.             )
  140.         );
  141.         $user_messages_drafts_total = count($user_messages_drafts);
  142. echo'
  143. <div class="button-group">
  144. <a href="user.php?id='.$user->getId().'" class="button blue icon man rounded">'.$user->getName().'</a>
  145. <a href="edit-profile.php" class="button blue icon preferences rounded">'.__("Edit Profile").'</a>
  146. <a href="messages.php?folder=inbox" class="button blue icon mailclosed rounded">Inbox ('.$user_messages_drafts_total.')</a>
  147. ';
  148. ?>
  149. <?php print $user->getType() === MK_RecordUser::TYPE_CORE ? '<a href="change-password.php" class="button blue icon padlock rounded">'.__("Password").'</a>' : '' ?>
  150. <a href="logout.php" class="button blue icon eject rounded">Logout</a>
  151. </div>
  152. <?php
  153. } else {
  154. echo'
  155. <div class="button-group">
  156. <a href="'.$config->site->url.'login/" class="button blue icon man rounded">'.__("Guest").'</a>
  157. <a href="'.$config->site->url.'login/" class="button blue icon connections rounded">'.__("Login").'</a>
  158. <a href="'.$config->site->url.'register/" class="button blue icon connections rounded">'.__("Register").'</a>
  159. <a href="'.$config->site->url.'login/" class="button blue rounded on">Facebook</a>
  160. <a href="'.$config->site->url.'login/" class="button green rounded on">Twitter</a>
  161.  
  162. </div>';
  163. }
  164. ?>
  165.  
  166. </div>
  167. </div>
  168. <div id="content-bkg">
  169. <div class="wrapper">
  170.  <div class="centerblock clearfix">
  171.  
  172.                             <div class="button-group">                            
  173.                                 <a href="<?php print $config->site->url; ?>" class="button blue icon house rounded"><?php echo __("Home");?></a>
  174.                                 <a href="<?php print $config->site->url; ?>browse/" class="button blue icon clapboard rounded"><?php echo __("Recent videos");?></a>
  175.                                 <a href="<?php print $config->site->url; ?>viewed/" class="button blue icon star rounded"><?php echo __("Most Viewed");?></a>
  176.                                 <a href="<?php print $config->site->url; ?>liked/" class="button blue icon heart rounded"><?php echo __("Most liked videos");?></a>
  177.                                 <a href="<?php print $config->site->url; ?>members.php" class="button blue icon man rounded"><?php echo __("Our Community");?></a>
  178.                                  <a href="<?php print $config->site->url; ?>bigwall.php" class="button blue icon speechmedia rounded"><?php echo __("Recent Buzz");?></a>
  179.                             </div>
  180.  
  181. </div>  
  182.         <div class="clearfix" style="height:14px;"></div>
  183. <div class="clearfix" id="main-content">
  184. <div class="col col12">
  185. <div class="col col7">
  186.     <h1><?php echo $video->title; ?></h1>
  187.     </div> 
  188.     <div class="col col5 col-last">
  189.     <div class="button-group" style="float:right;padding-right:5px;margin-right:5px;">
  190.         <span class="button blue icon graph rounded"><?php echo $video_views; ?> <?php echo __("views");?></span>
  191.       <span class="button green icon heart rounded"><?php echo $video_likes; ?> <?php echo __("likes");?></span>
  192.       <span class="button red icon trash rounded"><?php echo $video_dislikes; ?> <?php echo __("dislikes");?></span>
  193.     </div>
  194.     </div>
  195.         </div>
  196.         <div class="clearfix" style="height:4px;"></div>
  197.    
  198. <script type="text/javascript" src="<?=$site_url?>tpl/player/swfobject.js"></script>
  199. <div id="mediaspace">
  200.  
  201. You need to have the <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> installed and
  202.  
  203.     a browser with JavaScript support.
  204.  
  205. </div>
  206.  
  207. <script type='text/javascript'>
  208.  
  209.   var so = new SWFObject('<?php echo $site_url;?>tpl/player/player.swf','mpl','1050','406','9');
  210.  
  211.   so.addParam('allowfullscreen','true');
  212.  
  213.   so.addParam('allowscriptaccess','always');
  214.  
  215.   so.addParam('wmode','opaque');
  216.  
  217.   so.addVariable('file','http://www.youtube.com/watch?v=<?php echo $video_id; ?>');
  218.  
  219.   so.addVariable('image','http://i2.ytimg.com/vi/<?php echo $video_id; ?>/0.jpg');
  220.  
  221.   so.addVariable('controlbar','over');
  222.  
  223.   so.addVariable('logo.file','<?php echo $site_url;?>tpl/player/playerlogo.png');
  224.  
  225.   so.addVariable('logo.link','<?php echo $canonical;?>');
  226.    
  227.   so.addVariable('autostart','true');
  228.  
  229.   so.addVariable('logo.hide','false');
  230.  
  231.   so.addVariable('logo.position','top-left');
  232.  
  233.   //so.addVariable('stretching','fill');
  234.  
  235.  
  236.  
  237.   so.write('mediaspace');
  238.  
  239.  
  240.  
  241. </script>  
  242. <div class="clearfix" style="height:14px;"></div>
  243. <div class="col col12">
  244. <div class="col col4">
  245.    <a href="<?php print $config->site->url; ?>category/<?php echo $catid; ?>/<?php echo seo_clean_url($category); ?>/"  class="button blue icon speaker rounded" title="<?php echo $category; ?> video channel"><?php echo $category; ?></a>
  246.     <a id="embed" class="button blue icon magnet rounded" href="#embedcodediv"><?php echo __("Embed video");?></a>
  247.     </div> 
  248.     <div class="col col4">
  249.     <div class="like_dislike">
  250.  
  251.                                     <ul>
  252.  
  253.                                         <li><a class="like" id="like" href="#" onClick=";return false;"><?php echo __("I like it");?></a></li>
  254.  
  255.                                         <li class="nobdr"><a class="dislike" id="dislike" href="#" onClick=";return false;"><?php echo __("I don't like it");?></a></li>
  256.  
  257.                                     </ul>
  258.  
  259.                                 </div>
  260.     </div>
  261.     <div class="col col4 col-last">
  262.     <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="<?php echo $canonical;?>" send="true" width="280" show_faces="false" font=""></fb:like>
  263.  
  264.     </div>
  265.         </div> 
  266. <div class="clearfix" style="height:14px;"></div>
  267.  
  268. <div class="col col9">
  269.     <div id="voting_result" class="clearfix" style="display:none;"></div>      
  270.  
  271. <div class="clearfix" style="height:14px;"></div>
  272. <div class="col-bkg clearfix">
  273.  
  274.  <?php
  275. if(!$user->isAuthorized())
  276.     {
  277. echo'
  278. <div class="button-group">
  279. <a href="'.$config->site->url.'login/" class="button blue icon man rounded">Guests cannot comment</a>
  280. <a href="'.$config->site->url.'login/" class="button blue icon connections rounded">Login</a>
  281. <a href="'.$config->site->url.'login/" class="button blue rounded on">Facebook Connect</a>
  282. <a href="'.$config->site->url.'login/" class="button green rounded on">Twitter Login</a>
  283.  
  284. </div><br /> <br />';
  285. }
  286.  
  287.   $object_id = 'video_'.$local_id; //identify the object which is being commented
  288. include('loadComments.php'); //load the comments and display  
  289. ?>
  290. <div class="share_this_video clearfix">
  291. <div class="detail_min clearfix">
  292. <ul>
  293. <li>
  294. <?php echo $description; ?>
  295.  
  296. </li>
  297. <li>
  298. <div class="addthis_toolbox addthis_default_style addthis_32x32_style">
  299. <a class="addthis_button_preferred_1"></a>
  300. <a class="addthis_button_preferred_2"></a>
  301. <a class="addthis_button_preferred_3"></a>
  302. <a class="addthis_button_preferred_4"></a>
  303. </div>
  304. <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4dbebba36feca69b"></script>
  305.  
  306. </li>
  307. </ul>
  308. </div>
  309. </div>
  310.  <?php
  311. $tags_array = explode(', ', $video_tags);
  312. if (count($tags_array) > 0):
  313. echo '<div class="button-group">';
  314. $tag_links = "";
  315. foreach ($tags_array as $tag):
  316. $atag = str_replace(" ", "+", $tag);   
  317. if ($tag != ""): $tag_links .= '<a href="'.$site_url.'izle/'.$atag.'" class="button blue icon clapboard">'.$tag.'</a>';
  318. endif;
  319. endforeach;
  320. else:
  321. $tag_links = '';
  322. endif;
  323. echo $tag_links;
  324. echo '</div>';
  325.  ?>
  326. <div class="vibe_contain">
  327.  <ul>
  328. <?php
  329. $morecat = 'rel_cat_'.$catid;
  330. if(!$string = $Cache->Load("$morecat")){
  331.                      $string = '';           
  332.                      $sql = dbquery("SELECT * FROM videos WHERE category='".$catid."' ORDER BY id DESC LIMIT 0,16");
  333.    
  334.                      while($row = mysql_fetch_array($sql)){
  335.     $new_id = $row["id"];  
  336.     $new_yt = $row["youtube_id"];
  337.     $new_title = $row["title"];
  338.     $small_title = substr($new_title, 0, 50);  
  339.     $new_description = $row["description"];
  340.     $new_seo_url = $site_url.''.$new_id.'/'.seo_clean_url($new_title) .'/';
  341.     $new_duration = $row["duration"];
  342.    
  343.   $string .='<li>
  344.                             <div class="vibekeep">
  345.                                 <a href="'.$new_seo_url.'"><img src="http://i4.ytimg.com/vi/'.$new_yt.'/default.jpg" width="147" height="99" alt="" />
  346.                                     <span class="time">'.sec2hms($new_duration).'</span>
  347.                                </a>
  348.                            </div>
  349.                             <div class="clear"></div>
  350.  
  351.                             <p class="ttle"><a href="'.$new_seo_url.'">'.$small_title.'></a></p>
  352.                            
  353.                        </li>';
  354.                         }
  355.  $Cache->Save($string, "$morecat");
  356. }
  357. echo $string;
  358. ?>
  359.  </ul>
  360.  
  361.  
  362.  
  363.                 </div> 
  364.  
  365. <div class="clearfix"></div>
  366. </div>
  367.   </div>
  368.  
  369.  
  370. <div class="col col4 col-last">
  371.  
  372.   <div class="sidecol-bkg">
  373.  <div class="sidebare clearfix">
  374.  
  375. <div class="sidekeep clearfix">
  376.  
  377. <ul class="clearfix">
  378. <?php
  379. $cache_rel = $cur_user_lang.'related_'.$local_id;
  380.  if(!$vtrend = $Cache->Load($cache_rel)){
  381. $vtrend = '';            
  382.  
  383. $keywords       = explode(',', $video_tags);
  384. $keywords_add   = NULL;
  385. $keywords_count = count($keywords);
  386.  
  387. if ( $keywords_count > 1 ) {
  388.     for ( $i=1; $i<$keywords_count; $i++ ) {
  389.         $keywords_add .= " OR tags LIKE '%" .mysql_real_escape_string($keywords[$i]). "%'";
  390.     }
  391. }
  392. $key_add        = "( tags LIKE '%" .mysql_real_escape_string($keywords['0']). "%' " .$keywords_add. ")";
  393.  
  394.  $related_sql = dbquery("SELECT id,youtube_id,title,views,duration,liked FROM videos WHERE ".$key_add." ORDER BY views DESC LIMIT 0,10 ");
  395.  while($row = mysql_fetch_array($related_sql)){
  396.     $new_id = $row["id"];  
  397.     $new_yt = $row["youtube_id"];
  398.     $new_title = $row["title"];
  399.     $small_title = substr($new_title, 0, 30);  
  400.     $new_seo_url = $site_url.''.$new_id.'/'.seo_clean_url($new_title) .'/';
  401.     $new_views = $row["views"];
  402.     $new_duration = $row["duration"];
  403.     $new_liked = $row["liked"];
  404.    
  405.    
  406.   $vtrend .='
  407. <li class="clearfix">
  408. <div class="thumb clearfix">
  409. <a href="'.$new_seo_url.'"><img src="'.Get_Thumb($new_yt).'"  width="124" height="84" alt="'.$new_title.'" />
  410. <span class="time">'.sec2hms($new_duration).'</span>
  411. </a>
  412. </div>
  413. <div class="description clearfix">
  414. <p><a href="'.$new_seo_url.'"> '.$small_title.'...</a></p>
  415. <p class="viewcounts">'.$new_views.'  '.__("views").'</p>
  416. <p class="stat">'.__("Liked by").' '.$new_liked.' '.__("persons").'</p>
  417. </div>
  418. </li>';
  419.  
  420. }
  421.  $Cache->Save($vtrend, $cache_rel);
  422. }
  423. echo $vtrend;
  424. ?>
  425. </ul>  
  426. </div>
  427. </div>
  428.  
  429.  
  430.  </div>
  431.         </div>
  432.      
  433.     </div>
  434.    
  435.     </div>
  436.     <div id="embedcodediv" style="display:none;">
  437.     Embed the video on your website:
  438.     <br/> <br/>
  439.     Link to it: <br />
  440.     <input name="txt" value="<?php echo $canonical;?>" type="text" size="40"/>
  441. <br/> <br/>
  442.     Put it on your website: <br />
  443.     <textarea cols="20" rows="2" style="width:320px; height:200px; font-size:14px;" maxlength="1045" >
  444. <object type="application/x-shockwave-flash" style="width:640px; height:510px;" data="http://www.youtube.com/v/<?php echo $video_id; ?>?fs=1&amp;hl=en_US&amp;rel=0">
  445. <param name="movie" value="http://www.youtube.com/v/<?php echo $video_id; ?>?fs=1&amp;hl=en_US&amp;rel=0" />
  446. <param value="application/x-shockwave-flash" name="type" />
  447. <param value="true" name="allowfullscreen" />
  448. <param value="always" name="allowscriptaccess" />
  449. <param value="opaque" name="wmode" />
  450. </object>
  451. <br/> <small>Found here : <a href="<?php echo $canonical; ?>"<?php echo $video->title; ?></a></small>
  452. </textarea>
  453.    
  454.     </div>
  455.  
  456. <?php      
  457. include_once("tpl/php/footer.php");
  458. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement