Last change
on this file since 31551 was
20255,
checked in by julien1311, 12 years ago
|
[pdf2tab] comment modification
|
-
Property svn:eol-style set to
LF
|
File size:
1.1 KB
|
Rev | Line | |
---|
[19811] | 1 | <?php |
---|
[20203] | 2 | /** |
---|
| 3 | * create the entry in the config table |
---|
[20255] | 4 | * @param string default parameters |
---|
[20203] | 5 | */ |
---|
[19811] | 6 | function 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 | |
---|
[20203] | 11 | /** |
---|
| 12 | * update the config entry if new default parameters have been added since last version |
---|
| 13 | */ |
---|
[19811] | 14 | function 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 | |
---|
[20203] | 36 | /** |
---|
| 37 | * delete an entry from the config table |
---|
| 38 | * @param string the param entry to delete |
---|
| 39 | */ |
---|
[19811] | 40 | function 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.