|
From: Jon O. <jon...@us...> - 2005-09-27 18:56:26
|
Update of /cvsroot/mxbb/mx_gallery2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20707/modules/mx_gallery2 Added Files: gallery2.php Log Message: added the gallery2 module --- NEW FILE: gallery2.php --- <?php /*************************************************************************** * gallery2.php * ------------------- * begin : Sep, 2005 * copyright : (C) 2005 mxBB * email : jon...@mx... * * $Id: gallery2.php,v 1.1 2005/09/27 18:56:13 jonohlsson Exp $ * * ***************************************************************************/ /*************************************************************************** * * 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 2 of the License, or * (at your option) any later version. * ***************************************************************************/ if( !defined('IN_PORTAL') ) { die("Hacking attempt !!!"); } // // Read block settings // $block_config = read_block_config($block_id); $title = $block_config[$block_id]['block_title']; $xtra_gallery_get_pars = !empty($block_config[$block_id]['xtra_get_vars']) ? '&g2_view=core.ShowItem&g2_itemId=' . $block_config[$block_id]['xtra_get_vars'] : ''; // // Includes // include_once($mx_root_path . "modules/mx_gallery2/includes/gallery_constants.$phpEx"); include_once($mx_root_path . "modules/mx_gallery2/includes/gallery_functions.$phpEx"); // // Start template // $template->set_filenames(array( 'body' => 'gallery2.tpl') ); // // Environment variables // $relativeG2Path = 'modules/gallery2'; $fullpath = realpath($mx_root_path).$relativeG2Path; $embedPath = '/'; $embedUri = 'index.php?page=' . $page_id . $xtra_gallery_get_pars; $loginRedirect = '/'; $cookiePath = '/'; // // Include the gallery embed class // require_once($relativeG2Path . '/embed.php'); // // Instatiate the mxBB to Gallery Class // $mx_gallery = new mx_gallery(); // // Is mxBB user already mapped in Gallery? If not, do it. // if ( !$mx_gallery->do_map() ) { mx_message_die(CRITICAL_ERROR, $map_debug); } // // When in debug mode, output all gallery embed actions // if (MAP_DEBUG) { echo($map_debug); } // // Init the GalleryEmbed class, passing current user_id // if($userdata['user_id'] != ANONYMOUS) { $ret = GalleryEmbed::init(array( 'embedUri' => $embedUri, 'embedPath' => $embedPath, 'relativeG2Path' => $relativeG2Path, 'loginRedirect' => $loginRedirect, 'activeUserId' => $userdata['user_id'])); if ($ret->isError()) { echo $ret->getAsHtml(); exit; } } else { $ret = GalleryEmbed::init(array( 'embedUri' => $embedUri, 'embedPath' => $embedPath, 'relativeG2Path' => $relativeG2Path, 'loginRedirect' => $loginRedirect, 'activeUserId' => 0)); if ($ret->isError()) { echo $ret->getAsHtml(); exit; } } // // Settings // GalleryCapabilities::set('showSidebarBlocks', true); $g2data = GalleryEmbed::handleRequest(); if ($g2data['isDone']) { exit; // Gallery 2 has already sent output (redirect or binary data) } // Use $g2data['headHtml'] and $g2data['bodyHtml'] // to display Gallery 2 content inside embedding application // if you don't want to use $g2data['headHtml'] directly, you can get the css, // javascript and page title separately by calling... if (isset($g2data['headHtml'])) { list($title, $css, $javascript) = GalleryEmbed::parseHead($g2data['headHtml']); } foreach($css as $stylesheet) { $links .= $stylesheet."\n"; } foreach($javascript as $js) { $jlink .= $js."\n"; } $bodyHtml = $g2data['bodyHtml']; // // Send to template // $template->assign_vars(array( 'BODY' => $bodyHtml, 'CSS' => $links, 'JAVASCRIPT' => $jlink)); $template->pparse('body'); // // End of code // ?> |