Ignore:
Timestamp:
Mar 28, 2010, 7:17:31 PM (14 years ago)
Author:
grum
Message:

Update the plugin for compatibility with Piwigo 2.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/grum_plugins_classes-2/tables.class.inc.php

    r3395 r5424  
    1 <?php 
     1<?php
    22
    33/* -----------------------------------------------------------------------------
    44  class name: manage_tables
    5   class version: 1.4
    6   date: 2008-12-28
     5  class version: 1.5
     6  date: 2010-03-28
    77  ------------------------------------------------------------------------------
    8   author: grum at grum.dnsalias.com
     8  author: grum at piwigo.org
    99  << May the Little SpaceFrog be with you >>
    1010  ------------------------------------------------------------------------------
    11  
     11
    1212  this class provides base functions to manage tables while plugin installation
    1313    - constructor manage_tables($tables)
     
    3131                        + $resultbooelan option for return
    3232                    + add multi_queries($queries) function
    33                     + add import($filename) function 
     33                    + add import($filename) function
    3434  v1.4 - 2009-03-01 + PHP5 migration (use of public/protected/private)
    3535                    + export => DROP TABLE IF EXISTS
    3636                    + import => if DROP TABLE without IF EXISTS, add IF EXISTS
     37  v1.5 - 2010-03-28 + Uses piwigo pwg_db_* functions instead of mysql_* functions
    3738
    3839   -------------------------------------------------------------------------- */
     
    4647    $this->tables = $tables;
    4748  }
    48  
    49   /* 
     49
     50  /*
    5051      create tables
    5152      $tables_def is an array of SQL CREATE queries
    5253
    53       return true if everything is ok, otherwise tablename 
     54      return true if everything is ok, otherwise tablename
    5455  */
    5556  public function create_tables($tables_def)
     
    7172  }
    7273
    73   /* update tables definition 
     74  /* update tables definition
    7475     $tables_alteration : array of arrays
    7576      example :
     
    8182        "attribute2" => " ADD COLUMN `attribute2` text null default ''"));
    8283
    83       return true if no error, otherwise return table.fields of error 
     84      return true if no error, otherwise return table.fields of error
    8485  */
    8586  public function update_tables_fields($tables_alteration)
     
    9899      {
    99100        $columns=array();
    100         while($row=mysql_fetch_assoc($result))
    101         { 
    102           array_push($columns, $row['Field']); 
     101        while($row=pwg_db_fetch_assoc($result))
     102        {
     103          array_push($columns, $row['Field']);
    103104        }
    104105
     
    121122
    122123
    123   /* 
     124  /*
    124125      delete tables listed in $this->tables_list
    125126  */
     
    170171    if($result)
    171172    {
    172       while($row=mysql_fetch_row($result))
     173      while($row=pwg_db_fetch_row($result))
    173174      {
    174175        if(isset($list[$row[0]]))
     
    207208                  if empty, assume that all tables have to be exported
    208209      $infos : additional info written in exported file (as comment)
    209       $resultboolean : if true, result is true/false ; 
     210      $resultboolean : if true, result is true/false ;
    210211                       if false, if result, return a string with nfo about export
    211212  */
     
    295296        if($result)
    296297        {
    297           while($row=mysql_fetch_row($result))
     298          while($row=pwg_db_fetch_row($result))
    298299          {
    299300            $text.=sprintf("%s; -- EOQ\n", $row[1]);
     
    316317          {
    317318            $tmp=array();
    318             while($row=mysql_fetch_row($result))
     319            while($row=pwg_db_fetch_row($result))
    319320            {
    320321              $tmp[]=$row[0];
     
    323324          $colnames='('.implode(',', $tmp).')';
    324325        }
    325    
     326
    326327        $sql='SELECT * FROM '.$this->tables[$key];
    327328        $result=pwg_query($sql);
    328329        if($result)
    329330        {
    330           while($row=mysql_fetch_row($result))
     331          while($row=pwg_db_fetch_row($result))
    331332          {
    332333            foreach($row as $key2 => $val2)
     
    403404    execute multiple query
    404405      each query have to be separated by a "-- EOQ\n"
    405      
     406
    406407      $queries : sql queries
    407408  */
Note: See TracChangeset for help on using the changeset viewer.