diff --git a/3.0/modules/tag_albums/-- Theme Files/Grey Dragon 3.2.2/libraries/MY_Theme_View.php b/3.0/modules/tag_albums/-- Theme Files/Grey Dragon 3.2.2/libraries/MY_Theme_View.php
new file mode 100644
index 00000000..a00c1825
--- /dev/null
+++ b/3.0/modules/tag_albums/-- Theme Files/Grey Dragon 3.2.2/libraries/MY_Theme_View.php
@@ -0,0 +1,920 @@
+
+
+class Theme_View extends Theme_View_Core {
+
+ protected $viewmode = "default";
+ protected $toolbar_large = FALSE;
+ protected $paginator_album;
+ protected $paginator_photo;
+ protected $sidebarvisible;
+ protected $sidebarallowed;
+ protected $sidebar_hideguest = FALSE;
+ protected $logopath;
+ protected $favicon = "lib/images/favicon.ico";
+ protected $appletouchicon;
+ protected $album_descmode = "hide";
+ protected $disablephotopage = FALSE;
+ protected $hidecontextmenu = FALSE;
+ protected $thumb_ratio = "";
+ protected $thumb_descmode_a = "overlay";
+ protected $thumb_descmode = "overlay";
+ protected $photo_descmode = "overlay_top";
+ protected $thumb_imgalign = "top";
+ protected $thumb_metamode = "default";
+ protected $is_blockheader_visible = TRUE;
+ protected $is_photometa_visible = FALSE;
+ protected $disable_seosupport = FALSE;
+ protected $mainmenu_position = "bottom-left";
+ protected $breadcrumbs_position = "bottom-right";
+ protected $breadcrumbs_showinroot = FALSE;
+ protected $copyright = null;
+ protected $show_guest_menu = FALSE;
+ protected $loginmenu_position = "default";
+ protected $visible_title_length = 15;
+ protected $title_source = "default";
+ protected $desc_allowbbcode = FALSE;
+ protected $enable_pagecache = FALSE;
+ protected $flex_rows = FALSE;
+ protected $photo_popupbox = "default";
+ protected $custom_css_path = "";
+ protected $thumb_inpage = FALSE;
+ protected $thumb_random = FALSE;
+ protected $row_count = 3;
+ protected $column_count = 3;
+
+ protected $crop_factor = -1;
+ protected $crop_class = "";
+ protected $_thumb_size_x = 200;
+ protected $_thumb_size_y = 200;
+ protected $allow_root_page = FALSE;
+ protected $show_root_page = FALSE;
+ protected $show_root_desc = TRUE;
+ protected $root_feed = "gallery/latest";
+ protected $root_cyclemode = "fade";
+ protected $root_delay = 15;
+ protected $root_description;
+ protected $permalinks = array("enter" => "?root=no", "root" => "?root=yes");
+
+ protected $last_update = 0;
+
+ protected $colorpack = "greydragon";
+ protected $framepack = "greydragon";
+ protected $themename = "";
+ protected $themeversion = "";
+ protected $themecss = array();
+
+ protected $is_rtl = FALSE;
+
+ protected function ensurevalue($value, $default) {
+ if ((!isset($value)) or ($value == "")):
+ return $default;
+ else:
+ return $value;
+ endif;
+ }
+
+ protected function ensureoptionsvalue($key, $default) {
+ return ($this->ensurevalue(module::get_var("th_greydragon", $key), $default));
+ }
+
+ public function read_session_cmdparam($cmd, $cookie, $issession, $default) {
+ try {
+ $_cmd = $_GET[$cmd];
+ } catch (Exception $e) {
+ };
+
+ if (isset($_cmd)):
+ $_var = strtolower($_cmd);
+ $_from_cmd = TRUE;
+ if ($_var == "default"):
+ $_var = $default;
+ endif;
+ else:
+ $_from_cmd = FALSE;
+ if ($cookie):
+ try {
+ $_var = $_COOKIE[$cookie];
+ } catch (Exception $e) {
+ };
+ endif;
+ endif;
+
+ if (!isset($_var)):
+ $_var = $default;
+ endif;
+
+ if ($issession):
+ if ($_from_cmd):
+ setcookie($cookie, $_var, 0);
+ endif;
+ else:
+ setcookie($cookie, $_var, time() + 31536000);
+ endif;
+
+ return $_var;
+ }
+
+ public function load_sessioninfo() {
+ // Sidebar position is kept for 360 days. Can be changed via url
+ $this->sidebarallowed = $this->ensureoptionsvalue("sidebar_allowed", "any");
+ $_sb_visible = $this->ensureoptionsvalue("sidebar_visible", "right");
+
+ if ($this->sidebarallowed == "default"):
+ $this->sidebarallowed = $_sb_visible;
+ $this->sidebarvisible = $_sb_visible;
+ else:
+ $this->sidebarvisible = $this->read_session_cmdparam("sb", "gd_sidebar_pos", FALSE, $_sb_visible);
+ endif;
+ $this->colorpack = $this->read_session_cmdparam("colorpack", "gd_colorpack", TRUE, $this->ensureoptionsvalue("color_pack", "greydragon"));
+ $this->framepack = $this->read_session_cmdparam("framepack", "gd_framepack", TRUE, $this->ensureoptionsvalue("frame_pack", "greydragon"));
+ $this->viewmode = $this->read_session_cmdparam("viewmode", "gd_viewmode", TRUE, $this->ensureoptionsvalue("viewmode", "default"));
+ $this->is_rtl = $this->read_session_cmdparam("is_rtl", "gd_rtl", TRUE, "no") == "yes";
+ $this->thumb_ratio = $this->read_session_cmdparam("ratio", "gd_ratio", TRUE, $this->ensureoptionsvalue("thumb_ratio", "photo"));
+
+ if ($this->ensureoptionsvalue("allow_root_page", FALSE)):
+ $_root = $this->read_session_cmdparam("root", "gd_rootpage", TRUE, "yes");
+
+ $this->show_root_page = ($_root == "yes");
+ $this->allow_root_page = TRUE;
+
+ if ($this->show_root_page):
+ $item = $this->item();
+ if (($item) && ($item->id == item::root()->id)):
+ if (($this->sidebarvisible == "left") or ($this->sidebarvisible == "right")):
+ $this->sidebarvisible = "bottom";
+ endif;
+ else:
+ $this->show_root_page = FALSE;
+ setcookie("gd_rootpage", "no", 0);
+ endif;
+
+ if ($this->ensureoptionsvalue("hide_root_sidebar", FALSE)):
+ $this->sidebarallowed = "none";
+ $this->sidebarvisible = "none";
+ endif;
+ endif;
+ endif;
+
+ $this->sidebarvisible = $this->ensurevalue($this->sidebarvisible, "right");
+
+ switch ($this->sidebarallowed):
+ case "default":
+ break;
+ case "right":
+ $this->sidebarvisible = "right";
+ break;
+ case "left":
+ $this->sidebarvisible = "left";
+ break;
+ case "bottom":
+ $this->sidebarvisible = "bottom";
+ break;
+ case "top":
+ $this->sidebarvisible = "top";
+ break;
+ endswitch;
+
+ if ($this->item()):
+ if ($this->ensureoptionsvalue("sidebar_albumonly", FALSE)):
+ if (!$this->item()->is_album()):
+ $this->sidebarvisible = "none";
+ $this->sidebarallowed = "none";
+ endif;
+ endif;
+ endif;
+
+ $this->sidebar_hideguest = $this->ensureoptionsvalue("sidebar_hideguest", FALSE);
+ if ((identity::active_user()->guest) & ($this->sidebar_hideguest)):
+ $this->sidebarvisible = "none";
+ $this->sidebarallowed = "none";
+ endif;
+
+ if (($this->page_subtype == "login") || ($this->page_subtype == "reauthenticate") || ($this->page_subtype == "error")):
+ $this->sidebarvisible = "none";
+ $this->sidebarallowed = "none";
+ endif;
+
+ $this->last_update = $this->ensureoptionsvalue("last_update", time());
+ $this->toolbar_large = $this->ensureoptionsvalue("toolbar_large", FALSE);
+ $this->row_count = $this->ensureoptionsvalue("row_count", 3);
+ $this->column_count = $this->ensureoptionsvalue("column_count", 3);
+ $this->logopath = $this->ensureoptionsvalue("logo_path", url::file("lib/images/logo.png"));
+ $this->favicon = $this->ensurevalue(module::get_var("gallery", "favicon_url"), url::file("lib/images/favicon.ico"));
+ $this->appletouchicon = module::get_var("gallery", "apple_touch_icon_url");
+ $this->horizontal_crop = $this->ensureoptionsvalue("horizontal_crop", FALSE);
+ $this->album_descmode = $this->ensureoptionsvalue("album_descmode", "hide");
+ $this->disablephotopage = $this->ensureoptionsvalue("disablephotopage", FALSE);
+ $this->hidecontextmenu = $this->ensureoptionsvalue("hidecontextmenu", FALSE);
+ $this->visible_title_length = module::get_var("gallery", "visible_title_length", 15);
+ $this->title_source = $this->ensureoptionsvalue("title_source", "default");
+ $this->thumb_descmode_a = $this->ensureoptionsvalue("thumb_descmode_a", "overlay");
+ $this->thumb_descmode = $this->ensureoptionsvalue("thumb_descmode", "overlay");
+ $this->photo_descmode = $this->ensureoptionsvalue("photo_descmode", "overlay_top");
+
+ $this->thumb_random = $this->ensureoptionsvalue("thumb_random", FALSE);
+ $this->thumb_imgalign = $this->ensureoptionsvalue("thumb_imgalign", "top");
+ if (module::is_active("info")):
+ $this->thumb_metamode = $this->ensureoptionsvalue("thumb_metamode", "default");
+ $this->is_photometa_visible = (!$this->ensureoptionsvalue("hide_photometa", TRUE));
+ else:
+ $this->thumb_metamode = "hide";
+ $this->is_photometa_visible = FALSE;
+ endif;
+ $this->disable_seosupport = $this->ensureoptionsvalue("disable_seosupport", FALSE);
+ $this->is_blockheader_visible = (!$this->ensureoptionsvalue("hide_blockheader", FALSE));
+
+ $this->mainmenu_position = $this->ensureoptionsvalue("mainmenu_position", "default");
+ $this->show_guest_menu = $this->ensureoptionsvalue("show_guest_menu", FALSE);
+ $this->breadcrumbs_position = $this->ensureoptionsvalue("breadcrumbs_position", "default");
+ $this->breadcrumbs_showinroot = $this->ensureoptionsvalue("breadcrumbs_showinroot", FALSE);
+ $this->desc_allowbbcode = $this->ensureoptionsvalue("desc_allowbbcode", FALSE);
+
+ $this->loginmenu_position = $this->ensureoptionsvalue("loginmenu_position", "default");
+ $this->copyright = $this->ensureoptionsvalue("copyright", null);
+ $this->paginator_album = $this->ensureoptionsvalue("paginator_album", "top");
+ $this->paginator_photo = $this->ensureoptionsvalue("paginator_photo", "top");
+ $this->enable_pagecache = $this->ensureoptionsvalue("enable_pagecache", FALSE);
+ $this->flex_rows = $this->ensureoptionsvalue("flex_rows", FALSE);
+ $this->show_root_desc = !$this->ensureoptionsvalue("hide_root_desc", FALSE);
+ $this->root_feed = $this->ensureoptionsvalue("root_feed", "gallery/latest");
+ $this->root_cyclemode = $this->ensureoptionsvalue("root_cyclemode", "fade");
+ $this->root_delay = $this->ensureoptionsvalue("root_delay", "15");
+ $this->root_description = module::get_var("th_greydragon", "root_description");
+ if ($this->ensureoptionsvalue("use_permalinks", FALSE)):
+ $this->permalinks = array("enter" => "enter", "root" => "root");
+ endif;
+ if (((module::is_active("shadowbox")) and (module::info("shadowbox")))
+ or ((module::is_active("fancybox")) and (module::info("fancybox")))
+ or ((module::is_active("colorbox")) and (module::info("colorbox")))
+ ):
+ $this->photo_popupbox = $this->ensureoptionsvalue("photo_popupbox", "default");
+ else:
+ $this->photo_popupbox = "none";
+ endif;
+
+ try {
+ $theme_info = new ArrayObject(parse_ini_file(THEMEPATH . "greydragon/theme.info"), ArrayObject::ARRAY_AS_PROPS);
+ $this->themename = $theme_info->name;
+ $this->themeversion = $theme_info->version;
+ } catch (Exception $e) {
+ $this->themename = "Grey Dragon Theme";
+ $this->themeversion = "2.7.+";
+ }
+
+ $this->custom_css_path = $this->ensureoptionsvalue("custom_css_path", "");
+
+ switch ($this->thumb_ratio):
+ /* case "square":
+ $this->crop_factor = 1;
+ $this->thumb_type = 'g-thumbtype-sqr';
+ break;
+ */
+ case "digital":
+ $this->crop_factor = 4/3;
+ $this->thumb_type = 'g-thumbtype-dgt';
+ break;
+ case "digital_ex":
+ $this->crop_factor = 4/3;
+ $this->thumb_type = 'g-thumbtype-dgt';
+ $this->_thumb_size_x = 300;
+ break;
+ case "film":
+ $this->crop_factor = 3/2;
+ $this->thumb_type = 'g-thumbtype-flm';
+ break;
+ case "film_ex":
+ $this->crop_factor = 3/2;
+ $this->thumb_type = 'g-thumbtype-flm';
+ $this->_thumb_size_x = 300;
+ break;
+ case "wide":
+ $this->crop_factor = 16/9;
+ $this->thumb_type = 'g-thumbtype-wd';
+ break;
+ case "wide_ex":
+ $this->crop_factor = 16/9;
+ $this->thumb_type = 'g-thumbtype-wd';
+ $this->_thumb_size_x = 300;
+ break;
+ case "photo_ex":
+ $this->crop_factor = 1;
+ $this->thumb_type = 'g-thumbtype-sqr';
+ $this->_thumb_size_x = 300;
+ break;
+ case "photo":
+ default:
+ $this->crop_factor = 1;
+ $this->thumb_type = 'g-thumbtype-sqr';
+ break;
+ endswitch;
+
+ $this->_thumb_size_y = intval($this->_thumb_size_x / $this->crop_factor);
+
+ if (($this->sidebarvisible == "none") or ($this->sidebarvisible == "bottom") or ($this->sidebarvisible == "top") ):
+ $this->thumb_inpage = $this->ensureoptionsvalue("thumb_inpage", FALSE);
+ endif;
+ }
+
+ public function is_sidebarallowed($align) {
+ return (($this->sidebarallowed == "any") or ($this->sidebarallowed == $align));
+ }
+
+ public function custom_header() {
+ if (Kohana::find_file('views', "header.html", FALSE)):
+ return new View("header.html");
+ endif;
+ }
+
+ public function custom_footer() {
+ if (Kohana::find_file('views', "footer.html", FALSE)):
+ return new View("footer.html");
+ endif;
+ }
+
+ public function get_item_title($item, $allowbbcode = FALSE, $limit_title_length = 0) {
+ if (!$item)
+ return "";
+
+ if ($item->is_album()):
+ $title = $item->title;
+ else:
+ switch ($this->title_source):
+ case "description":
+ $title = $item->description;
+ break;
+ case "no-filename":
+ $title = $item->title;
+ $filename = $item->name;
+
+ if (strcasecmp($title, $filename) == 0):
+ $title = "";
+ else:
+ if (defined('PATHINFO_FILENAME')):
+ $filename = pathinfo($filename, PATHINFO_FILENAME);
+ elseif (strstr($item->filename, '.')):
+ $filename = substr($filename, 0, strrpos($filename, '.'));
+ endif;
+
+ if (strcasecmp($title, $filename) == 0):
+ $title = "";
+ else:
+ $filename = item::convert_filename_to_title($filename); // Normalize filename to title format
+ if (strcasecmp($title, $filename) == 0)
+ $title = "";
+ endif;
+ endif;
+ break;
+ default:
+ $title = $item->title;
+ break;
+ endswitch;
+ endif;
+
+ $title = html::purify($title);
+ if ($allowbbcode):
+ $title = $this->bb2html($title, 1);
+ else:
+ $title = $this->bb2html($title, 2);
+ endif;
+
+ if ($limit_title_length):
+ $title = text::limit_chars($title, $limit_title_length);
+ endif;
+
+ if ($title === "")
+ $title = t(ucfirst($item->type)) . " " . $item->id;
+
+ return $title;
+ }
+
+ public function breadcrumb_menu($theme, $parents) {
+ $content = "";
+ if ($this->breadcrumbs_position == "hide"):
+ // Begin rWatcher Edit -- Add support for $theme->breadcrumbs.
+ elseif (!empty($theme->breadcrumbs)):
+ $content .= '
';
+ // End rWatcher Edit.
+ elseif ($this->item() and (!empty($parents) or (empty($parents) and $this->breadcrumbs_showinroot))):
+ $content .= '';
+ endif;
+
+ return $content;
+ }
+
+ protected function sidebar_menu_item($type, $url, $caption, $css) {
+ if (!$this->is_sidebarallowed($type)):
+ return "";
+ endif;
+
+ $iscurrent = ($this->sidebarvisible == $type);
+ $content_menu = '';
+ if (!$iscurrent):
+ $content_menu .= '';
+ endif;
+ $content_menu .= '';
+ if (!$iscurrent):
+ $content_menu .= '';
+ endif;
+
+ return $content_menu . '';
+ }
+
+ public function sidebar_menu($url) {
+ if ($this->sidebarallowed != "any"):
+ return "";
+ endif;
+ if ($this->page_subtype == "profile"):
+ return "";
+ endif;
+
+ $content_menu = $this->sidebar_menu_item("left", $url, t("Sidebar Left"), "left");
+ $content_menu .= $this->sidebar_menu_item("top", $url, t("Sidebar Top"), "top");
+ $content_menu .= $this->sidebar_menu_item("none", $url, t("No Sidebar"), "full");
+ $content_menu .= $this->sidebar_menu_item("bottom", $url, t("Sidebar Bottom"), "bottom");
+ $content_menu .= $this->sidebar_menu_item("right", $url, t("Sidebar Right"), "right");
+ return '';
+ }
+
+ public function add_paginator($position, $isalbum = TRUE) {
+ if ($isalbum):
+ $check = (($this->paginator_album == "both") or ($this->paginator_album == $position));
+ else:
+ $check = (($this->paginator_photo == "both") or ($this->paginator_photo == $position));
+ endif;
+
+ if ($check):
+ return ($this->paginator());
+ else:
+ return "";
+ endif;
+ }
+
+ public function get_bodyclass() {
+ $body_class = "";
+ if ($this->is_rtl):
+ $body_class = "rtl";
+ endif;
+ if ($this->toolbar_large):
+ $body_class .= " g-toolbar-large";
+ endif;
+ if ($this->viewmode == "mini"):
+ $body_class .= " viewmode-mini";
+ endif;
+ $body_class .= " g-sidebar-" . $this->sidebarvisible;
+
+ switch ($this->column_count):
+ case 5:
+ $body_class .= " g-column-5";
+ break;
+ case 4:
+ $body_class .= " g-column-4";
+ break;
+ case 2:
+ $body_class .= " g-column-2";
+ break;
+ case -1:
+ $body_class .= " g-column-flex";
+ break;
+ case 3:
+ default:
+ $body_class .= " g-column-3";
+ break;
+ endswitch;
+
+
+ switch ($this->thumb_ratio):
+ case "digital_ex":
+ case "film_ex":
+ case "wide_ex":
+ case "photo_ex":
+ $body_class .= ' g-extended';
+ break;
+ default:
+ break;
+ endswitch;
+
+ $body_class .= " g-" . $this->framepack;
+ return 'class="' . trim($body_class) . '"';
+ }
+
+ public function get_thumb_link($item) {
+ if ($item->is_album()):
+ return "";
+ endif;
+ if (item::viewable($item)):
+ if (access::can("view_full", $item)):
+ $direct_link = $item->file_url();
+ else:
+ $direct_link = $item->resize_url();
+ endif;
+ return ' ';
+ else:
+ return "";
+ endif;
+ }
+
+ public function get_thumb_element($item, $addcontext = FALSE, $linkonly = FALSE) {
+ $thumb_item = $item;
+ if ($this->thumb_random):
+ if ($item->is_album() && ($rnd = item::random_query()->where("parent_id", "=", $item->id)->find()) && $rnd->loaded()):
+ $thumb_item = $rnd;
+ endif;
+ endif;
+
+ $item_class = $item->is_album() ? "g-album" : "g-photo";
+ $content = 'has_thumb()):
+ $is_portrait = ($thumb_item->thumb_height > $thumb_item->thumb_width);
+ $_shift = "";
+ switch ($this->thumb_imgalign):
+ case "center":
+ if (($this->crop_factor == 1) and (!$is_portrait)):
+ $_shift = 'style="margin-top: ' . intval(($this->_thumb_size_y - $thumb_item->thumb_height) / 2) . 'px;"';
+ elseif ($this->crop_factor > 0):
+ $_shift = 'style="margin-top: -' . intval(($thumb_item->thumb_height - $this->_thumb_size_y) / 2) . 'px;"';
+ endif;
+ break;
+ case "bottom":
+ if (($this->crop_factor == 1) and (!$is_portrait)):
+ $_shift = 'style="margin-top: ' . intval($this->_thumb_size_y - $thumb_item->thumb_height) . 'px;"';
+ elseif ($this->crop_factor > 0):
+ $_shift = 'style="margin-top: -' . intval($thumb_item->thumb_height - $this->_thumb_size_y) . 'px;"';
+ endif;
+ break;
+ case "fit":
+ break;
+ case "top":
+ default:
+ break;
+ endswitch;
+ else:
+ $is_portrait = FALSE;
+ $_shift = 'style="margin-top: 0px;"';
+ endif;
+
+ $content .= ($is_portrait)? " g-portrait" : " g-landscape";
+ $content .= '">' . $this->thumb_top($item);
+
+ $content .= '';
+ $content .= $this->thumb_bottom($item);
+ $content .= '';
+
+ return $content;
+ }
+
+ public function get_block_html($module) {
+ $active = block_manager::get_active("site_sidebar");
+ $result = "";
+ foreach ($active as $id => $desc) {
+ if (($desc[0] == $module) and (method_exists("$desc[0]_block", "get"))) {
+ $block = call_user_func(array("$desc[0]_block", "get"), $desc[1], $this);
+ if (!empty($block)) {
+ $block->id = $id;
+ $block->css_id = $block->css_id . "-inline";
+ $result .= $block;
+ }
+ }
+ }
+ return $result;
+ }
+
+ public function css_link($file, $direct = FALSE) {
+ if (!$direct):
+ $file = $this->url("css/" . $file);
+ endif;
+ return "\n\n";
+ }
+
+ public function custom_css_inject($direct) {
+ $_css = $this->custom_css_path;
+ if ($_css != ""):
+ $_fileonly = (stripos($_css, '/') === FALSE);
+
+ if ($_fileonly):
+ if (!$direct):
+ return $this->css($_css);
+ endif;
+ else:
+ if ($direct):
+ return $this->css_link($_css, TRUE);
+ endif;
+ endif;
+ else:
+ return "";
+ endif;
+ }
+
+ public function theme_js_inject() {
+ $js = "";
+ if ($this->show_root_page):
+ $js .= $this->script("jquery.cycle.js");
+ endif;
+// $js .= $this->script("jquery.touchslider.js");
+ $js .= $this->script("ui.support.js");
+ return $js;
+ }
+
+ public function theme_css_inject() {
+ $css = $this->css("screen.css");
+ $css .= $this->css("colors.css");
+ $css .= $this->css("frame.css");
+ $css .= $this->custom_css_inject(FALSE);
+ return $css;
+ }
+
+ public function credits() {
+ if (module::get_var("gallery", "show_credits")):
+ $version_string = SafeString::of_safe_html('Gallery ' . gallery::VERSION);
+ return ''
+ . '- '
+ . '
'
+ . gallery_theme::credits()
+ . '
';
+ else:
+ return '';
+ endif;
+ }
+
+ // $mode: bit 1 - use mix mode ($mode in [1, 3]), bit 2 - strips bbcode ($mode in [2, 3])
+ public function bb2html($text, $mode) {
+ // Syntax Sample:
+ // --------------
+ // [img]http://elouai.com/images/star.gif[/img]
+ // [url="http://elouai.com"]eLouai[/url]
+ // [size="25"]HUGE[/size]
+ // [color="red"]RED[/color]
+ // [b]bold[/b]
+ // [i]italic[/i]
+ // [u]underline[/u]
+ // [list][*]item[*]item[*]item[/list]
+ // [code]value="123";[/code]
+ // [quote]John said yadda yadda yadda[/quote]
+
+ static $bbcode_mappings = array(
+ "#\\[b\\](.*?)\\[/b\\]#" => "$1",
+ "#\\[i\\](.*?)\\[/i\\]#" => "$1",
+ "#\\[u\\](.*?)\\[/u\\]#" => "$1",
+ "#\\[s\\](.*?)\\[/s\\]#" => "$1",
+ "#\\[o\\](.*?)\\[/o\\]#" => "$1",
+ "#\\[url\\](.*?)\[/url\\]#" => "$1",
+ "#\\[url=(.*?)\\](.*?)\[/url\\]#" => "$2",
+ "#\\[mail=(.*?)\\](.*?)\[/mail\\]#" => "$2",
+ "#\\[img\\](.*?)\\[/img\\]#" => "
",
+ "#\\[img=(.*?)\\](.*?)\[/img\\]#" => "
",
+ "#\\[quote\\](.*?)\\[/quote\\]#" => "$1
",
+ "#\\[code\\](.*?)\\[/code\\]#" => "$1
",
+ "#\\[size=([^\\[]*)\\]([^\\[]*)\\[/size\\]#" => "$2",
+ "#\\[color=([^\\[]*)\\]([^\\[]*)\\[/color\\]#" => "$2",
+ "#\\[class=([^\\[]*)\\]([^\\[]*)\\[/class\\]#" => "$2",
+ "#\\[center\\](.*?)\\[/center\\]#" => "$1
",
+ "#\\[list\\](.*?)\\[/list\\]#" => "",
+ "#\\[ul\\](.*?)\\[/ul\\]#" => "",
+ "#\\[li\\](.*?)\\[/li\\]#" => "$1",
+ );
+
+ static $bbcode_strip = '|[[\/\!]*?[^\[\]]*?]|si';
+
+ if (($mode == 1) or ($mode == 3)):
+ $newtext = str_replace("<", "<", $text);
+ $newtext = str_replace(">", ">", $newtext);
+ $newtext = str_replace(""", "\"", $newtext);
+ else:
+ // Replace any html brackets with HTML Entities to prevent executing HTML or script
+ $newtext = str_replace("<", "<", $text);
+ $newtext = str_replace(">", ">", $newtext);
+ $newtext = str_replace(""", """, $newtext);
+ endif;
+
+ // Convert new line chars to html
tags
+ $newtext = nl2br($newtext);
+
+ if (strpos($text, "[") !== false):
+ if (($mode == 2) or ($mode == 3)):
+ $newtext = preg_replace($bbcode_strip, '', $newtext);
+ else:
+ $newtext = preg_replace(array_keys($bbcode_mappings), array_values($bbcode_mappings), $newtext);
+ endif;
+ endif;
+
+ return stripslashes($newtext); //stops slashing, useful when pulling from db
+ }
+
+ function curl_get_file_contents($url) {
+ $curl = curl_init();
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($curl, CURLOPT_URL, $url);
+ $contents = curl_exec($curl);
+ curl_close($curl);
+
+ if ($contents):
+ return $contents;
+ else:
+ return FALSE;
+ endif;
+ }
+
+ function valid_url($str) {
+ return ( ! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $str)) ? FALSE : TRUE;
+ }
+
+ function get_slideshow_list($limit = 10) {
+ if( ! function_exists('simplexml_load_string'))
+ throw new Kohana_User_Exception('Feed Error', 'SimpleXML must be installed!');
+
+ $items = array();
+ $host = 'http://' . $_SERVER['SERVER_NAME'] . '/';
+
+ $feed_url = $this->root_feed;
+ if (!$this->valid_url($feed_url)):
+ $feed_url = $host . $feed_url;
+ endif;
+
+ $use_file_load = ($this->valid_url($feed_url)) || is_file($feed_url);
+
+ $er = error_reporting(0);
+ // Try to get feed directly
+ try {
+ try {
+ if ($use_file_load):
+ $feed = simplexml_load_file($feed_url, 'SimpleXMLElement', LIBXML_NOCDATA);
+ else:
+ $feed = simplexml_load_string($feed_url, 'SimpleXMLElement', LIBXML_NOCDATA);
+ endif;
+ } catch (Exception $e) {
+ }
+ } catch (Exception $e) {
+ };
+
+ if (isset($feed) && ($feed)):
+ // Direct load worked fine
+ else:
+ // Direct load did not work, let's try CURL (URL file-access is disabled ?)
+ try {
+ $file = $this->curl_get_file_contents($feed_url);
+ if ($file):
+ $feed = simplexml_load_string($file, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOBLANKS);
+ endif;
+ } catch (Exception $e) {
+ };
+ endif;
+ error_reporting($er);
+
+ if (isset($feed) && ($feed)):
+ $feed = isset($feed->channel) ? $feed->channel->xpath("//media:content[contains(@url, 'var/resizes')]") : array();
+ $i = 0;
+ foreach ($feed as $item):
+ if ($limit > 0 AND $i++ === $limit)
+ break;
+ $items[] = (array) $item;
+ endforeach;
+ endif;
+ return $items;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/3.0/modules/tag_albums/-- Theme Files/Grey Dragon 3.2.2/views/paginator.html.php b/3.0/modules/tag_albums/-- Theme Files/Grey Dragon 3.2.2/views/paginator.html.php
new file mode 100644
index 00000000..a9508256
--- /dev/null
+++ b/3.0/modules/tag_albums/-- Theme Files/Grey Dragon 3.2.2/views/paginator.html.php
@@ -0,0 +1,216 @@
+
+
+// This is a generic paginator for album, photo and movie pages. Depending on the page type,
+// there are different sets of variables available. With this data, you can make a paginator
+// that lets you say "You're viewing photo 5 of 35", or "You're viewing photos 10 - 18 of 37"
+// for album views.
+//
+// Available variables for all page types:
+// $page_type - "collection", "item", or "other"
+// $page_subtype - "album", "movie", "photo", "tag", etc.
+// $previous_page_url - the url to the previous page, if there is one
+// $next_page_url - the url to the next page, if there is one
+// $total - the total number of photos in this album
+//
+// Available for the "collection" page types:
+// $page - what page number we're on
+// $max_pages - the maximum page number
+// $page_size - the page size
+// $first_page_url - the url to the first page, or null if we're on the first page
+// $last_page_url - the url to the last page, or null if we're on the last page
+// $first_visible_position - the position number of the first visible photo on this page
+// $last_visible_position - the position number of the last visible photo on this page
+//
+// Available for "item" page types:
+// $position - the position number of this photo
+//
+?>
+
+
+ $_pagelist = array();
+
+ // rWatcher Mod
+ if (isset($theme->dynamic_siblings)):
+ $current_page = $position;
+ $i = 1;
+ $total_pages = count($theme->dynamic_siblings);
+ foreach ($theme->dynamic_siblings as $one_sibling):
+ if ($page_type == "item") {
+ $_pagelist[$i] = url::site("tag_albums/show/" . $one_sibling->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($one_sibling->name));
+ } elseif ($page_type == "") {
+ }
+ $i++;
+ endforeach;
+ else:
+ // End rWatcher Mod.
+
+ switch ($page_type) {
+ case "collection":
+ if (isset($item)):
+ $parent = $item->parent();
+ endif;
+ $current_page = $page;
+ $total_pages = $max_pages;
+ // Prepare page url list
+ for ($i = 1; $i <= $total_pages; $i++):
+ $_pagelist[$i] = url::site(url::merge(array("page" => $i)));
+ endfor;
+ break;
+ case "item":
+ if (isset($item)):
+ $parent = $item->parent();
+ endif;
+
+ if (isset($position)):
+ $current_page = $position;
+ else:
+ $current_page = 1;
+ endif;
+
+ $total_pages = $total;
+ if (isset($parent)):
+ $siblings = $parent->children();
+ for ($i = 1; $i <= $total; $i++):
+ $_pagelist[$i] = $siblings[$i-1]->url();
+ endfor;
+ endif;
+ break;
+ default:
+ $current_page = 1;
+ $total_pages = 1;
+ $_pagelist[1] = url::site();
+ break;
+ }
+
+// rWatcher Mod
+ endif;
+// End rWatcher Mod.
+
+ if ($total_pages <= 1):
+ $pagination_msg = " ";
+ else:
+ $pagination_msg = t("Page:") . ' ';
+ if ($total_pages < 13):
+ for ($i = 1; $i <= $total_pages; $i++):
+ if ($i == $current_page):
+ $pagination_msg .= '' . t($i) . '';
+ else:
+ $pagination_msg .= '' . t($i) . '';
+ endif;
+ if ($i < $total_pages):
+ $pagination_msg .= '·';
+ endif;
+ endfor;
+ elseif ($current_page < 9):
+ for ($i = 1; $i <= 10; $i++):
+ if ($i == $current_page):
+ $pagination_msg .= '' . t($i) . '';
+ else:
+ $pagination_msg .= '' . t($i) . '';
+ endif;
+ if ($i < 10):
+ $pagination_msg .= '·';
+ endif;
+ endfor;
+
+ $pagination_msg .= '…';
+ $pagination_msg .= '' . t($total_pages - 1) . '';
+ $pagination_msg .= '·';
+ $pagination_msg .= '' . t($total_pages) . '';
+
+ elseif ($current_page > $total_pages - 8):
+ $pagination_msg .= '' . t(1) . '';
+ $pagination_msg .= '·';
+ $pagination_msg .= '' . t(2) . '';
+ $pagination_msg .= '…';
+
+ for ($i = $total_pages - 9; $i <= $total_pages; $i++):
+ if ($i == $current_page):
+ $pagination_msg .= '' . t($i) . '';
+ else:
+ $pagination_msg .= '' . t($i) . '';
+ endif;
+ if ($i < $total_pages):
+ $pagination_msg .= '·';
+ endif;
+ endfor;
+
+ else:
+ $pagination_msg .= '' . t(1) . '';
+ $pagination_msg .= '·';
+ $pagination_msg .= '' . t(2) . '';
+ $pagination_msg .= '…';
+
+ for ($i = $current_page - 5; $i <= $current_page + 5; $i++):
+ if ($i == $current_page):
+ $pagination_msg .= '' . t($i) . '';
+ else:
+ $pagination_msg .= '' . t($i) . '';
+ endif;
+ if ($i < $current_page + 5):
+ $pagination_msg .= '·';
+ endif;
+ endfor;
+
+ $pagination_msg .= '…';
+ $pagination_msg .= '' . t($total_pages - 1) . '';
+ $pagination_msg .= '·';
+ $pagination_msg .= '' . t($total_pages) . '';
+ endif;
+ endif;
+?>
+
+
\ No newline at end of file
diff --git a/3.0/modules/tag_albums/-- Theme Files/Grey Dragon 3.2.2/views/photo.html.php b/3.0/modules/tag_albums/-- Theme Files/Grey Dragon 3.2.2/views/photo.html.php
new file mode 100644
index 00000000..fcb3fa97
--- /dev/null
+++ b/3.0/modules/tag_albums/-- Theme Files/Grey Dragon 3.2.2/views/photo.html.php
@@ -0,0 +1,133 @@
+
+
+ if ($theme->desc_allowbbcode):
+ $_description = $theme->bb2html($item->description, 1);
+ else:
+ $_description = nl2br(html::purify($item->description));
+ endif;
+
+ if ($theme->is_photometa_visible):
+ $_description .= '';
+ endif;
+
+ switch ($theme->photo_popupbox):
+ case "preview":
+ $include_list = FALSE;
+ $include_single = TRUE;
+ break;
+ case "none":
+ $include_list = FALSE;
+ $include_single = FALSE;
+ break;
+ default:
+ $include_list = TRUE;
+ $include_single = TRUE;
+ break;
+ endswitch;
+?>
+
+
+ $_title = $theme->get_item_title($item, TRUE); ?>
+
+
= $_title ?>
+
+ = $theme->add_paginator("top", FALSE); ?>
+ = $theme->photo_top() ?>
+ if (($theme->photo_descmode == "top") and ($_description)): ?>
+
+ endif; ?>
+
+ = $theme->resize_top($item) ?>
+ $_resizewidth = $item->resize_width;
+ // rWatcher Edit:
+ // Original Line: $siblings = $item->parent()->children();
+ $siblings = "";
+ if (isset($theme->dynamic_siblings)) {
+ $siblings = $theme->dynamic_siblings;
+ } else {
+ $siblings = $item->parent()->children();
+ }
+ // End rWatcher Edit.
+ ?>
+
+ $script = "\n"; ?>
+ $_align = "";
+ $_more = FALSE;
+ if ($_description):
+ switch ($theme->photo_descmode):
+ case "overlay_top":
+ $_align = "g-align-top";
+ $_more = TRUE;
+ break;
+ case "overlay_bottom":
+ $_align = "g-align-bottom";
+ $_more = TRUE;
+ break;
+ case "overlay_top_s":
+ $_align = "g-align-top g-align-static";
+ break;
+ case "overlay_bottom_s":
+ $_align = "g-align-bottom g-align-static";
+ break;
+ default:
+ break;
+ endswitch;
+ endif; ?>
+ if ($_align): ?>
+ if ($_more): ?>
+
= t("More") ?>
+ endif ?>
+
+ = $_title ?>
+ = $_description ?>
+
+ endif ?>
+
+ = $theme->resize_bottom($item) ?>
+
+ if (($theme->photo_descmode == "bottom") and ($_description)): ?>
+
+ endif; ?>
+ = $theme->add_paginator("bottom", FALSE); ?>
+ = $theme->photo_bottom() ?>
+
+= $script ?>
\ No newline at end of file
diff --git a/3.0/modules/tag_albums/controllers/tag_albums.php b/3.0/modules/tag_albums/controllers/tag_albums.php
index 763e6652..027fd76b 100644
--- a/3.0/modules/tag_albums/controllers/tag_albums.php
+++ b/3.0/modules/tag_albums/controllers/tag_albums.php
@@ -227,12 +227,10 @@ class tag_albums_Controller extends Controller {
// Set up breadcrumbs.
$tag_album_breadcrumbs = Array();
- $parent_url = "";
if ($id > 0) {
$counter = 0;
$tag_album_breadcrumbs[] = Breadcrumb::instance($album->title, $album->url())->set_last();
$parent_item = ORM::factory("item", $album->parent_id);
- $parent_url = $parent_item->url();
while ($parent_item->id != 1) {
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
$parent_item = ORM::factory("item", $parent_item->parent_id);
@@ -241,9 +239,8 @@ class tag_albums_Controller extends Controller {
$tag_album_breadcrumbs[1]->url .= "?show=" . $album->id;
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
} else {
- $parent_url = item::root()->url();
$tag_album_breadcrumbs[] = Breadcrumb::instance(item::root()->title, item::root()->url())->set_first();
- $tag_album_breadcrumbs[] = Breadcrumb::instance($page_title, $str_page_url)->set_first();
+ $tag_album_breadcrumbs[] = Breadcrumb::instance($page_title, $str_page_url)->set_last();
}
// Set up and display the actual page.
@@ -259,8 +256,6 @@ class tag_albums_Controller extends Controller {
$template->content = new View("dynamic.html");
$template->content->title = $page_title;
$template->content->description = $page_description;
-
- $template->set_global("parent_url", $parent_url); // Used by Grey Dragon.
$template->content->filter_text = $this->_get_filter_html($id, $filter);
print $template;
}
@@ -344,15 +339,16 @@ class tag_albums_Controller extends Controller {
// Set up breadcrumbs for the page.
$tag_album_breadcrumbs = Array();
- $parent_url = "";
if ($album_id > 0) {
$counter = 0;
$tag_album_breadcrumbs[] = Breadcrumb::instance($display_tag->name, $str_page_url)->set_last();
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
if ($album_tags[0]->tags != "*") {
$parent_item = ORM::factory("item", $parent_item->parent_id);
- }
- $parent_url = $parent_item->url(); // Used by Grey Dragon.
+ } else {
+ $tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->name, url::site("tag_albums/album/" . $album_tags[0]->id . "/" . urlencode($parent_item->name)));
+ $parent_item = ORM::factory("item", $parent_item->parent_id);
+ }
while ($parent_item->id != 1) {
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
$parent_item = ORM::factory("item", $parent_item->parent_id);
@@ -362,7 +358,6 @@ class tag_albums_Controller extends Controller {
$tag_album_breadcrumbs[1]->url .= "?show=" . $id;
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
} else {
- $parent_url = url::site("tag_albums/");
$tag_album_breadcrumbs[] = Breadcrumb::instance(item::root()->title, item::root()->url())->set_first();
if (module::get_var("tag_albums", "tag_index", "default") == "default") {
$tag_album_breadcrumbs[] = Breadcrumb::instance(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/") . "?show=" . $id);
@@ -387,7 +382,6 @@ class tag_albums_Controller extends Controller {
$template->content->description = $page_description;
$template->set_global("all_siblings", $this->_get_records(Array($id), $count, 0, "items." . $sort_page_field, $sort_page_direction, "OR", false));
- $template->set_global("parent_url", $parent_url); // Used by Grey Dragon.
print $template;
// Set breadcrumbs on the photo pages to point back to the calendar day view.
@@ -518,8 +512,6 @@ class tag_albums_Controller extends Controller {
$template->content->description = $page_description;
$template->set_global("all_siblings", $this->_get_records($tag_ids, $count, 0, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false));
- $parent_album = ORM::factory("item", $album->parent_id);
- $template->set_global("parent_url", $parent_album->url()); // Used by Grey Dragon.
print $template;
// Set breadcrumbs on the photo pages to point back to the calendar day view.
@@ -580,6 +572,8 @@ class tag_albums_Controller extends Controller {
static function get_display_context($item, $tag_id, $album_id) {
// Make sure #album_id is valid, clear it out if it isn't.
+ // Note: $dynamic_siblings is used exclusively for Grey Dragon.
+
$album_tags = ORM::factory("tags_album_id")
->where("id", "=", $album_id)
->find_all();
@@ -608,6 +602,7 @@ class tag_albums_Controller extends Controller {
$previous_item = "";
$next_item = "";
$position = 0;
+ $dynamic_siblings = "";
if ($tag_id > 0) {
$sibling_count = tag_albums_Controller::_count_records(Array($tag_id), "OR", false);
$position = tag_albums_Controller::_get_position($item->$sort_page_field, $item->id, Array($tag_id), "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
@@ -621,6 +616,7 @@ class tag_albums_Controller extends Controller {
if (count($next_item_object) > 0) {
$next_item = $next_item_object[0];
}
+ $dynamic_siblings = tag_albums_Controller::_get_records(Array($tag_id), $sibling_count, 0, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
} else {
$tag_ids = Array();
foreach (explode(",", $album_tags[0]->tags) as $tag_name) {
@@ -642,7 +638,7 @@ class tag_albums_Controller extends Controller {
if (count($next_item_object) > 0) {
$next_item = $next_item_object[0];
}
-
+ $dynamic_siblings = tag_albums_Controller::_get_records($tag_ids, $sibling_count, 0, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
}
// Set up breadcrumbs
@@ -676,6 +672,7 @@ class tag_albums_Controller extends Controller {
"tag_id" => $tag_id,
"album_id" => $album_id,
"is_tagalbum_page" => true,
+ "dynamic_siblings" => $dynamic_siblings,
"sibling_count" => $sibling_count,
"breadcrumbs" => $tag_album_breadcrumbs);
}
@@ -798,6 +795,7 @@ class tag_albums_Controller extends Controller {
if ($search_type == "AND") {
$items_model->having("result_count", "=", count($tag_ids));
}
+
return $items_model->find_all($page_size, $offset);
}