PHP Web Host - Quality Web Hosting For All PHP Applications Free RavenNuke(tm) Add Ons
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
abdlali8
New Member
New Member


Joined: Aug 22, 2009
Posts: 5

PostPosted: Sat Aug 22, 2009 6:03 am Reply with quote Back to top

hi
I am using dynamic titles on my site
i would like to be able to use them on the PHP-Nuke Video v2.3
i need help for Create this dynamic titles for my php-nuke video
Thanks a lot.
View user's profile Send private message
montego
Former Admin in Good Standing


Joined: Aug 29, 2004
Posts: 9071
Location: Arizona

PostPosted: Sat Aug 22, 2009 9:08 am Reply with quote Back to top

abdlali8, I would look at how includes/dynamic_titles.php is doing it and add your module code in there. However, I have to tell you, though, that we're moving to a completely different system for generating dynamic titles in the soon to be release 2.40.00 version.
View user's profile Send private message Visit poster's website
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 884

PostPosted: Sat Aug 22, 2009 8:25 pm Reply with quote Back to top

Will ther still be support for dbi in 2.4?

Dawg
View user's profile Send private message
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2404
Location: Pennsylvania

PostPosted: Sat Aug 22, 2009 8:51 pm Reply with quote Back to top

yes, you will have to uncomment the few lines for it as before.
View user's profile Send private message Visit poster's website
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 884

PostPosted: Sun Aug 23, 2009 3:47 am Reply with quote Back to top

If I recall PHP-Nuke Video v2.3 is a knocked off version of Video_Stream

If so this should work...

includes/dynamic_titles.php

Code:

if($name=="Video_Stream"){
global $db, $prefix, $id,$page;
$name = "Whatever you want for the Base Name";
if ($page == 'watch'){
   $result = $db->sql_query("SELECT * FROM ".$prefix."_video_stream WHERE id='$id'");
   $row = $db->sql_fetchrow($result);   
$newpagetitle = $name." - ".$row['vidname'];
}
elseif($page != 'watch'){
    $name = "$Whatever you want for the Base Name";
    $newpagetitle = "$name";
}
}


Palbin wrote:
yes, you will have to uncomment the few lines for it as before.


WOOT WOOT....I have 2 MODs I use that I really do not want to recreate that use dbi.

Dawg
View user's profile Send private message
abdlali8
New Member
New Member


Joined: Aug 22, 2009
Posts: 5

PostPosted: Sun Aug 23, 2009 5:52 am Reply with quote Back to top

montego wrote:
abdlali8, I would look at how includes/dynamic_titles.php is doing it and add your module code in there. However, I have to tell you, though, that we're moving to a completely different system for generating dynamic titles in the soon to be release 2.40.00 version.


Thank you Boss
i Wait the new version with impatience
View user's profile Send private message
abdlali8
New Member
New Member


Joined: Aug 22, 2009
Posts: 5

PostPosted: Sun Aug 23, 2009 5:56 am Reply with quote Back to top

Dawg wrote:
If I recall PHP-Nuke Video v2.3 is a knocked off version of Video_Stream

If so this should work...

includes/dynamic_titles.php

Code:

if($name=="Video_Stream"){
global $db, $prefix, $id,$page;
$name = "Whatever you want for the Base Name";
if ($page == 'watch'){
   $result = $db->sql_query("SELECT * FROM ".$prefix."_video_stream WHERE id='$id'");
   $row = $db->sql_fetchrow($result);   
$newpagetitle = $name." - ".$row['vidname'];
}
elseif($page != 'watch'){
    $name = "$Whatever you want for the Base Name";
    $newpagetitle = "$name";
}
}


Palbin wrote:
yes, you will have to uncomment the few lines for it as before.


WOOT WOOT....I have 2 MODs I use that I really do not want to recreate that use dbi.

Dawg



Thank You Dawg i try it right now

Palbin thank you too my friend
View user's profile Send private message
abdlali8
New Member
New Member


Joined: Aug 22, 2009
Posts: 5

PostPosted: Sun Aug 30, 2009 9:04 pm Reply with quote Back to top

Dawg wrote:
If I recall PHP-Nuke Video v2.3 is a knocked off version of Video_Stream

If so this should work...

includes/dynamic_titles.php

Code:

if($name=="Video_Stream"){
global $db, $prefix, $id,$page;
$name = "Whatever you want for the Base Name";
if ($page == 'watch'){
   $result = $db->sql_query("SELECT * FROM ".$prefix."_video_stream WHERE id='$id'");
   $row = $db->sql_fetchrow($result);   
$newpagetitle = $name." - ".$row['vidname'];
}
elseif($page != 'watch'){
    $name = "$Whatever you want for the Base Name";
    $newpagetitle = "$name";
}
}


Palbin wrote:
yes, you will have to uncomment the few lines for it as before.


WOOT WOOT....I have 2 MODs I use that I really do not want to recreate that use dbi.

Dawg


hey again
the codes not working with me
please i need anthor method
thank you
View user's profile Send private message
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 884

PostPosted: Mon Aug 31, 2009 4:14 am Reply with quote Back to top

Post the index.php for the MOD and I will have a look.

Dawg
View user's profile Send private message
abdlali8
New Member
New Member


Joined: Aug 22, 2009
Posts: 5

PostPosted: Mon Aug 31, 2009 5:45 am Reply with quote Back to top

hey
this codes for ( index.php )

Code:
<?php

if ( !defined('MODULE_FILE') )
{
   die("You can't access this file directly...");
}

define('NO_EDITOR', 1);

require_once("mainfile.php");
$pagetitle = "- Videos";

include_once(dirname(__FILE__).'/module.php');

new video_module;

?>


and this for ( module.php )

Code:
<?php

class video_module {

   function video_module(){
      global $db, $prefix, $user_prefix, $bgcolor2, $user, $admin;
      
      //PHPNuke functions / vars
      $this->db = &$db;
      $this->prefix = &$prefix;
      $this->user_prefix = &$user_prefix;
      $this->user = &$user;
      $this->admin = &$admin;
      $this->userinfo = getusrinfo($this->user);
      
      $this->base_path = dirname(__FILE__);
      $this->template_path = $this->base_path.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR;
      
      $this->module_name = basename($this->base_path);
      
      //Settings Object
      require_once($this->base_path.'/settings.php');
      $this->settings = new vidmod_settings;
      $this->config = $this->settings->get_settings();
      
      //Video Object
      include_once($this->base_path.'/videos.php');
      $this->videos = new vidmod_videos;

      //Category Object
      include_once($this->base_path.'/categories.php');
      $this->categories = new vidmod_categories;
      
      //Language Object
      include_once($this->base_path.'/languages.php');
      $this->languages = new vidmod_languages;
            
      //vTemplates
      include($this->base_path.'/libraries/vtemplates/vtemplates.php');
      $this->vt = new vtemplates;
      $this->vt->assign('BGCOLOR2', $bgcolor2);
      $this->vt->assign('SELF', basename($_SERVER['SCRIPT_NAME']));
      $this->vt->assign('MODULE', $this->module_name);
      $this->vt->assign('MEDIAPATH', 'modules/'.$this->module_name.'/media/');
      $this->vt->assign('THUMBNAILPATH', 'modules/'.$this->module_name.'/files/thumbnails/');
      $this->vt->assign('SETTINGS', $this->config);
      $this->vt->assign('TEMPLATEPATH', $this->template_path);
      $this->vt->assign('LANGUAGES', $this->languages->defines);
       
       switch($_REQUEST['op']){
          
          case 'search':
             $this->search();
             break;
       
          case 'submit_video':
             $this->submit_video();
             break;
             
          case 'submit_video_':
             $this->submit_video_();
             break;
             
          case 'download_submitted_video':
             $this->download_video();
             break;
             
          case 'view':
             $this->view();
             break;
             
          case 'download_video':
             $this->download_video();
             break;
             
          case 'download_converted':
             $this->download_converted();
             break;

         case 'download_stream':
            $this->download_stream();
            break;
            
         case 'download_remote':
            $this->download_remote();
            break;
             
          case 'rate_video':
             $this->rate_video();
             break;
             
          case 'post_comment':
             $this->post_comment();
             break;
             
          case 'delete_comment':
             $this->delete_comment();
             break;
             
          case 'category':
             $this->category();
             break;
             
          case 'terms':
             $this->terms();
             break;
             
          case 'view_user':
             $this->view_user();
             break;
             
          case 'send_to_a_friend':
             $this->send_to_a_friend();
             break;
             
          case 'report_broken':
             $this->report_broken();
             break;
          
          default:
             $this->view_videos();
             break;   
             
       }
       
   }
   
   function header(){
      include('header.php');
      $is_user = is_user($this->user) ? true : false;
      if($is_user){
         $this->vt->assign('userinfo', $this->userinfo);
      }
      $this->vt->assign('is_user', $is_user);
      $this->vt->display($this->base_path.'/templates/module_nav.tpl');
      $this->vt->display($this->base_path.'/templates/nav_search.tpl');
   }
   
   function footer(){
      include('footer.php');   
   }
   
   function search(){
      $query = isset($_POST['search_query']) ? $_POST['search_query'] : null;
      
      $videos = $this->videos->get_search_videos($query);

      
      $this->vt->assign('videos', $videos);
      $this->vt->assign('query', htmlspecialchars($query));
      
      $this->header();
      $this->vt->display($this->base_path.'/templates/search.tpl');
      $this->footer();

   }
   
   function category(){
      $this->header();

      
      $category_id = (isset($_REQUEST['vidmod_cat']) && is_numeric($_REQUEST['vidmod_cat']) ? $_REQUEST['vidmod_cat'] : false);
      if($category_id !== false && $this->categories->category_exists($category_id)){
         
         $this->vt->assign('main_categories', $this->categories->get_child_categories(0));
         if(isset($category_id) && $category_id != 0 && is_numeric($category_id)){
            $this->vt->assign('sub_categories', $this->categories->get_child_categories($category_id));   
         }
         
         $perpage = $this->config['listing_perpage'];
         if($perpage <= 0){
            $perpage = 1;
          }

         $page = (isset($_REQUEST['page']) && is_numeric($_REQUEST['page']) ? $_REQUEST['page'] : 1);
         $end = $page * $perpage;
         $start = $end - ($perpage - 1);
         
         $videos = $this->videos->get_category_videos($category_id, $start, $end);
         
         $total_pages = intval($this->videos->temp_count / $perpage);
         if(($this->videos->temp_count % $perpage) > 0) $total_pages++;
         
         $pages = array();
         for($i = 1; $i <= $total_pages; $i++)
            $pages[] = $i;
            
         
         $this->vt->assign('category', $this->categories->get_category($category_id));
         $this->vt->assign('ancestry', $this->categories->ancestry($category_id));
         $this->vt->assign('pages', $pages);
         $this->vt->assign('current_page', $page);
         $this->vt->assign('list', 'category_view');
         $this->vt->assign('videos', $videos);

         $this->vt->display($this->base_path.'/templates/videos.tpl');

         $this->footer();   
      }
      
   }
   
   function view_videos(){
      $this->header();

      $perpage = $this->config['listing_perpage'];
      if($perpage <= 0){
         $perpage = 1;
       }
      
      $page = (isset($_REQUEST['page']) && is_numeric($_REQUEST['page']) ? $_REQUEST['page'] : 1);
      $end = $page * $perpage;
      $start = $end - ($perpage - 1);
            
      $this->vt->assign('main_categories', $this->categories->get_child_categories(0));
      
      switch(isset($_REQUEST['list']) ? $_REQUEST['list'] : null){
         
         case 'most_recent':
            $list = 'most_recent';
            $videos = $this->videos->get_recent($start, $end);
            break;
            
         case 'most_viewed':
            $list = 'most_viewed';
            $videos = $this->videos->get_most_viewed($start, $end);
            break;
         
         
         default:
            $list = 'most_hottest';
            $videos = $this->videos->get_hottest($start, $end);
            break;
         
      }
      
      $total_pages = intval($this->videos->temp_count / $perpage);
      if(($this->videos->temp_count % $perpage) > 0) $total_pages++;
      $pages = array();
      for($i = 1; $i <= $total_pages; $i++)
         $pages[] = $i;
   
      $this->vt->assign('pages', $pages);
      $this->vt->assign('current_page', $page);
      $this->vt->assign('list', $list);
      $this->vt->assign('videos', $videos);
      $this->vt->display($this->base_path.'/templates/videos.tpl');

      $this->footer();   
   }
   
   function submit_video(){
      $this->header();

      $is_user = is_user($this->user) ? true : false;
      if($is_user){
         $this->vt->assign('userinfo', $this->userinfo);
      }
      $this->vt->assign('is_user', $is_user);
      
      $this->vt->display($this->base_path.'/templates/submit_video.tpl');

      $this->footer();   
   }
   
   function submit_video_(){
      $file_validity_check = $this->videos->check_valid_file($_FILES['video_file']['name']);
      if($_FILES['video_file'] != null && ($file_validity_check === true || $_POST['remote_link'] != '')){
         if(is_user($this->user)){
            $id = $this->videos->create_submitted_video($_POST['video_name'], $_POST['video_description'], $_FILES['video_file'], $_POST['remote_link'], $this->userinfo['user_id'], $this->userinfo['user_email']);
         } else {
            $id = $this->videos->create_submitted_video($_POST['video_name'], $_POST['video_description'], $_FILES['video_file'], $_POST['remote_link'], '0', $_POST['submitter_email']);
         }
         if($_FILES['thumb_file'] != null && $this->videos->check_valid_thumb($_FILES['thumb_file']['name'])){
            $this->videos->update_video($id, array('file_thumbnail' => $_FILES['thumb_file']));
         }
         $this->header();
         $this->vt->display($this->base_path.'/templates/submitted_video.tpl');
         $this->footer();
      } else {
         $this->header();
         $this->vt->assign('error', $file_validity_check);
         $this->vt->display($this->base_path.'/templates/error_submit.tpl');
         $this->footer();
      }
   }
   
   function download_submitted_video(){
      $this->videos->download_video($_GET['video_id']);
   }
   
   function view(){
      $this->header();
      
      $video_id = is_numeric($_REQUEST['video_id']) ? $_REQUEST['video_id'] : false;
      if($video_id != false && $this->videos->video_exists_approve($video_id)){
         
         //Update views
         if($this->videos->check_repstop($video_id, 'view') == false){
            $this->videos->update_views($video_id, true);   
         }
         
         
         $video = $this->videos->get_video($video_id);

         $full_page_link = 'http://'.$_SERVER['HTTP_HOST'].(dirname($_SERVER['SCRIPT_NAME']) != '' ? dirname($_SERVER['SCRIPT_NAME']) : '').basename($_SERVER['SCRIPT_NAME']).'?name='.$this->module_name.'&op=view&video_id='.$video_id;
         $full_stream_link = 'http://'.$_SERVER['HTTP_HOST'].(dirname($_SERVER['SCRIPT_NAME']) != '' ? dirname($_SERVER['SCRIPT_NAME']) : '').basename($_SERVER['SCRIPT_NAME']).'?name='.$this->module_name.'&op=download_stream&video_id='.$video_id;
         $full_thumb_link = 'http://'.$_SERVER['HTTP_HOST'].(dirname($_SERVER['SCRIPT_NAME']) != '' ? dirname($_SERVER['SCRIPT_NAME']) : '').'modules/'.$this->module_name.'/files/thumbnails/'.$video_id.'_'.$video['file_thumbnail'];

         $video['full_stream_link'] = urlencode($full_stream_link);
         $video['html_link'] = htmlspecialchars('<a href="'.$full_page_link.'" target="_blank"></a><img src="'.$full_thumb_link.'" width=115></a><br><a href="'.$full_page_link.'" target="_blank">'.$this->languages->defines['click_to_view'].'</a>');
         $video['bb_link'] = htmlspecialchars('[url='.$full_page_link.'][img]'.$full_thumb_link.'[/img][/url][url='.$full_page_link.']'.$this->languages->defines['click_to_view'].'[/url]');
         
         $valid_ratings = array(5, 4, 3, 2, 1);
         
         $is_user = is_user($this->user) ? true : false;
         
         $this->vt->assign('comments', $this->videos->get_comments($video_id));
         $this->vt->assign('is_user', $is_user);
         $this->vt->assign('is_admin', is_admin($this->admin));
         $this->vt->assign('submitted_by', $this->get_user_info($video['submitted_by']));
         $this->vt->assign('valid_ratings', $valid_ratings);
         $this->vt->assign('video', $video);
         $this->vt->assign('video_player_template', $this->videos->determine_player($video['extension_converted'] != '' ? $video['extension_converted'] : $video['extension_video']).'.tpl');
         
         $this->vt->display($this->base_path.'/templates/display_video.tpl');

         $this->vt->display($this->base_path.'/templates/display_comments.tpl');

      } else {

         $this->vt->display($this->base_path.'/templates/video_noexist.tpl');

      }
      
      
      $this->footer();   
      
   }
   
   function download_video(){
      $video_id = is_numeric($_REQUEST['video_id']) ? $_REQUEST['video_id'] : false;
      if($video_id != false && $this->videos->video_exists_approve($video_id)){
         $this->videos->download_video($video_id);
      }
   }
   
   function download_converted(){
      $video_id = is_numeric($_REQUEST['video_id']) ? $_REQUEST['video_id'] : false;
      if($video_id != false && $this->videos->video_exists_approve($video_id)){
         $this->videos->download_converted($video_id);
      }
   }

   function download_stream(){
      $video_id = is_numeric($_REQUEST['video_id']) ? $_REQUEST['video_id'] : false;
      if($video_id != false && $this->videos->video_exists_approve($video_id)){
         $this->videos->stream_converted($video_id);
      }
   }
   
   function download_remote(){
      $video_id = is_numeric($_REQUEST['video_id']) ? $_REQUEST['video_id'] : false;
      if($video_id != false && $this->videos->video_exists_approve($video_id)){
         $this->videos->download_remote($video_id);
      }
   }
   
   function rate_video(){
      $video_id = is_numeric($_REQUEST['video_id']) ? $_REQUEST['video_id'] : false;
      if($video_id != false && $this->videos->video_exists_approve($video_id)){
         $valid_ratings = array(1, 2, 3, 4, 5);
         if(isset($_REQUEST['rating']) && in_array($_REQUEST['rating'], $valid_ratings)){
            if($this->videos->check_repstop($video_id, 'rating') == false){
               $this->videos->update_rating($video_id, $_REQUEST['rating'], true);   
            }
            header('Location: '.basename($_SERVER['SCRIPT_NAME']).'?name='.$this->module_name.'&op=view&video_id='.$video_id);
         }
      }
      
   }
   
   function post_comment(){
      $video_id = is_numeric($_POST['video_id']) ? $_POST['video_id'] : false;
      if($video_id != false && $this->videos->video_exists_approve($video_id)){
         $this->videos->create_comment($video_id, $this->userinfo['user_id'], $_POST['subject'], $_POST['comment']);
         header('Location: '.basename($_SERVER['SCRIPT_NAME']).'?name='.$this->module_name.'&op=view&video_id='.$video_id);
      }
   }
   
   function delete_comment(){
      $video_id = is_numeric($_GET['video_id']) ? $_GET['video_id'] : false;
      $comment_id = is_numeric($_GET['comment_id']) ? $_GET['comment_id'] : false;
      if($video_id !== false && $comment_id !== false && is_admin($this->admin)){
         $this->videos->delete_comment($comment_id);   
      }
      header('Location: '.basename($_SERVER['SCRIPT_NAME']).'?name='.$this->module_name.'&op=view&video_id='.$video_id);
   }
   
   function get_user_info($user_id){
      if($user_id > 0){
         $result_id = $this->db->sql_query("select * from ".$this->user_prefix."_users where user_id='".$user_id."'");
         if($this->db->sql_numrows($result_id) > 0){
            return $this->db->sql_fetchrow($result_id);
         } else {
            return false;
         }
      } else {
         return false;
      }
   }
   
   function view_user(){
      if(is_numeric($_REQUEST['user_id'])){
         $user_info = $this->get_user_info($_REQUEST['user_id']);
         if($user_info !== false){
            $this->vt->assign('user_info', $user_info);
            $this->vt->assign('videos', $this->videos->get_user_videos($user_info['user_id']));
            
            $this->header();
            $this->vt->display($this->base_path.'/templates/view_user.tpl');
            $this->footer();
         }
      }
   }
   
   function send_to_a_friend(){
         
      switch($_REQUEST['action']){
         
         case 'send':
            $video_id = is_numeric($_REQUEST['video_id']) ? $_REQUEST['video_id'] : false;
            if($video_id != false && $this->videos->video_exists_approve($video_id)){
               $sender_email = $_POST['sender_email'];
               $receiver_email = $_POST['receiver_email'];
               
               $this->vt->assign('sender_email', $sender_email);   
               
               $video = $this->videos->get_video($video_id);
               $this->vt->assign('video', $video);
               $url = 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']).'modules.php?name=Video&op=view&video_id='.$video_id;
               $this->vt->assign('url', $url);            
               
               $message = $this->vt->generate($this->base_path.'/templates/mail_send_to_friend.tpl');
               
               mail($receiver_email, $this->languages->defines['View_this_Video'], $message, 'From: '.$sender_email.'');
            
               $this->header();
               $this->vt->display($this->base_path.'/templates/sent_to_friend.tpl');
               $this->footer();
            }
            break;
         
         default:
            $this->header();
            $video_id = is_numeric($_REQUEST['video_id']) ? $_REQUEST['video_id'] : false;
            if($video_id != false && $this->videos->video_exists_approve($video_id)){
               $video = $this->videos->get_video($video_id);
               $this->vt->assign('video', $video);
               $this->vt->display($this->base_path.'/templates/send_to_friend.tpl');
            }
            $this->footer();
            break;
         
      }
      
   }
   
   
   function report_broken(){
         
      switch($_REQUEST['action']){
         
         case 'submit':
            $video_id = is_numeric($_POST['video_id']) ? $_POST['video_id'] : false;
            if($video_id != false && $this->videos->video_exists_approve($video_id)){
               $ip = $_SERVER['REMOTE_ADDR'];
               $description = htmlspecialchars($_POST['description']);
               
               $video = $this->videos->get_video($video_id);
               $this->vt->assign('video', $video);
               $url = 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']).'/modules.php?name=Video&op=view&video_id='.$video_id;
               $this->vt->assign('url', $url);
               $this->vt->assign('ip', $ip);
               $this->vt->assign('description', $description);   
               
               $message = $this->vt->generate($this->base_path.'/templates/mail_report_broken.tpl');
               mail($this->config['conf_email'], $this->languages->defines['Broken_Video'], $message, 'From: '.$this->config['conf_email'].'');
            
               $this->header();
               $this->vt->display($this->base_path.'/templates/report_thanks.tpl');
               $this->footer();
            }
            break;
         
         default:
            $this->header();
            $video_id = is_numeric($_REQUEST['video_id']) ? $_REQUEST['video_id'] : false;
            if($video_id != false && $this->videos->video_exists_approve($video_id)){
               $video = $this->videos->get_video($video_id);
               $this->vt->assign('video', $video);
               $this->vt->display($this->base_path.'/templates/report_broken.tpl');
            }
            $this->footer();
            break;
         
      }
      
   }
   
   function terms(){
      $this->header();

      $this->vt->display($this->base_path.'/templates/terms.tpl');

      $this->footer();   
   }
   
}

?>



videos.php

Code:
<?php

class vidmod_videos {
   
   //Video player formats and valid extensions
   var $video_formats = array('flv_player' => array('flv'),
                        'wmv_player'   => array('wmv', 'avi', 'mpeg', 'mpg'),
                        'qt_player' => array('qt', 'mov'),
                        'real_player' => array('ra', 'rv', 'rm', 'rpm', 'ram')
                  );

   var $thumb_formats = array('jpg', 'jpeg', 'gif', 'png');
   
   function vidmod_videos(){
      global $user, $db, $prefix, $user_prefix;
      
      //PHPNuke functions / vars
      $this->db = &$db;
      $this->prefix = &$prefix;
      $this->user_prefix = &$user_prefix;
      $this->user = &$user;
      $this->userinfo =  is_user($user) ? getusrinfo($user) : array();
      

      //Module specific
      $this->file_path = dirname(__FILE__);

      require_once(dirname(__FILE__).'/settings.php');
      $this->settings = new vidmod_settings();
      $this->config = $this->settings->get_settings();

      $this->domain_video_path = 'modules/Video/files/videos/';
      $this->domain_thumbnail_path = 'modules/Video/files/thumbnails/';
      $this->domain_converted_path = 'modules/Video/files/converted/';
      
      $this->video_path = $this->file_path.'/files/videos/';
      $this->thumbnail_path = $this->file_path.'/files/thumbnails/';
      $this->converted_path = $this->file_path.'/files/converted/';
      
      $this->ftp_video_path = $this->file_path.'/files/ftp/videos/';
      $this->ftp_thumbnail_path = $this->file_path.'/files/ftp/thumbnails/';
      $this->ftp_converted_path = $this->file_path.'/files/ftp/converted/';
   }
   
   function create_submitted_video($name, $description, $video_file, $remote_link, $user_id, $submitter_email){
      $this->db->sql_query("insert into ".$this->prefix."_vidmod_videos values (null, 0, '".htmlspecialchars($name,  ENT_QUOTES)."', '".htmlspecialchars($description,  ENT_QUOTES)."', '', '', '', '".htmlspecialchars($remote_link, ENT_QUOTES)."', '0', '0', '0', '0', '".$this->config['defaultchk_dl_original']."', '".$this->config['defaultchk_stream_converted']."', '".$user_id."', '".htmlspecialchars($submitter_email,  ENT_QUOTES)."', ".time().", '0')");
      $video_id = $this->db->sql_nextid();
      $filename = $this->upload_video($video_id, $video_file);
      $this->db->sql_query("update ".$this->prefix."_vidmod_videos set file_video='".mysql_escape_string($filename)."' where id=".$video_id."");
      return $video_id;
   }
   
   function create_ftp_video($category_id, $video_file, $upload_video_file, $remote_link, $converted_file, $upload_converted_file, $thumb_file, $upload_thumb_file, $name, $description, $allow_dl_original, $stream_converted){
      $this->db->sql_query("insert into ".$this->prefix."_vidmod_videos values (null, '".$category_id."', '".htmlspecialchars($name,  ENT_QUOTES)."', '".htmlspecialchars($description,  ENT_QUOTES)."', '', '', '', '".htmlspecialchars($remote_link, ENT_QUOTES)."', '0', '0', '0', '0', '".$allow_dl_original."', '".$stream_converted."', '0', '', ".time().", '1')");
      $video_id = $this->db->sql_nextid();
      
      if($video_file != ''){
         $new_video_file = $video_id.'_'.$video_file;
         rename($this->ftp_video_path.$video_file, $this->video_path.$new_video_file);
      }
      
      if($converted_file != ''){
         $new_converted_file = $video_id.'_'.$converted_file;
         rename($this->ftp_converted_path.$converted_file, $this->converted_path.$new_converted_file);
      }
      
      if($thumb_file != ''){
         $new_thumb_file = $video_id.'_'.$thumb_file;
         rename($this->ftp_thumbnail_path.$thumb_file, $this->thumbnail_path.$new_thumb_file);
      }
      
      $this->db->sql_query("update ".$this->prefix."_vidmod_videos set file_video='".mysql_real_escape_string($video_file)."', file_converted='".mysql_real_escape_string($converted_file)."', file_thumbnail='".mysql_real_escape_string($thumb_file)."' where id='".$video_id."'");
      
      $name_video_file = $this->upload_video($video_id, $upload_video_file);
      if($name_video_file != '')
         $this->db->sql_query("update ".$this->prefix."_vidmod_videos set file_video='".mysql_escape_string($name_video_file)."' where id=".$video_id."");
   
      $name_converted_file = $this->upload_converted($video_id, $upload_converted_file);
      if($name_converted_file != '')
         $this->db->sql_query("update ".$this->prefix."_vidmod_videos set file_converted='".mysql_escape_string($name_converted_file)."' where id=".$video_id."");
   
      $name_thumb_file = $this->upload_thumbnail($video_id, $upload_thumb_file);
      if($name_thumb_file != '')
         $this->db->sql_query("update ".$this->prefix."_vidmod_videos set file_thumbnail='".mysql_escape_string($name_thumb_file)."' where id=".$video_id."");
      
   }
   
   function upload_video($video_id, $file){
      
      $temp_file = $file['tmp_name'];
      $file_name = '';
      if(is_uploaded_file($temp_file)){
         $file_name = $file['name'];
         $video_file = $video_id.'_'.$file_name;
         @unlink($this->video_path.$video_id.$video_file);
         move_uploaded_file($temp_file, $this->video_path.$video_file);
         @chmod($this->video_path.$video_file, 0777);
      }
      return $file_name;
   }
   
   function upload_converted($video_id, $file){
      //Stop upload from timing out
      set_time_limit(0);
      
      $temp_file = $file['tmp_name'];
      $file_name = '';
      if(is_uploaded_file($temp_file)){
         $file_name = $file['name'];
         $video_info = $this->get_video($video_id);
         
         $converted_file = $video_id.'_'.$file_name;
         @unlink($this->converted_path.$video_id.'_'.$video_info['file_converted']);
         move_uploaded_file($temp_file, $this->converted_path.$converted_file);
         @chmod($this->converted_path.$video_id.$converted_file, 0777);
      }
      return $file_name;
   }
   
   function upload_thumbnail($video_id, $file){
      //Stop upload from timing out
      
      set_time_limit(0);
      $temp_file = $file['tmp_name'];
      $file_name = '';
      if(is_uploaded_file($temp_file)){
         $file_name = $file['name'];
         $video_info = $this->get_video($video_id);

         @unlink($this->thumbnail_path.$video_id.'_'.$video_info['file_thumbnail']);
         @unlink($this->thumbnail_path.$video_id.'_'.$file['name']);
         move_uploaded_file($temp_file, $this->thumbnail_path.$video_id.'_'.$file['name']);
         @chmod($this->thumbnail_path.$video_id.'_'.$file['name'], 0777);
      }
      return $file_name;
   }
   
   function update_video($video_id, $update_array){
      //Lazy video updater
      if($this->video_exists($video_id)){
         foreach($update_array as $key => $value){
            if($key == 'file_thumbnail'){
               if($value != null || $value != ''){
                  $value = $this->upload_thumbnail($video_id, $value);
               } else {
                  $value = null;
               }
            } else if($key == 'file_converted'){
               if($value != null || $value != ''){
                  $value = $this->upload_converted($video_id, $value);   
               } else {
                  $value = null;
               }   
            }
            $this->db->sql_query("update ".$this->prefix."_vidmod_videos set ".$key."='".$value."' where id=".$video_id."");
         }   
      }
   }

   function update_ftp_thumbnail($video_id, $file){
      $this->db->sql_query("update ".$this->prefix."_vidmod_videos set file_thumbnail='".$file."' where id=".$video_id."");
   }

   function update_ftp_converted($video_id, $file){
      $this->db->sql_query("update ".$this->prefix."_vidmod_videos set file_converted='".$file."' where id=".$video_id."");
   }
   
   function video_exists($video_id){
      //check if video exists
      if(is_numeric($video_id)){
         $result_id = $this->db->sql_query("select id from ".$this->prefix."_vidmod_videos where id=".$video_id."");
         if($this->db->sql_numrows($result_id) == 1){
            return true;
         }
      }   
      return false;
   }
   
   function video_exists_approve($video_id){
      if(is_numeric($video_id)){
         $result_id = $this->db->sql_query("select id from ".$this->prefix."_vidmod_videos where id=".$video_id." and approved=1");
         if($this->db->sql_numrows($result_id) == 1){
            return true;   
         }   
      }
      return false;   
   }
   
   function approve_video($video_id){
      //Email user here.
      $this->update_video($video_id, array('approved' => 1));
   }
   
   function reject_video($video_id, $reason){
      //Email here
      $this->delete_video($video_id);
   }
   
   function delete_video($video_id){
      //delete video
      if(is_numeric($video_id)){
         $video_info = $this->get_video($video);
         $this->db->sql_query("delete from ".$this->prefix."_vidmod_videos where id=".$video_id."");
         @unlink($this->video_path.$video_id.'_'.$video_info['file_video']);
         @unlink($this->converted_path.$video_id.'_'.$video_info['file_converted']);
         @unlink($this->thumbnail_path.$video_id.'_'.$video_info['file_thumbnail']);
      }
   }
   
   function get_all_submitted_videos(){
      //get video information
      $videos = array();
      $result_id = $this->db->sql_query("select * from ".$this->prefix."_vidmod_videos where approved=0 order by date_created");

      while($video = $this->db->sql_fetchrow($result_id)){
         $video['file_size'] = @filesize($this->video_path.$video['id'].'_'.$video['file_video']);
         $videos[] = $video;   
      }
      
      return $videos;
   }

   function rate_round($rating){
      return round($rating);
   }
   
   function get_video($video_id){
      //get video information
      $video_info = array();
      if(is_numeric($video_id)){
         $result_id = $this->db->sql_query("select * from ".$this->prefix."_vidmod_videos where id=".$video_id."");
         $video_info = $this->db->sql_fetchrow($result_id);
         if($video_info['remote_link'] != ''){
            $video_info['extension_video'] = strtolower(array_pop(explode(".", $video_info['remote_link'])));
            $video_info['extension_converted'] = strtolower(array_pop(explode(".", $video_info['remote_link'])));
         } else {
            $video_info['extension_video'] = strtolower(array_pop(explode(".", $video_info['file_video'])));
            $video_info['extension_converted'] = strtolower(array_pop(explode(".", $video_info['file_converted'])));
         }
         $video_info['comment_count'] = $this->count_comments($video['id']);
         $video_info['rate_round'] = $this->rate_round($video_info['rating_avg']);
      }
      return $video_info;
   }
   
   function get_hottest($start, $end){
      $videos = array();
      $result_id = $this->db->sql_query("select * from ".$this->prefix."_vidmod_videos where approved=1 order by rating_avg desc limit ".$this->config['most_videomax']."");
      $count = 0;
      while($video = $this->db->sql_fetchrow($result_id)){
         $count++;
         if($count >= $start && $count <= $end){
            $video['comment_count'] = $this->count_comments($video['id']);
            $video['rate_round'] = $this->rate_round($video['rating_avg']);
            $videos[] = $video;   
         }
      }
      $this->temp_count = $this->db->sql_numrows($result_id);
      return $videos;
   }
   
   function get_recent($start, $end){
      $videos = array();
      $result_id = $this->db->sql_query("select * from ".$this->prefix."_vidmod_videos where approved=1 order by date_created desc limit ".$this->config['most_videomax']."");
      $count = 0;
      while($video = $this->db->sql_fetchrow($result_id)){
         $count++;
         if($count >= $start && $count <= $end){
            $video['comment_count'] = $this->count_comments($video['id']);
            $video['rate_round'] = $this->rate_round($video['rating_avg']);
            $videos[] = $video;   
         }
      }
      $this->temp_count = $this->db->sql_numrows($result_id);
      return $videos;
   }
   
   function get_most_viewed($start, $end){
      $videos = array();
      $result_id = $this->db->sql_query("select * from ".$this->prefix."_vidmod_videos where approved=1 order by views desc limit ".$this->config['most_videomax']."");
      $count = 0;
      while($video = $this->db->sql_fetchrow($result_id)){
         $count++;
         if($count >= $start && $count <= $end){
            $video['comment_count'] = $this->count_comments($video['id']);
            $video['rate_round'] = $this->rate_round($video['rating_avg']);
            $videos[] = $video;   
         }
      }
      $this->temp_count = $this->db->sql_numrows($result_id);
      return $videos;
   }
   
   function get_category_videos($category_id, $start, $end){
      $videos = array();
      $result_id = $this->db->sql_query("select * from ".$this->prefix."_vidmod_videos where approved=1 and category_id=".$category_id." order by id desc");
      $count = 0;
      while($video = $this->db->sql_fetchrow($result_id)){
         $count++;
         if($count >= $start && $count <= $end){
            $video['comment_count'] = $this->count_comments($video['id']);
            $video['rate_round'] = $this->rate_round($video['rating_avg']);
            $videos[] = $video;   
         }
      }
      $this->temp_count = $this->db->sql_numrows($result_id);
      return $videos;
   }

   function get_user_videos($user_id){
      $videos = array();
      $result_id = $this->db->sql_query("select * from ".$this->prefix."_vidmod_videos where approved=1 and submitted_by='".$user_id."' order by id desc");
      $count = 0;
      
      $count = 0;
      while($video = $this->db->sql_fetchrow($result_id)){
         $video['comment_count'] = $this->count_comments($video['id']);
         $video['rate_round'] = $this->rate_round($video['rating_avg']);
         $videos[] = $video;   
      }

      $this->temp_count = $this->db->sql_numrows($result_id);

      return $videos;
   }
   
   function get_search_videos($query){
      $videos = array();
      
      $result_id = $this->db->sql_query("select * from ".$this->prefix."_vidmod_videos where approved=1 and name like '%".mysql_real_escape_string($query)."%' or description like '%".mysql_real_escape_string($query)."%' order by id desc");
      
      $count = 0;
      while($video = $this->db->sql_fetchrow($result_id)){
         $video['comment_count'] = $this->count_comments($video['id']);
         $video['rate_round'] = $this->rate_round($video['rating_avg']);
         $videos[] = $video;   
         
      }

      $this->temp_count = $this->db->sql_numrows($result_id);

      return $videos;
   }
   
   function create_comment($video_id, $user_id, $subject, $content){
      //create a comment for a specific video
      if($this->video_exists($video_id)){
         $this->db->sql_query("insert into ".$this->prefix."_vidmod_comments values (null, ".$video_id.", ".$user_id.", '".htmlspecialchars($subject)."', '".htmlspecialchars($content)."', ".time().")");
      }
   }
   
   function delete_comment($comment_id){
      //simply delete a comment
      if(is_numeric($comment_id)){
         $this->db->sql_query("delete from ".$this->prefix."_vidmod_comments where id=".$comment_id."");
      }
   }
   
   function get_comments($video_id){
      $comments = array();
      if(is_numeric($video_id)){
         $result_id = $this->db->sql_query("select c.id, c.video_id, c.user_id, u.username, c.subject, c.content, c.date_posted from ".$this->prefix."_vidmod_comments c, ".$this->user_prefix."_users u where c.video_id=".$video_id." and c.user_id=u.user_id order by c.date_posted");   
         while($comment = $this->db->sql_fetchrow($result_id)){
            $comments[] = $comment;   
         }
      }   
      return $comments;
   }
   
   function count_comments($video_id){
      if(is_numeric($video_id)){
         $result_id = $this->db->sql_query("select id from ".$this->prefix."_vidmod_comments where video_id=".$video_id."");
         return $this->db->sql_numrows($result_id);
      }
      return 0;
   }
   
   function update_views($video_id, $add_repstop = false){
      //if valid video, update view count
      if($this->video_exists($video_id)){
         $video_info = $this->get_video($video_id);
         $this->db->sql_query("update ".$this->prefix."_vidmod_videos set views=".($video_info['views'] + 1)." where id=".$video_id."");   
      }
      
      //if add_repstop is true, add ip of viewer to repstop list
      if($add_repstop){
         $this->add_repstop($video_id, 'view');   
      }
   }
   
   function update_rating($video_id, $score, $add_repstop = false){
      //if valid rating and video, update score and rating count
      if($this->valid_rating($score) && $this->video_exists($video_id)){
         $video_info = $this->get_video($video_id);
         $rating_score = $video_info['rating_score'] + $score;
         $rating_count = $video_info['rating_count'] + 1;
         if($rating_count != 0){
            $rating_avg = $rating_score / $rating_count;
         } else {
            $rating_avg = 0;
         }
         $this->db->sql_query("update ".$this->prefix."_vidmod_videos set rating_score=".$rating_score.", rating_count=".$rating_count.", rating_avg=".$rating_avg." where id='".$video_id."'");
      }
      //if add_repstop is true, add ip of rater to repstop list
      if($add_repstop){
         $this->add_repstop($video_id, 'rating');
      }
   }
   
   function check_repstop($video_id, $action = null){
      //if video exists, get repstop count, and return true if user has committed action to video
      $result_id = $this->db->sql_query("select * from ".$this->prefix."_vidmod_repstop where video_id=".$video_id." and action='".mysql_escape_string($action)."' and ip_address='".$_SERVER['REMOTE_ADDR']."'");
         
      if($this->db->sql_numrows($result_id) == 0){
         return false;
      }
      
      return true;
   }
   
   function valid_rating($score){
      //checks for a valid score
      if(is_numeric($score) && $score >= 1 && $score <= 5){
         return true;   
      }
      return false;
   }
   
   function add_repstop($video_id, $action){
      //add ip address and action to video
      if(is_numeric($video_id)){
         $this->db->sql_query("insert into ".$this->prefix."_vidmod_repstop values (".$video_id.", '".mysql_escape_string($action)."', '".$_SERVER['REMOTE_ADDR']."', ".time().")");
      }
   }
   
   function download_video($video_id){
      if($this->video_exists($video_id)){
         $video_info = $this->get_video($video_id);

         $file = $this->domain_video_path.$video_id.'_'.$video_info['file_video'];

         header('Location: '.$file);
      } else {
         die();   
      }
   }

   function stream_converted($video_id){
      if($this->video_exists($video_id)){
         $video_info = $this->get_video($video_id);
         
         if($video_info['remote_link'] != ''){
            $file = $video_info['remote_link'];
         } else {
            if($video_info['file_converted'] != ''){
               $file = $this->domain_converted_path.$video_id.'_'.$video_info['file_converted'];
            } else if($this->config['global_stream_original'] == 1){
               $file = $this->domain_video_path.$video_id.'_'.$video_info['file_video'];
            }
         
         }
         
         header('Location: '.$file);
         
      } else {
         die();   
      }
   }
   
   function download_converted($video_id){
      if($this->video_exists($video_id)){
         $video_info = $this->get_video($video_id);
         $file = $this->domain_converted_path.$video_id.'_'.$video_info['file_converted'];

         header('Location: '.$file);
      } else {
         die();   
      }
   }
   
   function download_remote($video_id){
      if($this->video_exists($video_id)){
         $video_info = $this->get_video($video_id);
         
         $file = $video_info['remote_link'];
         
         header('Location: '.$file);
      } else {
         die();   
      }
   }
   
   function get_random_videos($number){
      $videos = array();
      if($number > 0){
         $result_id = $this->db->sql_query("select id from ".$this->prefix."_vidmod_videos where approved=1");
         $all_videos = array();
         while($temp_video = $this->db->sql_fetchrow($result_id)){
            $all_videos[] = $temp_video['id'];
         }
         if(count($all_videos) > 0){
            if(count($all_videos) < $number)
               $number = count($all_videos);
         
            $vid_ids = array_rand($all_videos, $number);
            
            if(!is_array($vid_ids)){
               $vid_ids = array($vid_ids);
            }
            
            foreach($vid_ids as $key => $id){
               $video = $this->get_video($all_videos[$id]);
               $video['comment_count'] = $this->count_comments($all_videos[$id]);
               $videos[] = $video;
            }
         }
         
      }   
      return $videos;
   }
   
   function get_recent_videos($number){
      $videos = array();
      if($number > 0){
         $result_id = $this->db->sql_query("select id from ".$this->prefix."_vidmod_videos where approved=1 order by id desc limit ".$number." ");
         while($temp_video = $this->db->sql_fetchrow($result_id)){
            $video = $this->get_video($temp_video['id']);
            $video['comment_count'] = $this->count_comments($temp_video['id']);
            $videos[] = $video;
         }
         
      }
      return $videos;
   }
   
   function check_valid_file($filename){
      //This checks whether or not the file name is valid and if the extension
      //is that off a file we want uploaded.
      
      if(!preg_match('/^[a-zA-Z0-9_.\-()]*$/', $filename))
         return 'bad_file_name';
      
      //Get file extension
      $file_extension = strtolower(array_pop(explode(".", $filename)));
      
      foreach($this->video_formats as $video_player){
         foreach($video_player as $video_extension){
            if($video_extension == $file_extension){
               return true;
            }
         }
      }
   
      return 'invalid_extension';
      
   }

   function check_valid_thumb($filename){
      //This checks whether or not the file name is valid and if the extension
      //is that off a file we want uploaded.
      
      if(!preg_match('/^[a-zA-Z0-9_.\-()]*$/', $filename))
         return 'bad_file_name';
      
      //Get file extension
      $file_extension = strtolower(array_pop(explode(".", $filename)));
      
      foreach($this->thumb_formats as $format){
         if($format == $file_extension){
            return true;
         }
      }
   
      return 'invalid_extension';
      
   }
   
   function determine_player($ext){
      foreach($this->video_formats as $key => $video_format){
         if(in_array($ext, $video_format)){
            return $key;   
         }
      }
      return false;
   }
   
}

?>
View user's profile Send private message
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 884

PostPosted: Tue Sep 01, 2009 4:13 am Reply with quote Back to top

Look in the database and see where it is storing the Name of the Video. My guess is that this sql will get the $name....along with the rest of the video info.
Code:
   function get_video($video_id){
      //get video information
      $video_info = array();
      if(is_numeric($video_id)){
         $result_id = $this->db->sql_query("select * from ".$this->prefix."_vidmod_videos where id=".$video_id."");
         $video_info = $this->db->sql_fetchrow($result_id);
         if($video_info['remote_link'] != ''){
            $video_info['extension_video'] = strtolower(array_pop(explode(".", $video_info['remote_link'])));
            $video_info['extension_converted'] = strtolower(array_pop(explode(".", $video_info['remote_link'])));
         } else {
            $video_info['extension_video'] = strtolower(array_pop(explode(".", $video_info['file_video'])));
            $video_info['extension_converted'] = strtolower(array_pop(explode(".", $video_info['file_converted'])));
         }
         $video_info['comment_count'] = $this->count_comments($video['id']);
         $video_info['rate_round'] = $this->rate_round($video_info['rating_avg']);
      }
      return $video_info;
   }


Now take part of this sql and alter it to get the video Name....(I am guessing here becasue I have not way of testing any of this....

Code:
 //get video information
      $video_info = array();
      if(is_numeric($video_id)){
         $result_id = $this->db->sql_query("select * from ".$this->prefix."_vidmod_videos where id=".$video_id."");
         $video_info = $this->db->sql_fetchrow($result_id);
         $name = $video_info['name']


Change name in $video_info['name'] to whatever that field in the database is called.

Once you have that working....include that in Dynamic Titles.

Dawg
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum