Changeset - 9897baead6b3
[Not reviewed]
default
0 3 0
Nathan Brink (binki) - 14 years ago 2011-04-05 23:34:59
ohnobinki@ohnopublishing.net
Record the referrer URL and the list of saved_schedules temporarily associated with a user upon feedback submission. Fix some session handling with securimage (captchas).
3 files changed with 51 insertions and 6 deletions:
0 comments (0 inline, 0 general)
captcha_img.php
Show inline comments
 
@@ -23,6 +23,9 @@ require_once('inc/class.page.php');
 
if (!$use_captcha)
 
  page::show_404('Captchas are disabled.');
 

	
 
require('securimage/securimage.php');
 
/* Make sure that securimage works without our own sessions */
 
page::session_start();
 

	
 
require_once 'securimage/securimage.php';
 
$securimage = new Securimage();
 
echo $securimage->show();
feedback-submit.php
Show inline comments
 
@@ -18,11 +18,14 @@
 
 * along with SlatePermutate.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
  include_once 'inc/class.page.php';
 
include_once 'inc/class.page.php';
 

	
 
/* Make sure we start our own named session and to not let securimage create its own :-p */
 
page::session_start();
 

	
 
if ($use_captcha)
 
  {
 
    require_once('securimage/securimage.php');
 
    require_once 'securimage/securimage.php';
 
    $securimage = new Securimage();
 
  }
 

	
 
@@ -34,7 +37,6 @@ if ($use_captcha)
 
<h3>Thanks!</h3>
 

	
 
<?php
 
Page::session_start();
 

	
 
$ip = $_POST['ip'];
 
$httpagent = $_POST['httpagent'];
 
@@ -45,6 +47,13 @@ Page::session_start();
 
$school_id = isset($_SESSION['school']) ? $_SESSION['school'] : '';
 
$feedback = $_POST['feedback'];
 
$rating = $_POST['rating'];
 
$referrer = $_POST['referrer'];
 

	
 
$saved_schedules = array();
 
if (!empty($_SESSION['saved']))
 
  foreach ($_SESSION['saved'] as $key => $val)
 
    $saved_schedules[] = $key;
 
$saved_schedules = implode(', ', $saved_schedules);
 

	
 
$reject = FALSE;
 

	
 
@@ -84,6 +93,8 @@ Feedback: $feedback
 
IP = $ip 
 
Browser = $httpagent 
 
Deployment = $fromdom
 
Referrer = $referrer
 
saved_schedules = $saved_schedules
 
";
 

	
 
    $from = "From: $visitormail\r\n";
feedback.php
Show inline comments
 
@@ -18,7 +18,8 @@
 
 * along with SlatePermutate.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
include_once 'inc/class.page.php'; 
 
include_once 'inc/class.page.php';
 
require_once 'inc/class.schedule.php';
 

	
 
$feedbackpage = page::page_create('Feedback');
 
$feedbackpage->head();
 
@@ -26,6 +27,18 @@ include_once 'inc/class.page.php';
 
$fromdom = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
 
$httpagenti = $_SERVER['HTTP_USER_AGENT'];
 

	
 
$referrer = '';
 
if (!empty($_SERVER['HTTP_REFERER']))
 
  $referrer = $_SERVER['HTTP_REFERER'];
 
if (!empty($_POST['referrer']))
 
  $referrer = $_POST['referrer'];
 

	
 
$saved_schedules = array();
 
if (!empty($_SESSION['saved']))
 
  foreach ($_SESSION['saved'] as $key => $val)
 
    $saved_schedules[] = '<a href="' . htmlentities(Schedule::url($key)) . '">' . htmlentities($key) . '</a>';
 
$saved_schedules = implode(', ', $saved_schedules);
 

	
 
/* some prefill support */
 
$school = $feedbackpage->get_school();
 
$feedback_text = '';
 
@@ -43,8 +56,9 @@ if (isset($_GET['feedback']))
 

	
 
<table>
 
<tr><td><label for="nameis">Name: </label></td><td><input type="text" name="nameis" size="20" /></td></tr>
 
<tr><td><label for="visitormail">Email:</label></td><td><input type="text" name="visitormail" size="20" /> <span class="graytext">(if you want us to get back to you)</span></td></tr>
 
<tr><td><label for="visitormail">Email:</label></td><td><input type="text" name="visitormail" size="20" /></td></tr>
 
<tr><td><label for="school">School: </label></td><td><input type="text" name="school" value="<?php echo htmlentities($school['id']); ?>" size="20" /> <span class="graytext">(if relevant to your feedback)</span></td></tr>
 
  <tr><td><label for="referrer">Relevant Page:</label></td><td><input type="text" name="referrer" value="<?php echo htmlentities($referrer); ?>" size="20" /> <span class="graytext">(if relevant to your feedback)</span></td></tr>
 
</table>
 
<br/> Overall Rating:<br/> <input checked="checked" name="rating" type="radio" value="Great" />Great <input name="rating" type="radio" value="Usable" />Usable  <input name="rating" type="radio" value="Buggy/Hard to Use" />Buggy/Hard to Use <input name="rating" type="radio" value="Don't know" />Don't Know <!-- ' -->
 

	
 
@@ -68,6 +82,23 @@ if (isset($_GET['feedback']))
 
?>
 

	
 
<input class="gray" type="submit" value="Send Feedback" />
 

	
 
<?php if (!empty($saved_schedules)): ?>
 
<p class="graytext" style="margin-top: 20pt;">
 
  The following information will also be submitted when you send feedback:
 
</p>
 
<table class="graytext">
 
  <tr>
 
    <th>Type</th>
 
    <th>Value</th>
 
  </tr>
 
  <tr>
 
  <td>Saved Schedules:</td>
 
    <td><?php echo $saved_schedules; ?></td>
 
  </tr>
 
</table>
 
<?php endif; ?>
 

	
 
</form>
 

	
 
<?php
0 comments (0 inline, 0 general)