[3305] | 1 | <?php |
---|
| 2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 3 | |
---|
| 4 | function plugin_install() |
---|
| 5 | { |
---|
[10983] | 6 | global $conf; |
---|
| 7 | |
---|
| 8 | $BBcode_default = array( |
---|
| 9 | 'b' => true, |
---|
| 10 | 'i' => true, |
---|
| 11 | 'u' => true, |
---|
| 12 | 's' => true, |
---|
| 13 | 'p' => true, |
---|
| 14 | 'center' => true, |
---|
| 15 | 'right' => true, |
---|
| 16 | 'quote' => true, |
---|
| 17 | 'ul' => true, |
---|
| 18 | 'ol' => true, |
---|
| 19 | 'img' => true, |
---|
| 20 | 'url' => true, |
---|
| 21 | 'email' => true, |
---|
| 22 | 'size' => true, |
---|
| 23 | 'color' => true, |
---|
| 24 | ); |
---|
[3305] | 25 | |
---|
[10983] | 26 | if (!isset($conf['bbcode_bar'])) |
---|
| 27 | { |
---|
| 28 | $q = "INSERT INTO " . CONFIG_TABLE . " (param,value,comment) |
---|
| 29 | VALUES ('bbcode_bar','" . serialize($BBcode_default) . "','Parametres BBCode Bar');"; |
---|
| 30 | pwg_query($q); |
---|
| 31 | } |
---|
[3305] | 32 | } |
---|
| 33 | |
---|
[9965] | 34 | function plugin_activate() |
---|
| 35 | { |
---|
[10983] | 36 | global $conf; |
---|
| 37 | |
---|
| 38 | if (strpos($conf['bbcode_bar'],',') !== false) |
---|
| 39 | { |
---|
| 40 | $conf_bbcode_bar = explode(',', $conf['bbcode_bar']); |
---|
| 41 | |
---|
| 42 | $new_bbcode_bar = array( |
---|
| 43 | 'b' => $conf_bbcode_bar[1] == '1' ? true : false, |
---|
| 44 | 'i' => $conf_bbcode_bar[2] == '1' ? true : false, |
---|
| 45 | 'u' => $conf_bbcode_bar[3] == '1' ? true : false, |
---|
| 46 | 's' => $conf_bbcode_bar[4] == '1' ? true : false, |
---|
| 47 | 'p' => $conf_bbcode_bar[0] == '1' ? true : false, |
---|
| 48 | 'center' => $conf_bbcode_bar[5] == '1' ? true : false, |
---|
| 49 | 'right' => $conf_bbcode_bar[6] == '1' ? true : false, |
---|
| 50 | 'quote' => $conf_bbcode_bar[9] == '1' ? true : false, |
---|
| 51 | 'ul' => $conf_bbcode_bar[7] == '1' ? true : false, |
---|
| 52 | 'ol' => $conf_bbcode_bar[8] == '1' ? true : false, |
---|
| 53 | 'img' => $conf_bbcode_bar[10] == '1' ? true : false, |
---|
| 54 | 'url' => $conf_bbcode_bar[11] == '1' ? true : false, |
---|
| 55 | 'email' => $conf_bbcode_bar[12] == '1' ? true : false, |
---|
| 56 | 'size' => $conf_bbcode_bar[13] == '1' ? true : false, |
---|
| 57 | 'color' => $conf_bbcode_bar[14] == '1' ? true : false, |
---|
| 58 | ); |
---|
| 59 | |
---|
| 60 | $q = "UPDATE " . CONFIG_TABLE . " |
---|
| 61 | SET value='" . serialize($new_bbcode_bar) . "' |
---|
| 62 | WHERE param='bbcode_bar';"; |
---|
| 63 | pwg_query($q); |
---|
| 64 | } |
---|
[9965] | 65 | } |
---|
| 66 | |
---|
[3305] | 67 | function plugin_uninstall() |
---|
| 68 | { |
---|
[10983] | 69 | global $conf; |
---|
[3305] | 70 | |
---|
[10983] | 71 | if (isset($conf['bbcode_bar'])) |
---|
| 72 | { |
---|
| 73 | pwg_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE param="bbcode_bar";'); |
---|
| 74 | } |
---|
[3305] | 75 | } |
---|
[9682] | 76 | |
---|
| 77 | ?> |
---|