/** * Create a new configuration repository. * * @param string $path * @return void */ public function __construct($path = null) { if (!$path) { $path = PATH_ROOT; } $this->file = $path . DS . 'configuration.php'; if ($this->file) { $data = $this->read($this->file); $data = \Hubzero\Utility\Arr::fromObject($data); $config = array(); foreach ($data as $key => $value) { foreach ($this->map as $group => $values) { if (!isset($config[$group])) { $config[$group] = array(); } if (in_array($key, $values)) { $config[$group][$key] = $value; } } } parent::__construct($config); } }
/** * Method to unset the root_user value from configuration data. * * This method will load the global configuration data straight from * JConfig and remove the root_user value for security, then save the configuration. * * @return boolean * @since 1.6 */ public function removeroot() { // Get the previous configuration. $prev = new JConfig(); $prev = \Hubzero\Utility\Arr::fromObject($prev); // Create the new configuration object, and unset the root_user property unset($prev['root_user']); $config = new Registry($prev); // Write the configuration file. return $this->writeConfigFile($config); }
/** * Display session information. * * Called recursive. * * @param string $key A session key * @param mixed $session The session array, initially null * @param integer $id The id is used for JS toggling the div * @return string */ protected function displaySession($key = '', $session = null, $id = 0) { if (!$session) { $session = $_SESSION; } static $html = ''; static $id; if (!is_array($session)) { $html .= $key . ' ⇒' . $session . PHP_EOL; } else { foreach ($session as $sKey => $entries) { $display = true; if ($sKey == 'password_clear') { continue; } if (is_array($entries) && $entries) { $display = false; } if (is_object($entries)) { $o = \Hubzero\Utility\Arr::fromObject($entries); if ($o) { $entries = $o; $display = false; } } if (!$display) { $html .= '<div class="debug-sub-container">'; $id++; // Recurse... $this->displaySession($sKey, $entries, $id); $html .= '</div>'; continue; } if (is_array($entries)) { $entries = implode($entries); } if (is_string($entries)) { $html .= '<code>'; $html .= '<span class="ky">' . $sKey . '</span> <span class="op">⇒</span> <span class="vl">' . $entries . '</span><br />'; $html .= '</code>'; } } } return $html; }