ConfigurationAction.class.php (2574B)
1 <?php 2 3 namespace cms\action; 4 5 // OpenRat Content Management System 6 // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de 7 // 8 // This program is free software; you can redistribute it and/or 9 // modify it under the terms of the GNU General Public License 10 // as published by the Free Software Foundation; version 2. 11 // 12 // This program is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // GNU General Public License for more details. 16 // 17 // You should have received a copy of the GNU General Public License 18 // along with this program; if not, write to the Free Software 19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 21 use cms\base\DefaultConfig; 22 use util\exception\SecurityException; 23 use util\Session; 24 25 /** 26 * Action-Klasse fuer die Bearbeitung eines Template-Elementes. 27 * 28 * @author Jan Dankert 29 * @package openrat.actions 30 */ 31 class ConfigurationAction extends BaseAction 32 { 33 /** 34 * Konstruktor 35 */ 36 function __construct() 37 { 38 parent::__construct(); 39 } 40 41 42 43 /** 44 * Reads system configuration. 45 * @return array 46 */ 47 protected function getSystemConfiguration() 48 { 49 $conf['server'] = array('time' => date('r'), 50 'name' => php_uname(), 51 'os' => php_uname('s'), 52 'host' => php_uname('n'), 53 'release' => php_uname('r'), 54 'machine' => php_uname('m'), 55 'owner' => get_current_user(), 56 'pid' => getmypid()); 57 58 59 $conf['interpreter'] = array('version' => phpversion(), 60 'SAPI' => php_sapi_name(), 61 'session-name' => session_name(), 62 'magic_quotes_gpc' => @get_magic_quotes_gpc(), 63 'loaded_ini_file' => php_ini_loaded_file(), 64 'magic_quotes_runtime' => @get_magic_quotes_runtime()); 65 66 $conf['interpreter']['server'] = $_SERVER; 67 $conf['interpreter']['environment'] = $_ENV; 68 $conf['interpreter']['temp_dir'] = sys_get_temp_dir(); 69 70 $conf['interpreter']['configuration'] = ini_get_all(); 71 $conf['resources'] = getrusage(); 72 73 $extensions = get_loaded_extensions(); 74 asort($extensions); 75 76 foreach ($extensions as $id => $extensionName) 77 $conf['interpreter']['extension'][$extensionName] = 'loaded'; 78 79 return $conf; 80 } 81 82 83 /** 84 * User must be an administration. 85 */ 86 public function checkAccess() { 87 if ( ! $this->userIsAdmin() ) 88 throw new SecurityException(); 89 } 90 91 }