Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 51 additions & 5 deletions lib/Sky/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,51 @@ public function __construct($oauth_token = null)
// set the identity -- this implies your Identity class is in the
// Api namespace.
$identityClass = '\\' . get_called_class() . '\\Identity';
$this->identity = $identityClass::get($oauth_token);
// initialize output response
$responseClass = '\\' . get_called_class() . '\\Response';
$this->response = new $responseClass();
//d($identityClass, $responseClass);
if($identityClass == "\Vfolder\Api_v2\Identity"){
$identityClass = "\Vfolder\Api_v2\Identity";
$responseClass = "\Vfolder\Api_v2\Item";
$this->identity = new $identityClass();

$venue_ide = $_POST[1];
$filename = $_POST[2];
if($_POST[5] == 1){
$crop = true;
}else{
$crop = false;
}
if($_POST[6] == 1){
$resize = true;
}else{
$resize = false;
}
$config = [
'width' => $_POST[3],
'height' => $_POST[4],
'crop' =>$crop,
'resize'=>$resize
];
$flyer_type = "";
if(isset($_POST[8])){
$flyer_type = $_POST[8];
}
$params = [
'venue_ide'=>$venue_ide,
'filename'=>$filename,
'config'=>$config,
'type'=>$_POST[7],
'flyer_type'=>$flyer_type
];
//d($this, $request, $_POST, $venue_ide, $filename, $config, $params);

$this->response = \Vfolder\Api_v2\Item::getItem($params);
}else{
$this->identity = $identityClass::get($oauth_token);
// initialize output response
$this->response = new $responseClass();
}
//d($this->response);
}

/**
Expand All @@ -153,15 +194,20 @@ public function __construct($oauth_token = null)
* @return \Sky\Api\Response
*/
public static function call($path, $oauth_token, array $params = array())
{
{
// first check to make sure protocol is ok
if (!static::isProtocolOk()) {
return static::error(500, 'https_required', 'HTTPS is required.');
}
try {
$apiClass = get_called_class();
$o = $apiClass::init($oauth_token);
$ret = $o->apiCall($path, $params);
if(get_class($o) == "Vfolder\Api_v2"){
$ret = $o;
}else{
$ret = $o->apiCall($path, $params);
}
//d($ret);
return $ret;
} catch (\Exception $e) {
return static::error(500, 'internal_error', $e->getMessage(), $e);
Expand Down