noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
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 * check if 2FA is completed
40 */
41if ( ! $User->is_double_identified()) {
42 exit();
43}
44$audit=true;
45
46if ($User->admin != 1)
47{
48 $theme=(isset($User->theme))?$User->theme:"";
49 $User->audit('FAIL',"ADMIN : [$action]".var_export($_REQUEST,true));
50 html_page_start($theme);
51 echo '<div class=content" style="padding:5%">';
52 echo "<h1 class=\"title\">";
53 echo _("Accès interdit");
54 echo "</h1>";
55 echo '<span class="warning">';
56 echo _("Vous n'êtes pas administateur");
57 echo '</span>';
58 $reconnect=http_build_query(array("reconnect"=>1,"backurl"=>"admin-noalyss.php?action=upgrade"));
59 echo '<a class="mtitle" style="text-decoration:underline" href="'.NOALYSS_URL.'/index.php?'.$reconnect.'">';
60
61 echo _("Cliquez ici pour vous connecter comme administrateur");
62 echo '</a>';
64 return;
65}
66$User->audit('SUCCESS',"ADMIN : [$action] ".var_export($_REQUEST,true));
67
68// For a backup , we must avoid to send anything before the
69// dump file
70if ( $action== 'backup') {
71 /* take backup */
72 require_once NOALYSS_INCLUDE."/backup.inc.php";
73 exit();
74}
75html_page_start($_SESSION[SESSION_KEY.'g_theme']);
77echo '<H2 class="info w100"> '._('Administration').'</H2>';
78echo '<div class="topmenu">';
79
80echo MenuAdmin()."</div>";
81
82?>
83<DIV >
84<?php
85echo js_include("admin.js");
86if ( $action=="user_mgt" )
87{
88 //----------------------------------------------------------------------
89 // User management
90 //----------------------------------------------------------------------
91 require_once NOALYSS_INCLUDE."/user.inc.php";
92}
93
94if ( $action=="dossier_mgt")
95{
96 //-----------------------------------------------------------------------
97 // action = dossier_mgt
98 //-----------------------------------------------------------------------
99 require_once NOALYSS_INCLUDE."/dossier.inc.php";
100}
101if ( $action== "modele_mgt" )
102{
103 //-----------------------------------------------------------------------
104 // Template Management
105 //-----------------------------------------------------------------------
106 require_once NOALYSS_INCLUDE."/modele.inc.php";
107} // action is set
108if ( $action== 'restore')
109{
110 // Backup and restaure folders
111 require_once NOALYSS_INCLUDE."/restore.inc.php";
112}
113if ($action== 'audit_log')
114{
115 /* List the connexion successfull and failed */
116 require_once NOALYSS_INCLUDE."/audit_log.php";
117}
118/*
119 * Display information about current installation
120 */
121if ( $action == "info" && SYSINFO_DISPLAY == true) {
122 global $version_noalyss;
123 echo "<h2>"._("Version Noalyss")."</h2>";
124 echo "Noalyss : ", $version_noalyss;
125
126 echo "<h2>"._('Variables').":".NOALYSS_INCLUDE.'/config.inc.php </h2>';
127 echo '<ul style="list-style:square">';
128 echo "<li>". "NOALYSS_HOME".": ".NOALYSS_HOME."</li>";
129 echo "<li>"."NOALYSS_INCLUDE".": ".NOALYSS_INCLUDE."</li>";
130 echo "<li>"."NOALYSS_TEMPLATE".": ".NOALYSS_TEMPLATE."</li>";
131 echo "<li>"."DEBUG".": ".DEBUGNOALYSS."</li>";
132 echo "<li>"."LOGINPUT".": ".LOGINPUT."</li>";
133 echo "<li>"."LOCALE".": ".LOCALE."</li>";
134 echo "<li>"."MULTI".": ".MULTI."</li>";
135 echo "<li>"."DOMAINE".": ".domaine."</li>";
136 echo "<li>"."PG_PATH".": ".PG_PATH."</li>";
137 echo "<li>"."PG_DUMP".": ".PG_DUMP."</li>";
138 echo "<li>"."PG_RESTORE".": ".PG_RESTORE."</li>";
139 echo "<li>"."PSQL".": ".PSQL."</li>";
140 echo "</ul>";
141 echo "<h2>"._("Paramètre base de données")."</h2>";
142 $a_option = array ("client_encoding","lc_collate","listen_addresses",
143 "server_encoding","work_mem","shared_buffers","server_version",
144 "hba_file","config_file","data_directory","effective_cache_size");
145 /*
146 * For old version of noalyss config file
147 */
148 $noalyss_user=(defined("noalyss_user"))?noalyss_user:phpcompta_user;
149 $port=(defined("noalyss_psql_port"))?noalyss_psql_port:phpcompta_psql_port;
150 $host=(!defined("noalyss_psql_host") )?'127.0.0.1':noalyss_psql_host;
151
152 echo '<ul style="list-style:square">';
153 echo "<li>";
154 echo _('Hôte')." = ".$host;
155 echo "</li>";
156 echo "<li>";
157 echo _('Port')." = ".$port;
158 echo "</li>";
159 echo "<li>";
160 echo _('Utilisateur')." = ".$noalyss_user;
161 echo "</li>";
162
163 for ( $i = 0 ; $i < count($a_option); $i++) {
164 $name=$a_option[$i];
165
166 $sql="select setting from pg_settings where name=$1";
167 $value=$rep->get_value($sql,array($name));
168 echo "<li> ".$name." = ".$value."</li>";
169 }
170
171 echo "</ul>";
172
173 echo "<h2>"._('Paramètre PHP')."</h2>";
174 ob_start();
175 echo phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_ENVIRONMENT | INFO_VARIABLES);
176 $r=ob_get_clean();
177 $html=new DOMDocument();
178 libxml_use_internal_errors(true);
179 $html->loadHTML($r);
180 $nodelist=$html->getElementsByTagName("style");
181 $nodelist->item(0)->nodeValue='
182.p {text-align: left;}
183.e {background-color: #ccccff; font-weight: bold; color: #000000;}
184.h {background-color: #9999cc; font-weight: bold; color: #000000;word-wrap:break-word;word-break: break-all;}
185.v {background-color: #cccccc; color: #000000;;word-wrap:break-word;word-break: break-all}
186.vr {background-color: #cccccc; text-align: right; color: #000000;word-wrap:break-word;word-break: break-all}
187img {float: right; border: 0px;}
188hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}
189 ';
190 $a_table=$html->getElementsByTagName("table");
191
192 // For PHP < 7 , we must change the attribute "width"
193 if ( substr(phpversion(),0,1) < 7 )
194 {
195 for ( $i = 0 ; $i < $a_table->length;$i++) {
196 $node=$a_table->item($i);
197 $node_width = $node->attributes->getNamedItem("width");
198 if ( $node_width != null ) $node_width->nodeValue="100%";
199
200 }
201 }
202 $a_title = $html->getElementsByTagName("title");
203 for ( $i = 0;$i<$a_title->length;$i++) {
204 $a_title->item($i)->nodeValue="";
205 }
206 echo $html->saveHTML();
207
208}
209//------------------------------------------------------------------------------
210// Upgrade
211//------------------------------------------------------------------------------
212if ( $action == "upgrade" ) {
213
214
215 require_once NOALYSS_INCLUDE."/upgrade.inc.php";
216}
217?>
218</DIV>
219<?php
221?>
html_page_stop()
end tag
html_page_start($p_theme="", $p_script="", $p_script2="")
Default page header for each page.
if(! $User->is_double_identified()) $audit
check if 2FA is completed
if(headers_sent() &&DEBUGNOALYSS > 0) $html
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$_REQUEST['ac']
_("actif, passif,charge,...")
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