global $gQueryUser, $moduleParams; extract($moduleParams); $gFisheyeImage = new FisheyeImage(); if (!empty($module_rows)) { $_REQUEST['max_records'] = $module_rows; } elseif (!empty($_REQUEST['offset']) && is_numeric($_REQUEST['offset'])) { $gBitSmarty->assignByRef('iMaxRows', $iMaxRows); } if (empty($_REQUEST['sort_mode'])) { $_REQUEST['sort_mode'] = 'random'; } if (!empty($_REQUEST['search'])) { $gBitSmarty->assignByRef('iSearchString', $iSearchtring); } $gBitSmarty->assignByRef('iSortMode', $_REQUEST['sort_mode']); /* Get a list of galleries which matches the imput paramters (default is to list every gallery in the system) */ if (!empty($gQueryUser) && $gQueryUser->mUserId) { $_REQUEST['user_id'] = $gQueryUser->mUserId; } $_REQUEST['root_only'] = TRUE; $_REQUEST['get_thumbnails'] = TRUE; $thumbnailList = $gFisheyeImage->getList($_REQUEST); $gBitSmarty->assignByRef('thumbnailList', $thumbnailList); /* Process the input parameters this page accepts */ if (!empty($gQueryUser) && $gQueryUser->isRegistered()) { $gBitSmarty->assignByRef('gQuerUserId', $gQueryUser->mUserId); $template = 'user_galleries.tpl'; } else { $template = 'list_galleries.tpl'; } $gBitSmarty->assign('fisheye_center_params', $module_params);
function data_gallery($pData, $pParams) { global $gBitSystem, $gBitSmarty; $ret = ' '; $imgStyle = ''; $wrapper = liberty_plugins_wrapper_style($pParams); $description = !isset($wrapper['description']) ? $wrapper['description'] : NULL; foreach ($pParams as $key => $value) { if (!empty($value)) { switch ($key) { // rename a couple of parameters case 'width': case 'height': if (preg_match("/^\\d+(em|px|%|pt)\$/", trim($value))) { $imgStyle .= $key . ':' . $value . ';'; } elseif (preg_match("/^\\d+\$/", $value)) { $imgStyle .= $key . ':' . $value . 'px;'; } // remove values from the hash that they don't get used in the div as well $pParams[$key] = NULL; break; } } } $wrapper = liberty_plugins_wrapper_style($pParams); if (!empty($pParams['src'])) { $thumbUrl = $pParams['src']; } elseif (@BitBase::verifyId($pParams['id']) && $gBitSystem->isPackageActive('fisheye')) { require_once FISHEYE_PKG_PATH . 'FisheyeImage.php'; $gBitSmarty->loadPlugin('smarty_modifier_display_bytes'); $gallery = new FisheyeImage(); $listHash = $pParams; $listHash['size'] = 'small'; $listHash['gallery_id'] = $pParams['id']; $listHash['max_records'] = 3; $listHash['sort_mode'] = 'random'; $images = $gallery->getList($listHash); $out = '<div>'; foreach ($images as $image) { // insert source url if we need the original file if (!empty($pParams['size']) && $pParams['size'] == 'original') { $thumbUrl = $image['source_url']; } elseif ($image['thumbnail_url']) { $thumbUrl = $image['thumbnail_url']; } if (empty($image['$description'])) { $description = !isset($wrapper['description']) ? $wrapper['description'] : $image['title']; } // check if we have a valid thumbnail if (!empty($thumbUrl)) { // set up image first $ret = '<img class="img-responsive"' . ' alt="' . $description . '"' . ' title="' . $description . '"' . ' src="' . $thumbUrl . '"' . ' style="float:left; ' . $imgStyle . '"' . ' />'; if (!empty($pParams['nolink'])) { } elseif (!empty($wrapper['link'])) { // if this image is linking to something, wrap the image with the <a> $ret = '<a href="' . trim($wrapper['link']) . '">' . $ret . '</a>'; } elseif (empty($pParams['size']) || $pParams['size'] != 'original') { if ($image['source_url']) { $ret = '<a href="' . trim($image['source_url']) . '">' . $ret . '</a>'; } } if (!empty($wrapper['style']) || !empty($class) || !empty($wrapper['description'])) { $ret = '<' . $wrapper['wrapper'] . ' class="' . (!empty($wrapper['class']) ? $wrapper['class'] : "img-responsive") . '" style="' . $wrapper['style'] . '">' . $ret . (!empty($wrapper['description']) ? '<br />' . $wrapper['description'] : '') . '</' . $wrapper['wrapper'] . '>'; } } else { $ret = tra("Unknown Gallery"); } $out .= $ret; } $out .= '</div>'; } return $out; }
<?php /** * @version $Header$ * @package fisheye * @subpackage modules */ global $gQueryUserId, $gContent, $moduleParams; // makes things in older modules easier extract($moduleParams); /** * required setup */ require_once FISHEYE_PKG_PATH . 'FisheyeGallery.php'; $image = new FisheyeImage(); $display = TRUE; $listHash = $module_params; $listHash['size'] = 'extra-large'; $listHash['gallery_id'] = $module_rows; $listHash['max_records'] = 5; $listHash['sort_mode'] = 'random'; $images = $image->getList($listHash); $moduleTitle = 'Banner Image'; $_template->tpl_vars['moduleTitle'] = new Smarty_variable($title); $_template->tpl_vars['modImages'] = new Smarty_variable($images); $_template->tpl_vars['module_params'] = new Smarty_variable($module_params);
// check permission to view fisheye images if (!$gBitUser->hasPermission('p_fisheye_view')) { require_once RSS_PKG_PATH . "rss_error.php"; } else { $listHash = array('max_records' => $gBitSystem->getConfig('fisheye_rss_max_records', 10), 'sort_mode' => 'last_modified_desc', 'gallery_id' => !empty($_REQUEST['gallery_id']) ? $_REQUEST['gallery_id'] : NULL, 'user_id' => !empty($_REQUEST['user_id']) ? $_REQUEST['user_id'] : NULL); // check if we want to use the cache file $cacheFile = TEMP_PKG_PATH . RSS_PKG_NAME . '/' . FISHEYE_PKG_NAME . '/' . "g{$listHash['gallery_id']}u{$listHash['user_id']}" . $cacheFileTail; $rss->useCached($rss_version_name, $cacheFile, $gBitSystem->getConfig('rssfeed_cache_time')); // if we have a gallery we can work with - load it if (@BitBase::verifyId($_REQUEST['gallery_id'])) { $gallery = new FisheyeGallery($_REQUEST['gallery_id']); $gallery->load(); $rss->title .= " - {$gallery->getTitle()}"; } $fisheye = new FisheyeImage(); $feeds = $fisheye->getList($listHash); // set the rss link $rss->link = 'http://' . $_SERVER['HTTP_HOST'] . FISHEYE_PKG_URL; global $gBitSystem; // get all the data ready for the feed creator foreach ($feeds as $feed) { $item = new FeedItem(); $item->title = $feed['title']; $item->link = $feed['display_url']; $item->description = '<a href="' . $feed['display_url'] . '"><img src="' . $feed['thumbnail_url'] . '" /></a>'; $item->description .= '<p>' . $feed['data'] . '</p>'; $item->date = (int) $feed['last_modified']; $item->source = 'http://' . $_SERVER['HTTP_HOST'] . BIT_ROOT_URL; $item->author = $gBitUser->getDisplayName(FALSE, $feed); $item->descriptionTruncSize = $gBitSystem->getConfig('rssfeed_truncate', 5000); $item->descriptionHtmlSyndicated = FALSE;
function data_carousel($pData, $pParams) { global $gBitSystem, $gBitSmarty; $ret = ' '; $imgStyle = ''; $wrapper = liberty_plugins_wrapper_style($pParams); $description = !isset($wrapper['description']) ? $wrapper['description'] : NULL; foreach ($pParams as $key => $value) { if (!empty($value)) { switch ($key) { // rename a couple of parameters case 'width': case 'height': if (preg_match("/^\\d+(em|px|%|pt)\$/", trim($value))) { $imgStyle .= $key . ':' . $value . ';'; } elseif (preg_match("/^\\d+\$/", $value)) { $imgStyle .= $key . ':' . $value . 'px;'; } // remove values from the hash that they don't get used in the div as well $pParams[$key] = NULL; break; } } } $wrapper = liberty_plugins_wrapper_style($pParams); $pParams['nolink'] = 'yes'; if (!empty($pParams['src'])) { $thumbUrl = $pParams['src']; } elseif (@BitBase::verifyId($pParams['id']) && $gBitSystem->isPackageActive('fisheye')) { require_once FISHEYE_PKG_PATH . 'FisheyeImage.php'; $gBitSmarty->loadPlugin('smarty_modifier_display_bytes'); $gallery = new FisheyeImage(); $listHash = $pParams; $listHash['size'] = 'large'; $listHash['gallery_id'] = $pParams['id']; $listHash['max_records'] = 10; $listHash['sort_mode'] = 'item_position_asc'; $images = $gallery->getList($listHash); $num = count($images); $out = '<div class="carousel slide" data-ride="carousel" id="myCarousel">'; $out .= '<ol class="carousel-indicators">'; $out .= '<li class="active" data-slide-to="0" data-target="#myCarousel"> </li>'; for ($i = 1; $i < $num; $i++) { $out .= '<li data-slide-to="' . $i . '" data-target="#myCarousel"> </li>'; } $out .= '</ol>'; $out .= '<div class="carousel-inner" role="listbox">'; $i = 0; foreach ($images as $image) { // insert source url if we need the original file if (!empty($pParams['size']) && $pParams['size'] == 'original') { $thumbUrl = $image['source_url']; } elseif ($image['thumbnail_url']) { $thumbUrl = $image['thumbnail_url']; } if (empty($image['$description'])) { $description = !isset($wrapper['description']) ? $wrapper['description'] : $image['title']; } // check if we have a valid thumbnail if (!empty($thumbUrl)) { if ($i == 0) { $active = ' active'; } else { $active = ''; } $i++; // set up image first $ret = '<div class="item' . $active . '"><img class="img-responsive"' . ' alt="' . $description . '"' . ' title="' . $description . '"' . ' src="' . $thumbUrl . '"' . ' height="103" width="800"' . ' /></div>'; if (!empty($pParams['nolink'])) { } elseif (!empty($wrapper['link'])) { // if this image is linking to something, wrap the image with the <a> $ret = '<a href="' . trim($wrapper['link']) . '">' . $ret . '</a>'; } elseif (empty($pParams['size']) || $pParams['size'] != 'original') { if ($image['source_url']) { $ret = '<a href="' . trim($image['source_url']) . '">' . $ret . '</a>'; } } if (!empty($wrapper['style']) || !empty($class) || !empty($wrapper['description'])) { $ret = '<' . $wrapper['wrapper'] . ' class="' . (!empty($wrapper['class']) ? $wrapper['class'] : "img-responsive") . '" style="' . $wrapper['style'] . '">' . $ret . (!empty($wrapper['description']) ? '<br />' . $wrapper['description'] : '') . '</' . $wrapper['wrapper'] . '>'; } } else { $ret = tra("Unknown Gallery"); } $out .= $ret; } $out .= '</div>'; $out .= '<a class="left carousel-control" data-slide="prev" href="#myCarousel" role="button">'; $out .= '<span class="sr-only">Previous</span> </a>'; $out .= '<a class="right carousel-control" data-slide="next" href="#myCarousel" role="button">'; $out .= '<span class="sr-only">Next</span> </a></div>'; $out .= '</div>'; } return $out; }