Rev 148 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 148 | Rev 150 | ||
---|---|---|---|
Line 36... | Line 36... | ||
36 | 36 | ||
37 | if (!OIDplus::authUtils()::isRaLoggedIn($email) && !OIDplus::authUtils()::isAdminLoggedIn()) { |
37 | if (!OIDplus::authUtils()::isRaLoggedIn($email) && !OIDplus::authUtils()::isAdminLoggedIn()) { |
38 | die(json_encode(array("error" => 'Authentification error. Please log in as the RA to update its data.'))); |
38 | die(json_encode(array("error" => 'Authentification error. Please log in as the RA to update its data.'))); |
39 | } |
39 | } |
40 | 40 | ||
41 | $res = OIDplus::db()->query("select * from ".OIDPLUS_TABLENAME_PREFIX."ra where email = '".OIDplus::db()->real_escape_string($email)."'"); |
41 | $res = OIDplus::db()->query("select * from ".OIDPLUS_TABLENAME_PREFIX."ra where email = ?", array($email)); |
42 | if (OIDplus::db()->num_rows($res) == 0) { |
42 | if (OIDplus::db()->num_rows($res) == 0) { |
43 | die(json_encode(array("error" => 'RA does not exist'))); |
43 | die(json_encode(array("error" => 'RA does not exist'))); |
44 | } |
44 | } |
45 | 45 | ||
46 | OIDplus::logger()->log("RA($email)?/A?", "Changed RA '$email' contact data/details"); |
46 | OIDplus::logger()->log("RA($email)?/A?", "Changed RA '$email' contact data/details"); |
47 | 47 | ||
48 | if (!OIDplus::db()->query("UPDATE ".OIDPLUS_TABLENAME_PREFIX."ra ". |
48 | if (!OIDplus::db()->query("UPDATE ".OIDPLUS_TABLENAME_PREFIX."ra ". |
49 | "SET ". |
49 | "SET ". |
50 | "updated = now(), ". |
50 | "updated = now(), ". |
- | 51 | "ra_name = ?, ". |
|
- | 52 | "organization = ?, ". |
|
- | 53 | "office = ?, ". |
|
- | 54 | "personal_name = ?, ". |
|
- | 55 | "privacy = ?, ". |
|
- | 56 | "street = ?, ". |
|
- | 57 | "zip_town = ?, ". |
|
- | 58 | "country = ?, ". |
|
- | 59 | "phone = ?, ". |
|
- | 60 | "mobile = ?, ". |
|
- | 61 | "fax = ? ". |
|
- | 62 | "WHERE email = ?", |
|
- | 63 | array( |
|
51 | "ra_name = '".OIDplus::db()->real_escape_string($_POST['ra_name'])."', ". |
64 | $_POST['ra_name'], |
52 | "organization = '".OIDplus::db()->real_escape_string($_POST['organization'])."', ". |
65 | $_POST['organization'], |
53 | "office = '".OIDplus::db()->real_escape_string($_POST['office'])."', ". |
66 | $_POST['office'], |
54 | "personal_name = '".OIDplus::db()->real_escape_string($_POST['personal_name'])."', ". |
67 | $_POST['personal_name'], |
55 | "privacy = ".OIDplus::db()->escape_bool($_POST['privacy']).", ". |
68 | $_POST['privacy'], |
56 | "street = '".OIDplus::db()->real_escape_string($_POST['street'])."', ". |
69 | $_POST['street'], |
57 | "zip_town = '".OIDplus::db()->real_escape_string($_POST['zip_town'])."', ". |
70 | $_POST['zip_town'], |
58 | "country = '".OIDplus::db()->real_escape_string($_POST['country'])."', ". |
71 | $_POST['country'], |
59 | "phone = '".OIDplus::db()->real_escape_string($_POST['phone'])."', ". |
72 | $_POST['phone'], |
60 | "mobile = '".OIDplus::db()->real_escape_string($_POST['mobile'])."', ". |
73 | $_POST['mobile'], |
61 | "fax = '".OIDplus::db()->real_escape_string($_POST['fax'])."' ". |
74 | $_POST['fax'], |
62 | "WHERE email = '".OIDplus::db()->real_escape_string($email)."'")) |
75 | $email |
- | 76 | ) |
|
- | 77 | )) |
|
63 | { |
78 | { |
64 | die(json_encode(array("error" => OIDplus::db()->error()))); |
79 | die(json_encode(array("error" => OIDplus::db()->error()))); |
65 | } |
80 | } |
66 | 81 | ||
67 | echo json_encode(array("status" => 0)); |
82 | echo json_encode(array("status" => 0)); |
Line 88... | Line 103... | ||
88 | $out['icon'] = 'img/error_big.png'; |
103 | $out['icon'] = 'img/error_big.png'; |
89 | $out['text'] .= '<p>You need to <a '.oidplus_link('oidplus:login').'>log in</a> as the requested RA <b>'.htmlentities($ra_email).'</b>.</p>'; |
104 | $out['text'] .= '<p>You need to <a '.oidplus_link('oidplus:login').'>log in</a> as the requested RA <b>'.htmlentities($ra_email).'</b>.</p>'; |
90 | } else { |
105 | } else { |
91 | $out['text'] .= '<p>Your email address: <b>'.htmlentities($ra_email).'</b>'; |
106 | $out['text'] .= '<p>Your email address: <b>'.htmlentities($ra_email).'</b>'; |
92 | 107 | ||
93 | $res = OIDplus::db()->query("select * from ".OIDPLUS_TABLENAME_PREFIX."ra where email = '".OIDplus::db()->real_escape_string($ra_email)."'"); |
108 | $res = OIDplus::db()->query("select * from ".OIDPLUS_TABLENAME_PREFIX."ra where email = ?", array($ra_email)); |
94 | if (OIDplus::db()->num_rows($res) == 0) { |
109 | if (OIDplus::db()->num_rows($res) == 0) { |
95 | $out['icon'] = 'img/error_big.png'; |
110 | $out['icon'] = 'img/error_big.png'; |
96 | $out['text'] = 'RA <b>'.htmlentities($ra_email).'</b> does not exist'; |
111 | $out['text'] = 'RA <b>'.htmlentities($ra_email).'</b> does not exist'; |
97 | return $out; |
112 | return $out; |
98 | } |
113 | } |