source: extensions/Mobile_Theme_for_Tablets/install/functions.inc.php @ 31810

Last change on this file since 31810 was 20256, checked in by julien1311, 11 years ago

[mobile_theme_for_tablets] small changes

  • Property svn:eol-style set to LF
File size: 1.1 KB
Line 
1<?php
2/**
3 * create the entry in the config table
4 * @param string default parameters
5 */
6function mtt_install($config) {
7        $query = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("mobile_theme_for_tablets" ,"'.pwg_db_real_escape_string(serialize($config)).'", "Mobile Theme for Tablets plugin parameters");';
8        pwg_query($query);
9}
10
11/**
12 * update the config when plugin is activated or updated
13 */
14function mtt_update_db() {
15        global $conf;
16        include(dirname(__FILE__).'/config_default.inc.php');
17
18        $config = array();
19        if (isset($conf['mobile_theme_for_tablets']))
20                $conf_mtt = unserialize($conf['mobile_theme_for_tablets']);
21       
22        if (isset($conf_mtt)) {
23                foreach ($config_default as $key => $value) {
24                        if (isset($conf_mtt[$key]))
25                                $config[$key] = $conf_mtt[$key];
26                        else
27                                $config[$key] = $config_default[$key];
28                }
29                mtt_delete_conf("mobile_theme_for_tablets");
30                mtt_install($config);
31        } else {
32                mtt_install($config_default);
33        }
34}
35
36/**
37 * delete the config
38 * @param string param column of the table
39 */
40function mtt_delete_conf($where) {
41        $query = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE (param="'.$where.'");';
42        pwg_query($query);
43}
44?>
Note: See TracBrowser for help on using the repository browser.