source: extensions/charlies_content/charlies_config.php @ 10459

Last change on this file since 10459 was 9958, checked in by ddtddt, 14 years ago

[extensions] - charlies_content - add 3gp

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 8.6 KB
Line 
1<?php
2
3/* Configuration of Charlies */
4if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
5if (!defined('IN_ADMIN') or !IN_ADMIN) die('Hacking attempt!');
6load_language('plugin.lang', CHARLIES_PATH);
7
8global $charlie;
9$errors = array();
10$infos = array();
11
12$curtains = array();
13for ($i = 1; $i <= 18; $i++) { $curtains['png' . $i] = 'png' . $i; }
14$curtains['none'] = 'none';
15// Init all extensions and players
16// Existing first
17$extensions = array();
18foreach ($charlie as $tpl => $ext) {
19        if (is_array($ext) and $tpl != 'all') { 
20                $players[] = array( 'name' => $tpl, 'ext' => $ext);
21                $extensions = array_merge($extensions, $ext);
22        }
23}
24// add some wellknown
25$extensions = array_merge($extensions, array( 'flv','swf','pls','m3u','wav',
26        'mid','au','aif','mp3','pdf','asf','wmv','divx','xvid','aiff','aac','bmp',
27        'gsm','mov','mpg','mpeg','mp4','m4a','psd','qt','qtif','qif','qti','snd',
28        'tif','tiff','3g2','3pg','zip','rar','3gp' ));
29// Adding some specific new extension by $conf['Charlies more extensions'] = array('dvx', 'mp8',);
30if (isset($conf['Charlies more extensions']) and is_array($conf['Charlies more extensions']))
31        $extensions = array_merge($extensions, $conf['Charlies more extensions']);
32// Uniqueness
33$extensions = array_unique($extensions);
34
35// Pending TODO
36// Addind some specific new players (comming from $conf['Charlies more players'])
37// Include added TPL (in template-extension as well) => need a change in charlie.inc.php
38// Check if templates are still available
39// Remove deleted players
40
41// Tabsheets
42include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
43$CC_url = get_admin_plugin_menu_link(__FILE__);
44if (!isset($_GET['tab'])) $page['tab'] = 'templates';
45else $page['tab'] = $_GET['tab']; 
46
47$tabsheet = new tabsheet();
48$tabsheet->add('templates', l10n('Templates configuration'), $CC_url.'&amp;tab=templates');
49$tabsheet->add('options', l10n('Players options'), $CC_url.'&amp;tab=options');
50$tabsheet->add('colors', l10n('Players colors'), $CC_url.'&amp;tab=colors');
51$tabsheet->add('curtain', l10n('Curtain selection'), $CC_url.'&amp;tab=curtain');
52$tabsheet->select($page['tab']);
53$tabsheet->assign();
54$template->assign('page', $page['tab']);
55
56$sub = ( isset($_POST['submit']) ) ? true : false;
57
58// Check input on templates
59if ($sub and isset($_POST['from']) and $_POST['from']=='templates') {
60  foreach ($_POST as $tpl => $ext) {
61                if (is_array($ext) and isset($charlie[$tpl])) $charlie[$tpl] = $ext; 
62        }
63}
64// Check input on options
65if ($sub and isset($_POST['from']) and $_POST['from']=='options') {
66  $charlie = array_merge($charlie, $_POST);
67        if ( $charlie['forced_width']!='' and (!is_numeric($charlie['forced_width']) or $charlie['forced_width'] < 90 or $charlie['forced_width'] > 1024 ))
68    array_push($errors, l10n('Forced width is out of range (Correct range: 90-1024)')); 
69        if ( $charlie['forced_height']!='' and (!is_numeric($charlie['forced_height']) or $charlie['forced_height'] < 90 or $charlie['forced_height'] > 1024 ))
70    array_push($errors, l10n('Forced height is out of range (Correct range: 90-1024)')); 
71        if (!is_numeric($charlie['video_default_width']) or $charlie['video_default_width'] < 90 or $charlie['video_default_width'] > 1024 )
72    array_push($errors, l10n('Default width is out of range (Correct range: 90-1024)')); 
73        if (!is_numeric($charlie['video_default_height']) or $charlie['video_default_height'] < 90 or $charlie['video_default_height'] > 1024 )
74    array_push($errors, l10n('Default height is out of range (Correct range: 90-1024)')); 
75        if (!is_numeric($charlie['volume']) or $charlie['volume'] < 0 or $charlie['volume'] > 200 )
76    array_push($errors, l10n('Volume is out of range (Correct range: 0-200)')); 
77  if ($charlie['start_image'] != '' and !is_file($charlie['start_image']))
78    array_push($errors, l10n('Unknown file (Start image)')); 
79  if ($charlie['top1'] != '') {
80                list($url, $x, $y) = explode('|', $charlie['top1'], 3);
81                if ( !is_file($url) or !is_numeric($x) or !is_numeric($x) )
82    array_push($errors, l10n('Unknown file or URL|x|y error (x and y must be numeric)')); 
83        }
84        if ( $charlie['titlesize']!='' and (!is_numeric($charlie['titlesize']) or $charlie['titlesize'] < 12 or $charlie['titlesize'] > 72 ))
85    array_push($errors, l10n('Title font size is out of range (Correct range: 12-72)')); 
86        if (!is_numeric($charlie['iconplaybgalpha']) or $charlie['iconplaybgalpha'] < 0 or $charlie['iconplaybgalpha'] > 100 )
87    array_push($errors, l10n('Play icon transparency is out of range (Correct range: 0-100)')); 
88        if ( $charlie['margin']!='' and (!is_numeric($charlie['margin']) or $charlie['margin'] < 0 or $charlie['margin'] > 40 ))
89    array_push($errors, l10n('Margin is out of range (Correct range: 0-40)')); 
90  if ($charlie['skin'] != '' and !is_file($charlie['skin']))
91    array_push($errors, l10n('Unknown file (skin)')); 
92        if (!is_numeric($charlie['playertimeout']) or $charlie['playertimeout'] < 0 or $charlie['playertimeout'] > 9999 )
93    array_push($errors, l10n('Autohide delay is out of range (Correct range: 0-9999)')); 
94        if (!is_numeric($charlie['playeralpha']) or $charlie['playeralpha'] < 0 or $charlie['playeralpha'] > 100 )
95    array_push($errors, l10n('Player transparency is out of range (Correct range: 0-100)')); 
96        if ( $charlie['srtsize']!='' and (!is_numeric($charlie['srtsize']) or $charlie['srtsize'] < 8 or $charlie['srtsize'] > 24 ))
97    array_push($errors, l10n('Subtitle font size is out of range (Correct range: 8-24)')); 
98  if ($charlie['srturl'] != '' and !is_file($charlie['srturl']) and strtolower(substr($charlie['srturl'],-4))!='.srt')
99    array_push($errors, l10n('Wrong filename or file not found (Subtitles file)')); 
100  if ($charlie['netconnection'] != '' and strtolower(substr($charlie['netconnection'],0,4))!='rtmp')
101    array_push($errors, l10n('Wrong filename. RTMP (Real Time Messaging Protocol) is a TCP based propriety protocol
102    developed by Adobe System for the purpose of streaming Audio/Video data between Flash Player and media server.')); 
103}
104if ($sub and isset($_POST['from']) and $_POST['from']=='colors') {
105        $charlie['color0'] = $_POST['color0'];
106        $charlie['color1'] = $_POST['color1'];
107        $charlie['color2'] = $_POST['color2'];
108        $charlie['color3'] = $_POST['color3'];
109        $charlie['color4'] = $_POST['color4'];
110        $charlie['color5'] = $_POST['color5'];
111        $charlie['color6'] = $_POST['color6'];
112        $charlie['color7'] = $_POST['color7'];
113        $charlie['color8'] = $_POST['color8'];
114        $charlie['color9'] = $_POST['color9'];
115        $charlie['color10'] = $_POST['color10'];
116        $charlie['color11'] = $_POST['color11'];
117        $charlie['color12'] = $_POST['color12'];
118        $charlie['color13'] = $_POST['color13'];
119        $charlie['color14'] = $_POST['color14'];
120        $charlie['color15'] = $_POST['color15'];
121        $charlie['color16'] = $_POST['color16'];
122  $colors =  $charlie['color0']. $charlie['color1'] . $charlie['color2'] . $charlie['color3'] . $charlie['color4']
123                                         . $charlie['color5']. $charlie['color6'] . $charlie['color7'] . $charlie['color8'] . $charlie['color9']
124                                         . $charlie['color10']. $charlie['color11'] . $charlie['color12'] . $charlie['color13'] . $charlie['color14']
125                                         . $charlie['color15']. $charlie['color16'];
126  if ( !preg_match('/^(#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})){17}$/', $colors) ) 
127    array_push($errors, l10n('Invalid color code: 3 or 6 hexadecimal characters, preceded by "#"')); 
128}
129if ($sub and isset($_POST['from']) and $_POST['from']=='curtain') {
130  $charlie['curtain'] = $_POST['curtain'];
131}
132$charlie['title'] = stripslashes(htmlspecialchars(strip_tags($charlie['title'])));
133
134// Submit and errors
135if ( $sub )
136{
137        if ( count($errors) > 0 )
138        array_push($errors, l10n('Your configuration is NOT saved due to above reasons.'));
139}
140// Submit and Advisor => Thanks
141if ( $sub and is_adviser() and count($errors) == 0 )
142        array_push($infos, l10n('You are Adviser and you are not authorized to change this configuration.'));
143unset ( $charlie['all'] );
144// Submit and not Advisor => Update Config table
145if ( $sub and !is_adviser() and count($errors) == 0 )
146{
147  $dir = $conf['local_data_dir'].'/plugins/';
148  @mkdir($dir);
149  $file = fopen( $dir.basename(dirname(__FILE__)).'.dat', 'w' );
150  fwrite($file, serialize($charlie));
151  fclose( $file );
152        array_push($infos, l10n('Your configuration is saved.'));
153}
154// Send data
155
156$template->set_filenames(array(
157    'plugin_admin_content' => dirname(__FILE__) . '/charlies_config.tpl'));
158if (count($errors) != 0) $template->assign('errors', $errors);
159if (count($infos) != 0) $template->assign('infos', $infos);
160if ($charlie['onclick']==0) $charlie['onclick'] =  'playpause'; // ???
161
162$template->assign(array(
163        'Charlies' => $charlie,
164        'CHARLIES_PATH' => CHARLIES_PATH,
165        'curtains' => $curtains,
166        'players' => $players,
167        'extensions' => $extensions,
168        ) );
169$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
170
171//var_dump($charlie);
172?>
Note: See TracBrowser for help on using the repository browser.