noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 04/16: Restructure file , remove html/admin/s


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 04/16: Restructure file , remove html/admin/sql , backup ...
Date: Tue, 20 Oct 2015 14:26:28 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit db9835387b487ce8f613e31d333ed33ee1f598b2
Author: Dany De Bontridder <address@hidden>
Date:   Mon Oct 19 00:38:04 2015 +0200

    Restructure file , remove html/admin/sql , backup ...
---
 html/admin/setup.php           |    4 +-
 html/do.php                    |    2 +-
 html/index.php                 |    2 +-
 html/login.php                 |    4 +-
 html/user_login.php            |    4 +-
 include/admin_repo.inc.php     |   89 ++++++++++++++++++++--------------------
 include/lib/class_database.php |   12 ++---
 7 files changed, 58 insertions(+), 59 deletions(-)

diff --git a/html/admin/setup.php b/html/admin/setup.php
index 80b873e..12d895a 100644
--- a/html/admin/setup.php
+++ b/html/admin/setup.php
@@ -466,7 +466,7 @@ if ( $flag == 0 ) {
 if ( ! isset($_POST['go']) ) {
 ?>
 <span style="text-align: center">
-    <FORM METHOD="post" action="setup.php?lang=<?php echo $_GET['lang']?>">
+    <FORM METHOD="post" action="admin-noalyss.php?lang=<?php echo 
$_GET['lang']?>">
 <input type="submit" class="button" name="go" value="<?php echo _("Commencer 
la mise à jour ou l'installation");?>">
 </form>
 </span>
@@ -618,7 +618,7 @@ for ($e=0;$e < $MaxDossier;$e++) {
 //----------------------------------------------------------------------
 // Upgrade the account_repository
 //----------------------------------------------------------------------
- echo "<h2>"._("Mise à Repository")."</h2>";
+ echo "<h2>"._("Mise à jour de la base de données Paramètrage")."</h2>";
  $cn=new Database();
  if ( DEBUG == false ) ob_start();
  $MaxVersion=DBVERSIONREPO-1;
diff --git a/html/do.php b/html/do.php
index 5661887..9fd0617 100644
--- a/html/do.php
+++ b/html/do.php
@@ -146,7 +146,7 @@ if (DBVERSION > dossier::get_version($cn))
     $a = _("cliquez ici pour appliquer le patch");
     $base = dirname($_SERVER['REQUEST_URI']);
     if ($base == '/') { $base = ''; }
-    $base .= '/admin/setup.php';
+    $base .= '/admin-noalyss.php';
     echo '<a hreF="' . $base . '">' . $a . '</a></h2>';
 }
 
diff --git a/html/index.php b/html/index.php
index 5eb72b2..dc0c14b 100644
--- a/html/index.php
+++ b/html/index.php
@@ -134,7 +134,7 @@
 
 if ( ! 
file_exists('..'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'config.inc.php'))
 {
-    header("Location: admin/setup.php",true, 307);
+    header("Location: setup.php",true, 307);
     exit(0);
 }
 
diff --git a/html/login.php b/html/login.php
index 4d765b6..f2ce714 100644
--- a/html/login.php
+++ b/html/login.php
@@ -51,7 +51,7 @@ if (  isset ($_POST["p_user"] ) )
        if ($version != DBVERSIONREPO)
        {
                echo alert(_('Version de base de données incorrectes, vous 
devez mettre à jour'));
-               echo "<META HTTP-EQUIV=\"REFRESH\" 
content=\"0;url=admin/setup.php\">";
+               echo "<META HTTP-EQUIV=\"REFRESH\" 
content=\"0;url=admin-noalyss.php\">";
                exit();
        }
     include_once NOALYSS_INCLUDE."/class/class_user.php";
@@ -88,7 +88,7 @@ else
     if ( $version != DBVERSIONREPO)
       {
        echo alert(_('Version de base de données incorrectes, vous devez mettre 
à jour'));
-       echo "<META HTTP-EQUIV=\"REFRESH\" content=\"1;url=admin/setup.php\">";
+       echo "<META HTTP-EQUIV=\"REFRESH\" 
content=\"1;url=admin-noalyss.php\">";
        exit();
 
       }
diff --git a/html/user_login.php b/html/user_login.php
index 026c5c9..7972092 100644
--- a/html/user_login.php
+++ b/html/user_login.php
@@ -77,7 +77,7 @@ if ( $version < DBVERSIONREPO )
     $a=_("cliquez ici pour appliquer le patch");
     $base = dirname($_SERVER['REQUEST_URI']);
     if ($base == '/') { $base = ''; }
-    $base .= '/admin/setup.php';
+    $base .= 'admin-noalyss.php';
     echo '<a hreF="'.$base.'">'.$a.'</a></h2>';
 
 }
@@ -152,7 +152,7 @@ $result.="<table border=\"0\">";
 $result.='<TR>';
 if ( $User->Admin()  == 1 )
 {
-    $result.="<TD  class=\"tool\" ><A class=\"cell\" 
HREF=\"setup.php\">"._("Administration")."  </A></TD>";
+    $result.="<TD  class=\"tool\" ><A class=\"cell\" 
HREF=\"admin-noalyss.php\">"._("Administration")."  </A></TD>";
 }
 $result.='<TD class="tool">';
 $result.='<a onclick="set_preference(0)" title="Préférence" 
href="javascript:void(0)" class="cell">'._('Préférence').'</a>';
diff --git a/include/admin_repo.inc.php b/include/admin_repo.inc.php
index 7ca8861..175b8c4 100644
--- a/include/admin_repo.inc.php
+++ b/include/admin_repo.inc.php
@@ -28,74 +28,75 @@ require_once NOALYSS_INCLUDE."/lib/user_common.php";
 include_once NOALYSS_INCLUDE."/lib/ac_common.php";
 require_once NOALYSS_INCLUDE.'/lib/class_database.php';
 require_once NOALYSS_INCLUDE."/lib/user_menu.php";
+$action = HtmlInput::default_value_request("action", "");
 
 $rep=new Database();
 $User=new User($rep);
 $User->Check();
 
-html_page_start($User->theme);
 
 if ($User->admin != 1)
 {
+    html_page_start($User->theme);
     echo "<h2 class=\"warning\">";
     echo _("Vous n'êtes pas administateur");
     echo "</h2>";
     html_page_stop();
     return;
 }
+// For a backup , we must avoid to send anything before the 
+// dump file
+if ( $action== 'backup') {
+        /* take backup */
+        require_once NOALYSS_INCLUDE."/backup.inc.php";
+        exit();
+}
+html_page_start();
 load_all_script();
 echo '<H2 class="info"> '._('Administration').'</H2>';
 echo '<div class="topmenu">';
 
 echo MenuAdmin()."</div>";
 
-define('ALLOWED',true);
-
-
 ?>
 <DIV >
 <?php
-if ( isset ($_REQUEST["action"]) )
+echo js_include("admin.js");
+if ( $action=="user_mgt" )
 {
-    echo js_include("admin.js");
-    if ( $_REQUEST["action"]=="user_mgt" )
-    {
-        
//----------------------------------------------------------------------
-        // User management
-        
//----------------------------------------------------------------------
-        require_once NOALYSS_INCLUDE."/user.inc.php";
-    }
-    // action=user_mgt
-    if ( $_REQUEST["action"]=="dossier_mgt")
-    {
-        
//-----------------------------------------------------------------------
-        // action = dossier_mgt
-        
//-----------------------------------------------------------------------
-        require_once NOALYSS_INCLUDE."/dossier.inc.php";
-    }
-    if ( $_REQUEST["action"] == "modele_mgt" )
-    {
-        
//-----------------------------------------------------------------------
-        //  Template Management
-        
//-----------------------------------------------------------------------
-        require_once NOALYSS_INCLUDE."/modele.inc.php";
-    } // action is set
-    if ( $_REQUEST['action'] == 'restore')
-    {
-        // Backup and restaure folders
-        require_once NOALYSS_INCLUDE."/restore.inc.php";
-    }
-    if ($_REQUEST['action'] == 'audit_log')
-    {
-       /* List the connexion successuf and failed */
-       require_once NOALYSS_INCLUDE."/audit_log.php";
-    }
-    if ( $_REQUEST['action'] == 'backup') {
-        /* take backup */
-        require_once NOALYSS_INCLUDE."/backup.inc.php";
-    }
-}// action = modele_mgt
-
+    //----------------------------------------------------------------------
+    // User management
+    //----------------------------------------------------------------------
+    require_once NOALYSS_INCLUDE."/user.inc.php";
+}
+// action=user_mgt
+if ( $action=="dossier_mgt")
+{
+    //-----------------------------------------------------------------------
+    // action = dossier_mgt
+    //-----------------------------------------------------------------------
+    require_once NOALYSS_INCLUDE."/dossier.inc.php";
+}
+if ( $action== "modele_mgt" )
+{
+    //-----------------------------------------------------------------------
+    //  Template Management
+    //-----------------------------------------------------------------------
+    require_once NOALYSS_INCLUDE."/modele.inc.php";
+} // action is set
+if ( $action== 'restore')
+{
+    // Backup and restaure folders
+    require_once NOALYSS_INCLUDE."/restore.inc.php";
+}
+if ($action== 'audit_log')
+{
+    /* List the connexion successuf and failed */
+    require_once NOALYSS_INCLUDE."/audit_log.php";
+}
+if ( $action == "logout") {
+     require_once 'logout.php';
+}
 ?>
 </DIV>
 <?php
diff --git a/include/lib/class_database.php b/include/lib/class_database.php
index da167e1..7d65e0d 100644
--- a/include/lib/class_database.php
+++ b/include/lib/class_database.php
@@ -399,11 +399,10 @@ class Database
      * \brief loop to apply all the path to a folder or
      *         a template
      * \param $p_name database name
-     * \param $from_setup == 1 if called from setup.php
      *
      */
 
-    function apply_patch($p_name, $from_setup=1)
+    function apply_patch($p_name)
     {
         if ( ! $this->exist_table('version')) {
             echo _('Base de donnée vide');
@@ -412,7 +411,6 @@ class Database
         $MaxVersion=DBVERSION-1;
         $succeed="<span style=\"font-size:18px;color:green\">&#x2713;</span>";
         echo '<ul style="list-type-style:square">';
-        $add=($from_setup==0)?'admin/':'';
         for ($i=4; $i<=$MaxVersion; $i++)
         {
             $to=$i+1;
@@ -431,7 +429,7 @@ class Database
                 echo "<li>Patching ".$p_name.
                 " from the version ".$this->get_version()." to $to ";
 
-                $this->execute_script($add.'sql/patch/upgrade'.$i.'.sql');
+                $this->execute_script 
(NOALYSS_INCLUDE.'/sql/patch/upgrade'.$i.'.sql');
                 echo $succeed;
 
                 if (!DEBUG)
@@ -467,7 +465,7 @@ class Database
                 // specific to version 17
                 if ($i==17)
                 {
-                    $this->execute_script($add.'sql/patch/upgrade17.sql');
+                    
$this->execute_script(NOALYSS_INCLUDE.'/sql/patch/upgrade17.sql');
                     $max=$this->get_value('select last_value from 
s_jnt_fic_att_value');
                     $this->alter_seq($p_cn, 's_jnt_fic_att_value', $max+1);
                 } // version
@@ -497,7 +495,7 @@ class Database
                     /* check the country and apply the path */
                     $res=$this->exec_sql("select pr_value from parameter where 
pr_id='MY_COUNTRY'");
                     $country=pg_fetch_result($res, 0, 0);
-                    
$this->execute_script($add."sql/patch/upgrade36.".$country.".sql");
+                    
$this->execute_script(NOALYSS_INCLUDE."/sql/patch/upgrade36.".$country.".sql");
                     $this->exec_sql('update tmp_pcmn set 
pcm_type=find_pcm_type(pcm_val)');
                 }
                 if ($i==59)
@@ -512,7 +510,7 @@ class Database
                 if ($i==61)
                 {
                     $country=$this->get_value("select pr_value from parameter 
where pr_id='MY_COUNTRY'");
-                    
$this->execute_script($add."sql/patch/upgrade61.".$country.".sql");
+                    
$this->execute_script(NOALYSS_INCLUDE."/sql/patch/upgrade61.".$country.".sql");
                 }
 
                 if (!DEBUG)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]