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

Last change on this file since 5826 was 4850, checked in by vdigital, 15 years ago

2.0.f (The reset version)

New: includes Reset ALL Charlies' configuration in second tab
New: translation system (Thanks to ddtddt).
minor language/plugin corrections.

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