noalyss Version-9
admin_repo.inc.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19// Copyright Author Dany De Bontridder danydb@aevalys.eu
20/*!
21 *\file
22 *\brief Administration of the repository : creation of user, folder, security,
23 * templates... Accessible only by the administrator
24 */
25if ( ! defined ('ALLOWED')) { die (_('Non autorisé'));}
26if ( ! defined ('ALLOWED_ADMIN')) { die (_('Non autorisé'));}
28include_once NOALYSS_INCLUDE . "/class/noalyss_user.class.php";
29require_once NOALYSS_INCLUDE."/lib/user_common.php";
30include_once NOALYSS_INCLUDE."/lib/ac_common.php";
31require_once NOALYSS_INCLUDE."/lib/user_menu.php";
33$action = $http->request("action","string", "");
34
36$User=new Noalyss_user($rep);
37$User->Check();
38
39
40if ($User->admin != 1)
41{
42 $theme=(isset($User->theme))?$User->theme:"";
43 html_page_start($theme);
44 echo "<h2 class=\"warning\">";
45 echo _("Vous n'êtes pas administateur");
46 echo "</h2>";
47 $reconnect=http_build_query(array("reconnect"=>1,"backurl"=>"admin-noalyss.php?action=upgrade"));
48 echo '<a href="'.NOALYSS_URL.'/index.php?'.$reconnect.'">';
49 echo _("Connectez-vous comme administrateur");
50 echo '</a>';
52 return;
53}
54// For a backup , we must avoid to send anything before the
55// dump file
56if ( $action== 'backup') {
57 /* take backup */
58 require_once NOALYSS_INCLUDE."/backup.inc.php";
59 exit();
60}
61html_page_start($_SESSION[SESSION_KEY.'g_theme']);
63echo '<H2 class="info w100"> '._('Administration').'</H2>';
64echo '<div class="topmenu">';
65
66echo MenuAdmin()."</div>";
67
68?>
69<DIV >
70<?php
71echo js_include("admin.js");
72if ( $action=="user_mgt" )
73{
74 //----------------------------------------------------------------------
75 // User management
76 //----------------------------------------------------------------------
77 require_once NOALYSS_INCLUDE."/user.inc.php";
78}
79// action=user_mgt
80if ( $action=="dossier_mgt")
81{
82 //-----------------------------------------------------------------------
83 // action = dossier_mgt
84 //-----------------------------------------------------------------------
85 require_once NOALYSS_INCLUDE."/dossier.inc.php";
86}
87if ( $action== "modele_mgt" )
88{
89 //-----------------------------------------------------------------------
90 // Template Management
91 //-----------------------------------------------------------------------
92 require_once NOALYSS_INCLUDE."/modele.inc.php";
93} // action is set
94if ( $action== 'restore')
95{
96 // Backup and restaure folders
97 require_once NOALYSS_INCLUDE."/restore.inc.php";
98}
99if ($action== 'audit_log')
100{
101 /* List the connexion successfull and failed */
102 require_once NOALYSS_INCLUDE."/audit_log.php";
103}
104/*
105 * Display information about current installation
106 */
107if ( $action == "info" && SYSINFO_DISPLAY == true) {
108 global $version_noalyss;
109 echo "<h2>"._("Version Noalyss")."</h2>";
110 echo "Noalyss : ", $version_noalyss;
111
112 echo "<h2>"._('Variables').":".NOALYSS_INCLUDE.'/config.inc.php </h2>';
113 echo '<ul style="list-style:square">';
114 echo "<li>". "NOALYSS_HOME".": ".NOALYSS_HOME."</li>";
115 echo "<li>"."NOALYSS_INCLUDE".": ".NOALYSS_INCLUDE."</li>";
116 echo "<li>"."NOALYSS_TEMPLATE".": ".NOALYSS_TEMPLATE."</li>";
117 echo "<li>"."DEBUG".": ".DEBUGNOALYSS."</li>";
118 echo "<li>"."LOGINPUT".": ".LOGINPUT."</li>";
119 echo "<li>"."LOCALE".": ".LOCALE."</li>";
120 echo "<li>"."MULTI".": ".MULTI."</li>";
121 echo "<li>"."DOMAINE".": ".domaine."</li>";
122 echo "<li>"."PG_PATH".": ".PG_PATH."</li>";
123 echo "<li>"."PG_DUMP".": ".PG_DUMP."</li>";
124 echo "<li>"."PG_RESTORE".": ".PG_RESTORE."</li>";
125 echo "<li>"."PSQL".": ".PSQL."</li>";
126 echo "</ul>";
127 echo "<h2>"._("Paramètre base de données")."</h2>";
128 $a_option = array ("client_encoding","lc_collate","listen_addresses",
129 "server_encoding","work_mem","shared_buffers","server_version",
130 "hba_file","config_file","data_directory","effective_cache_size");
131 /*
132 * For old version of noalyss config file
133 */
134 $noalyss_user=(defined("noalyss_user"))?noalyss_user:phpcompta_user;
135 $port=(defined("noalyss_psql_port"))?noalyss_psql_port:phpcompta_psql_port;
136 $host=(!defined("noalyss_psql_host") )?'127.0.0.1':noalyss_psql_host;
137
138 echo '<ul style="list-style:square">';
139 echo "<li>";
140 echo _('Hôte')." = ".$host;
141 echo "</li>";
142 echo "<li>";
143 echo _('Port')." = ".$port;
144 echo "</li>";
145 echo "<li>";
146 echo _('Utilisateur')." = ".$noalyss_user;
147 echo "</li>";
148
149 for ( $i = 0 ; $i < count($a_option); $i++) {
150 $name=$a_option[$i];
151
152 $sql="select setting from pg_settings where name=$1";
153 $value=$rep->get_value($sql,array($name));
154 echo "<li> ".$name." = ".$value."</li>";
155 }
156
157 echo "</ul>";
158
159 echo "<h2>"._('Paramètre PHP')."</h2>";
160 ob_start();
161 echo phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_ENVIRONMENT | INFO_VARIABLES);
162 $r=ob_get_clean();
163 $html=new DOMDocument();
164 libxml_use_internal_errors(true);
165 $html->loadHTML($r);
166 $nodelist=$html->getElementsByTagName("style");
167 $nodelist->item(0)->nodeValue='
168.p {text-align: left;}
169.e {background-color: #ccccff; font-weight: bold; color: #000000;}
170.h {background-color: #9999cc; font-weight: bold; color: #000000;word-wrap:break-word;word-break: break-all;}
171.v {background-color: #cccccc; color: #000000;;word-wrap:break-word;word-break: break-all}
172.vr {background-color: #cccccc; text-align: right; color: #000000;word-wrap:break-word;word-break: break-all}
173img {float: right; border: 0px;}
174hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}
175 ';
176 $a_table=$html->getElementsByTagName("table");
177
178 // For PHP < 7 , we must change the attribute "width"
179 if ( substr(phpversion(),0,1) < 7 )
180 {
181 for ( $i = 0 ; $i < $a_table->length;$i++) {
182 $node=$a_table->item($i);
183 $node_width = $node->attributes->getNamedItem("width");
184 if ( $node_width != null ) $node_width->nodeValue="100%";
185
186 }
187 }
188 $a_title = $html->getElementsByTagName("title");
189 for ( $i = 0;$i<$a_title->length;$i++) {
190 $a_title->item($i)->nodeValue="";
191 }
192 echo $html->saveHTML();
193
194}
195//------------------------------------------------------------------------------
196// Upgrade
197//------------------------------------------------------------------------------
198if ( $action == "upgrade" ) {
199
200
201 require_once NOALYSS_INCLUDE."/upgrade.inc.php";
202}
203?>
204</DIV>
205<?php
207?>
html_page_stop()
end tag
Definition: ac_common.php:468
html_page_start($p_theme="", $p_script="", $p_script2="")
Default page header for each page.
Definition: ac_common.php:275
$action
if(headers_sent() &&DEBUGNOALYSS > 0) $html
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
contains the class for connecting to Noalyss
manage the http input (get , post, request) and extract from an array
static echo_file($msg, $print=true)
display the file
Definition: dbg.php:88
global $version_noalyss
Definition: constant.php:26
for($e=0; $e< count($afiche); $e++) exit
load_all_script()
load all the javascript only one time
js_include($p_string)
create the HTML for including of a javascript file if a file is included twice, the second time it wi...
MenuAdmin()
show the menu for user/database management
Definition: user_menu.php:32