This repository was archived by the owner on Jul 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpersonal.php
More file actions
executable file
·137 lines (116 loc) · 4.32 KB
/
Copy pathpersonal.php
File metadata and controls
executable file
·137 lines (116 loc) · 4.32 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
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
require_once("inc/include.php");
if(substr($_SERVER['REQUEST_URI'], -1) != "/") {
header("Location: ". $_SERVER['REQUEST_URI'] ."/");
die();
}
// Page to be opened
if( empty( $_GET['page'] ) ) $_GET['page'] = "-1";
if( !empty( $_GET['page'] ) ) $_GET['page'] = substr( $_GET['page'], 1 );
$page = $_GET['page'];
if( !is_numeric($page) OR $page < 1 OR substr( $_SERVER['REQUEST_URI'], -3) == "-1/" )
{
header( "Location: ". $cfg['htmldir'] . substr( $_SERVER['REQUEST_URI'], -3) .'/' );
die();
}
$i['threadlist'] = '<a href="'. $cfg['htmldir'] .'/personal/'. $_GET['do'] .'/threadlist/">'. T_("Show thread list") .'</a>';
$threads = false;
if( $_GET['do'] == 'followed' )
{
foreach( $cfg['user']['follow'] AS $threadid )
{
if( $threads ) $threads .= " OR ";
$threads .= "`id` = '". $threadid ."'";
}
// Let's cheat a little...
$i['followed'] = true;
$title = T_("Followed threads"); // Site title
$i['url'] = 'personal/followed';
$i['name'] = T_("Followed threads");
$i['description'] = T_("The threads you are following are shown on this page.");
}
elseif( $_GET['do'] == 'mythreads' OR $_GET['do'] == 'repliedthreads' )
{
$threads = false;
if( $_GET['do'] == 'mythreads' )
{
$q = mysql_query("SELECT `id` FROM `posts` WHERE `deleted_time` = '0' AND `uid` = '". $cfg['user']['uid'] ."' AND `thread` = '0' ORDER BY `id` DESC");
$title = T_("My threads");
$i['url'] = 'personal/mythreads';
$i['name'] = T_("My threads");
$i['description'] = T_("The threads you have made are shown on this page.");
}
elseif( $_GET['do'] == 'repliedthreads' )
{
$q = mysql_query("SELECT `thread` AS `id` FROM `posts` WHERE `deleted_time` = '0' AND `uid` = '". $cfg['user']['uid'] ."' AND `thread` != '0' GROUP BY `thread` ORDER BY `id` DESC");
$title = T_("Replied threads");
$i['url'] = 'personal/repliedthreads';
$i['name'] = T_("Replied threads");
$i['description'] = T_("The threads you have replied to are shown on this page.");
}
if( mysql_num_rows( $q ) != 0 )
{
while( $thread = mysql_fetch_assoc( $q ) )
{
if($threads) $threads .= " OR ";
$threads .= "`id` = '". $thread['id'] ."'";
}
}
}
else
error( T_('Unknown function!') );
$title .= ' - '. $cfg['site_title']; // Site title
include("inc/header.php"); // Html-head
echo common_top($i);
if(!$threads) echo '
<p>'. T_("You have no threads here.") .'</p>';
else
{
echo '
<form id="deleteform" method="post" action="'. $cfg['htmldir'] .'/delete/?url='. urlencode($_SERVER['REQUEST_URI']) .'">
<fieldset>';
$pagesq = mysql_query("SELECT COUNT(`id`) AS 'count' FROM `posts` WHERE ". $threads ."");
$pages = ceil(mysql_result($pagesq, 0, "count") / $cfg['tpp']);
if($pages < 1) $pages = 1;
$a = ($page-1) * $cfg['tpp'];
$b = $cfg['tpp'];
$i['followed_threads'] = true;
$threads = mysql_query("SELECT * FROM `posts` WHERE `deleted_time` = '0' AND ". $threads ." ORDER BY `bump_time` DESC LIMIT ". $a .", ". $b);
while($thread = mysql_fetch_assoc($threads)) {
print_thread($thread, "board", $i);
}
echo '
<div id="bottomnav">
<div id="bottomleft">
<p id="pages">';
if($page != 1) echo '
<a id="prev" class="button" href="'. $cfg['htmldir'] .'/'. $i['url'] .'-'. ($page-1) .'/">'. T_("Previous") .'</a>';
for($a = 1; $a <= $pages; $a++) {
if($page == $a) echo '
['. $a .']';
else echo '
[<a href="'. $cfg['htmldir'] .'/'. $i['url'] . ($a != 1 ? '-'. $a : '') .'/">'. $a .'</a>]';
}
if($page < $pages) echo '
<a id="next" class="button" href="'. $cfg['htmldir'] .'/'. $i['url'] .'-'. ($page+1) .'/">'. T_("Next") .'</a>';
echo '
</p>
</div>
<div class="boardnav"> [ <a href="'. $cfg['htmldir'] .'/personal/followed/">'. T_("Followed") .'</a> |
<a href="'. $cfg['htmldir'] .'/personal/mythreads/">'. T_("My threads") .'</a> |
<a href="'. $cfg['htmldir'] .'/personal/repliedthreads/">'. T_("Replied") .'</a> ]
<div style="float: right;">
[ <a href="'. $cfg['htmldir'] .'/">'. T_('Front page') .'</a> |
<a href="'. $cfg['htmldir'] .'/search/">'. T_('Message search') .'</a> |
<a href="'. $cfg['htmldir'] .'/settings/">'. T_("Site personalization") .'</a> ]
</div>
<br />'. boardnav() .'</div>'.buttons_bottom(), '
</div>
</fieldset>
</form>';
}
?>
</div>
<?php
include("inc/footer.php"); // Html-footeri
?>