You are here

function _vkxp_get_upload_server in VK CrossPoster 6

Same name and namespace in other branches
  1. 6.3 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

upload url on success or FALSE on failure

1 call to _vkxp_get_upload_server()
vkxp_nodeapi in ./vkxp.module
Implementation of hook_nodeapi

File

./vkxp.module, line 223

Code

function _vkxp_get_upload_server() {
  $params = array();
  if (variable_get('vkxp_wall_owner', 'group') == 'group') {
    $params['gid'] = variable_get('vkxp_group_id', '');
  }
  else {
    $params['uid'] = variable_get('vkxp_group_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;
}