Files
        @ 5f91fda96f45
    
        
              Branch filter: 
        
    Location: SlatePermutate/feedback-submit.php - annotation
        
            
            5f91fda96f45
            3.0 KiB
            text/x-php
        
        
    
    Switch from using a nowdoc to using a heredoc to support ancient PHP (5.1.6).
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105  | eab20c15a6b2 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 eab20c15a6b2 7a6777d84d07 79e1cca91899 7b489f5ccba0 7b489f5ccba0 7b489f5ccba0 7b489f5ccba0 7b489f5ccba0 7b489f5ccba0 ae8cada84fa2 ae8cada84fa2 7b489f5ccba0 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 e2768399ec54 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 e2768399ec54 e2768399ec54 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 f5b8a6f32c9a f5b8a6f32c9a eab20c15a6b2 79e1cca91899 f5b8a6f32c9a eab20c15a6b2 f5b8a6f32c9a eab20c15a6b2 f5b8a6f32c9a eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 f5b8a6f32c9a eab20c15a6b2 eab20c15a6b2 7b489f5ccba0 7b489f5ccba0 7b489f5ccba0 7b489f5ccba0 7b489f5ccba0 7b489f5ccba0 7b489f5ccba0 7b489f5ccba0 a7e66144bf54 79e1cca91899 f5b8a6f32c9a f5b8a6f32c9a f5b8a6f32c9a eab20c15a6b2 f5b8a6f32c9a e2768399ec54 e2768399ec54 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 eab20c15a6b2 f5b8a6f32c9a eab20c15a6b2 f5b8a6f32c9a f5b8a6f32c9a f5b8a6f32c9a f5b8a6f32c9a f5b8a6f32c9a eab20c15a6b2 8f5f454f9dd4 8f5f454f9dd4 8f5f454f9dd4 8f5f454f9dd4 8f5f454f9dd4 7b489f5ccba0 7a6777d84d07 79e1cca91899 7a6777d84d07  | <?php
/*
 * Copyright 2010 Nathan Gelderloos, Ethan Zonca, Nathan Phillip Brink
 *
 * This file is part of SlatePermutate.
 *
 * SlatePermutate is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * SlatePermutate is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with SlatePermutate.  If not, see <http://www.gnu.org/licenses/>.
 */
  include_once 'inc/class.page.php';
if ($use_captcha)
  {
    require_once('securimage/securimage.php');
    $securimage = new Securimage();
  }
$feedbackpage = page::page_create('Feedback');
$feedbackpage->head();
$subject = '[SlatePermutate] - Feedback';
?>
<h3>Thanks!</h3>
<?php
Page::session_start();
$ip = $_POST['ip'];
$httpagent = $_POST['httpagent'];
$fromdom = $_POST['fromdom'];
$nameis = $_POST['nameis'];
$visitormail = $_POST['visitormail'];
$school = $_POST['school'];
$school_id = isset($_SESSION['school']) ? $_SESSION['school'] : '';
$feedback = $_POST['feedback'];
$rating = $_POST['rating'];
$reject = FALSE;
if (eregi('http:', $feedback)) { 
  echo '<p>Please do not include URLs in your submission! Please click "back" and try again.</p>';
  $reject = TRUE;
}
if (empty($visitormail) || !preg_match('/^[^@]+@[^@]+\.[^@]+$/', $visitormail)) {
  echo '<p>Please click "back" and enter valid e-mail address.</p>';
  $reject = TRUE;
}
if(empty($nameis) || empty($feedback) || empty($visitormail)) {
  echo '<p>Please click "back" and fill in all fields.</p>';
  $reject = TRUE;
}
/** Check the captcha */
if ($use_captcha)
  {
    if (!$securimage->check($_REQUEST['captcha_code']))
      {
	echo '<p>Your captcha response was incorrect, please try again.</p>';
	$reject = TRUE;
      }
  }
if (!$reject)
  {
    $feedback = stripcslashes($feedback);
    $message = date('l, F j, Y, g:i a') ."
From: $nameis ($visitormail)
School: $school ($school_id)\n
Rating: $rating 
Feedback: $feedback 
\n
IP = $ip 
Browser = $httpagent 
Deployment = $fromdom
";
    $from = "From: $visitormail\r\n";
    /* $feedback_emails has its default set in inc/class.page.inc, can be set in config.inc */
    foreach($feedback_emails as $toaddr)
      {
	mail($toaddr, $subject, $message, $from);
      }
    if($feedback_disk_log) {
      $file = fopen($feedback_disk_log_file,'a') or die("Can't open file.");
      fwrite($file, $message . "----------------------------------------\n");
      fclose($file);
    }
    echo '<p>Thanks for helping make SlatePermutate better. Your feedback is greatly appreciated.</p>';
    echo '<p>We will attempt to respond via email if your feedback lends itself to a response.</p>';
  }
    $feedbackpage->foot();
 |