@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @return string |
| 127 | 127 | */ |
| 128 | 128 | public function getAPIUrl($apiMethod, $responseFormat = 'json') { |
| 129 | - return self::METHOD_URL . $apiMethod.'.'.$responseFormat; |
|
| 129 | + return self::METHOD_URL.$apiMethod.'.'.$responseFormat; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | if (is_array($pValue)) { |
| 226 | 226 | $pValue = implode(', ', $pValue); |
| 227 | 227 | } |
| 228 | - $parametersSignature .= $pKey . '=' . $pValue; |
|
| 228 | + $parametersSignature .= $pKey.'='.$pValue; |
|
| 229 | 229 | } |
| 230 | 230 | $parametersSignature .= $this->APISecret; |
| 231 | 231 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | return $resultType == 'array' ? $decodedJSON : $apiResponse; |
| 247 | - } catch(VKException $ex) { |
|
| 247 | + } catch (VKException $ex) { |
|
| 248 | 248 | echo $ex->getMessage(); |
| 249 | 249 | return [ ]; |
| 250 | 250 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * @return string |
| 274 | 274 | */ |
| 275 | 275 | private function createURL($urlString, $parametersArray) { |
| 276 | - $urlString .= '?' . http_build_query($parametersArray); |
|
| 276 | + $urlString .= '?'.http_build_query($parametersArray); |
|
| 277 | 277 | return $urlString; |
| 278 | 278 | } |
| 279 | 279 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | private function performRequest($requestURL, $requestMethod = 'GET', $postFields = [ ]) { |
| 288 | 288 | curl_setopt_array($this->curlObject, [ |
| 289 | - CURLOPT_USERAGENT => 'FreedomCore/' . self::PACKAGE_VERSION . ' VK OAuth Client', |
|
| 289 | + CURLOPT_USERAGENT => 'FreedomCore/'.self::PACKAGE_VERSION.' VK OAuth Client', |
|
| 290 | 290 | CURLOPT_RETURNTRANSFER => true, |
| 291 | 291 | CURLOPT_SSL_VERIFYPEER => false, |
| 292 | 292 | CURLOPT_POST => ($requestMethod == 'POST'), |
@@ -341,42 +341,42 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | private function codeToErrorText($Code) { |
| 343 | 343 | $errorsData = [ |
| 344 | - 1 => [ 'title' => 'Unknown error occurred', 'description' => 'Try again later.' ], |
|
| 345 | - 2 => [ 'title' => 'Application is disabled. Enable your application or use test mode ', 'description' => 'You need to switch on the app in Settings (https://vk.com/editapp?id={Your API_ID} or use the test mode (test_mode=1).' ], |
|
| 346 | - 3 => [ 'title' => 'Unknown method passed ', 'description' => 'Check the method name: <a href="http://vk.com/dev/methods" target="_blank">http://vk.com/dev/methods</a> ' ], |
|
| 347 | - 4 => [ 'title' => 'Incorrect signature ', 'description' => 'Check if the signature has been formed correctly: <a href="https://vk.com/dev/api_nohttps" target="_blank"></a>' ], |
|
| 348 | - 5 => [ 'title' => 'User authorization failed ', 'description' => 'Make sure that you use a correct authorization type. To work with the methods without a secureprefix you need to authorize a user with one of these ways: http://vk.com/dev/auth_sites, http://vk.com/dev/auth_mobile.' ], |
|
| 349 | - 6 => [ 'title' => 'Too many requests per second ', 'description' => 'Decrease the request frequency or use the execute method. More details on frequency limits here: <a href="http://vk.com/dev/api_requests" target="_blank">http://vk.com/dev/api_requests</a>' ], |
|
| 350 | - 7 => [ 'title' => 'Permission to perform this action is denied ', 'description' => 'Make sure that your have received required permissions during the authorization. You can do it with the account.getAppPermissions method.' ], |
|
| 351 | - 8 => [ 'title' => 'Invalid request ', 'description' => 'Check the request syntax and used parameters list (it can be found on a method description page) ' ], |
|
| 352 | - 9 => [ 'title' => 'Flood control ', 'description' => 'You need to decrease the count of identical requests. For more efficient work you may use execute or JSONP.' ], |
|
| 353 | - 10 => [ 'title' => 'Internal server error', 'description' => 'Try again later.' ], |
|
| 354 | - 11 => [ 'title' => 'In test mode application should be disabled or user should be authorized', 'description' => 'Switch the app off in Settings: https://vk.com/editapp?id={Your API_ID}.' ], |
|
| 355 | - 14 => [ 'title' => 'Captcha needed ', 'description' => 'Work with this error is explained in detail on the <a href="https://vk.com/dev/need_confirmation" target="_blank">separate page</a>' ], |
|
| 356 | - 15 => [ 'title' => 'Access denied ', 'description' => 'Make sure that you use correct identifiers and the content is available for the user in the full version of the site.' ], |
|
| 357 | - 16 => [ 'title' => 'HTTP authorization failed', 'description' => 'To avoid this error check if a user has the \'Use secure connection\' option enabled with the account.getInfo method.' ], |
|
| 358 | - 17 => [ 'title' => 'Validation required ', 'description' => 'Make sure that you don\'t use a token received with http://vk.com/dev/auth_mobile for a request from the server. It\'s restricted. The validation process is described on the <a href="https://vk.com/dev/need_confirmation" target="_blank">separate page</a>.' ], |
|
| 359 | - 20 => [ 'title' => 'Permission to perform this action is denied for non-standalone applications ', 'description' => 'If you see this error despite your app has the Standalone type, make sure that you use redirect_uri=https://oauth.vk.com/blank.html. Details here: http://vk.com/dev/auth_mobile.' ], |
|
| 360 | - 21 => [ 'title' => 'Permission to perform this action is allowed only for Standalone and OpenAPI applications', 'description' => '' ], |
|
| 361 | - 23 => [ 'title' => 'This method was disabled ', 'description' => 'All the methods available now are listed here: <a href="http://vk.com/dev/methods" target="_blank">http://vk.com/dev/methods</a>' ], |
|
| 362 | - 24 => [ 'title' => 'Confirmation required ', 'description' => 'Confirmation process is described on the <a href="https://vk.com/dev/need_confirmation" target="_blank">separate page</a>' ], |
|
| 363 | - 100 => [ 'title' => 'One of the parameters specified was missing or invalid ', 'description' => 'Check the required parameters list and their format on a method description page.' ], |
|
| 364 | - 101 => [ 'title' => 'Invalid application API ID ', 'description' => 'Find the app in the administrated list in settings: <a href="http://vk.com/apps?act=settings" target="_blank">http://vk.com/apps?act=settings</a> And set the correct API_ID in the request.' ], |
|
| 344 | + 1 => [ 'title' => 'Unknown error occurred', 'description' => 'Try again later.' ], |
|
| 345 | + 2 => [ 'title' => 'Application is disabled. Enable your application or use test mode ', 'description' => 'You need to switch on the app in Settings (https://vk.com/editapp?id={Your API_ID} or use the test mode (test_mode=1).' ], |
|
| 346 | + 3 => [ 'title' => 'Unknown method passed ', 'description' => 'Check the method name: <a href="http://vk.com/dev/methods" target="_blank">http://vk.com/dev/methods</a> ' ], |
|
| 347 | + 4 => [ 'title' => 'Incorrect signature ', 'description' => 'Check if the signature has been formed correctly: <a href="https://vk.com/dev/api_nohttps" target="_blank"></a>' ], |
|
| 348 | + 5 => [ 'title' => 'User authorization failed ', 'description' => 'Make sure that you use a correct authorization type. To work with the methods without a secureprefix you need to authorize a user with one of these ways: http://vk.com/dev/auth_sites, http://vk.com/dev/auth_mobile.' ], |
|
| 349 | + 6 => [ 'title' => 'Too many requests per second ', 'description' => 'Decrease the request frequency or use the execute method. More details on frequency limits here: <a href="http://vk.com/dev/api_requests" target="_blank">http://vk.com/dev/api_requests</a>' ], |
|
| 350 | + 7 => [ 'title' => 'Permission to perform this action is denied ', 'description' => 'Make sure that your have received required permissions during the authorization. You can do it with the account.getAppPermissions method.' ], |
|
| 351 | + 8 => [ 'title' => 'Invalid request ', 'description' => 'Check the request syntax and used parameters list (it can be found on a method description page) ' ], |
|
| 352 | + 9 => [ 'title' => 'Flood control ', 'description' => 'You need to decrease the count of identical requests. For more efficient work you may use execute or JSONP.' ], |
|
| 353 | + 10 => [ 'title' => 'Internal server error', 'description' => 'Try again later.' ], |
|
| 354 | + 11 => [ 'title' => 'In test mode application should be disabled or user should be authorized', 'description' => 'Switch the app off in Settings: https://vk.com/editapp?id={Your API_ID}.' ], |
|
| 355 | + 14 => [ 'title' => 'Captcha needed ', 'description' => 'Work with this error is explained in detail on the <a href="https://vk.com/dev/need_confirmation" target="_blank">separate page</a>' ], |
|
| 356 | + 15 => [ 'title' => 'Access denied ', 'description' => 'Make sure that you use correct identifiers and the content is available for the user in the full version of the site.' ], |
|
| 357 | + 16 => [ 'title' => 'HTTP authorization failed', 'description' => 'To avoid this error check if a user has the \'Use secure connection\' option enabled with the account.getInfo method.' ], |
|
| 358 | + 17 => [ 'title' => 'Validation required ', 'description' => 'Make sure that you don\'t use a token received with http://vk.com/dev/auth_mobile for a request from the server. It\'s restricted. The validation process is described on the <a href="https://vk.com/dev/need_confirmation" target="_blank">separate page</a>.' ], |
|
| 359 | + 20 => [ 'title' => 'Permission to perform this action is denied for non-standalone applications ', 'description' => 'If you see this error despite your app has the Standalone type, make sure that you use redirect_uri=https://oauth.vk.com/blank.html. Details here: http://vk.com/dev/auth_mobile.' ], |
|
| 360 | + 21 => [ 'title' => 'Permission to perform this action is allowed only for Standalone and OpenAPI applications', 'description' => '' ], |
|
| 361 | + 23 => [ 'title' => 'This method was disabled ', 'description' => 'All the methods available now are listed here: <a href="http://vk.com/dev/methods" target="_blank">http://vk.com/dev/methods</a>' ], |
|
| 362 | + 24 => [ 'title' => 'Confirmation required ', 'description' => 'Confirmation process is described on the <a href="https://vk.com/dev/need_confirmation" target="_blank">separate page</a>' ], |
|
| 363 | + 100 => [ 'title' => 'One of the parameters specified was missing or invalid ', 'description' => 'Check the required parameters list and their format on a method description page.' ], |
|
| 364 | + 101 => [ 'title' => 'Invalid application API ID ', 'description' => 'Find the app in the administrated list in settings: <a href="http://vk.com/apps?act=settings" target="_blank">http://vk.com/apps?act=settings</a> And set the correct API_ID in the request.' ], |
|
| 365 | 365 | 103 => [ 'title' => 'Out of limits', 'description' => 'Out of limits' ], |
| 366 | 366 | 104 => [ 'title' => 'Not found', 'description' => 'Not found' ], |
| 367 | - 113 => [ 'title' => 'Invalid user id ', 'description' => 'Make sure that you use a correct id. You can get an id using a screen name with the utils.resolveScreenName method' ], |
|
| 368 | - 150 => [ 'title' => 'Invalid timestamp ', 'description' => 'You may get a correct value with the utils.getServerTime method.' ], |
|
| 369 | - 200 => [ 'title' => 'Access to album denied ', 'description' => 'Make sure you use correct ids (owner_id is always positive for users, negative for communities) and the current user has access to the requested content in the full version of the site.' ], |
|
| 370 | - 201 => [ 'title' => 'Access to audio denied ', 'description' => 'Make sure you use correct ids (owner_id is always positive for users, negative for communities) and the current user has access to the requested content in the full version of the site.' ], |
|
| 371 | - 203 => [ 'title' => 'Access to group denied ', 'description' => 'Make sure that the current user is a member or admin of the community (for closed and private groups and events).' ], |
|
| 372 | - 300 => [ 'title' => 'This album is full ', 'description' => 'You need to delete the odd objects from the album or use another album.' ], |
|
| 373 | - 500 => [ 'title' => 'Permission denied. You must enable votes processing in application settings', 'description' => 'Check the app settings: http://vk.com/editapp?id={Your API_ID}§ion=payments' ], |
|
| 374 | - 600 => [ 'title' => 'Permission denied. You have no access to operations specified with given object(s)', 'description' => '' ], |
|
| 375 | - 603 => [ 'title' => 'Some ads error occurred', 'description' => '' ], |
|
| 376 | - 1260 => [ 'title' => 'Invalid screen name', 'description' => 'This screen name is already in use or invalid' ], |
|
| 367 | + 113 => [ 'title' => 'Invalid user id ', 'description' => 'Make sure that you use a correct id. You can get an id using a screen name with the utils.resolveScreenName method' ], |
|
| 368 | + 150 => [ 'title' => 'Invalid timestamp ', 'description' => 'You may get a correct value with the utils.getServerTime method.' ], |
|
| 369 | + 200 => [ 'title' => 'Access to album denied ', 'description' => 'Make sure you use correct ids (owner_id is always positive for users, negative for communities) and the current user has access to the requested content in the full version of the site.' ], |
|
| 370 | + 201 => [ 'title' => 'Access to audio denied ', 'description' => 'Make sure you use correct ids (owner_id is always positive for users, negative for communities) and the current user has access to the requested content in the full version of the site.' ], |
|
| 371 | + 203 => [ 'title' => 'Access to group denied ', 'description' => 'Make sure that the current user is a member or admin of the community (for closed and private groups and events).' ], |
|
| 372 | + 300 => [ 'title' => 'This album is full ', 'description' => 'You need to delete the odd objects from the album or use another album.' ], |
|
| 373 | + 500 => [ 'title' => 'Permission denied. You must enable votes processing in application settings', 'description' => 'Check the app settings: http://vk.com/editapp?id={Your API_ID}§ion=payments' ], |
|
| 374 | + 600 => [ 'title' => 'Permission denied. You have no access to operations specified with given object(s)', 'description' => '' ], |
|
| 375 | + 603 => [ 'title' => 'Some ads error occurred', 'description' => '' ], |
|
| 376 | + 1260 => [ 'title' => 'Invalid screen name', 'description' => 'This screen name is already in use or invalid' ], |
|
| 377 | 377 | ]; |
| 378 | 378 | |
| 379 | - return (!array_key_exists($Code, $errorsData)) ? $errorsData[1] : $errorsData[$Code]; |
|
| 379 | + return (!array_key_exists($Code, $errorsData)) ? $errorsData[ 1 ] : $errorsData[ $Code ]; |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | } |
| 383 | 383 | \ No newline at end of file |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function join($groupID, $ifMeeting = null) { |
| 116 | 116 | $requestParameters[ 'group_id' ] = $groupID; |
| 117 | - if ($ifMeeting != null){ |
|
| 117 | + if ($ifMeeting != null) { |
|
| 118 | 118 | if ($ifMeeting == 1 || $ifMeeting == 0) { |
| 119 | - $requestParameters[ 'not_sure' ] = $ifMeeting; |
|
| 119 | + $requestParameters[ 'not_sure' ] = $ifMeeting; |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * @return mixed |
| 216 | 216 | */ |
| 217 | 217 | public function getBanned($groupID) { |
| 218 | - return parent::executeQuery(__FUNCTION__, [ 'group_id' => $groupID]); |
|
| 218 | + return parent::executeQuery(__FUNCTION__, [ 'group_id' => $groupID ]); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * @return mixed |
| 273 | 273 | */ |
| 274 | 274 | public function getSettings($groupID) { |
| 275 | - return parent::executeQuery(__FUNCTION__, [ 'group_id' => $groupID]); |
|
| 275 | + return parent::executeQuery(__FUNCTION__, [ 'group_id' => $groupID ]); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | /** |
@@ -372,9 +372,9 @@ discard block |
||
| 372 | 372 | 'contacts' |
| 373 | 373 | ]; |
| 374 | 374 | |
| 375 | - foreach($fieldsArray as $fKey => $fValue) { |
|
| 375 | + foreach ($fieldsArray as $fKey => $fValue) { |
|
| 376 | 376 | if (!in_array($fValue, $groupsFields)) { |
| 377 | - unset($fieldsArray[$fKey]); |
|
| 377 | + unset($fieldsArray[ $fKey ]); |
|
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | 380 | return implode(',', $fieldsArray); |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require getcwd() . '/vendor/autoload.php'; |
|
| 2 | +require getcwd().'/vendor/autoload.php'; |
|
| 3 | 3 | session_start(); |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Define Directory Separator Short Code if not defined |
| 7 | 7 | */ |
| 8 | -if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR); |
|
| 8 | +if (!defined('DS')) define('DS', DIRECTORY_SEPARATOR); |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Define Project Folder Short Code if not defined |
| 12 | 12 | */ |
| 13 | -if(!defined('PROJECT_FOLDER')) define('PROJECT_FOLDER', getcwd()); |
|
| 13 | +if (!defined('PROJECT_FOLDER')) define('PROJECT_FOLDER', getcwd()); |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Define Content Folder Short Code if not defined |
| 17 | 17 | */ |
| 18 | -if(!defined('CONTENT_FOLDER')) define('CONTENT_FOLDER', PROJECT_FOLDER . DS . 'Content' . DS); |
|
| 18 | +if (!defined('CONTENT_FOLDER')) define('CONTENT_FOLDER', PROJECT_FOLDER.DS.'Content'.DS); |
|
| 19 | 19 | |
| 20 | 20 | $dataArray = [ |
| 21 | 21 | 'key' => '', |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | ]; |
| 24 | 24 | |
| 25 | 25 | |
| 26 | -if(isset($_SESSION['access_token'])){ |
|
| 27 | - $dataArray['token'] = $_SESSION['access_token']; |
|
| 28 | - $VKObject = new FreedomCore\VK\VKBase($dataArray['key'], $dataArray['secret'], $dataArray['token']); |
|
| 26 | +if (isset($_SESSION[ 'access_token' ])) { |
|
| 27 | + $dataArray[ 'token' ] = $_SESSION[ 'access_token' ]; |
|
| 28 | + $VKObject = new FreedomCore\VK\VKBase($dataArray[ 'key' ], $dataArray[ 'secret' ], $dataArray[ 'token' ]); |
|
| 29 | 29 | $VKObject->setAPIVersion('5.50'); |
| 30 | 30 | } else { |
| 31 | - $VKObject = new \FreedomCore\VK\VKBase($dataArray['key'], $dataArray['secret']); |
|
| 31 | + $VKObject = new \FreedomCore\VK\VKBase($dataArray[ 'key' ], $dataArray[ 'secret' ]); |
|
| 32 | 32 | $VKObject->setAPIVersion('5.50'); |
| 33 | 33 | } |
@@ -5,17 +5,23 @@ |
||
| 5 | 5 | /** |
| 6 | 6 | * Define Directory Separator Short Code if not defined |
| 7 | 7 | */ |
| 8 | -if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR); |
|
| 8 | +if(!defined('DS')) { |
|
| 9 | + define('DS', DIRECTORY_SEPARATOR); |
|
| 10 | +} |
|
| 9 | 11 | |
| 10 | 12 | /** |
| 11 | 13 | * Define Project Folder Short Code if not defined |
| 12 | 14 | */ |
| 13 | -if(!defined('PROJECT_FOLDER')) define('PROJECT_FOLDER', getcwd()); |
|
| 15 | +if(!defined('PROJECT_FOLDER')) { |
|
| 16 | + define('PROJECT_FOLDER', getcwd()); |
|
| 17 | +} |
|
| 14 | 18 | |
| 15 | 19 | /** |
| 16 | 20 | * Define Content Folder Short Code if not defined |
| 17 | 21 | */ |
| 18 | -if(!defined('CONTENT_FOLDER')) define('CONTENT_FOLDER', PROJECT_FOLDER . DS . 'Content' . DS); |
|
| 22 | +if(!defined('CONTENT_FOLDER')) { |
|
| 23 | + define('CONTENT_FOLDER', PROJECT_FOLDER . DS . 'Content' . DS); |
|
| 24 | +} |
|
| 19 | 25 | |
| 20 | 26 | $dataArray = [ |
| 21 | 27 | 'key' => '', |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | print_r($searchUsers); |
| 10 | 10 | echo "</pre>"; |
| 11 | 11 | } else { |
| 12 | - header('Location: /login.php'); |
|
| 12 | + header('Location: /login.php'); |
|
| 13 | 13 | } |
| 14 | 14 | } else { |
| 15 | 15 | header('Location: /login.php'); |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require('header.php'); |
| 3 | 3 | |
| 4 | -if(isset($_SESSION['access_token'])) { |
|
| 5 | - if($VKObject->isAuthorized()){ |
|
| 4 | +if (isset($_SESSION[ 'access_token' ])) { |
|
| 5 | + if ($VKObject->isAuthorized()) { |
|
| 6 | 6 | $VKUsers = new \FreedomCore\VK\API\VKUsers($VKObject); |
| 7 | - $searchUsers = $VKUsers->get(['{ID_ONE}', '{ID_TWO'}, '{ID_N}']) |
|
| 7 | + $searchUsers = $VKUsers->get([ '{ID_ONE}', '{ID_TWO'}, '{ID_N}' ]) |
|
| 8 | 8 | echo "<pre>"; |
| 9 | 9 | print_r($searchUsers); |
| 10 | 10 | echo "</pre>"; |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | require('header.php'); |
| 3 | 3 | |
| 4 | 4 | |
| 5 | -$accessToken = $VKObject->getAccessToken($_REQUEST['code'], 'https://vkapi.local/callback.php'); |
|
| 5 | +$accessToken = $VKObject->getAccessToken($_REQUEST[ 'code' ], 'https://vkapi.local/callback.php'); |
|
| 6 | 6 | |
| 7 | -$_SESSION['access_token'] = $accessToken['access_token']; |
|
| 7 | +$_SESSION[ 'access_token' ] = $accessToken[ 'access_token' ]; |
|
| 8 | 8 | header('Location: /'); |
| 9 | 9 | \ No newline at end of file |