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