Changeset 12819 for extensions/PHP_Optimisateur/index.php
- Timestamp:
- Jan 1, 2012, 10:09:17 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PHP_Optimisateur/index.php
r10338 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Version 1.4|3 | PHP OPTIMISATEUR | 4 | Version 1.4 | 5 5 \***************************************/ 6 6 … … 14 14 $LOG = array(); 15 15 $PAGE = array( 16 17 18 19 20 16 'section' => 'home', 17 'header' => null, 18 'content' => null, 19 'msgs' => null, 20 'end' => null, 21 21 ); 22 22 … … 28 28 ### CONFIGURATION ### 29 29 if (!file_exists('config.xml')) { 30 30 $ERRORS['fatal'][] = 'ErrorConfigFile'; 31 31 } else { 32 32 $CONF = load_config('config.xml'); 33 33 } 34 34 35 35 if (!file_exists('include/nconvert.exe')) { 36 36 $ERRORS['fatal'][] = 'ErrorNconvert'; 37 37 } 38 38 … … 44 44 ### PROCESSUS ### 45 45 switch ($PAGE['section']) { 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 46 case 'home': 47 if (!isset($ERRORS['fatal'])) { 48 if (!file_exists($CONF['DIRsource'])) { 49 mkdir($CONF['DIRsource']); 50 } 51 if (!file_exists($CONF['DIRsortie'])) { 52 mkdir($CONF['DIRsortie']); 53 } 54 if (is_dir_empty($CONF['DIRsource'])) { 55 $ERRORS['fatal'][] = 'ErrorFolderIn'; 56 } 57 if ($CONF['silentORNOT'] == 'block' AND !is_dir_empty($CONF['DIRsortie'])) { 58 $ERRORS['fatal'][] = 'ErrorFolderOut'; 59 } else if ($CONF['silentORNOT'] == 'erase' AND !is_dir_empty($CONF['DIRsortie'])) { 60 $ERRORS['notice'][] = 'EraseFolderOut'; 61 } 62 } 63 break; 64 65 case 'setup': 66 if (isset($_POST['submit'])) { 67 include('include/save_config.php'); 68 } 69 break; 70 71 case 'process': 72 include('include/main.php'); 73 break; 74 74 } 75 75 … … 78 78 ### AFFICHAGE ### 79 79 switch ($PAGE['section']) { 80 81 82 83 84 85 86 87 88 80 case 'home': 81 include('include/display_config.php'); 82 83 if (isset($ERRORS['fatal'])) { 84 $PAGE['end'] .= ' 85 <div class="generic link"> 86 <a class="input-submit" href="index.php">'.l10n('Reload').'</a> 87 <a class="input-submit" href="index.php?page=setup">'.l10n('Config').'</a> 88 </div>'; 89 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 90 } else { 91 $PAGE['end'] .= ' 92 <div class="generic finish"> 93 <span id="ready-text">'.l10n('Ready').'</span> 94 <span id="loader"><img src="template/favicon.png" alt="PHP OPT"/></span> 95 </div> 96 <div class="generic link"> 97 <a class="input-submit" href="index.php?page=process" onclick="Load();">'.l10n('Launch').'</a> 98 <a class="input-submit" href="index.php?page=setup">'.l10n('Config').'</a> 99 </div>'; 100 } 101 break; 102 103 case 'setup': 104 if (isset($ERRORS['fatal'])) { 105 $PAGE['end'] .= ' 106 <div class="generic link"> 107 <a class="input-submit" href="index.php">'.l10n('Back').'</a> 108 <a class="input-submit" href="index.php?page=setup">'.l10n('Reload').'</a> 109 </div>'; 110 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 111 } else { 112 include('include/setup.php'); 113 } 114 break; 115 116 case 'process': 117 ### Affichage des fichiers traités et création du log ### 118 $nb_files = count($FilesSource); 119 $time = intval((microtime(true)-$TIME_START)); 120 $logfile = print_log($nb_files, $time); 121 122 $PAGE['content'] .= ' 123 <div class="generic files"> 124 <h2>'.l10n('Source files').'</h2> 125 <ul>'; 126 foreach ($FilesSource as $value) { 127 $PAGE['content'] .= '<li>'.$value.'</li>'; 128 } 129 $PAGE['content'] .= '</ul> 130 <i>'.l10n('%d files', $nb_files).'</i><br> 131 <b>Log :</b> <a href="logs/'.$logfile.'">'.$logfile.'</a> 132 </div>'; 133 134 134 135 136 137 138 139 140 141 142 143 144 135 unset($FilesSource); 136 unset($FilesSortie); 137 138 $PAGE['end'] .= ' 139 <div class="generic finish">'.l10n('Finish %d seconds', $time).'</div> 140 <div class="generic link"> 141 <a class="input-submit" href="index.php">'.l10n('Back').'</a> 142 <a class="input-submit" href="index.php?page=setup">'.l10n('Config').'</a> 143 </div>'; 144 break; 145 145 } 146 146 … … 150 150 // erreurs fatales 151 151 if (isset($ERRORS['fatal'])) { 152 153 154 155 156 152 $PAGE['msgs'] .= '<div class="generic error">'; 153 foreach ($ERRORS['fatal'] as $key) { 154 $PAGE['msgs'] .= '<div>'.l10n('fatal.'.$key).'</div>'; 155 } 156 $PAGE['msgs'] .= '</div>'; 157 157 } 158 158 // informations 159 159 if (isset($ERRORS['notice'])) { 160 161 162 163 164 160 $PAGE['msgs'] .= '<div class="generic notice">'; 161 foreach ($ERRORS['notice'] as $key) { 162 $PAGE['msgs'] .= '<div>'.l10n('notice.'.$key).'</div>'; 163 } 164 $PAGE['msgs'] .= '</div>'; 165 165 } 166 166 // erreurs de configuration 167 167 if (isset($ERRORS['conf'])) { 168 169 170 171 172 168 $PAGE['msgs'] .= '<div class="generic notice conf">'; 169 foreach ($ERRORS['conf'] as $key) { 170 $PAGE['msgs'] .= '<div>'.l10n('notice.'.$key[1].' %s', '<i>'.$key[0].'</i>').'</div>'; 171 } 172 $PAGE['msgs'] .= '</div>'; 173 173 } 174 174 … … 183 183 echo ' 184 184 <div class="generic footer"> 185 185 2010/2011 - <a href="http://www.strangeplanet.fr">Damien Sorel</a> - <a href="http://fr.piwigo.org/forum/viewtopic.php?id=19117">Forum</a> - <a href="http://fr.piwigo.org/doc/doku.php?id=tools:php_o">Documentation</a> 186 186 </div> 187 187
Note: See TracChangeset
for help on using the changeset viewer.