Changeset 26627


Ignore:
Timestamp:
Jan 11, 2014, 4:35:00 PM (7 years ago)
Author:
flop25
Message:

smartpocket: Thememaintain class used in maintain.inc.php-> no more issue on 2.6 installation (tested)

Location:
trunk/themes/smartpocket/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/themes/smartpocket/admin/maintain.inc.php

    r23718 r26627  
    11<?php
     2class smartpocket_maintain extends ThemeMaintain
     3{
     4  private $installed = false;
     5 
     6  private $default_conf = array(
     7    'loop'            => true,//true - false
     8    'autohide'            => 5000,//5000 - 0
     9  );
     10 
     11  function activate($theme_version, &$errors=array())
     12  {
     13    global $conf, $prefixeTable;
    214
    3 function theme_activate($id, $version, &$errors)
    4 {
    5   global $prefixeTable, $conf;
     15    if (empty($conf['smartpocket']))
     16    {
     17      $conf['smartpocket'] = serialize($this->default_conf);
     18      $query = "
     19  INSERT INTO " . CONFIG_TABLE . " (param,value,comment)
     20  VALUES ('smartpocket' , '".pwg_db_real_escape_string($conf['smartpocket'])."' , 'loop#autohide');";
     21      pwg_query($query);
     22    }
     23    elseif (count(unserialize( $conf['smartpocket'] ))!=2)
     24    {
     25      $conff=unserialize($conf['smartpocket']);
     26      $config = array(
     27        'loop'            => (!empty($conff['loop'])) ? $conff['loop'] :true,
     28        'autohide'            => (!empty($conff['autohide'])) ? $conff['autohide'] :5000,
     29      );
     30      conf_update_param('smartpocket', pwg_db_real_escape_string(serialize($config)));
     31      load_conf_from_db();
     32    }
     33    $this->installed = true;
     34  }
    635
    7   if (!isset($conf['smartpocket']))
     36  function deactivate()
     37  { }
     38
     39  function delete()
    840  {
    9     $config = array(
    10       'loop'            => true,//true - false
    11       'autohide'            => 5000,//5000 - 0
    12     );
    13      
    14     $query = "
    15 INSERT INTO " . CONFIG_TABLE . " (param,value,comment)
    16 VALUES ('smartpocket' , '".pwg_db_real_escape_string(serialize($config))."' , 'loop#autohide');";
    17     pwg_query($query);
     41    // delete configuration
     42    conf_delete_param('smartpocket');
    1843  }
    1944}
    20 
    21 function theme_delete()
    22 {
    23   global $prefixeTable;
    24 
    25   $query = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="smartpocket" ;';
    26   pwg_query($query);
    27 }
    28 
    2945?>
  • trunk/themes/smartpocket/admin/upgrade.inc.php

    r26620 r26627  
    2121  $conff=unserialize($conf['smartpocket']);
    2222  $config = array(
    23     'loop'            => (isset($conff['loop'])) ? $conff['loop'] :true,
    24     'autohide'            => (isset($conff['autohide'])) ? $conff['autohide'] :5000,
     23    'loop'            => (!empty($conff['loop'])) ? $conff['loop'] :true,
     24    'autohide'            => (!empty($conff['autohide'])) ? $conff['autohide'] :5000,
    2525  );
    2626  conf_update_param('smartpocket', pwg_db_real_escape_string(serialize($config)));
Note: See TracChangeset for help on using the changeset viewer.