Author Topic: Megavideo Fix ( and poster of movies ) V 0.1  (Read 2968 times)

0 Members and 1 Guest are viewing this topic.

Offline thefrenchboy

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
    • View Profile
Megavideo Fix ( and poster of movies ) V 0.1
« on: December 08, 2009, 09:23:10 PM »
To create a platform of streaming of film with megavideo, it is enough to put the mod megavideo and to change after "author" by " poster of movies "

 succeeded has to make one process_megavideo.inc:

1. To create a file process_megavideo.inc and put inside:

Quote
<?php
/**
 * Gets youtube link from eg http://www.megavideo.com/?v=xxxxxxxxxxx
 * By thefrenchboy, http://phpdirector.co.uk/forum
 * @param http://www.megavideo.com/?v=xxxxxxxxxxx
 * @return Youtube id
 */
function getytid($url){

//checks if valid youtube link

$checkyt = explode(".", $url);

if ($checkyt[1] == "megavideo" ){

   //gets vid id
$yt_start = explode("v=",$url,2);
$yt_end = explode("&",$yt_start[1],2);
$gotid = $yt_end[0];
return $gotid;
}
}
/**
 * Gets Author from megavideo id
 *
 * @param megavideo Id
 * @return $yt_author
 */
function getauthor($videoid){
$yt_xml_author_string = @file_get_contents("http://www.megavideo.com/?v=".$videoid);
$yt_xml_author_start = explode("<author>",$yt_xml_author_string,2);
$yt_xml_author_end = explode("</author>",$yt_xml_author_start[1],2);
$yt_author = addslashes($yt_xml_author_end[0]);
return $yt_author;
}
/**
 * Gets Title from megavideo id
 *
 * @param megavideo Id
 * @return $yt_title_noslash
 */
function gettitle($videoid){
$yt_xml_title_string = @file_get_contents("http://www.megavideo.com/?v=".$videoid);
$yt_xml_title_start = explode("<title>",$yt_xml_title_string,2);
$yt_xml_title_end = explode("</title>",$yt_xml_title_start[1],2);
$yt_title = addslashes($yt_xml_title_end[0]);
$yt_title_noslash = $yt_xml_title_end[0];
return $yt_title_noslash;
}

/**
 * Gets description from megavideo id
 *
 * @param Youtube Id
 * @return $yt_description
 */
function getdescription($videoid){
$yt_xml_description_string = @file_get_contents("http://www.megavideo.com/?v=".$videoid);
$yt_xml_description_start = explode("<description>",$yt_xml_description_string,2);
$yt_xml_description_end = explode("</description>",$yt_xml_description_start[1],2);
$yt_description = addslashes($yt_xml_description_end[0]);
return $yt_description;
}

/**
 * Gets Viewcount from megavideo id
 *
 * @param Youtube Id
 * @return $yt_view_count
 *//*
function getviewcount($videoid){
$yt_xml_view_count_string = @file_get_contents("http://www.megavideo.com/?v=".$videoid);
$yt_xml_view_count_start = explode("<view_count>",$yt_xml_view_count_string,2);
$yt_xml_view_count_end = explode("</view_count>",$yt_xml_view_count_start[1],2);
$yt_view_count = $yt_xml_view_count_end[0];
return $yt_view_count;
}
*/
//check if its allready there

//$videourl is the input link eg http://www.megavideo.com/?v=VflOBMTZiQw
//$videoid is the id that gets sorted in mysql for link above it is VflOBMTZiQw
$videoid_untrim = getytid($videourl);

$videoid = trim($videoid_untrim);  //removes whitespaces at the end

      if($videoid !== null){
      $title  = safe_sql_insert(gettitle($videoid)); //Function to make the sql safe
      $smarty->assign('title', $title);
     
      $author = safe_sql_insert(getauthor($videoid));
      $smarty->assign('author', $author);
     
      $des    = getdescription($videoid);
      $smarty->assign('description', $des);
      //Vous pouvez mettre une image pour dire que la vidéo est megavideo en mettant les bonne balise, thefrenchboy
     
     
      $smarty->assign('image', $thumb);
      $smarty->assign('vidtype', 'megavideo');
      $smarty->assign('videoid', $videoid);

            }//check for blank end
 ?>

2. We add in / template / phptube / players.tpl

Quote
{elseif $vidtype eq "megavideo"}

<object width="640" height="468"><param name="movie" value="http://www.megavideo.com/v/{if $video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.megavideo.com/v/{if $video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="333"></embed></object>

3. We add in / submit.php

Quote
}elseif ($source == "megavideo"){ //megavideo
            include("processes/process_megavideo.inc.php");

Normally it walks(works)  and for the poster of movies :

Warning : it is necessary to make all this before installing Fix on his waiter (server)!

4. Modify / Install / index.php
Look for the line:

`creator ` varchar (64) NOT NULL default ",
And replace 64 by 2 000


5. replace

Template/photine/viewvid.php

Quote
{include file="header.tpl"}
{section name=video loop=$video}
<div align='center'>
{if $reject eq "1"}
{$LAN_26}
{/if}
<h2>{$video[video].name}</h2>
<p>{$LAN_36}:

   <img src="{$video[video].creator}">

   </p>
{include file="players.tpl"}

{rating_bar units='5' id=$video[video].id}
<strong>{$LAN_35}:</strong>
      

<div id='description'>{$video[video].description}</div>


{$LAN_32}: {$video[video].views}
{/section}
</div>
{include file="footer.tpl"}

6. Replace

Template/photine/index.php

Quote

{include file="header.tpl"}
<!--{*
Things not used that you might find usefull
{$paginate.first}
{$paginate.last}
{$paginate.total}
*}-->


<div align="center">

{section name=mysec loop=$videos}

   <table border="0" cellspacing="20" >      
{section name=i loop=$videos step=6 max=16}

<tr valign="top" >
{section name=mysec loop=$videos start=$smarty.section.i.index max=6}
<td width="160px">
<a href="videos.php?id={$videos[mysec].id}"><img height='120' width='160' src="{$video[video].creator}   " class="thumbnail" alt="thumbnail" />[/url]







<h4><a href="videos.php?id={$videos[mysec].id}">{$videos[mysec].name|truncate:32:'...'}[/url]</h4>






</td>
      

      
   {/section}
        </tr>

   {/section}
  </table>   
      
</div>
   
   {sectionelse}
   
   No Results
   
   {/section}
   

   
<div class="center"> {* display pagination info *}

   <h3 align="center">&nbsp;&nbsp;{paginate_first}&nbsp;&nbsp;{paginate_prev}&nbsp;&nbsp;{paginate_middle page_limit="20" format="page"}&nbsp;&nbsp;{paginate_next}&nbsp;&nbsp;{paginate_last} </h3>
   
</div>

{include file="footer.tpl"}


7. and replace

 template/photine/submit2.php

Quote
{include file="header.tpl"}
{literal}
<script>
function checkform()
{
   if (document.video.titletext.value == '') {
   alert('Please Enter A Title');
   return false;
   }   
   else if (document.video.descriptiontext.value == '')
   {
   alert('Please Enter A description');
   return false;
   }
   else if (document.video.authortext.value == '')
   {
   alert('Please Enter A Author');
   return false;
   }
   else if(!document.video.picture[0].checked && !document.video.picture[1].checked && !document.video.picture[2].checked) {
   alert('Please Choose A Screenshot');
   return false;
}
   // If the script gets this far through all of your fields
   // without problems, it's ok and you can submit the form

   return true;
}</script>
{/literal}
<div align="center">
<form action="submit.php?pt=submit&amp;part=3" method="post" name="video" onSubmit="return checkform()">
   <!--Center Page-->
   <h3>Source:{$source}
   </h3>
   <!--Source Of Media-->
   Confirm Default Screenshot
   <input name="videoid" type="hidden" value="{$videoid}" />
   <input name="vidtype" type="hidden" value="{$vidtype}" />
   <input name="file2" type="hidden" value="{$file2}" />
   
      <table width="136" border="0">
         <!--Shows All The Images-->
         <tr> {section name=default loop=$image}
            <td  align="center" width="130"><img src="{$image[default]}" alt="{$title}" width="130" height="97" /> </td>
            {/section} </tr>
         <tr> {section name=default loop=$image}
            <td align="center"><input name="picture" type="radio" value="{$image[default]}" checked="checked" />
            </td>
            {/section} </tr>
      </table>
      <!-- END - Shows All The Images-->
      <table width="83" border="0">
         <tr>
            <td height="21" align="center">Title</td>
         </tr>
         <tr>
            <td height="21" align="center"><textarea name="titletext" cols="50" rows="1" id="titletext" style="text-align:center; text-shadow:#990000">{$title}</textarea></td>
            <td>&nbsp;</td>
         </tr>
         <tr>
            <td width="77" height="21" align="center">Poster ( http:// )</td>
         </tr>
         <tr>
            <td height="42"><textarea name="authortext" cols="50" rows="1" style="text-align:center;">{$author}</textarea>            </td>
            <td>&nbsp;</td>
         </tr>
         <tr>
            <td height="21" align="center">Description</td>
         </tr>
         <tr>
            <td height="104"><textarea name="descriptiontext" cols="50" rows="6" style="text-align:center;">{$description}</textarea>            </td>
            <td>&nbsp;</td>
         </tr>
         <tr>
            <td height="19" align="center">Category</td>
         </tr>
         <tr>
            <td height="104" align="center"><select name="category" size="6">
                  
                  
        {section name=cat loop=$cat}
                  <option value="{$cat[cat].id}" {if $cat[cat].id eq "1"}selected="selected"{/if}>{$cat[cat].name}</option>
      {/section}

               
            
               </select>            </td>
            <td>&nbsp;</td>
         </tr>
      </table>
      <p align="center">{include file="players.tpl"} </p>
      <p align="center">
         <input type="submit" value="Submit">
      </p>
   </form>
</div>
{include file="footer.tpl"}


« Last Edit: April 29, 2010, 12:38:24 PM by thefrenchboy »

Offline RunarM

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: Megavideo Fix ( and poster of movies )
« Reply #1 on: March 07, 2010, 03:30:10 PM »
Does this work for 0.3 =)?

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Megavideo Fix ( and poster of movies )
« Reply #2 on: March 11, 2010, 12:34:29 AM »
I have not tried it on .30
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com