From 86ab58acac0a316189756f696c57cea2c468dcf9 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 2 Mar 2011 16:50:28 +0000 Subject: [PATCH] Fixes to maek signature page work --- api.php | 10 +++++++++ config/pagetexts.php | 4 ++-- register_participants_signature.php | 34 +++++++++++++++++++---------- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/api.php b/api.php index 81dca1b..55fadc3 100644 --- a/api.php +++ b/api.php @@ -1194,6 +1194,16 @@ switch($request[0]) { $c=ob_get_contents(); ob_end_clean(); $b64=base64_encode($c); + + $fptmp=fopen("tmp.pdf","w"); + fwrite($fptmp,$c); + fclose($fptmp); +/* + $fptmp=fopen("tmp.b64","w"); + fwrite($fptmp,$b64); + fclose($fptmp); + */ + $ret['status']="ok"; $ret['pdf']=$b64; break; diff --git a/config/pagetexts.php b/config/pagetexts.php index d8327c1..35313e6 100644 --- a/config/pagetexts.php +++ b/config/pagetexts.php @@ -38,8 +38,7 @@ ); $q=mysql_query("SELECT * FROM pagetext WHERE conferences_id='-1' ORDER BY textname"); - while($r=mysql_fetch_object($q)) - { + while($r=mysql_fetch_object($q)) { foreach($config['languages'] AS $lang=>$langname) { mysql_query("INSERT INTO pagetext (textname,textdescription,text,conferences_id,lang) VALUES ( '".mysql_escape_string($r->textname)."', @@ -47,6 +46,7 @@ '".mysql_escape_string($r->text)."', '".$conference['id']."', '".mysql_escape_string($lang)."')"); + echo mysql_error(); } } diff --git a/register_participants_signature.php b/register_participants_signature.php index db6186c..f1883b3 100644 --- a/register_participants_signature.php +++ b/register_participants_signature.php @@ -34,21 +34,29 @@ //they must be a participant user_auth_required('participant'); $u=user_load($_SESSION['users_id']); + /* + echo "User: "; + print_r($u); + */ - $q=mysql_query("SELECT registrations.id AS regid, + $qstr="SELECT registrations.id AS regid, registrations.num AS regnum FROM registrations WHERE - registrations.id='{$u['registration_id']}' - AND registrations.conferences_id={$conference['id']}"); - + registrations.id='{$u['registrations_id']}' + AND registrations.conferences_id={$conference['id']}"; +// echo "query=[$qstr]"; + $q=mysql_query($qstr); + /* echo mysql_error(); - + echo "Checkign Auth\n"; + */ if(mysql_num_rows($q)==0) { header("Location: register_participants.php"); + echo "Authentication Failed!"; exit; - } +// echo "Auth OK\n"; $authinfo=mysql_fetch_object($q); $registration_number=$authinfo->regnum; $registration_id=$authinfo->regid; @@ -89,16 +97,21 @@ $pdf->AddPage(); "); $projectinfo=mysql_fetch_object($q); - $q=mysql_query("SELECT firstname, lastname, grade, schools_id + $qstr="SELECT firstname, lastname, grade, schools_id FROM users - JOIN user_roles ON users.id=user_roles.id + JOIN user_roles ON users.id=user_roles.users_id JOIN roles ON user_roles.roles_id=roles.id WHERE registrations_id='".$registration_id."' AND conferences_id='".$conference['id']."' - AND roles.type='participant'"); + AND roles.type='participant'"; +// echo "qstr=[$qstr]"; + $q=mysql_query($qstr); + echo mysql_error(); - while($si=mysql_fetch_object($q)) + $studentinfoarray=array(); + while($si=mysql_fetch_object($q)) { $studentinfoarray[]=$si; + } } $plural = (count($studentinfoarray)>1) ? 's' : ''; @@ -211,7 +224,6 @@ function sig($pdf, $text) $pdf->WriteHTML("

".i18n('Additional Information')."

$t"); $pdf->WriteHTML("

"); } - if(isset($PDFDEST)) echo $pdf->output('',$PDFDEST); else