Exemplo n.º 1
0
 function OA_Upgrade_Config()
 {
     $this->oSettings = new OA_Admin_Settings();
     $this->aConfig =& $this->oSettings->getConfigArray();
     // set default configPath
     $this->configPath = MAX_PATH . '/var/';
     if (!OA_Admin_Settings::isConfigWritable()) {
         return false;
     }
 }
 function __construct()
 {
     $this->oSettings = new OA_Admin_Settings();
     // Use reference here
     $this->aConfig =& $this->oSettings->getConfigArray();
     // set default configPath
     $this->configPath = MAX_PATH . '/var/';
     if (!OA_Admin_Settings::isConfigWritable()) {
         return false;
     }
 }
 function init()
 {
     $aConf = $GLOBALS['_MAX']['CONF'];
     $this->pathPackages = $aConf['pluginPaths']['packages'];
     $this->pathPlugins = $aConf['pluginPaths']['plugins'];
     $this->pathPluginsAdmin = $aConf['pluginPaths']['admin'];
     $this->pathDataObjects = $aConf['pluginPaths']['var'] . 'DataObjects/';
     // Attempt to increase the memory limit when using the plugin manager
     OX_increaseMemoryLimit(OX_getMinimumRequiredMemory('plugin'));
     $this->basePath = MAX_PATH;
     $this->configLocked = !OA_Admin_Settings::isConfigWritable();
 }
 function testIsConfigWritable()
 {
     $oConf = new OA_Admin_Settings(true);
     // 1) Test we can write to an existing file.
     $path = $this->basePath;
     $filename = 'oa_test_' . rand() . '.conf.php';
     $fp = fopen($path . '/' . $filename, 'w');
     fwrite($fp, 'foo');
     fclose($fp);
     $this->assertTrue($oConf->isConfigWritable($path . '/' . $filename));
     unlink($path . '/' . $filename);
     // 2) A non-existing file in an unwriteable location.
     $this->assertFalse($oConf->isConfigWritable($this->basePath . '/non_existent_dir/non_existent_file'));
     /**
      * @todo Test fails when running the test as root
      */
     // 3) An existing file we don't have write permission for.
     $path = $this->basePath;
     $filename = 'oa_test_' . rand() . '.conf.php';
     $fp = fopen($path . '/' . $filename, 'w');
     fwrite($fp, 'foo');
     fclose($fp);
     chmod($path . '/' . $filename, 0400);
     $this->assertFalse($oConf->isConfigWritable($path . '/' . $filename));
     chmod($path . '/' . $filename, 0700);
     unlink($path . '/' . $filename);
     // 4) An empty directory we can write to.
     $this->assertTrue($oConf->isConfigWritable($this->basePath . '/non_existent_file'));
     /**
      * @todo Test fails when running the test as root or on Windows
      */
     // 5) An empty directory we cannot write to.
     $path = $this->basePath;
     $dirname = 'oa_test_' . rand();
     mkdir($path . '/' . $dirname);
     chmod($path . '/' . $dirname, 00);
     $this->assertFalse($oConf->isConfigWritable($path . '/' . $dirname . '/non_existent_file'));
     chmod($path . '/' . $dirname, 0700);
     rmdir($path . '/' . $dirname);
 }
Exemplo n.º 5
0
}
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
phpAds_PageHeader("plugin-index", new OA_Admin_UI_Model_PageHeaderModel($GLOBALS['strPlugins']), '', false, true);
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
if (is_null($oTpl)) {
    if (array_key_exists('selection', $_REQUEST) && $_REQUEST['selection'] == 'groups') {
        $oTpl = new OA_Admin_Template('plugin-group-index-list.html');
        $oTpl->assign('aWarnings', $oComponentGroupManager->aWarnings);
        $oTpl->assign('selected', 'groups');
        $oTpl->assign('aPlugins', $oComponentGroupManager->getComponentGroupsList());
    } else {
        $oTpl = new OA_Admin_Template('plugin-index.html');
        $oTpl->assign('selected', 'plugins');
        $oTpl->assign('aPackages', $oPluginManager->getPackagesList());
        $oTpl->assign('aWarnings', $oPluginManager->aWarnings);
        $oTpl->assign('aErrors', $oPluginManager->aErrors);
        $oTpl->assign('aMessages', $oPluginManager->aMessages);
    }
}
// Determine if config file is writable
$configLocked = !OA_Admin_Settings::isConfigWritable();
$image = $configLocked ? 'closed' : 'open';
$oTpl->assign('configLocked', $configLocked);
$oTpl->assign('image', $image);
$oTpl->assign('token', phpAds_SessionGetToken());
$oTpl->display();
phpAds_PageFooter();
Exemplo n.º 6
0
 function writeDefaultConfigFile($configPath, $configFile, $newHost)
 {
     $file = $configPath . '/default' . $configFile . '.conf.php';
     if (!OA_Admin_Settings::isConfigWritable($file)) {
         return false;
     }
     $aConfig = array('realConfig' => $newHost);
     $oConfig = new Config();
     $oConfigContainer =& $oConfig->parseConfig($aConfig, 'phpArray');
     $oConfigContainer->createComment('*** DO NOT REMOVE THE LINE ABOVE ***', 'top');
     $oConfigContainer->createComment('<' . '?php exit; ?>', 'top');
     return $oConfig->writeConfig($file, 'IniCommented');
 }
Exemplo n.º 7
0
 /**
  * A private method to determine if a setting configuration file option item should be
  * disabled or not, based on the state of settings configuration file (i.e. if the file
  * be written to, or not).
  *
  * @access private
  * @param array $aItem An array of the option item.
  * @return boolean True if the option should be disabled, false otherwise.
  */
 function _disabledValue($aItem)
 {
     if ($this->_optionType == 'account-settings') {
         $aConf = $GLOBALS['_MAX']['CONF'];
         if (OA_INSTALLATION_STATUS == OA_INSTALLATION_STATUS_INSTALLED && isset($aItem['name'])) {
             $aNameExploded = explode('_', $aItem['name']);
             $aSettingSection = isset($aNameExploded[0]) ? $aNameExploded[0] : null;
             $aSettingKey = isset($aNameExploded[1]) ? $aNameExploded[1] : null;
             if (isset($aConf[$aSettingSection][$aSettingKey]) && !OA_Admin_Settings::isConfigWritable()) {
                 return true;
             }
         }
     }
     return false;
 }