Changeset 12578


Ignore:
Timestamp:
Nov 7, 2011, 3:20:05 PM (13 years ago)
Author:
flop25
Message:

BIGINT for id

Location:
extensions/music_player
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/music_player/class.inc.php

    r11627 r12578  
    3737         if (isset($conf_plugin)) {
    3838                $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>');
    4040          }
    4141  }
  • extensions/music_player/maintain.inc.php

    r9590 r12578  
    33function plugin_install()
    44{
    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);
    630
    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);
    5536}
    5637
     
    5940function plugin_activate()
    6041{
    61     global $prefixeTable;
     42  global $prefixeTable;
    6243
    6344///[ update from 1.2 ]
    64     $q = pwg_query('SHOW COLUMNS FROM '.$prefixeTable.'mp_playlist');
    65     $champ = array();
    66         while ($rep = mysql_fetch_row($q))
    67         {
    68         array_push($champ, $rep[0]);
    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  }
    7051
    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);
    7377    }
    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  }
    9879///[\]
    9980
    100    $query = '
     81 $query = '
    10182SELECT COUNT(*) AS result FROM '.CONFIG_TABLE.'
    102   WHERE param IN (\'mp_lecteur\')
     83WHERE param IN (\'mp_lecteur\')
    10384;';
    104    $data_table = mysql_fetch_array(pwg_query($query));
    105    $exist = $data_table['result'];
    106    if ( $exist == 0 )
    107    {
    108     $q = '
     85 $data_table = mysql_fetch_array(pwg_query($query));
     86 $exist = $data_table['result'];
     87 if ( $exist == 0 )
     88 {
     89  $q = '
    10990INSERT 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");';
    112     pwg_query($q);
    113    }
    114    else {
    115       $query = '
     91VALUES
     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 = '
    11697SELECT value FROM '.CONFIG_TABLE.'
    117   WHERE param IN (\'mp_lecteur\')
     98WHERE param IN (\'mp_lecteur\')
    11899;';
    119    $data_conf = mysql_fetch_array(pwg_query($query));
    120    $conf=explode(',', $data_conf['value']);
    121    $nbr=count($conf);
    122   
    123      if ($nbr!=11 or $conf[9]=='lecteur.css')// pour update depuis 2.1.0
    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    {
    125106      pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN (\'mp_lecteur\')');
    126107      pwg_query($q);
    127           $q = '
    128 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
    129         VALUES
    130         ("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");';
     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");';
    131112      pwg_query($q);
    132      }
    133113   }
    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  {
    144125    $q = '
    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");';
     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");';
    148129    pwg_query($q);
    149130  }
    150    else {
    151       $query = '
    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      if ($nbr!=5)
    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    {
    161142      pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN (\'mp_plugin\')');
    162143      pwg_query($q);
    163144      $q = '
    164 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
    165         VALUES
    166         ("mp_plugin" , "true,false,false,260,400" , "Plugin music_player : evidence, header, footer, hauteur, largeur");';
     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");';
    167148      pwg_query($q);
    168      }
    169    }
    170        
     149    }
     150  }
     151 
    171152}//fin active
    172153
     
    176157function plugin_uninstall()
    177158{
    178     global $prefixeTable;
    179 
     159  global $prefixeTable;
     160 
    180161  $q = 'DROP TABLE ' . $prefixeTable . 'mp_playlist;';
    181162  pwg_query($q);
Note: See TracChangeset for help on using the changeset viewer.