Changeset 9745 for extensions/ContestResults/maintain.inc.php
- Timestamp:
- Mar 17, 2011, 8:25:13 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ContestResults/maintain.inc.php
r9572 r9745 14 14 'menubar_block' => array( 15 15 'number' => 5 16 ) 16 ), 17 'truncate_summary' => 350, 17 18 ))); 18 19 19 // Install tion20 // Installation 20 21 function plugin_install() { 21 22 global $prefixeTable; … … 29 30 `logo` VARCHAR( 255 ) NULL , 30 31 `banner` VARCHAR( 255 ) NULL , 32 `summary` TEXT NULL , 31 33 `description` TEXT NULL , 32 34 PRIMARY KEY ( `id` ) 33 ) ;");35 ) DEFAULT CHARSET=utf8;"); 34 36 35 37 pwg_query("CREATE TABLE `" . $prefixeTable . "contests_results` ( … … 40 42 `comment` TEXT NULL, 41 43 UNIQUE ( `image_id` , `contest_id` ) 42 ) ;");44 ) DEFAULT CHARSET=utf8;"); 43 45 44 46 pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('ContestResults', '" . default_config . "', 'Parametres du plugin ContestResults');"); … … 49 51 global $conf, $prefixeTable; 50 52 51 // compatibilité avec les versions < 1.1 (ajout d'une entrée de configuration) 52 if (!isset($conf['ContestResults'])) { 53 pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('ContestResults', '" . default_config . "', 'Parametres du plugin ContestResults');"); 54 } 55 56 // compatibilité avec les versions < 1.2 (suppression option d'affichage) 57 $field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'presentation_display'"); 58 if (pwg_db_num_rows($field)) { 59 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` 60 DROP `presentation_display`, 61 DROP `rules_display`, 62 DROP `prices_display`, 63 DROP `final_display`;" 64 ); 65 } 66 67 // compatibilité avec les versions < 1.3 (suppression option status, regroupement des champs de description) 68 $field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'status'"); 69 if (pwg_db_num_rows($field)) { 70 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `status`"); 71 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` ADD `description` TEXT NULL"); 72 73 $contests = pwg_query("SELECT * FROM `" . $prefixeTable . "contests`"); 74 while ($contest = pwg_db_fetch_assoc($contests)) { 75 $new_description = array(); 76 if (!empty($contest['presentation'])) { 77 $new_description[] = array( 78 'name' => 'Presentation[lang=fr]Présentation[/lang][lang=es]Presentación[/lang][lang=lv]Prezentacija[/lang]', 79 'content' => $contest['presentation'], 80 ); 81 } 82 if (!empty($contest['rules'])) { 83 $new_description[] = array( 84 'name' => 'Rules[lang=fr]Règles[/lang][lang=es]Restricciones[/lang][lang=lv]Noteikumi[/lang]', 85 'content' => $contest['rules'], 86 ); 87 } 88 if (!empty($contest['prices'])) { 89 $new_description[] = array( 90 'name' => 'Prices[lang=fr]Prix[/lang][lang=es]Precios[/lang][lang=lv]Cenas[/lang]', 91 'content' => $contest['prices'], 92 ); 93 } 94 if (!empty($contest['final'])) { 95 $new_description[] = array( 96 'name' => 'Conclusion[lang=fr]Conclusion[/lang][lang=es]Conclusión[/lang][lang=lv]Beigsana[/lang]', 97 'content' => $contest['final'], 98 ); 99 } 100 101 $new_description = base64_encode(serialize($new_description)); 102 pwg_query("UPDATE `" . $prefixeTable . "contests` 103 SET description = '". $new_description ."' 104 WHERE id = ". $contest['id'] .";" 105 ); 106 } 107 108 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` 109 DROP `presentation`, 110 DROP `rules`, 111 DROP `prices`, 112 DROP `final`;" 113 ); 114 } 115 53 include('include/compatibility.inc.php'); 116 54 } 117 55
Note: See TracChangeset
for help on using the changeset viewer.