forked from Needlworks/Textcube
/
index.php
146 lines (140 loc) · 5.29 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
<?php
/// Copyright (c) 2004-2012, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
if (isset($_POST['page']))
$_GET['page'] = $_POST['page'];
if (!empty($_POST['mode']) && $_POST['mode'] == 'fb') {
$IV = array(
'GET' => array(
'page' => array('int', 1, 'default' => 1),
'category' => array('int', 0, 'mandatory'=>false)
),
'POST' => array(
'mode' => array(array('fb')),
'partial' => array('bool','default' => false),
's_home_title' => array('string', 'default'=>''),
's_name' => array('string' , 'default'=>''),
's_no' => array('int'),
'url' => array('string', 'default'=>''),
's_url' => array('string', 'default'=>''),
's_post_title' => array('string', 'default'=>''),
'r1_no' => array('int'),
'r1_name' => array('string', 'default'=>''),
'r1_rno' => array('int'),
'r1_homepage' => array('string', 'default'=>''),
'r1_regdate' => array('timestamp'),
'r1_body' => array('string'),
'r1_url' => array('string', 'default'=>''),
'r2_no' => array('int'),
'r2_name' => array('string', 'default'=>''),
'r2_rno' => array('int'),
'r2_homepage' => array('string', 'default'=>''),
'r2_regdate' => array('timestamp'),
'r2_body' => array('string'),
'r2_url' => array('string', 'default'=>'')
)
);
} else {
$IV = array(
'GET' => array(
'page' => array('int', 1, 'default' => 1),
'mode' => array(array('mobile','desktop','tablet'),'mandatory'=>false),
'category' => array('int', 0, 'mandatory'=>false)
)
);
}
require ROOT . '/library/preprocessor.php';
// Redirect for ipod touch / iPhone
$browserUtil = Utils_Browser::getInstance();
if(Setting::getBlogSettingGlobal('useiPhoneUI',true) && ($browserUtil->isMobile() == true)
&& (!isset($_GET['mode']) || $_GET['mode'] != 'desktop')
&& (!isset($_SESSION['mode']) || !in_array($_SESSION['mode'],array('desktop')))) {
if(isset($suri['id'])) {
$slogan = getSloganById($blogid, $suri['id']);
if(!empty($slogan)) {
header("Location: ".$context->getProperty('uri.blog')."/i/entry/".URL::encode($slogan)); exit;
}
} else {
header("Location: ".$context->getProperty('uri.blog')."/i"); exit;
}
}
$_SESSION['mode'] = 'desktop';
publishEntries();
if (!empty($_POST['mode']) && $_POST['mode'] == 'fb') { // Treat comment notifier.
$result = receiveNotifiedComment($_POST);
if ($result > 0)
echo '<?xml version="1.0" encoding="utf-8"?><response><error>1</error><message>error('.$result.')</message></response>';
else
echo '<?xml version="1.0" encoding="utf-8"?><response><error>0</error></response>';
} else {
notifyComment();
}
fireEvent('OBStart');
if(empty($suri['id'])) { // Without id.
$skin = new Skin($skinSetting['skin']);
$frontpage = Setting::getBlogSettingGlobal('frontpage','entry');
if (empty($suri['value']) && $suri["directive"] == "/" && ($frontpage != 'entry')) {
if($frontpage == 'cover' && isset($skin->cover) && count($coverpageMappings) > 0) {
define('__TEXTCUBE_COVER__',true);
require ROOT . '/interface/common/blog/begin.php';
dress('article_rep', '', $view);
dress('paging', '', $view);
require ROOT . '/interface/common/blog/cover.php';
require ROOT . '/interface/common/blog/end.php';
} else if ($frontpage == 'line' && isset($skin->line)) {
define('__TEXTCUBE_LINE__',true);
$lineobj = Model_Line::getInstance();
$lineobj->reset();
$lineobj->setFilter(array('category','equals','public',true));
$lineobj->setLimit(20);
$lineobj->setOrder('created','desc');
$lines = $lineobj->get();
require ROOT . '/interface/common/blog/begin.php';
require ROOT . '/interface/common/blog/line.php';
require ROOT . '/interface/common/blog/end.php';
} else {
require ROOT . '/interface/common/blog/begin.php';
require ROOT . '/interface/common/blog/end.php';
}
} else {
list($entries, $paging) = getEntriesWithPaging($blogid, $suri['page'], $blog['entriesOnPage']);
require ROOT . '/interface/common/blog/begin.php';
require ROOT . '/interface/common/blog/entries.php';
require ROOT . '/interface/common/blog/end.php';
}
} else { // With id.
if(isset($_GET['category'])) { // category exists
if(Validator::isInteger($_GET['category'], 0)) {
list($entries, $paging) = getEntryWithPaging($blogid, $suri['id'],false,$_GET['category']);
}
} else { // Just normal entry view
list($entries, $paging) = getEntryWithPaging($blogid, $suri['id']);
}
if (isset($_POST['partial'])) { // Partial output.
header('Content-Type: text/plain; charset=utf-8');
$skin = new Skin($skinSetting['skin']);
$view = '[##_article_rep_##]';
require ROOT . '/interface/common/blog/entries.php';
$view = removeAllTags($view);
if ($view != '[##_article_rep_##]')
print $view;
} else {
require ROOT . '/interface/common/blog/begin.php';
if (empty($entries)) {
header('HTTP/1.1 404 Not Found');
if (empty($skin->pageError)) {
dress('article_rep', '<div class="TCwarning">' . _text('존재하지 않는 페이지입니다.') . '</div>', $view);
} else{
dress('article_rep', NULL, $view);
dress('page_error', $skin->pageError, $view);
}
unset($paging);
} else {
require ROOT . '/interface/common/blog/entries.php';
}
require ROOT . '/interface/common/blog/end.php';
}
}
fireEvent('OBEnd');
?>