-
Notifications
You must be signed in to change notification settings - Fork 1
/
detail.php
68 lines (62 loc) · 1.97 KB
/
detail.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
<?php
# Medialinks view a page
# $Id: detail.php,v 1.4 2007/12/28 15:17:34 nobu Exp $
include "../../mainfile.php";
include_once "functions.php";
$mid = isset($_GET['mid'])?intval($_GET['mid']):0;
if (!$mid) {
redirect_header('index.php', 3, _NOPERM);
exit;
}
$content = new MediaContent($mid);
if ($content->getVar('mid')!=$mid) {
redirect_header('index.php', 3, _NOPERM);
exit;
}
$content->hits();
if ($content->getVar('status')!='N') { // deleted content view only admin
if (!is_object($xoopsUser) ||
!($xoopsUser->isAdmin($xoopsModule->getVar('mid')) ||
($content->getVar('status')=='W' && $content->getVar('poster')==$xoopsUser->getVar('uid')))) {
redirect_header('index.php', 3, _NOPERM);
exit;
}
}
include XOOPS_ROOT_PATH."/header.php";
$xoopsOption['template_main'] = 'medialinks_detail.html';
$xoopsTpl->assign('xoops_pagetitle', htmlspecialchars($xoopsModule->getVar('name')._MD_SEP.$content->getVar('title')));
$xoopsTpl->assign('fields', $content->dispVars());
$keyid = isset($_GET['keyid'])?intval($_GET['keyid']):0;
$keys =& $content->getKeywords();
if (count($keys) && !in_array($keyid, $keys)) {
$ids = $keywords->getPriKeysID();
$keyid = 0;
if (count($keys)) {
foreach ($ids as $pid) {
if (in_array($pid, $keys)) {
$keyid = $pid;
break;
}
}
}
}
$keypath = $content->keys_path($keyid, 0, true);
$xoopsTpl->assign('keypath', $keypath);
set_ml_breadcrumbs($keypath, array(array(
'url'=>MODULE_URL.'/detail.php?mid='.$mid,
'name'=>htmlspecialchars($content->getVar('title')))));
$conf = $xoopsModuleConfig['d3forumid'];
if ($conf) {
$d3id = 0;
foreach (explode(',', $conf) as $id) {
if (preg_match('/^\d+$/', $id)) {
if ($d3id==0) $d3id = $id;
} elseif (preg_match('/^key(\d+)=(\d+)$/', $id, $d)) {
if (in_array($d[1], $keys)) $d3id = $d[2];
}
}
if ($d3id) $xoopsTpl->assign('d3forum_id', $d3id);
}
include XOOPS_ROOT_PATH.'/include/comment_view.php';
include XOOPS_ROOT_PATH."/footer.php";
?>