Subversion Repositories Applications.papyrus

Rev

Rev 831 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
define('phorum_page','subscribe');
20
 
21
include_once("./common.php");
22
 
23
phorum_require_login();
24
 
25
// checking read-permissions
26
if(!phorum_check_read_common()) {
27
  return;
28
}
29
 
30
// somehow we got to a folder
31
if($PHORUM["folder_flag"] || empty($PHORUM["forum_id"])){
32
    $dest_url = phorum_get_url(PHORUM_INDEX_URL, $PHORUM["forum_id"]);
33
    phorum_redirect_by_url($dest_url);
34
    exit();
35
}
36
 
37
if(isset($PHORUM["args"][1])){
38
    $thread=$PHORUM["args"][1];
39
} elseif(isset($_POST["thread"])){
40
    $thread=$_POST["thread"];
41
}
42
 
43
if(empty($thread)) {
44
    phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
45
    exit();
46
}
47
 
48
$message=phorum_db_get_message($thread);
49
 
50
if(isset($PHORUM["args"]["remove"])){
51
    // we are removing a message from the follow list
52
    phorum_user_unsubscribe( $PHORUM['user']['user_id'], $thread );
53
    $PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["RemoveFollowed"];
54
    $PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $thread);
55
    $PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
56
    $template="message";
57
} elseif(isset($PHORUM["args"]["noemail"])){
58
    // we are stopping emails for this thread
59
    phorum_user_unsubscribe( $PHORUM['user']['user_id'], $thread );
60
    phorum_user_subscribe( $PHORUM['user']['user_id'], $message["forum_id"], $thread, PHORUM_SUBSCRIPTION_BOOKMARK );
61
    $PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["NoMoreEmails"];
62
    $PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $thread);
63
    $PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
64
    $template="message";
65
} elseif(!empty($_POST)) {
66
    // the user has submitted the form
67
    $type = (isset($_POST["send_email"])) ? PHORUM_SUBSCRIPTION_MESSAGE : PHORUM_SUBSCRIPTION_BOOKMARK;
68
    phorum_user_subscribe( $PHORUM['user']['user_id'], $message["forum_id"], $thread, $type );
69
    $PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $thread);
70
    $PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
71
    $PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["BookmarkedThread"];
72
    $template="message";
73
} else {
74
    // we are following a new thread
75
    $PHORUM["DATA"]["URL"]["ACTION"]=phorum_get_url(PHORUM_FOLLOW_ACTION_URL);
76
    $PHORUM["DATA"]["SUBJECT"]=htmlspecialchars($message["subject"]);
77
    $PHORUM["DATA"]["THREAD"]=$thread;
78
    $PHORUM["DATA"]["FORUM_ID"]=$PHORUM["forum_id"];
79
    $template="follow";
80
}
81
 
82
 
83
// set all our common URL's
84
phorum_build_common_urls();
85
 
86
include phorum_get_template("header");
87
phorum_hook("after_header");
88
include phorum_get_template($template);
89
phorum_hook("before_footer");
90
include phorum_get_template("footer");
91
 
92
 
93
?>