示例#1
0
 /**
  * Sets up some basic stuff for the gallery.
  */
 public static function init()
 {
     global $db, $user;
     phpbb_gallery_url::_include('functions_phpbb', 'phpbb', 'includes/gallery/');
     phpbb_gallery_plugins::init(phpbb_gallery_url::path());
     // Little precaution.
     $user->data['user_id'] = (int) $user->data['user_id'];
     self::$user = new phpbb_gallery_user($db, $user->data['user_id']);
     $user_id = $user->data['user_perm_from'] == 0 ? $user->data['user_id'] : $user->data['user_perm_from'];
     self::$auth = new phpbb_gallery_auth($user_id);
     if (phpbb_gallery_config::get('mvc_time') < time()) {
         // Check the version, do we need to update?
         phpbb_gallery_config::set('mvc_time', time() + 86400);
         phpbb_gallery_config::set('mvc_version', phpbb_gallery_modversioncheck::check(true));
     }
     self::$loaded = true;
 }
示例#2
0
 public static function init($path)
 {
     global $template;
     /**
      * Highslide JS
      *
      * Latest version tested: 4.1.9
      * Download: http://highslide.com/download.php
      * License:  Creative Commons Attribution-NonCommercial 2.5 License
      *           http://creativecommons.org/licenses/by-nc/2.5/
      */
     if (file_exists($path . 'plugins/highslide/highslide-full.js')) {
         self::$plugins[] = 'highslide';
         self::$slideshow = true;
         $template->assign_var('S_GP_HIGHSLIDE', $path . 'plugins/highslide/');
     }
     /**
      * Lytebox
      *
      * Latest version tested: 3.22
      * Download: http://www.dolem.com/lytebox/
      * License:  Creative Commons Attribution 3.0 License
      *           http://creativecommons.org/licenses/by/3.0/
      */
     if (file_exists($path . 'plugins/lytebox/lytebox.js')) {
         self::$plugins[] = 'lytebox';
         self::$slideshow = true;
         $template->assign_var('S_GP_LYTEBOX', $path . 'plugins/lytebox/');
     }
     /**
      * Shadowbox.js
      *
      * Latest version tested: 3.0b
      * Download: http://www.shadowbox-js.com/download.html
      * License:  Shadowbox.js License version 1.0
      *           http://shadowbox-js.com/LICENSE
      */
     if (file_exists($path . 'plugins/shadowbox/shadowbox.js')) {
         self::$plugins[] = 'shadowbox';
         self::$slideshow = true;
         $template->assign_var('S_GP_SHADOWBOX', $path . 'plugins/shadowbox/');
     }
 }
示例#3
0
 /**
  * Generate link to image
  *
  * @param	string	$content	what's in the link: image_name, thumbnail, fake_thumbnail, medium or lastimage_icon
  * @param	string	$mode		where does the link leed to: highslide, lytebox, lytebox_slide_show, image_page, image, none
  * @param	int		$image_id
  * @param	string	$image_name
  * @param	int		$album_id
  * @param	bool	$is_gif		we need to know whether we display a gif, so we can use a better medium-image
  * @param	bool	$count		shall the image-link be counted as view? (Set to false from image_page.php to deny double increment)
  * @param	string	$additional_parameters		additional parameters for the url, (starting with &amp;)
  */
 public static function generate_link($content, $mode, $image_id, $image_name, $album_id, $is_gif = false, $count = true, $additional_parameters = '')
 {
     global $phpEx, $user;
     $image_page_url = phpbb_gallery_url::append_sid('image_page', "album_id={$album_id}&amp;image_id={$image_id}{$additional_parameters}");
     $image_url = phpbb_gallery_url::append_sid('image', "album_id={$album_id}&amp;image_id={$image_id}{$additional_parameters}" . (!$count ? '&amp;view=no_count' : ''));
     $thumb_url = phpbb_gallery_url::append_sid('image', "mode=thumbnail&amp;album_id={$album_id}&amp;image_id={$image_id}{$additional_parameters}");
     $medium_url = phpbb_gallery_url::append_sid('image', "mode=medium&amp;album_id={$album_id}&amp;image_id={$image_id}{$additional_parameters}");
     switch ($content) {
         case 'image_name':
             $shorten_image_name = utf8_strlen(htmlspecialchars_decode($image_name)) > phpbb_gallery_config::get('shortnames') + 3 ? utf8_substr(htmlspecialchars_decode($image_name), 0, phpbb_gallery_config::get('shortnames')) . '...' : $image_name;
             $content = '<span style="font-weight: bold;">' . $shorten_image_name . '</span>';
             break;
         case 'image_name_unbold':
             $shorten_image_name = utf8_strlen(htmlspecialchars_decode($image_name)) > phpbb_gallery_config::get('shortnames') + 3 ? utf8_substr(htmlspecialchars_decode($image_name), 0, phpbb_gallery_config::get('shortnames')) . '...' : $image_name;
             $content = $shorten_image_name;
             break;
         case 'thumbnail':
             $content = '<img src="{U_THUMBNAIL}" alt="{IMAGE_NAME}" title="{IMAGE_NAME}" />';
             $content = str_replace(array('{U_THUMBNAIL}', '{IMAGE_NAME}'), array($thumb_url, $image_name), $content);
             break;
         case 'fake_thumbnail':
             $content = '<img src="{U_THUMBNAIL}" alt="{IMAGE_NAME}" title="{IMAGE_NAME}" style="max-width: {FAKE_THUMB_SIZE}px; max-height: {FAKE_THUMB_SIZE}px;" />';
             $content = str_replace(array('{U_THUMBNAIL}', '{IMAGE_NAME}', '{FAKE_THUMB_SIZE}'), array($thumb_url, $image_name, phpbb_gallery_config::get('mini_thumbnail_size')), $content);
             break;
         case 'medium':
             $content = '<img src="{U_MEDIUM}" alt="{IMAGE_NAME}" title="{IMAGE_NAME}" />';
             $content = str_replace(array('{U_MEDIUM}', '{IMAGE_NAME}'), array($medium_url, $image_name), $content);
             //cheat for animated/transparent gifs
             if ($is_gif) {
                 $content = '<img src="{U_MEDIUM}" alt="{IMAGE_NAME}" title="{IMAGE_NAME}" style="max-width: {MEDIUM_WIDTH_SIZE}px; max-height: {MEDIUM_HEIGHT_SIZE}px;" />';
                 $content = str_replace(array('{U_MEDIUM}', '{IMAGE_NAME}', '{MEDIUM_HEIGHT_SIZE}', '{MEDIUM_WIDTH_SIZE}'), array($image_url, $image_name, phpbb_gallery_config::get('medium_height'), phpbb_gallery_config::get('medium_width')), $content);
             }
             break;
         case 'lastimage_icon':
             $content = $user->img('icon_topic_latest', 'VIEW_LATEST_IMAGE');
             break;
     }
     switch ($mode) {
         case 'image_page':
             $url = $image_page_url;
             $tpl = '<a href="{IMAGE_URL}" title="{IMAGE_NAME}">{CONTENT}</a>';
             break;
         case 'image_page_next':
             $url = $image_page_url;
             $tpl = '<a href="{IMAGE_URL}" title="{IMAGE_NAME}" class="right-box right">{CONTENT}</a>';
             break;
         case 'image_page_prev':
             $url = $image_page_url;
             $tpl = '<a href="{IMAGE_URL}" title="{IMAGE_NAME}" class="left-box left">{CONTENT}</a>';
             break;
         case 'image':
             $url = $image_url;
             $tpl = '<a href="{IMAGE_URL}" title="{IMAGE_NAME}">{CONTENT}</a>';
             break;
         case 'none':
             $url = $image_page_url;
             $tpl = '{CONTENT}';
             break;
         default:
             $url = $image_url;
             $tpl = phpbb_gallery_plugins::generate_image_link($mode);
             break;
     }
     return str_replace(array('{IMAGE_URL}', '{IMAGE_NAME}', '{CONTENT}'), array($url, $image_name, $content), $tpl);
 }
 /**
  * Select the link destination
  */
 function uc_select($value, $key)
 {
     global $user;
     $sort_order_options = phpbb_gallery_plugins::uc_select($value, $key);
     if ($key != 'link_imagepage') {
         $sort_order_options .= '<option' . ($value == 'image_page' ? ' selected="selected"' : '') . " value='image_page'>" . $user->lang['UC_LINK_IMAGE_PAGE'] . '</option>';
     }
     $sort_order_options .= '<option' . ($value == 'image' ? ' selected="selected"' : '') . " value='image'>" . $user->lang['UC_LINK_IMAGE'] . '</option>';
     $sort_order_options .= '<option' . ($value == 'none' ? ' selected="selected"' : '') . " value='none'>" . $user->lang['UC_LINK_NONE'] . '</option>';
     return "<select name='config[{$key}]' id='{$key}'>{$sort_order_options}</select>" . ($key == 'link_thumbnail' ? '<br /><input class="checkbox" type="checkbox" name="update_bbcode" id="update_bbcode" value="update_bbcode" /><label for="update_bbcode">' . $user->lang['UPDATE_BBCODE'] . '</label>' : '');
 }