Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    Join Date
    Nov 2007
    Location
    Toulouse - France
    Posts
    112
    Plugin Contributions
    0

    Default Re: integrate a FLV video reader

    In the function 'list_all_in_dir' I add the red text :

    Code:
    <?php
    /**
     * Simple Video Manager
     *
     * Coded by yellow1912
     * Visit me @ rubikintegration.com
     */
    class simple_video_manager extends yclass {
    	// use var for php4 compatibility
    	var $directory;
    	var $extension;
    	
    	function construct($directory, $extension) {
        	$this->directory = $directory;
        	$this->extension = explode(',',$extension);
        	$this->array_clean_up($this->extension);
        }
        
    	function list_all_in_db(){
    		global $db;
    		return $db->Execute('SELECT * FROM '.TABLE_SIMPLE_VIDEO_MANAGER);
    	}
    	
    	function get($id){
    		global $db;
    		return $db->Execute('SELECT * FROM '.TABLE_SIMPLE_VIDEO_MANAGER.' WHERE id=\''.$id.'\'');
    	}
    	
    	function add($file){
    		global $db, $messageStack;
    		$file = zen_db_prepare_input($file);
    		$filename=$file[0]['value'];
    		if(!$this->file_exists_in_dir($filename)){
    			$messageStack->add(sprintf(VIDEO_MANAGER_FILE_NOT_FOUND, $filename), 'error');
    			return;
    		}
    		if(empty($file[1]['value']))
    			$file[1]['value'] = $filename;
    		
    		if(isset($file[3])&&$file[3]['fieldName']=='id'){
    			$db->perform(TABLE_SIMPLE_VIDEO_MANAGER, $file ,'UPDATE', 'id=\''.$file[3]['value'].'\'');
    			if(mysql_affected_rows($db->link)>0)
    				$messageStack->add(sprintf(VIDEO_MANAGER_FILE_UPDATED,$filename), 'success');
    			else
    				$messageStack->add(sprintf(VIDEO_MANAGER_FILE_UPDATE_FAILED,$filename), 'error');
    		}
    		else{
    			if($this->file_exists_in_db($filename)){
    				$messageStack->add(sprintf(VIDEO_MANAGER_FILE_ALREADY_EXISTS, $filename), 'error');
    				return;
    				}
    			$db->perform(TABLE_SIMPLE_VIDEO_MANAGER, $file);
    			if(mysql_affected_rows($db->link)>0)
    				$messageStack->add(sprintf(VIDEO_MANAGER_FILE_ADDED,$filename), 'success');
    			else
    				$messageStack->add(sprintf(VIDEO_MANAGER_FILE_ADD_FAILED,$filename), 'error');
    		}
    	}
    	
    	function delete($file_id){
    		global $db, $messageStack;
    		$file_id = zen_db_prepare_input($file_id);
    		$db->Execute('DELETE FROM '.TABLE_SIMPLE_VIDEO_MANAGER.' WHERE id=\''.$file_id.'\'');
    		$messageStack->add(sprintf(VIDEO_MANAGER_FILE_REMOVED,mysql_affected_rows($db->link)),'success');
    	}
    	
    	// http://www.laughing-buddha.net/jon/php/dirlist/
    	function list_all_in_dir() {
    	    // create an array to hold directory list
    	    $results = array();
    	    // create a handler for the directory
    	    // keep going until all files in directory have been read
    		$dir = is_dir('../videos');
    		echo 'Is dir : ' . $dir . ' Directory : ' . $this->directory;
    	    if ($handler = opendir($this->directory))			    
    		    while (($file = readdir($handler)) !== false) {
    		        // if $file isn't this directory or its parent, 
    		        // add it to the results array
    		        if ($file != '.' && $file != '..')
    		        	if(in_array(substr($file, strrpos($file, '.')+1), $this->extension))
        		        	$results[] = $file;
    		    }
    	    closedir($handler);
        	return $results;
    	}
    	
    	function file_exists_in_dir($file){
    		return file_exists ($this->directory.$file);
    	}
    	
    	function file_exists_in_db($file){
    		global $db;
    		$count = $db->Execute('SELECT id FROM '.TABLE_SIMPLE_VIDEO_MANAGER.' WHERE filename=\''.$file.'\' LIMIT 1');
    		if($count->RecordCount()>0)
    			return $count->fields['id'];
    		return 0;
    	}
    }
    The result is : Is dir : 1 Directory :

  2. #12
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: integrate a FLV video reader

    Did you make any other changes to the code? for example:
    PHP Code:
    function construct($directory$extension) {
            
    $this->directory $directory;
            
    $this->extension explode(',',$extension);
            
    $this->array_clean_up($this->extension);
        } 
    should be:
    PHP Code:
    function __construct($directory$extension) {
            
    $this->directory $directory;
            
    $this->extension explode(',',$extension);
            
    $this->array_clean_up($this->extension);
        } 
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  3. #13
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: integrate a FLV video reader

    Anyhow, assuming that you are using PHP4, please change the function name "__construct" to "simple_video_manager".
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  4. #14
    Join Date
    Nov 2007
    Location
    Toulouse - France
    Posts
    112
    Plugin Contributions
    0

    Default Re: integrate a FLV video reader

    The result after your mod :

    Code:
    Is dir : 1 Directory : /www/zencart/videos/
    
    Warning: opendir(/www/zencart/videos/): failed to open dir: Invalid argument in c:\program files\easyphp1-8\www\zencart\admin\includes\functions\extra_functions\simple_video_manager.php on line 76
    
    Warning: closedir(): supplied argument is not a valid Directory resource in c:\program files\easyphp1-8\www\zencart\admin\includes\functions\extra_functions\simple_video_manager.php on line 84

  5. #15
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: integrate a FLV video reader

    Seem like the path is not correct.
    Check my PM.
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v151 I want to add a .flv Instructional Video
    By SilverHD in forum General Questions
    Replies: 3
    Last Post: 8 Aug 2013, 02:58 PM
  2. Replies: 5
    Last Post: 12 Oct 2010, 02:54 PM
  3. Using JW Player and FLV flash video in product description
    By keithk in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 17 Aug 2009, 05:02 PM
  4. How to integrate video introduction to the website?
    By sunzhoujian in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 2 Jun 2008, 06:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg