Task #0000843: Fonctionnement sur server mutualisé

Ajout des fichiers + changement dans le setup.php
This commit is contained in:
Dany De Bontridder 2013-05-17 00:29:31 +00:00
parent 28fd38c4b1
commit 26ec5e2799
12 changed files with 19000 additions and 64 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,530 @@
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
--
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: -
--
SET search_path = public, pg_catalog;
--
-- Name: limit_user(); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION limit_user() RETURNS trigger
LANGUAGE plpgsql
AS $$
begin
NEW.ac_user := substring(NEW.ac_user from 1 for 80);
return NEW;
end; $$;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: ac_dossier; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE ac_dossier (
dos_id integer DEFAULT nextval(('dossier_id'::text)::regclass) NOT NULL,
dos_name text NOT NULL,
dos_description text,
dos_jnt_user integer DEFAULT 0
);
--
-- Name: ac_users; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE ac_users (
use_id integer DEFAULT nextval(('users_id'::text)::regclass) NOT NULL,
use_first_name text,
use_name text,
use_login text NOT NULL,
use_active integer DEFAULT 0,
use_pass text,
use_admin integer DEFAULT 0,
CONSTRAINT ac_users_use_active_check CHECK (((use_active = 0) OR (use_active = 1)))
);
--
-- Name: audit_connect; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE audit_connect (
ac_id integer NOT NULL,
ac_user text,
ac_date timestamp without time zone DEFAULT now(),
ac_ip text,
ac_state text,
ac_module text,
ac_url text,
CONSTRAINT valid_state CHECK ((((ac_state = 'FAIL'::text) OR (ac_state = 'SUCCESS'::text)) OR (ac_state = 'AUDIT'::text)))
);
--
-- Name: audit_connect_ac_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE audit_connect_ac_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- Name: audit_connect_ac_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE audit_connect_ac_id_seq OWNED BY audit_connect.ac_id;
--
-- Name: audit_connect_ac_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('audit_connect_ac_id_seq', 287, true);
--
-- Name: dossier_id; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE dossier_id
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- Name: dossier_id; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('dossier_id', 29, true);
--
-- Name: jnt_use_dos; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE jnt_use_dos (
jnt_id integer DEFAULT nextval(('seq_jnt_use_dos'::text)::regclass) NOT NULL,
use_id integer NOT NULL,
dos_id integer NOT NULL
);
--
-- Name: modeledef; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE modeledef (
mod_id integer DEFAULT nextval(('s_modid'::text)::regclass) NOT NULL,
mod_name text NOT NULL,
mod_desc text
);
--
-- Name: priv_user; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE priv_user (
priv_id integer DEFAULT nextval(('seq_priv_user'::text)::regclass) NOT NULL,
priv_jnt integer NOT NULL,
priv_priv text
);
--
-- Name: s_modid; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE s_modid
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- Name: s_modid; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('s_modid', 8, true);
--
-- Name: seq_jnt_use_dos; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE seq_jnt_use_dos
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- Name: seq_jnt_use_dos; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('seq_jnt_use_dos', 33, true);
--
-- Name: seq_priv_user; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE seq_priv_user
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- Name: seq_priv_user; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('seq_priv_user', 16, true);
--
-- Name: theme; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE theme (
the_name text NOT NULL,
the_filestyle text,
the_filebutton text
);
--
-- Name: user_global_pref; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE user_global_pref (
user_id text NOT NULL,
parameter_type text NOT NULL,
parameter_value text
);
--
-- Name: TABLE user_global_pref; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON TABLE user_global_pref IS 'The user''s global parameter ';
--
-- Name: COLUMN user_global_pref.user_id; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN user_global_pref.user_id IS 'user''s login ';
--
-- Name: COLUMN user_global_pref.parameter_type; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN user_global_pref.parameter_type IS 'the type of parameter ';
--
-- Name: COLUMN user_global_pref.parameter_value; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN user_global_pref.parameter_value IS 'the value of parameter ';
--
-- Name: users_id; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE users_id
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- Name: users_id; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('users_id', 5, true);
--
-- Name: version; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE repo_version (
val integer NOT NULL
);
--
-- Name: ac_id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY audit_connect ALTER COLUMN ac_id SET DEFAULT nextval('audit_connect_ac_id_seq'::regclass);
--
-- Data for Name: ac_dossier; Type: TABLE DATA; Schema: public; Owner: -
--
COPY ac_dossier (dos_id, dos_name, dos_description, dos_jnt_user) FROM stdin;
25 Dossier Dossier par défaut 0
\.
--
-- Data for Name: ac_users; Type: TABLE DATA; Schema: public; Owner: -
--
COPY ac_users (use_id, use_first_name, use_name, use_login, use_active, use_pass, use_admin) FROM stdin;
1 \N \N phpcompta 1 b1cc88e1907cde80cb2595fa793b3da9 1
\.
--
-- Data for Name: audit_connect; Type: TABLE DATA; Schema: public; Owner: -
--
--
-- Data for Name: jnt_use_dos; Type: TABLE DATA; Schema: public; Owner: -
--
COPY jnt_use_dos (jnt_id, use_id, dos_id) FROM stdin;
29 1 25
\.
--
-- Data for Name: modeledef; Type: TABLE DATA; Schema: public; Owner: -
--
COPY modeledef (mod_id, mod_name, mod_desc) FROM stdin;
1 (BE) Basique Comptabilité Belge, à adapter
2 (FR) Basique Comptabilité Française, à adapter
\.
--
-- Data for Name: priv_user; Type: TABLE DATA; Schema: public; Owner: -
--
COPY priv_user (priv_id, priv_jnt, priv_priv) FROM stdin;
\.
--
-- Data for Name: theme; Type: TABLE DATA; Schema: public; Owner: -
--
COPY theme (the_name, the_filestyle, the_filebutton) FROM stdin;
classic style.css \N
Light style-light.css \N
Colored style-color.css \N
EPad style-epad.css \N
\.
--
-- Data for Name: user_global_pref; Type: TABLE DATA; Schema: public; Owner: -
--
COPY user_global_pref (user_id, parameter_type, parameter_value) FROM stdin;
phpcompta TOPMENU TEXT
phpcompta PAGESIZE 50
phpcompta THEME classic
phpcompta LANG fr_FR.utf8
\.
--
-- Data for Name: version; Type: TABLE DATA; Schema: public; Owner: -
--
COPY repo_version (val) FROM stdin;
14
\.
--
-- Name: ac_dossier_dos_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY ac_dossier
ADD CONSTRAINT ac_dossier_dos_name_key UNIQUE (dos_name);
--
-- Name: ac_dossier_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY ac_dossier
ADD CONSTRAINT ac_dossier_pkey PRIMARY KEY (dos_id);
--
-- Name: ac_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY ac_users
ADD CONSTRAINT ac_users_pkey PRIMARY KEY (use_id);
--
-- Name: ac_users_use_login_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY ac_users
ADD CONSTRAINT ac_users_use_login_key UNIQUE (use_login);
--
-- Name: audit_connect_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY audit_connect
ADD CONSTRAINT audit_connect_pkey PRIMARY KEY (ac_id);
--
-- Name: jnt_use_dos_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY jnt_use_dos
ADD CONSTRAINT jnt_use_dos_pkey PRIMARY KEY (jnt_id);
--
-- Name: modeledef_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY modeledef
ADD CONSTRAINT modeledef_pkey PRIMARY KEY (mod_id);
--
-- Name: pk_user_global_pref; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY user_global_pref
ADD CONSTRAINT pk_user_global_pref PRIMARY KEY (user_id, parameter_type);
--
-- Name: priv_user_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY priv_user
ADD CONSTRAINT priv_user_pkey PRIMARY KEY (priv_id);
--
-- Name: version_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY version
ADD CONSTRAINT version_pkey PRIMARY KEY (val);
--
-- Name: audit_connect_ac_user; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX audit_connect_ac_user ON audit_connect USING btree (ac_user);
--
-- Name: fk_jnt_dos_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX fk_jnt_dos_id ON jnt_use_dos USING btree (dos_id);
--
-- Name: fk_jnt_use_dos; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX fk_jnt_use_dos ON jnt_use_dos USING btree (use_id);
--
-- Name: limit_user_trg; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER limit_user_trg
BEFORE INSERT OR UPDATE ON audit_connect
FOR EACH ROW
EXECUTE PROCEDURE limit_user();
--
-- Name: fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY user_global_pref
ADD CONSTRAINT fk_user_id FOREIGN KEY (user_id) REFERENCES ac_users(use_login) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- Name: jnt_use_dos_dos_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY jnt_use_dos
ADD CONSTRAINT jnt_use_dos_dos_id_fkey FOREIGN KEY (dos_id) REFERENCES ac_dossier(dos_id) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- Name: jnt_use_dos_use_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY jnt_use_dos
ADD CONSTRAINT jnt_use_dos_use_id_fkey FOREIGN KEY (use_id) REFERENCES ac_users(use_id);
--
-- Name: priv_user_priv_jnt_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY priv_user
ADD CONSTRAINT priv_user_priv_jnt_fkey FOREIGN KEY (priv_jnt) REFERENCES jnt_use_dos(jnt_id) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- PostgreSQL database dump complete
--

View file

@ -8,4 +8,20 @@ content[201]="Désactiver le changement de langue (requis pour MacOSX)";
content[202]="Le chemin vers le repertoire contenant psql, pg_dump..."; content[202]="Le chemin vers le repertoire contenant psql, pg_dump...";
content[203]="Utilisateur de la base de donnée postgresql"; content[203]="Utilisateur de la base de donnée postgresql";
content[204]="Mot de passe de l'utilisateur "; content[204]="Mot de passe de l'utilisateur ";
content[205]="Port de postgresql"; content[205]="Port de postgresql";
content[206]="En version mono dossier, le nom de la base de données doit être mentionnée";
function show_dbname(obj) {
try {
if (obj.value === '1')
{
this.document.getElementById('div_db').style.visibility= 'hidden';
}
else {
this.document.getElementById('div_db').style.visibility= 'visible';
}
} catch (e) {
alert(e.getMessage);
}
}

View file

@ -46,15 +46,17 @@
<script type="text/javascript" charset="utf8" language="javascript" src="setup.js"></script> <script type="text/javascript" charset="utf8" language="javascript" src="setup.js"></script>
<?php <?php
$failed="<span style=\"font-size:18px;color:red\">&#x2716;</span>"; $failed="<span style=\"font-size:18px;color:red\">&#x2716;</span>";
$succeed="<span style=\"font-size:18px;color:green\">&#x2713;</span>"; $succeed="<span style=\"font-size:18px;color:green\">&#x2713;</span>";
$inc_path=get_include_path(); $inc_path=get_include_path();
global $os;
/** /**
*@brief create correctly the htaccess file *@brief create correctly the htaccess file
*/ */
function create_htaccess() { function create_htaccess() {
$inc_path=get_include_path(); $inc_path=get_include_path();
global $os;
if ( strpos($inc_path,";") != 0 ) { if ( strpos($inc_path,";") != 0 ) {
$new_path=$inc_path.';..\..\include;addon'; $new_path=$inc_path.';..\..\include;addon';
$os=0; /* $os is 0 for windoz */ $os=0; /* $os is 0 for windoz */
@ -97,17 +99,10 @@ $file='..'.DIRECTORY_SEPARATOR.'.htaccess';
foreach ($array as $value ) fwrite($hFile,$value."\n"); foreach ($array as $value ) fwrite($hFile,$value."\n");
fclose($hFile); fclose($hFile);
} }
if ( strpos($inc_path,";") != 0 ) {
$new_path=$inc_path.';..\..\include;addon';
$os=0; /* $os is 0 for windoz */
} else {
$new_path=$inc_path.':../../include:addon';
$os=1; /* $os is 1 for unix */
}
set_include_path($new_path);
/* The config file is created here */ /* The config file is created here */
if (isset($_POST['save_config'])) { if (isset($_POST['save_config'])) {
require_once('config_file.php'); require_once('../../include/config_file.php');
$url=config_file_create($_POST,1,$os); $url=config_file_create($_POST,1,$os);
echo ' echo '
<form method="post" > <form method="post" >
@ -125,7 +120,7 @@ create_htaccess();
if ( ! file_exists('..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'config.inc.php')) { if ( ! file_exists('..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'config.inc.php')) {
echo '<h1 class="info">Entrez les informations n&eacute;cessaires &agrave; phpcompta</h1>'; echo '<h1 class="info">Entrez les informations n&eacute;cessaires &agrave; phpcompta</h1>';
echo '<form method="post">'; echo '<form method="post">';
require_once('config_file.php'); require_once('../../include/config_file.php');
echo config_file_form(); echo config_file_form();
echo '<div style="position:float;float:left;"></div>'; echo '<div style="position:float;float:left;"></div>';
echo HtmlInput::submit('save_config','Sauver la configuration'); echo HtmlInput::submit('save_config','Sauver la configuration');
@ -144,8 +139,8 @@ if ( ! file_exists('..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'include'.D
// magic_quotes_runtime = Off // magic_quotes_runtime = Off
// magic_quotes_sybase = Off // magic_quotes_sybase = Off
// include_path // include_path
require_once '../../include/constant.php';
require_once('config_file.php'); require_once('config_file.php');
include_once('constant.php');
require_once('class_database.php'); require_once('class_database.php');
echo "<h1>Configuration</h1>"; echo "<h1>Configuration</h1>";
?> ?>
@ -237,19 +232,6 @@ if ( ini_get("session.use_trans_sid") == false ) {
} }
echo "<li>"; echo "<li>";
if ( strpos($inc_path,"../include") == 0 && strpos ($inc_path,'..\\include') == 0)
{
echo 'variable include_path: '.$failed;
print ("<span class=\"warning\"> include_path incorrect !!!".$inc_path."</span>");
$flag_php++;
}
else
if ( strpos($inc_path,"addon") == 0) {
echo 'variable include_path: '.$failed;
print ("<span class=\"warning\">2 include_path incorrect !!!".$inc_path."</span>");
$flag_php++;
}else
echo 'variable include_path: '.$succeed;
echo "</li>"; echo "</li>";
echo "</ul>"; echo "</ul>";
@ -260,8 +242,13 @@ if ( $flag_php==0 ) {
exit -1; exit -1;
} }
/* check user */ /* check user */
$cn=new Database(-1,'template'); if ( defined("MULTI") && MULTI==1)
{
$cn=new Database(-1,'template');
} else
{
$cn=new Database();
}
?> ?>
<h2>Base de données</h2> <h2>Base de données</h2>
<?php <?php
@ -344,7 +331,10 @@ if ( ! isset($_POST['go']) ) {
if ( ! isset($_POST['go']) ) if ( ! isset($_POST['go']) )
exit(); exit();
// Check if account_repository exists // Check if account_repository exists
$account=$cn->count_sql("select * from pg_database where datname=lower('".domaine."account_repository')"); if ( defined("MULTI") && MULTI== 0)
$account = $cn->count_sql("select * from pg_database where datname=lower('" . domaine . "account_repository')");
else
$account=1;
// Create the account_repository // Create the account_repository
if ($account == 0 ) { if ($account == 0 ) {
@ -393,7 +383,27 @@ $cn=new Database();
echo "<h1>Mise a jour du systeme</h1>"; echo "<h1>Mise a jour du systeme</h1>";
echo "<h2 > Mise &agrave; jour dossier</h2>"; echo "<h2 > Mise &agrave; jour dossier</h2>";
if (defined("MULTI") && MULTI == 0)
{
$db = new Database();
if ($db->exist_table("version") == false)
{
echo '<p class="warning">' . $failed . 'La base de donnée ' . dbname . ' est vide, veuillez y restaurer un modèle de base de données plus le script mono.sql
, ce script se trouve dans phpcompta/contrib/mono.sql</p>';
exit();
}
echo "<h3>Patching " . dbname . '</h3>';
$db->apply_patch(dbname);
echo "<p class=\"info\">Tout est install&eacute; $succeed";
?>
<A style="" class="button" HREF="../index.php">Connectez-vous à PhpCompta</A>
<?php
exit();
}
/*
* If multi folders
*/
$Resdossier=$cn->exec_sql("select dos_id, dos_name from ac_dossier"); $Resdossier=$cn->exec_sql("select dos_id, dos_name from ac_dossier");
$MaxDossier=$cn->size($Resdossier); $MaxDossier=$cn->size($Resdossier);

View file

@ -55,6 +55,18 @@
<TD>Port de postgresql </TD> <TD>Port de postgresql </TD>
<TD><?php echo $icport->input();echo HtmlInput::infobulle(205)?></TD> <TD><?php echo $icport->input();echo HtmlInput::infobulle(205)?></TD>
</TR> </TR>
<tr>
<td>Mode Serveur mutualisé ou dédié</td>
<td><?php echo $smulti->input() ?></td>
</tr>
<tr id="div_db" style="visibility:hidden">
<td>
Nom base de donnée
</td>
<td>
<?php echo $icdbname->input();echo HtmlInput::infobulle(206) ?>
</td>
</tr>
</table> </table>
</div> </div>
<div class="notice"> <div class="notice">
@ -66,4 +78,5 @@
<?php <?php
} }
?> ?>
</div> </div>

View file

@ -28,7 +28,14 @@ require_once('constant.php');
/* $Revision$ */ /* $Revision$ */
require_once('class_database.php'); require_once('class_database.php');
// Verif if User and Pass match DB
// if no, then redirect to the login page
$rep=new Database();
if (defined('MULTI') && MULTI == 0)
$version = $rep->get_value('select val from repo_version');
else
$version = $rep->get_value('select val from version');
if ( isset ($_POST["p_user"] ) ) if ( isset ($_POST["p_user"] ) )
{ {
@ -37,20 +44,18 @@ if ( isset ($_POST["p_user"] ) )
$_SESSION['g_user']=$g_user; $_SESSION['g_user']=$g_user;
$_SESSION['g_pass']=$g_pass; $_SESSION['g_pass']=$g_pass;
// Verif if User and Pass match DB
// if no, then redirect to the login page
$rep=new Database();
/* /*
* Check repository version * Check repository version
*/ */
if ( $rep->get_value('select val from version') != DBVERSIONREPO)
{
echo alert('Version de base de données incorrectes, vous devez mettre à jour');
echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url=admin/setup.php\">";
exit();
} if ($version != DBVERSIONREPO)
include_once ("class_user.php"); {
echo alert('Version de base de données incorrectes, vous devez mettre à jour');
echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url=admin/setup.php\">";
exit();
}
include_once ("class_user.php");
$User=new User($rep); $User=new User($rep);
$User->Check(false,'LOGIN'); $User->Check(false,'LOGIN');
if ($g_captcha == true) if ($g_captcha == true)
@ -76,7 +81,7 @@ else
* Check repository version * Check repository version
*/ */
if ( $rep->get_value('select val from version') != DBVERSIONREPO) if ( $version != DBVERSIONREPO)
{ {
echo alert('Version de base de données incorrectes, vous devez mettre à jour'); echo alert('Version de base de données incorrectes, vous devez mettre à jour');
echo "<META HTTP-EQUIV=\"REFRESH\" content=\"1;url=admin/setup.php\">"; echo "<META HTTP-EQUIV=\"REFRESH\" content=\"1;url=admin/setup.php\">";

View file

@ -20,6 +20,7 @@
/*! \file /*! \file
* \brief Logout * \brief Logout
*/ */
require_once '../include/constant.php';
require_once ("ac_common.php"); require_once ("ac_common.php");
require_once('class_database.php'); require_once('class_database.php');

View file

@ -104,7 +104,7 @@ echo '<div class="welcome"> ';
* folder if he's an "plugin user" * folder if he's an "plugin user"
*/ */
if ( $User->admin == 0 ) if ( $User->admin == 0 || (defined("MULTI")&&MULTI==0))
{ {
// how many folder ? // how many folder ?
$folder=$User->get_available_folder(); $folder=$User->get_available_folder();

View file

@ -47,27 +47,37 @@ class Database
$password=phpcompta_password; $password=phpcompta_password;
$port=phpcompta_psql_port; $port=phpcompta_psql_port;
$host=( ! defined ("phpcompta_psql_host"))?'127.0.0.1':phpcompta_psql_host; $host=( ! defined ("phpcompta_psql_host"))?'127.0.0.1':phpcompta_psql_host;
if (defined ("MULTI") && MULTI=="0") {
$phpcompta_user = phpcompta_user;
$password = phpcompta_password;
$port = phpcompta_psql_port;
$host = (!defined("phpcompta_psql_host")) ? '127.0.0.1' : phpcompta_psql_host;
$l_dossier= dbname;
}
else
{
if ( $p_database_id == 0 ) if ( $p_database_id == 0 )
{ /* connect to the repository */ { /* connect to the repository */
$l_dossier=sprintf("%saccount_repository",strtolower(domaine)); $l_dossier=sprintf("%saccount_repository",strtolower(domaine));
} }
else if ( $p_type == 'dos') else if ( $p_type == 'dos')
{ /* connect to a folder (dossier) */ { /* connect to a folder (dossier) */
$l_dossier=sprintf("%sdossier%d",strtolower(domaine),$p_database_id); $l_dossier=sprintf("%sdossier%d",strtolower(domaine),$p_database_id);
} }
else if ($p_type=='mod') else if ($p_type=='mod')
{ /* connect to a template (modele) */ { /* connect to a template (modele) */
$l_dossier=sprintf("%smod%d",strtolower(domaine),$p_database_id); $l_dossier=sprintf("%smod%d",strtolower(domaine),$p_database_id);
} }
else if ($p_type=='template') else if ($p_type=='template')
{ {
$l_dossier='template1'; $l_dossier='template1';
} }
else else
{ {
throw new Exception ('Connection invalide'); throw new Exception ('Connection invalide');
} }
}
ob_start(); ob_start();
$a=pg_connect("dbname=$l_dossier host='$host' user='$phpcompta_user' $a=pg_connect("dbname=$l_dossier host='$host' user='$phpcompta_user'
@ -578,7 +588,7 @@ class Database
*/ */
function exist_database($p_name) function exist_database($p_name)
{ {
$database_exist=$this->get_value('select count(*) $database_exist=$this->get_value('select count(*)
from pg_catalog.pg_database where datname = lower($1)',array($p_name)); from pg_catalog.pg_database where datname = lower($1)',array($p_name));
return $database_exist; return $database_exist;
} }

View file

@ -66,6 +66,9 @@ function config_file_form($p_array=null)
$cport=5432; $cport=5432;
$cdomain=''; $cdomain='';
$clocale=1; $clocale=1;
$multi=1;
$cdbname="database_phpcompta";
} }
else extract ($p_array); else extract ($p_array);
@ -85,6 +88,18 @@ function config_file_form($p_array=null)
$icuser=new IText('cuser',$cuser); $icuser=new IText('cuser',$cuser);
$icpasswd=new IText('cpasswd',$cpasswd); $icpasswd=new IText('cpasswd',$cpasswd);
$icport=new IText("cport",$cport); $icport=new IText("cport",$cport);
/*
* For version MONO
*/
$smulti=new ISelect ('multi');
$smulti->value=array(
array('value'=>1,'label'=>'Serveur dédié : plusieurs dossiers'),
array('value'=>0,'label'=>'Serveur Mutualisé: un seul dossier')
);
$smulti->selected=1;
$smulti->javascript=' onchange="show_dbname(this)"';
$icdbname=new IText('cdbname');
require 'template_config_form.php'; require 'template_config_form.php';
} }
@ -134,6 +149,12 @@ function config_file_create($p_array,$from_setup=1,$os=1)
fputs($hFile, 'define ("domaine","");'); fputs($hFile, 'define ("domaine","");');
fputs($hFile,"\r\n"); fputs($hFile,"\r\n");
fputs($hFile, 'define ("MULTI","'.$multi.'");');
fputs($hFile,"\r\n");
fputs($hFile, 'define ("dbname","'.$cdbname.'");');
fputs($hFile,"\r\n");
fputs($hFile,'?>'); fputs($hFile,'?>');
fclose($hFile); fclose($hFile);
} }

View file

@ -41,7 +41,17 @@ if ( strpos($inc_path,";") != 0 ) {
$os=1; /* $os is 1 for unix */ $os=1; /* $os is 1 for unix */
} }
set_include_path($new_path); set_include_path($new_path);
session_start(); if ( defined("MULTI") && MULTI==0 ) {
ini_set ('session.use_cookies',1);
ini_set ('session.use_only_cookies','on');
ini_set ('session.use_trans_sid','on');
ini_set ('magic_quotes_gpc','off');
ini_set ('max_execution_time',240);
ini_set ('memory_limit','20M');
ini_set ('post_max_size','20M');
ini_set ('upload_max_filesize','20M');
@session_start();
}
/* /*
* Ini session * Ini session
*/ */