Exemplo n.º 1
0
 function __construct($sPage = "")
 {
     parent::__construct('builder_menus');
     $this->oDb = new BxDolStudioNavigationQuery();
     $this->sPage = BX_DOL_STUDIO_NAV_TYPE_DEFAULT;
     if (is_string($sPage) && !empty($sPage)) {
         $this->sPage = $sPage;
     }
     //--- Check actions ---//
     if (($sAction = bx_get('nav_action')) !== false) {
         $sAction = bx_process_input($sAction);
         $aResult = array('code' => 1, 'message' => _t('_adm_nav_err_cannot_process_action'));
         switch ($sAction) {
             case 'get-page-by-type':
                 $sValue = bx_process_input(bx_get('nav_value'));
                 if (empty($sValue)) {
                     break;
                 }
                 $this->sPage = $sValue;
                 $aResult = array('code' => 0, 'content' => $this->getPageCode());
                 break;
             default:
                 $sMethod = 'action' . $this->getClassName($sAction);
                 if (method_exists($this, $sMethod)) {
                     $aResult = $this->{$sMethod}();
                 }
         }
         echo json_encode($aResult);
         exit;
     }
 }
 function __construct($sPage = "")
 {
     parent::__construct('builder_permissions');
     $this->oDb = new BxDolStudioPermissionsQuery();
     $this->sPage = BX_DOL_STUDIO_PRM_TYPE_DEFAULT;
     if (is_string($sPage) && !empty($sPage)) {
         $this->sPage = $sPage;
     }
     //--- Check actions ---//
     if (($sAction = bx_get('pgt_action')) !== false) {
         $sAction = bx_process_input($sAction);
         $aResult = array('code' => 1, 'message' => _t('_adm_pgt_err_cannot_process_action'));
         switch ($sAction) {
             case 'get-page-by-type':
                 $sValue = bx_process_input(bx_get('pgt_value'));
                 if (empty($sValue)) {
                     break;
                 }
                 $this->sPage = $sValue;
                 $aResult = array('code' => 0, 'content' => $this->getPageCode());
                 break;
         }
         echo json_encode($aResult);
         exit;
     }
 }
Exemplo n.º 3
0
 function __construct($sType = '', $sCategory = '')
 {
     parent::__construct('settings');
     $this->oDb = new BxDolStudioSettingsQuery();
     $this->sType = BX_DOL_STUDIO_STG_TYPE_DEFAULT;
     if (is_string($sType) && !empty($sType)) {
         $this->sType = $sType;
     }
     $this->sCategory = '';
     if (is_string($sCategory) && !empty($sCategory)) {
         $this->sCategory = $sCategory;
     }
     //--- Check actions ---//
     if (($sAction = bx_get('stg_action')) !== false && ($sValue = bx_get('stg_value')) !== false) {
         $sAction = bx_process_input($sAction);
         $sValue = bx_process_input($sValue);
         $aResult = array('code' => 0, 'message' => '');
         if (!empty($sAction) && !empty($sValue)) {
             switch ($sAction) {
                 case 'get-page-by-type':
                     $this->sType = $sValue;
                     $aResult['content'] = $this->getPageCode();
                     break;
             }
             echo json_encode($aResult);
         }
         exit;
     }
 }
Exemplo n.º 4
0
 function __construct($sPage = "")
 {
     parent::__construct('builder_permissions');
     $this->oDb = new BxDolStudioPermissionsQuery();
     $this->sPage = BX_DOL_STUDIO_PRM_TYPE_DEFAULT;
     if (is_string($sPage) && !empty($sPage)) {
         $this->sPage = $sPage;
     }
 }
Exemplo n.º 5
0
 function __construct($sPage = "")
 {
     parent::__construct('builder_menus');
     $this->oDb = new BxDolStudioNavigationQuery();
     $this->sPage = BX_DOL_STUDIO_NAV_TYPE_DEFAULT;
     if (is_string($sPage) && !empty($sPage)) {
         $this->sPage = $sPage;
     }
 }
Exemplo n.º 6
0
 function __construct($sPage = "")
 {
     parent::__construct('polyglot');
     $this->oDb = new BxDolStudioPolyglotQuery();
     $this->sPage = BX_DOL_STUDIO_PGT_TYPE_DEFAULT;
     if (is_string($sPage) && !empty($sPage)) {
         $this->sPage = $sPage;
     }
 }
Exemplo n.º 7
0
 function __construct($sModule = "", $sPage = "")
 {
     parent::__construct($sModule);
     $this->oDb = new BxDolStudioModulesQuery();
     $this->sPageRssHelpObject = 'sys_studio_module_help';
     $this->sModule = '';
     if (is_string($sModule) && !empty($sModule)) {
         $this->sModule = $sModule;
     }
     $this->sPage = $this->sPageDefault;
     if (is_string($sPage) && !empty($sPage)) {
         $this->sPage = $sPage;
     }
 }
Exemplo n.º 8
0
 public function __construct($mixedPageName)
 {
     parent::__construct($mixedPageName);
     $this->oDb = BxDolStudioWidgetsQuery::getInstance();
     $this->aWidgets = array();
     $this->aWidgetsNotices = array();
     if (!$this->bPageMultiple) {
         $this->oDb->getWidgets(array('type' => 'by_page_id', 'value' => $this->aPage['id']), $this->aWidgets, false);
     } else {
         foreach ($this->aPage as $sPage => $aPage) {
             $this->aWidgets[$sPage] = array();
             $this->oDb->getWidgets(array('type' => 'by_page_id', 'value' => $aPage['id']), $this->aWidgets[$sPage], false);
         }
     }
     //--- Load Cache (Widgets' Notices)
     $oCache = $this->oDb->getDbCacheObject();
     $sCacheKey = $this->oDb->genDbCacheKey($this->sCacheKeyNotices);
     $this->aWidgetsNotices = $oCache->getData($sCacheKey);
 }
Exemplo n.º 9
0
 function __construct($sPage = "")
 {
     parent::__construct('designer');
     $this->oDb = new BxDolStudioDesignerQuery();
     $this->sPage = BX_DOL_STUDIO_DSG_TYPE_DEFAULT;
     if (is_string($sPage) && !empty($sPage)) {
         $this->sPage = $sPage;
     }
     //--- Check actions ---//
     if (($sAction = bx_get('dsg_action')) !== false) {
         $sAction = bx_process_input($sAction);
         $aResult = array('code' => 1, 'message' => _t('_adm_dsg_err_cannot_process_action'));
         switch ($sAction) {
             case 'delete_logo':
                 $aResult = array('code' => 0, 'message' => '');
                 if (!$this->deleteLogo()) {
                     $aResult = array('code' => 2, 'message' => _t('_adm_dsg_err_remove_old_logo'));
                 }
                 break;
             case 'make_default':
                 $aResult = array('code' => 0, 'message' => '');
                 if (!$this->makeDefault()) {
                     $aResult = array('code' => 2, 'message' => _t('_adm_dsg_err_make_default'));
                 }
                 break;
             case 'get-page-by-type':
                 $sValue = bx_process_input(bx_get('dsg_value'));
                 if (empty($sValue)) {
                     break;
                 }
                 $this->sPage = $sValue;
                 $aResult = array('code' => 0, 'content' => $this->getPageCode());
                 break;
         }
         echo json_encode($aResult);
         exit;
     }
 }
Exemplo n.º 10
0
 function __construct($sTemplate = "", $sPage = "")
 {
     parent::__construct($sTemplate);
     $this->oDb = new BxDolStudioDesignsQuery();
     $this->sTemplate = BX_DOL_STUDIO_TEMPL_DEFAULT;
     if (is_string($sTemplate) && !empty($sTemplate)) {
         $this->sTemplate = $sTemplate;
     }
     $this->sPage = BX_DOL_STUDIO_TEMPL_TYPE_DEFAULT;
     if (is_string($sPage) && !empty($sPage)) {
         $this->sPage = $sPage;
     }
     //--- Check actions ---//
     if (($sAction = bx_get('templ_action')) !== false) {
         $sAction = bx_process_input($sAction);
         $aResult = array('code' => 1, 'message' => _t('_adm_dsg_err_cannot_process_action'));
         switch ($sAction) {
             case 'activate':
                 $sValue = bx_process_input(bx_get('templ_value'));
                 if (empty($sValue)) {
                     break;
                 }
                 $aResult = $this->activate($sValue);
                 break;
         }
         echo json_encode($aResult);
         exit;
     }
     $this->aTemplate = BxDolModuleQuery::getInstance()->getModuleByName($this->sTemplate);
     if (empty($this->aTemplate) || !is_array($this->aTemplate)) {
         BxDolStudioTemplate::getInstance()->displayPageNotFound();
     }
     $this->aPage['header'] = $this->aTemplate['title'];
     $this->aPage['caption'] = $this->aTemplate['title'];
     $this->addAction(array('type' => 'switcher', 'name' => 'activate', 'caption' => '_adm_txt_pca_active', 'checked' => (int) $this->aTemplate['enabled'] == 1, 'onchange' => "javascript:" . $this->getPageJsObject() . ".activate('" . $this->sTemplate . "', this)"), false);
 }
Exemplo n.º 11
0
 protected function getModuleIcon($sName, $sType = 'menu', $bReturnAsUrl = true)
 {
     $sResult = '';
     switch ($sName) {
         case BX_DOL_STUDIO_MODULE_SYSTEM:
             $sResult = 'cog';
             break;
         case BX_DOL_STUDIO_MODULE_CUSTOM:
             $sResult = 'wrench';
             break;
         case BX_DOL_STUDIO_BP_SKELETONS:
             $sResult = 'qrcode';
             break;
         default:
             $sResult = parent::getModuleIcon($sName, $sType, $bReturnAsUrl);
     }
     return $sResult;
 }
Exemplo n.º 12
0
 function __construct($sPage = "")
 {
     parent::__construct('polyglot');
     $this->oDb = new BxDolStudioPolyglotQuery();
     $this->sPage = BX_DOL_STUDIO_PGT_TYPE_DEFAULT;
     if (is_string($sPage) && !empty($sPage)) {
         $this->sPage = $sPage;
     }
     //--- Check actions ---//
     if (($sAction = bx_get('pgt_action')) !== false) {
         $sAction = bx_process_input($sAction);
         bx_import('BxDolStudioLanguagesUtils');
         $oLanguages = BxDolStudioLanguagesUtils::getInstance();
         $aResult = array('code' => 1, 'message' => _t('_adm_pgt_err_cannot_process_action'));
         switch ($sAction) {
             case 'get-page-by-type':
                 $sValue = bx_process_input(bx_get('pgt_value'));
                 if (empty($sValue)) {
                     break;
                 }
                 $this->sPage = $sValue;
                 $aResult = array('code' => 0, 'content' => $this->getPageCode());
                 break;
                 /*
                  * Available URL params:
                  * pgt_action = recompile - action name
                  * pgt_language - ID or name(en, ru, etc) of language.
                  */
             /*
              * Available URL params:
              * pgt_action = recompile - action name
              * pgt_language - ID or name(en, ru, etc) of language.
              */
             case 'recompile':
                 $sLanguage = bx_process_input(bx_get('pgt_language'));
                 if ($oLanguages->compileLanguage($sLanguage)) {
                     $aResult = array('code' => 0, 'content' => _t('_adm_pgt_scs_recompiled'));
                 } else {
                     $aResult = array('code' => 2, 'content' => _t('_adm_pgt_err_cannot_recompile_lang'));
                 }
                 break;
                 /*
                  * Available URL params:
                  * pgt_action = restore - action name
                  * pgt_language - ID or name(en, ru, etc) of language.
                  * pgt_module - ID or Module Uri (@see sys_modules table). Leave empty for 'System' language file.
                  */
             /*
              * Available URL params:
              * pgt_action = restore - action name
              * pgt_language - ID or name(en, ru, etc) of language.
              * pgt_module - ID or Module Uri (@see sys_modules table). Leave empty for 'System' language file.
              */
             case 'restore':
                 $sLanguage = bx_process_input(bx_get('pgt_language'));
                 $sModule = bx_process_input(bx_get('pgt_module'));
                 if ($oLanguages->restoreLanguage($sLanguage, $sModule)) {
                     $aResult = array('code' => 0, 'content' => _t('_adm_pgt_scs_restored'));
                 } else {
                     $aResult = array('code' => 2, 'content' => _t('_adm_pgt_err_cannot_restore_lang'));
                 }
                 break;
         }
         echo json_encode($aResult);
         exit;
     }
 }
Exemplo n.º 13
0
 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;
     }
 }
Exemplo n.º 14
0
 function __construct()
 {
     parent::__construct('dashboard');
     $this->oDb = new BxDolStudioDashboardQuery();
     $this->aBlocks = array('space' => 'serviceGetBlockSpace', 'htools' => 'serviceGetBlockHostTools');
     $this->aItemsCache = array(array('name' => 'all'), array('name' => 'db'), array('name' => 'template'), array('name' => 'css'), array('name' => 'js'));
     $this->aItemsHTools = array('PHP' => 'requirementsPHP', 'MySQL' => 'requirementsMySQL', 'Web Server' => 'requirementsWebServer');
     //--- Check actions ---//
     if (($sAction = bx_get('dbd_action')) !== false) {
         $sAction = bx_process_input($sAction);
         $aResult = array('code' => 1, 'message' => _t('_adm_err_cannot_process_action'));
         switch ($sAction) {
             case 'get_block':
                 $sValue = bx_get('dbd_value');
                 if ($sValue === false) {
                     break;
                 }
                 $sValue = bx_process_input($sValue);
                 if (!isset($this->aBlocks[$sValue])) {
                     break;
                 }
                 $aBlock = $this->{$this->aBlocks[$sValue]}(false);
                 if (!empty($aBlock['content'])) {
                     $aResult = array('code' => 0, 'data' => $aBlock['content']);
                 }
                 break;
             case 'check_for_upgrade':
                 $aResult = array('code' => 0, 'data' => $this->getPageCodeVersionAvailable());
                 break;
             case 'perform_upgrade':
                 $oUpgrader = bx_instance('BxDolUpgrader');
                 if (!$oUpgrader->prepare()) {
                     $aResult = array('code' => 1, 'message' => $oUpgrader->getError());
                 } else {
                     $aResult = array('code' => 0, 'message' => _t('_adm_dbd_msg_upgrade_started'));
                 }
                 break;
             case 'clear_cache':
                 $sValue = bx_get('dbd_value');
                 if ($sValue === false) {
                     break;
                 }
                 $sValue = bx_process_input($sValue);
                 $oCacheUtilities = BxDolCacheUtilities::getInstance();
                 switch ($sValue) {
                     case 'all':
                         $aResult = false;
                         foreach ($this->aItemsCache as $aItem) {
                             if ($aItem['name'] == 'all') {
                                 continue;
                             }
                             $aResultClear = $oCacheUtilities->clear($aItem['name']);
                             if ($aResultClear === false) {
                                 continue;
                             }
                             $aResult = $aResultClear;
                             if (isset($aResult['code']) && $aResult['code'] != 0) {
                                 break;
                             }
                         }
                         break;
                     case 'db':
                     case 'template':
                     case 'css':
                     case 'js':
                         $aResult = $oCacheUtilities->clear($sValue);
                         break;
                     default:
                         $aResult = array('code' => 1, 'message' => _t('_Error Occured'));
                 }
                 if ($aResult === false) {
                     $aResult['data'] = MsgBox(_t('_adm_dbd_msg_c_all_disabled'));
                 } else {
                     if (isset($aResult['code']) && $aResult['code'] == 0) {
                         $aResult['data'] = $this->getCacheChartData(false);
                     }
                 }
                 break;
             case 'permissions':
                 $oAdmTools = new BxDolStudioTools();
                 header('Content-type: text/html; charset=utf-8');
                 echo $oAdmTools->generateStyles();
                 $oAdmTools->checkPermissions();
                 exit;
             case 'server_audit':
                 $oAudit = new BxDolStudioToolsAudit();
                 header('Content-type: text/html; charset=utf-8');
                 echo $oAudit->generate();
                 exit;
         }
         if (!empty($aResult['message'])) {
             $aResult['message'] = BxDolStudioTemplate::getInstance()->parseHtmlByName('page_action_result.html', array('content' => $aResult['message']));
             $aResult['message'] = BxTemplStudioFunctions::getInstance()->transBox('', $aResult['message']);
         }
         echo json_encode($aResult);
         exit;
     }
 }