@@ -32,7 +32,7 @@ |
||
| 32 | 32 | # Catch pipe chars here, because services/users/by_usernames would split up the name. |
| 33 | 33 | # OC databases do not contain user names with pipe chars. |
| 34 | 34 | |
| 35 | - if (strstr($username,'|')) |
|
| 35 | + if (strstr($username, '|')) |
|
| 36 | 36 | throw new InvalidParam('username', "There is no user by this username."); |
| 37 | 37 | $fields = $request->get_parameter('fields'); |
| 38 | 38 | |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | if (!$usernames) throw new ParamMissing('usernames'); |
| 28 | 28 | $usernames = explode("|", $usernames); |
| 29 | 29 | if (count($usernames) > 500) |
| 30 | - throw new InvalidParam('usernames', "Maximum allowed number of referenced users ". |
|
| 31 | - "is 500. You provided ".count($usernames)." usernames."); |
|
| 30 | + throw new InvalidParam('usernames', "Maximum allowed number of referenced users " . |
|
| 31 | + "is 500. You provided " . count($usernames) . " usernames."); |
|
| 32 | 32 | $fields = $request->get_parameter('fields'); |
| 33 | 33 | if (!$fields) |
| 34 | 34 | throw new ParamMissing('fields'); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $rs = Db::query(" |
| 40 | 40 | select username, uuid |
| 41 | 41 | from user |
| 42 | - where username collate ".Settings::get('DB_CHARSET')."_general_ci in ('".implode("','", array_map('\okapi\Db::escape_string', $usernames))."') |
|
| 42 | + where username collate ".Settings::get('DB_CHARSET') . "_general_ci in ('" . implode("','", array_map('\okapi\Db::escape_string', $usernames)) . "') |
|
| 43 | 43 | "); |
| 44 | 44 | $lower_username2useruuid = array(); |
| 45 | 45 | while ($row = Db::fetch_assoc($rs)) |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | if (!$user_uuids) throw new ParamMissing('user_uuids'); |
| 32 | 32 | $user_uuids = explode("|", $user_uuids); |
| 33 | 33 | if (count($user_uuids) > 500) |
| 34 | - throw new InvalidParam('user_uuids', "Maximum allowed number of referenced users ". |
|
| 35 | - "is 500. You provided ".count($user_uuids)." user IDs."); |
|
| 34 | + throw new InvalidParam('user_uuids', "Maximum allowed number of referenced users " . |
|
| 35 | + "is 500. You provided " . count($user_uuids) . " user IDs."); |
|
| 36 | 36 | $fields = $request->get_parameter('fields'); |
| 37 | 37 | if (!$fields) |
| 38 | 38 | throw new ParamMissing('fields'); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $rs = Db::query(" |
| 44 | 44 | select user_id, uuid, username, admin, latitude, longitude, date_created |
| 45 | 45 | from user |
| 46 | - where uuid in ('".implode("','", array_map('\okapi\Db::escape_string', $user_uuids))."') |
|
| 46 | + where uuid in ('".implode("','", array_map('\okapi\Db::escape_string', $user_uuids)) . "') |
|
| 47 | 47 | "); |
| 48 | 48 | $results = array(); |
| 49 | 49 | $id2uuid = array(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | case 'uuid': $entry['uuid'] = $row['uuid']; break; |
| 61 | 61 | case 'username': $entry['username'] = $row['username']; break; |
| 62 | - case 'profile_url': $entry['profile_url'] = Settings::get('SITE_URL')."viewprofile.php?userid=".$row['user_id']; break; |
|
| 62 | + case 'profile_url': $entry['profile_url'] = Settings::get('SITE_URL') . "viewprofile.php?userid=" . $row['user_id']; break; |
|
| 63 | 63 | case 'is_admin': |
| 64 | 64 | if (!$request->token) { |
| 65 | 65 | $entry['is_admin'] = null; |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | # does not make sense. |
| 87 | 87 | $entry['home_location'] = null; |
| 88 | 88 | } else { |
| 89 | - $entry['home_location'] = round($row['latitude'], 6)."|".round($row['longitude'], 6); |
|
| 89 | + $entry['home_location'] = round($row['latitude'], 6) . "|" . round($row['longitude'], 6); |
|
| 90 | 90 | } |
| 91 | 91 | break; |
| 92 | - default: throw new Exception("Missing field case: ".$field); |
|
| 92 | + default: throw new Exception("Missing field case: " . $field); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | $results[$row['uuid']] = $entry; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $rs = Db::query(" |
| 114 | 114 | select user_id, founds_count, notfounds_count, hidden_count |
| 115 | 115 | from user |
| 116 | - where user_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($id2uuid)))."') |
|
| 116 | + where user_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($id2uuid))) . "') |
|
| 117 | 117 | "); |
| 118 | 118 | } |
| 119 | 119 | else |
@@ -130,13 +130,13 @@ discard block |
||
| 130 | 130 | user u |
| 131 | 131 | left join stat_user su |
| 132 | 132 | on su.user_id = u.user_id |
| 133 | - where u.user_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($id2uuid)))."') |
|
| 133 | + where u.user_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($id2uuid))) . "') |
|
| 134 | 134 | "); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | while ($row = Db::fetch_assoc($rs)) |
| 138 | 138 | { |
| 139 | - $extras[$row['user_id']] = array();; |
|
| 139 | + $extras[$row['user_id']] = array(); ; |
|
| 140 | 140 | $extra_ref = &$extras[$row['user_id']]; |
| 141 | 141 | $extra_ref['caches_found'] = 0 + $row['founds_count']; |
| 142 | 142 | $extra_ref['caches_notfound'] = 0 + $row['notfounds_count']; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $rs = Db::query(" |
| 150 | 150 | select user_id, count(*) as rcmds_given |
| 151 | 151 | from cache_rating |
| 152 | - where user_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($id2uuid)))."') |
|
| 152 | + where user_id in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($id2uuid))) . "') |
|
| 153 | 153 | group by user_id |
| 154 | 154 | "); |
| 155 | 155 | $rcmds_counts = array(); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | $response = new OkapiHttpResponse(); |
| 32 | 32 | $response->content_type = "text/plain; charset=utf-8"; |
| 33 | - $response->body = $new_token."&oauth_callback_confirmed=true"; |
|
| 33 | + $response->body = $new_token . "&oauth_callback_confirmed=true"; |
|
| 34 | 34 | return $response; |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -34,8 +34,8 @@ |
||
| 34 | 34 | # done in the "services" folder. 2) "services" don't display |
| 35 | 35 | # any interactive webpages, they just return the result. |
| 36 | 36 | |
| 37 | - return new OkapiRedirectResponse(Settings::get('SITE_URL')."okapi/apps/authorize". |
|
| 38 | - "?oauth_token=".$token_key.(($langpref != null) ? "&langpref=".$langpref : ""). |
|
| 39 | - "&interactivity=".$interactivity); |
|
| 37 | + return new OkapiRedirectResponse(Settings::get('SITE_URL') . "okapi/apps/authorize" . |
|
| 38 | + "?oauth_token=" . $token_key . (($langpref != null) ? "&langpref=" . $langpref : "") . |
|
| 39 | + "&interactivity=" . $interactivity); |
|
| 40 | 40 | } |
| 41 | 41 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | # Fill some other fields (not kept in the cached attrdict). |
| 91 | 91 | |
| 92 | 92 | $attr['is_locally_used'] = ($attr['internal_id'] !== null); |
| 93 | - $attr['is_deprecated'] = $attr['is_discontinued']; // deprecated and undocumetned field, see issue 70 |
|
| 93 | + $attr['is_deprecated'] = $attr['is_discontinued']; // deprecated and undocumetned field, see issue 70 |
|
| 94 | 94 | |
| 95 | 95 | # Add to results. |
| 96 | 96 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $internal_id = $attr_ref['internal_id']; |
| 120 | 120 | if (isset($map[$internal_id])) { |
| 121 | 121 | $row = $map[$internal_id]; |
| 122 | - $attr_ref['local_icon_url'] = $prefix.$row['icon_large']; |
|
| 122 | + $attr_ref['local_icon_url'] = $prefix . $row['icon_large']; |
|
| 123 | 123 | } else { |
| 124 | 124 | $attr_ref['local_icon_url'] = null; |
| 125 | 125 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | $acode = $request->get_parameter('acode'); |
| 32 | 32 | if ($acode === null) throw new ParamMissing('acode'); |
| 33 | - if (strstr($acode,'|')) throw new InvalidParam('acode', "Only a single A-code must be supplied."); |
|
| 33 | + if (strstr($acode, '|')) throw new InvalidParam('acode', "Only a single A-code must be supplied."); |
|
| 34 | 34 | |
| 35 | 35 | $langpref = $request->get_parameter('langpref'); |
| 36 | 36 | if (!$langpref) $langpref = "en"; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | try |
| 53 | 53 | { |
| 54 | - $path = $GLOBALS['rootpath']."okapi/services/attrs/attribute-definitions.xml"; |
|
| 54 | + $path = $GLOBALS['rootpath'] . "okapi/services/attrs/attribute-definitions.xml"; |
|
| 55 | 55 | $xml = file_get_contents($path); |
| 56 | 56 | self::refresh_from_string($xml); |
| 57 | 57 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | # That's bad! We don't have ANY copy of the data AND we failed |
| 68 | 68 | # to parse it. We will use a fake, empty data. |
| 69 | 69 | |
| 70 | - $cache_key = "attrhelper/dict#".Okapi::$git_revision.self::cache_key_suffix(); |
|
| 70 | + $cache_key = "attrhelper/dict#" . Okapi::$git_revision . self::cache_key_suffix(); |
|
| 71 | 71 | $cachedvalue = array( |
| 72 | 72 | 'attr_dict' => array(), |
| 73 | 73 | ); |
@@ -128,12 +128,12 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | $internal_id = (int)$ocnode['id']; |
| 130 | 130 | if (isset($all_internal_ids[$internal_id])) |
| 131 | - throw new Exception("The internal attribute ".$internal_id. |
|
| 131 | + throw new Exception("The internal attribute " . $internal_id . |
|
| 132 | 132 | " has multiple assigments to OKAPI attributes."); |
| 133 | 133 | $all_internal_ids[$internal_id] = true; |
| 134 | 134 | if (!is_null($attr['internal_id'])) |
| 135 | - throw new Exception("There are multiple internal IDs for the ". |
|
| 136 | - $attr['acode']." attribute."); |
|
| 135 | + throw new Exception("There are multiple internal IDs for the " . |
|
| 136 | + $attr['acode'] . " attribute."); |
|
| 137 | 137 | $attr['internal_id'] = $internal_id; |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -143,13 +143,13 @@ discard block |
||
| 143 | 143 | foreach ($langnode->name as $namenode) |
| 144 | 144 | { |
| 145 | 145 | if (isset($attr['names'][$lang])) |
| 146 | - throw new Exception("Duplicate ".$lang." name of attribute ".$attr['acode']); |
|
| 146 | + throw new Exception("Duplicate " . $lang . " name of attribute " . $attr['acode']); |
|
| 147 | 147 | $attr['names'][$lang] = (string)$namenode; |
| 148 | 148 | } |
| 149 | 149 | foreach ($langnode->desc as $descnode) |
| 150 | 150 | { |
| 151 | 151 | if (isset($attr['descriptions'][$lang])) |
| 152 | - throw new Exception("Duplicate ".$lang." description of attribute ".$attr['acode']); |
|
| 152 | + throw new Exception("Duplicate " . $lang . " description of attribute " . $attr['acode']); |
|
| 153 | 153 | $xml = $descnode->asxml(); /* contains "<desc>" and "</desc>" */ |
| 154 | 154 | $innerxml = preg_replace("/(^[^>]+>)|(<[^<]+$)/us", "", $xml); |
| 155 | 155 | $attr['descriptions'][$lang] = self::cleanup_string($innerxml); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $cachedvalue['attr_dict'][$attr['acode']] = $attr; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $cache_key = "attrhelper/dict#".Okapi::$git_revision.self::cache_key_suffix(); |
|
| 161 | + $cache_key = "attrhelper/dict#" . Okapi::$git_revision . self::cache_key_suffix(); |
|
| 162 | 162 | Cache::set($cache_key, $cachedvalue, self::ttl()); |
| 163 | 163 | self::$attr_dict = $cachedvalue['attr_dict']; |
| 164 | 164 | } |
@@ -177,9 +177,9 @@ discard block |
||
| 177 | 177 | ), |
| 178 | 178 | 'descriptions' => array( |
| 179 | 179 | 'en' => ( |
| 180 | - "This attribute ($acode) is unknown at ".Okapi::get_normalized_site_name(). |
|
| 181 | - ". It might not exist, or it may be a new attribute, recognized ". |
|
| 182 | - "only in newer OKAPI installations. Perhaps ".Okapi::get_normalized_site_name(). |
|
| 180 | + "This attribute ($acode) is unknown at " . Okapi::get_normalized_site_name() . |
|
| 181 | + ". It might not exist, or it may be a new attribute, recognized " . |
|
| 182 | + "only in newer OKAPI installations. Perhaps " . Okapi::get_normalized_site_name() . |
|
| 183 | 183 | " needs to have its OKAPI updated?" |
| 184 | 184 | ) |
| 185 | 185 | ), |
@@ -192,14 +192,14 @@ discard block |
||
| 192 | 192 | * loads attribute values from the cache. If they are not present in the |
| 193 | 193 | * cache, it will read and parse them from attribute-definitions.xml file. |
| 194 | 194 | */ |
| 195 | - private static function init_from_cache($allow_refreshing=true) |
|
| 195 | + private static function init_from_cache($allow_refreshing = true) |
|
| 196 | 196 | { |
| 197 | 197 | if (self::$attr_dict !== null) |
| 198 | 198 | { |
| 199 | 199 | /* Already initialized. */ |
| 200 | 200 | return; |
| 201 | 201 | } |
| 202 | - $cache_key = "attrhelper/dict#".Okapi::$git_revision.self::cache_key_suffix(); |
|
| 202 | + $cache_key = "attrhelper/dict#" . Okapi::$git_revision . self::cache_key_suffix(); |
|
| 203 | 203 | $cachedvalue = Cache::get($cache_key); |
| 204 | 204 | if ($cachedvalue === null) |
| 205 | 205 | { |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | if ($mapping !== null) |
| 248 | 248 | return $mapping; |
| 249 | 249 | |
| 250 | - $cache_key = "attrhelper/id2acode/".Okapi::$git_revision.self::cache_key_suffix(); |
|
| 250 | + $cache_key = "attrhelper/id2acode/" . Okapi::$git_revision . self::cache_key_suffix(); |
|
| 251 | 251 | $mapping = Cache::get($cache_key); |
| 252 | 252 | if (!$mapping) |
| 253 | 253 | { |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | from cache_logs |
| 39 | 39 | where |
| 40 | 40 | type in (1,2,7) |
| 41 | - and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "deleted = 0" : "true")." |
|
| 41 | + and ".((Settings::get('OC_BRANCH') == 'oc.pl') ? "deleted = 0" : "true") . " |
|
| 42 | 42 | UNION DISTINCT |
| 43 | 43 | select distinct user_id |
| 44 | 44 | from caches |