Changeset 5424


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

Update the plugin for compatibility with Piwigo 2.1

Location:
extensions/grum_plugins_classes-2
Files:
4 edited

Legend:

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

    r3679 r5424  
    22/* -----------------------------------------------------------------------------
    33  class name: common_plugin
    4   class version: 2.0.1
    5   date: 2009-07-24
     4  class version: 2.0.2
     5  date: 2010-03-28
    66
    77  ------------------------------------------------------------------------------
     
    3939  2.0.1     - 2009-07-24
    4040             config loader : better management for arrays items
     41  2.0.2     - 2010-03-28
     42  *           Uses piwigo pwg_db_* functions instead of mysql_* functions
    4143
    4244  --------------------------------------------------------------------------- */
     
    5355  protected $plugin_admin_file = "plugin_admin";
    5456  protected $tables;   // list of all tables names used by plugin
    55   private $debug_file; 
     57  private $debug_file;
    5658  public $my_config;     // array of config parameters
    5759
     
    8284
    8385  /* ---------------------------------------------------------------------------
    84      CONFIGURATION RELATED FUNCTIONS 
     86     CONFIGURATION RELATED FUNCTIONS
    8587  --------------------------------------------------------------------------- */
    8688
     
    100102    if($result)
    101103    {
    102       $row=mysql_fetch_row($result);
    103       if(is_string($row[0])) 
     104      $row=pwg_db_fetch_row($result);
     105      if(is_string($row[0]))
    104106      {
    105107        $config = unserialize($row[0]);
    106108        reset($config);
    107         while (list($key, $val) = each($config)) 
    108         { 
     109        while (list($key, $val) = each($config))
     110        {
    109111          if(is_array($val))
    110112          {
    111113            foreach($val as $key2 => $val2)
    112114            {
    113               $this->my_config[$key][$key2]=$val2; 
     115              $this->my_config[$key][$key2]=$val2;
    114116            }
    115117          }
    116118          else
    117119          {
    118             $this->my_config[$key] =$val; 
     120            $this->my_config[$key] =$val;
    119121          }
    120122        }
     
    126128  public function save_config()
    127129  {
    128     $sql="REPLACE INTO ".CONFIG_TABLE." 
     130    $sql="REPLACE INTO ".CONFIG_TABLE."
    129131           VALUES('".$this->plugin_name_files."_config', '"
    130            .serialize($this->my_config)."', '')"; 
     132           .serialize($this->my_config)."', '')";
    131133    $result=pwg_query($sql);
    132     if($result) 
    133     { return true; } 
    134     else 
     134    if($result)
     135    { return true; }
     136    else
    135137    { return false; }
    136138  }
     
    139141  public function delete_config()
    140142  {
    141     $sql="DELETE FROM ".CONFIG_TABLE." 
    142           WHERE param='".$this->plugin_name_files."_config'"; 
     143    $sql="DELETE FROM ".CONFIG_TABLE."
     144          WHERE param='".$this->plugin_name_files."_config'";
    143145    $result=pwg_query($sql);
    144     if($result) 
    145     { return true; } 
    146     else 
     146    if($result)
     147    { return true; }
     148    else
    147149    { return false; }
    148150  }
     
    166168
    167169  /* ---------------------------------------------------------------------------
    168      ADMINISTRATOR CONSOLE RELATED FUNCTIONS 
     170     ADMINISTRATOR CONSOLE RELATED FUNCTIONS
    169171  --------------------------------------------------------------------------- */
    170172
     
    208210      $fhandle=fopen($this->debug_file, "a");
    209211    }
    210    
     212
    211213    if($fhandle)
    212214    {
  • extensions/grum_plugins_classes-2/main.inc.php

    r4394 r5424  
    22/*
    33Plugin Name: Grum Plugins Classes.2
    4 Version: 2.0.4
     4Version: 2.0.5
    55Description: Collection de classes partagées entre mes plugins (existants, ou à venir) / Partaged classes between my plugins (actuals or futures)
    66Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=199
     
    2828| 2.0.3   | 2009/07/24 | * modify common_plugin class config loader (r2.0.1)
    2929| 2.0.4   | 2009/11/29 | * modify users class
    30 |         |            |
     30| 2.0.5   | 2010/03/28 | * Uses piwigo pwg_db_* functions instead of mysql_* functions
    3131|         |            |
    3232
     
    3939Classes version for this package
    4040    ajax.class.php -v2.0 + ajax.js -v1.0.1
    41     common_plugin.class.php -v2.0.1
     41    common_plugin.class.php -v2.0.2
    4242    css.class.php -v2.0
    4343    pages_navigation.class.php -v1.0
    4444    public_integration.class.php -v1.0
    45     tables.class.php -v1.4
     45    tables.class.php -v1.5
    4646    tabsheets.class.inc.php -v1.1
    4747    translate.class.inc.php -v2.0.0 + google_translate.js -v2.0.0
    48     users_groups.class.inc.php -v1.1
     48    users_groups.class.inc.php -v1.2
    4949    genericjs.class.inc.php -v1.0 + genericjs.js -v1.0
    5050
     
    5858define('GPC_PATH' , PHPWG_PLUGINS_PATH . GPC_DIR . '/');
    5959
    60 define('GPC_VERSION' , '2.0.4');
     60define('GPC_VERSION' , '2.0.5');
    6161
    6262/*
  • 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  */
  • extensions/grum_plugins_classes-2/users_groups.class.inc.php

    r4394 r5424  
    33/* -----------------------------------------------------------------------------
    44  class name: allowed_access, groups, users
    5   class version: 1.1
    6   date: 2007-10-31
     5  class version: 1.2
     6  date: 2010-03-28
    77  ------------------------------------------------------------------------------
    88  author: grum at piwog.org
     
    2727| release | date       |
    2828| 1.1     | 2009/11/29 | add 'webmaster' status for users
    29 |         |            |
     29| 1.2     | 2010/03/28 | Uses piwigo pwg_db_* functions instead of mysql_* functions
    3030|         |            |
    3131
     
    240240    if($result)
    241241    {
    242       while($row=mysql_fetch_assoc($result))
     242      while($row=pwg_db_fetch_assoc($result))
    243243      {
    244244        $this->access_list[$row['id']] =
Note: See TracChangeset for help on using the changeset viewer.