public function __construct() { if (isset($GLOBALS['bxDolClasses'][get_class($this)])) { trigger_error('Multiple instances are not allowed for the class: ' . get_class($this), E_USER_ERROR); } parent::__construct(); $this->sKey = getParam('sys_oauth_key'); $this->sSecret = getParam('sys_oauth_secret'); $this->sDataRetrieveMethod = OAUTH_HTTP_METHOD_POST; }
public function __construct() { if (isset($GLOBALS['bxDolClasses'][get_class($this)])) { trigger_error('Multiple instances are not allowed for the class: ' . get_class($this), E_USER_ERROR); } parent::__construct(); $this->sKey = getParam('sys_oauth_key'); $this->sSecret = getParam('sys_oauth_secret'); $this->sDataRetrieveMethod = 'POST'; $this->sService = 'Dolphin'; $this->oStorage = new Session(); }
public function downloadFileAuthorized($iFileId) { bx_import('BxDolStudioOAuth'); $aItem = BxDolStudioOAuth::getInstance()->loadItems(array('dol_type' => 'product_file', 'dol_file_id' => $iFileId)); return $this->downloadFile($aItem); }
function __construct($sPage = "") { parent::__construct('store'); $this->oDb = new BxDolStudioStoreQuery(); $this->aAlias = array('tag' => array('modules' => 'extensions', 'languages' => 'translations'), 'category' => array()); $this->bAuthAccessUpdates = false; $this->sPage = BX_DOL_STUDIO_STR_TYPE_DEFAULT; if (is_string($sPage) && !empty($sPage)) { $this->sPage = $sPage; } bx_import('BxDolStudioOAuth'); $this->iClient = BxDolStudioOAuth::getAuthorizedClient(); //--- Check actions ---// if (($sAction = bx_get('str_action')) !== false) { $sAction = bx_process_input($sAction); $aResult = array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => _t('_adm_mod_err_cannot_process_action')); switch ($sAction) { case 'get-file': $iFileId = (int) bx_get('str_id'); $aResult = $this->getFile($iFileId); break; case 'get-product': $sModuleName = bx_process_input(bx_get('str_id')); $aResult = $this->getProduct($sModuleName); break; case 'get-update': $sModuleName = bx_process_input(bx_get('str_id')); $aResult = $this->getUpdate($sModuleName); break; case 'get-update-and-install': $sModuleName = bx_process_input(bx_get('str_id')); $aResult = $this->getUpdate($sModuleName, true); break; case 'get-products-by-type': $this->sPage = bx_process_input(bx_get('str_value')); $sContent = $this->getPageCode(); if (!empty($sContent)) { $aResult = array('code' => BX_DOL_STUDIO_IU_RC_SUCCESS, 'content' => $sContent); } else { $aResult = array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => _t('_adm_act_err_failed_page_loading')); } break; case 'get-products-by-page': $this->sPage = bx_process_input(bx_get('str_type')); $sContent = $this->getPageContent(); if (!empty($sContent)) { $aResult = array('code' => BX_DOL_STUDIO_IU_RC_SUCCESS, 'content' => $sContent); } else { $aResult = array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => _t('_adm_act_err_failed_page_loading')); } break; case 'add-to-cart': $sVendor = bx_process_input(bx_get('str_vendor')); $iItem = (int) bx_get('str_item'); $iItemCount = 1; if (empty($sVendor) || empty($iItem)) { $aResult = array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => _t('_adm_err_modules_cannot_add_to_cart')); break; } bx_import('BxDolStudioCart'); BxDolStudioCart::getInstance()->add($sVendor, $iItem, $iItemCount); $aResult = array('code' => BX_DOL_STUDIO_IU_RC_SUCCESS, 'message' => _t('_adm_msg_modules_success_added_to_cart')); break; case 'delete-from-cart': $sVendor = bx_process_input(bx_get('str_vendor')); $iItem = (int) bx_get('str_item'); if (empty($sVendor)) { $aResult = array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => _t('_adm_err_modules_cannot_delete_from_cart')); break; } bx_import('BxDolStudioCart'); BxDolStudioCart::getInstance()->delete($sVendor, $iItem); $aResult = array('code' => BX_DOL_STUDIO_IU_RC_SUCCESS, 'message' => ''); break; case 'checkout-cart': $sVendor = bx_process_input(bx_get('str_vendor')); if (empty($sVendor)) { $aResult = array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => _t('_adm_err_modules_cannot_checkout_empty_vendor')); break; } $sLocation = $this->checkoutCart($sVendor); $aResult = array('code' => BX_DOL_STUDIO_IU_RC_SUCCESS, 'message' => '', 'redirect' => $sLocation); break; case 'install': $sValue = bx_process_input(bx_get('str_value')); if (empty($sValue)) { break; } $aResult = BxDolStudioInstallerUtils::getInstance()->perform($sValue, 'install', array('auto_enable' => true, 'html_response' => true)); break; case 'update': $sValue = bx_process_input(bx_get('str_value')); if (empty($sValue)) { break; } $aResult = BxDolStudioInstallerUtils::getInstance()->perform($sValue, 'update', array('html_response' => true)); break; case 'delete': $sValue = bx_process_input(bx_get('str_value')); if (empty($sValue)) { break; } $aResult = BxDolStudioInstallerUtils::getInstance()->perform($sValue, 'delete', array('html_response' => true)); break; } if (!empty($aResult['message'])) { bx_import('BxDolStudioTemplate'); $aResult['message'] = BxDolStudioTemplate::getInstance()->parseHtmlByName('mod_action_result.html', array('content' => $aResult['message'])); bx_import('BxTemplStudioFunctions'); $aResult['message'] = BxTemplStudioFunctions::getInstance()->transBox('', $aResult['message']); } echo json_encode($aResult); exit; } }
protected function loadFiles($iId, $sType) { bx_import('BxDolStudioOAuth'); return BxDolStudioOAuth::getInstance()->loadItems(array('dol_type' => 'product_files', 'dol_product_id' => $iId, 'dol_file_type' => $sType)); }