diff --git a/apps/maarch_entreprise/admin/update_control/update_control.php b/apps/maarch_entreprise/admin/update_control/update_control.php index 0e4f8881a514293a174ea320eadbd0df6b9383c4..531be69ad81e2aa623228b30b47181eb02e5c93f 100644 --- a/apps/maarch_entreprise/admin/update_control/update_control.php +++ b/apps/maarch_entreprise/admin/update_control/update_control.php @@ -27,7 +27,7 @@ if (isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == 'true') { $pagePath = $_SESSION['config']['businessappurl'] . 'index.php?page=' . 'update_control&admin=update_control'; -$pageLabel = _UPDATE_CONTROL; +$pageLabel = _ADMIN_UPDATE_CONTROL; $pageId = 'update_control'; $level = ''; if (isset($_REQUEST['level']) @@ -91,6 +91,7 @@ foreach ($tags as $key => $value) { } //var_dump($allCurrentTags); ?> +<h1><?php echo _ADMIN_UPDATE_CONTROL;?></h1> <br/> <br/> <br/> @@ -128,7 +129,7 @@ foreach ($tags as $key => $value) { if (count($tags)>0) { ?> <select id="version" id="name"> - <option value="default"><?php echo _SELECT_A_VERSION;?></option> + <!--option value="default"><?php echo _SELECT_A_VERSION;?></option--> <?php for ($i=0;$i<count($allCurrentTags);$i++) { if ($allCurrentTags[$i]['enabled']) { @@ -187,7 +188,7 @@ foreach ($tags as $key => $value) { <td> <?php if ($isAnyAvailableVersion) { - echo _NEW_MAJOR_VERSION_AVAILABLE . ':'; + echo '<b>' . _NEW_MAJOR_VERSION_AVAILABLE . '</b>:'; for ($j=0;$j<count($allNextTags);$j++) { echo $allNextTags[$j] . '<br />'; } diff --git a/apps/maarch_entreprise/lang/en.php b/apps/maarch_entreprise/lang/en.php index 60d4194fadaa59c34907bb55fe22e093f6deff3c..28c36b9fee0e60e61189b1464bbe3ad0dcd70c06 100644 --- a/apps/maarch_entreprise/lang/en.php +++ b/apps/maarch_entreprise/lang/en.php @@ -1897,3 +1897,61 @@ if (!defined('_UPDATED_EMAIL_SIGNATURE')) if (!defined('_DELETED_EMAIL_SIGNATURE')) define('_DELETED_EMAIL_SIGNATURE', 'Mail signature deleted'); /***** Profile *****/ + +/**** admin update control ****/ +if (!defined('_ADMIN_UPDATE_CONTROL')) + define('_ADMIN_UPDATE_CONTROL', 'Vérification mise à jour'); +if (!defined('_ADMIN_UPDATE_CONTROL_DESC')) + define('_ADMIN_UPDATE_CONTROL_DESC', 'Vérification mise à jour'); +if (!defined('_YOUR_VERSION')) + define('_YOUR_VERSION', 'Votre version'); +if (!defined('_AVAILABLE_VERSION_TO_UPDATE')) + define('_AVAILABLE_VERSION_TO_UPDATE', 'Versions disponibles'); +if (!defined('_CLICK_HERE_TO_GO_TO_UPDATE_MANAGEMENT')) + define('_CLICK_HERE_TO_GO_TO_UPDATE_MANAGEMENT', 'Cliquez ici pour commencer la procédure de mise à jour'); +if (!defined('_NEW_MAJOR_VERSION_AVAILABLE')) + define('_NEW_MAJOR_VERSION_AVAILABLE', 'Nouvelle version majeure disponible'); +if (!defined('_BRANCH_VERSION')) + define('_BRANCH_VERSION', 'Branche'); +if (!defined('_TAG_VERSION')) + define('_TAG_VERSION', 'Tag'); +if (!defined('_CONNECT_YOU_IN_SUPERADMIN')) + define('_CONNECT_YOU_IN_SUPERADMIN', 'Vous devez être connecté en superadmin pour accéder à la procédure de mise à jour'); +if (!defined('_UPDATE_WELCOME')) + define('_UPDATE_WELCOME', 'Mise à jour'); +if (!defined('_UPDATE_WELCOME_INSTALL')) + define('_UPDATE_WELCOME_INSTALL', 'Procédure de mise à jour'); +if (!defined('_UPDATE_DESC_INSTALL')) + define('_UPDATE_DESC_INSTALL', 'Procédure de mise à jour de MaarchCourrier (versions mineures uniquement)'); +if (!defined('_UPDATE_BACKUP')) + define('_UPDATE_BACKUP', 'Sauvegarde'); +if (!defined('_UPDATE_BACKUP_INFOS')) + define('_UPDATE_BACKUP_INFOS', 'Sauvegarde de votre version actuelle'); +if (!defined('_UPDATE_BACKUP_DETAILS')) + define('_UPDATE_BACKUP_DETAILS', 'Procédure de sauvegarde de votre version actuelle afin de pouvoir la restaurer si besoin'); +if (!defined('_ACTUAL_VERSION_PATH')) + define('_ACTUAL_VERSION_PATH', 'Chemin de votre installation'); +if (!defined('_UPDATE_BACKUP_PATH')) + define('_UPDATE_BACKUP_PATH', 'Chemin de votre sauvegarde'); +if (!defined('_BACKUP_ACTUAL_VERSION')) + define('_BACKUP_ACTUAL_VERSION', 'Sauvegarder votre version'); +if (!defined('_UPDATE_DOWNLOAD')) + define('_UPDATE_DOWNLOAD', 'Téléchargement'); +if (!defined('_LAST_RELEASE_INFOS')) + define('_LAST_RELEASE_INFOS', 'Téléchargement de la dernière version mineure'); +if (!defined('_LAST_RELEASE_DETAILS')) + define('_LAST_RELEASE_DETAILS', 'Détails des versions mineures disponibles'); +if (!defined('_CHOOSE_VERSION_TO_UPDATE')) + define('_CHOOSE_VERSION_TO_UPDATE', 'Choisissez la version'); +if (!defined('_UPDATE_DEPLOY')) + define('_UPDATE_DEPLOY', 'Déploiement'); +if (!defined('_UPDATE_DEPLOY_INFOS')) + define('_UPDATE_DEPLOY_INFOS', 'Déploiement de la version téléchargée'); +if (!defined('_UPDATE_DEPLOY_DETAILS')) + define('_UPDATE_DEPLOY_DETAILS', 'Déploiement de la version téléchargée'); +if (!defined('_DEPLOY_VERSION')) + define('_DEPLOY_VERSION', 'Déployer la version'); +if (!defined('_UPDATE_END')) + define('_UPDATE_END', 'Mise à jour réussi'); +if (!defined('_UPDATE_DESC_END')) + define('_UPDATE_DESC_END', 'Mise à jour réussi'); \ No newline at end of file diff --git a/apps/maarch_entreprise/lang/fr.php b/apps/maarch_entreprise/lang/fr.php index b82223820bd0b3724f6b42d4e97532189070c5a9..2c7942cb96b5af34a73d8efb04b182b001862b5a 100755 --- a/apps/maarch_entreprise/lang/fr.php +++ b/apps/maarch_entreprise/lang/fr.php @@ -1906,3 +1906,61 @@ if (!defined('_UPDATED_EMAIL_SIGNATURE')) if (!defined('_DELETED_EMAIL_SIGNATURE')) define('_DELETED_EMAIL_SIGNATURE', 'Signature de mail supprimée'); /***** Profile *****/ + +/**** admin update control ****/ +if (!defined('_ADMIN_UPDATE_CONTROL')) + define('_ADMIN_UPDATE_CONTROL', 'Vérification mise à jour'); +if (!defined('_ADMIN_UPDATE_CONTROL_DESC')) + define('_ADMIN_UPDATE_CONTROL_DESC', 'Vérification mise à jour'); +if (!defined('_YOUR_VERSION')) + define('_YOUR_VERSION', 'Votre version'); +if (!defined('_AVAILABLE_VERSION_TO_UPDATE')) + define('_AVAILABLE_VERSION_TO_UPDATE', 'Versions disponibles'); +if (!defined('_CLICK_HERE_TO_GO_TO_UPDATE_MANAGEMENT')) + define('_CLICK_HERE_TO_GO_TO_UPDATE_MANAGEMENT', 'Cliquez ici pour commencer la procédure de mise à jour'); +if (!defined('_NEW_MAJOR_VERSION_AVAILABLE')) + define('_NEW_MAJOR_VERSION_AVAILABLE', 'Nouvelle version majeure disponible'); +if (!defined('_BRANCH_VERSION')) + define('_BRANCH_VERSION', 'Branche'); +if (!defined('_TAG_VERSION')) + define('_TAG_VERSION', 'Tag'); +if (!defined('_CONNECT_YOU_IN_SUPERADMIN')) + define('_CONNECT_YOU_IN_SUPERADMIN', 'Vous devez être connecté en superadmin pour accéder à la procédure de mise à jour'); +if (!defined('_UPDATE_WELCOME')) + define('_UPDATE_WELCOME', 'Mise à jour'); +if (!defined('_UPDATE_WELCOME_INSTALL')) + define('_UPDATE_WELCOME_INSTALL', 'Procédure de mise à jour'); +if (!defined('_UPDATE_DESC_INSTALL')) + define('_UPDATE_DESC_INSTALL', 'Procédure de mise à jour de MaarchCourrier (versions mineures uniquement)'); +if (!defined('_UPDATE_BACKUP')) + define('_UPDATE_BACKUP', 'Sauvegarde'); +if (!defined('_UPDATE_BACKUP_INFOS')) + define('_UPDATE_BACKUP_INFOS', 'Sauvegarde de votre version actuelle'); +if (!defined('_UPDATE_BACKUP_DETAILS')) + define('_UPDATE_BACKUP_DETAILS', 'Procédure de sauvegarde de votre version actuelle afin de pouvoir la restaurer si besoin'); +if (!defined('_ACTUAL_VERSION_PATH')) + define('_ACTUAL_VERSION_PATH', 'Chemin de votre installation'); +if (!defined('_UPDATE_BACKUP_PATH')) + define('_UPDATE_BACKUP_PATH', 'Chemin de votre sauvegarde'); +if (!defined('_BACKUP_ACTUAL_VERSION')) + define('_BACKUP_ACTUAL_VERSION', 'Sauvegarder votre version'); +if (!defined('_UPDATE_DOWNLOAD')) + define('_UPDATE_DOWNLOAD', 'Téléchargement'); +if (!defined('_LAST_RELEASE_INFOS')) + define('_LAST_RELEASE_INFOS', 'Téléchargement de la dernière version mineure'); +if (!defined('_LAST_RELEASE_DETAILS')) + define('_LAST_RELEASE_DETAILS', 'Détails des versions mineures disponibles'); +if (!defined('_CHOOSE_VERSION_TO_UPDATE')) + define('_CHOOSE_VERSION_TO_UPDATE', 'Choisissez la version'); +if (!defined('_UPDATE_DEPLOY')) + define('_UPDATE_DEPLOY', 'Déploiement'); +if (!defined('_UPDATE_DEPLOY_INFOS')) + define('_UPDATE_DEPLOY_INFOS', 'Déploiement de la version téléchargée'); +if (!defined('_UPDATE_DEPLOY_DETAILS')) + define('_UPDATE_DEPLOY_DETAILS', 'Déploiement de la version téléchargée'); +if (!defined('_DEPLOY_VERSION')) + define('_DEPLOY_VERSION', 'Déployer la version'); +if (!defined('_UPDATE_END')) + define('_UPDATE_END', 'Mise à jour réussi'); +if (!defined('_UPDATE_DESC_END')) + define('_UPDATE_DESC_END', 'Mise à jour réussi'); diff --git a/install/view/update_backup_view.php b/install/view/update_backup_view.php index 52a26db94712cebc9b4b7204076d88dcdaf69a72..1131ad485f61a1938ba3998c6fe0ab23d32b4309 100644 --- a/install/view/update_backup_view.php +++ b/install/view/update_backup_view.php @@ -15,6 +15,11 @@ * @version $Revision$ * @ingroup install */ +if ($_SESSION['user']['UserId'] <> 'superadmin') { + header('location: ' . $_SESSION['config']['businessappurl'] + . 'index.php?page=update_control&admin=update_control'); + exit(); +} ?> <script> function launchProcess( diff --git a/install/view/update_deploy_view.php b/install/view/update_deploy_view.php index 0d2a953320733365b603ec0fb4f0fd8c7e999626..b5ec344e2ff37251a07ca29fa815fb888645fc89 100644 --- a/install/view/update_deploy_view.php +++ b/install/view/update_deploy_view.php @@ -15,6 +15,11 @@ * @version $Revision$ * @ingroup install */ +if ($_SESSION['user']['UserId'] <> 'superadmin') { + header('location: ' . $_SESSION['config']['businessappurl'] + . 'index.php?page=update_control&admin=update_control'); + exit(); +} ?> <script> function launchProcess( @@ -38,13 +43,13 @@ <div class="blockWrapper"> <div class="titleBlock"> <h2 onClick="slide('database');" style="cursor: pointer;"> - <?php echo _LAST_RELEASE_INFOS;?> + <?php echo _UPDATE_DEPLOY_INFOS;?> </h2> </div> <div class="contentBlock" id="database"> <p> <h6> - <?php echo _LAST_RELEASE_DETAILS;?> + <?php echo _UPDATE_DEPLOY_DETAILS;?> </h6> <form> <table> diff --git a/install/view/update_download_view.php b/install/view/update_download_view.php index b57eee6ed52abffaf52fe49343486c0c27c20d92..643b025c557cc580ea40b9cad3541fa8b4181806 100644 --- a/install/view/update_download_view.php +++ b/install/view/update_download_view.php @@ -15,7 +15,11 @@ * @version $Revision$ * @ingroup install */ - +if ($_SESSION['user']['UserId'] <> 'superadmin') { + header('location: ' . $_SESSION['config']['businessappurl'] + . 'index.php?page=update_control&admin=update_control'); + exit(); +} //retrives tags $client = new \Gitlab\Client('https://labs.maarch.org/api/v4/'); @@ -33,6 +37,42 @@ $query = "select param_value_int, param_value_string from parameters where id = $stmt = $db->query($query, []); $currentVersion = $stmt->fetchObject(); // var_dump($currentVersion); +$currentVersionNumeric = preg_replace("/[^0-9,]/", "", $currentVersion->param_value_int); +if (!empty($currentVersion->param_value_string)) { + $currentVersionTagNumeric = preg_replace("/[^0-9,]/", "", $currentVersion->param_value_string); +} + +$allTagsNumeric = []; +$allCurrentTags = []; +$allNextTags = []; +$cptCurrentTags = 0; +$isAnyAvailableTag = false; +$isAnyAvailableVersion = false; + +foreach ($tags as $key => $value) { + //echo $tags[$key]['name'] . ' ' . preg_replace("/[^0-9,]/", "", $tags[$key]['name']) . '<br />'; + $tagNumeric = preg_replace("/[^0-9,]/", "", $tags[$key]['name']); + $allTagsNumeric[] = $tagNumeric; + $pos = strpos($tagNumeric, $currentVersionNumeric); + if ($pos === false) { + //echo 'tag not in currentVersion:'; + $isAnyAvailableVersion = true; + $allNextTags[] = $tags[$key]['name']; + } else { + //echo 'tag in currentVersion:'; + $allCurrentTags[$cptCurrentTags] = []; + $allCurrentTags[$cptCurrentTags]['name'] = $tags[$key]['name']; + $allCurrentTags[$cptCurrentTags]['numeric'] = $tagNumeric; + if ($tagNumeric > $currentVersionTagNumeric) { + $allCurrentTags[$cptCurrentTags]['enabled'] = true; + $isAnyAvailableTag = true; + } else { + $allCurrentTags[$cptCurrentTags]['enabled'] = false; + } + $cptCurrentTags++; + } + //echo $tagNumeric . '<br />'; +} ?> <script> @@ -102,31 +142,33 @@ $currentVersion = $stmt->fetchObject(); if (count($tags)>0) { ?> <select id="version" id="name"> - <option value="default">Select a version</option> + <!--option value="default"><?php echo _SELECT_A_VERSION;?></option--> <?php - foreach ($tags as $key => $value) { - //echo $tags[$key]['name'] . '<br />'; - echo '<option '; - echo 'value="' . $tags[$key]['name'] . '"'; - echo '>'; - echo $tags[$key]['name']; - echo '</option>'; + for ($i=0;$i<count($allCurrentTags);$i++) { + if ($allCurrentTags[$i]['enabled']) { + echo '<option '; + echo 'value="' . $allCurrentTags[$i]['name'] . '"'; + echo '>'; + echo $allCurrentTags[$i]['name']; + echo '</option>'; + } else { + echo '<option '; + echo 'value="' . $allCurrentTags[$i]['name'] . '"'; + echo ' disabled>'; + echo $allCurrentTags[$i]['name']; + echo '</option>'; + } } ?> </select> <?php } else { - echo _NO_AVAILABLE_VERSION_TO_UPDATE; + echo _NO_AVAILABLE_TAG_TO_UPDATE . '<br />'; } ?> </td> </tr> - <tr> - <td> </td> - <td> </td> - <td> </td> - </tr> <tr> <td></td> <td></td> @@ -138,6 +180,39 @@ $currentVersion = $stmt->fetchObject(); /> </td> </tr> + <tr> + <td> </td> + <td> </td> + <td> </td> + </tr> + <tr> + <td> </td> + <td> </td> + <td> + <?php + if (!$isAnyAvailableTag) { + echo _NO_AVAILABLE_TAG_TO_UPDATE . '<br />'; + }?> + </td> + </tr> + <tr> + <td> </td> + <td> </td> + <td> </td> + </tr> + <tr> + <td> </td> + <td> </td> + <td> + <?php + if ($isAnyAvailableVersion) { + echo '<b>' . _NEW_MAJOR_VERSION_AVAILABLE . '</b>:'; + for ($j=0;$j<count($allNextTags);$j++) { + echo $allNextTags[$j] . '<br />'; + } + }?> + </td> + </tr> </table> </form> <br /> diff --git a/install/view/update_end_view.php b/install/view/update_end_view.php index 987a8746ac5ab64aa8c758cfe6348decd759bb3a..b15d26cd19f720599b5641639b7abccdc4f268d5 100644 --- a/install/view/update_end_view.php +++ b/install/view/update_end_view.php @@ -15,6 +15,12 @@ * @version $Revision$ * @ingroup install */ + +if ($_SESSION['user']['UserId'] <> 'superadmin') { + header('location: ' . $_SESSION['config']['businessappurl'] + . 'index.php?page=update_control&admin=update_control'); + exit(); +} ?> <div class="blockWrapper"> <div class="titleBlock"> diff --git a/install/view/update_language_view.php b/install/view/update_language_view.php index 10772dfb8a060573e584b884ffe8d49f2ea4a57e..2d39fa370582a6cc9ce47f010b8664c4ba6066de 100644 --- a/install/view/update_language_view.php +++ b/install/view/update_language_view.php @@ -1,21 +1,9 @@ <?php -/* -* Copyright 2008-2012 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework 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 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework 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. +/** +* Copyright Maarch since 2008 under licence GPLv3. +* See LICENCE.txt file at the root folder for more details. +* This file is part of Maarch software. * -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. */ /** @@ -27,6 +15,11 @@ * @version $Revision$ * @ingroup install */ +if ($_SESSION['user']['UserId'] <> 'superadmin') { + header('location: ' . $_SESSION['config']['businessappurl'] + . 'index.php?page=update_control&admin=update_control'); + exit(); +} ?> <div class="blockWrapper"> <div class="titleBlock"> diff --git a/install/view/update_welcome_view.php b/install/view/update_welcome_view.php index 1f4e6a377f407970d63bea1938173fc9ec9401c7..b5f59975b42137e5c25825c300bbff32b5e1a99e 100644 --- a/install/view/update_welcome_view.php +++ b/install/view/update_welcome_view.php @@ -1,21 +1,9 @@ <?php -/* -* Copyright 2008-2012 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework 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 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework 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. +/** +* Copyright Maarch since 2008 under licence GPLv3. +* See LICENCE.txt file at the root folder for more details. +* This file is part of Maarch software. * -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. */ /** @@ -27,6 +15,11 @@ * @version $Revision$ * @ingroup install */ +if ($_SESSION['user']['UserId'] <> 'superadmin') { + header('location: ' . $_SESSION['config']['businessappurl'] + . 'index.php?page=update_control&admin=update_control'); + exit(); +} ?> <div class="blockWrapper"> <div class="titleBlock">