@@ -1,22 +1,22 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 4 | - return; |
|
| 4 | + return; |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | function trier_rss($texte) { |
| 8 | - if (preg_match_all(',<item.*</item>\s*?,Uims', (string) $texte, $matches, PREG_SET_ORDER)) { |
|
| 9 | - $placeholder = '<!--REINSERT-->'; |
|
| 10 | - $items = []; |
|
| 11 | - foreach ($matches as $match) { |
|
| 12 | - if (preg_match(',<dc:date>(.*)</dc:date>,Uims', $match[0], $r)) { |
|
| 13 | - $items[strtotime($r[1])] = trim($match[0]); |
|
| 14 | - $texte = str_replace($match[0], unique($placeholder), (string) $texte); |
|
| 15 | - } |
|
| 16 | - } |
|
| 17 | - krsort($items); |
|
| 18 | - $texte = str_replace($placeholder, implode("\n\t", $items) . "\n", (string) $texte); |
|
| 19 | - } |
|
| 8 | + if (preg_match_all(',<item.*</item>\s*?,Uims', (string) $texte, $matches, PREG_SET_ORDER)) { |
|
| 9 | + $placeholder = '<!--REINSERT-->'; |
|
| 10 | + $items = []; |
|
| 11 | + foreach ($matches as $match) { |
|
| 12 | + if (preg_match(',<dc:date>(.*)</dc:date>,Uims', $match[0], $r)) { |
|
| 13 | + $items[strtotime($r[1])] = trim($match[0]); |
|
| 14 | + $texte = str_replace($match[0], unique($placeholder), (string) $texte); |
|
| 15 | + } |
|
| 16 | + } |
|
| 17 | + krsort($items); |
|
| 18 | + $texte = str_replace($placeholder, implode("\n\t", $items) . "\n", (string) $texte); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - return $texte; |
|
| 21 | + return $texte; |
|
| 22 | 22 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | } |
| 16 | 16 | } |
| 17 | 17 | krsort($items); |
| 18 | - $texte = str_replace($placeholder, implode("\n\t", $items) . "\n", (string) $texte); |
|
| 18 | + $texte = str_replace($placeholder, implode("\n\t", $items)."\n", (string) $texte); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | return $texte; |
@@ -10,40 +10,40 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | function defaut_tri_defined($defaut) { |
| 17 | - if (!defined('_TRI_ARTICLES_RUBRIQUE')) { |
|
| 18 | - return $defaut; |
|
| 19 | - } |
|
| 17 | + if (!defined('_TRI_ARTICLES_RUBRIQUE')) { |
|
| 18 | + return $defaut; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - $sens = 1; |
|
| 22 | - $tri = trim((string) _TRI_ARTICLES_RUBRIQUE); |
|
| 23 | - $tri = explode(' ', $tri); |
|
| 24 | - if (strncasecmp(end($tri), 'DESC', 4) == 0) { |
|
| 25 | - $sens = -1; |
|
| 26 | - array_pop($tri); |
|
| 27 | - } elseif (strncasecmp(end($tri), 'ASC', 3) == 0) { |
|
| 28 | - $sens = 1; |
|
| 29 | - array_pop($tri); |
|
| 30 | - } |
|
| 31 | - $tri = implode(' ', $tri); |
|
| 32 | - $tri = [$tri => $sens]; |
|
| 33 | - foreach ($defaut as $n => $s) { |
|
| 34 | - if (!isset($tri[$n])) { |
|
| 35 | - $tri[$n] = $s; |
|
| 36 | - } |
|
| 37 | - } |
|
| 21 | + $sens = 1; |
|
| 22 | + $tri = trim((string) _TRI_ARTICLES_RUBRIQUE); |
|
| 23 | + $tri = explode(' ', $tri); |
|
| 24 | + if (strncasecmp(end($tri), 'DESC', 4) == 0) { |
|
| 25 | + $sens = -1; |
|
| 26 | + array_pop($tri); |
|
| 27 | + } elseif (strncasecmp(end($tri), 'ASC', 3) == 0) { |
|
| 28 | + $sens = 1; |
|
| 29 | + array_pop($tri); |
|
| 30 | + } |
|
| 31 | + $tri = implode(' ', $tri); |
|
| 32 | + $tri = [$tri => $sens]; |
|
| 33 | + foreach ($defaut as $n => $s) { |
|
| 34 | + if (!isset($tri[$n])) { |
|
| 35 | + $tri[$n] = $s; |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - return $tri; |
|
| 39 | + return $tri; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | function defaut_tri_par($par, $defaut) { |
| 43 | - if (!defined('_TRI_ARTICLES_RUBRIQUE')) { |
|
| 44 | - return $par; |
|
| 45 | - } |
|
| 46 | - $par = array_keys($defaut); |
|
| 43 | + if (!defined('_TRI_ARTICLES_RUBRIQUE')) { |
|
| 44 | + return $par; |
|
| 45 | + } |
|
| 46 | + $par = array_keys($defaut); |
|
| 47 | 47 | |
| 48 | - return reset($par); |
|
| 48 | + return reset($par); |
|
| 49 | 49 | } |
@@ -10,53 +10,53 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // Fonction appelee par divers pipelines |
| 17 | 17 | function notifications_instituerarticle_dist($quoi, $id_article, $options) { |
| 18 | 18 | |
| 19 | - // ne devrait jamais se produire |
|
| 20 | - if ($options['statut'] == $options['statut_ancien']) { |
|
| 21 | - spip_log('statut inchange', 'notifications'); |
|
| 22 | - |
|
| 23 | - return; |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - include_spip('inc/texte'); |
|
| 27 | - |
|
| 28 | - $modele = ''; |
|
| 29 | - if ($options['statut'] == 'publie') { |
|
| 30 | - if ( |
|
| 31 | - $GLOBALS['meta']['post_dates'] == 'non' |
|
| 32 | - && strtotime((string) $options['date']) > time() |
|
| 33 | - ) { |
|
| 34 | - $modele = 'notifications/article_valide'; |
|
| 35 | - } else { |
|
| 36 | - $modele = 'notifications/article_publie'; |
|
| 37 | - } |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - if ($options['statut'] == 'prop' && $options['statut_ancien'] != 'publie') { |
|
| 41 | - $modele = 'notifications/article_propose'; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - if ($modele) { |
|
| 45 | - $destinataires = []; |
|
| 46 | - if ($GLOBALS['meta']['suivi_edito'] == 'oui') { |
|
| 47 | - $destinataires = explode(',', (string) $GLOBALS['meta']['adresse_suivi']); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - |
|
| 51 | - $destinataires = pipeline( |
|
| 52 | - 'notifications_destinataires', |
|
| 53 | - [ |
|
| 54 | - 'args' => ['quoi' => $quoi, 'id' => $id_article, 'options' => $options], |
|
| 55 | - 'data' => $destinataires |
|
| 56 | - ] |
|
| 57 | - ); |
|
| 58 | - |
|
| 59 | - $texte = email_notification_article($id_article, $modele); |
|
| 60 | - notifications_envoyer_mails($destinataires, $texte); |
|
| 61 | - } |
|
| 19 | + // ne devrait jamais se produire |
|
| 20 | + if ($options['statut'] == $options['statut_ancien']) { |
|
| 21 | + spip_log('statut inchange', 'notifications'); |
|
| 22 | + |
|
| 23 | + return; |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + include_spip('inc/texte'); |
|
| 27 | + |
|
| 28 | + $modele = ''; |
|
| 29 | + if ($options['statut'] == 'publie') { |
|
| 30 | + if ( |
|
| 31 | + $GLOBALS['meta']['post_dates'] == 'non' |
|
| 32 | + && strtotime((string) $options['date']) > time() |
|
| 33 | + ) { |
|
| 34 | + $modele = 'notifications/article_valide'; |
|
| 35 | + } else { |
|
| 36 | + $modele = 'notifications/article_publie'; |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + if ($options['statut'] == 'prop' && $options['statut_ancien'] != 'publie') { |
|
| 41 | + $modele = 'notifications/article_propose'; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + if ($modele) { |
|
| 45 | + $destinataires = []; |
|
| 46 | + if ($GLOBALS['meta']['suivi_edito'] == 'oui') { |
|
| 47 | + $destinataires = explode(',', (string) $GLOBALS['meta']['adresse_suivi']); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + |
|
| 51 | + $destinataires = pipeline( |
|
| 52 | + 'notifications_destinataires', |
|
| 53 | + [ |
|
| 54 | + 'args' => ['quoi' => $quoi, 'id' => $id_article, 'options' => $options], |
|
| 55 | + 'data' => $destinataires |
|
| 56 | + ] |
|
| 57 | + ); |
|
| 58 | + |
|
| 59 | + $texte = email_notification_article($id_article, $modele); |
|
| 60 | + notifications_envoyer_mails($destinataires, $texte); |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -34,45 +34,45 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | function install_etape_1_dist() { |
| 36 | 36 | |
| 37 | - $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 38 | - echo $minipage->installDebutPage(); |
|
| 37 | + $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 38 | + echo $minipage->installDebutPage(); |
|
| 39 | 39 | |
| 40 | - // stopper en cas de grosse incompatibilite de l'hebergement |
|
| 41 | - tester_compatibilite_hebergement(); |
|
| 40 | + // stopper en cas de grosse incompatibilite de l'hebergement |
|
| 41 | + tester_compatibilite_hebergement(); |
|
| 42 | 42 | |
| 43 | - // Recuperer les anciennes donnees pour plus de facilite (si presentes) |
|
| 44 | - $s = @is_readable(_FILE_CONNECT_TMP) ? analyse_fichier_connection(_FILE_CONNECT_TMP) : ''; |
|
| 43 | + // Recuperer les anciennes donnees pour plus de facilite (si presentes) |
|
| 44 | + $s = @is_readable(_FILE_CONNECT_TMP) ? analyse_fichier_connection(_FILE_CONNECT_TMP) : ''; |
|
| 45 | 45 | |
| 46 | - [$adresse_db, $login_db] = $s ?: ['localhost', '']; |
|
| 46 | + [$adresse_db, $login_db] = $s ?: ['localhost', '']; |
|
| 47 | 47 | |
| 48 | - $chmod = (isset($_GET['chmod']) && preg_match(',^\d+$,', (string) $_GET['chmod'])) ? |
|
| 49 | - sprintf('%04o', $_GET['chmod']) : '0777'; |
|
| 48 | + $chmod = (isset($_GET['chmod']) && preg_match(',^\d+$,', (string) $_GET['chmod'])) ? |
|
| 49 | + sprintf('%04o', $_GET['chmod']) : '0777'; |
|
| 50 | 50 | |
| 51 | - if (@is_readable(_FILE_CHMOD_TMP)) { |
|
| 52 | - $s = @implode('', @file(_FILE_CHMOD_TMP)); |
|
| 53 | - if (preg_match("#define\('_SPIP_CHMOD', (.*)\)#", $s, $regs)) { |
|
| 54 | - $chmod = $regs[1]; |
|
| 55 | - } |
|
| 56 | - } |
|
| 51 | + if (@is_readable(_FILE_CHMOD_TMP)) { |
|
| 52 | + $s = @implode('', @file(_FILE_CHMOD_TMP)); |
|
| 53 | + if (preg_match("#define\('_SPIP_CHMOD', (.*)\)#", $s, $regs)) { |
|
| 54 | + $chmod = $regs[1]; |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | - $db = [$adresse_db, _T('entree_base_donnee_2')]; |
|
| 60 | - $login = [$login_db, _T('entree_login_connexion_2')]; |
|
| 61 | - $pass = ['', _T('entree_mot_passe_2')]; |
|
| 59 | + $db = [$adresse_db, _T('entree_base_donnee_2')]; |
|
| 60 | + $login = [$login_db, _T('entree_login_connexion_2')]; |
|
| 61 | + $pass = ['', _T('entree_mot_passe_2')]; |
|
| 62 | 62 | |
| 63 | - $predef = [ |
|
| 64 | - defined('_INSTALL_SERVER_DB') ? _INSTALL_SERVER_DB : '', |
|
| 65 | - defined('_INSTALL_HOST_DB'), |
|
| 66 | - defined('_INSTALL_USER_DB'), |
|
| 67 | - defined('_INSTALL_PASS_DB') |
|
| 68 | - ]; |
|
| 63 | + $predef = [ |
|
| 64 | + defined('_INSTALL_SERVER_DB') ? _INSTALL_SERVER_DB : '', |
|
| 65 | + defined('_INSTALL_HOST_DB'), |
|
| 66 | + defined('_INSTALL_USER_DB'), |
|
| 67 | + defined('_INSTALL_PASS_DB') |
|
| 68 | + ]; |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - echo info_progression_etape(1, 'etape_', 'install/'); |
|
| 71 | + echo info_progression_etape(1, 'etape_', 'install/'); |
|
| 72 | 72 | |
| 73 | - // ces deux chaines de langues doivent etre reecrites |
|
| 73 | + // ces deux chaines de langues doivent etre reecrites |
|
| 74 | 74 | # echo info_etape(_T('info_connexion_mysql'), _T('texte_connexion_mysql').aide ("install1", true)); |
| 75 | - echo info_etape(_T('info_connexion_base_donnee')); |
|
| 76 | - echo install_connexion_form($db, $login, $pass, $predef, "\n<input type='hidden' name='chmod' value='$chmod' />", 2); |
|
| 77 | - echo $minipage->installFinPage(); |
|
| 75 | + echo info_etape(_T('info_connexion_base_donnee')); |
|
| 76 | + echo install_connexion_form($db, $login, $pass, $predef, "\n<input type='hidden' name='chmod' value='$chmod' />", 2); |
|
| 77 | + echo $minipage->installFinPage(); |
|
| 78 | 78 | } |
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | if (defined('_TEST_DIRS')) { |
| 17 | - return; |
|
| 17 | + return; |
|
| 18 | 18 | } |
| 19 | 19 | define('_TEST_DIRS', '1'); |
| 20 | 20 | |
@@ -26,38 +26,38 @@ discard block |
||
| 26 | 26 | // Tente d'ecrire |
| 27 | 27 | // |
| 28 | 28 | function test_ecrire($my_dir) { |
| 29 | - static $chmod = 0; |
|
| 30 | - |
|
| 31 | - $ok = false; |
|
| 32 | - $script = @file_exists('spip_loader.php') ? 'spip_loader.php' : $_SERVER['PHP_SELF']; |
|
| 33 | - $self = basename((string) $script); |
|
| 34 | - $uid = @fileowner('.'); |
|
| 35 | - $uid2 = @fileowner($self); |
|
| 36 | - $gid = @filegroup('.'); |
|
| 37 | - $gid2 = @filegroup($self); |
|
| 38 | - $perms = @fileperms($self); |
|
| 39 | - |
|
| 40 | - // Comparer l'appartenance d'un fichier cree par PHP |
|
| 41 | - // avec celle du script et du repertoire courant |
|
| 42 | - if (!$chmod) { |
|
| 43 | - @rmdir('test'); |
|
| 44 | - spip_unlink('test'); // effacer au cas ou |
|
| 45 | - @touch('test'); |
|
| 46 | - if ($uid > 0 && $uid == $uid2 && @fileowner('test') == $uid) { |
|
| 47 | - $chmod = 0700; |
|
| 48 | - } else { |
|
| 49 | - $chmod = $gid > 0 && $gid == $gid2 && @filegroup('test') == $gid ? 0770 : 0777; |
|
| 50 | - } |
|
| 51 | - // Appliquer de plus les droits d'acces du script |
|
| 52 | - if ($perms > 0) { |
|
| 53 | - $perms = ($perms & 0777) | (($perms & 0444) >> 2); |
|
| 54 | - $chmod |= $perms; |
|
| 55 | - } |
|
| 56 | - spip_unlink('test'); |
|
| 57 | - } |
|
| 58 | - $ok = is_dir($my_dir) && is_writable($my_dir); |
|
| 59 | - |
|
| 60 | - return $ok ? $chmod : false; |
|
| 29 | + static $chmod = 0; |
|
| 30 | + |
|
| 31 | + $ok = false; |
|
| 32 | + $script = @file_exists('spip_loader.php') ? 'spip_loader.php' : $_SERVER['PHP_SELF']; |
|
| 33 | + $self = basename((string) $script); |
|
| 34 | + $uid = @fileowner('.'); |
|
| 35 | + $uid2 = @fileowner($self); |
|
| 36 | + $gid = @filegroup('.'); |
|
| 37 | + $gid2 = @filegroup($self); |
|
| 38 | + $perms = @fileperms($self); |
|
| 39 | + |
|
| 40 | + // Comparer l'appartenance d'un fichier cree par PHP |
|
| 41 | + // avec celle du script et du repertoire courant |
|
| 42 | + if (!$chmod) { |
|
| 43 | + @rmdir('test'); |
|
| 44 | + spip_unlink('test'); // effacer au cas ou |
|
| 45 | + @touch('test'); |
|
| 46 | + if ($uid > 0 && $uid == $uid2 && @fileowner('test') == $uid) { |
|
| 47 | + $chmod = 0700; |
|
| 48 | + } else { |
|
| 49 | + $chmod = $gid > 0 && $gid == $gid2 && @filegroup('test') == $gid ? 0770 : 0777; |
|
| 50 | + } |
|
| 51 | + // Appliquer de plus les droits d'acces du script |
|
| 52 | + if ($perms > 0) { |
|
| 53 | + $perms = ($perms & 0777) | (($perms & 0444) >> 2); |
|
| 54 | + $chmod |= $perms; |
|
| 55 | + } |
|
| 56 | + spip_unlink('test'); |
|
| 57 | + } |
|
| 58 | + $ok = is_dir($my_dir) && is_writable($my_dir); |
|
| 59 | + |
|
| 60 | + return $ok ? $chmod : false; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // |
@@ -67,84 +67,84 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | function install_etape_chmod_dist() { |
| 69 | 69 | |
| 70 | - $continuer = null; |
|
| 71 | - $test_dir = _request('test_dir'); |
|
| 72 | - $chmod = 0; |
|
| 73 | - |
|
| 74 | - if ($test_dir && !str_contains((string) $test_dir, '..')) { |
|
| 75 | - if (!str_ends_with((string) $test_dir, '/')) { |
|
| 76 | - $test_dir .= '/'; |
|
| 77 | - } |
|
| 78 | - if (!in_array($test_dir, $GLOBALS['test_dirs'])) { |
|
| 79 | - $GLOBALS['test_dirs'][] = _DIR_RACINE . $test_dir; |
|
| 80 | - } |
|
| 81 | - } else { |
|
| 82 | - if (!_FILE_CONNECT) { |
|
| 83 | - $GLOBALS['test_dirs'][] = _DIR_CONNECT; |
|
| 84 | - $GLOBALS['test_dirs'][] = _DIR_CHMOD; |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - $bad_dirs = []; |
|
| 89 | - $absent_dirs = []; |
|
| 90 | - |
|
| 91 | - foreach ($GLOBALS['test_dirs'] as $i => $my_dir) { |
|
| 92 | - $test = test_ecrire($my_dir); |
|
| 93 | - if (!$test) { |
|
| 94 | - $m = preg_replace(',^' . _DIR_RACINE . ',', '', (string) $my_dir); |
|
| 95 | - if (@file_exists($my_dir)) { |
|
| 96 | - $bad_dirs['<li>' . $m . '</li>'] = 1; |
|
| 97 | - } else { |
|
| 98 | - $absent_dirs['<li>' . $m . '</li>'] = 1; |
|
| 99 | - } |
|
| 100 | - } else { |
|
| 101 | - $chmod = max($chmod, $test); |
|
| 102 | - } |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - if ($bad_dirs || $absent_dirs) { |
|
| 106 | - if (!_FILE_CONNECT) { |
|
| 107 | - $titre = _T('dirs_preliminaire'); |
|
| 108 | - $continuer = ' ' . _T('dirs_commencer') . '.'; |
|
| 109 | - } else { |
|
| 110 | - $titre = _T('dirs_probleme_droits'); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - |
|
| 114 | - $res = "<div align='right'>" . menu_langues('var_lang_ecrire') . "</div>\n"; |
|
| 115 | - |
|
| 116 | - if ($bad_dirs) { |
|
| 117 | - $res .= |
|
| 118 | - _T( |
|
| 119 | - 'dirs_repertoires_suivants', |
|
| 120 | - ['bad_dirs' => implode("\n", array_keys($bad_dirs))] |
|
| 121 | - ) . |
|
| 122 | - '<b>' . _T('login_recharger') . '</b>.'; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - if ($absent_dirs) { |
|
| 126 | - $res .= |
|
| 127 | - _T( |
|
| 128 | - 'dirs_repertoires_absents', |
|
| 129 | - ['bad_dirs' => implode("\n", array_keys($absent_dirs))] |
|
| 130 | - ) . |
|
| 131 | - '<b>' . _T('login_recharger') . '</b>.'; |
|
| 132 | - } |
|
| 133 | - $res = '<p>' . $continuer . $res . aider('install0', true) . '</p>'; |
|
| 134 | - |
|
| 135 | - $t = _T('login_recharger'); |
|
| 136 | - $t = ($test_dir ? "<input type='hidden' name='test_dir' value='" . spip_htmlspecialchars($test_dir, ENT_QUOTES) . "' />" : |
|
| 137 | - '') |
|
| 138 | - . "<input type='hidden' name='etape' value='chmod' />" |
|
| 139 | - . "<div style='text-align: right'><input type='submit' value='" . attribut_html($t) . "' /></div>"; |
|
| 140 | - |
|
| 141 | - echo minipres($titre, $res . generer_form_ecrire('install', $t)); |
|
| 142 | - } else { |
|
| 143 | - $deja = (_FILE_CONNECT && analyse_fichier_connection(_FILE_CONNECT)); |
|
| 144 | - if (!$deja) { |
|
| 145 | - redirige_url_ecrire('install', 'etape=1&chmod=' . $chmod); |
|
| 146 | - } else { |
|
| 147 | - redirige_url_ecrire(); |
|
| 148 | - } |
|
| 149 | - } |
|
| 70 | + $continuer = null; |
|
| 71 | + $test_dir = _request('test_dir'); |
|
| 72 | + $chmod = 0; |
|
| 73 | + |
|
| 74 | + if ($test_dir && !str_contains((string) $test_dir, '..')) { |
|
| 75 | + if (!str_ends_with((string) $test_dir, '/')) { |
|
| 76 | + $test_dir .= '/'; |
|
| 77 | + } |
|
| 78 | + if (!in_array($test_dir, $GLOBALS['test_dirs'])) { |
|
| 79 | + $GLOBALS['test_dirs'][] = _DIR_RACINE . $test_dir; |
|
| 80 | + } |
|
| 81 | + } else { |
|
| 82 | + if (!_FILE_CONNECT) { |
|
| 83 | + $GLOBALS['test_dirs'][] = _DIR_CONNECT; |
|
| 84 | + $GLOBALS['test_dirs'][] = _DIR_CHMOD; |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + $bad_dirs = []; |
|
| 89 | + $absent_dirs = []; |
|
| 90 | + |
|
| 91 | + foreach ($GLOBALS['test_dirs'] as $i => $my_dir) { |
|
| 92 | + $test = test_ecrire($my_dir); |
|
| 93 | + if (!$test) { |
|
| 94 | + $m = preg_replace(',^' . _DIR_RACINE . ',', '', (string) $my_dir); |
|
| 95 | + if (@file_exists($my_dir)) { |
|
| 96 | + $bad_dirs['<li>' . $m . '</li>'] = 1; |
|
| 97 | + } else { |
|
| 98 | + $absent_dirs['<li>' . $m . '</li>'] = 1; |
|
| 99 | + } |
|
| 100 | + } else { |
|
| 101 | + $chmod = max($chmod, $test); |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + if ($bad_dirs || $absent_dirs) { |
|
| 106 | + if (!_FILE_CONNECT) { |
|
| 107 | + $titre = _T('dirs_preliminaire'); |
|
| 108 | + $continuer = ' ' . _T('dirs_commencer') . '.'; |
|
| 109 | + } else { |
|
| 110 | + $titre = _T('dirs_probleme_droits'); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + |
|
| 114 | + $res = "<div align='right'>" . menu_langues('var_lang_ecrire') . "</div>\n"; |
|
| 115 | + |
|
| 116 | + if ($bad_dirs) { |
|
| 117 | + $res .= |
|
| 118 | + _T( |
|
| 119 | + 'dirs_repertoires_suivants', |
|
| 120 | + ['bad_dirs' => implode("\n", array_keys($bad_dirs))] |
|
| 121 | + ) . |
|
| 122 | + '<b>' . _T('login_recharger') . '</b>.'; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + if ($absent_dirs) { |
|
| 126 | + $res .= |
|
| 127 | + _T( |
|
| 128 | + 'dirs_repertoires_absents', |
|
| 129 | + ['bad_dirs' => implode("\n", array_keys($absent_dirs))] |
|
| 130 | + ) . |
|
| 131 | + '<b>' . _T('login_recharger') . '</b>.'; |
|
| 132 | + } |
|
| 133 | + $res = '<p>' . $continuer . $res . aider('install0', true) . '</p>'; |
|
| 134 | + |
|
| 135 | + $t = _T('login_recharger'); |
|
| 136 | + $t = ($test_dir ? "<input type='hidden' name='test_dir' value='" . spip_htmlspecialchars($test_dir, ENT_QUOTES) . "' />" : |
|
| 137 | + '') |
|
| 138 | + . "<input type='hidden' name='etape' value='chmod' />" |
|
| 139 | + . "<div style='text-align: right'><input type='submit' value='" . attribut_html($t) . "' /></div>"; |
|
| 140 | + |
|
| 141 | + echo minipres($titre, $res . generer_form_ecrire('install', $t)); |
|
| 142 | + } else { |
|
| 143 | + $deja = (_FILE_CONNECT && analyse_fichier_connection(_FILE_CONNECT)); |
|
| 144 | + if (!$deja) { |
|
| 145 | + redirige_url_ecrire('install', 'etape=1&chmod=' . $chmod); |
|
| 146 | + } else { |
|
| 147 | + redirige_url_ecrire(); |
|
| 148 | + } |
|
| 149 | + } |
|
| 150 | 150 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $test_dir .= '/'; |
| 77 | 77 | } |
| 78 | 78 | if (!in_array($test_dir, $GLOBALS['test_dirs'])) { |
| 79 | - $GLOBALS['test_dirs'][] = _DIR_RACINE . $test_dir; |
|
| 79 | + $GLOBALS['test_dirs'][] = _DIR_RACINE.$test_dir; |
|
| 80 | 80 | } |
| 81 | 81 | } else { |
| 82 | 82 | if (!_FILE_CONNECT) { |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | foreach ($GLOBALS['test_dirs'] as $i => $my_dir) { |
| 92 | 92 | $test = test_ecrire($my_dir); |
| 93 | 93 | if (!$test) { |
| 94 | - $m = preg_replace(',^' . _DIR_RACINE . ',', '', (string) $my_dir); |
|
| 94 | + $m = preg_replace(',^'._DIR_RACINE.',', '', (string) $my_dir); |
|
| 95 | 95 | if (@file_exists($my_dir)) { |
| 96 | - $bad_dirs['<li>' . $m . '</li>'] = 1; |
|
| 96 | + $bad_dirs['<li>'.$m.'</li>'] = 1; |
|
| 97 | 97 | } else { |
| 98 | - $absent_dirs['<li>' . $m . '</li>'] = 1; |
|
| 98 | + $absent_dirs['<li>'.$m.'</li>'] = 1; |
|
| 99 | 99 | } |
| 100 | 100 | } else { |
| 101 | 101 | $chmod = max($chmod, $test); |
@@ -105,21 +105,21 @@ discard block |
||
| 105 | 105 | if ($bad_dirs || $absent_dirs) { |
| 106 | 106 | if (!_FILE_CONNECT) { |
| 107 | 107 | $titre = _T('dirs_preliminaire'); |
| 108 | - $continuer = ' ' . _T('dirs_commencer') . '.'; |
|
| 108 | + $continuer = ' '._T('dirs_commencer').'.'; |
|
| 109 | 109 | } else { |
| 110 | 110 | $titre = _T('dirs_probleme_droits'); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | |
| 114 | - $res = "<div align='right'>" . menu_langues('var_lang_ecrire') . "</div>\n"; |
|
| 114 | + $res = "<div align='right'>".menu_langues('var_lang_ecrire')."</div>\n"; |
|
| 115 | 115 | |
| 116 | 116 | if ($bad_dirs) { |
| 117 | 117 | $res .= |
| 118 | 118 | _T( |
| 119 | 119 | 'dirs_repertoires_suivants', |
| 120 | 120 | ['bad_dirs' => implode("\n", array_keys($bad_dirs))] |
| 121 | - ) . |
|
| 122 | - '<b>' . _T('login_recharger') . '</b>.'; |
|
| 121 | + ). |
|
| 122 | + '<b>'._T('login_recharger').'</b>.'; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if ($absent_dirs) { |
@@ -127,22 +127,21 @@ discard block |
||
| 127 | 127 | _T( |
| 128 | 128 | 'dirs_repertoires_absents', |
| 129 | 129 | ['bad_dirs' => implode("\n", array_keys($absent_dirs))] |
| 130 | - ) . |
|
| 131 | - '<b>' . _T('login_recharger') . '</b>.'; |
|
| 130 | + ). |
|
| 131 | + '<b>'._T('login_recharger').'</b>.'; |
|
| 132 | 132 | } |
| 133 | - $res = '<p>' . $continuer . $res . aider('install0', true) . '</p>'; |
|
| 133 | + $res = '<p>'.$continuer.$res.aider('install0', true).'</p>'; |
|
| 134 | 134 | |
| 135 | 135 | $t = _T('login_recharger'); |
| 136 | - $t = ($test_dir ? "<input type='hidden' name='test_dir' value='" . spip_htmlspecialchars($test_dir, ENT_QUOTES) . "' />" : |
|
| 137 | - '') |
|
| 136 | + $t = ($test_dir ? "<input type='hidden' name='test_dir' value='".spip_htmlspecialchars($test_dir, ENT_QUOTES)."' />" : '') |
|
| 138 | 137 | . "<input type='hidden' name='etape' value='chmod' />" |
| 139 | - . "<div style='text-align: right'><input type='submit' value='" . attribut_html($t) . "' /></div>"; |
|
| 138 | + . "<div style='text-align: right'><input type='submit' value='".attribut_html($t)."' /></div>"; |
|
| 140 | 139 | |
| 141 | - echo minipres($titre, $res . generer_form_ecrire('install', $t)); |
|
| 140 | + echo minipres($titre, $res.generer_form_ecrire('install', $t)); |
|
| 142 | 141 | } else { |
| 143 | 142 | $deja = (_FILE_CONNECT && analyse_fichier_connection(_FILE_CONNECT)); |
| 144 | 143 | if (!$deja) { |
| 145 | - redirige_url_ecrire('install', 'etape=1&chmod=' . $chmod); |
|
| 144 | + redirige_url_ecrire('install', 'etape=1&chmod='.$chmod); |
|
| 146 | 145 | } else { |
| 147 | 146 | redirige_url_ecrire(); |
| 148 | 147 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | include_spip('inc/headers'); |
@@ -19,61 +19,61 @@ discard block |
||
| 19 | 19 | // Mise en place des fichiers de configuration si ce n'est fait |
| 20 | 20 | |
| 21 | 21 | function install_etape_fin_dist() { |
| 22 | - ecrire_acces(); |
|
| 22 | + ecrire_acces(); |
|
| 23 | 23 | |
| 24 | - $f = str_replace(_FILE_TMP_SUFFIX, '.php', (string) _FILE_CHMOD_TMP); |
|
| 25 | - if (file_exists(_FILE_CHMOD_TMP) && !@rename(_FILE_CHMOD_TMP, $f) && @copy(_FILE_CHMOD_TMP, $f)) { |
|
| 26 | - spip_unlink(_FILE_CHMOD_TMP); |
|
| 27 | - } |
|
| 24 | + $f = str_replace(_FILE_TMP_SUFFIX, '.php', (string) _FILE_CHMOD_TMP); |
|
| 25 | + if (file_exists(_FILE_CHMOD_TMP) && !@rename(_FILE_CHMOD_TMP, $f) && @copy(_FILE_CHMOD_TMP, $f)) { |
|
| 26 | + spip_unlink(_FILE_CHMOD_TMP); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - $f = str_replace(_FILE_TMP_SUFFIX, '.php', (string) _FILE_CONNECT_TMP); |
|
| 30 | - if (file_exists(_FILE_CONNECT_TMP)) { |
|
| 31 | - spip_log("renomme $f"); |
|
| 32 | - if (!@rename(_FILE_CONNECT_TMP, $f) && @copy(_FILE_CONNECT_TMP, $f)) { |
|
| 33 | - @spip_unlink(_FILE_CONNECT_TMP); |
|
| 34 | - } |
|
| 35 | - } |
|
| 29 | + $f = str_replace(_FILE_TMP_SUFFIX, '.php', (string) _FILE_CONNECT_TMP); |
|
| 30 | + if (file_exists(_FILE_CONNECT_TMP)) { |
|
| 31 | + spip_log("renomme $f"); |
|
| 32 | + if (!@rename(_FILE_CONNECT_TMP, $f) && @copy(_FILE_CONNECT_TMP, $f)) { |
|
| 33 | + @spip_unlink(_FILE_CONNECT_TMP); |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - // creer le repertoire cache, qui sert partout ! |
|
| 38 | - // deja fait en etape 4 en principe, on garde au cas ou |
|
| 39 | - if (!@file_exists(_DIR_CACHE)) { |
|
| 40 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 41 | - $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 42 | - } |
|
| 37 | + // creer le repertoire cache, qui sert partout ! |
|
| 38 | + // deja fait en etape 4 en principe, on garde au cas ou |
|
| 39 | + if (!@file_exists(_DIR_CACHE)) { |
|
| 40 | + $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 41 | + $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - // Verifier la securite des htaccess |
|
| 45 | - // Si elle ne fonctionne pas, prevenir |
|
| 46 | - $msg = install_verifier_htaccess(); |
|
| 47 | - if ($msg) { |
|
| 48 | - $cible = _T('public:accueil_site'); |
|
| 49 | - $cible = generer_form_ecrire('accueil', '', '', $cible); |
|
| 50 | - $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 51 | - echo $minipage->page($msg . $cible); |
|
| 52 | - // ok, deboucher dans l'espace prive |
|
| 53 | - } else { |
|
| 54 | - redirige_url_ecrire('accueil'); |
|
| 55 | - } |
|
| 44 | + // Verifier la securite des htaccess |
|
| 45 | + // Si elle ne fonctionne pas, prevenir |
|
| 46 | + $msg = install_verifier_htaccess(); |
|
| 47 | + if ($msg) { |
|
| 48 | + $cible = _T('public:accueil_site'); |
|
| 49 | + $cible = generer_form_ecrire('accueil', '', '', $cible); |
|
| 50 | + $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 51 | + echo $minipage->page($msg . $cible); |
|
| 52 | + // ok, deboucher dans l'espace prive |
|
| 53 | + } else { |
|
| 54 | + redirige_url_ecrire('accueil'); |
|
| 55 | + } |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | function install_verifier_htaccess() { |
| 59 | - if ( |
|
| 60 | - verifier_htaccess(_DIR_TMP, true) |
|
| 61 | - && verifier_htaccess(_DIR_CONNECT, true) |
|
| 62 | - && verifier_htaccess(_DIR_VENDOR, true) |
|
| 63 | - ) { |
|
| 64 | - return ''; |
|
| 65 | - } |
|
| 59 | + if ( |
|
| 60 | + verifier_htaccess(_DIR_TMP, true) |
|
| 61 | + && verifier_htaccess(_DIR_CONNECT, true) |
|
| 62 | + && verifier_htaccess(_DIR_VENDOR, true) |
|
| 63 | + ) { |
|
| 64 | + return ''; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - $titre = _T('htaccess_inoperant'); |
|
| 67 | + $titre = _T('htaccess_inoperant'); |
|
| 68 | 68 | |
| 69 | - $averti = _T( |
|
| 70 | - 'htaccess_a_simuler', |
|
| 71 | - [ |
|
| 72 | - 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 73 | - 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
|
| 74 | - 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 75 | - ] |
|
| 76 | - ); |
|
| 69 | + $averti = _T( |
|
| 70 | + 'htaccess_a_simuler', |
|
| 71 | + [ |
|
| 72 | + 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 73 | + 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
|
| 74 | + 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 75 | + ] |
|
| 76 | + ); |
|
| 77 | 77 | |
| 78 | - return "<div class='error'><h3>$titre</h3><p>$averti</p></div>"; |
|
| 78 | + return "<div class='error'><h3>$titre</h3><p>$averti</p></div>"; |
|
| 79 | 79 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | // creer le repertoire cache, qui sert partout ! |
| 38 | 38 | // deja fait en etape 4 en principe, on garde au cas ou |
| 39 | 39 | if (!@file_exists(_DIR_CACHE)) { |
| 40 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 40 | + $rep = preg_replace(','._DIR_TMP.',', '', (string) _DIR_CACHE); |
|
| 41 | 41 | $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $cible = _T('public:accueil_site'); |
| 49 | 49 | $cible = generer_form_ecrire('accueil', '', '', $cible); |
| 50 | 50 | $minipage = new Spip\Afficher\Minipage\Installation(); |
| 51 | - echo $minipage->page($msg . $cible); |
|
| 51 | + echo $minipage->page($msg.$cible); |
|
| 52 | 52 | // ok, deboucher dans l'espace prive |
| 53 | 53 | } else { |
| 54 | 54 | redirige_url_ecrire('accueil'); |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | $averti = _T( |
| 70 | 70 | 'htaccess_a_simuler', |
| 71 | 71 | [ |
| 72 | - 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 72 | + 'htaccess' => '<tt>'._ACCESS_FILE_NAME.'</tt>', |
|
| 73 | 73 | 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
| 74 | - 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 74 | + 'document_root' => '<tt>'.$_SERVER['DOCUMENT_ROOT'].'</tt>' |
|
| 75 | 75 | ] |
| 76 | 76 | ); |
| 77 | 77 | |
@@ -10,85 +10,85 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | include_spip('inc/headers'); |
| 16 | 16 | include_spip('auth/ldap'); |
| 17 | 17 | |
| 18 | 18 | function install_etape_ldap5_dist() { |
| 19 | - etape_ldap5_save(); |
|
| 20 | - etape_ldap5_suite(); |
|
| 19 | + etape_ldap5_save(); |
|
| 20 | + etape_ldap5_suite(); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | function etape_ldap5_save() { |
| 24 | - $conn = null; |
|
| 25 | - if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 26 | - redirige_url_ecrire('install'); |
|
| 27 | - } |
|
| 24 | + $conn = null; |
|
| 25 | + if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 26 | + redirige_url_ecrire('install'); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - ecrire_meta('ldap_statut_import', _request('statut_ldap')); |
|
| 29 | + ecrire_meta('ldap_statut_import', _request('statut_ldap')); |
|
| 30 | 30 | |
| 31 | - lire_fichier(_FILE_CONNECT_TMP, $conn); |
|
| 31 | + lire_fichier(_FILE_CONNECT_TMP, $conn); |
|
| 32 | 32 | |
| 33 | - if ($p = strpos((string) $conn, "'');")) { |
|
| 34 | - ecrire_fichier( |
|
| 35 | - _FILE_CONNECT_TMP, |
|
| 36 | - substr((string) $conn, 0, $p + 1) |
|
| 37 | - . _FILE_LDAP |
|
| 38 | - . substr((string) $conn, $p + 1) |
|
| 39 | - ); |
|
| 40 | - } |
|
| 33 | + if ($p = strpos((string) $conn, "'');")) { |
|
| 34 | + ecrire_fichier( |
|
| 35 | + _FILE_CONNECT_TMP, |
|
| 36 | + substr((string) $conn, 0, $p + 1) |
|
| 37 | + . _FILE_LDAP |
|
| 38 | + . substr((string) $conn, $p + 1) |
|
| 39 | + ); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $adresse_ldap = addcslashes((string) _request('adresse_ldap'), "'\\"); |
|
| 43 | - $login_ldap = addcslashes((string) _request('login_ldap'), "'\\"); |
|
| 44 | - $pass_ldap = addcslashes((string) _request('pass_ldap'), "'\\"); |
|
| 45 | - $port_ldap = addcslashes((string) _request('port_ldap'), "'\\"); |
|
| 46 | - $tls_ldap = addcslashes((string) _request('tls_ldap'), "'\\"); |
|
| 47 | - $protocole_ldap = addcslashes((string) _request('protocole_ldap'), "'\\"); |
|
| 48 | - $base_ldap = addcslashes((string) _request('base_ldap'), "'\\"); |
|
| 49 | - $base_ldap_text = addcslashes((string) _request('base_ldap_text'), "'\\"); |
|
| 42 | + $adresse_ldap = addcslashes((string) _request('adresse_ldap'), "'\\"); |
|
| 43 | + $login_ldap = addcslashes((string) _request('login_ldap'), "'\\"); |
|
| 44 | + $pass_ldap = addcslashes((string) _request('pass_ldap'), "'\\"); |
|
| 45 | + $port_ldap = addcslashes((string) _request('port_ldap'), "'\\"); |
|
| 46 | + $tls_ldap = addcslashes((string) _request('tls_ldap'), "'\\"); |
|
| 47 | + $protocole_ldap = addcslashes((string) _request('protocole_ldap'), "'\\"); |
|
| 48 | + $base_ldap = addcslashes((string) _request('base_ldap'), "'\\"); |
|
| 49 | + $base_ldap_text = addcslashes((string) _request('base_ldap_text'), "'\\"); |
|
| 50 | 50 | |
| 51 | - $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
|
| 52 | - . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
|
| 53 | - . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
|
| 54 | - . (($tls_ldap != 'oui') ? '' : |
|
| 55 | - "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 56 | - . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
|
| 51 | + $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
|
| 52 | + . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
|
| 53 | + . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
|
| 54 | + . (($tls_ldap != 'oui') ? '' : |
|
| 55 | + "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 56 | + . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
|
| 57 | 57 | |
| 58 | - $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
|
| 59 | - $res = ''; |
|
| 60 | - foreach (array_keys($champs) as $champ) { |
|
| 61 | - $nom = 'ldap_' . $champ; |
|
| 62 | - $val = trim((string) _request($nom)); |
|
| 63 | - if (preg_match('/^\w*$/', $val)) { |
|
| 64 | - if ($val) { |
|
| 65 | - $val = _q($val); |
|
| 66 | - } |
|
| 67 | - } else { |
|
| 68 | - $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 69 | - }; |
|
| 70 | - if ($val) { |
|
| 71 | - $res .= "'$champ' => " . $val . ','; |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
|
| 58 | + $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
|
| 59 | + $res = ''; |
|
| 60 | + foreach (array_keys($champs) as $champ) { |
|
| 61 | + $nom = 'ldap_' . $champ; |
|
| 62 | + $val = trim((string) _request($nom)); |
|
| 63 | + if (preg_match('/^\w*$/', $val)) { |
|
| 64 | + if ($val) { |
|
| 65 | + $val = _q($val); |
|
| 66 | + } |
|
| 67 | + } else { |
|
| 68 | + $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 69 | + }; |
|
| 70 | + if ($val) { |
|
| 71 | + $res .= "'$champ' => " . $val . ','; |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
|
| 75 | 75 | |
| 76 | - install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 76 | + install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | function etape_ldap5_suite() { |
| 80 | - $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 81 | - echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 80 | + $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 81 | + echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 82 | 82 | |
| 83 | - echo info_etape( |
|
| 84 | - _T('info_ldap_ok'), |
|
| 85 | - info_progression_etape(5, 'etape_ldap', 'install/') |
|
| 86 | - ); |
|
| 83 | + echo info_etape( |
|
| 84 | + _T('info_ldap_ok'), |
|
| 85 | + info_progression_etape(5, 'etape_ldap', 'install/') |
|
| 86 | + ); |
|
| 87 | 87 | |
| 88 | - echo generer_form_ecrire('install', ( |
|
| 89 | - "<input type='hidden' name='etape' value='3' />" . |
|
| 90 | - "<input type='hidden' name='ldap_present' value='true' />" |
|
| 91 | - . bouton_suivant())); |
|
| 88 | + echo generer_form_ecrire('install', ( |
|
| 89 | + "<input type='hidden' name='etape' value='3' />" . |
|
| 90 | + "<input type='hidden' name='ldap_present' value='true' />" |
|
| 91 | + . bouton_suivant())); |
|
| 92 | 92 | |
| 93 | - echo $minipage->installFinPage(); |
|
| 93 | + echo $minipage->installFinPage(); |
|
| 94 | 94 | } |
@@ -51,29 +51,28 @@ discard block |
||
| 51 | 51 | $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
| 52 | 52 | . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
| 53 | 53 | . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
| 54 | - . (($tls_ldap != 'oui') ? '' : |
|
| 55 | - "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 54 | + . (($tls_ldap != 'oui') ? '' : "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 56 | 55 | . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
| 57 | 56 | |
| 58 | 57 | $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
| 59 | 58 | $res = ''; |
| 60 | 59 | foreach (array_keys($champs) as $champ) { |
| 61 | - $nom = 'ldap_' . $champ; |
|
| 60 | + $nom = 'ldap_'.$champ; |
|
| 62 | 61 | $val = trim((string) _request($nom)); |
| 63 | 62 | if (preg_match('/^\w*$/', $val)) { |
| 64 | 63 | if ($val) { |
| 65 | 64 | $val = _q($val); |
| 66 | 65 | } |
| 67 | 66 | } else { |
| 68 | - $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 67 | + $val = 'array('._q(preg_split('/\W+/', $val)).')'; |
|
| 69 | 68 | }; |
| 70 | 69 | if ($val) { |
| 71 | - $res .= "'$champ' => " . $val . ','; |
|
| 70 | + $res .= "'$champ' => ".$val.','; |
|
| 72 | 71 | } |
| 73 | 72 | } |
| 74 | 73 | $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
| 75 | 74 | |
| 76 | - install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 75 | + install_fichier_connexion(_DIR_CONNECT._FILE_LDAP, $conn); |
|
| 77 | 76 | } |
| 78 | 77 | |
| 79 | 78 | function etape_ldap5_suite() { |
@@ -86,7 +85,7 @@ discard block |
||
| 86 | 85 | ); |
| 87 | 86 | |
| 88 | 87 | echo generer_form_ecrire('install', ( |
| 89 | - "<input type='hidden' name='etape' value='3' />" . |
|
| 88 | + "<input type='hidden' name='etape' value='3' />". |
|
| 90 | 89 | "<input type='hidden' name='ldap_present' value='true' />" |
| 91 | 90 | . bouton_suivant())); |
| 92 | 91 | |
@@ -10,167 +10,167 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | include_spip('inc/headers'); |
| 17 | 17 | |
| 18 | 18 | function install_etape_3b_dist() { |
| 19 | - $auth_spip = null; |
|
| 20 | - $session = null; |
|
| 21 | - $row = null; |
|
| 22 | - $login = _request('login'); |
|
| 23 | - $email = _request('email'); |
|
| 24 | - $nom = _request('nom'); |
|
| 25 | - $pass = _request('pass'); |
|
| 26 | - $pass_verif = _request('pass_verif'); |
|
| 27 | - |
|
| 28 | - $server_db = defined('_INSTALL_SERVER_DB') |
|
| 29 | - ? _INSTALL_SERVER_DB |
|
| 30 | - : _request('server_db'); |
|
| 31 | - |
|
| 32 | - if (!defined('_PASS_LONGUEUR_MINI')) { |
|
| 33 | - define('_PASS_LONGUEUR_MINI', 6); |
|
| 34 | - } |
|
| 35 | - if (!defined('_LOGIN_TROP_COURT')) { |
|
| 36 | - define('_LOGIN_TROP_COURT', 4); |
|
| 37 | - } |
|
| 38 | - if ($login) { |
|
| 39 | - $echec = ($pass != $pass_verif) ? |
|
| 40 | - _T('info_passes_identiques') |
|
| 41 | - : ((strlen((string) $pass) < _PASS_LONGUEUR_MINI) ? |
|
| 42 | - _T('info_passe_trop_court_car_pluriel', ['nb' => _PASS_LONGUEUR_MINI]) |
|
| 43 | - : ((strlen((string) $login) < _LOGIN_TROP_COURT) ? |
|
| 44 | - _T('info_login_trop_court') |
|
| 45 | - : '')); |
|
| 46 | - include_spip('inc/filtres'); |
|
| 47 | - if (!$echec && $email && !email_valide($email)) { |
|
| 48 | - $echec = _T('form_email_non_valide'); |
|
| 49 | - } |
|
| 50 | - if ($echec) { |
|
| 51 | - echouer_etape_3b($echec); |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - if (@file_exists(_FILE_CHMOD_TMP)) { |
|
| 56 | - include(_FILE_CHMOD_TMP); |
|
| 57 | - } else { |
|
| 58 | - redirige_url_ecrire('install'); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 62 | - redirige_url_ecrire('install'); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - # maintenant on connait le vrai charset du site s'il est deja configure |
|
| 66 | - # sinon par defaut lire_meta reglera _DEFAULT_CHARSET |
|
| 67 | - # (les donnees arrivent de toute facon postees en _DEFAULT_CHARSET) |
|
| 68 | - |
|
| 69 | - lire_metas(); |
|
| 70 | - if ($login) { |
|
| 71 | - include_spip('inc/charsets'); |
|
| 72 | - |
|
| 73 | - $nom = (importer_charset($nom, _DEFAULT_CHARSET)); |
|
| 74 | - $login = (importer_charset($login, _DEFAULT_CHARSET)); |
|
| 75 | - $email = (importer_charset($email, _DEFAULT_CHARSET)); |
|
| 76 | - |
|
| 77 | - include_spip('auth/spip'); |
|
| 78 | - // prelablement, creer le champ webmestre si il n'existe pas (install neuve |
|
| 79 | - // sur une vieille base |
|
| 80 | - $t = sql_showtable('spip_auteurs', true); |
|
| 81 | - if (!isset($t['field']['webmestre'])) { |
|
| 82 | - @sql_alter("TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - // il faut avoir une cle des auth valide pour creer un nouvel auteur webmestre |
|
| 86 | - $cles = \Spip\Chiffrer\SpipCles::instance(); |
|
| 87 | - $secret = $cles->getSecretAuth(); |
|
| 88 | - |
|
| 89 | - $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 90 | - if ($id_auteur !== null) { |
|
| 91 | - // c'est un auteur connu : si on a pas de secret il faut absolument qu'il se reconnecte avec le meme mot de passe |
|
| 92 | - // pour restaurer la copie des cles |
|
| 93 | - if (!$secret && !auth_spip_initialiser_secret()) { |
|
| 94 | - $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur=' . (int) $id_auteur); |
|
| 95 | - if (empty($row['backup_cles']) || !$cles->restore($row['backup_cles'], $pass, $row['pass'], $id_auteur)) { |
|
| 96 | - $echec = _T('avis_connexion_erreur_fichier_cle_manquant_1'); |
|
| 97 | - echouer_etape_3b($echec); |
|
| 98 | - } |
|
| 99 | - spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth' . _LOG_INFO_IMPORTANTE); |
|
| 100 | - $cles->save(); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - sql_updateq('spip_auteurs', [ |
|
| 104 | - 'nom' => $nom, |
|
| 105 | - 'email' => $email, |
|
| 106 | - 'login' => $login, |
|
| 107 | - 'statut' => '0minirezo' |
|
| 108 | - ], 'id_auteur=' . (int) $id_auteur); |
|
| 109 | - // le passer webmestre separement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 110 | - @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 111 | - if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
|
| 112 | - $echec = _T('avis_erreur_creation_compte'); |
|
| 113 | - echouer_etape_3b($echec); |
|
| 114 | - } |
|
| 115 | - } else { |
|
| 116 | - // Si on a pas de cle et qu'on ne sait pas la creer, on ne peut pas creer de nouveau compte : |
|
| 117 | - // il faut qu'un webmestre avec un backup fasse l'install |
|
| 118 | - if (!$secret && !auth_spip_initialiser_secret()) { |
|
| 119 | - $echec = _T('avis_connexion_erreur_fichier_cle_manquant_2'); |
|
| 120 | - echouer_etape_3b($echec); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - $id_auteur = sql_insertq('spip_auteurs', [ |
|
| 124 | - 'nom' => $nom, |
|
| 125 | - 'email' => $email, |
|
| 126 | - 'login' => $login, |
|
| 127 | - 'statut' => '0minirezo' |
|
| 128 | - ]); |
|
| 129 | - // le passer webmestre separrement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 130 | - @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 131 | - if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
|
| 132 | - $echec = _T('avis_erreur_creation_compte'); |
|
| 133 | - echouer_etape_3b($echec); |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - // inserer email comme email webmaster principal |
|
| 138 | - // (sauf s'il est vide: cas de la re-installation) |
|
| 139 | - if ($email) { |
|
| 140 | - ecrire_meta('email_webmaster', $email); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - // Connecter directement celui qui vient de (re)donner son login |
|
| 144 | - // mais sans cookie d'admin ni connexion longue |
|
| 145 | - include_spip('inc/auth'); |
|
| 146 | - $auteur = auth_identifier_login($login, $pass); |
|
| 147 | - if (!$auteur || !auth_loger($auteur)) { |
|
| 148 | - spip_log("login automatique impossible $auth_spip $session" . (is_countable($row) ? count($row) : 0)); |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - // installer les metas |
|
| 153 | - $config = charger_fonction('config', 'inc'); |
|
| 154 | - $config(); |
|
| 155 | - |
|
| 156 | - // activer les plugins |
|
| 157 | - // leur installation ne peut pas se faire sur le meme hit, il faudra donc |
|
| 158 | - // poursuivre au hit suivant |
|
| 159 | - include_spip('inc/plugin'); |
|
| 160 | - actualise_plugins_actifs(); |
|
| 161 | - |
|
| 162 | - |
|
| 163 | - include_spip('inc/distant'); |
|
| 164 | - redirige_par_entete(parametre_url(self(), 'etape', '4', '&')); |
|
| 19 | + $auth_spip = null; |
|
| 20 | + $session = null; |
|
| 21 | + $row = null; |
|
| 22 | + $login = _request('login'); |
|
| 23 | + $email = _request('email'); |
|
| 24 | + $nom = _request('nom'); |
|
| 25 | + $pass = _request('pass'); |
|
| 26 | + $pass_verif = _request('pass_verif'); |
|
| 27 | + |
|
| 28 | + $server_db = defined('_INSTALL_SERVER_DB') |
|
| 29 | + ? _INSTALL_SERVER_DB |
|
| 30 | + : _request('server_db'); |
|
| 31 | + |
|
| 32 | + if (!defined('_PASS_LONGUEUR_MINI')) { |
|
| 33 | + define('_PASS_LONGUEUR_MINI', 6); |
|
| 34 | + } |
|
| 35 | + if (!defined('_LOGIN_TROP_COURT')) { |
|
| 36 | + define('_LOGIN_TROP_COURT', 4); |
|
| 37 | + } |
|
| 38 | + if ($login) { |
|
| 39 | + $echec = ($pass != $pass_verif) ? |
|
| 40 | + _T('info_passes_identiques') |
|
| 41 | + : ((strlen((string) $pass) < _PASS_LONGUEUR_MINI) ? |
|
| 42 | + _T('info_passe_trop_court_car_pluriel', ['nb' => _PASS_LONGUEUR_MINI]) |
|
| 43 | + : ((strlen((string) $login) < _LOGIN_TROP_COURT) ? |
|
| 44 | + _T('info_login_trop_court') |
|
| 45 | + : '')); |
|
| 46 | + include_spip('inc/filtres'); |
|
| 47 | + if (!$echec && $email && !email_valide($email)) { |
|
| 48 | + $echec = _T('form_email_non_valide'); |
|
| 49 | + } |
|
| 50 | + if ($echec) { |
|
| 51 | + echouer_etape_3b($echec); |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + if (@file_exists(_FILE_CHMOD_TMP)) { |
|
| 56 | + include(_FILE_CHMOD_TMP); |
|
| 57 | + } else { |
|
| 58 | + redirige_url_ecrire('install'); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 62 | + redirige_url_ecrire('install'); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + # maintenant on connait le vrai charset du site s'il est deja configure |
|
| 66 | + # sinon par defaut lire_meta reglera _DEFAULT_CHARSET |
|
| 67 | + # (les donnees arrivent de toute facon postees en _DEFAULT_CHARSET) |
|
| 68 | + |
|
| 69 | + lire_metas(); |
|
| 70 | + if ($login) { |
|
| 71 | + include_spip('inc/charsets'); |
|
| 72 | + |
|
| 73 | + $nom = (importer_charset($nom, _DEFAULT_CHARSET)); |
|
| 74 | + $login = (importer_charset($login, _DEFAULT_CHARSET)); |
|
| 75 | + $email = (importer_charset($email, _DEFAULT_CHARSET)); |
|
| 76 | + |
|
| 77 | + include_spip('auth/spip'); |
|
| 78 | + // prelablement, creer le champ webmestre si il n'existe pas (install neuve |
|
| 79 | + // sur une vieille base |
|
| 80 | + $t = sql_showtable('spip_auteurs', true); |
|
| 81 | + if (!isset($t['field']['webmestre'])) { |
|
| 82 | + @sql_alter("TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + // il faut avoir une cle des auth valide pour creer un nouvel auteur webmestre |
|
| 86 | + $cles = \Spip\Chiffrer\SpipCles::instance(); |
|
| 87 | + $secret = $cles->getSecretAuth(); |
|
| 88 | + |
|
| 89 | + $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 90 | + if ($id_auteur !== null) { |
|
| 91 | + // c'est un auteur connu : si on a pas de secret il faut absolument qu'il se reconnecte avec le meme mot de passe |
|
| 92 | + // pour restaurer la copie des cles |
|
| 93 | + if (!$secret && !auth_spip_initialiser_secret()) { |
|
| 94 | + $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur=' . (int) $id_auteur); |
|
| 95 | + if (empty($row['backup_cles']) || !$cles->restore($row['backup_cles'], $pass, $row['pass'], $id_auteur)) { |
|
| 96 | + $echec = _T('avis_connexion_erreur_fichier_cle_manquant_1'); |
|
| 97 | + echouer_etape_3b($echec); |
|
| 98 | + } |
|
| 99 | + spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth' . _LOG_INFO_IMPORTANTE); |
|
| 100 | + $cles->save(); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + sql_updateq('spip_auteurs', [ |
|
| 104 | + 'nom' => $nom, |
|
| 105 | + 'email' => $email, |
|
| 106 | + 'login' => $login, |
|
| 107 | + 'statut' => '0minirezo' |
|
| 108 | + ], 'id_auteur=' . (int) $id_auteur); |
|
| 109 | + // le passer webmestre separement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 110 | + @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 111 | + if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
|
| 112 | + $echec = _T('avis_erreur_creation_compte'); |
|
| 113 | + echouer_etape_3b($echec); |
|
| 114 | + } |
|
| 115 | + } else { |
|
| 116 | + // Si on a pas de cle et qu'on ne sait pas la creer, on ne peut pas creer de nouveau compte : |
|
| 117 | + // il faut qu'un webmestre avec un backup fasse l'install |
|
| 118 | + if (!$secret && !auth_spip_initialiser_secret()) { |
|
| 119 | + $echec = _T('avis_connexion_erreur_fichier_cle_manquant_2'); |
|
| 120 | + echouer_etape_3b($echec); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + $id_auteur = sql_insertq('spip_auteurs', [ |
|
| 124 | + 'nom' => $nom, |
|
| 125 | + 'email' => $email, |
|
| 126 | + 'login' => $login, |
|
| 127 | + 'statut' => '0minirezo' |
|
| 128 | + ]); |
|
| 129 | + // le passer webmestre separrement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 130 | + @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 131 | + if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
|
| 132 | + $echec = _T('avis_erreur_creation_compte'); |
|
| 133 | + echouer_etape_3b($echec); |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + // inserer email comme email webmaster principal |
|
| 138 | + // (sauf s'il est vide: cas de la re-installation) |
|
| 139 | + if ($email) { |
|
| 140 | + ecrire_meta('email_webmaster', $email); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + // Connecter directement celui qui vient de (re)donner son login |
|
| 144 | + // mais sans cookie d'admin ni connexion longue |
|
| 145 | + include_spip('inc/auth'); |
|
| 146 | + $auteur = auth_identifier_login($login, $pass); |
|
| 147 | + if (!$auteur || !auth_loger($auteur)) { |
|
| 148 | + spip_log("login automatique impossible $auth_spip $session" . (is_countable($row) ? count($row) : 0)); |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + // installer les metas |
|
| 153 | + $config = charger_fonction('config', 'inc'); |
|
| 154 | + $config(); |
|
| 155 | + |
|
| 156 | + // activer les plugins |
|
| 157 | + // leur installation ne peut pas se faire sur le meme hit, il faudra donc |
|
| 158 | + // poursuivre au hit suivant |
|
| 159 | + include_spip('inc/plugin'); |
|
| 160 | + actualise_plugins_actifs(); |
|
| 161 | + |
|
| 162 | + |
|
| 163 | + include_spip('inc/distant'); |
|
| 164 | + redirige_par_entete(parametre_url(self(), 'etape', '4', '&')); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | function echouer_etape_3b($echec): never { |
| 168 | - echo minipres( |
|
| 169 | - 'AUTO', |
|
| 170 | - info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 171 | - "<div class='error'><h3>$echec</h3>\n" . |
|
| 172 | - '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 173 | - '</div>' |
|
| 174 | - ); |
|
| 175 | - exit; |
|
| 168 | + echo minipres( |
|
| 169 | + 'AUTO', |
|
| 170 | + info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 171 | + "<div class='error'><h3>$echec</h3>\n" . |
|
| 172 | + '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 173 | + '</div>' |
|
| 174 | + ); |
|
| 175 | + exit; |
|
| 176 | 176 | } |
@@ -86,17 +86,17 @@ discard block |
||
| 86 | 86 | $cles = \Spip\Chiffrer\SpipCles::instance(); |
| 87 | 87 | $secret = $cles->getSecretAuth(); |
| 88 | 88 | |
| 89 | - $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 89 | + $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login='.sql_quote($login)); |
|
| 90 | 90 | if ($id_auteur !== null) { |
| 91 | 91 | // c'est un auteur connu : si on a pas de secret il faut absolument qu'il se reconnecte avec le meme mot de passe |
| 92 | 92 | // pour restaurer la copie des cles |
| 93 | 93 | if (!$secret && !auth_spip_initialiser_secret()) { |
| 94 | - $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur=' . (int) $id_auteur); |
|
| 94 | + $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur='.(int) $id_auteur); |
|
| 95 | 95 | if (empty($row['backup_cles']) || !$cles->restore($row['backup_cles'], $pass, $row['pass'], $id_auteur)) { |
| 96 | 96 | $echec = _T('avis_connexion_erreur_fichier_cle_manquant_1'); |
| 97 | 97 | echouer_etape_3b($echec); |
| 98 | 98 | } |
| 99 | - spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth' . _LOG_INFO_IMPORTANTE); |
|
| 99 | + spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth'._LOG_INFO_IMPORTANTE); |
|
| 100 | 100 | $cles->save(); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | 'email' => $email, |
| 106 | 106 | 'login' => $login, |
| 107 | 107 | 'statut' => '0minirezo' |
| 108 | - ], 'id_auteur=' . (int) $id_auteur); |
|
| 108 | + ], 'id_auteur='.(int) $id_auteur); |
|
| 109 | 109 | // le passer webmestre separement du reste, au cas ou l'alter n'aurait pas fonctionne |
| 110 | 110 | @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
| 111 | 111 | if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | include_spip('inc/auth'); |
| 146 | 146 | $auteur = auth_identifier_login($login, $pass); |
| 147 | 147 | if (!$auteur || !auth_loger($auteur)) { |
| 148 | - spip_log("login automatique impossible $auth_spip $session" . (is_countable($row) ? count($row) : 0)); |
|
| 148 | + spip_log("login automatique impossible $auth_spip $session".(is_countable($row) ? count($row) : 0)); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | function echouer_etape_3b($echec): never { |
| 168 | 168 | echo minipres( |
| 169 | 169 | 'AUTO', |
| 170 | - info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 171 | - "<div class='error'><h3>$echec</h3>\n" . |
|
| 172 | - '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 170 | + info_progression_etape(3, 'etape_', 'install/', true). |
|
| 171 | + "<div class='error'><h3>$echec</h3>\n". |
|
| 172 | + '<p>'._T('avis_connexion_echec_2').'</p>'. |
|
| 173 | 173 | '</div>' |
| 174 | 174 | ); |
| 175 | 175 | exit; |
@@ -10,70 +10,70 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | include_spip('inc/headers'); |
| 17 | 17 | |
| 18 | 18 | function install_etape_4_dist() { |
| 19 | 19 | |
| 20 | - // creer le repertoire cache, qui sert partout ! |
|
| 21 | - if (!@file_exists(_DIR_CACHE)) { |
|
| 22 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 23 | - $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 24 | - } |
|
| 20 | + // creer le repertoire cache, qui sert partout ! |
|
| 21 | + if (!@file_exists(_DIR_CACHE)) { |
|
| 22 | + $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 23 | + $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 27 | - echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 26 | + $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 27 | + echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 28 | 28 | |
| 29 | - echo info_progression_etape(4, 'etape_', 'install/'); |
|
| 29 | + echo info_progression_etape(4, 'etape_', 'install/'); |
|
| 30 | 30 | |
| 31 | - echo "<div class='success'><b>" |
|
| 32 | - . _T('info_derniere_etape') |
|
| 33 | - . '</b><p>' |
|
| 34 | - . _T('info_utilisation_spip') |
|
| 35 | - . '</p></div>'; |
|
| 31 | + echo "<div class='success'><b>" |
|
| 32 | + . _T('info_derniere_etape') |
|
| 33 | + . '</b><p>' |
|
| 34 | + . _T('info_utilisation_spip') |
|
| 35 | + . '</p></div>'; |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | - echo '<p>' |
|
| 39 | - . _T( |
|
| 40 | - 'plugin_info_plugins_dist_1', |
|
| 41 | - ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 42 | - ) |
|
| 43 | - . '</p>'; |
|
| 38 | + echo '<p>' |
|
| 39 | + . _T( |
|
| 40 | + 'plugin_info_plugins_dist_1', |
|
| 41 | + ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 42 | + ) |
|
| 43 | + . '</p>'; |
|
| 44 | 44 | |
| 45 | - // installer les extensions |
|
| 46 | - include_spip('inc/plugin'); |
|
| 47 | - $afficher = charger_fonction('afficher_liste', 'plugins'); |
|
| 48 | - echo $afficher( |
|
| 49 | - self(), |
|
| 50 | - liste_plugin_files(_DIR_PLUGINS_DIST), |
|
| 51 | - [], |
|
| 52 | - [], |
|
| 53 | - _DIR_PLUGINS_DIST, |
|
| 54 | - 'afficher_nom_plugin' |
|
| 55 | - ); |
|
| 45 | + // installer les extensions |
|
| 46 | + include_spip('inc/plugin'); |
|
| 47 | + $afficher = charger_fonction('afficher_liste', 'plugins'); |
|
| 48 | + echo $afficher( |
|
| 49 | + self(), |
|
| 50 | + liste_plugin_files(_DIR_PLUGINS_DIST), |
|
| 51 | + [], |
|
| 52 | + [], |
|
| 53 | + _DIR_PLUGINS_DIST, |
|
| 54 | + 'afficher_nom_plugin' |
|
| 55 | + ); |
|
| 56 | 56 | |
| 57 | - // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape |
|
| 58 | - // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour) |
|
| 59 | - // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin |
|
| 60 | - // et procede alors a l'installation |
|
| 61 | - if ( |
|
| 62 | - !isset($GLOBALS['meta']['version_installee']) |
|
| 63 | - || $GLOBALS['spip_version_base'] == (str_replace(',', '.', (string) $GLOBALS['meta']['version_installee'])) |
|
| 64 | - ) { |
|
| 65 | - plugin_installes_meta(); |
|
| 66 | - } |
|
| 57 | + // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape |
|
| 58 | + // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour) |
|
| 59 | + // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin |
|
| 60 | + // et procede alors a l'installation |
|
| 61 | + if ( |
|
| 62 | + !isset($GLOBALS['meta']['version_installee']) |
|
| 63 | + || $GLOBALS['spip_version_base'] == (str_replace(',', '.', (string) $GLOBALS['meta']['version_installee'])) |
|
| 64 | + ) { |
|
| 65 | + plugin_installes_meta(); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - // mettre a jour si necessaire l'adresse du site |
|
| 69 | - // securite si on arrive plus a se loger |
|
| 70 | - include_spip('inc/config'); |
|
| 71 | - appliquer_adresse_site(''); |
|
| 68 | + // mettre a jour si necessaire l'adresse du site |
|
| 69 | + // securite si on arrive plus a se loger |
|
| 70 | + include_spip('inc/config'); |
|
| 71 | + appliquer_adresse_site(''); |
|
| 72 | 72 | |
| 73 | - // aller a la derniere etape qui clos l'install et redirige |
|
| 74 | - $suite = "\n<input type='hidden' name='etape' value='fin' />" |
|
| 75 | - . bouton_suivant(_T('login_espace_prive')); |
|
| 73 | + // aller a la derniere etape qui clos l'install et redirige |
|
| 74 | + $suite = "\n<input type='hidden' name='etape' value='fin' />" |
|
| 75 | + . bouton_suivant(_T('login_espace_prive')); |
|
| 76 | 76 | |
| 77 | - echo generer_form_ecrire('install', $suite); |
|
| 78 | - echo $minipage->installFinPage(); |
|
| 77 | + echo generer_form_ecrire('install', $suite); |
|
| 78 | + echo $minipage->installFinPage(); |
|
| 79 | 79 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | // creer le repertoire cache, qui sert partout ! |
| 21 | 21 | if (!@file_exists(_DIR_CACHE)) { |
| 22 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 22 | + $rep = preg_replace(','._DIR_TMP.',', '', (string) _DIR_CACHE); |
|
| 23 | 23 | $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | echo '<p>' |
| 39 | 39 | . _T( |
| 40 | 40 | 'plugin_info_plugins_dist_1', |
| 41 | - ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 41 | + ['plugins_dist' => '<tt>'.joli_repertoire(_DIR_PLUGINS_DIST).'</tt>'] |
|
| 42 | 42 | ) |
| 43 | 43 | . '</p>'; |
| 44 | 44 | |