[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/ -> email.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/email.php,v $
  14  |     $Revision: 1.21 $
  15  |     $Date: 2007/01/07 15:24:48 $
  16  |     $Author: e107steved $
  17  +----------------------------------------------------------------------------+
  18  */
  19  require_once ("class2.php");
  20  require_once(HEADERF);
  21  
  22  $use_imagecode = FALSE;
  23  $imgtypes = array("jpeg", "png", "gif");
  24  foreach($imgtypes as $t)
  25  {
  26      if(function_exists("imagecreatefrom".$t))
  27      {
  28          $use_imagecode = TRUE;
  29      }
  30  }
  31  
  32  if ($use_imagecode)
  33  {
  34      require_once(e_HANDLER."secure_img_handler.php");
  35      $sec_img = new secure_image;
  36  }
  37  
  38  $qs = explode(".", e_QUERY, 2);
  39  if ($qs[0] == "")
  40  {
  41      header("location:".e_BASE."index.php");
  42      exit;
  43  }
  44  $source = $qs[0];
  45  $parms = $qs[1];
  46  
  47  $emailurl = ($source == "referer") ? $_SERVER['HTTP_REFERER'] : SITEURL;
  48  
  49  $comments = $tp->post_toHTML($_POST['comment'], TRUE, 'retain_nl, emotes_off, no_make_clickable');
  50  $author = $tp->post_toHTML($_POST['author_name'],FALSE,"emotes_off, no_make_clickable");
  51  $email_send = check_email($_POST['email_send']);
  52  
  53  
  54  if (isset($_POST['emailsubmit']))
  55  {
  56      if (!$email_send)
  57      {
  58          $error .= LAN_EMAIL_106;
  59      }
  60  
  61      if($use_imagecode)
  62      {
  63          if(!isset($_POST['code_verify']) || !isset($_POST['rand_num']))
  64          {
  65              header("location:".e_BASE."index.php");
  66              exit;
  67          }
  68          if (!$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify']))
  69          {
  70              header("location:".e_BASE."index.php");
  71              exit;
  72          }
  73      }
  74  
  75      if ($comments == "")
  76      {
  77          $message = LAN_EMAIL_188." ".SITENAME." (".SITEURL.")";
  78          if (USER == TRUE)
  79          {
  80              $message .= "\n\n".LAN_EMAIL_1." ".USERNAME;
  81          }
  82          else
  83          {
  84              $message .= "\n\n".LAN_EMAIL_1." ".$author;
  85          }
  86      }
  87      else
  88      {
  89          $message .= $comments;
  90      }
  91      $ip = $e107->getip();
  92      $message .= "\n\n".LAN_EMAIL_2." ".$ip."\n\n";
  93  
  94      if(strpos($source,'plugin:') !== FALSE)
  95      {
  96          $plugin = substr($source,7);
  97          $text = "";
  98          if(file_exists(e_PLUGIN.$plugin."/e_emailprint.php"))
  99          {
 100              include_once(e_PLUGIN.$plugin."/e_emailprint.php");
 101              $text = email_item($parms);
 102              $emailurl = SITEURL;
 103          }
 104          if($text == "")
 105          {
 106              header("location:".e_BASE."index.php");
 107              exit;
 108          }
 109          $message .= $text;
 110      }
 111      elseif($source == "referer")
 112      {
 113          if(!isset($_POST['referer']) || $_POST['referer'] == '')
 114          {
 115              header("location:".e_BASE."index.php");
 116              exit;
 117          }
 118          $message .= $_POST['referer'];
 119          $emailurl = $_POST['referer'];
 120      }
 121      else
 122      {
 123  
 124          $emailurl = $_POST['referer'];
 125          $message = "";
 126          if($sql->db_Select("news", "*", "news_id='".intval($parms)."'"))
 127          {
 128              list($news_id, $news_title, $news_body, $news_extended, $news_datestamp, $news_author, $news_source, $news_url, $news_category, $news_allow_comments) = $sql->db_Fetch();
 129              $message = "<h3 class='email_heading'>".$news_title."</h3><br />".$news_body."<br />".$news_extended."<br /><br /><a href='{e_BASE}news.php?extend.".$parms."'>{e_BASE}news.php?extend.".$parms."</a><br />";
 130              $message = $tp->toEmail($message);
 131  
 132          }
 133  
 134          if($message == "")
 135          {
 136              header("location:".e_BASE."index.php");
 137              exit;
 138          }
 139      }
 140  
 141      if ($error == "")
 142      {
 143  
 144          // Load Mail Handler and Email Template.
 145          require_once(e_HANDLER."mail.php");
 146          $email_body = $EMAIL_HEADER;
 147          $email_body .= (trim($comments) != "") ? $tp->toEmail($comments)."<hr />" : "";
 148          $email_body .= $tp->toEmail($message).$EMAIL_FOOTER;
 149  
 150          if (sendemail($email_send, LAN_EMAIL_3.SITENAME,$email_body))
 151          {
 152              $text = "<div style='text-align:center'>".LAN_EMAIL_10." ".$email_send."</div>";
 153          }
 154          else
 155          {
 156              $text = "<div style='text-align:center'>".LAN_EMAIL_9."</div>";
 157          }
 158          $ns->tablerender(LAN_EMAIL_11, $text);
 159      }
 160      else
 161      {
 162          $ns->tablerender(LAN_EMAIL_12, "<div style='text-align:center'>".$error."</div>");
 163      }
 164  }
 165  
 166  
 167  // --------------------- Form -------------------------------------------------
 168  
 169  
 170  
 171  $text = "<form method='post' action='".e_SELF."?".e_QUERY."'>\n
 172      <table>";
 173  
 174  if (USER != TRUE)
 175  {
 176      $text .= "<tr>
 177          <td style='width:25%'>".LAN_EMAIL_15."</td>
 178          <td style='width:75%'>
 179          <input class='tbox' type='text' name='author_name' size='60' style='width:95%' value='$author' maxlength='100' />
 180          </td>
 181          </tr>";
 182  }
 183  
 184  $text .= "
 185  <tr>
 186      <td style='width:25%'>".LAN_EMAIL_8."</td>
 187      <td style='width:75%'>
 188      <textarea class='tbox' name='comment' cols='70' rows='4' style='width:95%'>".LAN_EMAIL_6." ".SITENAME." (".$emailurl.")
 189  ";
 190  
 191  if (USER == TRUE)
 192  {
 193      $text .= "\n\n".LAN_EMAIL_1." ".USERNAME;
 194  }
 195  
 196  $text .= "</textarea>
 197      </td>
 198      </tr>
 199  
 200      <tr>
 201      <td style='width:25%'>".LAN_EMAIL_187."</td>
 202      <td style='width:75%'>
 203      <input class='tbox' type='text' name='email_send' size='60' value='$email_send' style='width:95%' maxlength='100' />
 204      </td>
 205      </tr>
 206      ";
 207  
 208      if($use_imagecode)
 209      {
 210          $text .= "<tr><td>".LAN_EMAIL_190."</td><td>";
 211          $text .= $sec_img->r_image();
 212          $text .= " <input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />
 213              <input type='hidden' name='rand_num' value='".$sec_img->random_number."' /></td></tr>";
 214      }
 215  
 216  $text .= "
 217      <tr style='vertical-align:top'>
 218      <td style='width:25%'></td>
 219      <td style='width:75%'>
 220      <input class='button' type='submit' name='emailsubmit' value='".LAN_EMAIL_4."' />
 221      <input type='hidden' name='referer' value='".$_SERVER['HTTP_REFERER']."' />
 222  </td>
 223      </tr>
 224      </table>
 225      </form>";
 226  
 227  $ns->tablerender(LAN_EMAIL_5, $text);
 228  
 229  require_once(FOOTERF);
 230  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7