[9745] | 1 | <?php |
---|
| 2 | |
---|
[9788] | 3 | // compatibilité avec les versions < 1.1 (ajout d'une entrée de configuration) |
---|
[9745] | 4 | if (!isset($conf['ContestResults'])) { |
---|
| 5 | pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('ContestResults', '" . default_config . "', 'Parametres du plugin ContestResults');"); |
---|
| 6 | } |
---|
| 7 | |
---|
[9788] | 8 | // compatibilité avec les versions < 1.2 (suppression option d'affichage) |
---|
[9745] | 9 | $field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'presentation_display'"); |
---|
| 10 | if (pwg_db_num_rows($field)) { |
---|
| 11 | pwg_query("ALTER TABLE `" . $prefixeTable . "contests` |
---|
| 12 | DROP `presentation_display`, |
---|
| 13 | DROP `rules_display`, |
---|
| 14 | DROP `prices_display`, |
---|
| 15 | DROP `final_display`;" |
---|
| 16 | ); |
---|
| 17 | } |
---|
| 18 | |
---|
[9788] | 19 | // compatibilité avec les versions < 1.3.a (suppression option status, regroupement des champs de description) |
---|
[9745] | 20 | $field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'status'"); |
---|
| 21 | if (pwg_db_num_rows($field)) { |
---|
| 22 | pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `status`"); |
---|
| 23 | pwg_query("ALTER TABLE `" . $prefixeTable . "contests` ADD `description` TEXT NULL"); |
---|
| 24 | |
---|
| 25 | $contests = pwg_query("SELECT * FROM `" . $prefixeTable . "contests`"); |
---|
| 26 | while ($contest = pwg_db_fetch_assoc($contests)) { |
---|
| 27 | $new_description = array(); |
---|
| 28 | if (!empty($contest['presentation'])) { |
---|
| 29 | $new_description[] = array( |
---|
[9788] | 30 | 'name' => 'Presentation[lang=fr]Présentation[/lang][lang=es]Presentación[/lang][lang=lv]Prezentacija[/lang]', |
---|
[9745] | 31 | 'content' => $contest['presentation'], |
---|
| 32 | ); |
---|
| 33 | } |
---|
| 34 | if (!empty($contest['rules'])) { |
---|
| 35 | $new_description[] = array( |
---|
[9788] | 36 | 'name' => 'Rules[lang=fr]Règles[/lang][lang=es]Restricciones[/lang][lang=lv]Noteikumi[/lang]', |
---|
[9745] | 37 | 'content' => $contest['rules'], |
---|
| 38 | ); |
---|
| 39 | } |
---|
| 40 | if (!empty($contest['prices'])) { |
---|
| 41 | $new_description[] = array( |
---|
| 42 | 'name' => 'Prices[lang=fr]Prix[/lang][lang=es]Precios[/lang][lang=lv]Cenas[/lang]', |
---|
| 43 | 'content' => $contest['prices'], |
---|
| 44 | ); |
---|
| 45 | } |
---|
| 46 | if (!empty($contest['final'])) { |
---|
| 47 | $new_description[] = array( |
---|
[9788] | 48 | 'name' => 'Conclusion[lang=fr]Conclusion[/lang][lang=es]Conclusión[/lang][lang=lv]Beigsana[/lang]', |
---|
[9745] | 49 | 'content' => $contest['final'], |
---|
| 50 | ); |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | $new_description = base64_encode(serialize($new_description)); |
---|
| 54 | pwg_query("UPDATE `" . $prefixeTable . "contests` |
---|
| 55 | SET description = '". $new_description ."' |
---|
| 56 | WHERE id = ". $contest['id'] .";" |
---|
| 57 | ); |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | pwg_query("ALTER TABLE `" . $prefixeTable . "contests` |
---|
| 61 | DROP `presentation`, |
---|
| 62 | DROP `rules`, |
---|
| 63 | DROP `prices`, |
---|
| 64 | DROP `final`;" |
---|
| 65 | ); |
---|
| 66 | } |
---|
| 67 | |
---|
[9788] | 68 | // compatibilité avec les versions < 1.3.b (ajout d'un paramètre de config) |
---|
[9745] | 69 | $conf['ContestResults'] = unserialize($conf['ContestResults']); |
---|
| 70 | if (!isset($conf['ContestResults']['truncate_summary'])) { |
---|
| 71 | $conf['ContestResults']['truncate_summary'] = 350; |
---|
[9975] | 72 | $conf['ContestResults']['menubar_bloc']['display_days'] = true; |
---|
[9745] | 73 | pwg_query("UPDATE " . CONFIG_TABLE . " SET value='" . serialize($conf['ContestResults']) . "' WHERE param = 'ContestResults';"); |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | ?> |
---|