source: extensions/charlies_content/main.inc.php @ 3341

Last change on this file since 3341 was 3341, checked in by vdigital, 11 years ago

+ 2.0.d (Called lumenation bypass)some url were generated in https

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 8.4 KB
Line 
1<?php /*
2Plugin Name: Charlies content
3Version: 2.0.d
4Description: Charlies content is a global solution for none picture files.
5Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=119
6Author: VDigital, rvelices (PhpWebGallery team)
7Author URI: http://www.phpwebgallery.net
8*/
9/* Synopsis
101 - Based on file extension...
112 - A template is used in state of the default content
12
13Localisation of Charlies content: Possible
14
15Requirements/recommendations:
161 - php 5
172 - GETID3 php modules (James Heinrich, Allan Hansen)
183 - $charlie['xxxxx']=array(....extensions....) means:
19    if file extension is in the array a file charlie_xxxxx.tpl will be used and
20    must be in the charlies_content directory
21
22/** History ***************
23  2009-05-24 2.0.d (Called lumenation bypass)
24                   some url were generated with https://
25  2009-04-13 2.0.c
26                   Flipflip proposal to exclude GETID3 for some extends
27                                                 nolive proposal to support GPX extensions
28                                                 Forced width/height are supported by flvstreamer
29  2009-02-15 2.0.b
30                   Admin configuration menu
31                                                 And related changes (New version of GetID3)
32
33  2008-10-30 2.0.a (Not distributed)
34             Smarty version for Piwigo (Don't use it with PhpWebGallery 1.7.x)
35  2008/03/26: error_reporting(E_ERROR | E_WARNING | E_PARSE);
36             during getid3 call (Only one referenced case).             
37  2008/02/22:
38 * 3GP support : video streams from mobile phones.
39   There are two different standards for this format:
40   3gp for GSM-based Phones, or 3g2 for CDMA-based Phones.
41 * $page['slideshow'] active/inactive support for "Pause" enhancement
42   so Charlies won't act on active slideshow but will act on Slideshow pause
43
44  2007-10-21 1.7.a First release for PhpWebGallery 1.7
45  2006-01-06 Video Integrator and followed by Media Integrator
46  and previously Kitof's Original MOD.
47 **/
48
49/**
50 * All media file have to be broadcasted via an embedded player
51 * so link its extention to a player name as to be define
52 * the same player can be used for several extentions
53 */
54  global $conf, $charlie;
55
56if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
57define('CHARLIES_DIR' , basename(dirname(__FILE__)));
58define('CHARLIES_PATH' , PHPWG_PLUGINS_PATH . CHARLIES_DIR . '/');
59define('CHARLIES_VER' , '2.0.d');
60$x = @file_get_contents( $conf['local_data_dir'].'/plugins/'.basename(dirname(__FILE__)).'.dat');
61if ($x!==false) $charlie = unserialize($x);
62if (!isset($charlie['version']) or  $charlie['version'] != CHARLIES_VER) 
63{
64        $charlie['version'] = CHARLIES_VER;
65        if (!isset($charlie['FlvStreamer'])) $charlie['FlvStreamer'] = array('flv',); 
66        if (!isset($charlie['Flash']))                  $charlie['Flash'] = array('swf',); 
67        if (!isset($charlie['Music']))                  $charlie['Music'] = array('pls','m3u','wav','mid','au','aif',); 
68        if (!isset($charlie['mp3Player']))      $charlie['mp3Player'] = array('mp3',); 
69        if (!isset($charlie['Acrobat']))                $charlie['Acrobat'] = array('pdf',); 
70        if (!isset($charlie['WMplayer']))       $charlie['WMplayer'] = array('asf','wmv','divx','xvid',); 
71        if (!isset($charlie['QuickTime']))      $charlie['QuickTime'] = 
72        array('aiff','aac','bmp','gsm','mov','mpg','mpeg','mp4','m4a','psd','qt','qtif','qif','qti','snd','tif','tiff','3g2','3pg');
73        if (!isset($charlie['Archive']))                $charlie['Archive'] = array('zip','rar',); 
74        if (!isset($charlie['GPS']))                            $charlie['GPS'] = array('gpx',); 
75
76        if (!isset($charlie['autoplay']))       $charlie['autoplay'] = 1;
77        if (!isset($charlie['loop']))                   $charlie['loop'] = 1;
78        if (!isset($charlie['full']))                   $charlie['full'] = 1;
79        if (!isset($charlie['forced_width']))   $charlie['forced_width'] = '';
80        if (!isset($charlie['forced_height']))  $charlie['forced_height'] = '';
81        if (!isset($charlie['video_default_width']))            $charlie['video_default_width'] =  320;
82        if (!isset($charlie['video_default_height']))           $charlie['video_default_height'] =  240;
83        if (!isset($charlie['volume']))                 $charlie['volume'] = 150;
84        if (!isset($charlie['onclick']))                $charlie['onclick'] = 'playpause';
85        if (!isset($charlie['onclicktarget']))  $charlie['onclicktarget'] = 0;
86        if (!isset($charlie['ondoubleclick']))  $charlie['ondoubleclick'] = 'fullscreen';
87        if (!isset($charlie['ondoubleclicktarget']))            $charlie['ondoubleclicktarget'] = 0;
88        if (!isset($charlie['buffer']))                 $charlie['buffer'] = 10;
89        if (!isset($charlie['buffermessage']))  $charlie['buffermessage'] = 1;
90        if (!isset($charlie['buffershowbg']))   $charlie['buffershowbg'] = 0;
91        if (!isset($charlie['config']))                 $charlie['config'] = 0;
92        if (!isset($charlie['configxml']))      $charlie['configxml'] = 0;
93        if (!isset($charlie['margin']))                 $charlie['margin'] = 8;
94        if (!isset($charlie['skin']))                   $charlie['skin'] = ''; // './plugins/charlies_content/skin.jpg';
95        if (!isset($charlie['title']))                  $charlie['title'] = '/n/n/nCharlies\' content ';
96        if (!isset($charlie['titlesize']))      $charlie['titlesize'] = 26;
97        if (!isset($charlie['start_image']))            $charlie['start_image'] = './plugins/charlies_content/city-lights.jpg';
98        if (!isset($charlie['showtitleandstartimage']))         $charlie['showtitleandstartimage'] = 0;
99        if (!isset($charlie['showiconplay']))           $charlie['showiconplay'] = 0;
100        if (!isset($charlie['iconplaybgalpha']))        $charlie['iconplaybgalpha'] = 20;
101        if (!isset($charlie['srt']))            $charlie['onclick'] = 0;
102        if (!isset($charlie['showplayer']))             $charlie['showplayer'] = 1;
103        if (!isset($charlie['showloading']))            $charlie['showloading'] = 1;
104        if (!isset($charlie['showmouse']))              $charlie['showmouse'] = 1;
105        if (!isset($charlie['showtime']))               $charlie['showtime'] = 2;
106        if (!isset($charlie['playeralpha']))            $charlie['playeralpha'] = 20;
107        if (!isset($charlie['playertimeout']))          $charlie['playertimeout'] = 1500;
108        if (!isset($charlie['showstop']))       $charlie['showstop'] = 1;
109        if (!isset($charlie['showvolume'])) $charlie['showvolume'] = 1;
110        if (!isset($charlie['showswitchsubtitles']))    $charlie['showswitchsubtitles'] = 0;
111        if (!isset($charlie['loadonstop'])) $charlie['loadonstop'] = 0;
112        if (!isset($charlie['shortcut']))       $charlie['shortcut'] = 1;
113        if (!isset($charlie['phpstream']))              $charlie['phpstream'] = 1;
114        if (!isset($charlie['curtain']))                $charlie['curtain'] = 'none';
115        if (!isset($charlie['start_image']))    $charlie['start_image'] =  CHARLIES_PATH . 'background.jpg';
116        if (!isset($charlie['color16']))
117        {
118                $charlie['color0'] = '#111111';
119                $charlie['color1'] = '#ff7700';
120                $charlie['color2'] = '#444444';
121                $charlie['color3'] = '#ff3333';
122                $charlie['color4'] = '#ff3363';
123                $charlie['color5'] = '#ff7700';
124                $charlie['color6'] = '#111111';
125                $charlie['color7'] = '#ff3333';
126                $charlie['color8'] = '#ff3363';
127                $charlie['color9'] = '#111111';
128                $charlie['color10'] = '#444444';
129                $charlie['color11'] = '#ff3333';
130                $charlie['color12'] = '#ff3363';
131                $charlie['color13'] = '#ff7700';
132                $charlie['color14'] = '#444444';
133                $charlie['color15'] = '#ff3333';
134                $charlie['color16'] = '#111111';
135        }
136
137        $dir = $conf['local_data_dir'].'/plugins/';
138        @mkdir($dir);
139        $file = fopen( $dir.basename(dirname(__FILE__)).'.dat', 'w' );
140        fwrite($file, serialize($charlie));
141        fclose( $file );
142}
143  /* Note: Uppercase extensions are not requested */
144  /**
145   * That means you must have a tpl file for each... player
146   * like for Flash => ./plugings/charlies_content/flash_content.tpl
147   *
148   * Player name is in lower-case followed by _content.tpl
149   */
150
151add_event_handler('render_element_content', 'render_Charlie_element_content', 40, 2 );
152add_event_handler('get_admin_plugin_menu_links', 'Charlie_plugin_admin_menu');
153$all = array();
154foreach ($charlie as $ext) { 
155  if ( is_array($ext)) $all = array_merge ($all, $ext); 
156}
157$conf['file_ext'] = array_merge (
158    $conf['file_ext'], $all, array_map('strtoupper', $all) );
159
160function Charlie_plugin_admin_menu($menu)
161{
162        array_push($menu, array(
163                                'NAME' => 'Charlies\'', 
164                                'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/charlies_config.php'), 
165                        ));
166        return $menu;
167} 
168
169/**
170 * Only if picture.php is active
171 */
172function render_Charlie_element_content($content, $picture)
173{
174  global $template, $charlie, $page, $conf;
175  if ( isset($page['slideshow']) and $page['slideshow'] ) return $content;
176  if ( @$picture['is_picture'] ) return $content; 
177  $all = array();
178  foreach ($charlie as $ext) { if (is_array($ext)) $all = array_merge ($all, $ext); }
179  $charlie['all'] = $all;
180  $extension = strtolower(get_extension($picture['file']));
181  if (!in_array($extension, $charlie['all']))
182  { // in fact nothing to do (Lucky Charlies)
183    return $content; }
184  unset($charlie['all']);
185  include_once(CHARLIES_PATH.'charlies.inc.php');
186  return Charlies_content($picture);
187}
188?>
Note: See TracBrowser for help on using the repository browser.