You are here

function _vkxp_get_upload_server in VK CrossPoster 6.3

Same name and namespace in other branches
  1. 6 vkxp.module \_vkxp_get_upload_server()
  2. 6.2 vkxp.module \_vkxp_get_upload_server()
  3. 7.2 vkxp.module \_vkxp_get_upload_server()
  4. 7 vkxp.module \_vkxp_get_upload_server()

Makes http query to api server to get upload uri.

Return value

string|bool Upload url on success or FALSE on failure.

1 call to _vkxp_get_upload_server()
_vkxp_get_node_images in ./vkxp.module
Get images from node.

File

./vkxp.module, line 285

Code

function _vkxp_get_upload_server() {
  $params = array();
  if (variable_get('vkxp_wall_owner', 'group') == 'group') {
    $params['gid'] = variable_get('vkxp_owner_id', '');
  }
  else {
    $params['uid'] = variable_get('vkxp_owner_id', '');
  }
  $params['access_token'] = variable_get('vkxp_access_token', '');
  $result = vkxp_query('photos.getWallUploadServer', $params);
  if ($result['response']['upload_url']) {
    return $result['response']['upload_url'];
  }
  elseif ($result['error']) {
    _vkxp_watchdog(array(
      'text' => t('Unable to recieve upload server. Error: !error', array(
        '!error' => $result['error']['error_msg'],
      )),
      'severity' => 'error',
    ));
  }
  return FALSE;
}