source: extensions/pdf2tab/install/functions.inc.php @ 20203

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

[pdf2tab] fix in admin

  • 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 array default parameters
5 */
6function pdf2tab_install($config) {
7        $query = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("pdf2tab" ,"'.pwg_db_real_escape_string(serialize($config)).'", "PDF2Tab plugin parameters");';
8        pwg_query($query);
9}
10
11/**
12 * update the config entry if new default parameters have been added since last version
13 */
14function pdf2tab_update_db() {
15        global $conf;
16        include(dirname(__FILE__).'/config_default.inc.php');
17
18        $config = array();
19        if (isset($conf['pdf2tab']))
20                $conf_pdf2tab = unserialize($conf['pdf2tab']);
21       
22        if (isset($conf_pdf2tab)) {
23                foreach ($config_default as $key => $value) {
24                        if (isset($conf_pdf2tab[$key]))
25                                $config[$key] = $conf_pdf2tab[$key];
26                        else
27                                $config[$key] = $config_default[$key];
28                }
29                pdf2tab_delete_conf("pdf2tab");
30                pdf2tab_install($config);
31        } else {
32                pdf2tab_install($config_default);
33        }
34}
35
36/**
37 * delete an entry from the config table
38 * @param string the param entry to delete
39 */
40function pdf2tab_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.