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