[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_tmpl/ -> message.send.tmpl.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // ----------------------------------------------------------------
  24  // obligate check for phpwcms constants
  25  if (!defined('PHPWCMS_ROOT')) {
  26     die("You Cannot Access This Script Directly, Have a Nice Day.");
  27  }
  28  // ----------------------------------------------------------------
  29  
  30  
  31  $msg_send_ok = 0;
  32  $msg_subject = '';
  33  $msg_message = '';
  34  $msg = 0;
  35  $msg_err = '';
  36  
  37  //If this should be a replay to another mail
  38  if(isset($_GET["msg"]) && intval($_GET["msg"]) && empty($_POST['msg_send_aktion'])) {
  39      list($msg, $msg_read) = explode(":", $_GET["msg"]);
  40      $msg = intval($msg);
  41      if($msg_read == "I" && $msg) { //Wenn die Nachricht noch den Status Unread hat, setzen auf read
  42          $sql =     "UPDATE ".DB_PREPEND."phpwcms_message SET ".
  43                  "msg_tstamp=msg_tstamp, msg_read=1 WHERE ".
  44                  "msg_uid=".$_SESSION["wcs_user_id"]." AND ".
  45                  "msg_id=".$msg.";";
  46          mysql_query($sql, $db) or die("error");
  47      }
  48      if($msg) {
  49          $sql =    "SELECT *, DATE_FORMAT(phpwcms_message.msg_tstamp, '%b %e, %Y (%H:%i)') AS send_date ".
  50                  "FROM ".DB_PREPEND."phpwcms_message INNER JOIN ".DB_PREPEND."phpwcms_user ON ".
  51                  DB_PREPEND."phpwcms_message.msg_from=".DB_PREPEND."phpwcms_user.usr_id WHERE ".DB_PREPEND."phpwcms_message.msg_uid=".$_SESSION["wcs_user_id"].
  52                  " AND ".DB_PREPEND."phpwcms_message.msg_id=".$msg." LIMIT 1;";
  53          if($result = mysql_query($sql, $db)) {
  54              if($msgdetail = mysql_fetch_array($result)) {
  55                  $msg_subject = $BL['be_msg_RE'].": ".$msgdetail["msg_subject"];
  56                  $msg_message =     "\n\n----[".$BL['be_msg_by']." ".$msgdetail["usr_name"].
  57                                  " ".$BL['be_msg_on']." ".$msgdetail["send_date"]."]----\n".
  58                                  $BL['be_msg_subject'].": ".$msgdetail["msg_subject"].
  59                                  "\n".$BL['be_msg_msg'].": ".$msgdetail["msg_text"];
  60                  $msg_to = $msgdetail["msg_from"];
  61                  $msg_pid = $msg;
  62              }
  63          }
  64      }
  65  }
  66  
  67  //Get signature value of user
  68  if($result = mysql_query(    "SELECT detail_signature FROM ".DB_PREPEND."phpwcms_userdetail WHERE detail_pid=".
  69                              $_SESSION["wcs_user_id"]." LIMIT 1;") ) {
  70      if($row = mysql_fetch_row($result)) {
  71          if(trim($row[0])) $msg_message = "\n\n\t\n".$row[0].$msg_message;
  72      }
  73  }
  74  if(isset($_POST['msg_send_aktion']) && intval($_POST['msg_send_aktion'])) {
  75      $msg_subject    = strip_tags(slweg(trim($_POST["msg_send_subject"])));
  76      $msg_message    = strip_tags(slweg($_POST["msg_send_msg"]));
  77      $msg_to            = slweg(trim($_POST["msg_send_receiver"]));
  78      $msg_pid        = intval($_POST['msg_send_pid']);
  79  
  80      if(isEmpty($msg_to)) {
  81          $msg_err .= "- ".$BL['be_msg_err1']."\n";
  82      }
  83      if(isEmpty($msg_subject)) {
  84          $msg_err .= "- ".$BL['be_msg_err2']."\n";
  85      }
  86      if(isEmpty($msg_message)) {
  87          $msg_err .= "- ".$BL['be_msg_err3']."\n";
  88      }
  89  
  90      if(isEmpty($msg_err)) {
  91          //send message routine
  92          $msg_receivers = explode(":", $msg_to);
  93          foreach($msg_receivers as $value) {
  94              $sql =    "INSERT INTO ".DB_PREPEND."phpwcms_message (".
  95                      "msg_pid, msg_uid, msg_subject, msg_text, msg_to, msg_from) VALUES (".
  96                      $msg_pid.",".
  97                      intval($value).",'".
  98                      aporeplace($msg_subject)."','".
  99                      aporeplace($msg_message)."','".
 100                      aporeplace($msg_to)."',".
 101                      $_SESSION["wcs_user_id"].
 102                      ");";
 103              mysql_query($sql, $db) or die("Error while sending message");
 104          }
 105          $msg_send_ok = 1;
 106      }
 107  }
 108  
 109  if($msg_send_ok) {
 110      echo "<span class=\"title\">".$BL['be_msg_sent']."</span><br /><img src='img/leer.gif' width=1 height=6><br />";
 111      echo $BL['be_msg_fwd']." <br /><a href='phpwcms.php?do=messages&p=1'>".$BL['be_msg_create']."</a>.";
 112      $forward_to_message_center = 1;
 113  } else { //Mitteilungszusammenstellung
 114  
 115  ?>
 116  <form name="sendmsg" action="phpwcms.php?do=messages&p=1" method="post">
 117  <table width="538" border="0" cellpadding="0" cellspacing="0" summary="">
 118      <tr><td colspan="3" class="title"><?php echo $BL['be_msg_newmsgtitle'] ?></td></tr>
 119      <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="6"></td></tr>
 120      <tr><td colspan="3"><img src="img/lines/l538_70.gif" alt="" width="538" height="1"></td></tr>
 121      <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="3"></td></tr>
 122  <?php
 123      //Errormeldung wenn Fehler beim Nachrichtenversand
 124      if(!empty($msg_err)) {
 125  ?>
 126      <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
 127      <tr><td colspan="3"><strong style="color:#FF6600"><?php echo $BL['be_msg_err'].":<br />".nl2br(chop($msg_err)) ?></strong></td></tr>
 128      <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="6"></td></tr>
 129      <tr><td colspan="3"><img src="img/lines/l538_70.gif" alt="" width="538" height="1"></td></tr>
 130      <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="3"></td></tr>
 131  <?php
 132    } //Ende Fehler Nachrichtenversand
 133  ?>
 134      <tr>
 135          <td width="253" class="v09"><?php echo $BL['be_msg_sendto'] ?>:</td>
 136          <td width="30"><img src="img/leer.gif" alt="" width="30" height="1"></td>
 137          <td width="255" class="v09"><?php echo $BL['be_msg_available'] ?>:</td>
 138      </tr>
 139      <tr valign="top">
 140          <td class="v09"><select name="msg_send_to" size="10" multiple style="width: 253px" class="f10" onDblClick="opt.transferRight()">
 141  <?php 
 142      $where1 = 'WHERE  usr_aktiv=1 ';
 143      if(!empty($msg_to)) {
 144          $msg_receivers = explode(":", $msg_to);
 145          foreach($msg_receivers as $value) {
 146              if(empty($where)) {
 147                  $where = "usr_id=".intval($value);
 148                  $where1 = "WHERE usr_aktiv=1 AND usr_id<>".intval($value);
 149              } else {
 150                  $where .= " OR usr_id=".intval($value);
 151                  $where1 .= " AND usr_id<>".intval($value);
 152              }
 153          }
 154          $sql = "SELECT usr_id, usr_login, usr_name FROM ".DB_PREPEND."phpwcms_user WHERE ".$where." ORDER BY usr_name ASC;";
 155          if($result = mysql_query($sql, $db)) {
 156              while($row = mysql_fetch_array($result)) {
 157                  echo "\t\t\t<option value=\"".$row['usr_id']."\">".html_specialchars($row['usr_name']." (".$row['usr_login']).")"."</option>\n";
 158              }
 159          }
 160      } 
 161  ?>
 162          </select></td>
 163      <td class="v09"><a href="javascript: opt.transferRight();"><img src="img/icons/trash.gif" alt="" width="15" height="15" border="0"></a><input name="msg_send_receiver" type="hidden" id="msg_send_receiver2"><input name="msg_send_aktion" type="hidden" id="msg_send_aktion" value="1"><input name="msg_send_pid" type="hidden" value="<?php echo intval($msg) ?>"></td>
 164      <td class="v09"><select name="msg_send_list" size="10" multiple id="msg_send_list" style="width: 253px" class="f10" onChange="opt.transferLeft()">
 165  <?php
 166      //Create the list of possible recipients
 167      $sql = "SELECT usr_id, usr_login, usr_name FROM ".DB_PREPEND."phpwcms_user ".$where1." ORDER BY usr_name ASC;";
 168      if($result = mysql_query($sql, $db)) {
 169          while($row = mysql_fetch_assoc($result)) {
 170              echo "\t\t\t<option value=\"".$row['usr_id']."\">".html_specialchars($row['usr_name']." (".$row['usr_login']).")"."</option>\n";
 171          }
 172      }
 173  ?>
 174          </select></td>
 175      </tr>
 176      <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="2"></td></tr>
 177      <tr><td colspan="3" class="v09"><?php echo $BL['be_msg_subject'] ?>:</td></tr>
 178      <tr><td colspan="3"><input name="msg_send_subject" type="text" id="msg_send_subject" style="font-family: Monaco, 'Courier New', Courier, monospace; font-size: 9pt; font-weight: bold; width: 537px" value="<?php echo html_specialchars($msg_subject); ?>" size="40" maxlength="125"></td></tr>
 179      <tr><td colspan="3" class="v09"><?php echo $BL['be_msg_msg'] ?>:</td></tr>
 180      <tr><td colspan="3"><textarea name="msg_send_msg" cols="40" rows="15" id="msg_send_msg" style="font-family: Monaco, 'Courier New', Courier, monospace; font-size: 9pt; width: 537px"><?php echo html_specialchars($msg_message); ?></textarea></td></tr>
 181      <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="6"></td></tr>
 182      <tr><td colspan="3"><input name="submit" type="image" id="submit" src="img/button/send_message.gif" alt="<?php echo $BL['be_msg_all'] ?>" width="87" height="17" border="0"></td></tr>
 183      <tr><td colspan="3">&nbsp;</td></tr>
 184  </table>
 185  </form>
 186  <?php
 187  } //Ende Mitteilungszusammenstellung
 188  ?>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7