/** * Installe le jeu d'essai * * @author Christophe Beyer <*****@*****.**> * @since 2006/10/26 */ public function processInstall() { global $params; $db = new Demo_DB(); $tools = new Demo_Tools(); $db->extract_db_infos(); $db->db_connect(); $fileSQL = '../instal/demo/jeu_essai.sql'; $errors = array(); if (CopixConfig::get('kernel|jeuEssaiInstalled') == 1) { $errors[] = CopixI18N::get('sysutils|demo.error.alreadyInstalled'); } elseif (!is_file($fileSQL)) { $errors[] = CopixI18N::get('sysutils|demo.error.noFileSql'); } if ($errors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $errors), 'back' => CopixUrl::get())); } $contents = file_get_contents($fileSQL); $lines = explode(";\n", $contents); $path = CopixUrl::getRequestedScriptPath(); foreach ($lines as $line) { $line = trim($line); if ($line) { $line = str_replace('<PATH>', $path, $line); // print_r("<br>***line=".$line); $db->run_query($line); } } $db->db_close(); // Copie des dossiers (pas de slashs à la fin!) $tools->installFolder('www/static/malle/2_9a4ba0cdef'); $tools->installFolder('var/data/blog/logos'); $tools->installFolder('www/static/album/2_be8550b87c'); $tools->installFolder('www/static/album/3_cf057489c9'); $tools->installFolder('www/static/album/4_c996b6cf13'); $tools->installFolder('www/static/prefs/avatar'); // Fin CopixConfig::set('kernel|jeuEssaiInstalled', 1); // Vidage de cache CacheServices::clearCache(); CacheServices::clearConfDB(); $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', CopixI18N::get('sysutils|demo.titlePage')); $tplDemo = new CopixTpl(); //$tplDemo->assign ("toto", 1); $tplDemo->assign('demo_txt_installed', CopixI18N::get('sysutils|demo.txt.installed')); $tplDemo->assign('demo_txt_accounts', CopixI18N::get('sysutils|demo.txt.accounts')); $tpl->assign("MAIN", $tplDemo->fetch("demo_install.tpl")); $tpl->assign('MENU', Admin::getMenu('demo')); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
Copyright (c) 2010 CAP-TIC <http://www.cap-tic.fr> */ include_once COPIX_PROJECT_PATH . "themes/default/helper.php"; $module = CopixRequest::get('module'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head profile="http://www.w3.org/2005/10/profile"> <meta content="text/html; charset=UTF-8" http-equiv="content-type" /> <title><?php echo isset($TITLE_BAR) ? $TITLE_BAR : ''; ?> </title> <link rel="icon" type="image/x-icon" href="<?php echo CopixUrl::getRequestedScriptPath(); ?> favicon.ico" /> <?php include_once COPIX_PROJECT_PATH . "themes/default/styles.php"; ?> <?php include_once COPIX_PROJECT_PATH . "themes/default/scripts.php"; ?> <?php echo $HTML_HEAD; ?> </head>
function iconito_multimedia($contents, $attr) { $mode = 'auto'; $cnt = count($contents); if ($cnt > 2) { $cnt = 2; } //print_r($contents); switch ($cnt) { case 2: $mode = $contents[1]; case 1: default: $file = rawurldecode($contents[0]); if ($mode == 'download') { $path = COPIX_WWW_PATH . substr($file, strpos($file, 'static')); if (file_exists($path) || fopen($path, 'r')) { $size = @filesize($path); $size = $size ? ' - ' . KernelMalle::human_file_size($size) : ''; $point = strrpos($file, "."); if ($point !== false) { $ext = substr($file, $point + 1); } $ext = MalleService::getTypeInfos($ext); $pos = strrpos($file, '/'); if ($pos === false) { $name = $file; $href = $name; } else { $name = substr($file, $pos + 1); $href = substr($file, 0, $pos + 1) . rawurlencode($name); } if (strlen($name) > 35) { $name = substr($name, 0, 35) . '...'; } // print_r(); $ret = '<div class="file_dl"><a href="' . $href . '" title="' . htmlentities($file) . '"><img src="' . _resource('img/malle/' . $ext['type_icon32']) . '" width="32" height="32" border="0" title="' . htmlentities($ext['type_text']) . '" alt="' . htmlentities($ext['type_text']) . '" /><div class="name">' . $name . '</div></a><div class="desc">' . $ext['type_text'] . '' . $size . '</div></div>'; } else { $ret = '<div>Fichier ' . $file . ' introuvable</div>'; } } elseif ($mode == 'view') { $point = strrpos($file, "."); if ($point !== false) { $ext = substr($file, $point + 1); } //print_r("ext=$ext"); switch (strtolower($ext)) { case "jpg": case "jpeg": case "gif": case "png": case "bmp": $link = array($file, 'image'); break; case "mp3": $link = array($file, 'mp3'); break; case "wmv": case "mpg": case "mpeg": case "avi": $link = array($file, 'wmv'); break; case "mov": case "mp4": case "m4a": $link = array($file, 'mov'); break; case "amr": $link = array($file, 'amr'); break; case "flv": $link = array($file, 'flv'); break; default: $path = $_SERVER['PHP_SELF']; $pos = strrpos($path, "/"); if ($pos !== false) { $abspath = substr($path, 0, $pos + 1); } if (substr($file, 0, strlen($abspath)) == $abspath) { $file = substr($file, strlen($abspath)); } $link = array($file, 'download'); } $ret = iconito_multimedia($link, NULL); } elseif ($mode == 'mp3') { $width = 200; $height = 20; $ret = '<div><object type="application/x-shockwave-flash" data="' . CopixUrl::getRequestedScriptPath() . 'dewplayer/dewplayer.swf?son=' . $file . '" width="' . $width . '" height="' . $height . '"> <param name="movie" value="' . CopixUrl::getRequestedScriptPath() . 'dewplayer/dewplayer.swf?son=' . $file . '" /><img src="' . _resource('img/music.png') . '" width="16" height="16" border="0" title="MP3" alt="MP3" /></object></div>'; } elseif ($mode == 'wmv') { $id = "media-Player" . md5(mt_rand()); $width = 480; $height = 385; $ret = '<div><object id="' . $id . '" width="' . $width . '" height="' . $height . '" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"> <param name="fileName" value="' . $file . '"> <param name="animationatStart" value="true"> <param name="transparentatStart" value="true"> <param name="autoStart" value="false"> <param name="showControls" value="true"> <param name="loop" value="false"> <embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/fr/download/" id="' . $id . '" name="' . $id . '" displaysize="4" autosize="-1" bgcolor="darkblue" showcontrols="true" showtracker="-1" showdisplay="0" showstatusbar="-1" videoborder3d="-1" width="' . $width . '" height="' . $height . '" src="' . $file . '" autostart="0" designtimesp="5311" loop="false"> </embed> <img src="' . _resource('img/film.png') . '" width="16" height="16" border="0" title="vidéo" alt="vidéo" /> </object></div>'; } elseif ($mode == 'mov' || $mode == 'amr' || $mode == 'mp4' || $mode == 'm4a') { $width = 480; $height = $mode == 'amr' ? 20 : 385; //$id = "media-Player".md5(mt_rand()); $ret = '<div><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="' . $width . '" height="' . $height . '" codebase="http://www.apple.com/qtactivex/qtplugin.cab"> <param name="src" value="' . $file . '"> <param name="autoplay" value="false"> <param name="controller" value="true"> <param name="loop" value="false"> <embed src="' . $file . '" width="' . $width . '" height="' . $height . '" autoplay="false" controller="true" loop="false" pluginspage="http://www.apple.com/quicktime/download/"> </embed> <img src="' . _resource('img/film.png') . '" width="16" height="16" border="0" title="vidéo" alt="vidéo" /> </object></div>'; } elseif ($mode == 'image') { $ret = '<div><img src="' . $file . '" alt="' . htmlentities($file) . '" title="" /></div>'; } elseif ($mode == 'flv') { $rand = md5(mt_rand()); $width = 480; $height = 385; $ret = ' <p id="player-' . $rand . '"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</p> <script type="text/javascript"> var FU = { movie:"' . CopixUrl::getRequestedScriptPath() . 'flvplayer/flvplayer.swf",width:"' . $width . '",height:"' . $height . '",majorversion:"7",build:"0",bgcolor:"#FFFFFF", flashvars:"file=' . (!preg_match("/^https?:\\/\\//", $file) ? CopixUrl::get() : "") . $file . '&showdigits=true&autostart=false" }; UFO.create(FU, "player-' . $rand . '"); </script>'; } elseif ($mode == 'youtube') { if (preg_match("/^([a-zA-Z0-9_-]+)\$/", $file)) { $id = $file; } elseif (preg_match("/v=([a-zA-Z0-9_-]+)/", $file, $regs)) { $id = $regs[1]; } if ($id) { $ret = '<div><object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/' . $id . '"><param name="movie" value="http://www.youtube.com/v/' . $id . '" /><param name="wmode" value="transparent" /><img src="' . _resource('img/film.png') . '" width="16" height="16" border="0" title="vidéo" alt="vidéo" /></object></div>'; } else { $ret = '<div>Problème de paramètre</div>'; } } elseif ($mode == 'googlevideo') { if (preg_match("/^([0-9-]+)\$/", $file)) { $id = $contents[0]; } elseif (preg_match("/docid=([0-9-]+)/", $file, $regs)) { $id = $regs[1]; } if ($id) { $ret = '<div><object width="400" height="326" type="application/x-shockwave-flash" data="http://video.google.com/googleplayer.swf?docId=' . $id . '"><param name="movie" value="http://video.google.com/googleplayer.swf?docId=' . $id . '" /><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="best" /><param name="scale" value="noScale" /><param name="wmode" value="transparent" /><param name="salign" value="TL" /><param name="FlashVars" value="playerMode=embedded" /><img src="' . _resource('img/film.png') . '" width="16" height="16" border="0" title="vidéo" alt="vidéo" /></object></div>'; } else { $ret = '<div>Problème de paramètre</div>'; } } else { //$ret = '<div>Mode indéfini</div>'; $ret = iconito_multimedia(array($file, 'download'), NULL); } } return $ret; }
/** * Affiche des photos d'un album * * @author Christophe Beyer <*****@*****.**> * @since 2008/11/10 * @param string $titre Titre a donner a la zone * @param string $mode Mode utilise. Uniquement dewslider pour l'instant * @param integer $album Id de l'album ou on pioche * @param integer $dossier Id du dossier de l'album ou on pioche * @param integer $width Largeur du player, en pixels * @param integer $height Hauteur du player, en pixels * @param boolean $legendes Si on affiche ou pas les legendes de chaque photo */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService'); // Récupération des paramètres $titre = $this->getParam('titre'); $mode = $this->getParam('mode'); $classeur = intval($this->getParam('classeur')); $album = intval($this->getParam('album')); $dossier = intval($this->getParam('dossier')); $width = intval($this->getParam('width')); $height = intval($this->getParam('height')); $legendes = $this->getParam('legendes'); // Classeur if ($classeur != 0) { $classeur_dao = _dao('classeur|classeur'); $nbPhotos = 0; if ($rClasseur = $classeur_dao->get($classeur)) { $fichier_dao = _dao('classeur|classeurfichier'); $photolist = $fichier_dao->getParDossier($rClasseur->id, $dossier); $nbPhotos = count($photolist); if ($nbPhotos > 0) { if ($mode == 'dewslider') { $arPhotos = array(); foreach ($photolist as $photo) { if ($photo->estUneImage()) { $arPhotos[] = $photo; } } generateClasseurDewsliderXml($rClasseur, $arPhotos, $width, $legendes); $tpl->assign('rClasseur', $rClasseur); } if ($mode == 'js') { $this->addJs('js/iconito/slideshow.js'); $this->addJs('js/iconito/module_welcome.js'); foreach ($photolist as $photo) { if ($photo->estUneImage()) { $arPhotos[] = array('file' => $photo->getLienMiniature($width, ''), 'title' => $photo->titre); } } $tpl->assign('photolist', $arPhotos); } } } } elseif ($album != 0) { $album_dao = _dao('album|album'); $nbPhotos = 0; if ($rAlbum = $album_dao->get($album)) { $photo_dao = _dao('album|photo'); $photolist = $photo_dao->findAllByAlbumAndFolder($album, $dossier); $nbPhotos = count($photolist); if ($nbPhotos > 0) { if ($mode == 'dewslider') { foreach ($photolist as $key => $photo) { $photolist[$key]->folder = CopixUrl::getRequestedScriptPath() . 'static/album/' . $photo->album_id . '_' . $photo->album_cle; $photolist[$key]->file = $photo->photo_id . '_' . $photo->photo_cle . '_' . $width . '.' . $photo->photo_ext; } generateAlbumDewsliderXml($rAlbum, $photolist, $width, $legendes); $tpl->assign('rAlbum', $rAlbum); } } } } $tpl->assign('mode', $mode); $tpl->assign('titre', $titre); $tpl->assign('width', $width); $tpl->assign('height', $height); $tpl->assign('nbPhotos', $nbPhotos); if ($nbPhotos > 0) { $toReturn = $tpl->fetch('zone_photos.tpl'); } return true; }