From b071d8dc18a8b2e6aeff96a2e9208ac02653381e Mon Sep 17 00:00:00 2001 From: flop25 Date: Sat, 11 Jan 2014 15:35:00 +0000 Subject: smartpocket: Thememaintain class used in maintain.inc.php-> no more issue on 2.6 installation (tested) git-svn-id: http://piwigo.org/svn/trunk@26627 68402e56-0260-453c-a942-63ccdbb3a9ee --- themes/smartpocket/admin/maintain.inc.php | 58 ++++++++++++++++++++----------- themes/smartpocket/admin/upgrade.inc.php | 4 +-- 2 files changed, 39 insertions(+), 23 deletions(-) (limited to 'themes') diff --git a/themes/smartpocket/admin/maintain.inc.php b/themes/smartpocket/admin/maintain.inc.php index 2af937d38..d3beb4873 100644 --- a/themes/smartpocket/admin/maintain.inc.php +++ b/themes/smartpocket/admin/maintain.inc.php @@ -1,29 +1,45 @@ true,//true - false + 'autohide' => 5000,//5000 - 0 + ); + + function activate($theme_version, &$errors=array()) { - $config = array( - 'loop' => true,//true - false - 'autohide' => 5000,//5000 - 0 - ); - - $query = " -INSERT INTO " . CONFIG_TABLE . " (param,value,comment) -VALUES ('smartpocket' , '".pwg_db_real_escape_string(serialize($config))."' , 'loop#autohide');"; - pwg_query($query); + global $conf, $prefixeTable; + + if (empty($conf['smartpocket'])) + { + $conf['smartpocket'] = serialize($this->default_conf); + $query = " + INSERT INTO " . CONFIG_TABLE . " (param,value,comment) + VALUES ('smartpocket' , '".pwg_db_real_escape_string($conf['smartpocket'])."' , 'loop#autohide');"; + pwg_query($query); + } + elseif (count(unserialize( $conf['smartpocket'] ))!=2) + { + $conff=unserialize($conf['smartpocket']); + $config = array( + 'loop' => (!empty($conff['loop'])) ? $conff['loop'] :true, + 'autohide' => (!empty($conff['autohide'])) ? $conff['autohide'] :5000, + ); + conf_update_param('smartpocket', pwg_db_real_escape_string(serialize($config))); + load_conf_from_db(); + } + $this->installed = true; } -} -function theme_delete() -{ - global $prefixeTable; + function deactivate() + { } - $query = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="smartpocket" ;'; - pwg_query($query); + function delete() + { + // delete configuration + conf_delete_param('smartpocket'); + } } - ?> \ No newline at end of file diff --git a/themes/smartpocket/admin/upgrade.inc.php b/themes/smartpocket/admin/upgrade.inc.php index 709cab495..1e1925d77 100644 --- a/themes/smartpocket/admin/upgrade.inc.php +++ b/themes/smartpocket/admin/upgrade.inc.php @@ -20,8 +20,8 @@ elseif (count(unserialize( $conf['smartpocket'] ))!=2) { $conff=unserialize($conf['smartpocket']); $config = array( - 'loop' => (isset($conff['loop'])) ? $conff['loop'] :true, - 'autohide' => (isset($conff['autohide'])) ? $conff['autohide'] :5000, + 'loop' => (!empty($conff['loop'])) ? $conff['loop'] :true, + 'autohide' => (!empty($conff['autohide'])) ? $conff['autohide'] :5000, ); conf_update_param('smartpocket', pwg_db_real_escape_string(serialize($config))); load_conf_from_db(); -- cgit v1.2.3