Deprecate LSsession :: redirect() method in favor of LSurl :: redirect().

This commit is contained in:
Benjamin Renard 2020-05-04 18:28:20 +02:00
parent 55d78db99f
commit a7fea52c92
8 changed files with 89 additions and 68 deletions

View file

@ -61,6 +61,6 @@ function LSaddon_phpldapadmin_support() {
*/
function redirectToPhpLdapAdmin(&$ldapObject) {
$url = $ldapObject->getFData(LS_PHPLDAPADMIN_VIEW_OBJECT_URL_FORMAT);
LSsession::redirect($url);
LSurl::redirect($url);
return true;
}

View file

@ -114,7 +114,7 @@ class LSauthMethod_HTTP extends LSauthMethod_basic {
**/
public static function afterLogout() {
if (defined('LSAUTHMETHOD_HTTP_LOGOUT_REMOTE_URL')) {
LSsession :: redirect(LSAUTHMETHOD_HTTP_LOGOUT_REMOTE_URL);
LSurl :: redirect(LSAUTHMETHOD_HTTP_LOGOUT_REMOTE_URL);
}
return true;
}

View file

@ -644,7 +644,7 @@ class LSsession {
LSauth :: afterLogout();
// Redirect user on home page
self :: redirect('index.php');
LSurl :: redirect('index.php');
return;
}
@ -2535,19 +2535,18 @@ class LSsession {
}
/**
* Redirection de l'utilisateur vers une autre URL
* Redirect user to another URL
*
* @param[in] $url string L'URL
* @param[in] $exit boolean Si true, l'execution script s'arrête après la redirection
* /!\ DEPRECATED /!\ : please use LSurl :: redirect()
*
* @param[in] $url string The destination URL
* @param[in] $exit boolean Unsed (keep for reto-compatibility)
*
* @retval void
*/
public static function redirect($url, $exit=true) {
LStemplate :: assign('url',$url);
LStemplate :: display('redirect.tpl');
if ($exit) {
exit();
}
LSerror :: addErrorCode('LSsession_27');
LSurl :: redirect($url);
}
/**
@ -2575,7 +2574,7 @@ class LSsession {
}
}
if ($force)
self :: redirect('index.php');
LSurl :: redirect('index.php');
}
/**
@ -2685,6 +2684,9 @@ class LSsession {
LSerror :: defineError('LSsession_26',
_("LSsession : You have been redirect from an old-style URL %{url}. Please upgrade this link.")
);
LSerror :: defineError('LSsession_27',
_("LSsession : You still seen use LSsession :: redirect() in your custom code. Please upgrade it and use LSurl :: redirect().")
);
}
/**

View file

@ -203,6 +203,10 @@ class LSurl {
LSlog :: debug("redirect($go) => Redirect to : <$url>");
header("Location: $url");
// Set & display template
LStemplate :: assign('url', $url);
LStemplate :: display('redirect.tpl');
exit();
}

View file

@ -1274,8 +1274,8 @@ LSurl :: add_handler('#^addon/(?P<LSaddon>[^/]+)/(?P<view>[^/]+)$#', 'handle_add
function handle_old_addon_view($request) {
if ((isset($_GET['LSaddon'])) && (isset($_GET['view']))) {
LSerror :: addErrorCode('LSsession_25', urldecode($_GET['LSaddon']));
LSsession :: redirect('addon/'.$_GET['LSaddon'].'/'.$_GET['view']);
LSurl :: redirect('addon/'.$_GET['LSaddon'].'/'.$_GET['view']);
}
LSsession :: redirect();
LSurl :: redirect();
}
LSurl :: add_handler('#^addon_view.php#', 'handle_old_addon_view');

View file

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: LdapSaisie\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2020-05-04 17:56+0200\n"
"PO-Revision-Date: 2020-05-04 18:25+0200\n"
"Last-Translator: Benjamin Renard <brenard@zionetrix.net>\n"
"Language-Team: LdapSaisie <ldapsaisie-users@lists.labs.libre-entreprise."
"org>\n"
@ -859,11 +859,11 @@ msgstr "Langue"
msgid "Connected as"
msgstr "Connecté en tant que"
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2611
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2610
msgid "LSsession : The constant %{const} is not defined."
msgstr "LSsession : La constante %{const} n'est pas définie."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2614
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2613
msgid ""
"LSsession : The %{addon} support is uncertain. Verify system compatibility "
"and the add-on configuration."
@ -871,52 +871,52 @@ msgstr ""
"LSsession : Le support %{addon} est incertain. Vérifiez la compatibilité du "
"système et la configuration de l'add-on."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2617
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2616
msgid ""
"LSsession : LDAP server's configuration data are invalid. Can't connect."
msgstr ""
"LSsession : Les données de configuration du serveur LDAP sont invalide. "
"Impossible de s'y connecter."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2620
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2619
msgid "LSsession : Failed to load LSobject type %{type} : unknon type."
msgstr ""
"LSsession : Impossible de charger le type d'LSobject %{type} : type inconnu."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2623
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2622
msgid "LSsession : Failed to load LSclass %{class}."
msgstr "LSsession : Impossible de charger la LSclass %{class}."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2626
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2625
msgid "LSsession : Login or password incorrect."
msgstr "LSsession : Identifiant ou mot de passe incorrects."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2629
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2628
msgid "LSsession : Impossible to identify you : Duplication of identities."
msgstr "LSsession : Impossible de vous identifier : Duplication d'identité."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2632
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2631
msgid "LSsession : Can't load class of authentification (%{class})."
msgstr ""
"LSsession : Impossible de charger la classe d'authentification (%{class})."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2635
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2634
msgid "LSsession : Can't connect to LDAP server."
msgstr "LSsession : Impossible de se connecter au serveur LDAP."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2638
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2637
msgid "LSsession : Impossible to authenticate you."
msgstr "LSsession : Impossible de vous identifier."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2641
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2640
msgid "LSsession : Your are not authorized to do this action."
msgstr "LSsession : Vous n'êtes pas autorisé à faire cette action."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2644
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2643
msgid "LSsession : Some informations are missing to display this page."
msgstr "LSsession : Des informations sont manquant pour afficher cette page."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2647
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2646
msgid ""
"LSsession : The function of the custom action %{name} does not exists or is "
"not configured."
@ -924,24 +924,24 @@ msgstr ""
"LSsearch : La fonction de l'action personnalisée %{name} n'existe pas ou "
"n'est pas configurée."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2650
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2649
msgid "LSsession : Fail to retreive user's LDAP credentials from LSauth."
msgstr ""
"LSsession : Erreur en récupérant les identifiants LDAP de l'utilisateur "
"depuis LSauth."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2653
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2652
msgid ""
"LSsession : Fail to reconnect to LDAP server with user's LDAP credentials."
msgstr ""
"LSsession : Impossible de se reconnecter au serveur LDAP avec les "
"identifiants de l'utilisateur."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2656
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2655
msgid "LSsession : No import/export format define for this object type."
msgstr "LSsession : Aucun format d'entrée/sortie définie pour ce type d'objet."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2659
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2658
msgid ""
"LSsession : Error during creation of list of levels. Contact administrators. "
"(Code : %{code})"
@ -949,13 +949,13 @@ msgstr ""
"LSsession : Erreur durant la création de la liste des niveaux. Contacter les "
"administrateurs. (Code : %{type})"
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2662
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2661
msgid "LSsession : The password recovery is disabled for this LDAP server."
msgstr ""
"LSsession : La récupération de mot de passe est désactivée pour ce serveur "
"LDAP."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2665
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2664
msgid ""
"LSsession : Some informations are missing to recover your password. Contact "
"administrators."
@ -963,7 +963,7 @@ msgstr ""
"LSsession : Des informations sont manques pour pouvoir récupérer votre mot "
"de passe. Contacter les administrateurs."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2668
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2667
msgid ""
"LSsession : Error during password recovery. Contact administrators.(Step : "
"%{step})"
@ -971,26 +971,26 @@ msgstr ""
"LSsession : Erreur durant la récupération de votre mot de passe. Contacter "
"les administrateurs. (Etape : %{step})"
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2671
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2670
msgid ""
"LSsession : call function %{func} do not provided from LSaddon %{addon}."
msgstr ""
"LSsession : la fonction %{func} n'est pas fournie par le LSaddon %{addon}."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2674
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2673
msgid "LSsession : problem during initialisation."
msgstr "LSsession : Problème durant l'initialisation."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2677
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2676
msgid "LSsession : view function %{func} for LSaddon %{addon} doet not exist."
msgstr ""
"LSsession : la fonction de vue %{func} du LSaddon %{addon} n'existe pas."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2680
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2679
msgid "LSsession : invalid related object's DN pass in parameter."
msgstr "LSsession : DN d'objet en relation incorrect dans les paramètres."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2683
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2682
msgid ""
"LSsession : the LSaddon %{addon} keep using old-style addon view URL. Please "
"upgrade it."
@ -998,7 +998,7 @@ msgstr ""
"LSsession : le LSaddon %{addon} utilise toujours l'ancien type d'URL de "
"vues. Merci de le mettre à jour."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2686
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2685
msgid ""
"LSsession : You have been redirect from an old-style URL %{url}. Please "
"upgrade this link."
@ -1006,6 +1006,15 @@ msgstr ""
"LSsession : Vous avez été redirigé depuis une ancienne URL %{url}. Merci de "
"le mettre à jour ce lien."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2688
msgid ""
"LSsession : You still seen use LSsession :: redirect() in your custom code. "
"Please upgrade it and use LSurl :: redirect()."
msgstr ""
"LSsession : Vous semblez toujours utilisé LSsession :: redirect() dans votre "
"code personnalisé. Merci de mettre à jour ce code et d'utiliser LSurl :: "
"redirect()."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSldapObject.php:473
msgid "The attribute %{attr} is not valid."
msgstr "L'attribut %{attr} n'est pas valide."

View file

@ -726,127 +726,133 @@ msgstr ""
msgid "Connected as"
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2611
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2610
msgid "LSsession : The constant %{const} is not defined."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2614
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2613
msgid ""
"LSsession : The %{addon} support is uncertain. Verify system compatibility "
"and the add-on configuration."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2617
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2616
msgid ""
"LSsession : LDAP server's configuration data are invalid. Can't connect."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2620
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2619
msgid "LSsession : Failed to load LSobject type %{type} : unknon type."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2623
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2622
msgid "LSsession : Failed to load LSclass %{class}."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2626
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2625
msgid "LSsession : Login or password incorrect."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2629
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2628
msgid "LSsession : Impossible to identify you : Duplication of identities."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2632
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2631
msgid "LSsession : Can't load class of authentification (%{class})."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2635
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2634
msgid "LSsession : Can't connect to LDAP server."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2638
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2637
msgid "LSsession : Impossible to authenticate you."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2641
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2640
msgid "LSsession : Your are not authorized to do this action."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2644
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2643
msgid "LSsession : Some informations are missing to display this page."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2647
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2646
msgid ""
"LSsession : The function of the custom action %{name} does not exists or is "
"not configured."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2650
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2649
msgid "LSsession : Fail to retreive user's LDAP credentials from LSauth."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2653
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2652
msgid ""
"LSsession : Fail to reconnect to LDAP server with user's LDAP credentials."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2656
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2655
msgid "LSsession : No import/export format define for this object type."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2659
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2658
msgid ""
"LSsession : Error during creation of list of levels. Contact administrators. "
"(Code : %{code})"
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2662
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2661
msgid "LSsession : The password recovery is disabled for this LDAP server."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2665
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2664
msgid ""
"LSsession : Some informations are missing to recover your password. Contact "
"administrators."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2668
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2667
msgid ""
"LSsession : Error during password recovery. Contact administrators.(Step : "
"%{step})"
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2671
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2670
msgid ""
"LSsession : call function %{func} do not provided from LSaddon %{addon}."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2674
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2673
msgid "LSsession : problem during initialisation."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2677
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2676
msgid "LSsession : view function %{func} for LSaddon %{addon} doet not exist."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2680
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2679
msgid "LSsession : invalid related object's DN pass in parameter."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2683
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2682
msgid ""
"LSsession : the LSaddon %{addon} keep using old-style addon view URL. Please "
"upgrade it."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2686
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2685
msgid ""
"LSsession : You have been redirect from an old-style URL %{url}. Please "
"upgrade this link."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsession.php:2688
msgid ""
"LSsession : You still seen use LSsession :: redirect() in your custom code. "
"Please upgrade it and use LSurl :: redirect()."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSldapObject.php:473
msgid "The attribute %{attr} is not valid."
msgstr ""