diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-25 23:15:08 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-25 23:15:08 +0100 |
commit | 01f21083a897b86bf148f1d2bb9c8edca4d3786a (patch) | |
tree | 784f04e9b6ef99a49e572c84e4b7ab40b5eb5fde /nixops/modules/websites/commons/spip | |
parent | bfe3c9c9df0c5112bc8806483292b55ed0f7e02d (diff) | |
download | Nix-01f21083a897b86bf148f1d2bb9c8edca4d3786a.tar.gz Nix-01f21083a897b86bf148f1d2bb9c8edca4d3786a.tar.zst Nix-01f21083a897b86bf148f1d2bb9c8edca4d3786a.zip |
Rename virtual folder to nixops
Fixes https://git.immae.eu/mantisbt/view.php?id=82
Diffstat (limited to 'nixops/modules/websites/commons/spip')
-rw-r--r-- | nixops/modules/websites/commons/spip/spip_ldap_patch.patch | 60 | ||||
-rw-r--r-- | nixops/modules/websites/commons/spip/spip_mes_options.php | 18 |
2 files changed, 78 insertions, 0 deletions
diff --git a/nixops/modules/websites/commons/spip/spip_ldap_patch.patch b/nixops/modules/websites/commons/spip/spip_ldap_patch.patch new file mode 100644 index 0000000..653c909 --- /dev/null +++ b/nixops/modules/websites/commons/spip/spip_ldap_patch.patch | |||
@@ -0,0 +1,60 @@ | |||
1 | --- old/ecrire/auth/ldap.php 2017-06-08 21:58:17.000000000 +0200 | ||
2 | +++ new/ecrire/auth/ldap.php 2017-06-10 02:54:02.687954143 +0200 | ||
3 | @@ -171,24 +171,41 @@ | ||
4 | $desc = isset($ldap['attributes']) && $ldap['attributes'] ? $ldap['attributes'] : $GLOBALS['ldap_attributes'] ; | ||
5 | |||
6 | $logins = is_array($desc['login']) ? $desc['login'] : array($desc['login']); | ||
7 | + if (isset($GLOBALS['ldap_search'])) { | ||
8 | + $search_query = str_replace("%user%", $login_search, $GLOBALS['ldap_search']); | ||
9 | + $result = @ldap_search($ldap_link, $ldap_base, $search_query, array("dn")); | ||
10 | + $info = @ldap_get_entries($ldap_link, $result); | ||
11 | + // Ne pas accepter les resultats si plus d'une entree | ||
12 | + // (on veut un attribut unique) | ||
13 | |||
14 | - // Tenter une recherche pour essayer de retrouver le DN | ||
15 | - foreach ($logins as $att) { | ||
16 | - $result = @ldap_search($ldap_link, $ldap_base, "$att=$login_search", array("dn")); | ||
17 | - $info = @ldap_get_entries($ldap_link, $result); | ||
18 | - // Ne pas accepter les resultats si plus d'une entree | ||
19 | - // (on veut un attribut unique) | ||
20 | + if (is_array($info) and $info['count'] == 1) { | ||
21 | + $dn = $info[0]['dn']; | ||
22 | + if (!$checkpass) { | ||
23 | + return $dn; | ||
24 | + } | ||
25 | + if (@ldap_bind($ldap_link, $dn, $pass)) { | ||
26 | + return $dn; | ||
27 | + } | ||
28 | + } | ||
29 | + } else { | ||
30 | + // Tenter une recherche pour essayer de retrouver le DN | ||
31 | + foreach ($logins as $att) { | ||
32 | + $result = @ldap_search($ldap_link, $ldap_base, "$att=$login_search", array("dn")); | ||
33 | + $info = @ldap_get_entries($ldap_link, $result); | ||
34 | + // Ne pas accepter les resultats si plus d'une entree | ||
35 | + // (on veut un attribut unique) | ||
36 | |||
37 | - if (is_array($info) and $info['count'] == 1) { | ||
38 | - $dn = $info[0]['dn']; | ||
39 | - if (!$checkpass) { | ||
40 | - return $dn; | ||
41 | - } | ||
42 | - if (@ldap_bind($ldap_link, $dn, $pass)) { | ||
43 | - return $dn; | ||
44 | - } | ||
45 | - } | ||
46 | - } | ||
47 | + if (is_array($info) and $info['count'] == 1) { | ||
48 | + $dn = $info[0]['dn']; | ||
49 | + if (!$checkpass) { | ||
50 | + return $dn; | ||
51 | + } | ||
52 | + if (@ldap_bind($ldap_link, $dn, $pass)) { | ||
53 | + return $dn; | ||
54 | + } | ||
55 | + } | ||
56 | + } | ||
57 | + } | ||
58 | |||
59 | if ($checkpass and !isset($dn)) { | ||
60 | // Si echec, essayer de deviner le DN | ||
diff --git a/nixops/modules/websites/commons/spip/spip_mes_options.php b/nixops/modules/websites/commons/spip/spip_mes_options.php new file mode 100644 index 0000000..8db8389 --- /dev/null +++ b/nixops/modules/websites/commons/spip/spip_mes_options.php | |||
@@ -0,0 +1,18 @@ | |||
1 | <?php // /!\ Important: There must be no blank space before <?php or after ?> | ||
2 | // This file was inspired from the spip contrib website | ||
3 | // http://www.spip.net/fr_article3811.html | ||
4 | |||
5 | $config_dir = getenv('SPIP_CONFIG_DIR') . '/'; | ||
6 | $var_dir = getenv('SPIP_VAR_DIR') . '/'; | ||
7 | |||
8 | $cookie_prefix = str_replace('.', '_', getenv("SPIP_SITE")); | ||
9 | $table_prefix = 'spip'; | ||
10 | |||
11 | spip_initialisation( | ||
12 | $config_dir, | ||
13 | _DIR_RACINE . _NOM_PERMANENTS_ACCESSIBLES, | ||
14 | $var_dir . _NOM_TEMPORAIRES_INACCESSIBLES, | ||
15 | _DIR_RACINE . _NOM_TEMPORAIRES_ACCESSIBLES | ||
16 | ); | ||
17 | |||
18 | ?> | ||