コード例 #1
0
 function actionPermissions()
 {
     $this->_oView->pageStart();
     $oAdmTools = new BxDolStudioTools();
     $sPermissionsStyles = $oAdmTools->generateStyles();
     ob_start();
     $bPermissionsOk = $oAdmTools->checkPermissions();
     $sPermissionsTable = ob_get_clean();
     $this->_oView->out('permissions.php', compact('sPermissionsStyles', 'sPermissionsTable', 'bPermissionsOk'));
     $this->_oView->setToolbarItem('question', 'http://www.boonex.com/trac/dolphin/wiki/DetailedInstall#InstallScript-Step1-Permissions', _t('_sys_inst_help_permissions'), '_blank');
     $this->_oView->pageEnd($this->_getTitle());
 }
コード例 #2
0
ファイル: cmd.php プロジェクト: blas-dmx/trident
 public function checkPermissions()
 {
     $oAdmTools = new BxDolStudioTools();
     $bPermissionsOk = $oAdmTools->checkPermissions(false, false);
     if (!$bPermissionsOk) {
         $this->finish($this->_aReturnCodes['permissions failed']['code'], $this->_aReturnCodes['permissions failed']['msg']);
     }
 }
コード例 #3
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;
     }
 }