Example #1
0
<?php

/**
 * mintypublish Content Management System
 * Copyright (c) 2009-2010 a2h
 * http://github.com/a2h/mintypublish
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * Under section 7b of the GNU General Public License you are
 * required to preserve this notice.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
if ($zvfpcms) {
    echo '<h1>' . $_GET['path'] . '</h1>';
    if (filetypes('embeddable', $_GET['path'])) {
        echo media_html($_GET['path']);
    } else {
        echo '<a href="' . $location['files'] . '/' . $_GET['path'] . '">Download this file</a>';
    }
}
Example #2
0
		</tr>
	
		<?php 
$zvfpcms = true;
include '../../../../config.php';
include '../../../../functions.php';
$mediaquery = mysql_query("SELECT * FROM files");
while ($row = mysql_fetch_array($mediaquery)) {
    $filetype = filetypes('identify', $row['file_filename']);
    // start the row
    echo '<tr>';
    // title
    echo '<td>' . $row['file_filename'] . '</td>';
    // filetype
    echo '<td>' . filetypes('identify', $row['file_filename']) . '</td>';
    if (filetypes('embeddable', $row['file_filename'])) {
        echo '<td><a href="javascript:void(0)" onclick="insertMedia(\'' . $filetype . '\', \'' . $row['file_filename'] . '\', ' . $row['file_id'] . ', true)">Embed</td>';
    } else {
        echo '<td>--</td>';
    }
    echo '<td><a href="javascript:void(0)" onclick="insertMedia(\'' . $filetype . '\', \'' . $row['file_filename'] . '\', ' . $row['file_id'] . ', false)">Link</td>';
    // end the row
    echo '</tr>';
}
?>
		
		<script type="text/javascript">
			function insertMedia(type, filename, id, embed)
			{
				var filedir = '<?php 
echo $location['files'];
Example #3
0
function media_html($fname)
{
    global $location;
    $toreturn = '';
    $ftype = filetypes('identify', $fname);
    $fpath = $location['files'] . '/' . $fname;
    $embedtemp = 'embed' . substr(md5($fname), 0, 5);
    switch ($ftype) {
        case 'audio':
        case 'video':
            $toreturn .= '
			<div id="' . $embedtemp . '"></div>
			<script type="text/javascript">
				var videovars = {
					path: "' . ($ftype == 'video' ? '../' : '') . $fpath . '",
					autoplay: true' . ($ftype == 'video' ? ',
					fullscreen: true' : '') . '
				};
				var videoparams = {
					bgcolor: "#000000",
					allowfullscreen: true
				};
				swfobject.embedSWF("' . $location['root'] . '/player.swf", "' . $embedtemp . '", 800, ' . ($ftype == 'video' ? 450 : 27) . ', "9.0.0", null, videovars, videoparams);
			</script>';
            break;
        case 'image':
            $toreturn .= '<img src="' . $fpath . '" alt="" />';
            break;
        case 'applet':
            // only VERY VERY basic embedding is supported, maybe just go with the old object method so that tinymce can be happy and params can be configured!
            $toreturn .= '
			<div id="' . $embedtemp . '"></div>
			<script type="text/javascript">
				swfobject.embedSWF("' . $fpath . '", "' . $embedtemp . '", 640, 480, "9.0.0");
			</script>';
            break;
        default:
            $toreturn .= 'Unrecognised filetype';
            break;
    }
    return $toreturn;
}