$__autoload['commonUrl'] = dirname(__FILE__) . '/class.common.url.php';\r
$__autoload['commonAjax'] = dirname(__FILE__) . '/class.common.ajax.php';\r
$__autoload['commonDroits'] = dirname(__FILE__) . '/class.common.droits.php';\r
+$__autoload['commonTools'] = dirname(__FILE__) . '/class.common.tools.php';\r
// Instantiation de la classe de contrôle\r
$core = new commonCore();\r
$core->monitoring=true;\r
// Définition des handlers des urls\r
$core->url->registerDefault(array('commonUrl', 'hub'));\r
$core->url->register('ajax', 'ajax', '^ajax(.*)$', array('cubeAjax', 'ajax'));\r
+$core->url->register('tools', 'tools', '^tools(.*)$', array('commonTools', 'hub'));\r
\r
?>
\ No newline at end of file
--- /dev/null
+<?php
+
+class commonTools {
+
+ public static function hub($args) {
+ global $core;
+ $args = cubePage::getArgs($args);
+
+ $function = array_shift($args);
+
+ if (!isset($_GET['light'])) {
+ echo commonPage::header($args);
+ }
+
+ $cb = array('commonTools', $function);
+ if (is_callable($cb)) {
+ echo call_user_func($cb, $args);
+ }
+
+ if (!isset($_GET['light'])) {
+ echo commonPage::footer();
+ }
+ }
+
+ public static function urlDecoder($args) {
+ global $js;
+ $js[] = JS_PATH.'/urldecoder.js';
+
+ global $core;
+ $res = commonPage::barre();
+ $res .= commonPage::tMain();
+ $res .= commonPage::bh();
+ $res.='<form id="urlDecoder" method="post">';
+ $res.='<table class="liste">';
+ $res.='<tr><th colspan="2"><strong>' . __('Décoder une URL') . ' (' . __('de la forme') . ' : http%3A%2F%2Fwww )</strong></th></tr>';
+ $res.='<tr><td>Collez l\'url à décoder</td><td><textarea id="input"></textarea></td></tr>';
+ $res.='<tr><td>Url décodée</td><td><textarea id="output"></textarea></td></tr>';
+ $res.='</table>';
+ $res.='</form>';
+ $res .= '</div>';
+ $res .= commonPage::bf();
+ $res .= commonPage::bMain();
+ return $res;
+ }
+
+ public static function tube($args) {
+ global $css, $js;
+
+ $css = array();
+ $js[] = JS_PATH . '/tube.js';
+ $js[] = JS_PATH . '/modernizr.js';
+
+ $url = $_GET['u'];
+ $hash = sha1($url);
+
+ $web = '/tube/' . $hash . '/';
+ $dir = ROOT . $web;
+ if (!file_exists($dir)) {
+
+ mkdir($dir, 0777, true);
+ $ext = files::getExtension($url);
+ $original = $dir . 'video.' . $ext;
+ copy($url, $original);
+
+ require_once ROOT . '/inc/ws/Util/class.ws.tools.php';
+ wsTools::encodeWebVideos($original);
+ }
+
+
+ $loop = isset($_GET['loop']) ? $_GET['loop'] : 0;
+ $autoplay = isset($_GET['autoplay']) ? $_GET['autoplay'] : 0;
+ $controls = isset($_GET['controls']) ? $_GET['controls'] : 1;
+
+ $fv = array('video' => $url,
+ 'autoPlay' => $autoplay == 1,
+ 'controls' => $controls == 1,
+ 'loop' => $loop == 1);
+
+ if (file_exists($dir . 'video.jpg')) {
+ $poster = $web . 'video.jpg';
+ $fv['poster'] = 'http://' . $_SERVER['HTTP_HOST'] . $poster;
+ }
+
+ $res = '<style type="text/css">';
+ $res.='html, body {margin: 0;padding: 0;height: 100%;color:#fff;overflow:hidden;}';
+ $res.='body{background:#000;}';
+ $res.='video{width:100%;height:100%;}';
+ $res.='#header{display:none;}';
+ $res.='</style>';
+
+ $alt = '<video width="100%" height="100%" data-src="' . $web . '"';
+ if ($controls) {
+ $alt.=' controls="controls"';
+ }
+ if ($loop) {
+ $alt.=' loop="loop"';
+ }
+ if ($autoplay) {
+ $alt.=' autoplay="autoplay"';
+ }
+ if (isset($poster)) {
+ $alt.=' poster="' . $web . 'video.jpg"';
+ }
+ $alt .= '>';
+ $alt .= '</video>';
+
+
+ $res .= cubeMedia::flash2('/swf/video.swf', '100%', '100%', $fv, 'video', '', 10, '#000000', $alt, true);
+
+ //ob_end_clean();
+ echo $res;
+ //exit;
+ }
+
+ public static function browserInfos($args) {
+ global $core;
+ global $jsnomerge;
+ global $js;
+ global $jsvar;
+
+ $jsnomerge[] = 'http://www.featureblend.com/flash_detect_1-0-4/flash_detect_min.js';
+ $js[] = JS_PATH . '/browserInfos.js';
+ $jsvar['NO_FLASH'] = __("Adobe Flash Player non détecté");
+ $res = commonPage::barre();
+ $res .= commonPage::tMain();
+ $res .= commonPage::bh();
+ $res.='<table class="liste">';
+ $res.='<tr><th colspan="2"><strong>' . __('Informations concernant votre navigateur') . '</strong></th></tr>';
+ $res.='<tr><td>' . __('Navigateur') . '</td><td>' . $_SERVER['HTTP_USER_AGENT'] . '</td></tr>';
+ $res.='<tr><td>' . __('Adresse IP') . '</td><td>' . $_SERVER['REMOTE_ADDR'] . '</td></tr>';
+ $res.='<tr><td>' . __('Adobe Flash Player') . '</td><td class="flashversion"></td></tr>';
+ $res.='</table>';
+ $res .= '</div>';
+ $res .= commonPage::bf();
+ $res .= commonPage::bMain();
+ return $res;
+ }
+
+ public static function favicon($args) {
+ global $core;
+ $res = commonPage::barre();
+ $res .= commonPage::tMain();
+ $res .= commonPage::bh();
+ $res.='<form action="' . SITE_PATH . 'tools/makeFavicon" method="post" class="notajax" enctype="multipart/form-data">';
+ $res.='<table class="liste">';
+ $res.='<tr><th><strong>' . __('Générer un favicon') . '</strong></th></tr>';
+ $res.='<tr><td>' . __('Veuillez charger une image carrée (dimensions optimales : 256x256 px)') . '</td></tr>';
+ $res.='<tr class="odd"><td><input type="file" name="file" /></td></tr>';
+ $res.='<tr><td class="right"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Générer le favicon')) . '</a></td></td>';
+ $res.='</table>';
+ $res.='</form>';
+ $res .= '</div>';
+ $res .= commonPage::bf();
+ $res .= commonPage::bMain();
+ return $res;
+ }
+
+ public static function makeFavicon() {
+
+ $tmp = cubeFiles::tempdir();
+ mkdir($tmp, 0777, true);
+
+
+
+ $upload = $_FILES['file']['tmp_name'];
+
+ $icotool = new cubeCommandLine('icotool');
+ $icotool->setArg('c');
+ $icotool->setArg('o', $tmp . '/favicon.ico');
+
+ $sizes = array(16, 32, 57, 64, 72, 114, 128, 256);
+ $apple = array(114, 72, 57);
+
+
+ foreach ($sizes as $s) {
+ if (in_array($s, $apple)) {
+ $r = $tmp . '/favicon-ios-' . $s . '.png';
+ } else {
+ $r = $tmp . '/ico-' . $s . '.png';
+ }
+ $it = new cubeImageTools();
+ $it->loadImage($upload);
+ $it->resize($s, $s, 'crop', true, 'C', 'M', 'transparent');
+ $it->output('png', $r);
+ if (in_array($s, $apple)) {
+ continue;
+ }
+ $icotool->setArg(null, $r);
+ }
+
+ $icotool->execute();
+
+ rename($tmp . '/ico-16.png', $tmp . '/favicon.png');
+
+ foreach ($sizes as $s) {
+ if ($s == 16 || in_array($s, $apple)) {
+ continue;
+ }
+ unlink($tmp . '/ico-' . $s . '.png');
+ }
+
+ $tmpfile = cubeFiles::tempnam() . '.zip';
+
+ $zip = new cubeCommandLine('zip');
+ $zip->cd($tmp);
+ $zip->setArg(null, $tmpfile);
+ $zip->setArg('0');
+ $zip->setArg('u');
+ $zip->setArg('r');
+ $zip->setArg('X');
+ $zip->setArg(null, '.');
+ $zip->execute();
+
+ cubeHTTP::downloadFile($tmpfile, 'favicon.zip');
+ }
+
+}
+
+?>
+++ /dev/null
-<?php
-
-class extranetTools {
-
- public static function hub($args) {
- global $core;
- $args = cubePage::getArgs($args);
-
- $function = array_shift($args);
-
- if (!isset($_GET['light'])) {
- echo commonPage::header($args);
- }
-
- $cb = array('extranetTools', $function);
- if (is_callable($cb)) {
- echo call_user_func($cb, $args);
- }
-
- if (!isset($_GET['light'])) {
- echo commonPage::footer();
- }
- }
-
- public static function urlDecoder($args) {
- global $js;
- $js[] = JS_PATH.'/urldecoder.js';
-
- global $core;
- $res = commonPage::barre();
- $res .= commonPage::tMain();
- $res .= commonPage::bh();
- $res.='<form id="urlDecoder" method="post">';
- $res.='<table class="liste">';
- $res.='<tr><th colspan="2"><strong>' . __('Décoder une URL') . ' (' . __('de la forme') . ' : http%3A%2F%2Fwww )</strong></th></tr>';
- $res.='<tr><td>Collez l\'url à décoder</td><td><textarea id="input"></textarea></td></tr>';
- $res.='<tr><td>Url décodée</td><td><textarea id="output"></textarea></td></tr>';
- $res.='</table>';
- $res.='</form>';
- $res .= '</div>';
- $res .= commonPage::bf();
- $res .= commonPage::bMain();
- return $res;
- }
-
- public static function tube($args) {
- global $css, $js;
-
- $css = array();
- $js[] = JS_PATH . '/tube.js';
- $js[] = JS_PATH . '/modernizr.js';
-
- $url = $_GET['u'];
- $hash = sha1($url);
-
- $web = '/tube/' . $hash . '/';
- $dir = ROOT . $web;
- if (!file_exists($dir)) {
-
- mkdir($dir, 0777, true);
- $ext = files::getExtension($url);
- $original = $dir . 'video.' . $ext;
- copy($url, $original);
-
- require_once ROOT . '/inc/ws/Util/class.ws.tools.php';
- wsTools::encodeWebVideos($original);
- }
-
-
- $loop = isset($_GET['loop']) ? $_GET['loop'] : 0;
- $autoplay = isset($_GET['autoplay']) ? $_GET['autoplay'] : 0;
- $controls = isset($_GET['controls']) ? $_GET['controls'] : 1;
-
- $fv = array('video' => $url,
- 'autoPlay' => $autoplay == 1,
- 'controls' => $controls == 1,
- 'loop' => $loop == 1);
-
- if (file_exists($dir . 'video.jpg')) {
- $poster = $web . 'video.jpg';
- $fv['poster'] = 'http://' . $_SERVER['HTTP_HOST'] . $poster;
- }
-
- $res = '<style type="text/css">';
- $res.='html, body {margin: 0;padding: 0;height: 100%;color:#fff;overflow:hidden;}';
- $res.='body{background:#000;}';
- $res.='video{width:100%;height:100%;}';
- $res.='#header{display:none;}';
- $res.='</style>';
-
- $alt = '<video width="100%" height="100%" data-src="' . $web . '"';
- if ($controls) {
- $alt.=' controls="controls"';
- }
- if ($loop) {
- $alt.=' loop="loop"';
- }
- if ($autoplay) {
- $alt.=' autoplay="autoplay"';
- }
- if (isset($poster)) {
- $alt.=' poster="' . $web . 'video.jpg"';
- }
- $alt .= '>';
- $alt .= '</video>';
-
-
- $res .= cubeMedia::flash2('/swf/video.swf', '100%', '100%', $fv, 'video', '', 10, '#000000', $alt, true);
-
- //ob_end_clean();
- echo $res;
- //exit;
- }
-
- public static function browserInfos($args) {
- global $core;
- global $jsnomerge;
- global $js;
- global $jsvar;
-
- $jsnomerge[] = 'http://www.featureblend.com/flash_detect_1-0-4/flash_detect_min.js';
- $js[] = JS_PATH . '/browserInfos.js';
- $jsvar['NO_FLASH'] = __("Adobe Flash Player non détecté");
- $res = commonPage::barre();
- $res .= commonPage::tMain();
- $res .= commonPage::bh();
- $res.='<table class="liste">';
- $res.='<tr><th colspan="2"><strong>' . __('Informations concernant votre navigateur') . '</strong></th></tr>';
- $res.='<tr><td>' . __('Navigateur') . '</td><td>' . $_SERVER['HTTP_USER_AGENT'] . '</td></tr>';
- $res.='<tr><td>' . __('Adresse IP') . '</td><td>' . $_SERVER['REMOTE_ADDR'] . '</td></tr>';
- $res.='<tr><td>' . __('Adobe Flash Player') . '</td><td class="flashversion"></td></tr>';
- $res.='</table>';
- $res .= '</div>';
- $res .= commonPage::bf();
- $res .= commonPage::bMain();
- return $res;
- }
-
- public static function favicon($args) {
- global $core;
- $res = commonPage::barre();
- $res .= commonPage::tMain();
- $res .= commonPage::bh();
- $res.='<form action="' . SITE_PATH . 'tools/makeFavicon" method="post" class="notajax" enctype="multipart/form-data">';
- $res.='<table class="liste">';
- $res.='<tr><th><strong>' . __('Générer un favicon') . '</strong></th></tr>';
- $res.='<tr><td>' . __('Veuillez charger une image carrée (dimensions optimales : 256x256 px)') . '</td></tr>';
- $res.='<tr class="odd"><td><input type="file" name="file" /></td></tr>';
- $res.='<tr><td class="right"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Générer le favicon')) . '</a></td></td>';
- $res.='</table>';
- $res.='</form>';
- $res .= '</div>';
- $res .= commonPage::bf();
- $res .= commonPage::bMain();
- return $res;
- }
-
- public static function makeFavicon() {
-
- $tmp = cubeFiles::tempdir();
- mkdir($tmp, 0777, true);
-
-
-
- $upload = $_FILES['file']['tmp_name'];
-
- $icotool = new cubeCommandLine('icotool');
- $icotool->setArg('c');
- $icotool->setArg('o', $tmp . '/favicon.ico');
-
- $sizes = array(16, 32, 57, 64, 72, 114, 128, 256);
- $apple = array(114, 72, 57);
-
-
- foreach ($sizes as $s) {
- if (in_array($s, $apple)) {
- $r = $tmp . '/favicon-ios-' . $s . '.png';
- } else {
- $r = $tmp . '/ico-' . $s . '.png';
- }
- $it = new cubeImageTools();
- $it->loadImage($upload);
- $it->resize($s, $s, 'crop', true, 'C', 'M', 'transparent');
- $it->output('png', $r);
- if (in_array($s, $apple)) {
- continue;
- }
- $icotool->setArg(null, $r);
- }
-
- $icotool->execute();
-
- rename($tmp . '/ico-16.png', $tmp . '/favicon.png');
-
- foreach ($sizes as $s) {
- if ($s == 16 || in_array($s, $apple)) {
- continue;
- }
- unlink($tmp . '/ico-' . $s . '.png');
- }
-
- $tmpfile = cubeFiles::tempnam() . '.zip';
-
- $zip = new cubeCommandLine('zip');
- $zip->cd($tmp);
- $zip->setArg(null, $tmpfile);
- $zip->setArg('0');
- $zip->setArg('u');
- $zip->setArg('r');
- $zip->setArg('X');
- $zip->setArg(null, '.');
- $zip->execute();
-
- cubeHTTP::downloadFile($tmpfile, 'favicon.zip');
- }
-
-}
-
-?>
<?php
$core->url->register('cleanDownload', 'cleanDownload', '^cleanDownload$', array('extranetUrl', 'cleanDownload'));
-$core->url->register('tools', 'tools', '^tools(.*)$', array('extranetTools', 'hub'));
?>