@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | public static function call(OkapiRequest $request) |
24 | 24 | { |
25 | 25 | $internal_id = $request->get_parameter('internal_id'); |
26 | - if (!$internal_id) throw new ParamMissing('internal_id'); |
|
26 | + if (!$internal_id) { |
|
27 | + throw new ParamMissing('internal_id'); |
|
28 | + } |
|
27 | 29 | $fields = $request->get_parameter('fields'); |
28 | 30 | |
29 | 31 | # There's no need to validate the fields parameter. |
@@ -32,8 +34,9 @@ discard block |
||
32 | 34 | $request->consumer, $request->token, array('internal_ids' => $internal_id, |
33 | 35 | 'fields' => $fields))); |
34 | 36 | $result = $results[$internal_id]; |
35 | - if ($result == null) |
|
36 | - throw new InvalidParam('internal_id', "There is no user by this internal_id."); |
|
37 | + if ($result == null) { |
|
38 | + throw new InvalidParam('internal_id', "There is no user by this internal_id."); |
|
39 | + } |
|
37 | 40 | return Okapi::formatted_response($request, $result); |
38 | 41 | } |
39 | 42 | } |
@@ -21,13 +21,17 @@ |
||
21 | 21 | public static function call(OkapiRequest $request) |
22 | 22 | { |
23 | 23 | $token_key = $request->get_parameter('oauth_token'); |
24 | - if (!$token_key) |
|
25 | - throw new ParamMissing("oauth_token"); |
|
24 | + if (!$token_key) { |
|
25 | + throw new ParamMissing("oauth_token"); |
|
26 | + } |
|
26 | 27 | $langpref = $request->get_parameter('langpref'); |
27 | 28 | $interactivity = $request->get_parameter('interactivity'); |
28 | - if (!$interactivity) $interactivity = 'minimal'; |
|
29 | - if (!in_array($interactivity, array('minimal', 'confirm_user'))) |
|
30 | - throw new InvalidParam('interactivity', $interactivity); |
|
29 | + if (!$interactivity) { |
|
30 | + $interactivity = 'minimal'; |
|
31 | + } |
|
32 | + if (!in_array($interactivity, array('minimal', 'confirm_user'))) { |
|
33 | + throw new InvalidParam('interactivity', $interactivity); |
|
34 | + } |
|
31 | 35 | |
32 | 36 | # Redirect to the "apps" folder. This is done there (not here) |
33 | 37 | # because: 1) we don't want any cookie or session-handling |
@@ -78,8 +78,9 @@ discard block |
||
78 | 78 | ); |
79 | 79 | $request->i_want_OkapiResponse = true; |
80 | 80 | $request->perceive_as_http_request = true; |
81 | - if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) |
|
82 | - $request->etag = $_SERVER['HTTP_IF_NONE_MATCH']; |
|
81 | + if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) { |
|
82 | + $request->etag = $_SERVER['HTTP_IF_NONE_MATCH']; |
|
83 | + } |
|
83 | 84 | $response = OkapiServiceRunner::call($service_name, $request); |
84 | 85 | $response->display(); |
85 | 86 | } |
@@ -118,8 +119,9 @@ discard block |
||
118 | 119 | */ |
119 | 120 | public static function schedule_geocache_check($cache_codes) |
120 | 121 | { |
121 | - if (!is_array($cache_codes)) |
|
122 | - $cache_codes = array($cache_codes); |
|
122 | + if (!is_array($cache_codes)) { |
|
123 | + $cache_codes = array($cache_codes); |
|
124 | + } |
|
123 | 125 | Db::execute(" |
124 | 126 | update caches |
125 | 127 | set okapi_syncbase = now() |
@@ -12,18 +12,22 @@ |
||
12 | 12 | public static function get_user_id() |
13 | 13 | { |
14 | 14 | static $cached_result = false; |
15 | - if ($cached_result !== false) |
|
16 | - return $cached_result; |
|
15 | + if ($cached_result !== false) { |
|
16 | + return $cached_result; |
|
17 | + } |
|
17 | 18 | |
18 | 19 | $cookie_name = Settings::get('OC_COOKIE_NAME'); |
19 | - if (!isset($_COOKIE[$cookie_name])) |
|
20 | - return null; |
|
20 | + if (!isset($_COOKIE[$cookie_name])) { |
|
21 | + return null; |
|
22 | + } |
|
21 | 23 | $OC_data = unserialize(base64_decode($_COOKIE[$cookie_name])); |
22 | - if (!isset($OC_data['sessionid'])) |
|
23 | - return null; |
|
24 | + if (!isset($OC_data['sessionid'])) { |
|
25 | + return null; |
|
26 | + } |
|
24 | 27 | $OC_sessionid = $OC_data['sessionid']; |
25 | - if (!$OC_sessionid) |
|
26 | - return null; |
|
28 | + if (!$OC_sessionid) { |
|
29 | + return null; |
|
30 | + } |
|
27 | 31 | |
28 | 32 | return Db::select_value("select user_id from sys_sessions where uuid='".Db::escape_string($OC_sessionid)."'"); |
29 | 33 | } |
@@ -20,9 +20,10 @@ |
||
20 | 20 | { |
21 | 21 | require_once($GLOBALS['rootpath'].'okapi/service_runner.php'); |
22 | 22 | |
23 | - if (!OkapiServiceRunner::exists($methodname)) |
|
24 | - throw new BadRequest("Method '$methodname' does not exist. ". |
|
23 | + if (!OkapiServiceRunner::exists($methodname)) { |
|
24 | + throw new BadRequest("Method '$methodname' does not exist. ". |
|
25 | 25 | "See OKAPI docs at ".Settings::get('SITE_URL')."okapi/"); |
26 | + } |
|
26 | 27 | $options = OkapiServiceRunner::options($methodname); |
27 | 28 | $request = new OkapiHttpRequest($options); |
28 | 29 | return OkapiServiceRunner::call($methodname, $request); |
@@ -76,10 +76,12 @@ discard block |
||
76 | 76 | if ($error == false) { |
77 | 77 | //cacheid |
78 | 78 | $cache_id = 0; |
79 | - if (isset($_REQUEST['cacheid'])) // Ocprop |
|
79 | + if (isset($_REQUEST['cacheid'])) { |
|
80 | + // Ocprop |
|
80 | 81 | { |
81 | 82 | $cache_id = $_REQUEST['cacheid']; |
82 | 83 | } |
84 | + } |
|
83 | 85 | |
84 | 86 | if ($usr === false) { |
85 | 87 | $tplname = 'login'; |
@@ -197,9 +199,11 @@ discard block |
||
197 | 199 | $way_length = isset($_POST['way_length']) ? $_POST['way_length'] : $cache_record['way_length']; |
198 | 200 | |
199 | 201 | if ($status_old == 5 && $status == 5) { |
200 | - if (isset($_POST['publish'])) // Ocprop |
|
202 | + if (isset($_POST['publish'])) { |
|
203 | + // Ocprop |
|
201 | 204 | { |
202 | 205 | $publish = $_POST['publish']; |
206 | + } |
|
203 | 207 | if (!($publish == 'now' || $publish == 'later' || $publish == 'notnow')) { |
204 | 208 | // somebody messed up the POST-data, so we do not publish the cache, since he isn't published right now (status=5) |
205 | 209 | $publish = 'notnow'; |
@@ -228,12 +232,14 @@ discard block |
||
228 | 232 | $status = $status_old; |
229 | 233 | } |
230 | 234 | |
231 | - if ($status_old == 7) // cache is locked |
|
235 | + if ($status_old == 7) { |
|
236 | + // cache is locked |
|
232 | 237 | { |
233 | 238 | // only admins can change status of locked caches |
234 | 239 | if (($bAdmin & ADMIN_USER) != ADMIN_USER) { |
235 | 240 | // no status change allowed for normal user |
236 | 241 | $status = $status_old; |
242 | + } |
|
237 | 243 | } |
238 | 244 | } |
239 | 245 | |
@@ -439,11 +445,13 @@ discard block |
||
439 | 445 | } |
440 | 446 | |
441 | 447 | //try to save to DB? |
442 | - if (isset($_POST['submit'])) // Ocprop |
|
448 | + if (isset($_POST['submit'])) { |
|
449 | + // Ocprop |
|
443 | 450 | { |
444 | 451 | //all validations ok? |
445 | 452 | if (!($hidden_date_not_ok || $lat_not_ok || $lon_not_ok || $name_not_ok || $time_not_ok || $way_length_not_ok || $size_not_ok || $activate_date_not_ok || $status_not_ok || $diff_not_ok || $attribs_not_ok || $wpgc_not_ok)) { |
446 | 453 | $cache_lat = $coords_lat_h + $coords_lat_min / 60; |
454 | + } |
|
447 | 455 | if ($coords_latNS == 'S') { |
448 | 456 | $cache_lat = - $cache_lat; |
449 | 457 | } |
@@ -931,9 +939,11 @@ discard block |
||
931 | 939 | tpl_set_var('statuschange', $status_old == 5 ? '' : mb_ereg_replace('%1', $cache_id, $status_change)); |
932 | 940 | |
933 | 941 | // show activation form? |
934 | - if ($status_old == 5) // status = not yet published |
|
942 | + if ($status_old == 5) { |
|
943 | + // status = not yet published |
|
935 | 944 | { |
936 | 945 | $tmp = $activation_form; |
946 | + } |
|
937 | 947 | |
938 | 948 | $tmp = mb_ereg_replace( |
939 | 949 | '{activate_day}', |
@@ -17,8 +17,9 @@ |
||
17 | 17 | $userid = isset($_REQUEST['userid']) ? $_REQUEST['userid'] + 0 : 0; |
18 | 18 | $lang = isset($_REQUEST['lang']) ? mb_strtoupper($_REQUEST['lang']) : $opt['template']['locale']; |
19 | 19 | |
20 | -if (!isset($opt['locale'][$lang])) |
|
20 | +if (!isset($opt['locale'][$lang])) { |
|
21 | 21 | $lang = $opt['template']['locale']; |
22 | +} |
|
22 | 23 | |
23 | 24 | $filename = GetFilename($userid, $lang); |
24 | 25 |
@@ -112,7 +112,8 @@ discard block |
||
112 | 112 | $emailadr |
113 | 113 | ); |
114 | 114 | } else { |
115 | - if ($bounced) // maximum one bounce per day is counted, to filter out temporary problems |
|
115 | + if ($bounced) { |
|
116 | + // maximum one bounce per day is counted, to filter out temporary problems |
|
116 | 117 | { |
117 | 118 | sql( |
118 | 119 | "UPDATE `user` SET `email_problems`=`email_problems`+1, `last_email_problem`='&2' |
@@ -121,6 +122,7 @@ discard block |
||
121 | 122 | $logentry['created'] |
122 | 123 | ); |
123 | 124 | } |
125 | + } |
|
124 | 126 | } |
125 | 127 | } else { |
126 | 128 | echo $this->name . ": no email address found for record ID " . $logentry['id'] . "\n"; |
@@ -88,8 +88,9 @@ |
||
88 | 88 | $tpl->assign('coordW3W2', $coord->getW3W($w3w_langs[1])); |
89 | 89 | $lang2_name = sql_value("SELECT `name` FROM `languages` WHERE `short`='&1'", '', $w3w_langs[1]); |
90 | 90 | $tpl->assign('W3Wlang2', $translate->t($lang2_name, '', '', 0)); |
91 | -} else |
|
91 | +} else { |
|
92 | 92 | $tpl->assign('coordW3W2', false); |
93 | +} |
|
93 | 94 | |
94 | 95 | // wp gesetzt? |
95 | 96 | $wp = isset($_REQUEST['wp']) ? $_REQUEST['wp'] : ''; |