Repository navigation
Expand file tree
/
Copy pathhtml_all.php
More file actions
124 lines (104 loc) · 2.95 KB
/
Copy pathhtml_all.php
File metadata and controls
124 lines (104 loc) · 2.95 KB
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
<?php
use Xmf\Request;
use XoopsModules\Tadtools\Utility;
use XoopsModules\Tad_book3\Tools;
/*-----------引入檔案區--------------*/
require_once __DIR__ . '/header.php';
set_time_limit(0);
ini_set('memory_limit', '150M');
/*-----------執行動作判斷區----------*/
$op = Request::getString('op');
$tbsn = Request::getInt('tbsn');
$header = Request::getInt('header', 1);
$book = get_tad_book3($tbsn);
if ($xoopsUser) {
$uid = $xoopsUser->uid();
} else {
$uid = 0;
}
$author_arr = explode(',', $book['author']);
$my = in_array($uid, $author_arr);
//高亮度語法
$prism = Utility::prism('return');
$bootstrap = Utility::get_bootstrap('return');
$html = '<!DOCTYPE html>
<html lang="zh-Hant-TW">
<head>
<meta charset="utf-8">
<title>' . $book['title'] . '</title>
' . $bootstrap . '
<link rel="stylesheet" type="text/css" href="' . XOOPS_URL . '/modules/tad_book3/css/reset.css" >
<style type="text/css">
body{
font-size: 100%;
}
.page{
font-size: 100%;
line-height:2;
padding: 2cm;
background-image: url(' . XOOPS_URL . '/modules/tad_book3/images/paper_bg.jpg);
background-repeat: repeat-x;
}
.page_content{
font-size: 100%;
}
.page_title{
border-bottom: 1px solid black;
text-align:right;
color:black;
margin-bottom:20px;
}
</style>
</head>
<body>' . $prism;
$i = 0;
$docs = '';
$sql = 'SELECT `tbdsn`, `enable` FROM `' . $xoopsDB->prefix('tad_book3_docs') . '` WHERE `tbsn` =? ORDER BY `category`, `page`, `paragraph`, `sort`';
$result = Utility::query($sql, 'i', [$tbsn]) or Utility::web_error($sql, __FILE__, __LINE__);
while (false !== ($all = $xoopsDB->fetchArray($result))) {
foreach ($all as $k => $v) {
$$k = $v;
}
if ('1' != $enable and !$my) {
continue;
}
$html .= view_page($tbdsn, $header);
$html .= '<p style="page-break-after:always"></p>';
}
$html .= '
</body>
</html>';
die($html);
//觀看某一頁
function view_page($tbdsn = '', $header = 1)
{
global $xoopsDB, $book;
$all = get_tad_book3_docs($tbdsn);
foreach ($all as $key => $value) {
$$key = $value;
}
if (!empty($from_tbdsn)) {
$form_page = get_tad_book3_docs($from_tbdsn);
$content .= $form_page['content'];
}
if (!Tools::chk_power($book['read_group'])) {
redirect_header('index.php', 3, _MD_TADBOOK3_CANT_READ);
}
if (!empty($book['passwd']) and $_SESSION['passwd'] != $book['passwd']) {
$data .= _MD_TADBOOK3_INPUT_PASSWD;
return $data;
exit;
}
$doc_sort = Tools::mk_category($category, $page, $paragraph, $sort);
$page_title = $header ? "<div class='page_title'>{$book['title']}</div>" : '';
$main = "
<div class='page'>
$page_title
<div class='page_content'>
<h{$doc_sort['level']}>{$doc_sort['main']} {$title}</h{$doc_sort['level']}>
$content
</div>
</div>
";
return $main;
}