Changeset 12578
- Timestamp:
- Nov 7, 2011, 3:20:05 PM (13 years ago)
- Location:
- extensions/music_player
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/music_player/class.inc.php
r11627 r12578 37 37 if (isset($conf_plugin)) { 38 38 $template->concat( 'PLUGIN_INDEX_ACTIONS', 39 '<li><a href="javascript:void(0)" onClick="window.open(\''.get_root_url().'plugins/'.$this->plugin_name.'/lecteur.php\',\'musique\',\'width='.$conf_plugin[4].',height='.$conf_plugin[3].',top=400,left=400,toolbar=no,location=no,menubar=no,resizable=yes,status=no,alwaysRaised=yes\')" ><img src="'.get_root_url().'plugins/'.$this->plugin_name.'/template/icon/icon32.png" width="26" height="26" alt="Music Player" title="Play Music" class="button" /></a></li>');39 '<li><a href="javascript:void(0)" title="Play Music" onClick="window.open(\''.get_root_url().'plugins/'.$this->plugin_name.'/lecteur.php\',\'musique\',\'width='.$conf_plugin[4].',height='.$conf_plugin[3].',top=400,left=400,toolbar=no,location=no,menubar=no,resizable=yes,status=no,alwaysRaised=yes\')" ><img src="'.get_root_url().'plugins/'.$this->plugin_name.'/template/icon/icon32.png" width="26" height="26" alt="Music Player" class="button" /></a></li>'); 40 40 } 41 41 } -
extensions/music_player/maintain.inc.php
r9590 r12578 3 3 function plugin_install() 4 4 { 5 global $prefixeTable; 5 global $prefixeTable; 6 $q = 'CREATE TABLE ' . $prefixeTable . 'mp_playlist ( 7 id BIGINT NOT NULL AUTO_INCREMENT , 8 type VARCHAR( 50 ) NOT NULL , 9 url VARCHAR( 255 ) NOT NULL , 10 texte TINYTEXT NOT NULL , 11 PRIMARY KEY ( id ) 12 ); 13 '; 14 pwg_query($q); 15 $q = 'CREATE TABLE ' . $prefixeTable . 'mp_music ( 16 id BIGINT NOT NULL AUTO_INCREMENT , 17 pl_id BIGINT NOT NULL , 18 rang BIGINT NOT NULL , 19 url VARCHAR( 255 ) NOT NULL , 20 nom VARCHAR( 255 ) NOT NULL , 21 PRIMARY KEY ( id ) 22 ); 23 '; 24 pwg_query($q); 25 $q = ' 26 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) 27 VALUES 28 ("mp_lecteur" , "148,300,128,true,128,false,list,0,true,./template/style/default.conf.php,true" , "Lecteur config : haut tt, larg tt, haut pl, miniature, larg min, shuffle, repeat, autostart, autoscroll, style, style pour chaque thème");'; 29 pwg_query($q); 6 30 7 8 $q = 'CREATE TABLE ' . $prefixeTable . 'mp_playlist ( 9 id SMALLINT NOT NULL AUTO_INCREMENT , 10 type VARCHAR( 50 ) NOT NULL , 11 url VARCHAR( 255 ) NOT NULL , 12 texte TINYTEXT NOT NULL , 13 PRIMARY KEY ( id ) 14 ); 15 '; 16 pwg_query($q); 17 $q = 'CREATE TABLE ' . $prefixeTable . 'mp_music ( 18 id TINYINT NOT NULL AUTO_INCREMENT , 19 pl_id TINYINT NOT NULL , 20 rang TINYINT NOT NULL , 21 url VARCHAR( 255 ) NOT NULL , 22 nom VARCHAR( 255 ) NOT NULL , 23 PRIMARY KEY ( id ) 24 ); 25 '; 26 pwg_query($q); 27 28 /* $q = 'CREATE TABLE ' . $prefixeTable . 'mp_playlist ( 29 id TINYINT NOT NULL AUTO_INCREMENT , 30 url VARCHAR( 255 ) NOT NULL , 31 texte TINYTEXT NOT NULL , 32 music MEDIUMTEXT NOT NULL , 33 PRIMARY KEY ( id ) 34 ); 35 '; 36 $q = 'CREATE TABLE ' . $prefixeTable . 'mp_config_save ( 37 id TINYINT NOT NULL AUTO_INCREMENT , 38 type VARCHAR( 255 ) NOT NULL , 39 config TINYTEXT NOT NULL , 40 PRIMARY KEY ( id ) 41 ); 42 ';*/ 43 44 $q = ' 45 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) 46 VALUES 47 ("mp_lecteur" , "148,300,128,true,128,false,list,0,true,./template/style/default.conf.php,true" , "Lecteur config : haut tt, larg tt, haut pl, miniature, larg min, shuffle, repeat, autostart, autoscroll, style, style pour chaque thème");'; 48 pwg_query($q); 49 50 $q = ' 51 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) 52 VALUES 53 ("mp_plugin" , "true,false,false,260,400" , "Plugin music_player : evidence, header, footer, hauteur, largeur");'; 54 pwg_query($q); 31 $q = ' 32 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) 33 VALUES 34 ("mp_plugin" , "true,false,false,260,400" , "Plugin music_player : evidence, header, footer, hauteur, largeur");'; 35 pwg_query($q); 55 36 } 56 37 … … 59 40 function plugin_activate() 60 41 { 61 42 global $prefixeTable; 62 43 63 44 ///[ update from 1.2 ] 64 65 66 67 68 69 45 $q = pwg_query('SHOW COLUMNS FROM '.$prefixeTable.'mp_playlist'); 46 $champ = array(); 47 while ($rep = mysql_fetch_row($q)) 48 { 49 array_push($champ, $rep[0]); 50 } 70 51 71 if (!in_array('type', $champ)) { 72 pwg_query('ALTER TABLE '.$prefixeTable.'mp_playlist ADD type VARCHAR( 50 ) NOT NULL AFTER id '); 52 if (!in_array('type', $champ)) { 53 pwg_query('ALTER TABLE '.$prefixeTable.'mp_playlist ADD type VARCHAR( 50 ) NOT NULL AFTER id '); 54 } 55 //ALTER TABLE `phpwebgallery_mp_playlist` ADD `type` VARCHAR( 50 ) NOT NULL AFTER `id` ; 56 $query = ' 57 SELECT COUNT(*) AS result FROM '.$prefixeTable.'mp_playlist 58 WHERE type="" 59 ;'; 60 $data_table = mysql_fetch_array(pwg_query($query)); 61 $exist = $data_table['result']; 62 if ( $exist != 0 ) 63 { 64 $query = ' 65 SELECT id FROM '.$prefixeTable.'mp_playlist 66 WHERE type="" 67 ;'; 68 $result = pwg_query($query); 69 while ($data = mysql_fetch_assoc($result)) 70 { 71 $query = ' 72 UPDATE '.$prefixeTable.'mp_playlist 73 SET type="local" 74 WHERE id="'.$data['id'].'" 75 LIMIT 1'; 76 pwg_query($query); 73 77 } 74 //ALTER TABLE `phpwebgallery_mp_playlist` ADD `type` VARCHAR( 50 ) NOT NULL AFTER `id` ; 75 $query = ' 76 SELECT COUNT(*) AS result FROM '.$prefixeTable.'mp_playlist 77 WHERE type="" 78 ;'; 79 $data_table = mysql_fetch_array(pwg_query($query)); 80 $exist = $data_table['result']; 81 if ( $exist != 0 ) 82 { 83 $query = ' 84 SELECT id FROM '.$prefixeTable.'mp_playlist 85 WHERE type="" 86 ;'; 87 $result = pwg_query($query); 88 while ($data = mysql_fetch_assoc($result)) 89 { 90 $query = ' 91 UPDATE '.$prefixeTable.'mp_playlist 92 SET type="local" 93 WHERE id="'.$data['id'].'" 94 LIMIT 1'; 95 pwg_query($query); 96 } 97 } 78 } 98 79 ///[\] 99 80 100 81 $query = ' 101 82 SELECT COUNT(*) AS result FROM '.CONFIG_TABLE.' 102 83 WHERE param IN (\'mp_lecteur\') 103 84 ;'; 104 105 106 107 108 85 $data_table = mysql_fetch_array(pwg_query($query)); 86 $exist = $data_table['result']; 87 if ( $exist == 0 ) 88 { 89 $q = ' 109 90 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) 110 111 112 113 114 115 91 VALUES 92 ("mp_lecteur" , "148,300,128,true,128,false,list,0,true,./template/style/default.conf.php,true" , "Lecteur config : haut tt, larg tt, haut pl, miniature, larg min, shuffle, repeat, autostart, autoscroll, style, style pour chaque thème");'; 93 pwg_query($q); 94 } 95 else { 96 $query = ' 116 97 SELECT value FROM '.CONFIG_TABLE.' 117 98 WHERE param IN (\'mp_lecteur\') 118 99 ;'; 119 120 121 122 123 124 100 $data_conf = mysql_fetch_array(pwg_query($query)); 101 $conf=explode(',', $data_conf['value']); 102 $nbr=count($conf); 103 104 if ($nbr!=11 or $conf[9]=='lecteur.css')// pour update depuis 2.1.0 105 { 125 106 pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN (\'mp_lecteur\')'); 126 107 pwg_query($q); 127 128 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)129 130 108 $q = ' 109 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) 110 VALUES 111 ("mp_lecteur" , "148,300,128,true,128,false,list,0,true,./template/style/default.conf.php,true" , "Lecteur config : haut tt, larg tt, haut pl, miniature, larg min, shuffle, repeat, autostart, autoscroll, style, style pour chaque thème");'; 131 112 pwg_query($q); 132 }133 113 } 134 135 136 $query = ' 137 SELECT COUNT(*) AS result FROM '.CONFIG_TABLE.' 138 WHERE param IN (\'mp_plugin\') 139 ;'; 140 $data_table = mysql_fetch_array(pwg_query($query)); 141 $exist = $data_table['result']; 142 if ( $exist == 0 ) 143 { 114 } 115 116 117 $query = ' 118 SELECT COUNT(*) AS result FROM '.CONFIG_TABLE.' 119 WHERE param IN (\'mp_plugin\') 120 ;'; 121 $data_table = mysql_fetch_array(pwg_query($query)); 122 $exist = $data_table['result']; 123 if ( $exist == 0 ) 124 { 144 125 $q = ' 145 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)146 147 126 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) 127 VALUES 128 ("mp_plugin" , "true,false,false,260,400" , "Plugin music_player : evidence, header, footer, hauteur, largeur");'; 148 129 pwg_query($q); 149 130 } 150 151 152 SELECT value FROM '.CONFIG_TABLE.'153 WHERE param IN (\'mp_plugin\')154 ;';155 $data_conf = mysql_fetch_array(pwg_query($query));156 $conf=explode(',', $data_conf['value']);157 $nbr=count($conf);158 159 160 131 else { 132 $query = ' 133 SELECT value FROM '.CONFIG_TABLE.' 134 WHERE param IN (\'mp_plugin\') 135 ;'; 136 $data_conf = mysql_fetch_array(pwg_query($query)); 137 $conf=explode(',', $data_conf['value']); 138 $nbr=count($conf); 139 140 if ($nbr!=5) 141 { 161 142 pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN (\'mp_plugin\')'); 162 143 pwg_query($q); 163 144 $q = ' 164 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)165 166 145 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) 146 VALUES 147 ("mp_plugin" , "true,false,false,260,400" , "Plugin music_player : evidence, header, footer, hauteur, largeur");'; 167 148 pwg_query($q); 168 169 170 149 } 150 } 151 171 152 }//fin active 172 153 … … 176 157 function plugin_uninstall() 177 158 { 178 179 159 global $prefixeTable; 160 180 161 $q = 'DROP TABLE ' . $prefixeTable . 'mp_playlist;'; 181 162 pwg_query($q);
Note: See TracChangeset
for help on using the changeset viewer.