[ Index ]
 

Code source de Phorum 5.1.25

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> follow.php (source)

   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=(int)$PHORUM["args"][1];
  39  } elseif(isset($_POST["thread"])){
  40      $thread=(int)$_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  # We stepped away from using "remove" as the URL parameter to stop 
  51  # following a certain thread, because it got blacklisted by several  
  52  # spam filtering programs. We'll still handle the remove parameter 
  53  # though, to keep supporting the URLs that are in the messages 
  54  # that were sent out before this change. 
  55  if(isset($PHORUM["args"]["remove"]) || isset($PHORUM["args"]["stop"])){
  56      // we are removing a message from the follow list
  57      phorum_user_unsubscribe( $PHORUM['user']['user_id'], $thread );
  58      $PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["RemoveFollowed"];
  59      $PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $thread);
  60      $PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
  61      $template="message";
  62  } elseif(isset($PHORUM["args"]["noemail"])){
  63      // we are stopping emails for this thread
  64      phorum_user_unsubscribe( $PHORUM['user']['user_id'], $thread );
  65      phorum_user_subscribe( $PHORUM['user']['user_id'], $message["forum_id"], $thread, PHORUM_SUBSCRIPTION_BOOKMARK );
  66      $PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["NoMoreEmails"];
  67      $PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $thread);
  68      $PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
  69      $template="message";
  70  } elseif(!empty($_POST)) {
  71      // the user has submitted the form
  72      $type = (isset($_POST["send_email"])) ? PHORUM_SUBSCRIPTION_MESSAGE : PHORUM_SUBSCRIPTION_BOOKMARK;
  73      phorum_user_subscribe( $PHORUM['user']['user_id'], $message["forum_id"], $thread, $type );
  74      $PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $thread);
  75      $PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
  76      $PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["BookmarkedThread"];
  77      $template="message";
  78  } else {
  79      // we are following a new thread
  80      $PHORUM["DATA"]["URL"]["ACTION"]=phorum_get_url(PHORUM_FOLLOW_ACTION_URL);
  81      $PHORUM["DATA"]["SUBJECT"]=htmlspecialchars($message["subject"]);
  82      $PHORUM["DATA"]["THREAD"]=$thread;
  83      $PHORUM["DATA"]["FORUM_ID"]=$PHORUM["forum_id"];
  84      $template="follow";
  85  }
  86  
  87  
  88  // set all our common URL's
  89  phorum_build_common_urls();
  90  
  91  include phorum_get_template("header");
  92  phorum_hook("after_header");
  93  include phorum_get_template($template);
  94  phorum_hook("before_footer");
  95  include phorum_get_template("footer");
  96  
  97  
  98  ?>


Généré le : Thu Nov 29 12:22:27 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics