Exemple #1
0
 public function construct()
 {
     $configuration = $this->configuration;
     // Get RedBeanPHP.
     require_once 'plugins/RedBeanORM/resources/rb.php';
     // Setup ReadBeanPHP.
     if (empty($this->dsn)) {
         $db_settings = PU_GetDBSettings($configuration);
         R::setup("mysql:host={$db_settings['host']};dbname={$db_settings['database']}", $db_settings['username'], $db_settings['password'], $configuration['production']);
     } else {
         R::setup($this->dsn);
     }
 }
Exemple #2
0
function checkConfigFiles()
{
    global $data;
    global $errors;
    $configFolder = '../../config/';
    $config_file = $configFolder . $data['config_file'];
    // Can we load the configuration file?
    if (!file_exists($config_file)) {
        addError('config_file', sprintf(_('The configuration file (%s) could not be read or found. Have you renamed the configuration file as specified in the readme file?'), $config_file));
    } else {
        // Include the config file.
        include_once $configFolder . 'PHPDS-defaults.config.php';
        @(include_once $configFolder . 'single-site.config.php');
        require_once $config_file;
        $db_settings = PU_GetDBSettings($configuration);
        // Check if we have a matching configuration file.
        if ($data['db_name'] != $db_settings['database']) {
            addError('db_name', _('Mismatching database name with the one provided in the config.php file.'));
        }
        if ($data['db_username'] != $db_settings['username']) {
            addError('db_username', _('Mismatching database username with the one provided in the config.php file.'));
        }
        if ($data['db_password'] != $db_settings['password']) {
            addError('db_password', _('Mismatching database password with the one provided in the config.php file.'));
        }
        if ($data['db_server'] != $db_settings['host']) {
            addError('db_server', _('Mismatching database server address (host) with the one provided in the config.php file.'));
        }
        if ($data['db_prefix'] != $db_settings['prefix']) {
            addError('db_prefix', _('Mismatching database prefix with the one provided in the config.php file.'));
        }
        // Check if folders are writable.
        if (!empty($configuration['session_path']) && !is_writeable('../../' . $configuration['session_path'])) {
            addError(kConfigSessionPath, sprintf(_('Your session path or "write" directory (%s) is currently not writable, please check the readme/install file for instructions.'), '../../' . $configuration['session_path']));
        }
        if (!is_writeable('../../' . $configuration['compile_path'])) {
            addError(kConfigDBCompilePath, sprintf(_('Your compile path or "write" directory (%s) is currently not writable, please check the readme/install file for instructions.'), '../../' . $configuration['compile_path']));
        }
    }
    return count($errors) == 0;
}
 /**
  * Sets the configuration settings for this connector as per the configuration file.
  *
  * @date		20120321
  * @version		1.0
  * @author		Don Schoeman
  */
 private function applyConfig($db_config = '')
 {
     $db = $this->db;
     // Retrieve all the database settings
     $db_settings = PU_GetDBSettings($this->configuration, $db_config);
     // For backwards compatibility, set the database class's parameters here as we don't know if anyone references
     // db's properties somewhere else
     $db->server = $db_settings['host'];
     $db->dbName = $db_settings['database'];
     $db->dbUsername = $db_settings['username'];
     $db->dbPassword = $db_settings['password'];
     // Set our own internal properties for faster access and better accessibility.
     $this->dbDSN = $db_settings['dsn'];
     $this->dbHost = $db_settings['host'];
     $this->dbName = $db_settings['database'];
     $this->dbUsername = $db_settings['username'];
     $this->dbPassword = $db_settings['password'];
     $this->dbPersistent = $db_settings['persistent'];
     $this->dbPrefix = $db_settings['prefix'];
     $this->dbCharset = $db_settings['charset'];
 }
Exemple #4
0
</p>
			</blockquote>


			<h2>The configuration</h2>
			<h3>Configuration files actually used:</h3>
			<?php 
        echo $conf['used'];
        ?>
			<h3>Configuration files which would have been used if they were present:</h3>
			<?php 
        echo $conf['missing'];
        ?>
			<h3>Main database info</h3>
			<?php 
        $db_settings = PU_GetDBSettings($config);
        echo "<p>Database <i>{$db_settings['database']}</i> with prefix <i>{$db_settings['prefix']}</i> on host <i>{$db_settings['host']}</i> with user <i>{$db_settings['username']}</i>.</p>";
        ?>
			<h3>Other useful configuration settings</h3>
			<?php 
        echo '<p>Sef URL is <i>' . ($config['sef_url'] ? 'on' : 'off') . '</i> ; default template is ' . ($config['default_template'] ? '<i>' . $config['default_template'] . '</i>' : '<b>not set</b>') . '.</p>';
        echo '<p>Guest role  is ' . (empty($config['guest_role']) ? '<b>not set</b>' : '<i>' . $config['guest_role'] . '</i>') . ' ; guest group is ' . (empty($config['guest_group']) ? '<b>not set</b>' : '<i>' . $config['guest_group'] . '</i>') . '.</p>';
        list($plugin, $menu_link) = $this->navigation->menuPath();
        echo empty($plugin) ? '<p>No plugin currently selected</p>' : '<p>Current plugin is <strong>' . $plugin . '</strong> (path is ' . $menu_link . ')</p>';
        ?>

			<h2>The Backtrace:</h2>
			<p>All relative file pathes are relative to the server root (namely <tt><?php 
        echo $_SERVER['DOCUMENT_ROOT'];
        ?>
/ )</tt></p>