[7988] | 1 | <?php |
---|
| 2 | /***************************************\ |
---|
| 3 | | PHP OPTIMISATEUR | |
---|
[9420] | 4 | | Version 1.3.3 | |
---|
[7988] | 5 | \***************************************/ |
---|
| 6 | |
---|
[9201] | 7 | session_start(); |
---|
[8226] | 8 | set_time_limit(7200); |
---|
[9201] | 9 | |
---|
| 10 | $APPversion = '1.3'; |
---|
[7988] | 11 | $TIME_START = microtime(true); |
---|
[9201] | 12 | $ERRORS = array(); |
---|
| 13 | $CONF = array(); |
---|
| 14 | $PAGE_CONTENT = array(0=>null,1=>null,2=>null); |
---|
[7988] | 15 | |
---|
[9201] | 16 | include('include/functions.php'); |
---|
| 17 | $PAGE = (isset($_GET['page'])) ? $_GET['page'] : 'home'; |
---|
[7988] | 18 | |
---|
| 19 | |
---|
[7991] | 20 | |
---|
[9201] | 21 | ### CONFIGURATION ### |
---|
[7991] | 22 | if (!file_exists('config.xml')) { |
---|
[9201] | 23 | $ERRORS['fatal']['ErrorConfigFile'] = true; |
---|
[7993] | 24 | } else { |
---|
[9201] | 25 | $CONF = load_config('config.xml'); |
---|
| 26 | } |
---|
[7988] | 27 | |
---|
[9201] | 28 | if (!file_exists('include/nconvert.exe')) { |
---|
| 29 | $ERRORS['fatal']['ErrorNconvert'] = true; |
---|
[7991] | 30 | } |
---|
| 31 | |
---|
[7993] | 32 | |
---|
[8195] | 33 | |
---|
[9201] | 34 | ### HEADER ### |
---|
| 35 | $CONF = array_merge($CONF, GetLanguage()); |
---|
| 36 | include('language/'.$CONF['user_lang'].'/'.$CONF['user_lang'].'.php'); |
---|
| 37 | include('include/header.php'); |
---|
[7988] | 38 | |
---|
| 39 | |
---|
[7991] | 40 | |
---|
[9276] | 41 | ### PROCESSUS ### |
---|
[9201] | 42 | if ($PAGE == 'home') { |
---|
| 43 | if (!isset($ERRORS['fatal'])) { |
---|
| 44 | if (!file_exists($CONF['DIRsource'])) { |
---|
| 45 | mkdir($CONF['DIRsource']); |
---|
[7988] | 46 | } |
---|
[9201] | 47 | if (!file_exists($CONF['DIRsortie'])) { |
---|
| 48 | mkdir($CONF['DIRsortie']); |
---|
| 49 | } |
---|
| 50 | if (is_dir_empty($CONF['DIRsource'])) { |
---|
[9515] | 51 | $ERRORS['fatal']['ErrorFolderIn'] = true; |
---|
[9201] | 52 | } |
---|
| 53 | if ($CONF['silentORNOT'] == 'block' AND !is_dir_empty($CONF['DIRsortie'])) { |
---|
| 54 | $ERRORS['fatal']['ErrorFolderOut'] = true; |
---|
| 55 | } else if ($CONF['silentORNOT'] == 'erase' AND !is_dir_empty($CONF['DIRsortie'])) { |
---|
| 56 | $ERRORS['notice']['EraseFolderOut'] = true; |
---|
| 57 | } |
---|
[7988] | 58 | } |
---|
[7994] | 59 | |
---|
[9201] | 60 | } else if ($PAGE == 'setup') { |
---|
| 61 | if (isset($_GET['ErrorConfig'])) { |
---|
| 62 | $ERRORS['notice']['ErrorConfig'] = true; |
---|
[7991] | 63 | } |
---|
[9201] | 64 | if (isset($_POST['DIRsource'])) { |
---|
| 65 | include('include/save_config.php'); |
---|
[7991] | 66 | } |
---|
[8195] | 67 | |
---|
[9201] | 68 | } else if ($PAGE = 'process') { |
---|
| 69 | include('include/main.php'); |
---|
| 70 | } |
---|
[7988] | 71 | |
---|
| 72 | |
---|
[9201] | 73 | |
---|
| 74 | ### ERREURS ### |
---|
| 75 | if (isset($ERRORS['fatal'])) { |
---|
| 76 | $PAGE_CONTENT[1] .= '<div class="generic error">'; |
---|
| 77 | foreach ($ERRORS['fatal'] as $key => $i) { |
---|
| 78 | $PAGE_CONTENT[1] .= '<div>'.l10n('fatal.'.$key).'</div>'; |
---|
[7991] | 79 | } |
---|
[9201] | 80 | $PAGE_CONTENT[1] .= '</div>'; |
---|
| 81 | } |
---|
| 82 | if (isset($ERRORS['notice'])) { |
---|
| 83 | $PAGE_CONTENT[1] .= '<div class="generic notice">'; |
---|
| 84 | foreach ($ERRORS['notice'] as $key => $i) { |
---|
| 85 | $PAGE_CONTENT[1] .= '<div>'.l10n('notice.'.$key).'</div>'; |
---|
| 86 | } |
---|
| 87 | $PAGE_CONTENT[1] .= '</div>'; |
---|
| 88 | } |
---|
[7988] | 89 | |
---|
| 90 | |
---|
| 91 | |
---|
[9201] | 92 | ### AFFICHAGE ### |
---|
| 93 | if ($PAGE == 'home') { |
---|
| 94 | if (isset($ERRORS['fatal'])) { |
---|
[9276] | 95 | $PAGE_CONTENT[2] .= ' |
---|
| 96 | <div class="generic link"> |
---|
| 97 | <a class="input-submit" href="index.php">'.l10n('Back').'</a> |
---|
| 98 | <a class="input-submit" href="index.php?page=setup">'.l10n('Config').'</a> |
---|
| 99 | </div>'; |
---|
[9201] | 100 | |
---|
| 101 | } else { |
---|
| 102 | include('include/display_config.php'); |
---|
[8195] | 103 | |
---|
[9276] | 104 | $PAGE_CONTENT[2] .= ' |
---|
| 105 | <div class="generic finish"> |
---|
[9201] | 106 | <span id="ready-text">'.l10n('Ready').'</span> |
---|
| 107 | <span id="loader"><img src="template/favicon.png" alt="PHP OPT"/></span> |
---|
| 108 | </div> |
---|
| 109 | <div class="generic link"> |
---|
| 110 | <a class="input-submit" href="index.php?page=process" onclick="Load();">'.l10n('Launch').'</a> |
---|
| 111 | <a class="input-submit" href="index.php?page=setup">'.l10n('Config').'</a> |
---|
| 112 | </div>'; |
---|
[7988] | 113 | } |
---|
[9201] | 114 | |
---|
| 115 | } else if ($PAGE == 'setup') { |
---|
| 116 | if (isset($ERRORS['fatal'])) { |
---|
| 117 | $PAGE_CONTENT[2] .= '<div class="generic link"><a class="input-submit" href="index.php">'.l10n('Back').'</a></div>'; |
---|
[7988] | 118 | |
---|
[9201] | 119 | } else { |
---|
| 120 | include('include/setup.php'); |
---|
| 121 | } |
---|
[8195] | 122 | |
---|
[9201] | 123 | } else if ($PAGE = 'process') { |
---|
| 124 | ### Affichage des fichiers traités ### |
---|
[9276] | 125 | $PAGE_CONTENT[0] .= ' |
---|
| 126 | <div class="generic files"> |
---|
[8195] | 127 | <h2>'.l10n('Source files').'</h2> |
---|
| 128 | <ul>'; |
---|
| 129 | foreach ($FilesSource as $value) { |
---|
[9201] | 130 | $PAGE_CONTENT[0] .= '<li>'.$value.'</li>'; |
---|
[8195] | 131 | } |
---|
[9201] | 132 | $PAGE_CONTENT[0] .= '</ul> |
---|
[8195] | 133 | <i>'.l10n('%d files', count($FilesSource)).'</i> |
---|
| 134 | </div>'; |
---|
[7988] | 135 | |
---|
[7991] | 136 | unset($FilesSource); |
---|
| 137 | unset($FilesSortie); |
---|
| 138 | |
---|
[9276] | 139 | $PAGE_CONTENT[2] .= ' |
---|
| 140 | <div class="generic finish">'.l10n('Finish %d seconds', intval((microtime(true)-$TIME_START))).'</div> |
---|
[9201] | 141 | <div class="generic link"> |
---|
| 142 | <a class="input-submit" href="index.php">'.l10n('Back').'</a> |
---|
| 143 | <a class="input-submit" href="index.php?page=setup">'.l10n('Config').'</a> |
---|
| 144 | </div>'; |
---|
[7988] | 145 | } |
---|
| 146 | |
---|
[8195] | 147 | |
---|
[9201] | 148 | ### FIN ### |
---|
| 149 | echo $PAGE_CONTENT[0]; |
---|
| 150 | echo $PAGE_CONTENT[1]; |
---|
| 151 | echo $PAGE_CONTENT[2]; |
---|
[8195] | 152 | |
---|
[9276] | 153 | echo ' |
---|
| 154 | <div class="generic footer"> |
---|
[9202] | 155 | 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> |
---|
[8195] | 156 | </div> |
---|
| 157 | |
---|
| 158 | </body> |
---|
[7988] | 159 | </html>'; |
---|
| 160 | ?> |
---|