[152] | 1 | <?php |
---|
| 2 | |
---|
| 3 | include_spip('inc/vieilles_defs'); |
---|
| 4 | include_spip('inc/svn_update'); |
---|
| 5 | include_spip('inc/cfg_config'); |
---|
| 6 | |
---|
| 7 | # securite |
---|
| 8 | if (!defined("_ECRIRE_INC_VERSION")) return; |
---|
| 9 | |
---|
| 10 | function exec_svn_update() { |
---|
| 11 | global $connect_statut, $connect_id_auteur, $connect_toutes_rubriques; |
---|
| 12 | global $exec; |
---|
| 13 | include_spip('inc/presentation'); |
---|
| 14 | include_spip('inc/config'); |
---|
| 15 | |
---|
| 16 | pipeline('exec_init', |
---|
| 17 | array('args'=>array('exec'=>'configuration'),'data'=>'')); |
---|
| 18 | |
---|
| 19 | debut_page(_L('Update SVN'), "configuration", "configuration"); |
---|
| 20 | echo "<br><br><br>"; |
---|
| 21 | gros_titre(_L('Update SVN')); |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | if ($connect_statut != '0minirezo' |
---|
| 25 | OR !in_array($connect_id_auteur, explode(';', _SVN_UPDATE_AUTEURS))) { |
---|
| 26 | echo _T('avis_non_acces_page'); |
---|
| 27 | fin_page(); |
---|
| 28 | exit; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | debut_gauche(); |
---|
| 32 | debut_droite(); |
---|
| 33 | |
---|
| 34 | $config = explode("\n",lire_config('svn_update/file')); |
---|
| 35 | |
---|
| 36 | $dirs_ok = array(); |
---|
| 37 | foreach ($config as $l) { |
---|
| 38 | $l = trim($l); |
---|
| 39 | if ($l AND substr($l,0,1) != "#") { |
---|
| 40 | list($src,$dest) = explode(' ', $l); |
---|
| 41 | $dirs_ok[$dest] = $l; |
---|
| 42 | $sources[$dest] = $src; |
---|
| 43 | } |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | if ($dirs_ok) { |
---|
| 47 | |
---|
| 48 | chdir(_DIR_RACINE); |
---|
| 49 | // Appliquer la demande |
---|
| 50 | if (_request('dir_svn') == -1) { |
---|
| 51 | traiter_config_svn($config); |
---|
| 52 | } else |
---|
| 53 | if ($dir_svn = _request('dir_svn') |
---|
| 54 | AND isset($dirs_ok[$dir_svn])) { |
---|
| 55 | traiter_config_svn(array($dirs_ok[$dir_svn])); |
---|
| 56 | } |
---|
| 57 | chdir(_DIR_RESTREINT_ABS); |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | // Menu |
---|
| 61 | |
---|
| 62 | echo _L("Choisir le répertoire à mettre à jour : "); |
---|
| 63 | echo "<form action='./?exec=$exec' method='post'> |
---|
| 64 | <input type='hidden' name='exec' value='$exec' /> |
---|
| 65 | <select name='dir_svn'> |
---|
| 66 | <option value=''></option>"; |
---|
| 67 | foreach ($dirs_ok as $dir => $source) { |
---|
| 68 | echo "<option value='$dir'>".$dir |
---|
| 69 | ." depuis ".$sources[$dir]."</option>\n"; |
---|
| 70 | } |
---|
| 71 | echo "<option value='-1'>** "._L('Tous')."</option>\n"; |
---|
| 72 | echo "</select> |
---|
| 73 | <input type='submit' value='Update' /> |
---|
| 74 | </form> |
---|
| 75 | "; |
---|
| 76 | |
---|
| 77 | } else |
---|
| 78 | echo _L("Désolé, aucun répertoire n'est accessible en SVN."); |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | fin_page(); |
---|
| 82 | |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | ?> |
---|