From 959843d4c488dec4bcfbe928576ee4952d60c84f Mon Sep 17 00:00:00 2001 From: james Date: Thu, 2 Sep 2010 18:53:48 +0000 Subject: [PATCH] Add a simple API test page for checking some api calls Update /api/dates to use current conference id if one isnt specificed --- api.php | 23 ++++++++++++----------- testapi.php | 27 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 testapi.php diff --git a/api.php b/api.php index 9c8dc28..28e4631 100644 --- a/api.php +++ b/api.php @@ -69,19 +69,20 @@ switch($request[0]) { case "dates": if($request[1]) { - $ret['status']="ok"; - $ret['dates']=array(); - $q=mysql_query("SELECT date,name,description FROM dates WHERE conferences_id='{$request[1]}' ORDER BY date"); - $dates=array(); - while($r=mysql_fetch_assoc($q)) { - $dates[]=$r; - } - $ret['dates']=$dates; + $cid=intval($request[1]); } - else { - $ret['status']="error"; - $ret['error']="Conference ID is required"; + else + $cid=$_SESSION['conferences_id']; + + $ret['status']="ok"; + $ret['dates']=array(); + $q=mysql_query("SELECT date,name,description FROM dates WHERE conferences_id='$cid' ORDER BY date"); + $dates=array(); + while($r=mysql_fetch_assoc($q)) { + $dates[]=$r; } + $ret['conferences_id']=$cid; + $ret['dates']=$dates; break; case "auth": diff --git a/testapi.php b/testapi.php new file mode 100644 index 0000000..3632237 --- /dev/null +++ b/testapi.php @@ -0,0 +1,27 @@ + + +Login Check +
+ + + +
+ +Logout Check +
+ +
+ +Conference List
+Switch Conference Check +
+ + +
+ +Dates List (current conference)
+ + + + +