00001 <?php
00002
00005
00006 require_once 'Smarty.class.php';
00007 require_once 'sql.php';
00008 require_once 'error.php';
00009 require_once 'redirect.php';
00010 require_once 'util.php';
00011
00012 ## parameters accepted by this php script
00013
00025
00026 function view_email($smarty, $INPUT, $db) {
00027
00028 global $_SESSION, $validation_info;
00029
00030 $defaults = array (
00031 );
00032
00033 ## check user input
00034
00035 # $INPUT = array_merge($defaults, $_GET, $_POST);
00036
00037 $INPUT = array_merge($defaults, $INPUT);
00038 $errors = check_input($INPUT, $validation_info);
00039
00040 if ($debug_level > 10) {
00041 print "<hr><pre>Input: ";
00042 print_r($INPUT);
00043 print "</pre><hr>";
00044 }
00045
00046 if (!empty($errors)) {
00047 user_error("Missing or malformed input parameter(s): " . join($errors, ", "),
00048 E_USER_ERROR);
00049 }
00050
00051
00052 $sql_param = array (
00053 "table" => "email",
00054 "tables" => "email,user,degree",
00055 "cond" => "degree.id = user.degree_id AND user.id = email.user_id AND email.document_id = " . $INPUT['document_id'],
00056 "columns" => "email.*,user.surname,user.forename,user.sex,degree.description AS degree_description",
00057 "order" => "email.created DESC",
00058 );
00059
00060
00061 $tpl_vars = $INPUT;
00062 $tpl_vars['email'] = sql_query('select', $sql_param, $db);
00063
00064 do_template($smarty, 'email.tpl', $tpl_vars);
00065 exit(0);
00066
00067 }
00068 ?>