@@ -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,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 | } |
@@ -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 | |
@@ -12,85 +12,85 @@ |
||
| 12 | 12 | \***************************************************************************/ |
| 13 | 13 | |
| 14 | 14 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 15 | - return; |
|
| 15 | + return; |
|
| 16 | 16 | } |
| 17 | 17 | include_spip('inc/headers'); |
| 18 | 18 | include_spip('auth/ldap'); |
| 19 | 19 | |
| 20 | 20 | function install_etape_ldap5_dist() { |
| 21 | - etape_ldap5_save(); |
|
| 22 | - etape_ldap5_suite(); |
|
| 21 | + etape_ldap5_save(); |
|
| 22 | + etape_ldap5_suite(); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | function etape_ldap5_save() { |
| 26 | - $conn = null; |
|
| 27 | - if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 28 | - redirige_url_ecrire('install'); |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - ecrire_meta('ldap_statut_import', _request('statut_ldap')); |
|
| 32 | - |
|
| 33 | - lire_fichier(_FILE_CONNECT_TMP, $conn); |
|
| 34 | - |
|
| 35 | - if ($p = strpos((string) $conn, "'');")) { |
|
| 36 | - ecrire_fichier( |
|
| 37 | - _FILE_CONNECT_TMP, |
|
| 38 | - substr((string) $conn, 0, $p + 1) |
|
| 39 | - . _FILE_LDAP |
|
| 40 | - . substr((string) $conn, $p + 1) |
|
| 41 | - ); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - $adresse_ldap = addcslashes((string) _request('adresse_ldap'), "'\\"); |
|
| 45 | - $login_ldap = addcslashes((string) _request('login_ldap'), "'\\"); |
|
| 46 | - $pass_ldap = addcslashes((string) _request('pass_ldap'), "'\\"); |
|
| 47 | - $port_ldap = addcslashes((string) _request('port_ldap'), "'\\"); |
|
| 48 | - $tls_ldap = addcslashes((string) _request('tls_ldap'), "'\\"); |
|
| 49 | - $protocole_ldap = addcslashes((string) _request('protocole_ldap'), "'\\"); |
|
| 50 | - $base_ldap = addcslashes((string) _request('base_ldap'), "'\\"); |
|
| 51 | - $base_ldap_text = addcslashes((string) _request('base_ldap_text'), "'\\"); |
|
| 52 | - |
|
| 53 | - $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
|
| 54 | - . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
|
| 55 | - . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
|
| 56 | - . (($tls_ldap != 'oui') ? '' : |
|
| 57 | - "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 58 | - . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
|
| 59 | - |
|
| 60 | - $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
|
| 61 | - $res = ''; |
|
| 62 | - foreach (array_keys($champs) as $champ) { |
|
| 63 | - $nom = 'ldap_' . $champ; |
|
| 64 | - $val = trim((string) _request($nom)); |
|
| 65 | - if (preg_match('/^\w*$/', $val)) { |
|
| 66 | - if ($val) { |
|
| 67 | - $val = _q($val); |
|
| 68 | - } |
|
| 69 | - } else { |
|
| 70 | - $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 71 | - }; |
|
| 72 | - if ($val) { |
|
| 73 | - $res .= "'$champ' => " . $val . ','; |
|
| 74 | - } |
|
| 75 | - } |
|
| 76 | - $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
|
| 77 | - |
|
| 78 | - install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 26 | + $conn = null; |
|
| 27 | + if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 28 | + redirige_url_ecrire('install'); |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + ecrire_meta('ldap_statut_import', _request('statut_ldap')); |
|
| 32 | + |
|
| 33 | + lire_fichier(_FILE_CONNECT_TMP, $conn); |
|
| 34 | + |
|
| 35 | + if ($p = strpos((string) $conn, "'');")) { |
|
| 36 | + ecrire_fichier( |
|
| 37 | + _FILE_CONNECT_TMP, |
|
| 38 | + substr((string) $conn, 0, $p + 1) |
|
| 39 | + . _FILE_LDAP |
|
| 40 | + . substr((string) $conn, $p + 1) |
|
| 41 | + ); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + $adresse_ldap = addcslashes((string) _request('adresse_ldap'), "'\\"); |
|
| 45 | + $login_ldap = addcslashes((string) _request('login_ldap'), "'\\"); |
|
| 46 | + $pass_ldap = addcslashes((string) _request('pass_ldap'), "'\\"); |
|
| 47 | + $port_ldap = addcslashes((string) _request('port_ldap'), "'\\"); |
|
| 48 | + $tls_ldap = addcslashes((string) _request('tls_ldap'), "'\\"); |
|
| 49 | + $protocole_ldap = addcslashes((string) _request('protocole_ldap'), "'\\"); |
|
| 50 | + $base_ldap = addcslashes((string) _request('base_ldap'), "'\\"); |
|
| 51 | + $base_ldap_text = addcslashes((string) _request('base_ldap_text'), "'\\"); |
|
| 52 | + |
|
| 53 | + $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
|
| 54 | + . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
|
| 55 | + . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
|
| 56 | + . (($tls_ldap != 'oui') ? '' : |
|
| 57 | + "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 58 | + . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
|
| 59 | + |
|
| 60 | + $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
|
| 61 | + $res = ''; |
|
| 62 | + foreach (array_keys($champs) as $champ) { |
|
| 63 | + $nom = 'ldap_' . $champ; |
|
| 64 | + $val = trim((string) _request($nom)); |
|
| 65 | + if (preg_match('/^\w*$/', $val)) { |
|
| 66 | + if ($val) { |
|
| 67 | + $val = _q($val); |
|
| 68 | + } |
|
| 69 | + } else { |
|
| 70 | + $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 71 | + }; |
|
| 72 | + if ($val) { |
|
| 73 | + $res .= "'$champ' => " . $val . ','; |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | + $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
|
| 77 | + |
|
| 78 | + install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | function etape_ldap5_suite() { |
| 82 | - $minipage = new Installation(); |
|
| 83 | - echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 82 | + $minipage = new Installation(); |
|
| 83 | + echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 84 | 84 | |
| 85 | - echo info_etape( |
|
| 86 | - _T('info_ldap_ok'), |
|
| 87 | - info_progression_etape(5, 'etape_ldap', 'install/') |
|
| 88 | - ); |
|
| 85 | + echo info_etape( |
|
| 86 | + _T('info_ldap_ok'), |
|
| 87 | + info_progression_etape(5, 'etape_ldap', 'install/') |
|
| 88 | + ); |
|
| 89 | 89 | |
| 90 | - echo generer_form_ecrire('install', ( |
|
| 91 | - "<input type='hidden' name='etape' value='3' />" . |
|
| 92 | - "<input type='hidden' name='ldap_present' value='true' />" |
|
| 93 | - . bouton_suivant())); |
|
| 90 | + echo generer_form_ecrire('install', ( |
|
| 91 | + "<input type='hidden' name='etape' value='3' />" . |
|
| 92 | + "<input type='hidden' name='ldap_present' value='true' />" |
|
| 93 | + . bouton_suivant())); |
|
| 94 | 94 | |
| 95 | - echo $minipage->installFinPage(); |
|
| 95 | + echo $minipage->installFinPage(); |
|
| 96 | 96 | } |
@@ -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 | |
@@ -12,70 +12,70 @@ |
||
| 12 | 12 | \***************************************************************************/ |
| 13 | 13 | |
| 14 | 14 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 15 | - return; |
|
| 15 | + return; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | include_spip('inc/headers'); |
| 19 | 19 | |
| 20 | 20 | function install_etape_4_dist() { |
| 21 | 21 | |
| 22 | - // creer le repertoire cache, qui sert partout ! |
|
| 23 | - if (!@file_exists(_DIR_CACHE)) { |
|
| 24 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 25 | - $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - $minipage = new Installation(); |
|
| 29 | - echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 30 | - |
|
| 31 | - echo info_progression_etape(4, 'etape_', 'install/'); |
|
| 32 | - |
|
| 33 | - echo "<div class='success'><b>" |
|
| 34 | - . _T('info_derniere_etape') |
|
| 35 | - . '</b><p>' |
|
| 36 | - . _T('info_utilisation_spip') |
|
| 37 | - . '</p></div>'; |
|
| 38 | - |
|
| 39 | - |
|
| 40 | - echo '<p>' |
|
| 41 | - . _T( |
|
| 42 | - 'plugin_info_plugins_dist_1', |
|
| 43 | - ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 44 | - ) |
|
| 45 | - . '</p>'; |
|
| 46 | - |
|
| 47 | - // installer les extensions |
|
| 48 | - include_spip('inc/plugin'); |
|
| 49 | - $afficher = charger_fonction('afficher_liste', 'plugins'); |
|
| 50 | - echo $afficher( |
|
| 51 | - self(), |
|
| 52 | - liste_plugin_files(_DIR_PLUGINS_DIST), |
|
| 53 | - [], |
|
| 54 | - [], |
|
| 55 | - _DIR_PLUGINS_DIST, |
|
| 56 | - 'afficher_nom_plugin' |
|
| 57 | - ); |
|
| 58 | - |
|
| 59 | - // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape |
|
| 60 | - // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour) |
|
| 61 | - // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin |
|
| 62 | - // et procede alors a l'installation |
|
| 63 | - if ( |
|
| 64 | - !isset($GLOBALS['meta']['version_installee']) |
|
| 65 | - || $GLOBALS['spip_version_base'] == (str_replace(',', '.', (string) $GLOBALS['meta']['version_installee'])) |
|
| 66 | - ) { |
|
| 67 | - plugin_installes_meta(); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - // mettre a jour si necessaire l'adresse du site |
|
| 71 | - // securite si on arrive plus a se loger |
|
| 72 | - include_spip('inc/config'); |
|
| 73 | - appliquer_adresse_site(''); |
|
| 74 | - |
|
| 75 | - // aller a la derniere etape qui clos l'install et redirige |
|
| 76 | - $suite = "\n<input type='hidden' name='etape' value='fin' />" |
|
| 77 | - . bouton_suivant(_T('login_espace_prive')); |
|
| 78 | - |
|
| 79 | - echo generer_form_ecrire('install', $suite); |
|
| 80 | - echo $minipage->installFinPage(); |
|
| 22 | + // creer le repertoire cache, qui sert partout ! |
|
| 23 | + if (!@file_exists(_DIR_CACHE)) { |
|
| 24 | + $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 25 | + $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + $minipage = new Installation(); |
|
| 29 | + echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 30 | + |
|
| 31 | + echo info_progression_etape(4, 'etape_', 'install/'); |
|
| 32 | + |
|
| 33 | + echo "<div class='success'><b>" |
|
| 34 | + . _T('info_derniere_etape') |
|
| 35 | + . '</b><p>' |
|
| 36 | + . _T('info_utilisation_spip') |
|
| 37 | + . '</p></div>'; |
|
| 38 | + |
|
| 39 | + |
|
| 40 | + echo '<p>' |
|
| 41 | + . _T( |
|
| 42 | + 'plugin_info_plugins_dist_1', |
|
| 43 | + ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 44 | + ) |
|
| 45 | + . '</p>'; |
|
| 46 | + |
|
| 47 | + // installer les extensions |
|
| 48 | + include_spip('inc/plugin'); |
|
| 49 | + $afficher = charger_fonction('afficher_liste', 'plugins'); |
|
| 50 | + echo $afficher( |
|
| 51 | + self(), |
|
| 52 | + liste_plugin_files(_DIR_PLUGINS_DIST), |
|
| 53 | + [], |
|
| 54 | + [], |
|
| 55 | + _DIR_PLUGINS_DIST, |
|
| 56 | + 'afficher_nom_plugin' |
|
| 57 | + ); |
|
| 58 | + |
|
| 59 | + // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape |
|
| 60 | + // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour) |
|
| 61 | + // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin |
|
| 62 | + // et procede alors a l'installation |
|
| 63 | + if ( |
|
| 64 | + !isset($GLOBALS['meta']['version_installee']) |
|
| 65 | + || $GLOBALS['spip_version_base'] == (str_replace(',', '.', (string) $GLOBALS['meta']['version_installee'])) |
|
| 66 | + ) { |
|
| 67 | + plugin_installes_meta(); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + // mettre a jour si necessaire l'adresse du site |
|
| 71 | + // securite si on arrive plus a se loger |
|
| 72 | + include_spip('inc/config'); |
|
| 73 | + appliquer_adresse_site(''); |
|
| 74 | + |
|
| 75 | + // aller a la derniere etape qui clos l'install et redirige |
|
| 76 | + $suite = "\n<input type='hidden' name='etape' value='fin' />" |
|
| 77 | + . bouton_suivant(_T('login_espace_prive')); |
|
| 78 | + |
|
| 79 | + echo generer_form_ecrire('install', $suite); |
|
| 80 | + echo $minipage->installFinPage(); |
|
| 81 | 81 | } |
@@ -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 | |
@@ -20,28 +20,28 @@ discard block |
||
| 20 | 20 | * @param array $arbre |
| 21 | 21 | */ |
| 22 | 22 | function plugins_extraire_pipelines_dist(&$arbre) { |
| 23 | - $pipes = null; |
|
| 24 | - $tag = null; |
|
| 25 | - $pipeline = []; |
|
| 26 | - if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) { |
|
| 27 | - foreach ($pipes as $tag => $p) { |
|
| 28 | - if (!is_array($p[0])) { |
|
| 29 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 30 | - $pipeline[] = $att; |
|
| 31 | - } else { |
|
| 32 | - foreach ($p as $pipe) { |
|
| 33 | - $att = []; |
|
| 34 | - if (is_array($pipe)) { |
|
| 35 | - foreach ($pipe as $k => $t) { |
|
| 36 | - $att[$k] = trim((string) end($t)); |
|
| 37 | - } |
|
| 38 | - } |
|
| 39 | - $pipeline[] = $att; |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - } |
|
| 43 | - unset($arbre[$tag]); |
|
| 44 | - } |
|
| 23 | + $pipes = null; |
|
| 24 | + $tag = null; |
|
| 25 | + $pipeline = []; |
|
| 26 | + if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) { |
|
| 27 | + foreach ($pipes as $tag => $p) { |
|
| 28 | + if (!is_array($p[0])) { |
|
| 29 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 30 | + $pipeline[] = $att; |
|
| 31 | + } else { |
|
| 32 | + foreach ($p as $pipe) { |
|
| 33 | + $att = []; |
|
| 34 | + if (is_array($pipe)) { |
|
| 35 | + foreach ($pipe as $k => $t) { |
|
| 36 | + $att[$k] = trim((string) end($t)); |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | + $pipeline[] = $att; |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | + unset($arbre[$tag]); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - return $pipeline; |
|
| 46 | + return $pipeline; |
|
| 47 | 47 | } |
@@ -10,207 +10,207 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | include_spip('inc/xml'); |
| 17 | 17 | include_spip('inc/plugin'); |
| 18 | 18 | |
| 19 | 19 | function plugins_verifie_conformite_dist($plug, &$arbre, $dir_plugins = _DIR_PLUGINS) { |
| 20 | - $needs = null; |
|
| 21 | - $compat_spip = null; |
|
| 22 | - $uses = null; |
|
| 23 | - $paths = null; |
|
| 24 | - $trads = null; |
|
| 25 | - static $etats = ['dev', 'experimental', 'test', 'stable']; |
|
| 20 | + $needs = null; |
|
| 21 | + $compat_spip = null; |
|
| 22 | + $uses = null; |
|
| 23 | + $paths = null; |
|
| 24 | + $trads = null; |
|
| 25 | + static $etats = ['dev', 'experimental', 'test', 'stable']; |
|
| 26 | 26 | |
| 27 | - $matches = []; |
|
| 28 | - $silence = false; |
|
| 29 | - $p = null; |
|
| 30 | - // chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP |
|
| 31 | - if ($n = spip_xml_match_nodes(',^plugin(\s|$),', $arbre, $matches)) { |
|
| 32 | - // version de SPIP |
|
| 33 | - $vspip = $GLOBALS['spip_version_branche']; |
|
| 34 | - foreach ($matches as $tag => $sous) { |
|
| 35 | - [$tagname, $atts] = spip_xml_decompose_tag($tag); |
|
| 36 | - // On rajoute la condition sur $n : |
|
| 37 | - // -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait |
|
| 38 | - // un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise |
|
| 39 | - // de la meme facon. |
|
| 40 | - if ( |
|
| 41 | - $tagname == 'plugin' |
|
| 42 | - && is_array($sous) |
|
| 43 | - && (!isset($atts['spip']) || $n == 1 || plugin_version_compatible($atts['spip'], $vspip, 'spip')) |
|
| 44 | - ) { |
|
| 45 | - // on prend la derniere declaration avec ce nom |
|
| 46 | - $p = end($sous); |
|
| 47 | - $compat_spip = $atts['spip'] ?? ''; |
|
| 48 | - } |
|
| 49 | - } |
|
| 50 | - } |
|
| 51 | - if (is_null($p)) { |
|
| 52 | - $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent') . " : $plug"]]; |
|
| 53 | - $silence = true; |
|
| 54 | - } else { |
|
| 55 | - $arbre = $p; |
|
| 56 | - } |
|
| 57 | - if (!is_array($arbre)) { |
|
| 58 | - $arbre = []; |
|
| 59 | - } |
|
| 60 | - // verification de la conformite du plugin avec quelques |
|
| 61 | - // precautions elementaires |
|
| 62 | - if (!isset($arbre['nom'])) { |
|
| 63 | - if (!$silence) { |
|
| 64 | - $arbre['erreur'][] = _T('erreur_plugin_nom_manquant'); |
|
| 65 | - } |
|
| 66 | - $arbre['nom'] = ['']; |
|
| 67 | - } |
|
| 68 | - if (!isset($arbre['version'])) { |
|
| 69 | - if (!$silence) { |
|
| 70 | - $arbre['erreur'][] = _T('erreur_plugin_version_manquant'); |
|
| 71 | - } |
|
| 72 | - $arbre['version'] = ['']; |
|
| 73 | - } |
|
| 74 | - if (!isset($arbre['prefix'])) { |
|
| 75 | - if (!$silence) { |
|
| 76 | - $arbre['erreur'][] = _T('erreur_plugin_prefix_manquant'); |
|
| 77 | - } |
|
| 78 | - $arbre['prefix'] = ['']; |
|
| 79 | - } else { |
|
| 80 | - $prefix = trim((string) end($arbre['prefix'])); |
|
| 81 | - if (strtoupper($prefix) == 'SPIP' && $plug != './') { |
|
| 82 | - $arbre['erreur'][] = _T('erreur_plugin_prefix_interdit'); |
|
| 83 | - } |
|
| 84 | - if (isset($arbre['etat'])) { |
|
| 85 | - $etat = trim((string) end($arbre['etat'])); |
|
| 86 | - if (!in_array($etat, $etats)) { |
|
| 87 | - $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'"; |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - if (isset($arbre['options'])) { |
|
| 91 | - foreach ($arbre['options'] as $optfile) { |
|
| 92 | - $optfile = trim((string) $optfile); |
|
| 93 | - if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 94 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 95 | - } |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - if (isset($arbre['fonctions'])) { |
|
| 99 | - foreach ($arbre['fonctions'] as $optfile) { |
|
| 100 | - $optfile = trim((string) $optfile); |
|
| 101 | - if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 102 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - $fonctions = []; |
|
| 107 | - if (isset($arbre['fonctions'])) { |
|
| 108 | - $fonctions = $arbre['fonctions']; |
|
| 109 | - } |
|
| 110 | - $liste_methodes_reservees = [ |
|
| 111 | - '__construct', |
|
| 112 | - '__destruct', |
|
| 113 | - 'plugin', |
|
| 114 | - 'install', |
|
| 115 | - 'uninstall', |
|
| 116 | - strtolower($prefix) |
|
| 117 | - ]; |
|
| 27 | + $matches = []; |
|
| 28 | + $silence = false; |
|
| 29 | + $p = null; |
|
| 30 | + // chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP |
|
| 31 | + if ($n = spip_xml_match_nodes(',^plugin(\s|$),', $arbre, $matches)) { |
|
| 32 | + // version de SPIP |
|
| 33 | + $vspip = $GLOBALS['spip_version_branche']; |
|
| 34 | + foreach ($matches as $tag => $sous) { |
|
| 35 | + [$tagname, $atts] = spip_xml_decompose_tag($tag); |
|
| 36 | + // On rajoute la condition sur $n : |
|
| 37 | + // -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait |
|
| 38 | + // un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise |
|
| 39 | + // de la meme facon. |
|
| 40 | + if ( |
|
| 41 | + $tagname == 'plugin' |
|
| 42 | + && is_array($sous) |
|
| 43 | + && (!isset($atts['spip']) || $n == 1 || plugin_version_compatible($atts['spip'], $vspip, 'spip')) |
|
| 44 | + ) { |
|
| 45 | + // on prend la derniere declaration avec ce nom |
|
| 46 | + $p = end($sous); |
|
| 47 | + $compat_spip = $atts['spip'] ?? ''; |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | + if (is_null($p)) { |
|
| 52 | + $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent') . " : $plug"]]; |
|
| 53 | + $silence = true; |
|
| 54 | + } else { |
|
| 55 | + $arbre = $p; |
|
| 56 | + } |
|
| 57 | + if (!is_array($arbre)) { |
|
| 58 | + $arbre = []; |
|
| 59 | + } |
|
| 60 | + // verification de la conformite du plugin avec quelques |
|
| 61 | + // precautions elementaires |
|
| 62 | + if (!isset($arbre['nom'])) { |
|
| 63 | + if (!$silence) { |
|
| 64 | + $arbre['erreur'][] = _T('erreur_plugin_nom_manquant'); |
|
| 65 | + } |
|
| 66 | + $arbre['nom'] = ['']; |
|
| 67 | + } |
|
| 68 | + if (!isset($arbre['version'])) { |
|
| 69 | + if (!$silence) { |
|
| 70 | + $arbre['erreur'][] = _T('erreur_plugin_version_manquant'); |
|
| 71 | + } |
|
| 72 | + $arbre['version'] = ['']; |
|
| 73 | + } |
|
| 74 | + if (!isset($arbre['prefix'])) { |
|
| 75 | + if (!$silence) { |
|
| 76 | + $arbre['erreur'][] = _T('erreur_plugin_prefix_manquant'); |
|
| 77 | + } |
|
| 78 | + $arbre['prefix'] = ['']; |
|
| 79 | + } else { |
|
| 80 | + $prefix = trim((string) end($arbre['prefix'])); |
|
| 81 | + if (strtoupper($prefix) == 'SPIP' && $plug != './') { |
|
| 82 | + $arbre['erreur'][] = _T('erreur_plugin_prefix_interdit'); |
|
| 83 | + } |
|
| 84 | + if (isset($arbre['etat'])) { |
|
| 85 | + $etat = trim((string) end($arbre['etat'])); |
|
| 86 | + if (!in_array($etat, $etats)) { |
|
| 87 | + $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'"; |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + if (isset($arbre['options'])) { |
|
| 91 | + foreach ($arbre['options'] as $optfile) { |
|
| 92 | + $optfile = trim((string) $optfile); |
|
| 93 | + if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 94 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + if (isset($arbre['fonctions'])) { |
|
| 99 | + foreach ($arbre['fonctions'] as $optfile) { |
|
| 100 | + $optfile = trim((string) $optfile); |
|
| 101 | + if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 102 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + $fonctions = []; |
|
| 107 | + if (isset($arbre['fonctions'])) { |
|
| 108 | + $fonctions = $arbre['fonctions']; |
|
| 109 | + } |
|
| 110 | + $liste_methodes_reservees = [ |
|
| 111 | + '__construct', |
|
| 112 | + '__destruct', |
|
| 113 | + 'plugin', |
|
| 114 | + 'install', |
|
| 115 | + 'uninstall', |
|
| 116 | + strtolower($prefix) |
|
| 117 | + ]; |
|
| 118 | 118 | |
| 119 | - $extraire_pipelines = charger_fonction('extraire_pipelines', 'plugins'); |
|
| 120 | - $arbre['pipeline'] = $extraire_pipelines($arbre); |
|
| 121 | - foreach ($arbre['pipeline'] as $pipe) { |
|
| 122 | - if (!isset($pipe['nom']) && !$silence) { |
|
| 123 | - $arbre['erreur'][] = _T('erreur_plugin_nom_pipeline_non_defini'); |
|
| 124 | - } |
|
| 125 | - $action = $pipe['action'] ?? $pipe['nom']; |
|
| 126 | - // verif que la methode a un nom autorise |
|
| 127 | - if (in_array(strtolower((string) $action), $liste_methodes_reservees) && !$silence) { |
|
| 128 | - $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit') . " : $action"; |
|
| 129 | - } |
|
| 130 | - if (isset($pipe['inclure'])) { |
|
| 131 | - $inclure = $dir_plugins . "$plug/" . $pipe['inclure']; |
|
| 132 | - if (!@is_readable($inclure) && !$silence) { |
|
| 133 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure"; |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - } |
|
| 137 | - $necessite = []; |
|
| 138 | - $spip_trouve = false; |
|
| 139 | - if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) { |
|
| 140 | - foreach (array_keys($needs) as $tag) { |
|
| 141 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 142 | - if (!isset($att['id'])) { |
|
| 143 | - if (!$silence) { |
|
| 144 | - $arbre['erreur'][] = _T( |
|
| 145 | - 'erreur_plugin_attribut_balise_manquant', |
|
| 146 | - ['attribut' => 'id', 'balise' => $att] |
|
| 147 | - ); |
|
| 148 | - } |
|
| 149 | - } else { |
|
| 150 | - $necessite[] = $att; |
|
| 151 | - } |
|
| 152 | - if (strtolower((string) $att['id']) == 'spip') { |
|
| 153 | - $spip_trouve = true; |
|
| 154 | - } |
|
| 155 | - } |
|
| 156 | - } |
|
| 157 | - if ($compat_spip && !$spip_trouve) { |
|
| 158 | - $necessite[] = ['id' => 'spip', 'version' => $compat_spip]; |
|
| 159 | - } |
|
| 160 | - $arbre['necessite'] = $necessite; |
|
| 161 | - $utilise = []; |
|
| 162 | - if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) { |
|
| 163 | - foreach (array_keys($uses) as $tag) { |
|
| 164 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 165 | - if (!isset($att['id'])) { |
|
| 166 | - if (!$silence) { |
|
| 167 | - $arbre['erreur'][] = _T( |
|
| 168 | - 'erreur_plugin_attribut_balise_manquant', |
|
| 169 | - ['attribut' => 'id', 'balise' => $att] |
|
| 170 | - ); |
|
| 171 | - } |
|
| 172 | - } else { |
|
| 173 | - $utilise[] = $att; |
|
| 174 | - } |
|
| 175 | - } |
|
| 176 | - } |
|
| 177 | - $arbre['utilise'] = $utilise; |
|
| 178 | - $procure = []; |
|
| 179 | - if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) { |
|
| 180 | - foreach (array_keys($uses) as $tag) { |
|
| 181 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 182 | - $procure[] = $att; |
|
| 183 | - } |
|
| 184 | - } |
|
| 185 | - $arbre['procure'] = $procure; |
|
| 186 | - $path = []; |
|
| 187 | - if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) { |
|
| 188 | - foreach (array_keys($paths) as $tag) { |
|
| 189 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 190 | - $att['path'] = $att['dir']; // ancienne syntaxe |
|
| 191 | - $path[] = $att; |
|
| 192 | - } |
|
| 193 | - } else { |
|
| 194 | - $path = [['dir' => '']]; |
|
| 195 | - } // initialiser par defaut |
|
| 196 | - $arbre['path'] = $path; |
|
| 197 | - // exposer les noisettes |
|
| 198 | - if (isset($arbre['noisette'])) { |
|
| 199 | - foreach ($arbre['noisette'] as $k => $nut) { |
|
| 200 | - $nut = preg_replace(',[.]html$,uims', '', trim((string) $nut)); |
|
| 201 | - $arbre['noisette'][$k] = $nut; |
|
| 202 | - if (!@is_readable($dir_plugins . "$plug/$nut.html") && !$silence) { |
|
| 203 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut"; |
|
| 204 | - } |
|
| 205 | - } |
|
| 206 | - } |
|
| 207 | - $traduire = []; |
|
| 208 | - if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) { |
|
| 209 | - foreach (array_keys($trads) as $tag) { |
|
| 210 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 211 | - $traduire[] = $att; |
|
| 212 | - } |
|
| 213 | - } |
|
| 214 | - $arbre['traduire'] = $traduire; |
|
| 215 | - } |
|
| 119 | + $extraire_pipelines = charger_fonction('extraire_pipelines', 'plugins'); |
|
| 120 | + $arbre['pipeline'] = $extraire_pipelines($arbre); |
|
| 121 | + foreach ($arbre['pipeline'] as $pipe) { |
|
| 122 | + if (!isset($pipe['nom']) && !$silence) { |
|
| 123 | + $arbre['erreur'][] = _T('erreur_plugin_nom_pipeline_non_defini'); |
|
| 124 | + } |
|
| 125 | + $action = $pipe['action'] ?? $pipe['nom']; |
|
| 126 | + // verif que la methode a un nom autorise |
|
| 127 | + if (in_array(strtolower((string) $action), $liste_methodes_reservees) && !$silence) { |
|
| 128 | + $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit') . " : $action"; |
|
| 129 | + } |
|
| 130 | + if (isset($pipe['inclure'])) { |
|
| 131 | + $inclure = $dir_plugins . "$plug/" . $pipe['inclure']; |
|
| 132 | + if (!@is_readable($inclure) && !$silence) { |
|
| 133 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure"; |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + $necessite = []; |
|
| 138 | + $spip_trouve = false; |
|
| 139 | + if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) { |
|
| 140 | + foreach (array_keys($needs) as $tag) { |
|
| 141 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 142 | + if (!isset($att['id'])) { |
|
| 143 | + if (!$silence) { |
|
| 144 | + $arbre['erreur'][] = _T( |
|
| 145 | + 'erreur_plugin_attribut_balise_manquant', |
|
| 146 | + ['attribut' => 'id', 'balise' => $att] |
|
| 147 | + ); |
|
| 148 | + } |
|
| 149 | + } else { |
|
| 150 | + $necessite[] = $att; |
|
| 151 | + } |
|
| 152 | + if (strtolower((string) $att['id']) == 'spip') { |
|
| 153 | + $spip_trouve = true; |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | + } |
|
| 157 | + if ($compat_spip && !$spip_trouve) { |
|
| 158 | + $necessite[] = ['id' => 'spip', 'version' => $compat_spip]; |
|
| 159 | + } |
|
| 160 | + $arbre['necessite'] = $necessite; |
|
| 161 | + $utilise = []; |
|
| 162 | + if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) { |
|
| 163 | + foreach (array_keys($uses) as $tag) { |
|
| 164 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 165 | + if (!isset($att['id'])) { |
|
| 166 | + if (!$silence) { |
|
| 167 | + $arbre['erreur'][] = _T( |
|
| 168 | + 'erreur_plugin_attribut_balise_manquant', |
|
| 169 | + ['attribut' => 'id', 'balise' => $att] |
|
| 170 | + ); |
|
| 171 | + } |
|
| 172 | + } else { |
|
| 173 | + $utilise[] = $att; |
|
| 174 | + } |
|
| 175 | + } |
|
| 176 | + } |
|
| 177 | + $arbre['utilise'] = $utilise; |
|
| 178 | + $procure = []; |
|
| 179 | + if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) { |
|
| 180 | + foreach (array_keys($uses) as $tag) { |
|
| 181 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 182 | + $procure[] = $att; |
|
| 183 | + } |
|
| 184 | + } |
|
| 185 | + $arbre['procure'] = $procure; |
|
| 186 | + $path = []; |
|
| 187 | + if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) { |
|
| 188 | + foreach (array_keys($paths) as $tag) { |
|
| 189 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 190 | + $att['path'] = $att['dir']; // ancienne syntaxe |
|
| 191 | + $path[] = $att; |
|
| 192 | + } |
|
| 193 | + } else { |
|
| 194 | + $path = [['dir' => '']]; |
|
| 195 | + } // initialiser par defaut |
|
| 196 | + $arbre['path'] = $path; |
|
| 197 | + // exposer les noisettes |
|
| 198 | + if (isset($arbre['noisette'])) { |
|
| 199 | + foreach ($arbre['noisette'] as $k => $nut) { |
|
| 200 | + $nut = preg_replace(',[.]html$,uims', '', trim((string) $nut)); |
|
| 201 | + $arbre['noisette'][$k] = $nut; |
|
| 202 | + if (!@is_readable($dir_plugins . "$plug/$nut.html") && !$silence) { |
|
| 203 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut"; |
|
| 204 | + } |
|
| 205 | + } |
|
| 206 | + } |
|
| 207 | + $traduire = []; |
|
| 208 | + if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) { |
|
| 209 | + foreach (array_keys($trads) as $tag) { |
|
| 210 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 211 | + $traduire[] = $att; |
|
| 212 | + } |
|
| 213 | + } |
|
| 214 | + $arbre['traduire'] = $traduire; |
|
| 215 | + } |
|
| 216 | 216 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | if (is_null($p)) { |
| 52 | - $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent') . " : $plug"]]; |
|
| 52 | + $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent')." : $plug"]]; |
|
| 53 | 53 | $silence = true; |
| 54 | 54 | } else { |
| 55 | 55 | $arbre = $p; |
@@ -84,22 +84,22 @@ discard block |
||
| 84 | 84 | if (isset($arbre['etat'])) { |
| 85 | 85 | $etat = trim((string) end($arbre['etat'])); |
| 86 | 86 | if (!in_array($etat, $etats)) { |
| 87 | - $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'"; |
|
| 87 | + $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu')." : '$etat'"; |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | if (isset($arbre['options'])) { |
| 91 | 91 | foreach ($arbre['options'] as $optfile) { |
| 92 | 92 | $optfile = trim((string) $optfile); |
| 93 | - if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 94 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 93 | + if (!@is_readable($dir_plugins."$plug/$optfile") && !$silence) { |
|
| 94 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $optfile"; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | if (isset($arbre['fonctions'])) { |
| 99 | 99 | foreach ($arbre['fonctions'] as $optfile) { |
| 100 | 100 | $optfile = trim((string) $optfile); |
| 101 | - if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 102 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 101 | + if (!@is_readable($dir_plugins."$plug/$optfile") && !$silence) { |
|
| 102 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $optfile"; |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | $action = $pipe['action'] ?? $pipe['nom']; |
| 126 | 126 | // verif que la methode a un nom autorise |
| 127 | 127 | if (in_array(strtolower((string) $action), $liste_methodes_reservees) && !$silence) { |
| 128 | - $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit') . " : $action"; |
|
| 128 | + $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit')." : $action"; |
|
| 129 | 129 | } |
| 130 | 130 | if (isset($pipe['inclure'])) { |
| 131 | - $inclure = $dir_plugins . "$plug/" . $pipe['inclure']; |
|
| 131 | + $inclure = $dir_plugins."$plug/".$pipe['inclure']; |
|
| 132 | 132 | if (!@is_readable($inclure) && !$silence) { |
| 133 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure"; |
|
| 133 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $inclure"; |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | foreach ($arbre['noisette'] as $k => $nut) { |
| 200 | 200 | $nut = preg_replace(',[.]html$,uims', '', trim((string) $nut)); |
| 201 | 201 | $arbre['noisette'][$k] = $nut; |
| 202 | - if (!@is_readable($dir_plugins . "$plug/$nut.html") && !$silence) { |
|
| 203 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut"; |
|
| 202 | + if (!@is_readable($dir_plugins."$plug/$nut.html") && !$silence) { |
|
| 203 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $nut"; |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | $dir = constant($dir); |
| 69 | 69 | foreach ($infos['install'] as $file) { |
| 70 | - $file = $dir . $plug . '/' . trim((string) $file); |
|
| 70 | + $file = $dir.$plug.'/'.trim((string) $file); |
|
| 71 | 71 | if (file_exists($file)) { |
| 72 | 72 | include_once($file); |
| 73 | 73 | } |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | // S'assurer que les metas de la table spécifique sont bien accessibles dans la globale |
| 81 | 81 | lire_metas($table); |
| 82 | 82 | } |
| 83 | - $nom_meta = $infos['prefix'] . '_base_version'; |
|
| 83 | + $nom_meta = $infos['prefix'].'_base_version'; |
|
| 84 | 84 | |
| 85 | 85 | // Détermination de la fonction à appeler et de ses arguments |
| 86 | - $f = $infos['prefix'] . '_install'; |
|
| 86 | + $f = $infos['prefix'].'_install'; |
|
| 87 | 87 | if (!function_exists($f)) { |
| 88 | 88 | $f = isset($infos['schema']) ? 'spip_plugin_install' : ''; |
| 89 | 89 | $arg = $infos; |
@@ -162,12 +162,12 @@ discard block |
||
| 162 | 162 | && isset($GLOBALS[$table][$nom_meta]) |
| 163 | 163 | && spip_version_compare($GLOBALS[$table][$nom_meta], $version_cible, '>=')); |
| 164 | 164 | case 'install': |
| 165 | - if (function_exists($upgrade = $infos['prefix'] . '_upgrade')) { |
|
| 165 | + if (function_exists($upgrade = $infos['prefix'].'_upgrade')) { |
|
| 166 | 166 | $upgrade($nom_meta, $version_cible, $table); |
| 167 | 167 | } |
| 168 | 168 | break; |
| 169 | 169 | case 'uninstall': |
| 170 | - if (function_exists($vider_tables = $infos['prefix'] . '_vider_tables')) { |
|
| 170 | + if (function_exists($vider_tables = $infos['prefix'].'_vider_tables')) { |
|
| 171 | 171 | $vider_tables($nom_meta, $table); |
| 172 | 172 | } |
| 173 | 173 | break; |
@@ -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 | /** |
@@ -53,92 +53,92 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | function plugins_installer_dist($plug, $action, $dir_type = '_DIR_PLUGINS') { |
| 55 | 55 | |
| 56 | - // Charger les informations du XML du plugin et vérification de l'existence d'une installation |
|
| 57 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 58 | - $infos = $get_infos($plug, false, constant($dir_type)); |
|
| 59 | - if (!isset($infos['install']) || !$infos['install']) { |
|
| 60 | - return false; |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - // Passer en chemin absolu si possible, c'est plus efficace |
|
| 64 | - $dir = str_replace('_DIR_', '_ROOT_', $dir_type); |
|
| 65 | - if (!defined($dir)) { |
|
| 66 | - $dir = $dir_type; |
|
| 67 | - } |
|
| 68 | - $dir = constant($dir); |
|
| 69 | - foreach ($infos['install'] as $file) { |
|
| 70 | - $file = $dir . $plug . '/' . trim((string) $file); |
|
| 71 | - if (file_exists($file)) { |
|
| 72 | - include_once($file); |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - // Détermination de la table meta et du nom de la meta plugin |
|
| 77 | - $table = 'meta'; |
|
| 78 | - if (isset($infos['meta']) && $infos['meta'] !== 'meta') { |
|
| 79 | - $table = $infos['meta']; |
|
| 80 | - // S'assurer que les metas de la table spécifique sont bien accessibles dans la globale |
|
| 81 | - lire_metas($table); |
|
| 82 | - } |
|
| 83 | - $nom_meta = $infos['prefix'] . '_base_version'; |
|
| 84 | - |
|
| 85 | - // Détermination de la fonction à appeler et de ses arguments |
|
| 86 | - $f = $infos['prefix'] . '_install'; |
|
| 87 | - if (!function_exists($f)) { |
|
| 88 | - $f = isset($infos['schema']) ? 'spip_plugin_install' : ''; |
|
| 89 | - $arg = $infos; |
|
| 90 | - // On passe la table et la meta pour éviter de les recalculer dans la fonction appelée |
|
| 91 | - $arg['meta'] = $table; |
|
| 92 | - $arg['nom_meta'] = $nom_meta; |
|
| 93 | - } else { |
|
| 94 | - // Ancienne méthode d'installation - TODO à supprimer à terme |
|
| 95 | - // stupide: info deja dans le nom |
|
| 96 | - $arg = $infos['prefix']; |
|
| 97 | - } |
|
| 98 | - $version = $infos['schema'] ?? ''; |
|
| 99 | - |
|
| 100 | - if (!$f) { |
|
| 101 | - // installation sans operation particuliere |
|
| 102 | - $infos['install_test'] = [true, '']; |
|
| 103 | - return $infos; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - // Tester si l'action demandée est nécessaire ou pas. |
|
| 107 | - $test = $f('test', $arg, $version); |
|
| 108 | - if ($action == 'uninstall') { |
|
| 109 | - $test = !$test; |
|
| 110 | - } |
|
| 111 | - // Si deja fait, on ne fait rien et on ne dit rien |
|
| 112 | - if ($test) { |
|
| 113 | - return true; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - // Si install et que l'on a la meta d'installation, c'est un upgrade. On le consigne dans $infos |
|
| 117 | - // pour renvoyer le bon message en retour de la fonction. |
|
| 118 | - if ($action == 'install' && !empty($GLOBALS[$table][$nom_meta])) { |
|
| 119 | - $infos['upgrade'] = true; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - // executer l'installation ou l'inverse |
|
| 123 | - // et renvoyer la trace (mais il faudrait passer en AJAX plutot) |
|
| 124 | - ob_start(); |
|
| 125 | - $f($action, $arg, $version); |
|
| 126 | - $aff = ob_get_contents(); |
|
| 127 | - ob_end_clean(); |
|
| 128 | - |
|
| 129 | - // vider le cache des descriptions de tables a chaque (de)installation |
|
| 130 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 131 | - $trouver_table(''); |
|
| 132 | - $infos['install_test'] = [$f('test', $arg, $version), $aff]; |
|
| 133 | - |
|
| 134 | - // Si la table meta n'est pas spip_meta et qu'on est dans la première installation du plugin |
|
| 135 | - // on force la création du fichier cache à la date du moment. |
|
| 136 | - // On relit les metas de la table pour être sur que la globale soit à jour pour touch_meta. |
|
| 137 | - if ($table !== 'meta' && $action == 'install' && empty($infos['upgrade'])) { |
|
| 138 | - touch_meta(false, $table); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - return $infos; |
|
| 56 | + // Charger les informations du XML du plugin et vérification de l'existence d'une installation |
|
| 57 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 58 | + $infos = $get_infos($plug, false, constant($dir_type)); |
|
| 59 | + if (!isset($infos['install']) || !$infos['install']) { |
|
| 60 | + return false; |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + // Passer en chemin absolu si possible, c'est plus efficace |
|
| 64 | + $dir = str_replace('_DIR_', '_ROOT_', $dir_type); |
|
| 65 | + if (!defined($dir)) { |
|
| 66 | + $dir = $dir_type; |
|
| 67 | + } |
|
| 68 | + $dir = constant($dir); |
|
| 69 | + foreach ($infos['install'] as $file) { |
|
| 70 | + $file = $dir . $plug . '/' . trim((string) $file); |
|
| 71 | + if (file_exists($file)) { |
|
| 72 | + include_once($file); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + // Détermination de la table meta et du nom de la meta plugin |
|
| 77 | + $table = 'meta'; |
|
| 78 | + if (isset($infos['meta']) && $infos['meta'] !== 'meta') { |
|
| 79 | + $table = $infos['meta']; |
|
| 80 | + // S'assurer que les metas de la table spécifique sont bien accessibles dans la globale |
|
| 81 | + lire_metas($table); |
|
| 82 | + } |
|
| 83 | + $nom_meta = $infos['prefix'] . '_base_version'; |
|
| 84 | + |
|
| 85 | + // Détermination de la fonction à appeler et de ses arguments |
|
| 86 | + $f = $infos['prefix'] . '_install'; |
|
| 87 | + if (!function_exists($f)) { |
|
| 88 | + $f = isset($infos['schema']) ? 'spip_plugin_install' : ''; |
|
| 89 | + $arg = $infos; |
|
| 90 | + // On passe la table et la meta pour éviter de les recalculer dans la fonction appelée |
|
| 91 | + $arg['meta'] = $table; |
|
| 92 | + $arg['nom_meta'] = $nom_meta; |
|
| 93 | + } else { |
|
| 94 | + // Ancienne méthode d'installation - TODO à supprimer à terme |
|
| 95 | + // stupide: info deja dans le nom |
|
| 96 | + $arg = $infos['prefix']; |
|
| 97 | + } |
|
| 98 | + $version = $infos['schema'] ?? ''; |
|
| 99 | + |
|
| 100 | + if (!$f) { |
|
| 101 | + // installation sans operation particuliere |
|
| 102 | + $infos['install_test'] = [true, '']; |
|
| 103 | + return $infos; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + // Tester si l'action demandée est nécessaire ou pas. |
|
| 107 | + $test = $f('test', $arg, $version); |
|
| 108 | + if ($action == 'uninstall') { |
|
| 109 | + $test = !$test; |
|
| 110 | + } |
|
| 111 | + // Si deja fait, on ne fait rien et on ne dit rien |
|
| 112 | + if ($test) { |
|
| 113 | + return true; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + // Si install et que l'on a la meta d'installation, c'est un upgrade. On le consigne dans $infos |
|
| 117 | + // pour renvoyer le bon message en retour de la fonction. |
|
| 118 | + if ($action == 'install' && !empty($GLOBALS[$table][$nom_meta])) { |
|
| 119 | + $infos['upgrade'] = true; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + // executer l'installation ou l'inverse |
|
| 123 | + // et renvoyer la trace (mais il faudrait passer en AJAX plutot) |
|
| 124 | + ob_start(); |
|
| 125 | + $f($action, $arg, $version); |
|
| 126 | + $aff = ob_get_contents(); |
|
| 127 | + ob_end_clean(); |
|
| 128 | + |
|
| 129 | + // vider le cache des descriptions de tables a chaque (de)installation |
|
| 130 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 131 | + $trouver_table(''); |
|
| 132 | + $infos['install_test'] = [$f('test', $arg, $version), $aff]; |
|
| 133 | + |
|
| 134 | + // Si la table meta n'est pas spip_meta et qu'on est dans la première installation du plugin |
|
| 135 | + // on force la création du fichier cache à la date du moment. |
|
| 136 | + // On relit les metas de la table pour être sur que la globale soit à jour pour touch_meta. |
|
| 137 | + if ($table !== 'meta' && $action == 'install' && empty($infos['upgrade'])) { |
|
| 138 | + touch_meta(false, $table); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + return $infos; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -154,24 +154,24 @@ discard block |
||
| 154 | 154 | * @return bool|void |
| 155 | 155 | */ |
| 156 | 156 | function spip_plugin_install($action, $infos, $version_cible) { |
| 157 | - $nom_meta = $infos['nom_meta']; |
|
| 158 | - $table = $infos['meta']; |
|
| 159 | - switch ($action) { |
|
| 160 | - case 'test': |
|
| 161 | - return (isset($GLOBALS[$table]) |
|
| 162 | - && isset($GLOBALS[$table][$nom_meta]) |
|
| 163 | - && spip_version_compare($GLOBALS[$table][$nom_meta], $version_cible, '>=')); |
|
| 164 | - case 'install': |
|
| 165 | - if (function_exists($upgrade = $infos['prefix'] . '_upgrade')) { |
|
| 166 | - $upgrade($nom_meta, $version_cible, $table); |
|
| 167 | - } |
|
| 168 | - break; |
|
| 169 | - case 'uninstall': |
|
| 170 | - if (function_exists($vider_tables = $infos['prefix'] . '_vider_tables')) { |
|
| 171 | - $vider_tables($nom_meta, $table); |
|
| 172 | - } |
|
| 173 | - break; |
|
| 174 | - } |
|
| 157 | + $nom_meta = $infos['nom_meta']; |
|
| 158 | + $table = $infos['meta']; |
|
| 159 | + switch ($action) { |
|
| 160 | + case 'test': |
|
| 161 | + return (isset($GLOBALS[$table]) |
|
| 162 | + && isset($GLOBALS[$table][$nom_meta]) |
|
| 163 | + && spip_version_compare($GLOBALS[$table][$nom_meta], $version_cible, '>=')); |
|
| 164 | + case 'install': |
|
| 165 | + if (function_exists($upgrade = $infos['prefix'] . '_upgrade')) { |
|
| 166 | + $upgrade($nom_meta, $version_cible, $table); |
|
| 167 | + } |
|
| 168 | + break; |
|
| 169 | + case 'uninstall': |
|
| 170 | + if (function_exists($vider_tables = $infos['prefix'] . '_vider_tables')) { |
|
| 171 | + $vider_tables($nom_meta, $table); |
|
| 172 | + } |
|
| 173 | + break; |
|
| 174 | + } |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
@@ -190,10 +190,10 @@ discard block |
||
| 190 | 190 | * @return array Tableau des plugins actifs |
| 191 | 191 | **/ |
| 192 | 192 | function liste_plugin_actifs() { |
| 193 | - $liste = $GLOBALS['meta']['plugin'] ?? ''; |
|
| 194 | - if (!$liste) { |
|
| 195 | - return []; |
|
| 196 | - } |
|
| 197 | - $liste = unserialize($liste); |
|
| 198 | - return is_array($liste) ? $liste : []; |
|
| 193 | + $liste = $GLOBALS['meta']['plugin'] ?? ''; |
|
| 194 | + if (!$liste) { |
|
| 195 | + return []; |
|
| 196 | + } |
|
| 197 | + $liste = unserialize($liste); |
|
| 198 | + return is_array($liste) ? $liste : []; |
|
| 199 | 199 | } |
@@ -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 | /** |
@@ -24,64 +24,64 @@ discard block |
||
| 24 | 24 | * @return array |
| 25 | 25 | */ |
| 26 | 26 | function plugins_infos_paquet($desc, $plug = '', $dir_plugins = _DIR_PLUGINS) { |
| 27 | - static $process = [ // tableau constant |
|
| 28 | - 'debut' => 'paquet_debutElement', |
|
| 29 | - 'fin' => 'paquet_finElement', |
|
| 30 | - 'text' => 'paquet_textElement' |
|
| 31 | - ]; |
|
| 32 | - |
|
| 33 | - $valider_xml = charger_fonction('valider', 'xml'); |
|
| 34 | - $vxml = $valider_xml($desc, false, $process, 'paquet.dtd', 'utf-8'); |
|
| 35 | - if (!$vxml->err) { |
|
| 36 | - // On veut toutes les variantes selon la version de SPIP |
|
| 37 | - if (!$plug) { |
|
| 38 | - return $vxml->versions; |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - // compatibilite avec l'existant: |
|
| 42 | - $tree = $vxml->versions['0']; |
|
| 43 | - |
|
| 44 | - // l'arbre renvoie parfois un tag vide... etrange. Pas la peine de garder ca. |
|
| 45 | - if (isset($tree['']) && !strlen((string) $tree[''])) { |
|
| 46 | - unset($tree['']); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - $tree['slogan'] = $tree['prefix'] . '_slogan'; |
|
| 50 | - $tree['description'] = $tree['prefix'] . '_description'; |
|
| 51 | - paquet_readable_files($tree, "$dir_plugins$plug/"); |
|
| 52 | - if (!$tree['chemin']) { |
|
| 53 | - $tree['chemin'] = []; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - // On verifie qu'il existe des balises spip qu'il faudrait rajouter dans |
|
| 57 | - // la structure d'infos du paquet en fonction de la version spip courante |
|
| 58 | - if ((is_countable($vxml->versions) ? count($vxml->versions) : 0) > 1) { |
|
| 59 | - $vspip = $GLOBALS['spip_version_branche']; |
|
| 60 | - foreach ($vxml->versions as $_compatibilite => $_version) { |
|
| 61 | - if ( |
|
| 62 | - $_version['balise'] == 'spip' |
|
| 63 | - && plugin_version_compatible($_compatibilite, $vspip, 'spip') |
|
| 64 | - ) { |
|
| 65 | - // on merge les sous-balises de la balise spip compatible avec celles de la |
|
| 66 | - // balise paquet |
|
| 67 | - foreach ($_version as $_index => $_balise) { |
|
| 68 | - if ($_index && $_index != 'balise') { |
|
| 69 | - $tree[$_index] = array_merge($tree[$_index], $_balise); |
|
| 70 | - } |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - return $tree; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - // Prendre les messages d'erreur sans les numeros de lignes |
|
| 80 | - $msg = array_column($vxml->err, 0); |
|
| 81 | - $t = _T('plugins_erreur', ['plugins' => $plug]); |
|
| 82 | - array_unshift($msg, $t . " <ul class='erreur_xml'><li>" . reset($msg) . '</li></ul>'); |
|
| 83 | - |
|
| 84 | - return ['erreur' => $msg]; |
|
| 27 | + static $process = [ // tableau constant |
|
| 28 | + 'debut' => 'paquet_debutElement', |
|
| 29 | + 'fin' => 'paquet_finElement', |
|
| 30 | + 'text' => 'paquet_textElement' |
|
| 31 | + ]; |
|
| 32 | + |
|
| 33 | + $valider_xml = charger_fonction('valider', 'xml'); |
|
| 34 | + $vxml = $valider_xml($desc, false, $process, 'paquet.dtd', 'utf-8'); |
|
| 35 | + if (!$vxml->err) { |
|
| 36 | + // On veut toutes les variantes selon la version de SPIP |
|
| 37 | + if (!$plug) { |
|
| 38 | + return $vxml->versions; |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + // compatibilite avec l'existant: |
|
| 42 | + $tree = $vxml->versions['0']; |
|
| 43 | + |
|
| 44 | + // l'arbre renvoie parfois un tag vide... etrange. Pas la peine de garder ca. |
|
| 45 | + if (isset($tree['']) && !strlen((string) $tree[''])) { |
|
| 46 | + unset($tree['']); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + $tree['slogan'] = $tree['prefix'] . '_slogan'; |
|
| 50 | + $tree['description'] = $tree['prefix'] . '_description'; |
|
| 51 | + paquet_readable_files($tree, "$dir_plugins$plug/"); |
|
| 52 | + if (!$tree['chemin']) { |
|
| 53 | + $tree['chemin'] = []; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + // On verifie qu'il existe des balises spip qu'il faudrait rajouter dans |
|
| 57 | + // la structure d'infos du paquet en fonction de la version spip courante |
|
| 58 | + if ((is_countable($vxml->versions) ? count($vxml->versions) : 0) > 1) { |
|
| 59 | + $vspip = $GLOBALS['spip_version_branche']; |
|
| 60 | + foreach ($vxml->versions as $_compatibilite => $_version) { |
|
| 61 | + if ( |
|
| 62 | + $_version['balise'] == 'spip' |
|
| 63 | + && plugin_version_compatible($_compatibilite, $vspip, 'spip') |
|
| 64 | + ) { |
|
| 65 | + // on merge les sous-balises de la balise spip compatible avec celles de la |
|
| 66 | + // balise paquet |
|
| 67 | + foreach ($_version as $_index => $_balise) { |
|
| 68 | + if ($_index && $_index != 'balise') { |
|
| 69 | + $tree[$_index] = array_merge($tree[$_index], $_balise); |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + return $tree; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + // Prendre les messages d'erreur sans les numeros de lignes |
|
| 80 | + $msg = array_column($vxml->err, 0); |
|
| 81 | + $t = _T('plugins_erreur', ['plugins' => $plug]); |
|
| 82 | + array_unshift($msg, $t . " <ul class='erreur_xml'><li>" . reset($msg) . '</li></ul>'); |
|
| 83 | + |
|
| 84 | + return ['erreur' => $msg]; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | * @return void |
| 94 | 94 | */ |
| 95 | 95 | function paquet_readable_files(&$tree, $dir) { |
| 96 | - $prefix = strtolower((string) $tree['prefix']); |
|
| 96 | + $prefix = strtolower((string) $tree['prefix']); |
|
| 97 | 97 | |
| 98 | - $tree['options'] = (is_readable($dir . $f = ($prefix . '_options.php'))) ? [$f] : []; |
|
| 99 | - $tree['fonctions'] = (is_readable($dir . $f = ($prefix . '_fonctions.php'))) ? [$f] : []; |
|
| 100 | - $tree['install'] = (is_readable($dir . $f = ($prefix . '_administrations.php'))) ? [$f] : []; |
|
| 98 | + $tree['options'] = (is_readable($dir . $f = ($prefix . '_options.php'))) ? [$f] : []; |
|
| 99 | + $tree['fonctions'] = (is_readable($dir . $f = ($prefix . '_fonctions.php'))) ? [$f] : []; |
|
| 100 | + $tree['install'] = (is_readable($dir . $f = ($prefix . '_administrations.php'))) ? [$f] : []; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -114,35 +114,35 @@ discard block |
||
| 114 | 114 | * @param array $attrs |
| 115 | 115 | */ |
| 116 | 116 | function paquet_debutElement($phraseur, $name, $attrs) { |
| 117 | - xml_debutElement($phraseur, $name, $attrs); |
|
| 118 | - if ($phraseur->err) { |
|
| 119 | - return; |
|
| 120 | - } |
|
| 121 | - if ($name == 'paquet' || $name == 'spip') { |
|
| 122 | - if ($name == 'spip') { |
|
| 123 | - $n = $attrs['compatibilite']; |
|
| 124 | - $attrs = []; |
|
| 125 | - } else { |
|
| 126 | - $n = '0'; |
|
| 127 | - $phraseur->contenu['paquet'] = $attrs; |
|
| 128 | - $attrs['menu'] = []; |
|
| 129 | - $attrs['chemin'] = []; |
|
| 130 | - $attrs['necessite'] = []; |
|
| 131 | - $attrs['lib'] = []; |
|
| 132 | - $attrs['onglet'] = []; |
|
| 133 | - $attrs['procure'] = []; |
|
| 134 | - $attrs['pipeline'] = []; |
|
| 135 | - $attrs['utilise'] = []; |
|
| 136 | - $attrs['style'] = []; |
|
| 137 | - $attrs['script'] = []; |
|
| 138 | - $attrs['genie'] = []; |
|
| 139 | - } |
|
| 140 | - $phraseur->contenu['compatible'] = $n; |
|
| 141 | - $phraseur->versions[$phraseur->contenu['compatible']] = $attrs; |
|
| 142 | - } else { |
|
| 143 | - $phraseur->versions[$phraseur->contenu['compatible']][$name][0] = $attrs; |
|
| 144 | - } |
|
| 145 | - $phraseur->versions[$phraseur->contenu['compatible']][''] = ''; |
|
| 117 | + xml_debutElement($phraseur, $name, $attrs); |
|
| 118 | + if ($phraseur->err) { |
|
| 119 | + return; |
|
| 120 | + } |
|
| 121 | + if ($name == 'paquet' || $name == 'spip') { |
|
| 122 | + if ($name == 'spip') { |
|
| 123 | + $n = $attrs['compatibilite']; |
|
| 124 | + $attrs = []; |
|
| 125 | + } else { |
|
| 126 | + $n = '0'; |
|
| 127 | + $phraseur->contenu['paquet'] = $attrs; |
|
| 128 | + $attrs['menu'] = []; |
|
| 129 | + $attrs['chemin'] = []; |
|
| 130 | + $attrs['necessite'] = []; |
|
| 131 | + $attrs['lib'] = []; |
|
| 132 | + $attrs['onglet'] = []; |
|
| 133 | + $attrs['procure'] = []; |
|
| 134 | + $attrs['pipeline'] = []; |
|
| 135 | + $attrs['utilise'] = []; |
|
| 136 | + $attrs['style'] = []; |
|
| 137 | + $attrs['script'] = []; |
|
| 138 | + $attrs['genie'] = []; |
|
| 139 | + } |
|
| 140 | + $phraseur->contenu['compatible'] = $n; |
|
| 141 | + $phraseur->versions[$phraseur->contenu['compatible']] = $attrs; |
|
| 142 | + } else { |
|
| 143 | + $phraseur->versions[$phraseur->contenu['compatible']][$name][0] = $attrs; |
|
| 144 | + } |
|
| 145 | + $phraseur->versions[$phraseur->contenu['compatible']][''] = ''; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | * @param string $data |
| 155 | 155 | */ |
| 156 | 156 | function paquet_textElement($phraseur, $data) { |
| 157 | - xml_textElement($phraseur, $data); |
|
| 158 | - if ($phraseur->err || !(trim($data))) { |
|
| 159 | - return; |
|
| 160 | - } |
|
| 161 | - $phraseur->versions[$phraseur->contenu['compatible']][''] .= $data; |
|
| 157 | + xml_textElement($phraseur, $data); |
|
| 158 | + if ($phraseur->err || !(trim($data))) { |
|
| 159 | + return; |
|
| 160 | + } |
|
| 161 | + $phraseur->versions[$phraseur->contenu['compatible']][''] .= $data; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -170,32 +170,32 @@ discard block |
||
| 170 | 170 | * @param string $name |
| 171 | 171 | */ |
| 172 | 172 | function paquet_finElement($phraseur, $name) { |
| 173 | - if ($phraseur->err) { |
|
| 174 | - return; |
|
| 175 | - } |
|
| 176 | - $n = $phraseur->contenu['compatible']; |
|
| 177 | - |
|
| 178 | - if (isset($phraseur->versions[$n][$name][0]) && is_array($phraseur->versions[$n][$name][0])) { |
|
| 179 | - $attrs = $phraseur->versions[$n][$name][0]; |
|
| 180 | - unset($phraseur->versions[$n][$name][0]); |
|
| 181 | - } else { |
|
| 182 | - $attrs = []; |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - $texte = trim((string) $phraseur->versions[$n]['']); |
|
| 186 | - $phraseur->versions[$n][''] = ''; |
|
| 187 | - |
|
| 188 | - $f = 'info_paquet_' . $name; |
|
| 189 | - if (function_exists($f)) { |
|
| 190 | - $f($phraseur, $attrs, $texte); |
|
| 191 | - } elseif (!$attrs) { |
|
| 192 | - $phraseur->versions[$n][$name] = $texte; |
|
| 193 | - } else { |
|
| 194 | - // Traitement generique. Si $attrs['nom'] n'existe pas, ce n'est pas normal ici |
|
| 195 | - $phraseur->versions[$n][$name][$attrs['nom']] = $attrs; |
|
| 196 | - # echo("<br>pour $name $n " . $attrs['nom']); var_dump($phraseur->versions[$n]); |
|
| 197 | - } |
|
| 198 | - xml_finElement($phraseur, $name, $attrs); |
|
| 173 | + if ($phraseur->err) { |
|
| 174 | + return; |
|
| 175 | + } |
|
| 176 | + $n = $phraseur->contenu['compatible']; |
|
| 177 | + |
|
| 178 | + if (isset($phraseur->versions[$n][$name][0]) && is_array($phraseur->versions[$n][$name][0])) { |
|
| 179 | + $attrs = $phraseur->versions[$n][$name][0]; |
|
| 180 | + unset($phraseur->versions[$n][$name][0]); |
|
| 181 | + } else { |
|
| 182 | + $attrs = []; |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + $texte = trim((string) $phraseur->versions[$n]['']); |
|
| 186 | + $phraseur->versions[$n][''] = ''; |
|
| 187 | + |
|
| 188 | + $f = 'info_paquet_' . $name; |
|
| 189 | + if (function_exists($f)) { |
|
| 190 | + $f($phraseur, $attrs, $texte); |
|
| 191 | + } elseif (!$attrs) { |
|
| 192 | + $phraseur->versions[$n][$name] = $texte; |
|
| 193 | + } else { |
|
| 194 | + // Traitement generique. Si $attrs['nom'] n'existe pas, ce n'est pas normal ici |
|
| 195 | + $phraseur->versions[$n][$name][$attrs['nom']] = $attrs; |
|
| 196 | + # echo("<br>pour $name $n " . $attrs['nom']); var_dump($phraseur->versions[$n]); |
|
| 197 | + } |
|
| 198 | + xml_finElement($phraseur, $name, $attrs); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -207,9 +207,9 @@ discard block |
||
| 207 | 207 | * @param string $texte |
| 208 | 208 | */ |
| 209 | 209 | function info_paquet_licence($phraseur, $attrs, $texte) { |
| 210 | - $lien = $attrs['lien'] ?? ''; |
|
| 211 | - $n = $phraseur->contenu['compatible']; |
|
| 212 | - $phraseur->versions[$n]['licence'][] = ['nom' => $texte, 'url' => $lien]; |
|
| 210 | + $lien = $attrs['lien'] ?? ''; |
|
| 211 | + $n = $phraseur->contenu['compatible']; |
|
| 212 | + $phraseur->versions[$n]['licence'][] = ['nom' => $texte, 'url' => $lien]; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -221,14 +221,14 @@ discard block |
||
| 221 | 221 | * @param string $texte |
| 222 | 222 | */ |
| 223 | 223 | function info_paquet_chemin($phraseur, $attrs, $texte) { |
| 224 | - $n = $phraseur->contenu['compatible']; |
|
| 225 | - if (isset($attrs['path'])) { |
|
| 226 | - if (isset($attrs['type'])) { |
|
| 227 | - $phraseur->versions[$n]['chemin'][] = ['path' => $attrs['path'], 'type' => $attrs['type']]; |
|
| 228 | - } else { |
|
| 229 | - $phraseur->versions[$n]['chemin'][] = ['path' => $attrs['path']]; |
|
| 230 | - } |
|
| 231 | - } |
|
| 224 | + $n = $phraseur->contenu['compatible']; |
|
| 225 | + if (isset($attrs['path'])) { |
|
| 226 | + if (isset($attrs['type'])) { |
|
| 227 | + $phraseur->versions[$n]['chemin'][] = ['path' => $attrs['path'], 'type' => $attrs['type']]; |
|
| 228 | + } else { |
|
| 229 | + $phraseur->versions[$n]['chemin'][] = ['path' => $attrs['path']]; |
|
| 230 | + } |
|
| 231 | + } |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | |
@@ -242,20 +242,20 @@ discard block |
||
| 242 | 242 | * @param string $texte |
| 243 | 243 | */ |
| 244 | 244 | function info_paquet_auteur($phraseur, $attrs, $texte) { |
| 245 | - # echo 'auteur ', $texte; var_dump($attrs); |
|
| 246 | - if (isset($attrs['mail'])) { |
|
| 247 | - if (strpos((string) $attrs['mail'], '@')) { |
|
| 248 | - $attrs['mail'] = str_replace('@', ' AT ', (string) $attrs['mail']); |
|
| 249 | - } |
|
| 250 | - $mail = $attrs['mail']; |
|
| 251 | - } else { |
|
| 252 | - $mail = ''; |
|
| 253 | - } |
|
| 254 | - |
|
| 255 | - $lien = $attrs['lien'] ?? ''; |
|
| 256 | - |
|
| 257 | - $n = $phraseur->contenu['compatible']; |
|
| 258 | - $phraseur->versions[$n]['auteur'][] = ['nom' => $texte, 'url' => $lien, 'mail' => $mail]; |
|
| 245 | + # echo 'auteur ', $texte; var_dump($attrs); |
|
| 246 | + if (isset($attrs['mail'])) { |
|
| 247 | + if (strpos((string) $attrs['mail'], '@')) { |
|
| 248 | + $attrs['mail'] = str_replace('@', ' AT ', (string) $attrs['mail']); |
|
| 249 | + } |
|
| 250 | + $mail = $attrs['mail']; |
|
| 251 | + } else { |
|
| 252 | + $mail = ''; |
|
| 253 | + } |
|
| 254 | + |
|
| 255 | + $lien = $attrs['lien'] ?? ''; |
|
| 256 | + |
|
| 257 | + $n = $phraseur->contenu['compatible']; |
|
| 258 | + $phraseur->versions[$n]['auteur'][] = ['nom' => $texte, 'url' => $lien, 'mail' => $mail]; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -268,10 +268,10 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | function info_paquet_credit($phraseur, $attrs, $texte) { |
| 270 | 270 | |
| 271 | - $lien = $attrs['lien'] ?? ''; |
|
| 271 | + $lien = $attrs['lien'] ?? ''; |
|
| 272 | 272 | |
| 273 | - $n = $phraseur->contenu['compatible']; |
|
| 274 | - $phraseur->versions[$n]['credit'][] = ['nom' => $texte, 'url' => $lien]; |
|
| 273 | + $n = $phraseur->contenu['compatible']; |
|
| 274 | + $phraseur->versions[$n]['credit'][] = ['nom' => $texte, 'url' => $lien]; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -283,8 +283,8 @@ discard block |
||
| 283 | 283 | * @param string $texte |
| 284 | 284 | */ |
| 285 | 285 | function info_paquet_copyright($phraseur, $attrs, $texte) { |
| 286 | - $n = $phraseur->contenu['compatible']; |
|
| 287 | - $phraseur->versions[$n]['copyright'][] = $texte; |
|
| 286 | + $n = $phraseur->contenu['compatible']; |
|
| 287 | + $phraseur->versions[$n]['copyright'][] = $texte; |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
@@ -296,9 +296,9 @@ discard block |
||
| 296 | 296 | * @param string $texte |
| 297 | 297 | */ |
| 298 | 298 | function info_paquet_paquet($phraseur, $attrs, $texte) { |
| 299 | - $n = 0; |
|
| 300 | - $phraseur->versions[$n]['dtd'] = 'paquet'; |
|
| 301 | - $phraseur->versions[$n]['balise'] = 'paquet'; |
|
| 299 | + $n = 0; |
|
| 300 | + $phraseur->versions[$n]['dtd'] = 'paquet'; |
|
| 301 | + $phraseur->versions[$n]['balise'] = 'paquet'; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
@@ -310,8 +310,8 @@ discard block |
||
| 310 | 310 | * @param string $texte |
| 311 | 311 | **/ |
| 312 | 312 | function info_paquet_traduire($phraseur, $attrs, $texte) { |
| 313 | - $n = $phraseur->contenu['compatible']; |
|
| 314 | - $phraseur->versions[$n]['traduire'][] = $attrs; |
|
| 313 | + $n = $phraseur->contenu['compatible']; |
|
| 314 | + $phraseur->versions[$n]['traduire'][] = $attrs; |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -323,8 +323,8 @@ discard block |
||
| 323 | 323 | * @param string $texte |
| 324 | 324 | */ |
| 325 | 325 | function info_paquet_spip($phraseur, $attrs, $texte) { |
| 326 | - $n = $phraseur->contenu['compatible']; |
|
| 327 | - $phraseur->versions[$n]['balise'] = 'spip'; |
|
| 326 | + $n = $phraseur->contenu['compatible']; |
|
| 327 | + $phraseur->versions[$n]['balise'] = 'spip'; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | |
@@ -336,8 +336,8 @@ discard block |
||
| 336 | 336 | * @param string $texte |
| 337 | 337 | */ |
| 338 | 338 | function info_paquet_pipeline($phraseur, $attrs, $texte) { |
| 339 | - $n = $phraseur->contenu['compatible']; |
|
| 340 | - $phraseur->versions[$n]['pipeline'][] = $attrs; |
|
| 339 | + $n = $phraseur->contenu['compatible']; |
|
| 340 | + $phraseur->versions[$n]['pipeline'][] = $attrs; |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | |
@@ -350,23 +350,23 @@ discard block |
||
| 350 | 350 | * @param string $texte |
| 351 | 351 | */ |
| 352 | 352 | function info_paquet_style($phraseur, $attrs, $texte) { |
| 353 | - $lien = $chemin = $type = $media = ''; |
|
| 354 | - |
|
| 355 | - include_spip('inc/utils'); |
|
| 356 | - if (tester_url_absolue($attrs['source'])) { |
|
| 357 | - $lien = $attrs['source']; |
|
| 358 | - } else { |
|
| 359 | - $chemin = $attrs['source']; |
|
| 360 | - } |
|
| 361 | - if (isset($attrs['type'])) { |
|
| 362 | - $type = $attrs['type']; |
|
| 363 | - } |
|
| 364 | - if (isset($attrs['media'])) { |
|
| 365 | - $media = $attrs['media']; |
|
| 366 | - } |
|
| 367 | - |
|
| 368 | - $n = $phraseur->contenu['compatible']; |
|
| 369 | - $phraseur->versions[$n]['style'][] = ['url' => $lien, 'path' => $chemin, 'type' => $type, 'media' => $media]; |
|
| 353 | + $lien = $chemin = $type = $media = ''; |
|
| 354 | + |
|
| 355 | + include_spip('inc/utils'); |
|
| 356 | + if (tester_url_absolue($attrs['source'])) { |
|
| 357 | + $lien = $attrs['source']; |
|
| 358 | + } else { |
|
| 359 | + $chemin = $attrs['source']; |
|
| 360 | + } |
|
| 361 | + if (isset($attrs['type'])) { |
|
| 362 | + $type = $attrs['type']; |
|
| 363 | + } |
|
| 364 | + if (isset($attrs['media'])) { |
|
| 365 | + $media = $attrs['media']; |
|
| 366 | + } |
|
| 367 | + |
|
| 368 | + $n = $phraseur->contenu['compatible']; |
|
| 369 | + $phraseur->versions[$n]['style'][] = ['url' => $lien, 'path' => $chemin, 'type' => $type, 'media' => $media]; |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | |
@@ -379,20 +379,20 @@ discard block |
||
| 379 | 379 | * @param string $texte |
| 380 | 380 | */ |
| 381 | 381 | function info_paquet_script($phraseur, $attrs, $texte) { |
| 382 | - $lien = $chemin = $type = $media = ''; |
|
| 383 | - |
|
| 384 | - include_spip('inc/utils'); |
|
| 385 | - if (tester_url_absolue($attrs['source'])) { |
|
| 386 | - $lien = $attrs['source']; |
|
| 387 | - } else { |
|
| 388 | - $chemin = $attrs['source']; |
|
| 389 | - } |
|
| 390 | - if (isset($attrs['type'])) { |
|
| 391 | - $type = $attrs['type']; |
|
| 392 | - } |
|
| 393 | - |
|
| 394 | - $n = $phraseur->contenu['compatible']; |
|
| 395 | - $phraseur->versions[$n]['script'][] = ['url' => $lien, 'path' => $chemin, 'type' => $type]; |
|
| 382 | + $lien = $chemin = $type = $media = ''; |
|
| 383 | + |
|
| 384 | + include_spip('inc/utils'); |
|
| 385 | + if (tester_url_absolue($attrs['source'])) { |
|
| 386 | + $lien = $attrs['source']; |
|
| 387 | + } else { |
|
| 388 | + $chemin = $attrs['source']; |
|
| 389 | + } |
|
| 390 | + if (isset($attrs['type'])) { |
|
| 391 | + $type = $attrs['type']; |
|
| 392 | + } |
|
| 393 | + |
|
| 394 | + $n = $phraseur->contenu['compatible']; |
|
| 395 | + $phraseur->versions[$n]['script'][] = ['url' => $lien, 'path' => $chemin, 'type' => $type]; |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | /** |
@@ -403,6 +403,6 @@ discard block |
||
| 403 | 403 | * @param string $texte |
| 404 | 404 | */ |
| 405 | 405 | function info_paquet_genie($phraseur, $attrs, $texte) { |
| 406 | - $n = $phraseur->contenu['compatible']; |
|
| 407 | - $phraseur->versions[$n]['genie'][] = $attrs; |
|
| 406 | + $n = $phraseur->contenu['compatible']; |
|
| 407 | + $phraseur->versions[$n]['genie'][] = $attrs; |
|
| 408 | 408 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @return array |
| 25 | 25 | */ |
| 26 | 26 | function plugins_infos_paquet($desc, $plug = '', $dir_plugins = _DIR_PLUGINS) { |
| 27 | - static $process = [ // tableau constant |
|
| 27 | + static $process = [// tableau constant |
|
| 28 | 28 | 'debut' => 'paquet_debutElement', |
| 29 | 29 | 'fin' => 'paquet_finElement', |
| 30 | 30 | 'text' => 'paquet_textElement' |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | unset($tree['']); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $tree['slogan'] = $tree['prefix'] . '_slogan'; |
|
| 50 | - $tree['description'] = $tree['prefix'] . '_description'; |
|
| 49 | + $tree['slogan'] = $tree['prefix'].'_slogan'; |
|
| 50 | + $tree['description'] = $tree['prefix'].'_description'; |
|
| 51 | 51 | paquet_readable_files($tree, "$dir_plugins$plug/"); |
| 52 | 52 | if (!$tree['chemin']) { |
| 53 | 53 | $tree['chemin'] = []; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | // Prendre les messages d'erreur sans les numeros de lignes |
| 80 | 80 | $msg = array_column($vxml->err, 0); |
| 81 | 81 | $t = _T('plugins_erreur', ['plugins' => $plug]); |
| 82 | - array_unshift($msg, $t . " <ul class='erreur_xml'><li>" . reset($msg) . '</li></ul>'); |
|
| 82 | + array_unshift($msg, $t." <ul class='erreur_xml'><li>".reset($msg).'</li></ul>'); |
|
| 83 | 83 | |
| 84 | 84 | return ['erreur' => $msg]; |
| 85 | 85 | } |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | function paquet_readable_files(&$tree, $dir) { |
| 96 | 96 | $prefix = strtolower((string) $tree['prefix']); |
| 97 | 97 | |
| 98 | - $tree['options'] = (is_readable($dir . $f = ($prefix . '_options.php'))) ? [$f] : []; |
|
| 99 | - $tree['fonctions'] = (is_readable($dir . $f = ($prefix . '_fonctions.php'))) ? [$f] : []; |
|
| 100 | - $tree['install'] = (is_readable($dir . $f = ($prefix . '_administrations.php'))) ? [$f] : []; |
|
| 98 | + $tree['options'] = (is_readable($dir.$f = ($prefix.'_options.php'))) ? [$f] : []; |
|
| 99 | + $tree['fonctions'] = (is_readable($dir.$f = ($prefix.'_fonctions.php'))) ? [$f] : []; |
|
| 100 | + $tree['install'] = (is_readable($dir.$f = ($prefix.'_administrations.php'))) ? [$f] : []; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $texte = trim((string) $phraseur->versions[$n]['']); |
| 186 | 186 | $phraseur->versions[$n][''] = ''; |
| 187 | 187 | |
| 188 | - $f = 'info_paquet_' . $name; |
|
| 188 | + $f = 'info_paquet_'.$name; |
|
| 189 | 189 | if (function_exists($f)) { |
| 190 | 190 | $f($phraseur, $attrs, $texte); |
| 191 | 191 | } elseif (!$attrs) { |