-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
150 lines (125 loc) · 5.5 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
use Xmf\Request;
use XoopsModules\Tadgallery\Tadgallery;
use XoopsModules\Tadgallery\Tools;
use XoopsModules\Tadtools\CategoryHelper;
use XoopsModules\Tadtools\ColorBox;
use XoopsModules\Tadtools\FancyBox;
use XoopsModules\Tadtools\Jeditable;
use XoopsModules\Tadtools\Utility;
/*-----------引入檔案區--------------*/
require_once __DIR__ . '/header.php';
$op = Request::getString('op');
$show_uid = Request::getInt('show_uid');
$csn = Request::getInt('csn');
$passwd = Request::getString('passwd');
$tadgallery = new Tadgallery();
if ($show_uid) {
$tadgallery->set_show_uid($show_uid);
}
if (!empty($csn)) {
$cate = Tools::get_tad_gallery_cate($csn);
if ('waterfall' === $cate['show_mode']) {
$GLOBALS['xoopsOption']['template_main'] = 'tadgallery_list_waterfall.tpl';
} elseif ('flickr' === $cate['show_mode']) {
$GLOBALS['xoopsOption']['template_main'] = 'tadgallery_list_flickr.tpl';
} elseif ('passwd_form' === $op) {
$GLOBALS['xoopsOption']['template_main'] = 'tadgallery_passwd_form.tpl';
} else {
$GLOBALS['xoopsOption']['template_main'] = 'tadgallery_list_normal.tpl';
}
} else {
if ('waterfall' === $xoopsModuleConfig['index_mode']) {
$GLOBALS['xoopsOption']['template_main'] = 'tadgallery_list_waterfall.tpl';
} elseif ('flickr' === $xoopsModuleConfig['index_mode']) {
$GLOBALS['xoopsOption']['template_main'] = 'tadgallery_list_flickr.tpl';
} else {
$GLOBALS['xoopsOption']['template_main'] = 'tadgallery_list_normal.tpl';
}
}
$GLOBALS['xoopsOption']['template_main'] = $xoopsOption['template_main'];
require_once XOOPS_ROOT_PATH . '/header.php';
if ((!empty($csn) && $cate['show_mode'] == 'flickr') || (empty($csn) && $xoopsModuleConfig['index_mode'] == 'flickr')) {
$GLOBALS['xoTheme']->addStylesheet('modules/tadgallery/class/justifiedGallery/justifiedGallery.min.css');
$GLOBALS['xoTheme']->addScript('modules/tadgallery/class/justifiedGallery/jquery.justifiedGallery.min.js');
} elseif ((!empty($csn) && $cate['show_mode'] == 'waterfall') || (empty($csn) && $xoopsModuleConfig['index_mode'] == 'waterfall')) {
$GLOBALS['xoTheme']->addScript('modules/tadgallery/class/jquery.masonry.min.js');
$GLOBALS['xoTheme']->addScript('modules/tadgallery/class/jquery.corner.js');
$GLOBALS['xoTheme']->addScript('modules/tadgallery/class/jquery.animate-shadow.js');
} else {
$GLOBALS['xoTheme']->addScript('modules/tadgallery/class/jquery.animate-shadow.js');
}
/*-----------執行動作判斷區----------*/
$sn = Request::getInt('sn');
$uid = Request::getInt('uid');
$show_uid = Request::getInt('show_uid');
if (!empty($csn) and !empty($passwd)) {
$_SESSION['tadgallery'][$csn] = $passwd;
}
switch ($op) {
case 'passwd_form':
passwd_form($csn, $cate['title']);
break;
default:
list_photos($csn);
break;
}
/*-----------秀出結果區--------------*/
$categoryHelper = new CategoryHelper('tad_gallery_cate', 'csn', 'of_csn', 'title');
$arr = $categoryHelper->getCategoryPath($csn);
$path = Utility::tad_breadcrumb($csn, $arr, 'index.php', 'csn', 'title');
$xoopsTpl->assign('path', $path);
$author_menu = get_all_author($show_uid);
$xoopsTpl->assign('author_option', $author_menu);
$xoopsTpl->assign('toolbar', Utility::toolbar_bootstrap($interface_menu, false, $interface_icon));
if ($GLOBALS['xoTheme']) {
$GLOBALS['xoTheme']->addStylesheet('modules/tadgallery/css/module.css');
$GLOBALS['xoTheme']->addStylesheet('modules/tadgallery/class/jquery.thumbs/jquery.thumbs.css');
$GLOBALS['xoTheme']->addScript('modules/tadgallery/class/jquery.thumbs/jquery.thumbs.js');
}
require_once XOOPS_ROOT_PATH . '/footer.php';
/*-----------function區--------------*/
//列出所有照片
function list_photos($csn = '')
{
global $xoopsModuleConfig, $xoopsTpl, $tadgallery;
$GLOBALS['xoTheme']->addStylesheet('modules/tadgallery/class/pannellum/pannellum.css');
$GLOBALS['xoTheme']->addScript('modules/tadgallery/class/pannellum/pannellum.js');
if ($csn) {
$tadgallery->set_orderby('photo_sort');
$tadgallery->set_view_csn($csn);
$tadgallery->set_limit($xoopsModuleConfig['thumbnail_number']);
$tadgallery->set_only_thumb($xoopsModuleConfig['only_thumb']);
$cate = Tools::get_tad_gallery_cate($csn);
$xoopsTpl->assign('cate', $cate);
$upload_powers = Tools::chk_cate_power('upload');
if ($upload_powers) {
$file = 'save.php';
$jeditable = new Jeditable();
$jeditable->setTextAreaCol('#content', $file, '90%', '100px', "{'csn':$csn,'op' : 'save'}", _MD_TADGAL_EDIT_CATE_CONTENT);
$jeditable->render();
}
} else {
$tadgallery->set_orderby('rand');
$tadgallery->set_limit($xoopsModuleConfig['thumbnail_number']);
}
if (0 != $xoopsModuleConfig['random_photo'] or !empty($csn)) {
$photo = $tadgallery->get_photos();
}
$xoopsTpl->assign('random_photo', $xoopsModuleConfig['random_photo']);
$xoopsTpl->assign('photo', $photo);
$tadgallery->get_albums();
$cate_fancybox = new FancyBox('.editbtn', 800);
$cate_fancybox->set_type('iframe');
$cate_fancybox->render(false);
$colorbox = new ColorBox('.Photo');
$colorbox->render(false);
$xoopsTpl->assign('only_thumb', $xoopsModuleConfig['only_thumb']);
$xoopsTpl->assign('csn', $csn);
}
function passwd_form($csn, $title)
{
global $xoopsTpl;
$xoopsTpl->assign('title', sprintf(_MD_TADGAL_INPUT_ALBUM_PASSWD, $title));
$xoopsTpl->assign('csn', $csn);
}