From b9d8a9c8c5e034aff0de8f5baf5f6e99da9fcba9 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 3 Mar 2011 22:17:05 +0000 Subject: [PATCH] catch a few more role/add errors, and show more debug if it (by chance) hits the defualt case --- account.inc.php | 4 ++-- api.php | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/account.inc.php b/account.inc.php index 94c831d..7984207 100644 --- a/account.inc.php +++ b/account.inc.php @@ -215,7 +215,7 @@ function account_add_role($accounts_id, $roles_id, $conferences_id, $password = return "invalidaccount"; } if(mysql_result(mysql_query("SELECT COUNT(*) FROM roles WHERE id = $roles_id"), 0) != 1){ - return "invalidrole($roles_id)"; + return "invalidrole"; } if(mysql_result(mysql_query("SELECT COUNT(*) FROM conferences WHERE id = $conferences_id"), 0) != 1){ return "invalidconference"; @@ -303,7 +303,7 @@ function account_add_role($accounts_id, $roles_id, $conferences_id, $password = $error = ''; } else { - $error = 'invalidrole(invite only)'; + $error = 'invalidrole(invite_only)'; } break; } diff --git a/api.php b/api.php index e67a911..2a00b30 100644 --- a/api.php +++ b/api.php @@ -792,10 +792,12 @@ switch($request[0]) { updateSessionRoles(); break; case "invalidrole": $ret['status']="error"; $ret['error']="Invalid role"; break; + case "invalidrole(invite only)": $ret['status']="error"; $ret['error']="Invalid role - registation by invite only"; break; + case "invalidrole(account_add_role_allowed)": $ret['status']="error"; $ret['error']="Invalid role - account_add_role_allowed said no"; break; case "invalidaccount": $ret['status']="error"; $ret['error']="Invalid account"; break; case "invalidconference": $ret['status']="error"; $ret['error']="Invalid conference"; break; case "invalidpassword": $ret['status']="error"; $ret['error']="Invalid password for role"; break; - default: $ret['status']="error"; $ret['error']="unknown role add error"; + default: $ret['status']="error"; $ret['error']="unknown role add error. addstatus=[$addstatus]"; } break;