Last change
on this file since 26282 was
20256,
checked in by julien1311, 12 years ago
|
[mobile_theme_for_tablets] small changes
|
-
Property svn:eol-style set to
LF
|
File size:
1.1 KB
|
Rev | Line | |
---|
[19815] | 1 | <?php |
---|
[20256] | 2 | /** |
---|
| 3 | * create the entry in the config table |
---|
| 4 | * @param string default parameters |
---|
| 5 | */ |
---|
[19815] | 6 | function 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 | |
---|
[20256] | 11 | /** |
---|
| 12 | * update the config when plugin is activated or updated |
---|
| 13 | */ |
---|
[19815] | 14 | function 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 | |
---|
[20256] | 36 | /** |
---|
| 37 | * delete the config |
---|
| 38 | * @param string param column of the table |
---|
| 39 | */ |
---|
[19815] | 40 | function 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.