Geeklog France

Mediagallery block

Last ten uploaded

/*
 * This function will display a vertical list of thumbnails for the last
 * 10 uploaded media items, with a link to the the media item.
 *
 * This function can be called from a static page
 *
 * Staticpage Instructions:
 *
 *   To use this function in a static page, the static page must allow PHP
 *   to execute.
 *
 *   Place the following code in the static page:
 *
 *   echo mg_phpblock_last_ten_uploaded();
 *
 */

function mg_phpblock_last_ten_uploaded() {
    global $MG_albums, $_TABLES, $_CONF, $_MG_CONF, $_USER, $glversion;

    require_once($_MG_CONF['path_html'] . 'classMedia.php');

    $retval = '';

    $sql = "SELECT * FROM {$_TABLES['mg_media']} AS m LEFT JOIN {$_TABLES['mg_media_albums']} AS ma ON m.media_id=ma.media_id ORDER BY m.media_upload_time DESC LIMIT 10";
    $result = DB_query($sql,1);
    $nRows = DB_numRows($result);
    for ($x = 0; $x < $nRows; $x++) {
        $row = DB_fetchArray($result);
        if ( $MG_albums[$row['album_id']]->access > 0 ) {
            $media = new Media($row,$row['album_id']);
            $media->constructor($row,$row['album_id']);

            // this returns the thumbnail
            $retval .= '<a href="' . $_MG_CONF['site_url'] . '/media.php?s=' . $row['media_id'] . '">' . $media->displayRawThumb() . '</a>';

            /*
             * If you don't want the thumbnail returned, instead just a test link,
             * comment out the above $retval line and uncomment the following lines:
             */

            // this returns a text link to the title:
            // if ( $row['media_title'] == '' ) {
            //     $title = substr(strip_tags(COM_stripslashes($MG_albums[$row['album_id']]->title)),0,30);
            // } else {
            //     $title = substr(strip_tags(COM_stripslashes($row['media_title'])),0,30);
            // }
            // retval .= '<a href="' . $_MG_CONF['site_url'] . '/media.php?s=' . $row['media_id'] . '">' . $title . '</a>';
        }
    }
    return $retval;
}

Top rated

/*
 * This function will display a vertical list of thumbnails for the top
 * 10 rated media items, with a link to the the media item.
 *
 * This function can be called from a static page
 *
 * Staticpage Instructions:
 *
 *   To use this function in a static page, the static page must allow PHP
 *   to execute.
 *
 *   Place the following code in the static page:
 *
 *   echo mg_phpblock_last_ten_uploaded();
 *
 */

function mg_phpblock_top_rated() {
    global $MG_albums, $_TABLES, $_CONF, $_MG_CONF, $_USER, $glversion;

    require_once($_MG_CONF['path_html'] . 'classMedia.php');

    $retval = '';

    $sql = "SELECT * FROM {$_TABLES['mg_media']} AS m LEFT JOIN {$_TABLES['mg_media_albums']} AS ma ON m.media_id=ma.media_id ORDER BY m.media_rating DESC LIMIT 10";
    $result = DB_query($sql,1);
    $nRows = DB_numRows($result);
    for ($x = 0; $x < $nRows; $x++) {
        $row = DB_fetchArray($result);
        if ( $MG_albums[$row['album_id']]->access > 0 ) {
            $media = new Media($row,$row['album_id']);
            $media->constructor($row,$row['album_id']);

            // returns thumbnail link
            $retval .= '<a href="' . $_MG_CONF['site_url'] . '/media.php?s=' . $row['media_id'] . '">' . $media->displayRawThumb() . '</a>';

            /*
             * If you don't want the thumbnail returned, instead just a test link,
             * comment out the above $retval line and uncomment the following lines:
             */

            // this returns a text link to the title:
            // if ( $row['media_title'] == '' ) {
            //     $title = substr(strip_tags(COM_stripslashes($MG_albums[$row['album_id']]->title)),0,30);
            // } else {
            //     $title = substr(strip_tags(COM_stripslashes($row['media_title'])),0,30);
            // }
            // retval .= '<a href="' . $_MG_CONF['site_url'] . '/media.php?s=' . $row['media_id'] . '">' . $title . '</a>';

        }
    }
    return $retval;
}

Random Video Block

/*
 * Random Video Block for Geeklog v1.4.1 and Media Gallery v1.5.0
 *
 * This block will return a random video with the video title and Browse
 * album link displayed below the video.
 *
 * To install, copy this function to your Geeklog lib-custom.php file.
 * Create a Geeklog block, type PHP Block and enter phpblock_mg_randomVideo
 * as the Block Function.
 *
 */

function phpblock_mg_randomVideo() {
    global $_CONF, $MG_albums, $_MG_CONF, $_TABLES, $_USER, $LANG_MG03;

    $retval = '';
    $gotit = 0;

    $sql = "SELECT * FROM {$_TABLES['mg_albums']} as a LEFT JOIN {$_TABLES['mg_media_albums']} as ma
            on a.album_id=ma.album_id LEFT JOIN {$_TABLES['mg_media']} as m on ma.media_id=m.media_id WHERE
            (m.media_type=1 || m.media_type=5) AND a.enable_random=1 AND a.hidden=0 " . COM_getPermSQL('and') . " ORDER BY RAND(NOW()) LIMIT 1";

    $result = DB_query( $sql,1 );
    $nRows  = DB_numRows( $result );
    if ( $nRows > 0 ) {
        $row    = DB_fetchArray( $result );
        $gotit = true;
    } else {
        $gotit = false;
    }

    if ( $gotit ) {
        $videowidth     = 200;
        $videoheight    = 150;
        $aid = $row['album_id'];
        if ( $MG_albums[$aid]->access == 0 ) {
            return '';
        }
        switch(  $row['mime_type']  ) {
            case 'embed' :
                if ( $align != '' && $align != "center") {
                        $u_image = '<div style="' . $float . 'padding:5px;">' .
                            $row['remote_url'] .
                                '</div>';
                } else {
                        $u_image = '<div style="padding:5px;">' .
                            $row['remote_url'] .
                                '</div>';
                                }
                break;
            case 'video/x-ms-asf' :
            case 'video/x-ms-asf-plugin' :
            case 'video/avi' :
            case 'video/msvideo' :
            case 'video/x-msvideo' :
            case 'video/avs-video' :
            case 'video/x-ms-wmv' :
            case 'video/x-ms-wvx' :
            case 'video/x-ms-wm' :
            case 'application/x-troff-msvideo' :
            case 'application/x-ms-wmz' :
            case 'application/x-ms-wmd' :
                $V = new Template($_CONF['path'] . 'plugins/mediagallery/templates');
                $V->set_file (array ('video' => 'view_asf.thtml'));
                $V->set_var(array(
                    'autostart'         => 'true',
                    'enablecontextmenu' => 'true',
                    'stretchtofit'      => 'false',
                    'showstatusbar'     => 'false',
                    'showcontrols'      => 'true',
                    'showdisplay'       => 'false',
                    'height'            => $videoheight,
                    'width'             => $videowidth,
                    'bgcolor'           => '#FFFFFF',
                    'playcount'         => '9999',
                    'loop'              => 'true',
                    'movie'             => $_MG_CONF['site_url'] . '/mediaobjects/orig/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $row['media_mime_ext'],
                    'autostart0'         => '1',
                    'enablecontextmenu0' => '1',
                    'stretchtofit0'      => '0',
                    'showstatusbar0'     => '0',
                    'uimode0'            => 'none',
                    'showcontrols0'      => '1',
                    'showdisplay0'      => '0',
                ));
                $V->parse('output','video');
                if ( $align != '' && $align != "center") {
                    $u_image = '<div style="float:' . $align . ';padding:5px;">' . $V->finish($V->get_var('output')) . '</div>';
                } else {
                    $u_image = '<div style="padding:5px;">' . $V->finish($V->get_var('output')) . '</div>';
                }
                break;
            case 'video/mpeg' :
            case 'video/x-motion-jpeg' :
            case 'video/quicktime' :
            case 'video/mpeg' :
            case 'video/x-mpeg' :
            case 'video/x-mpeq2a' :
            case 'video/x-qtc' :
                $V = new Template($_CONF['path'] . 'plugins/mediagallery/templates');
                $V->set_file (array ('video' => 'view_quicktime.thtml'));
                $V->set_var(array(
                    'autoref'       => 'true',
                    'autoplay'      => 'true',
                    'controller'    => 'true',
                    'kioskmode'     => 'true',
                    'scale'         => 'aspect',
                    'height'        => $videoheight,
                    'width'         => $videowidth,
                    'bgcolor'       => '#F0F0F0',
                    'loop'          => 'true',
                    'movie'         => $_MG_CONF['site_url'] . '/mediaobjects/orig/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $row['media_mime_ext'],
                ));
                $V->parse('output','video');
                if ( $align != '' && $align != "center" ) {
                    $u_image = '<div style="float:' . $align . ';padding:5px;">' . $V->finish($V->get_var('output')) . '</div>';
                } else {
                    $u_image = '<div style="padding:5px;">' . $V->finish($V->get_var('output')) . '</div>';
                }
                break;
            case 'application/x-shockwave-flash' :
                // set the default playback options...
                $playback_options['play']    = $_MG_CONF['swf_play'];
                $playback_options['menu']    = $_MG_CONF['swf_menu'];
                $playback_options['quality'] = $_MG_CONF['swf_quality'];
                $playback_options['height']  = $_MG_CONF['swf_height'];
                $playback_options['width']   = $_MG_CONF['swf_width'];
                $playback_options['loop']    = $_MG_CONF['swf_loop'];
                $playback_options['scale']   = $_MG_CONF['swf_scale'];
                $playback_options['wmode']   = $_MG_CONF['swf_wmode'];
                $playback_options['allowscriptaccess'] = $_MG_CONF['swf_allowscriptaccess'];
                $playback_options['bgcolor']    = $_MG_CONF['swf_bgcolor'];
                $playback_options['swf_version'] = $_MG_CONF['swf_version'];
                $playback_options['flashvars']   = $_MG_CONF['swf_flashvars'];

                $poResult = DB_query("SELECT * FROM {$_TABLES['mg_playback_options']} WHERE media_id='" . $row['media_id'] . "'");
                while ( $poRow = DB_fetchArray($poResult) ) {
                    $playback_options[$poRow['option_name']] = $poRow['option_value'];
                }
                if ( $swfjsinclude > 0 ) {
                    $u_image = '';
                } else {
                    $S = new Template($_CONF['path'] . 'plugins/mediagallery/templates');
                    $S->set_file(array('swf' => 'swfobject.thtml'));
                    $S->set_var(array(
                        'site_url'  => $_MG_CONF['site_url'],
                    ));
                    $S->parse('output','swf');
                    $u_image = $S->finish($S->get_var('output'));
                    $swfjsinclude++;
                }
                $V = new Template($_CONF['path'] . 'plugins/mediagallery/templates');
                $V->set_file (array ('video' => 'view_swf.thtml'));
                $V->set_var(array(
                    'site_url'  => $_MG_CONF['site_url'],
                    'lang_noflash' => $LANG_MG03['no_flash'],
                    'play'      => 'true',
                    'menu'      => ($playback_options['menu'] ? 'true' : 'false'),
                    'loop'      => ($playback_options['loop'] ? 'true' : 'false'),
                    'scale'     => $playback_options['scale'],
                    'wmode'     => $playback_options['wmode'],
                    'flashvars' => $playback_options['flashvars'],
                    'quality'   => $playback_options['quality'],
                    'height'    => $videoheight,
                    'width'     => $videowidth,
                    'asa'       => $playback_options['allowscriptaccess'],
                    'bgcolor'   => $playback_options['bgcolor'],
                    'swf_version' => $playback_options['swf_version'],
                    'filename'  => $row['media_original_filename'],
                    'id'        => $row['media_original_filename'] . rand(),
                    'id2'       => $row['media_original_filename'] . rand(),
                    'movie'     => $_MG_CONF['site_url'] . '/mediaobjects/orig/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $row['media_mime_ext'],
                ));
                $V->parse('output','video');
                $u_image .= '<div style="float:' . $align . ';padding:5px;">' . $V->finish($V->get_var('output'))  . '</div>';
                break;
                        case 'video/x-flv' :
                    // set the default playback options...
                    $playback_options['play']    = $_MG_CONF['swf_play'];
                    $playback_options['menu']    = $_MG_CONF['swf_menu'];
                    $playback_options['quality'] = $_MG_CONF['swf_quality'];
                    $playback_options['height']  = $_MG_CONF['swf_height'];
                    $playback_options['width']   = $_MG_CONF['swf_width'];
                    $playback_options['loop']    = 0;
                    $playback_options['scale']   = $_MG_CONF['swf_scale'];
                    $playback_options['wmode']   = $_MG_CONF['swf_wmode'];
                    $playback_options['allowscriptaccess'] = $_MG_CONF['swf_allowscriptaccess'];
                    $playback_options['bgcolor']    = $_MG_CONF['swf_bgcolor'];
                    $playback_options['swf_version'] = $_MG_CONF['swf_version'];
                    $playback_options['flashvars']   = $_MG_CONF['swf_flashvars'];
                    $poResult = DB_query("SELECT * FROM {$_TABLES['mg_playback_options']} WHERE media_id='" . $row['media_id'] ."'");
                    while ( $poRow = DB_fetchArray($poResult) ) {
                        $playback_options[$poRow['option_name']] = $poRow['option_value'];
                    }
                    if ( $swfjsinclude > 0 ) {
                        $u_image = '';
                    } else {
                        $S = new Template($_CONF['path'] . 'plugins/mediagallery/templates');
                        $S->set_file(array('swf' => 'swfobject.thtml'));
                        $S->set_var(array(
                            'site_url'  => $_MG_CONF['site_url'],
                        ));
                        $S->parse('output','swf');
                        $u_image = $S->finish($S->get_var('output'));
                        $swfjsinclude++;
                    }
                if ( $autoplay == 1 ) {
                    $splash = '';
                } else {
                    $splash = 'splashImageFile: \'' . $_MG_CONF['site_url'] . '/';
                    if ( $row['media_tn_attached'] == 1 ) {
                        $splash .= '/mediaobjects/tn/' . $row['media_filename'][0] . '/tn_' . $row['media_filename'] . '.jpg';
                    } else {
                        $splash .= '/players/play.jpg';
                    }
                    $splash .= "',";
                }
                $finalFlashVar = "config={ videoFile: '" . $_MG_CONF['site_url'] . '/mediaobjects/orig/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $row['media_mime_ext'] . "?source=1', " . $splash . " autoBuffering: false, play: " . ($autoplay ? 'true' : 'false') . ", loop: false}";

                if ( $row['remote_media'] == 1 ) {
                    $urlParts = array();
                    $urlParts = parse_url($row['remote_url']);

                    $pathParts = array();
                    $pathParts = explode('/',$urlParts['path']);

                    $ppCount = count($pathParts);
                    $pPath = '';
                    for ($i=1; $i<$ppCount-1;$i++) {
                        $pPath .= '/' . $pathParts[$i];
                    }
                    $videoFile = $pathParts[$ppCount-1];

                    $pos = strrpos($videoFile, '.');
                    if($pos === false) {
                        $basefilename = $videoFile;
                    } else {
                        $basefilename = substr($videoFile,0,$pos);
                    }

                    $streamingServerURL = $urlParts['scheme'] . '://' . $urlParts['host'] . $pPath;
                    $finalFlashVar = "config={streamingServerURL: '" . $streamingServerURL . "', videoFile: '" . $basefilename . "', streamingServer: 'fms', " . $splash . " autoPlay: " . ($autoplay ? 'true' : 'false') . ", startingBufferLength: 5, bufferLength: 20, loop: false, initialScale: 'orig', hideControls: false }";
                }

                $V = new Template($_CONF['path'] . 'plugins/mediagallery/templates');
                $V->set_file (array ('video' => 'view_flv_light.thtml'));
                $V->set_var(array(
                    'site_url'  => $_MG_CONF['site_url'],
                    'lang_noflash' => $LANG_MG03['no_flash'],
                    'play'      => ($autoplay ? 'true' : 'false'),
                    'menu'      => ($playback_options['menu'] ? 'true' : 'false'),
                    'loop'      => ($playback_options['loop'] ? 'true' : 'false'),
                    'scale'     => $playback_options['scale'],
                    'wmode'     => $playback_options['wmode'],
                    'flashvars' => $finalFlashVar,
                    'quality'   => 'high',
                    'height'    => $videoheight + 24, // allow 24px for player controls
                    'width'     => $videowidth,
                    'asa'       => 'false',
                    'bgcolor'   => '#0f0f0f',
                    'swf_version' => '9',
                    'filename'  => $row['media_original_filename'],
                    'id'        => 'flvvideo' . rand(),
                    'id2'       => 'flvvideo' . rand(),
                    'movie'     => $_MG_CONF['site_url'] . '/mediaobjects/orig/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $row['media_mime_ext'],
                    'splash'    => $splash,
                ));
                $V->parse('output','video');
                $u_image .= '<div style="float:' . $align . ';padding:5px;">' . $V->finish($V->get_var('output'))  . '</div>';
                break;
        }
        return $u_image . '<div style="text-align:center;">' . $row['media_title'] . '</div><div style="text-align:center;"><a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $aid . '">Browse Album</a></div>';
    } else {
        return 'No Videos Found';
    }
}
/*
 * Random Video Block for Media Gallery v1.6.0
 *
 * Updated August 18, 2008
 *
 * This block will return a random video with the video title and Browse
 * album link displayed below the video.
 *
 * To install, copy this function to your lib-custom.php file.
 * Create a Geeklog block, type PHP Block and enter phpblock_mg_randomVideo
 * as the Block Function.
 *
 */
 
function phpblock_mg_randomVideo() {
    global $_CONF, $MG_albums, $_MG_CONF, $_TABLES, $_USER, $LANG_MG03;
 
    $retval = '';
    $gotit = 0;
 
    $sql = "SELECT * FROM {$_TABLES['mg_albums']} as a LEFT JOIN {$_TABLES['mg_media_albums']} as ma
            on a.album_id=ma.album_id LEFT JOIN {$_TABLES['mg_media']} as m on ma.media_id=m.media_id WHERE
            (m.media_type=1 || m.media_type=5) AND a.enable_random=1 AND a.hidden=0 " . COM_getPermSQL('and') . " ORDER BY RAND(NOW()) LIMIT 1";
 
    $result = DB_query( $sql,1 );
    $nRows  = DB_numRows( $result );
    if ( $nRows > 0 ) {
        $row    = DB_fetchArray( $result );
        $gotit = true;
    } else {
        $gotit = false;
    }
 
    if ( $gotit ) {
        $videowidth = 200;
        $videoheight = 150;
        $aid = $row['album_id'];
        if ( $MG_albums[$aid]->access == 0 ) {
            return '';
        }
        switch(  $row['mime_type']  ) {
            case 'embed' :
                if ( $align != '' && $align != "center") {
                        $u_image = '<div style="' . $float . 'padding:5px;">' .
                            $row['remote_url'] .
                                '</div>';
                } else {
                        $u_image = '<div style="padding:5px;">' .
                            $row['remote_url'] .
                                '</div>';
                                }
                break;
            case 'video/x-ms-asf' :
            case 'video/x-ms-asf-plugin' :
            case 'video/avi' :
            case 'video/msvideo' :
            case 'video/x-msvideo' :
            case 'video/avs-video' :
            case 'video/x-ms-wmv' :
            case 'video/x-ms-wvx' :
            case 'video/x-ms-wm' :
            case 'application/x-troff-msvideo' :
            case 'application/x-ms-wmz' :
            case 'application/x-ms-wmd' :
                $V = new Template($_CONF['path'] . 'plugins/mediagallery/templates');
                $V->set_file (array ('video' => 'view_asf.thtml'));
                $V->set_var(array(
                    'autostart'         => 'true',
                    'enablecontextmenu' => 'true',
                    'stretchtofit'      => 'false',
                    'showstatusbar'     => 'false',
                    'showcontrols'      => 'true',
                    'showdisplay'       => 'false',
                    'height'            => $videoheight,
                    'width'             => $videowidth,
                    'bgcolor'           => '#FFFFFF',
                    'playcount'         => '9999',
                    'loop'              => 'true',
                    'movie'             => $_MG_CONF['site_url'] . '/mediaobjects/orig/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $row['media_mime_ext'],
                    'autostart0'         => '1',
                    'enablecontextmenu0' => '1',
                    'stretchtofit0'      => '0',
                    'showstatusbar0'     => '0',
                    'uimode0'            => 'none',
                    'showcontrols0'      => '1',
                    'showdisplay0'      => '0',
                ));
                $V->parse('output','video');
                if ( $align != '' && $align != "center") {
                    $u_image = '<div style="float:' . $align . ';padding:5px;">' . $V->finish($V->get_var('output')) . '</div>';
                } else {
                    $u_image = '<div style="padding:5px;">' . $V->finish($V->get_var('output')) . '</div>';
                }
                break;
 
 
            case 'video/mpeg' :
            case 'video/x-motion-jpeg' :
            case 'video/quicktime' :
            case 'video/mpeg' :
            case 'video/x-mpeg' :
            case 'video/x-mpeq2a' :
            case 'video/x-qtc' :
                $V = new Template($_CONF['path'] . 'plugins/mediagallery/templates');
                $V->set_file (array ('video' => 'view_quicktime.thtml'));
                $V->set_var(array(
                    'autoref'       => 'true',
                    'autoplay'      => 'true',
                    'controller'    => 'true',
                    'kioskmode'     => 'true',
                    'scale'         => 'aspect',
                    'height'        => $videoheight,
                    'width'         => $videowidth,
                    'bgcolor'       => '#F0F0F0',
                    'loop'          => 'true',
                    'movie'         => $_MG_CONF['site_url'] . '/mediaobjects/orig/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $row['media_mime_ext'],
                ));
                $V->parse('output','video');
                if ( $align != '' && $align != "center" ) {
                    $u_image = '<div style="float:' . $align . ';padding:5px;">' . $V->finish($V->get_var('output')) . '</div>';
                } else {
                    $u_image = '<div style="padding:5px;">' . $V->finish($V->get_var('output')) . '</div>';
                }
                break;
            case 'application/x-shockwave-flash' :
                // set the default playback options...
                $playback_options['play']    = $_MG_CONF['swf_play'];
                $playback_options['menu']    = $_MG_CONF['swf_menu'];
                $playback_options['quality'] = $_MG_CONF['swf_quality'];
                $playback_options['height']  = $_MG_CONF['swf_height'];
                $playback_options['width']   = $_MG_CONF['swf_width'];
                $playback_options['loop']    = $_MG_CONF['swf_loop'];
                $playback_options['scale']   = $_MG_CONF['swf_scale'];
                $playback_options['wmode']   = $_MG_CONF['swf_wmode'];
                $playback_options['allowscriptaccess'] = $_MG_CONF['swf_allowscriptaccess'];
                $playback_options['bgcolor']    = $_MG_CONF['swf_bgcolor'];
                $playback_options['swf_version'] = $_MG_CONF['swf_version'];
                $playback_options['flashvars']   = $_MG_CONF['swf_flashvars'];
 
                $poResult = DB_query("SELECT * FROM {$_TABLES['mg_playback_options']} WHERE media_id='" . $row['media_id'] . "'");
                while ( $poRow = DB_fetchArray($poResult) ) {
                    $playback_options[$poRow['option_name']] = $poRow['option_value'];
                }
                if ( $swfjsinclude > 0 ) {
                    $u_image = '';
                } else {
                    $S = new Template($_CONF['path'] . 'plugins/mediagallery/templates');
                    $S->set_file(array('swf' => 'swfobject.thtml'));
                    $S->set_var(array(
                        'site_url'  => $_MG_CONF['site_url'],
                    ));
                    $S->parse('output','swf');
                    $u_image = $S->finish($S->get_var('output'));
                    $swfjsinclude++;
                }
                $V = new Template($_CONF['path'] . 'plugins/mediagallery/templates');
                $V->set_file (array ('video' => 'view_swf.thtml'));
                $V->set_var(array(
                    'site_url'  => $_MG_CONF['site_url'],
                    'lang_noflash' => $LANG_MG03['no_flash'],
                    'play'      => 'true',
                    'menu'      => ($playback_options['menu'] ? 'true' : 'false'),
                    'loop'      => ($playback_options['loop'] ? 'true' : 'false'),
                    'scale'     => $playback_options['scale'],
                    'wmode'     => $playback_options['wmode'],
                    'flashvars' => $playback_options['flashvars'],
                    'quality'   => $playback_options['quality'],
                    'height'    => $videoheight,
                    'width'     => $videowidth,
                    'asa'       => $playback_options['allowscriptaccess'],
                    'bgcolor'   => $playback_options['bgcolor'],
                    'swf_version' => $playback_options['swf_version'],
                    'filename'  => $row['media_original_filename'],
                    'id'        => $row['media_original_filename'] . rand(),
                    'id2'       => $row['media_original_filename'] . rand(),
                    'movie'     => $_MG_CONF['site_url'] . '/mediaobjects/orig/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $row['media_mime_ext'],
                ));
                $V->parse('output','video');
                $u_image .= '<div style="float:' . $align . ';padding:5px;">' . $V->finish($V->get_var('output'))  . '</div>';
                break;
             case 'video/x-flv' :
                // set the default playback options...
                $playback_options['play']    = $_MG_CONF['swf_play'];
                $playback_options['menu']    = $_MG_CONF['swf_menu'];
                $playback_options['quality'] = $_MG_CONF['swf_quality'];
                $playback_options['height']  = $_MG_CONF['swf_height'];
                $playback_options['width']   = $_MG_CONF['swf_width'];
                $playback_options['loop']    = $_MG_CONF['swf_loop'];
                $playback_options['scale']   = $_MG_CONF['swf_scale'];
                $playback_options['wmode']   = $_MG_CONF['swf_wmode'];
                $playback_options['allowscriptaccess'] = $_MG_CONF['swf_allowscriptaccess'];
                $playback_options['bgcolor']    = $_MG_CONF['swf_bgcolor'];
                $playback_options['swf_version'] = $_MG_CONF['swf_version'];
                $playback_options['flashvars']   = $_MG_CONF['swf_flashvars'];
 
                $poResult = DB_query("SELECT * FROM {$_TABLES['mg_playback_options']} WHERE media_id='" . $row['media_id'] . "'");
                while ( $poRow = DB_fetchArray($poResult) ) {
                    $playback_options[$poRow['option_name']] = $poRow['option_value'];
                }
                if ( $swfjsinclude > 0 ) {
                    $u_image = '';
                } else {
                    $S = new Template( MG_getTemplatePath(0) );
                    $S->set_file(array('swf' => 'swfobject.thtml'));
                    $S->set_var(array(
                        'site_url'  => $_MG_CONF['site_url'],
                    ));
                    $S->parse('output','swf');
                    $u_image = $S->finish($S->get_var('output'));
                    $swfjsinclude++;
                }
                $V = new Template( MG_getTemplatePath(0) );
                $V->set_file('video','view_flv_light.thtml');
 
                // now the player specific items.
                $F = new Template( MG_getTemplatePath(0) );
                $F->set_file(array('player' => 'flvfp.thtml'));
                if ( $autoplay == 1 ) {  // auto start
                    $playButton = '';
                } else {
                    if ( $row['media_tn_attached'] == 1 ) {
                        foreach ($_MG_CONF['validExtensions'] as $ext ) {
                            if ( file_exists($_MG_CONF['path_mediaobjects'] . 'tn/' . $row['media_filename'][0] . '/tn_' . $row['media_filename'] . $ext) ) {
                                $playImage = $_MG_CONF['mediaobjects_url'] . '/tn/' . $row['media_filename'][0] . '/tn_' . $row['media_filename'] . $ext;
                                break;
                            }
                        }
                    } else {
                        $playImage = MG_getImageFile('blank_blk.jpg');
                    }
                    $playButton = "{ url: '" . $playImage . "', overlayId: 'play' },";
                }
                if ( $row['remote_media'] == 1 ) {
                    $urlParts = array();
                    $urlParts = parse_url($row['remote_url']);
 
                    $pathParts = array();
                    $pathParts = explode('/',$urlParts['path']);
 
                    $ppCount = count($pathParts);
                    $pPath = '';
                    for ($row=1; $row<$ppCount-1;$row++) {
                        $pPath .= '/' . $pathParts[$row];
                    }
                    $videoFile = $pathParts[$ppCount-1];
 
                    $pos = strrpos($videoFile, '.');
                    if($pos === false) {
                        $basefilename = $videoFile;
                    } else {
                        $basefilename = substr($videoFile,0,$pos);
                    }
                    $videoFile            = $basefilename;
                    $streamingServerURL   = "streamingServerURL: '" . $urlParts['scheme'] . '://' . $urlParts['host'] . $pPath . "',";
                    $streamingServer      = "streamingServer: 'fms',";
                } else {
                    $streamingServerURL   = '';
                    $streamingServer      = '';
                    $videoFile            = urlencode($_MG_CONF['mediaobjects_url'] . '/orig/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $row['media_mime_ext']);
                }
                $width  = $videowidth;
                $height = $videoheight + 22;
                $resolution_x = $videowidth;
                $resolution_y = $videoheight;
                $id  = 'id_'  . rand();
                $id2 = 'id2_' . rand();
                $F->set_var(array(
                    'site_url'          => $_MG_CONF['site_url'],
                    'lang_noflash'      => $LANG_MG03['no_flash'],
                    'play'              => ($autoplay ? 'true' : 'false'),
                    'menu'              => ($playback_options['menu'] ? 'true' : 'false'),
                    'loop'              => ($playback_options['loop'] ? 'true' : 'false'),
                    'scale'             => $playback_options['scale'],
                    'wmode'             => $playback_options['wmode'],
                    'width'             => $width,
                    'height'            => $height,
                    'streamingServerURL'=> $streamingServerURL,
                    'streamingServer'   => $streamingServer,
                    'videoFile'         => $videoFile,
                    'playButton'        => $playButton,
                    'id'                => $id,
                    'id2'               => $id2,
                    'resolution_x'      => $resolution_x,
                    'resolution_y'      => $resolution_y,
                    'xhtml'             => XHTML,
                ));
                $F->parse('output','player');
                $flv_player = $F->finish($F->get_var('output'));
 
                $V->set_var(array(
                    'site_url'      => $_MG_CONF['site_url'],
                    'lang_noflash'  => $LANG_MG03['no_flash'],
                    'id'            => $id,
                    'id2'           => $id2,
                    'width'         => $resolution_x,
                    'height'        => $resolution_y,
                    'flv_player'    => $flv_player,
                    'xhtml'         => XHTML,
                ));
 
                $V->parse('output','video');
                $u_image .= $V->finish($V->get_var('output'));
                break;
        }
        return $u_image . '<div style="text-align:center;">' . $row['media_title'] . '</div><div style="text-align:center;"><a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $aid . '">' . $LANG_MG03['browse_album'] . '</a></div>';
    } else {
        return 'No Videos Found';
    }
}
Connecté en tant que : Guest (Guest)
plugins/mediagallery/phpblock.txt · Dernière modification: 2010/05/12 13:58 par ::Ben
 

Download geeklog

Last version 1.8.1

Espace Membre





Devenir membre
Enregistrez-vous

Mot de passe oublié ?

Change language

Categories

  • Geeklog (38)
  • Plugins (53)
  • Thèmes (17)
  • My cart

    Votre panier (0 article)

    Votre panier est vide!

    0.00 EUR

    Visual Theme Switcher

    Test out available themes by selecting from one of the 6 available themes or give the Visual Switcher a try:

    Follow us on twitter

    En ligne

    Visiteurs: 10