Periode : fix bug
This commit is contained in:
commit
0bbb93f296
32 changed files with 1578 additions and 470 deletions
|
|
@ -29,6 +29,7 @@ if (file_exists("../include/config.inc.php") ) {
|
|||
* installed
|
||||
*/
|
||||
define ('ALLOWED',1);
|
||||
define ('ALLOWED_ADMIN',1);
|
||||
require_once '../include/constant.php';
|
||||
require_once NOALYSS_INCLUDE.'/admin_repo.inc.php';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -203,6 +203,12 @@ $path = array(
|
|||
"modele_drop"=>"ajax_admin",
|
||||
// From admin, display the information of a template you can modify
|
||||
"modele_modify"=>"ajax_admin",
|
||||
// From admin , upgrade Noalyss
|
||||
"upgradeCore"=>"ajax_admin",
|
||||
// From admin , upgrade or install plugin
|
||||
"upgradePlugin"=>"ajax_admin",
|
||||
// From admin , install a template
|
||||
"installTemplate"=>"ajax_admin",
|
||||
// From dashboard, display detail about last operation
|
||||
"action_show"=>"ajax_gestion",
|
||||
// From dashboard, display form for a new event
|
||||
|
|
|
|||
12
html/do.php
12
html/do.php
|
|
@ -190,15 +190,19 @@ if ($cn->exist_table('version') == false)
|
|||
}
|
||||
if (DBVERSION < dossier::get_version($cn))
|
||||
{
|
||||
echo '<h2 class="error" style="font-size:12px">' . _("Attention: la version de base de donnée est supérieure à la version du programme, vous devriez mettre à jour") . '</h2>';
|
||||
$a = _("cliquez ici pour mettre à jour ");
|
||||
$base =NOALYSS_URL."/admin-noalyss.php?action=upgrade&sb=application";
|
||||
|
||||
echo '<h2 class="error" style="font-size:12px">' .
|
||||
_("Attention: la version de base de donnée est supérieure à la version du programme, vous devriez mettre à jour") ,
|
||||
'<a hreF="' . $base . '">' . $a . '</a></h2>',
|
||||
'</h2>';
|
||||
}
|
||||
if (DBVERSION > dossier::get_version($cn))
|
||||
{
|
||||
echo '<h2 class="error" style="font-size:12px">' . _("Votre base de données n'est pas à jour") . ' ';
|
||||
$a = _("cliquez ici pour appliquer le patch");
|
||||
$base = dirname($_SERVER['REQUEST_URI']);
|
||||
if ($base == '/') { $base = ''; }
|
||||
$base .= '/admin-noalyss.php';
|
||||
$base =NOALYSS_URL.'/admin-noalyss.php?action=upgrade&sb=database';
|
||||
echo '<a hreF="' . $base . '">' . $a . '</a></h2>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,20 +62,6 @@ background-repeat: repeat-x repeat-y;
|
|||
#logo_id {
|
||||
width:19%;
|
||||
}
|
||||
|
||||
|
||||
#recover_box {
|
||||
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 40%;
|
||||
z-index: 1;
|
||||
border: 2px solid blue;
|
||||
width: 30%;
|
||||
margin-left: 25%;
|
||||
background-color: whitesmoke;
|
||||
|
||||
}
|
||||
@media only screen and (max-width : 360px) {
|
||||
#alternate_browser {
|
||||
display : none;
|
||||
|
|
@ -87,6 +73,32 @@ background-repeat: repeat-x repeat-y;
|
|||
width:auto;
|
||||
left:0px;
|
||||
|
||||
}
|
||||
#login_frm {
|
||||
position:absolute;
|
||||
left:15%;
|
||||
top:50%;
|
||||
}
|
||||
.input_text {
|
||||
width:8em;
|
||||
}
|
||||
#recover_link {
|
||||
position:absolute;
|
||||
margin-bottom:30px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
#alternate_browser {
|
||||
display : none;
|
||||
}
|
||||
#logo_id {
|
||||
position:absolute;
|
||||
z-index:-1;
|
||||
height:45%;
|
||||
width:auto;
|
||||
left:0px;
|
||||
|
||||
}
|
||||
#login_frm {
|
||||
position:absolute;
|
||||
|
|
@ -155,18 +167,48 @@ background-repeat: repeat-x repeat-y;
|
|||
z-index:-1;
|
||||
position:absolute;
|
||||
width:19%;
|
||||
left:15%;
|
||||
top:10%;
|
||||
left:7%;
|
||||
top:9%;
|
||||
}
|
||||
#login_frm {
|
||||
position:absolute;
|
||||
left:29%;
|
||||
left:15%;
|
||||
top:15%;
|
||||
}
|
||||
.input_text {
|
||||
width: 24em;
|
||||
width: 24rem;
|
||||
}
|
||||
#recover_link {
|
||||
position:absolute;
|
||||
margin-top:397px;
|
||||
left:539px;
|
||||
background-color: white;
|
||||
}
|
||||
}
|
||||
@media only screen and (min-width : 1100px) {
|
||||
#alternate_browser {
|
||||
position:absolute;
|
||||
bottom: 0px;
|
||||
left:0px;
|
||||
z-index: -1;
|
||||
}
|
||||
#logo_id {
|
||||
z-index:-1;
|
||||
position:absolute;
|
||||
width:19%;
|
||||
left:8%;
|
||||
top:19.5%;
|
||||
}
|
||||
#login_frm {
|
||||
position:absolute;
|
||||
left:25%;
|
||||
top:30%;
|
||||
}
|
||||
.input_text {
|
||||
width: 24em;
|
||||
width: 24rem;
|
||||
}
|
||||
#recover_link {
|
||||
position:absolute;
|
||||
top:397px;
|
||||
|
|
|
|||
|
|
@ -132,12 +132,14 @@
|
|||
* </ul>
|
||||
*/
|
||||
|
||||
|
||||
if ( ! file_exists('..'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'config.inc.php'))
|
||||
{
|
||||
header("Location: install.php",true, 307);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
echo '<!doctype html><HTML>
|
||||
<head>
|
||||
<TITLE> NOALYSS </TITLE>
|
||||
|
|
@ -153,11 +155,21 @@ require_once '../include/constant.php';
|
|||
require_once '../include/config.inc.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
|
||||
if (file_exists("install.php")&& ! DEBUG ) {
|
||||
/*
|
||||
* This file shouldn't exist
|
||||
*/
|
||||
echo _("Le fichier ".__DIR__."/install.php est encore présent, vous devez l'effacer avant d'utiliser NOALYSS");
|
||||
return;
|
||||
// At the end of the installation procedure , the install file must be removed
|
||||
if (isset($_GET['remove_install'])) {
|
||||
if (is_writable(__DIR__."/install.php") ) {
|
||||
unlink(__DIR__."/install.php");
|
||||
}
|
||||
}
|
||||
// if removed failed then
|
||||
if (file_exists("install.php") )
|
||||
{
|
||||
/*
|
||||
* This file shouldn't exist
|
||||
*/
|
||||
echo _("Le fichier ".__DIR__."/install.php est encore présent, vous devez l'effacer avant d'utiliser NOALYSS");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ( strlen(domaine) > 0 )
|
||||
{
|
||||
|
|
|
|||
136
html/install.php
136
html/install.php
|
|
@ -319,73 +319,33 @@ echo "<li>";
|
|||
|
||||
echo "</li>";
|
||||
}
|
||||
//---------------------------------------------------------------------------------------
|
||||
// Check php modules
|
||||
//---------------------------------------------------------------------------------------
|
||||
$module=get_loaded_extensions();
|
||||
|
||||
echo "<li>";
|
||||
$str_error_message=_('Vous devez installer ou activer l\'extension').'<span style="font-weight:bold"> %s </span>';
|
||||
if ( in_array('mbstring',$module) == false ){
|
||||
echo 'module mbstring '.$failed;
|
||||
echo '<span class="warning">',
|
||||
sprintf($str_error_message, "mbstring"),
|
||||
' </span>';
|
||||
$flag_php++;
|
||||
} else echo 'module mbstring '.$succeed;
|
||||
echo "</li>";
|
||||
|
||||
echo "<li>";
|
||||
if ( in_array('pgsql',$module) == false )
|
||||
{
|
||||
echo 'module PGSQL '.$failed;
|
||||
echo '<span class="warning">',
|
||||
sprintf($str_error_message, "psql"),
|
||||
' </span>';
|
||||
$flag_php++;
|
||||
} else echo 'module PGSQL '.$succeed;
|
||||
echo "</li>";
|
||||
$a_need_module=array("mbstring","pgsql","bcmath","gettext","zip","gd","dom","xml","SimpleXML","xmlwriter","xmlreader");
|
||||
|
||||
echo "<li>";
|
||||
if ( in_array('bcmath',$module) == false )
|
||||
{
|
||||
echo 'module BCMATH ok '.$failed;
|
||||
echo '<span class="warning">',
|
||||
sprintf($str_error_message, "bcmath"),
|
||||
' </span>';
|
||||
$flag_php++;
|
||||
} else echo 'module BCMATH '.$succeed;
|
||||
echo "</li>";
|
||||
$nb_need_module=count($a_need_module);
|
||||
|
||||
echo "<li>";
|
||||
if (in_array('gettext',$module) == false )
|
||||
for ($m=0;$m<$nb_need_module;$m++)
|
||||
{
|
||||
echo 'module GETTEXT '.$failed;
|
||||
echo '<span class="warning">',
|
||||
sprintf($str_error_message, "gettext"),
|
||||
' </span>';
|
||||
$flag_php++;
|
||||
} else echo 'module GETTEXT '.$succeed;
|
||||
echo "</li>";
|
||||
|
||||
echo "<li>";
|
||||
if ( in_array('zip',$module) == false )
|
||||
{
|
||||
echo 'module ZIP '.$failed;
|
||||
echo '<span class="warning">',
|
||||
sprintf($str_error_message, "zip"),
|
||||
' </span>';
|
||||
$flag_php++;
|
||||
} else echo 'module ZIP '.$succeed;
|
||||
echo "</li>";
|
||||
echo "<li>";
|
||||
if ( in_array('gd',$module) == false )
|
||||
{
|
||||
echo 'module GD '.$failed;
|
||||
echo '<span class="warning">',
|
||||
sprintf($str_error_message, "gd"),
|
||||
' </span>';
|
||||
$flag_php++;
|
||||
} else echo 'module GD '.$succeed;
|
||||
echo "</li>";
|
||||
|
||||
|
||||
echo "<li>";
|
||||
if ( in_array($a_need_module[$m],$module) == false ){
|
||||
echo 'module '.$a_need_module[$m].$failed;
|
||||
echo '<span class="warning">',
|
||||
sprintf($str_error_message, $a_need_module[$m]),
|
||||
' </span>';
|
||||
$flag_php++;
|
||||
} else echo 'module '.$a_need_module[$m].$succeed;
|
||||
echo "</li>";
|
||||
}
|
||||
//---------------------------------------------------------------------------------------
|
||||
// Max_execution_time , can be overriden
|
||||
//---------------------------------------------------------------------------------------
|
||||
if ( ini_get("max_execution_time") < 60 ) {
|
||||
echo "<li>";
|
||||
echo _('Avertissement').' : '.$failed;
|
||||
|
|
@ -505,13 +465,19 @@ if ( ! isset($_POST['go']) ) {
|
|||
</span>
|
||||
<?php
|
||||
}
|
||||
if ( ! isset($_POST['go']) )
|
||||
exit();
|
||||
if (!isset($_POST['go']))
|
||||
{
|
||||
exit();
|
||||
}
|
||||
// Check if account_repository exists
|
||||
if (!defined("MULTI") || (defined("MULTI") && MULTI == 1))
|
||||
$account = $cn->count_sql("select * from pg_database where datname=lower('" . domaine . "account_repository')");
|
||||
if (!defined("MULTI")||(defined("MULTI")&&MULTI==1))
|
||||
{
|
||||
$account=$cn->count_sql("select * from pg_database where datname=lower('".domaine."account_repository')");
|
||||
}
|
||||
else
|
||||
$account=1;
|
||||
{
|
||||
$account=1;
|
||||
}
|
||||
|
||||
// Create the account_repository
|
||||
if ($account == 0 ) {
|
||||
|
|
@ -531,11 +497,17 @@ if ($account == 0 ) {
|
|||
|
||||
$cn->commit($cn);
|
||||
|
||||
if ( ! DEBUG) ob_end_clean();
|
||||
if (!DEBUG)
|
||||
{
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
echo _("Creation of Modele 1");
|
||||
if ( ! DEBUG) ob_start();
|
||||
$cn->exec_sql("create database ".domaine."mod1 encoding='utf8'");
|
||||
echo _("Creation of Modele 1");
|
||||
if (!DEBUG)
|
||||
{
|
||||
ob_start();
|
||||
}
|
||||
$cn->exec_sql("create database ".domaine."mod1 encoding='utf8'");
|
||||
|
||||
$cn=new Database(1,'mod');
|
||||
$cn->start();
|
||||
|
|
@ -544,9 +516,12 @@ if ($account == 0 ) {
|
|||
$cn->execute_script(NOALYSS_INCLUDE.'/sql/mod1/constraint.sql');
|
||||
$cn->commit();
|
||||
|
||||
if ( ! DEBUG) ob_end_clean();
|
||||
if (!DEBUG)
|
||||
{
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
echo _("Creation of Modele 2");
|
||||
echo _("Creation of Modele 2");
|
||||
$cn->exec_sql("create database ".domaine."mod2 encoding='utf8'");
|
||||
$cn=new Database(2,'mod');
|
||||
$cn->start();
|
||||
|
|
@ -575,8 +550,8 @@ if (defined("MULTI") && MULTI == 0)
|
|||
$db = new Database();
|
||||
if ($db->exist_table("repo_version") == false)
|
||||
{
|
||||
if ( ! DEBUG) { ob_start(); }
|
||||
$db->execute_script(NOALYSS_INCLUDE.'/sql/mono/mono.sql');
|
||||
if ( ! DEBUG) { ob_start(); }
|
||||
$db->execute_script(NOALYSS_INCLUDE.'/sql/mono/mono.sql');
|
||||
|
||||
if ( ! DEBUG) ob_end_clean();
|
||||
}
|
||||
|
|
@ -631,12 +606,15 @@ if (defined("MULTI") && MULTI == 0)
|
|||
* If multi folders
|
||||
*/
|
||||
define ('ALLOWED',1);
|
||||
define ('ALLOWED_ADMIN',1);
|
||||
|
||||
$_GET['sb']="upg_all";
|
||||
$rep=new Database();
|
||||
if (defined (NOALYSS_ADMINISTRATOR) )
|
||||
$rep->exec_sql("update ac_users set use_login=$1 where use_id=1",
|
||||
array(strtolower(NOALYSS_ADMINISTRATOR)));
|
||||
require NOALYSS_INCLUDE."/upgrade.inc.php";
|
||||
if (defined(NOALYSS_ADMINISTRATOR))
|
||||
{
|
||||
$rep->exec_sql("update ac_users set use_login=$1 where use_id=1", array(strtolower(NOALYSS_ADMINISTRATOR)));
|
||||
}
|
||||
Dossier::upgrade();
|
||||
echo '<h1>'._('Important').'</h1>';
|
||||
echo '<p>'._('Utilisateur administrateur'),' ',NOALYSS_ADMINISTRATOR,'</p>';
|
||||
|
||||
|
|
@ -644,9 +622,9 @@ echo "<h2 class=\"warning\">";
|
|||
printf (" VOUS DEVEZ EFFACER CE FICHIER %s",__FILE__);
|
||||
echo "</h2>";
|
||||
|
||||
echo "<p class=\"info\">"._("Tout est installé")." ". $succeed;
|
||||
echo "<p class=\"info\">"._("Tout est installé")." ". $succeed;
|
||||
?>
|
||||
</p>
|
||||
<p style="text-align: center">
|
||||
<A style="display:inline;margin:10px;padding:10px;" class="button" HREF="index.php"><?php echo _('Connectez-vous à NOALYSS')?></A>
|
||||
<A style="display:inline;margin:10px;padding:10px;" class="button" HREF="index.php?remove_install"><?php echo _("Essai effacement install.php et se connecter à NOALYSS")?></A>
|
||||
</p>
|
||||
|
|
@ -305,9 +305,9 @@ td.cell{
|
|||
}
|
||||
td.selectedcell{
|
||||
|
||||
border-radius:15px;
|
||||
-moz-border-radius: 15px;
|
||||
-webkit-border-radius: 15px;
|
||||
border-radius:19px;
|
||||
-moz-border-radius: 19px;
|
||||
-webkit-border-radius: 19px;
|
||||
font-weight: bold;
|
||||
color:#FFFFFF;
|
||||
width:250px;
|
||||
|
|
@ -315,6 +315,7 @@ td.selectedcell{
|
|||
background: #b8c6df; /* Old browsers */
|
||||
border-top-right-radius: 0px;
|
||||
border-bottom-left-radius: 0px;
|
||||
border-bottom-right-radius: 0px;
|
||||
}
|
||||
.menu2 td.mtitle ,.menu2 td.selectedcell{
|
||||
border-radius: 0px;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ $hi=new HttpInput();
|
|||
if ( $ac->exist_table('version') == false)
|
||||
{
|
||||
echo '<h2 class="error" style="font-size:12px">'._("Base de donnée invalide").'</h2>';
|
||||
$base=dirname($_SERVER['REQUEST_URI']);
|
||||
echo '<a hreF="'.NOALYSS_URL.'/user_login.php">'._("Retour").'</a></h2>';
|
||||
exit();
|
||||
}
|
||||
|
||||
|
|
@ -78,27 +78,30 @@ if ( $version < DBVERSIONREPO )
|
|||
{
|
||||
echo '<h2 class="error" style="font-size:12px">'._("Votre base de données n'est pas à jour").' ';
|
||||
$a=_("cliquez ici pour appliquer le patch");
|
||||
$base = dirname($_SERVER['REQUEST_URI']);
|
||||
if ($base == '/') { $base = ''; }
|
||||
$base .= '/admin-noalyss.php';
|
||||
$base =NOALYSS_URL.'/admin-noalyss.php';
|
||||
echo '<a hreF="'.$base.'">'.$a.'</a></h2>';
|
||||
|
||||
}
|
||||
if ( $User->Admin() == 1)
|
||||
{
|
||||
if (SITE_UPDATE !="") {
|
||||
$update=@file_get_contents(SITE_UPDATE);
|
||||
if (SITE_UPDATE !="") {
|
||||
$update=@file_get_contents(SITE_UPDATE);
|
||||
if ($update > $version_noalyss ) {
|
||||
echo '<div id="version_div" class="inner_box" style="width:25%;margin-left:10%;margin-top:3px;">';
|
||||
echo '<p class="notice">';
|
||||
printf ( "Mise à jour disponible de NOALYSS version actuelle : %s votre version %s ",$update,$version_noalyss);
|
||||
echo '</p>';
|
||||
echo '<p style="text-align:center"> <a class="button" onclick="document.body.removeChild(document.getElementById(\'version_div\'))">'.
|
||||
_('Fermer').
|
||||
"</a></p>";
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
echo '<div id="version_div" class="inner_box" style="width:25%;margin-left:10%;margin-top:3px;">';
|
||||
echo '<p class="notice">';
|
||||
printf ( "Mise à jour disponible de NOALYSS version actuelle : %s votre version %s ",$update,$version_noalyss);
|
||||
|
||||
// Link to admin_repo : upgrade application
|
||||
$base =NOALYSS_URL."/admin-noalyss.php?action=upgrade&sb=application";
|
||||
|
||||
echo '<a hreF="' . $base . '">' . _("Cliquez ici pour mettre à jour") . '</a>';
|
||||
echo '</p>';
|
||||
echo '<p style="text-align:center"> <a class="button" onclick="document.body.removeChild(document.getElementById(\'version_div\'))">'.
|
||||
_('Fermer').
|
||||
"</a></p>";
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include_once NOALYSS_INCLUDE."/lib/user_menu.php";
|
||||
|
|
@ -144,12 +147,11 @@ if ( $User->admin == 0 || (defined("MULTI")&& MULTI == 0 ) )
|
|||
if ( $folder != null && count($folder) == 1 )
|
||||
{
|
||||
|
||||
redirect('do.php?gDossier='.$folder[0]['dos_id']);
|
||||
redirect(NOALYSS_URL.'/do.php?gDossier='.$folder[0]['dos_id']);
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$result="";
|
||||
$result.="<table border=\"0\">";
|
||||
$result.='<TR>';
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
* templates... Accessible only by the administrator
|
||||
*/
|
||||
if ( ! defined ('ALLOWED')) { die (_('Non autorisé'));}
|
||||
if ( ! defined ('ALLOWED_ADMIN')) { die (_('Non autorisé'));}
|
||||
|
||||
include_once NOALYSS_INCLUDE."/class/user.class.php";
|
||||
require_once NOALYSS_INCLUDE."/lib/user_common.php";
|
||||
|
|
@ -46,7 +47,7 @@ if ($User->admin != 1)
|
|||
echo _("Vous n'êtes pas administateur");
|
||||
echo "</h2>";
|
||||
$reconnect=http_build_query(array("reconnect"=>1,"backurl"=>"admin-noalyss.php?action=upgrade"));
|
||||
echo '<a href="index.php?'.$reconnect.'">';
|
||||
echo '<a href="'.NOALYSS_URL.'/index.php?'.$reconnect.'">';
|
||||
echo _("Connectez-vous comme administrateur");
|
||||
echo '</a>';
|
||||
html_page_stop();
|
||||
|
|
@ -59,7 +60,7 @@ if ( $action== 'backup') {
|
|||
require_once NOALYSS_INCLUDE."/backup.inc.php";
|
||||
exit();
|
||||
}
|
||||
html_page_start();
|
||||
html_page_start($_SESSION['g_theme']);
|
||||
load_all_script();
|
||||
echo '<H2 class="info"> '._('Administration').'</H2>';
|
||||
echo '<div class="topmenu">';
|
||||
|
|
@ -191,19 +192,16 @@ hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #0
|
|||
echo $html->saveHTML();
|
||||
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// Upgrade
|
||||
//------------------------------------------------------------------------------
|
||||
if ( $action == "upgrade" ) {
|
||||
?>
|
||||
<form method="get" id="frm_upg_all" onsubmit="return confirm_box('frm_upg_all','<?php echo _('Confirmez')?>')">
|
||||
<input type="hidden" name="sb" value="upg_all">
|
||||
<input type="hidden" name="action" value="upgrade">
|
||||
<input type="submit" class="button" name="submit_upg_all" id="submit_upg_all" value="<?php echo _('Tout mettre à jour')?>">
|
||||
</form>
|
||||
<?php
|
||||
|
||||
|
||||
require_once NOALYSS_INCLUDE."/upgrade.inc.php";
|
||||
}
|
||||
?>
|
||||
</DIV>
|
||||
<?php
|
||||
|
||||
html_page_stop();
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -31,10 +31,11 @@ if ($g_user->Admin()==0)
|
|||
{
|
||||
die();
|
||||
}
|
||||
session_write_close();
|
||||
set_language();
|
||||
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
|
||||
$http=new HttpInput();
|
||||
|
||||
$op=$http->request("op");
|
||||
// From admin, grant the access to a folder to an
|
||||
// user
|
||||
if ($op=='folder_add') // operation
|
||||
|
|
@ -50,7 +51,7 @@ if ($op=='folder_add') // operation
|
|||
$dossiercn=new Database($dossier_id);
|
||||
// By default new user has the profile 1 (admin) and ledger's security
|
||||
// + action's security are disabled
|
||||
$user=new User($dossiercn,$user_id);
|
||||
$user=new User($dossiercn, $user_id);
|
||||
$user->set_status_security_action(0);
|
||||
$user->set_status_security_ledger(0);
|
||||
$user->save_profile(1);
|
||||
|
|
@ -70,7 +71,7 @@ if ($op=='folder_add') // operation
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// Answer in XML
|
||||
header('Content-type: text/xml; charset=UTF-8');
|
||||
|
|
@ -131,20 +132,20 @@ if ($op=='folder_display') // operation
|
|||
try
|
||||
{
|
||||
$user_id=$http->get("p_user", "number"); // get variable
|
||||
$p_filter=$http->get('p_filter', "string",'');
|
||||
$p_filter=$http->get('p_filter', "string", '');
|
||||
ob_start();
|
||||
$user=new User($cn, $user_id);
|
||||
$a_dossier=Dossier::show_dossier('X', $user->id, $p_filter, MAX_FOLDER_TO_SHOW);
|
||||
echo HtmlInput::title_box(_("Liste dossier"), 'folder_list_div');
|
||||
?>
|
||||
<form method="get" onsubmit="folder_display('<?php echo $user_id ?>');
|
||||
return false">
|
||||
return false">
|
||||
<p style="text-align: center">
|
||||
<?php echo _('Recherche'); ?>
|
||||
|
||||
|
||||
<input type="text" id="database_filter_input" class="input_text" autofocus="true" autocomplete="off" nohistory autocomplete="false" value="<?php echo $p_filter ?>"
|
||||
onkeyup="filter_table(this, 'folder_display_tb','1,2,3',0)" >
|
||||
<input type="button" class="smallbutton" onclick="$('database_filter_input').value='';filter_table($('database_filter_input'), 'folder_display_tb','1,2,3',0);" value="X">
|
||||
onkeyup="filter_table(this, 'folder_display_tb', '1,2,3', 0)" >
|
||||
<input type="button" class="smallbutton" onclick="$('database_filter_input').value = '';filter_table($('database_filter_input'), 'folder_display_tb', '1,2,3', 0);" value="X">
|
||||
<input type="submit" class="smallbutton" value="<?php echo _('Rechercher') ?>">
|
||||
</p>
|
||||
</form>
|
||||
|
|
@ -159,8 +160,6 @@ if ($op=='folder_display') // operation
|
|||
require NOALYSS_TEMPLATE.'/folder_display.php';
|
||||
$content=ob_get_clean();
|
||||
$status='OK';
|
||||
|
||||
|
||||
}
|
||||
catch (Exception $exc)
|
||||
{
|
||||
|
|
@ -195,14 +194,13 @@ if (in_array($op, array('modele_drop', 'modele_modify', 'folder_modify', 'folder
|
|||
$dossier=$http->get('p_dossier', "number");
|
||||
$content=_('Erreur paramètre');
|
||||
$status="NOK";
|
||||
|
||||
}
|
||||
catch (Exception $exc)
|
||||
{
|
||||
error_log($exc->getTraceAsString());
|
||||
$content=_('Erreur paramètre');
|
||||
$status="NOK";
|
||||
//----------------------------------------------------------------
|
||||
//----------------------------------------------------------------
|
||||
// Answer in XML
|
||||
header('Content-type: text/xml; charset=UTF-8');
|
||||
$dom=new DOMDocument('1.0', 'UTF-8');
|
||||
|
|
@ -215,7 +213,6 @@ if (in_array($op, array('modele_drop', 'modele_modify', 'folder_modify', 'folder
|
|||
$dom->appendChild($root);
|
||||
echo $dom->saveXML();
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
// Modify the description or the name of folder
|
||||
|
|
@ -237,8 +234,8 @@ if (in_array($op, array('modele_drop', 'modele_modify', 'folder_modify', 'folder
|
|||
echo _('Description').' : <br>';
|
||||
echo $wDesc->input('desc', $dos->get_parameter('desc'));
|
||||
echo '<br>';
|
||||
|
||||
echo _('Max. email / jour (-1 = illimité)') ;
|
||||
|
||||
echo _('Max. email / jour (-1 = illimité)');
|
||||
$max_email_input=new INum('max_email');
|
||||
$max_email_input->value=$dos->get_parameter('max_email');
|
||||
$max_email_input->prec=0;
|
||||
|
|
@ -341,4 +338,72 @@ if (in_array($op, array('modele_drop', 'modele_modify', 'folder_modify', 'folder
|
|||
echo $dom->saveXML();
|
||||
exit();
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
// Upgrade Core
|
||||
//------------------------------------------------------------------
|
||||
if ($op=='upgradeCore')
|
||||
{
|
||||
require_once NOALYSS_INCLUDE.'/lib/progress_bar.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/package_repository.class.php';
|
||||
$task_id=$http->request("task_id");
|
||||
$progress=new Progress_Bar($task_id);
|
||||
$progress->set_value(2);
|
||||
$repo=new Package_Repository();
|
||||
$core=$repo->make_object("core", " ");
|
||||
$progress->set_value(5);
|
||||
$core->download();
|
||||
$progress->set_value(55);
|
||||
if (!DEBUG)
|
||||
{
|
||||
$core->install();
|
||||
}
|
||||
$progress->set_value(100);
|
||||
|
||||
$url=sprintf('<a href="%s"> install.php</a>', NOALYSS_URL."/install.php");
|
||||
printf(_("Afin de terminer l'installation aller sur %s , à la fin de la procédure , demandez à effacer le fichier install.php"),
|
||||
$url);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
// Upgrade or install plugin
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
if ($op=='upgradePlugin')
|
||||
{
|
||||
require_once NOALYSS_INCLUDE.'/lib/progress_bar.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/package_repository.class.php';
|
||||
$task_id=$http->request("task_id");
|
||||
$code=$http->post("code_plugin");
|
||||
$progress=new Progress_Bar($task_id);
|
||||
$progress->set_value(2);
|
||||
$repo=new Package_Repository();
|
||||
$plugin=$repo->make_object("plugin", $code);
|
||||
$progress->set_value(5);
|
||||
$plugin->download();
|
||||
$progress->set_value(55);
|
||||
if (!DEBUG)
|
||||
{
|
||||
$plugin->install();
|
||||
}
|
||||
$progress->set_value(100);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Install template
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
if ($op=="installTemplate")
|
||||
{
|
||||
require_once NOALYSS_INCLUDE.'/lib/progress_bar.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/package_repository.class.php';
|
||||
$task_id=$http->request("task_id");
|
||||
$name=$http->post("code");
|
||||
$progress=new Progress_Bar($task_id);
|
||||
$progress->set_value(2);
|
||||
$package_repository=new Package_Repository();
|
||||
$progress->set_value(4);
|
||||
$template=$package_repository->make_object("template", $name);
|
||||
$progress->set_value(30);
|
||||
$template->download();
|
||||
$progress->set_value(70);
|
||||
$template->install();
|
||||
$progress->set_value(100);
|
||||
echo _("Modèle installé ");
|
||||
}
|
||||
?>
|
||||
|
|
@ -279,9 +279,11 @@ switch ($act)
|
|||
$a_answer['content']=ob_get_clean();
|
||||
$a_answer['status']="OK";
|
||||
$a_answer['p_id']=$p_id;
|
||||
$a_answer['status']="OK";
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$a_answer['status']="NOK";
|
||||
$a_answer['content']=$e->getMessage();
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
// Copyright Author Dany De Bontridder danydb@noalyss.eu
|
||||
|
||||
/*!\file
|
||||
* \brief let you see the list of the connexion
|
||||
*/
|
||||
if ( !defined ('ALLOWED')) die('Forbidden');
|
||||
?>
|
||||
<DIV class="content" style="width:80%;margin-left:10%">
|
||||
<DIV class="content">
|
||||
<span class="notice">Liste limitée aux 100 dernières connexions</span>
|
||||
<?php
|
||||
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@
|
|||
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/*!\file
|
||||
/* !\file
|
||||
* \brief the class for the dossier, everywhere we need to know to
|
||||
* which folder we are connected, because we can't use $_SESSION, we
|
||||
* need to pass the dossier_id via a _GET or a POST variable
|
||||
*/
|
||||
|
||||
/*! \brief manage the current dossier, everywhere we need to know to
|
||||
/* ! \brief manage the current dossier, everywhere we need to know to
|
||||
* which folder we are connected, because we can't use $_SESSION, we
|
||||
* need to pass the dossier_id via a _GET or a POST variable
|
||||
* private static $variable=array("id"=>"dos_id",
|
||||
|
|
@ -52,7 +52,7 @@ class Dossier
|
|||
$this->dos_id=$p_id;
|
||||
}
|
||||
|
||||
/*!\brief return the $_REQUEST['gDossier'] after a check */
|
||||
/* !\brief return the $_REQUEST['gDossier'] after a check */
|
||||
|
||||
static function id()
|
||||
{
|
||||
|
|
@ -78,11 +78,11 @@ class Dossier
|
|||
if ($p_type=="A")
|
||||
{
|
||||
$l_sql="select *, 'W' as priv_priv "
|
||||
. "from ac_dossier "
|
||||
. "where "
|
||||
. "dos_name ~* $2 "
|
||||
. "or dos_description ~* $2 "
|
||||
. "ORDER BY dos_name $str_limit ";
|
||||
."from ac_dossier "
|
||||
."where "
|
||||
."dos_name ~* $2 "
|
||||
."or dos_description ~* $2 "
|
||||
."ORDER BY dos_name $str_limit ";
|
||||
$a_row=$cn->get_array($l_sql, $p_text);
|
||||
return $a_row;
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ class Dossier
|
|||
return $nb_folder;
|
||||
}
|
||||
|
||||
/*!
|
||||
/* !
|
||||
* \brief Return all the users
|
||||
* as an array
|
||||
*/
|
||||
|
|
@ -157,11 +157,11 @@ class Dossier
|
|||
$sql
|
||||
";
|
||||
|
||||
$res=$this->cn->get_array($sql,array(NOALYSS_ADMINISTRATOR));
|
||||
$res=$this->cn->get_array($sql, array(NOALYSS_ADMINISTRATOR));
|
||||
return $res;
|
||||
}
|
||||
|
||||
/*!\brief check if gDossier is set */
|
||||
/* !\brief check if gDossier is set */
|
||||
|
||||
static function check()
|
||||
{
|
||||
|
|
@ -177,7 +177,7 @@ class Dossier
|
|||
exit('gDossier Invalide : '.$id);
|
||||
}
|
||||
|
||||
/*!
|
||||
/* !
|
||||
* \brief return a string to put to gDossier into a GET
|
||||
*/
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ class Dossier
|
|||
return "gDossier=".$_REQUEST['gDossier'];
|
||||
}
|
||||
|
||||
/*!\brief return a string to set gDossier into a FORM */
|
||||
/* !\brief return a string to set gDossier into a FORM */
|
||||
|
||||
static function hidden()
|
||||
{
|
||||
|
|
@ -195,7 +195,7 @@ class Dossier
|
|||
return '<input type="hidden" id="gDossier" name="gDossier" value="'.$_REQUEST['gDossier'].'">';
|
||||
}
|
||||
|
||||
/*!\brief retrieve the name of the current dossier */
|
||||
/* !\brief retrieve the name of the current dossier */
|
||||
|
||||
static function name($id=0)
|
||||
{
|
||||
|
|
@ -203,8 +203,7 @@ class Dossier
|
|||
|
||||
$cn=new Database();
|
||||
$id=($id==0)?$_REQUEST['gDossier']:$id;
|
||||
$name=$cn->get_value("select dos_name from ac_dossier where dos_id=$1",
|
||||
array($_REQUEST['gDossier']));
|
||||
$name=$cn->get_value("select dos_name from ac_dossier where dos_id=$1", array($_REQUEST['gDossier']));
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
|
@ -246,18 +245,16 @@ class Dossier
|
|||
return;
|
||||
|
||||
if ($this->cn->get_value("select count(*) from ac_dossier "
|
||||
. " where dos_name=$1 and dos_id<>$2",
|
||||
array($this->dos_name, $this->dos_id))!=0)
|
||||
." where dos_name=$1 and dos_id<>$2", array($this->dos_name, $this->dos_id))!=0)
|
||||
return;
|
||||
|
||||
$sql="update ac_dossier set dos_name=$1,dos_description=$2 ,dos_email=$3".
|
||||
" where dos_id = $4";
|
||||
$res=$this->cn->exec_sql(
|
||||
$sql,
|
||||
array(trim($this->dos_name),
|
||||
trim($this->dos_description),
|
||||
$this->dos_email,
|
||||
$this->dos_id)
|
||||
$sql, array(trim($this->dos_name),
|
||||
trim($this->dos_description),
|
||||
$this->dos_email,
|
||||
$this->dos_id)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -300,7 +297,7 @@ class Dossier
|
|||
*/
|
||||
static function synchro_admin($p_id)
|
||||
{
|
||||
// connect to target
|
||||
// connect to target
|
||||
$cn=new Database($p_id);
|
||||
|
||||
if (!$cn->exist_table("profile_menu"))
|
||||
|
|
@ -308,7 +305,7 @@ class Dossier
|
|||
echo_warning("Dossier invalide");
|
||||
return;
|
||||
}
|
||||
// connect to repo
|
||||
// connect to repo
|
||||
$repo=new Database();
|
||||
|
||||
$a_admin=$repo->get_array("select use_login from ac_users where
|
||||
|
|
@ -327,11 +324,86 @@ class Dossier
|
|||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
|
||||
|
||||
echo_warning($e->getMessage());
|
||||
record_log($e->getTraceAsString());
|
||||
$cn->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
static function upgrade()
|
||||
{
|
||||
$rep=new Database();
|
||||
/* If multi folders */
|
||||
$Resdossier=$rep->exec_sql("select dos_id, dos_name from ac_dossier");
|
||||
$MaxDossier=$rep->size($Resdossier);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Upgrade the account_repository
|
||||
//----------------------------------------------------------------------
|
||||
echo "<h2>"._("Mise à jour de la base de données principale")."</h2>";
|
||||
$cn=new Database();
|
||||
if (DEBUG==false)
|
||||
ob_start();
|
||||
$MaxVersion=DBVERSIONREPO-1;
|
||||
for ($i=4; $i<=$MaxVersion; $i++)
|
||||
{
|
||||
if ($cn->get_version()<=$i)
|
||||
{
|
||||
$cn->execute_script(NOALYSS_INCLUDE.'/sql/patch/ac-upgrade'.$i.'.sql');
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Upgrade the folders
|
||||
//----------------------------------------------------------------------
|
||||
echo "<h2>"._("Mise à jour dossiers")."</h2>";
|
||||
|
||||
for ($e=0; $e<$MaxDossier; $e++)
|
||||
{
|
||||
$db_row=Database::fetch_array($Resdossier, $e);
|
||||
$name=$rep->format_name($db_row['dos_id'], 'dos');
|
||||
echo "<h3>Patching ".$db_row['dos_name'].'</h3>';
|
||||
echo _('Base de données')." ".$name;
|
||||
|
||||
if ($rep->exist_database($name)>0)
|
||||
{
|
||||
$db=new Database($db_row['dos_id'], 'dos');
|
||||
$db->apply_patch($db_row['dos_name']);
|
||||
Dossier::synchro_admin($db_row['dos_id']);
|
||||
User::remove_inexistant_user($db_row['dos_id']);
|
||||
$db->clean_orphan_lob();
|
||||
}
|
||||
else
|
||||
{
|
||||
echo_warning(_("Dossier inexistant")." $name");
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Upgrade the template
|
||||
//----------------------------------------------------------------------
|
||||
$Resdossier=$rep->exec_sql("select mod_id, mod_name from modeledef");
|
||||
$MaxDossier=$rep->size();
|
||||
echo "<h2>"._("Mise à jour modèles")."</h2>";
|
||||
|
||||
for ($e=0; $e<$MaxDossier; $e++)
|
||||
{
|
||||
$db_row=Database::fetch_array($Resdossier, $e);
|
||||
$name=$rep->format_name($db_row['mod_id'], 'mod');
|
||||
echo "<h3>Patching ".$db_row['mod_name']."</h3>";
|
||||
echo _('Base de données')." ".$name;
|
||||
if ($rep->exist_database($name)>0)
|
||||
{
|
||||
$db=new Database($db_row['mod_id'], 'mod');
|
||||
$db->apply_patch($db_row['mod_name']);
|
||||
$db->clean_orphan_lob();
|
||||
}
|
||||
else
|
||||
{
|
||||
echo_warning(_("Modèle inexistant")." $name");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
|
|
@ -15,15 +16,15 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with NOALYSS; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
*/
|
||||
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/*!\file
|
||||
/* !\file
|
||||
* \brief the extension class manages the plugins for the security, the access
|
||||
* the inclusion...
|
||||
*/
|
||||
/*!\brief manage the extension, it involves the table extension
|
||||
/* !\brief manage the extension, it involves the table extension
|
||||
*
|
||||
* Data member
|
||||
* - $cn database connection
|
||||
|
|
@ -42,63 +43,76 @@ require_once NOALYSS_INCLUDE.'/class/profile_menu.class.php';
|
|||
|
||||
class Extension extends Menu_Ref_sql
|
||||
{
|
||||
|
||||
public function verify()
|
||||
{
|
||||
// Verify that the elt we want to add is correct
|
||||
if (trim($this->me_code)=="") throw new Exception('Le code ne peut pas être vide');
|
||||
if (trim($this->me_menu)=="") throw new Exception('Le nom ne peut pas être vide');
|
||||
if (trim($this->me_file)=="") throw new Exception('Chemin incorrect');
|
||||
if (file_exists(NOALYSS_PLUGIN.'/'.$this->me_file) == false)
|
||||
throw new Exception ('Extension non trouvée, le chemin est-il correct?');
|
||||
if (trim($this->me_code)=="")
|
||||
throw new Exception('Le code ne peut pas être vide');
|
||||
if (trim($this->me_menu)=="")
|
||||
throw new Exception('Le nom ne peut pas être vide');
|
||||
if (trim($this->me_file)=="")
|
||||
throw new Exception('Chemin incorrect');
|
||||
if (file_exists(NOALYSS_PLUGIN.'/'.$this->me_file)==false)
|
||||
throw new Exception('Extension non trouvée, le chemin est-il correct?');
|
||||
}
|
||||
/*!@brief search a extension, the what is the column (extends_code */
|
||||
|
||||
/* !@brief search a extension, the what is the column (extends_code */
|
||||
|
||||
function search($p_what)
|
||||
{
|
||||
$this->me_code=strtoupper($p_what);
|
||||
if ( $this->load() == -1) return null;
|
||||
return 1;
|
||||
$this->me_code=strtoupper($p_what);
|
||||
if ($this->load()==-1)
|
||||
return null;
|
||||
return 1;
|
||||
}
|
||||
/*!\brief return 1 if the user given in parameter can access this extension
|
||||
|
||||
/* !\brief return 1 if the user given in parameter can access this extension
|
||||
* otherwise returns 0
|
||||
*\param $p_login the user login
|
||||
*\return 1 has access, 0 has no access
|
||||
* \param $p_login the user login
|
||||
* \return 1 has access, 0 has no access
|
||||
*/
|
||||
|
||||
function can_request($p_login)
|
||||
{
|
||||
$cnt=$this->cn->get_value("select count(*) from menu_ref
|
||||
join profile_menu using (me_code)
|
||||
join profile_user using (p_id)
|
||||
where
|
||||
me_code=$1
|
||||
and user_name=$2",
|
||||
array($this->me_code,$p_login));
|
||||
if ( $cnt > 0) return 1;
|
||||
return 0;
|
||||
$cnt=$this->cn->get_value("select count(*) from menu_ref
|
||||
join profile_menu using (me_code)
|
||||
join profile_user using (p_id)
|
||||
where
|
||||
me_code=$1
|
||||
and user_name=$2", array($this->me_code, $p_login));
|
||||
if ($cnt>0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
/*!@brief make an array of the available plugin for the current user
|
||||
|
||||
/* !@brief make an array of the available plugin for the current user
|
||||
* @return an array
|
||||
*@see ISelect
|
||||
* @see ISelect
|
||||
*/
|
||||
|
||||
static function make_array($cn)
|
||||
{
|
||||
$sql="select DISTINCT me_code as value, me_menu as label from ".
|
||||
" menu_ref join profile_menu using (me_code)
|
||||
" menu_ref join profile_menu using (me_code)
|
||||
join profile_user using (p_id) where ".
|
||||
" user_name=$1 and me_type='PL' ORDER BY ME_MENU";
|
||||
$a=$cn->get_array($sql,array($_SESSION['g_user']));
|
||||
" user_name=$1 and me_type='PL' ORDER BY ME_MENU";
|
||||
$a=$cn->get_array($sql, array($_SESSION['g_user']));
|
||||
return $a;
|
||||
}
|
||||
|
||||
static function check_version($i)
|
||||
{
|
||||
global $version_noalyss;
|
||||
if ( ! isset ($version_noalyss) || $version_noalyss < $i )
|
||||
if (!isset($version_noalyss)||$version_noalyss<$i)
|
||||
{
|
||||
alert(_('Cette extension ne fonctionne pas sur cette version de NOALYSS'.
|
||||
' Veuillez mettre votre programme a jour. Version minimum ').$i);
|
||||
' Veuillez mettre votre programme a jour. Version minimum ').$i);
|
||||
return;
|
||||
}
|
||||
Extension::check_plugin_version();
|
||||
}
|
||||
|
||||
/**
|
||||
* insert into the table profile_menu for the given profile id and depending
|
||||
* of the module $p_module
|
||||
|
|
@ -112,28 +126,31 @@ class Extension extends Menu_Ref_sql
|
|||
// Module for the plugin
|
||||
$p_module=$this->depend;
|
||||
//profile exists ?
|
||||
$profile=new Profile_sql($cn,$p_id);
|
||||
if ( $profile->p_id != $p_id) {
|
||||
throw new Exception(_('Profil inexistant'),10);
|
||||
$profile=new Profile_sql($cn, $p_id);
|
||||
if ($profile->p_id!=$p_id)
|
||||
{
|
||||
throw new Exception(_('Profil inexistant'), 10);
|
||||
}
|
||||
// Menu exists
|
||||
$module=new Menu_Ref($cn,$p_module);
|
||||
if ($module->me_code==null) {
|
||||
throw new Exception(_('Module inexistant'),20);
|
||||
$module=new Menu_Ref($cn, $p_module);
|
||||
if ($module->me_code==null)
|
||||
{
|
||||
throw new Exception(_('Module inexistant'), 20);
|
||||
}
|
||||
// Dependency
|
||||
$dep_id=$cn->get_array('select pm_id from profile_menu
|
||||
where
|
||||
p_id=$1
|
||||
and me_code = $2 ',array($p_id,$p_module));
|
||||
and me_code = $2 ', array($p_id, $p_module));
|
||||
// throw an exception if there is no dependency
|
||||
if (empty($dep_id)) {
|
||||
throw new Exception(_('Pas de menu ').$p_module,30);
|
||||
if (empty($dep_id))
|
||||
{
|
||||
throw new Exception(_('Pas de menu ').$p_module, 30);
|
||||
}
|
||||
$nb_dep=count($dep_id);
|
||||
|
||||
|
||||
// insert at the right location
|
||||
for ($i=0;$i<$nb_dep;$i++)
|
||||
for ($i=0; $i<$nb_dep; $i++)
|
||||
{
|
||||
$profil_menu=new Profile_Menu($cn);
|
||||
$profil_menu->me_code=$this->me_code;
|
||||
|
|
@ -144,178 +161,203 @@ class Extension extends Menu_Ref_sql
|
|||
$profil_menu->pm_default=0;
|
||||
$profil_menu->p_order=$this->order;
|
||||
|
||||
$cnt=$profil_menu->count(' where pm_id_dep=$3 and p_id=$1 and me_code = $2',array($p_id,$this->me_code,$dep_id[$i]['pm_id']));
|
||||
if ( $cnt==0) {
|
||||
$cnt=$profil_menu->count(' where pm_id_dep=$3 and p_id=$1 and me_code = $2',
|
||||
array($p_id, $this->me_code, $dep_id[$i]['pm_id']));
|
||||
if ($cnt==0)
|
||||
{
|
||||
$profil_menu->insert();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function remove_from_profile_menu($p_id)
|
||||
{
|
||||
global $cn;
|
||||
|
||||
$cn->exec_sql('delete from profile_menu where (me_code = $1 or me_code in (select me_code from menu_ref where me_file=$2)) and p_id=$3',array($this->me_code,$this->me_file,$p_id));
|
||||
|
||||
|
||||
$cn->exec_sql('delete from profile_menu where (me_code = $1 or me_code in (select me_code from menu_ref where me_file=$2)) and p_id=$3',
|
||||
array($this->me_code, $this->me_file, $p_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a plugin into the given profile, by default always insert into EXT
|
||||
*
|
||||
* @param type $p_id profile.p_id
|
||||
* @throws Exception if duplicate or error db
|
||||
*/
|
||||
function insert_plugin()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->cn->start();
|
||||
$this->verify();
|
||||
// check if duplicate
|
||||
$this->me_code = strtoupper($this->me_code);
|
||||
$count = $this->cn->get_value("select count(*) from menu_ref where me_code=$1", array($this->me_code));
|
||||
if ($count != 0)
|
||||
throw new Exception("Doublon");
|
||||
$this->me_type = 'PL';
|
||||
$this->insert();
|
||||
$this->cn->commit();
|
||||
}
|
||||
catch (Exception $exc)
|
||||
{
|
||||
echo alert($exc->getMessage());
|
||||
}
|
||||
}
|
||||
function update_plugin()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->cn->start();
|
||||
$this->verify();
|
||||
$this->me_type = 'PL';
|
||||
$this->update();
|
||||
$this->cn->commit();
|
||||
}
|
||||
catch (Exception $exc)
|
||||
{
|
||||
echo alert($exc->getMessage());
|
||||
}
|
||||
}
|
||||
function remove_plugin()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->cn->start();
|
||||
$this->delete();
|
||||
$this->cn->commit();
|
||||
}
|
||||
catch (Exception $exc)
|
||||
{
|
||||
echo alert($exc->getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
*remove all the schema from the plugins
|
||||
* @param Database $p_cn
|
||||
*/
|
||||
static function clean(Database $p_cn)
|
||||
{
|
||||
$a_ext=array("tva_belge","amortissement","impdol","coprop","importbank");
|
||||
for($i=0;$i<count($a_ext);$i++){
|
||||
if ($p_cn->exist_schema($a_ext[$i])) {
|
||||
$p_cn->exec_sql("drop schema ".$a_ext[$i]." cascade");
|
||||
}
|
||||
}
|
||||
}
|
||||
static function check_plugin_version()
|
||||
function insert_plugin()
|
||||
{
|
||||
try
|
||||
{
|
||||
global $g_user,$version_plugin;
|
||||
if ($g_user->Admin() == 1)
|
||||
{
|
||||
if (SITE_UPDATE_PLUGIN != "")
|
||||
{
|
||||
$update = @file_get_contents(SITE_UPDATE_PLUGIN);
|
||||
if ($update > $version_plugin)
|
||||
{
|
||||
echo '<div id="version_plugin_div_id" class="inner_box" style="position:absolute;zindex:2;top:5px;left:37.5%;width:25%">';
|
||||
echo '<p class="notice">';
|
||||
echo "Mise à jour disponible des plugins pour NOALYSS, version actuelle : $update votre version $version_plugin";
|
||||
echo '</p>';
|
||||
echo '<p style="text-align:center">'.
|
||||
'<a id="version_plugin_button" class="button" onclick="$(\'version_plugin_div_id\').remove()">'.
|
||||
_('Fermer').
|
||||
"</a></p>";
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->cn->start();
|
||||
$this->verify();
|
||||
// check if duplicate
|
||||
$this->me_code=strtoupper($this->me_code);
|
||||
$count=$this->cn->get_value("select count(*) from menu_ref where me_code=$1", array($this->me_code));
|
||||
if ($count!=0)
|
||||
throw new Exception("Doublon");
|
||||
$this->me_type='PL';
|
||||
$this->insert();
|
||||
$this->cn->commit();
|
||||
}
|
||||
/**
|
||||
* Check that the xml contains all the needed information to change them into
|
||||
* a extension, the exception code is 0 if the element is optional
|
||||
* @brief Check XML.
|
||||
* @param SimpleXMLElement $xml
|
||||
* @throws Exception
|
||||
*/
|
||||
function check_xml(SimpleXMLElement $xml)
|
||||
catch (Exception $exc)
|
||||
{
|
||||
try {
|
||||
if ( !isset ($xml->plugin)) throw new Exception(_('Manque plugin'),1);
|
||||
$nb_plugin=count($xml->plugin);
|
||||
|
||||
for ($i=0;$i<$nb_plugin;$i++)
|
||||
{
|
||||
if ( !isset ($xml->plugin[$i]->name)) throw new Exception(_('Manque nom'),1);
|
||||
if ( !isset ($xml->plugin[$i]->description)) throw new Exception(_('Manque description'),0);
|
||||
if ( !isset ($xml->plugin[$i]->code)) throw new Exception(_('Manque code'),1);
|
||||
if ( !isset ($xml->plugin[$i]->author)) throw new Exception(_('Manque auteur'),0);
|
||||
if ( !isset ($xml->plugin[$i]->root)) throw new Exception(_('Manque répertoire racine'),1);
|
||||
if ( !isset ($xml->plugin[$i]->file)) throw new Exception(_('Manque fichier à inclure'),1);
|
||||
if ( !isset ($xml->plugin[$i]->depend)) $xml->plugin[$i]->depend="EXT";
|
||||
if ( !isset ($xml->plugin[$i]->order)) $xml->plugin[$i]->order=9000;
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
throw $ex;
|
||||
}
|
||||
echo alert($exc->getMessage());
|
||||
}
|
||||
/**
|
||||
* Parse a XML file to complete an array of extension objects
|
||||
* @brief Create extension from XML.
|
||||
* @param type $p_file filename
|
||||
* @return array of Extension
|
||||
*/
|
||||
static function read_definition($p_file)
|
||||
{
|
||||
global $cn;
|
||||
$dom=new DomDocument('1.0');
|
||||
$dom->load($p_file);
|
||||
$xml=simplexml_import_dom($dom);
|
||||
$nb_plugin=count($xml->plugin);
|
||||
$a_extension=array();
|
||||
for ($i=0;$i<$nb_plugin;$i++)
|
||||
{
|
||||
|
||||
$extension=new Extension($cn);
|
||||
try {
|
||||
$extension->check_xml($xml);
|
||||
} catch (Exception $ex) {
|
||||
echo_warning($e->getMessage());
|
||||
if ( $ex->getCode()==1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
$extension->me_file=trim($xml->plugin[$i]->root).'/'.trim($xml->plugin[$i]->file);
|
||||
$extension->me_code=trim($xml->plugin[$i]->code);
|
||||
$extension->me_description=(isset ($xml->plugin[$i]->description))?trim($xml->plugin[$i]->description):"";
|
||||
$extension->me_description_etendue=(trim($xml->plugin[$i]->author))?trim($xml->plugin[$i]->author):"";
|
||||
$extension->me_type='PL';
|
||||
$extension->me_menu=trim($xml->plugin[$i]->name);
|
||||
$extension->me_parameter='plugin_code='.trim($xml->plugin[$i]->code);
|
||||
$extension->depend=(isset($xml->plugin[$i]->depend))?trim($xml->plugin[$i]->depend):"";
|
||||
$extension->order=(isset($xml->plugin[$i]->order))?trim($xml->plugin[$i]->order):9000;
|
||||
$a_extension[]=clone $extension;
|
||||
}
|
||||
return $a_extension;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function update_plugin()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->cn->start();
|
||||
$this->verify();
|
||||
$this->me_type='PL';
|
||||
$this->update();
|
||||
$this->cn->commit();
|
||||
}
|
||||
catch (Exception $exc)
|
||||
{
|
||||
echo alert($exc->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
function remove_plugin()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->cn->start();
|
||||
$this->delete();
|
||||
$this->cn->commit();
|
||||
}
|
||||
catch (Exception $exc)
|
||||
{
|
||||
echo alert($exc->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* remove all the schema from the plugins
|
||||
* @param Database $p_cn
|
||||
*/
|
||||
static function clean(Database $p_cn)
|
||||
{
|
||||
$a_ext=array("tva_belge", "amortissement", "impdol", "coprop", "importbank");
|
||||
for ($i=0; $i<count($a_ext); $i++)
|
||||
{
|
||||
if ($p_cn->exist_schema($a_ext[$i]))
|
||||
{
|
||||
$p_cn->exec_sql("drop schema ".$a_ext[$i]." cascade");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static function check_plugin_version()
|
||||
{
|
||||
global $g_user, $version_plugin;
|
||||
if ($g_user->Admin()==1)
|
||||
{
|
||||
if (SITE_UPDATE_PLUGIN!="")
|
||||
{
|
||||
$update=@file_get_contents(SITE_UPDATE_PLUGIN);
|
||||
if ($update>$version_plugin)
|
||||
{
|
||||
echo '<div id="version_plugin_div_id" class="inner_box" style="position:absolute;zindex:2;top:5px;left:37.5%;width:25%">';
|
||||
echo '<p class="notice">';
|
||||
echo "Mise à jour disponible des plugins pour NOALYSS, version actuelle : $update votre version $version_plugin";
|
||||
echo '</p>';
|
||||
echo '<p style="text-align:center">'.
|
||||
'<a id="version_plugin_button" class="button" onclick="$(\'version_plugin_div_id\').remove()">'.
|
||||
_('Fermer').
|
||||
"</a></p>";
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the xml contains all the needed information to change them into
|
||||
* a extension, the exception code is 0 if the element is optional
|
||||
* @brief Check XML.
|
||||
* @param SimpleXMLElement $xml
|
||||
* @throws Exception
|
||||
*/
|
||||
function check_xml(SimpleXMLElement $xml)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!isset($xml->plugin))
|
||||
throw new Exception(_('Manque plugin'), 1);
|
||||
$nb_plugin=count($xml->plugin);
|
||||
|
||||
for ($i=0; $i<$nb_plugin; $i++)
|
||||
{
|
||||
if (!isset($xml->plugin[$i]->name))
|
||||
throw new Exception(_('Manque nom'), 1);
|
||||
if (!isset($xml->plugin[$i]->description))
|
||||
throw new Exception(_('Manque description'), 0);
|
||||
if (!isset($xml->plugin[$i]->code))
|
||||
throw new Exception(_('Manque code'), 1);
|
||||
if (!isset($xml->plugin[$i]->author))
|
||||
throw new Exception(_('Manque auteur'), 0);
|
||||
if (!isset($xml->plugin[$i]->root))
|
||||
throw new Exception(_('Manque répertoire racine'), 1);
|
||||
if (!isset($xml->plugin[$i]->file))
|
||||
throw new Exception(_('Manque fichier à inclure'), 1);
|
||||
if (!isset($xml->plugin[$i]->depend))
|
||||
$xml->plugin[$i]->depend="EXT";
|
||||
if (!isset($xml->plugin[$i]->order))
|
||||
$xml->plugin[$i]->order=9000;
|
||||
}
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a XML file to complete an array of extension objects
|
||||
* @brief Create extension from XML.
|
||||
* @param string $p_file filename
|
||||
* @return array array of Extension
|
||||
*/
|
||||
static function read_definition($p_file)
|
||||
{
|
||||
global $cn;
|
||||
$dom=new DomDocument('1.0');
|
||||
$dom->load($p_file);
|
||||
$xml=simplexml_import_dom($dom);
|
||||
$nb_plugin=count($xml->plugin);
|
||||
$a_extension=array();
|
||||
for ($i=0; $i<$nb_plugin; $i++)
|
||||
{
|
||||
|
||||
$extension=new Extension($cn);
|
||||
try
|
||||
{
|
||||
$extension->check_xml($xml);
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
echo_warning($e->getMessage());
|
||||
if ($ex->getCode()==1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$extension->me_file=trim($xml->plugin[$i]->root).'/'.trim($xml->plugin[$i]->file);
|
||||
$extension->me_code=trim($xml->plugin[$i]->code);
|
||||
$extension->me_description=(isset($xml->plugin[$i]->description))?trim($xml->plugin[$i]->description):"";
|
||||
$extension->me_description_etendue=(trim($xml->plugin[$i]->author))?trim($xml->plugin[$i]->author):"";
|
||||
$extension->me_type='PL';
|
||||
$extension->me_menu=trim($xml->plugin[$i]->name);
|
||||
$extension->me_parameter='plugin_code='.trim($xml->plugin[$i]->code);
|
||||
$extension->depend=(isset($xml->plugin[$i]->depend))?trim($xml->plugin[$i]->depend):"";
|
||||
$extension->order=(isset($xml->plugin[$i]->order))?trim($xml->plugin[$i]->order):9000;
|
||||
$a_extension[]=clone $extension;
|
||||
}
|
||||
return $a_extension;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
25
include/class/package_contrib.class.php
Normal file
25
include/class/package_contrib.class.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
*/
|
||||
64
include/class/package_core.class.php
Normal file
64
include/class/package_core.class.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
|
||||
require_once NOALYSS_INCLUDE.'/class/package_noalyss.class.php';
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Class Package Core to install the core , if possible
|
||||
*/
|
||||
class Package_Core extends Package_Noalyss
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief check if it is possible to install
|
||||
* Are the folder html and include writeable ?
|
||||
*/
|
||||
public function can_install()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Unzip the file and overwrite current implementation, the databases and modele are not upgraded.
|
||||
*It must be done after.
|
||||
* In this package the install is given and must be delete manually
|
||||
* @throws Exception 1 : cannot extract content of the zip , 2: cannot open zip file
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
$zip=new ZipArchive ();
|
||||
// open the file
|
||||
if ($zip->open(NOALYSS_HOME."/tmp/".$this->get_file()))
|
||||
{
|
||||
// try to unzip and overwrite current
|
||||
if (!$zip->extractTo(NOALYSS_HOME."/../"))
|
||||
{
|
||||
throw new Exception(_("Echec mis à jour"), 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("Ce n'est pas un fichier valide"), 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
117
include/class/package_noalyss.class.php
Normal file
117
include/class/package_noalyss.class.php
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief package noalyss is the mother class of the class to install and download package
|
||||
*/
|
||||
abstract class Package_Noalyss
|
||||
{
|
||||
|
||||
private $file;
|
||||
private $path;
|
||||
private $name;
|
||||
private $description;
|
||||
|
||||
function __construct($name, $description, $full_path)
|
||||
{
|
||||
$this->file=basename(trim($full_path));
|
||||
$this->path=dirname(trim($full_path));
|
||||
|
||||
$this->description=$description;
|
||||
$this->name=$name;
|
||||
}
|
||||
|
||||
public function get_path()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
public function set_path($path)
|
||||
{
|
||||
$this->path=$path;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function get_file()
|
||||
{
|
||||
return $this->file;
|
||||
}
|
||||
|
||||
public function get_name()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function get_description()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function set_file($file)
|
||||
{
|
||||
$this->file=$file;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function set_name($name)
|
||||
{
|
||||
$this->name=$name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function set_description($description)
|
||||
{
|
||||
$this->description=$description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* check that NOALYSS_HOME exists and is writable
|
||||
*/
|
||||
function can_download()
|
||||
{
|
||||
$download_dir=NOALYSS_HOME."/tmp";
|
||||
if (is_dir($download_dir)&&is_writable($download_dir))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function download()
|
||||
{
|
||||
// If install is writable then download
|
||||
if ( $this->can_download() )
|
||||
{
|
||||
$full=$this->get_path()."/".$this->get_file();
|
||||
$file = file_get_contents(NOALYSS_PACKAGE_REPOSITORY."/".$full);
|
||||
$fh_file=fopen(NOALYSS_HOME."/tmp/".$this->get_file(),"w+");
|
||||
|
||||
fwrite($fh_file, $file);
|
||||
fclose($fh_file);
|
||||
}
|
||||
}
|
||||
|
||||
abstract function install();
|
||||
|
||||
abstract function can_install();
|
||||
}
|
||||
66
include/class/package_plugin.class.php
Normal file
66
include/class/package_plugin.class.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE."/class/package_noalyss.class.php";
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @brief
|
||||
*/
|
||||
class Package_Plugin extends Package_Noalyss
|
||||
{
|
||||
|
||||
public function install()
|
||||
{
|
||||
$zip=new ZipArchive ();
|
||||
// open the file
|
||||
if ($zip->open(NOALYSS_HOME."/tmp/".$this->get_file()))
|
||||
{
|
||||
// try to unzip and overwrite current
|
||||
if (!$zip->extractTo(NOALYSS_PLUGIN))
|
||||
{
|
||||
throw new Exception(_("Echec installation plugin "), 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("Ce n'est pas un fichier valide"), 2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the NOALYSS_PLUGIN is writeable
|
||||
*/
|
||||
public function can_install()
|
||||
{
|
||||
if (is_writable(NOALYSS_PLUGIN))
|
||||
{
|
||||
return TRUE; ;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
175
include/class/package_repository.class.php
Normal file
175
include/class/package_repository.class.php
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief contains the class Package_Repository
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/class/package_core.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/package_plugin.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/package_template.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/package_contrib.class.php';
|
||||
|
||||
/**
|
||||
* @brief connect to NOALYSS_PACKAGE and fetch the file web.xml , it displays
|
||||
* content of this file , build the appropriate object for installing
|
||||
*/
|
||||
class Package_Repository
|
||||
{
|
||||
|
||||
private $content;
|
||||
|
||||
/**
|
||||
* @see package_repository.test.php
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$content=file_get_contents(NOALYSS_PACKAGE_REPOSITORY."/web.xml");
|
||||
|
||||
$this->content=simplexml_load_string($content);
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* check that NOALYSS_HOME exists and is writable
|
||||
*/
|
||||
function can_download()
|
||||
{
|
||||
$download_dir=NOALYSS_HOME."/tmp";
|
||||
if (is_dir($download_dir)&&is_writable($download_dir))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get info for Noalyss code : version #, announce, path to the last
|
||||
* version
|
||||
*/
|
||||
function display_noalyss_info()
|
||||
{
|
||||
global $g_user;
|
||||
switch ($g_user->lang)
|
||||
{
|
||||
case 'fr_FR.utf8':
|
||||
echo "<pre>";
|
||||
echo $this->content->core->description;
|
||||
echo "</pre>";
|
||||
|
||||
break;
|
||||
case 'en_US.utf8':
|
||||
break;
|
||||
case 'nl_NL.utf8':
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return a SimpleXMLElement of the plugin thanks its code, it returns NULL if no plugin is found
|
||||
* @param string $p_code code of the plugin
|
||||
* @return SimpleXMLElement or NULL if not found
|
||||
*/
|
||||
function find_plugin($p_code)
|
||||
{
|
||||
$a_plugin=$this->content->xpath('//plugins/plugin');
|
||||
$nb_plugin=count($a_plugin);
|
||||
for ($i=0; $i<$nb_plugin; $i++)
|
||||
{
|
||||
if (trim($a_plugin[$i]->code)==$p_code)
|
||||
{
|
||||
return $a_plugin[$i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return a SimpleXMLElement of the db template thanks its code, it returns NULL if no template is found
|
||||
* @param string $p_code code of the template
|
||||
* @return SimpleXMLElement or NULL if not found
|
||||
*/
|
||||
function find_template($p_code)
|
||||
{
|
||||
$a_template=$this->content->xpath('//database_template/dbtemplate');
|
||||
$nb_template=count($a_template);
|
||||
for ($i=0; $i<$nb_template; $i++)
|
||||
{
|
||||
if (trim($a_template[$i]->code)==$p_code)
|
||||
{
|
||||
return $a_template[$i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
function make_object($p_type, $p_id)
|
||||
{
|
||||
switch ($p_type)
|
||||
{
|
||||
case "core":
|
||||
// Create an object to download & install the core
|
||||
$obj=new Package_Core("Noalyss", "Core", $this->content->core->path);
|
||||
return $obj;
|
||||
break;
|
||||
case 'template':
|
||||
// create an object to download & install the template
|
||||
$db=$this->find_template($p_id);
|
||||
if ($db == NULL ) {
|
||||
throw new Exception(_("Modèle non trouvé"),1002);
|
||||
}
|
||||
$obj=new Package_Template($db->name,$db->description,$db->path);
|
||||
return $obj;
|
||||
case 'plugin':
|
||||
// create an object to download & install a plugin
|
||||
$plugin = $this->find_plugin($p_id);
|
||||
if ($plugin==NULL)
|
||||
{
|
||||
throw new Exception(_("Extension non trouvée"), 1001);
|
||||
}
|
||||
$obj=new Package_Plugin($plugin->name,$plugin->description,$plugin->path);
|
||||
return $obj;
|
||||
break;
|
||||
case 'contrib':
|
||||
//create an object to download & install a contrib
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Read xml file from the package
|
||||
* @param string $p_file
|
||||
* @return SimpleXMLElement
|
||||
*/
|
||||
public function read_package_xml($p_file)
|
||||
{
|
||||
$dom=new DomDocument('1.0');
|
||||
$dom->load($p_file);
|
||||
$xml=simplexml_import_dom($dom);
|
||||
return $xml;
|
||||
}
|
||||
|
||||
}
|
||||
77
include/class/package_template.class.php
Normal file
77
include/class/package_template.class.php
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE."/class/package_noalyss.class.php";
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
class Package_Template extends Package_Noalyss
|
||||
{
|
||||
|
||||
public function can_install()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the template
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
// make temp dir
|
||||
$tmp=NOALYSS_HOME."/tmp/";
|
||||
$tmpdir=$tmp."db-".microtime(TRUE);
|
||||
mkdir($tmpdir);
|
||||
|
||||
// unzip Archive file
|
||||
$db=new ZipArchive;
|
||||
$db->open($tmp."/".$this->get_file());
|
||||
$db->extractTo($tmpdir);
|
||||
|
||||
|
||||
// create database
|
||||
$cn=new Database();
|
||||
$seq=$cn->get_value("select nextval('s_modid')");
|
||||
|
||||
$sql=sprintf(" create database %smod%d encoding='utf8'", domaine, $seq);
|
||||
$cn->exec_sql($sql);
|
||||
|
||||
$newdb=new Database($seq, 'mod');
|
||||
|
||||
// Execute SQL Script
|
||||
$newdb->execute_script($tmpdir.'/schema.sql');
|
||||
$newdb->execute_script($tmpdir.'/data.sql');
|
||||
$newdb->execute_script($tmpdir.'/constraint.sql');
|
||||
|
||||
// Register into account_repository, we add the seq number for avoiding duplicate
|
||||
$description = sprintf(_("Installé le %s"),date("d-m-Y h:i:s"));
|
||||
$cn->exec_sql(" insert into modeledef (mod_id,mod_name,mod_desc) values ($1,$2,$3)",
|
||||
[$seq,$seq."-".$this->get_name(),$this->get_description()." ".$description]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -218,7 +218,7 @@ class Periode
|
|||
* @param date $p_date_end
|
||||
* @param int $p_exercice
|
||||
* @return int p_id of the new periode
|
||||
* @exception Exception 10 Invalide date or exercice
|
||||
* @exception Exception 10 Invalide date or exercice, 20 overlapping periode
|
||||
*/
|
||||
function insert($p_date_start, $p_date_end, $p_exercice)
|
||||
{
|
||||
|
|
@ -248,7 +248,7 @@ class Periode
|
|||
",[$p_date_end]);
|
||||
if ( $overlap_start > 0 || $overlap_end > 0)
|
||||
{
|
||||
throw new Exception (_("Période chevauchant une autre"));
|
||||
throw new Exception (_("Période chevauchant une autre"),20);
|
||||
}
|
||||
$p_id=$this->cn->get_next_seq('s_periode');
|
||||
$sql=" insert into parm_periode(p_id,p_start,p_end,p_closed,p_exercice)
|
||||
|
|
@ -264,15 +264,14 @@ class Periode
|
|||
$Res=$this->cn->exec_sql("insert into jrn_periode (jrn_def_id,p_id,status) ".
|
||||
"select jrn_def_id,$p_id,'OP' from jrn_def");
|
||||
$this->cn->commit();
|
||||
return $p_id;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
record_log($e->getTraceAsString());
|
||||
$this->cn->rollback();
|
||||
throw $e;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* !\brief load data from database
|
||||
|
|
@ -478,10 +477,7 @@ class Periode
|
|||
$date_start=sprintf('01.%02d.%d', $month, $year);
|
||||
$date_end=$this->cn->get_value("select to_char(to_date($1,'DD.MM.YYYY')+interval '1 month'-interval '1 day','DD.MM.YYYY')",
|
||||
array($date_start));
|
||||
if ($this->insert($date_start, $date_end, $p_exercice)!=0)
|
||||
{
|
||||
throw new Exception('Erreur insertion période');
|
||||
}
|
||||
$this->insert($date_start, $date_end, $p_exercice);
|
||||
}
|
||||
$month++;
|
||||
if ($month == 13 )
|
||||
|
|
|
|||
|
|
@ -103,7 +103,9 @@ if ( !defined("SITE_UPDATE"))
|
|||
define ("SITE_UPDATE",'http://www.noalyss.eu/last_version.txt');
|
||||
if ( !defined("SITE_UPDATE_PLUGIN"))
|
||||
define ("SITE_UPDATE_PLUGIN",'http://www.noalyss.eu/plugin_last_version.txt');
|
||||
|
||||
if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
|
||||
define ("NOALYSS_PACKAGE_REPOSITORY","https://package.noalyss.eu/");
|
||||
}
|
||||
// If you don't want that the system information is accessible
|
||||
if ( ! defined ("SYSINFO_DISPLAY")) {
|
||||
define ("SYSINFO_DISPLAY",TRUE);
|
||||
|
|
@ -311,3 +313,13 @@ define ('EXC_PARAM_TYPE',1006);
|
|||
define ('EXC_DUPLICATE',1200);
|
||||
define ("UNPINDG","");
|
||||
define ("PINDG","");
|
||||
|
||||
// Url of NOALYSS (http://...)
|
||||
//
|
||||
if ( ! defined ("NOALYSS_URL")) {
|
||||
$base=$_SERVER['REQUEST_SCHEME'].'://'.
|
||||
$_SERVER['HTTP_HOST'].
|
||||
":".$_SERVER['SERVER_PORT'].
|
||||
dirname($_SERVER['PHP_SELF']);
|
||||
define ("NOALYSS_URL",$base);
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ if ( isset ($_POST['upd']) && isNumber($dossier_id) == 1 && $dossier_id != -1)
|
|||
$dos->set_parameter("max_email", $max_email);
|
||||
$dos->save();
|
||||
}
|
||||
echo '<div class="content" style="width:80%;margin-left:10%">';
|
||||
echo '<div class="content">';
|
||||
/*
|
||||
* check and add an new folder
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ function MenuAdmin()
|
|||
array("admin-noalyss.php?action=dossier_mgt",_("Dossiers"),_('Gestion des dossiers'),1),
|
||||
array("admin-noalyss.php?action=modele_mgt",_("Modèles"),_('Gestion des modèles'),2),
|
||||
array("admin-noalyss.php?action=restore",_("Restaure"),_("Restaure une base de données"),3),
|
||||
array("admin-noalyss.php?action=upgrade",_("Mise à jour"),_("Mise à jour du système et des bases de données"),5),
|
||||
array("admin-noalyss.php?action=upgrade",_("Installation"),_("Installation Mise à jour du système et des bases de données"),5),
|
||||
array("admin-noalyss.php?action=audit_log",_("Audit"),_("Utilisateurs qui se sont connectés"),4),
|
||||
array("admin-noalyss.php?action=info",_("Information système"),('Information à propos de votre installation'),6),
|
||||
array("login.php",_("Accueil"),"",7),
|
||||
|
|
@ -145,7 +145,7 @@ function MenuAdmin()
|
|||
);
|
||||
|
||||
}
|
||||
$menu=ShowItem($item,'H',"mtitle","mtitle",$def,' style="width:80%;margin-left:10%" ');
|
||||
$menu=ShowItem($item,'H',"mtitle","mtitle",$def);
|
||||
return $menu;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ $Res = $cn->exec_sql("select mod_id,mod_name,mod_desc from
|
|||
modeledef $sql_order");
|
||||
|
||||
$count = Database::num_row($Res);
|
||||
echo '<div class="content" style="width:80%;margin-left:10%">';
|
||||
echo '<div class="content">';
|
||||
echo "<H2>"._('Modèles')."</H2>";
|
||||
if ($sa == 'list')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ if ( isset ($_REQUEST['sa'] ))
|
|||
// Restore a folder (dossier)
|
||||
if ( $_REQUEST['t']=='d')
|
||||
{
|
||||
echo '<div class="content" style="width:80%;margin-left:10%">';
|
||||
echo '<div class="content">';
|
||||
|
||||
$cn=new Database();
|
||||
$id=$cn->get_next_seq('dossier_id');
|
||||
|
|
|
|||
65
include/upgrade-core.php
Normal file
65
include/upgrade-core.php
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
|
||||
|
||||
if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
|
||||
if ( ! defined ('ALLOWED_ADMIN')) { die (_('Non autorisé'));}
|
||||
|
||||
|
||||
require_once NOALYSS_INCLUDE.'/class/package_repository.class.php';
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
*/
|
||||
printf (_(" La version de votre installaiton est %s "),NOALYSS_VERSION);
|
||||
|
||||
$core=new Package_Repository();
|
||||
$xml=$core->getContent();
|
||||
printf(h1(_("Version %s du %s")),$xml->core->version,$xml->core->date);
|
||||
echo '<p>';
|
||||
echo $xml->core->description;
|
||||
echo '</p>';
|
||||
|
||||
if ( $xml->core->version < NOALYSS_VERSION) {
|
||||
echo '<p>';
|
||||
echo _("Votre version est à jour");
|
||||
echo '</p>';
|
||||
return;
|
||||
}
|
||||
|
||||
$js="onclick='UpgradeCore()'";
|
||||
|
||||
echo HtmlInput::button("upgrade",_("Mise à jour de votre système"),$js);
|
||||
?>
|
||||
<div id="info_admin">
|
||||
|
||||
</div>
|
||||
<script>
|
||||
function UpgradeCore()
|
||||
{
|
||||
progress_bar_start('upgradeCore');
|
||||
new Ajax.Updater("info_admin","ajax_misc.php",{
|
||||
method:'POST',
|
||||
parameters:{op:"upgradeCore",gDossier:0,task_id:'upgradeCore'
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
133
include/upgrade-plugin.php
Normal file
133
include/upgrade-plugin.php
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
|
||||
|
||||
if (!defined('ALLOWED'))
|
||||
die('Appel direct ne sont pas permis');
|
||||
if (!defined('ALLOWED_ADMIN'))
|
||||
{
|
||||
die(_('Non autorisé'));
|
||||
}
|
||||
|
||||
|
||||
require_once NOALYSS_INCLUDE.'/class/package_repository.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/extension.class.php';
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Install new plugin
|
||||
*/
|
||||
$package_repository=new Package_Repository();
|
||||
$xml=$package_repository->getContent();
|
||||
|
||||
$a_plugin=$xml->xpath('//plugins/plugin');
|
||||
$nb_plugin=count($a_plugin);
|
||||
?>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
<?= _("Nom") ?>
|
||||
</th>
|
||||
<th>
|
||||
<?= _("Description") ?>
|
||||
</th>
|
||||
<th>
|
||||
<?= _("Auteur") ?>
|
||||
</th>
|
||||
<th>
|
||||
<?= _("Code") ?>
|
||||
</th>
|
||||
<th>
|
||||
Installé ou mettre à jour ???
|
||||
</th>
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
for ($i=0; $i<$nb_plugin; $i++)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?= $a_plugin[$i]->name; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $a_plugin[$i]->description; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $a_plugin[$i]->author; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $a_plugin[$i]->code; ?>
|
||||
version [<?= $a_plugin[$i]->version; ?>]
|
||||
</td>
|
||||
<td id="result<?=trim($a_plugin[$i]->code)?>">
|
||||
|
||||
<?php
|
||||
//is installed
|
||||
if (is_file(NOALYSS_PLUGIN."/".trim($a_plugin[$i]->root)."/plugin.xml"))
|
||||
{
|
||||
// plugin is installed take the version and compare with remote one
|
||||
$xml_plugin=$package_repository->read_package_xml(NOALYSS_PLUGIN."/".trim($a_plugin[$i]->root)."/plugin.xml");
|
||||
if (count($xml_plugin->plugin)>1)
|
||||
{
|
||||
echo _("MultiModule");
|
||||
}
|
||||
// Compute js to install or upgrade
|
||||
$js=sprintf("onclick=\"upgradePlugin('%s')\"", trim($a_plugin[$i]->code));
|
||||
// Check if new version is available
|
||||
if (floatval(trim($xml_plugin->plugin->version))<floatval(trim($a_plugin[$i]->version)))
|
||||
{
|
||||
printf (_("Nouvelle version disponible %s , votre version %s"),
|
||||
floatval(trim($a_plugin[$i]->version)),
|
||||
trim($xml_plugin->plugin->version));
|
||||
echo HtmlInput::button("upgrade", _("Mise à jour"), $js);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo _("Dernière version installée");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// It is not installed , propose to install it
|
||||
echo _("Non installée");
|
||||
echo HtmlInput::button("upgrade", _("Installation"), $js);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
function upgradePlugin(p_code) {
|
||||
var task_id="<?=uniqid()?>";
|
||||
progress_bar_start(task_id);
|
||||
new Ajax.Updater(
|
||||
"result"+p_code,
|
||||
"ajax_misc.php" ,
|
||||
{
|
||||
method:'POST',
|
||||
parameters:{gDossier:0,op:'upgradePlugin',code_plugin:p_code,"task_id":task_id}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
66
include/upgrade-template.php
Normal file
66
include/upgrade-template.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
|
||||
|
||||
if (!defined('ALLOWED'))
|
||||
die('Appel direct ne sont pas permis');
|
||||
if (!defined('ALLOWED_ADMIN'))
|
||||
{
|
||||
die(_('Non autorisé'));
|
||||
}
|
||||
require_once NOALYSS_INCLUDE.'/class/package_repository.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/extension.class.php';
|
||||
|
||||
|
||||
$package_repository=new Package_Repository();
|
||||
$xml=$package_repository->getContent();
|
||||
|
||||
|
||||
$a_template=$xml->xpath('//database_template/dbtemplate');
|
||||
$nb_template=count($a_template);
|
||||
echo "<table>";
|
||||
echo tr(
|
||||
th(_("Nom")).th(_("Description")).th(_("Mise à jour"))
|
||||
);
|
||||
for ($i=0; $i<$nb_template; $i++)
|
||||
{
|
||||
echo '<tr>';
|
||||
echo td($a_template[$i]->name);
|
||||
echo td($a_template[$i]->description);
|
||||
echo td($a_template[$i]->date_update);
|
||||
echo '<td id="template'.trim($a_template[$i]->code).'" >';
|
||||
$js=sprintf("onclick=\"install_template('%s')\"", trim($a_template[$i]->code));
|
||||
echo HtmlInput::button("installTemplate", "Installation modèle", $js);
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo "</table>";
|
||||
?>
|
||||
<script>
|
||||
function install_template(p_code)
|
||||
{
|
||||
var task_id = "<?= uniqid() ?>";
|
||||
progress_bar_start(task_id);
|
||||
new Ajax.Updater("installTemplate" + p_code, "ajax_misc.php", {
|
||||
method:"POST",
|
||||
parameters:{op:"installTemplate", gDossier:0, code:p_code,task_id:task_id}
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
|
|
@ -18,93 +17,78 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2014) Author Dany De Bontridder <dany@alchimerys.be>
|
||||
|
||||
if (!defined('ALLOWED'))
|
||||
die('Appel direct ne sont pas permis');
|
||||
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
|
||||
/**
|
||||
* @file
|
||||
* @brief Upgrade all the database : the central repository , the templates and
|
||||
* the folder
|
||||
* @param $rep db connection to central repository
|
||||
*/
|
||||
?>
|
||||
if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
|
||||
if ( ! defined ('ALLOWED_ADMIN')) { die (_('Non autorisé'));}
|
||||
|
||||
<?php
|
||||
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
|
||||
$http=new HttpInput();
|
||||
$sb= $http->get("sb", "string","none");
|
||||
if ($sb === "upg_all" && (!defined('MULTI')||(defined('MULTI')&&MULTI==1)))
|
||||
|
||||
$menu=array(
|
||||
["?action=upgrade&sb=database", _("Base de données"), _("Met à jour toutes les dossiers et modèles"), 'database'],
|
||||
["?action=upgrade&sb=application", _("Application"), _("Installe la dernière version de Noalyss"), 'application'],
|
||||
["?action=upgrade&sb=plugin", _("Extension"), _("Installe ou met à jour les extensions"), "plugin"],
|
||||
["?action=upgrade&sb=template", _("Modèle"), _("Installe des modèles"), "template"]
|
||||
);
|
||||
$sb=$http->request("sb", "string", "application");
|
||||
echo '<div class="menu2">';
|
||||
echo ShowItem($menu, "H", "mtitle", "mtitle", $sb);
|
||||
echo '</div>';
|
||||
|
||||
$sc=$http->get("sc", "string", "none");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Upgrade Databases (Folder, Template , Account )
|
||||
//-----------------------------------------------------------------------------
|
||||
if ($sb=="database")
|
||||
{
|
||||
echo '<div class="content">';
|
||||
/* If multi folders */
|
||||
$Resdossier=$rep->exec_sql("select dos_id, dos_name from ac_dossier");
|
||||
$MaxDossier=$rep->size($Resdossier);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Upgrade the account_repository
|
||||
//----------------------------------------------------------------------
|
||||
echo "<h2>"._("Mise à jour de la base de données principale")."</h2>";
|
||||
$cn=new Database();
|
||||
if (DEBUG==false)
|
||||
ob_start();
|
||||
$MaxVersion=DBVERSIONREPO-1;
|
||||
for ($i=4; $i<=$MaxVersion; $i++)
|
||||
?>
|
||||
<form method="get" id="frm_upg_all" onsubmit="return confirm_box('frm_upg_all', '<?php echo _('Confirmez') ?>')">
|
||||
<input type="hidden" name="sb" value="database">
|
||||
<input type="hidden" name="sc" value="upg_all">
|
||||
<input type="hidden" name="action" value="upgrade">
|
||||
<input type="submit" class="button" name="submit_upg_all" id="submit_upg_all" value="<?php echo _('Tout mettre à jour') ?>">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
if ($sc==="upg_all"&&(!defined('MULTI')||(defined('MULTI')&&MULTI==1)))
|
||||
{
|
||||
if ($cn->get_version()<=$i)
|
||||
{
|
||||
$cn->execute_script(NOALYSS_INCLUDE.'/sql/patch/ac-upgrade'.$i.'.sql');
|
||||
}
|
||||
echo '<div class="content">';
|
||||
|
||||
Dossier::upgrade();
|
||||
|
||||
echo '</div>';
|
||||
return;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Upgrade the folders
|
||||
//----------------------------------------------------------------------
|
||||
echo "<h2>"._("Mise à jour dossiers")."</h2>";
|
||||
|
||||
for ($e=0; $e<$MaxDossier; $e++)
|
||||
{
|
||||
$db_row=Database::fetch_array($Resdossier, $e);
|
||||
$name=$rep->format_name($db_row['dos_id'], 'dos');
|
||||
echo "<h3>Patching ".$db_row['dos_name'].'</h3>';
|
||||
echo _('Base de données')." ".$name;
|
||||
|
||||
if ($rep->exist_database($name)>0)
|
||||
{
|
||||
$db=new Database($db_row['dos_id'], 'dos');
|
||||
$db->apply_patch($db_row['dos_name']);
|
||||
Dossier::synchro_admin($db_row['dos_id']);
|
||||
User::remove_inexistant_user($db_row['dos_id']);
|
||||
$db->clean_orphan_lob();
|
||||
}
|
||||
else
|
||||
{
|
||||
echo_warning(_("Dossier inexistant")." $name");
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Upgrade the template
|
||||
//----------------------------------------------------------------------
|
||||
$Resdossier=$rep->exec_sql("select mod_id, mod_name from modeledef");
|
||||
$MaxDossier=$rep->size();
|
||||
echo "<h2>"._("Mise à jour modèles")."</h2>";
|
||||
|
||||
for ($e=0; $e<$MaxDossier; $e++)
|
||||
{
|
||||
$db_row=Database::fetch_array($Resdossier, $e);
|
||||
$name=$rep->format_name($db_row['mod_id'], 'mod');
|
||||
echo "<h3>Patching ".$db_row['mod_name']."</h3>";
|
||||
echo _('Base de données')." ".$name;
|
||||
if ($rep->exist_database($name)>0)
|
||||
{
|
||||
$db=new Database($db_row['mod_id'], 'mod');
|
||||
$db->apply_patch($db_row['mod_name']);
|
||||
$db->clean_orphan_lob();
|
||||
}
|
||||
else
|
||||
{
|
||||
echo_warning(_("Modèle inexistant")." $name");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// Import the file with the package
|
||||
//------------------------------------------------------------------------------
|
||||
// Upgrade Main application, show all the info from the NOALYSS_PACKAGE site
|
||||
//------------------------------------------------------------------------------
|
||||
if ($sb=="application")
|
||||
{
|
||||
require NOALYSS_INCLUDE."/upgrade-core.php";
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// Install or Upgrade Extension, show all the info from the NOALYSS_PACKAGE site
|
||||
//------------------------------------------------------------------------------
|
||||
if ($sb=="plugin")
|
||||
{
|
||||
require NOALYSS_INCLUDE."/upgrade-plugin.php";
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
// Install template
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
if ( $sb == 'template')
|
||||
{
|
||||
require NOALYSS_INCLUDE."/upgrade-template.php";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ if ( !defined ('ALLOWED')) die('Forbidden');
|
|||
require_once NOALYSS_INCLUDE.'/lib/sort_table.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
|
||||
$http=new HttpInput();
|
||||
echo '<div class="content" style="width:80%;margin-left:10%">';
|
||||
echo '<div class="content" >';
|
||||
/******************************************************/
|
||||
// Add user
|
||||
/******************************************************/
|
||||
|
|
|
|||
103
scenario/package_repository.test.php
Normal file
103
scenario/package_repository.test.php
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2018) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
//@description:Test class Package_Repository
|
||||
$_GET=array ();
|
||||
$_POST=array ();
|
||||
$_POST['gDossier']=$gDossierLogInput;
|
||||
$_GET['gDossier']=$gDossierLogInput;
|
||||
$_REQUEST=array_merge($_GET,$_POST);
|
||||
|
||||
require_once NOALYSS_INCLUDE.'/class/package_repository.class.php';
|
||||
|
||||
$package_repository=new Package_Repository();
|
||||
$package_repository->display_noalyss_info();
|
||||
|
||||
echo $package_repository->can_download();
|
||||
|
||||
$xml=$package_repository->getContent();
|
||||
|
||||
$a_plugin=$xml->xpath('//plugins/plugin');
|
||||
$nb_plugin=count($a_plugin);
|
||||
$a_coprop="";
|
||||
echo "<ol>";
|
||||
for ( $i=0;$i < $nb_plugin;$i++)
|
||||
{
|
||||
echo "<li>";
|
||||
echo $a_plugin[$i]->name;
|
||||
echo "- - - - - - ";
|
||||
echo $a_plugin[$i]->path;
|
||||
echo "- - - - - - ";
|
||||
echo $a_plugin[$i]->author;
|
||||
echo "- - - - - - ";
|
||||
echo $a_plugin[$i]->code;
|
||||
echo "</li>";
|
||||
if (trim($a_plugin[$i]->code)=="AMORTIS")
|
||||
{
|
||||
$a_coprop=$a_plugin[$i];
|
||||
var_dump($a_coprop);
|
||||
}
|
||||
}
|
||||
echo "</ol>";
|
||||
|
||||
// find a specific plugin
|
||||
$spec_plugin=$xml->xpath("//plugins/plugin[code='AMORTIS']");
|
||||
var_dump($spec_plugin);
|
||||
|
||||
|
||||
|
||||
$a_noalyss=$xml->xpath("//core");
|
||||
|
||||
echo "description core ".$a_noalyss[0]->description;
|
||||
|
||||
// Download fake core
|
||||
echo h1(_("Download core"));
|
||||
$core=$package_repository->make_object("core", "");
|
||||
$core->download();
|
||||
|
||||
//download fake plugin
|
||||
echo h1("Plugin : download and install ");
|
||||
$plugin=$package_repository->make_object("plugin","COPRO");
|
||||
$plugin->download();
|
||||
echo h2("Install in noalyss/include/ext/copro-fake");
|
||||
$plugin->install();
|
||||
|
||||
|
||||
echo h1("Available template");
|
||||
$a_template=$xml->xpath('//database_template/dbtemplate');
|
||||
$nb_template=count($a_template);
|
||||
echo "<ol>";
|
||||
for ( $i=0;$i < $nb_template;$i++)
|
||||
{
|
||||
echo "<li>";
|
||||
echo $a_template[$i]->name;
|
||||
echo "- - - - - - ";
|
||||
echo $a_template[$i]->description;
|
||||
echo "- - - - - - ";
|
||||
echo $a_template[$i]->path;
|
||||
echo "</li>";
|
||||
}
|
||||
echo "</ol>";
|
||||
|
||||
echo h1("Create new database");
|
||||
$template=$package_repository->make_object("template", "mod1");
|
||||
$template->download();
|
||||
$template->install();
|
||||
echo h2( $template->get_name()." est installé");
|
||||
Loading…
Add table
Add a link
Reference in a new issue