831 |
florian |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
////////////////////////////////////////////////////////////////////////////////
|
|
|
4 |
// //
|
|
|
5 |
// Copyright (C) 2006 Phorum Development Team //
|
|
|
6 |
// http://www.phorum.org //
|
|
|
7 |
// //
|
|
|
8 |
// This program is free software. You can redistribute it and/or modify //
|
|
|
9 |
// it under the terms of either the current Phorum License (viewable at //
|
|
|
10 |
// phorum.org) or the Phorum License that was distributed with this file //
|
|
|
11 |
// //
|
|
|
12 |
// This program is distributed in the hope that it will be useful, //
|
|
|
13 |
// but WITHOUT ANY WARRANTY, without even the implied warranty of //
|
|
|
14 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. //
|
|
|
15 |
// //
|
|
|
16 |
// You should have received a copy of the Phorum License //
|
|
|
17 |
// along with this program. //
|
|
|
18 |
////////////////////////////////////////////////////////////////////////////////
|
|
|
19 |
|
|
|
20 |
if(!defined("PHORUM_CONTROL_CENTER")) return;
|
|
|
21 |
|
|
|
22 |
// remove threads fromlist
|
|
|
23 |
if(isset($_POST["delthreads"])){
|
|
|
24 |
foreach($_POST["delthreads"] as $thread){
|
|
|
25 |
phorum_user_unsubscribe( $PHORUM['user']['user_id'], $thread );
|
|
|
26 |
}
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
// change any email settings
|
|
|
30 |
if(isset($_POST["sub_type"])){
|
|
|
31 |
foreach($_POST["sub_type"] as $thread=>$type){
|
|
|
32 |
if($type!=$_POST["old_sub_type"][$thread]){
|
|
|
33 |
phorum_user_unsubscribe( $PHORUM['user']['user_id'], $thread );
|
|
|
34 |
phorum_user_subscribe( $PHORUM['user']['user_id'], $_POST["thread_forum_id"][$thread], $thread, $type );
|
|
|
35 |
}
|
|
|
36 |
}
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
// the number of days to show
|
|
|
40 |
if (isset($_POST['subdays']) && is_numeric($_POST['subdays'])) {
|
|
|
41 |
$subdays = $_POST['subdays'];
|
|
|
42 |
} elseif(isset($PHORUM['args']['subdays']) && !empty($PHORUM["args"]['subdays']) && is_numeric($PHORUM["args"]['subdays'])) {
|
|
|
43 |
$subdays = $PHORUM['args']['subdays'];
|
|
|
44 |
} else {
|
|
|
45 |
$subdays = 2;
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
$PHORUM['DATA']['SELECTED'] = $subdays;
|
|
|
49 |
|
|
|
50 |
// reading all subscriptions to messages
|
|
|
51 |
$subscr_array = phorum_db_get_message_subscriptions($PHORUM['user']['user_id'], $subdays);
|
|
|
52 |
|
|
|
53 |
// reading all forums
|
|
|
54 |
$forum_ids = $subscr_array['forum_ids'];
|
|
|
55 |
unset($subscr_array['forum_ids']);
|
|
|
56 |
$forums_arr = phorum_db_get_forums($forum_ids,-1,$PHORUM['vroot']);
|
|
|
57 |
$subscr_array_final = array();
|
|
|
58 |
foreach($subscr_array as $dummy => $data) {
|
|
|
59 |
if ($data['forum_id'] == 0) {
|
|
|
60 |
$data['forum'] = $PHORUM['DATA']['LANG']['Announcement'];
|
|
|
61 |
} else {
|
|
|
62 |
$data['forum'] = $forums_arr[$data['forum_id']]['name'];
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
$data['datestamp'] = phorum_date($PHORUM["short_date"], $data["modifystamp"]);
|
|
|
66 |
$data['readurl'] = phorum_get_url(PHORUM_FOREIGN_READ_URL, $data["forum_id"], $data["thread"]);
|
|
|
67 |
|
|
|
68 |
if(!empty($data["user_id"])) {
|
|
|
69 |
$data["profile_url"] = phorum_get_url(PHORUM_PROFILE_URL, $data["user_id"]);
|
|
|
70 |
// we don't normally put HTML in this code, but this makes it easier on template builders
|
|
|
71 |
$data["linked_author"] = "<a href=\"".$data["profile_url"]."\">".htmlspecialchars($data["author"])."</a>";
|
|
|
72 |
} elseif(!empty($data["email"])) {
|
|
|
73 |
$data["email_url"] = phorum_html_encode("mailto:$data[email]");
|
|
|
74 |
// we don't normally put HTML in this code, but this makes it easier on template builders
|
|
|
75 |
$data["linked_author"] = "<a href=\"".$data["email_url"]."\">".htmlspecialchars($data["author"])."</a>";
|
|
|
76 |
} else {
|
|
|
77 |
$data["linked_author"] = htmlspecialchars($data["author"]);
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
$data["subject"]=htmlspecialchars($data["subject"]);
|
|
|
81 |
|
|
|
82 |
$subscr_array_final[] = $data;
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
$PHORUM['DATA']['subscriptions'] = $subscr_array_final;
|
|
|
86 |
$template = "cc_subscriptions";
|
|
|
87 |
|
|
|
88 |
?>
|