[6912] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
| 3 | // | Piwigo - a PHP based picture gallery | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
| 5 | // | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org | |
---|
| 6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
| 7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
| 8 | // +-----------------------------------------------------------------------+ |
---|
| 9 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 10 | // | it under the terms of the GNU General Public License as published by | |
---|
| 11 | // | the Free Software Foundation | |
---|
| 12 | // | | |
---|
| 13 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 16 | // | General Public License for more details. | |
---|
| 17 | // | | |
---|
| 18 | // | You should have received a copy of the GNU General Public License | |
---|
| 19 | // | along with this program; if not, write to the Free Software | |
---|
| 20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 21 | // | USA. | |
---|
| 22 | // +-----------------------------------------------------------------------+ |
---|
| 23 | |
---|
| 24 | if (!defined('AUTOSIZE_PATH')) |
---|
| 25 | define( |
---|
[7193] | 26 | 'AUTOSIZE_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/' |
---|
[6912] | 27 | ); |
---|
| 28 | |
---|
| 29 | function plugin_install() |
---|
| 30 | { |
---|
| 31 | global $conf; |
---|
[17503] | 32 | if (!isset($conf['cl_autosize'])){ |
---|
[6912] | 33 | $q = ' |
---|
| 34 | INSERT INTO '.CONFIG_TABLE.' (param, value, comment) |
---|
| 35 | VALUES ("cl_autosize","","Parametres du plugin Autosize") |
---|
| 36 | ;'; |
---|
| 37 | pwg_query($q); |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | |
---|
[17503] | 45 | function plugin_uninstall(){ |
---|
[6912] | 46 | global $conf; |
---|
| 47 | if (isset($conf['cl_autosize'])) |
---|
| 48 | { |
---|
| 49 | $q = ' |
---|
| 50 | DELETE FROM '.CONFIG_TABLE.' |
---|
| 51 | WHERE param="cl_autosize" |
---|
| 52 | ;'; |
---|
| 53 | pwg_query($q); |
---|
| 54 | } |
---|
| 55 | $query = 'DROP TABLE IF EXISTS '.CL_AUTOSIZE_TABLE.';'; |
---|
| 56 | pwg_query( $query); |
---|
| 57 | } |
---|
| 58 | |
---|
[17503] | 59 | function plugin_deactivate(){ |
---|
| 60 | global $conf ; |
---|
[18127] | 61 | |
---|
[17503] | 62 | if (isset($conf['cl_derivatives_sav'])) { |
---|
| 63 | $arr = @unserialize($conf['cl_derivatives_sav']); |
---|
| 64 | if(isset($arr['d'])){ |
---|
[18127] | 65 | $conf['derivatives'] = $conf['cl_derivatives_sav']; |
---|
[17503] | 66 | $query = ' |
---|
| 67 | UPDATE '.CONFIG_TABLE.' |
---|
| 68 | SET value="'.addslashes(serialize($arr)).'" |
---|
| 69 | WHERE param = "derivatives" |
---|
| 70 | LIMIT 1'; |
---|
| 71 | pwg_query($query); |
---|
| 72 | |
---|
| 73 | $q = 'DELETE FROM '.CONFIG_TABLE.' WHERE param="cl_derivatives_sav" ;'; |
---|
| 74 | pwg_query($q); |
---|
| 75 | } |
---|
[18127] | 76 | } |
---|
| 77 | $model= $conf['derivative_default_size']; |
---|
| 78 | $_COOKIE ['picture_deriv'] = $model; |
---|
| 79 | $_COOKIE ['picture_map'] = $model; |
---|
| 80 | pwg_set_session_var('picture_deriv', $model); |
---|
| 81 | |
---|
[17503] | 82 | } |
---|
| 83 | |
---|
| 84 | function plugin_activate(){ |
---|
| 85 | global $conf ; |
---|
| 86 | if (isset($conf['derivatives'])) { |
---|
| 87 | $arr = @unserialize($conf['derivatives']); |
---|
| 88 | if(isset($arr['d'])){ |
---|
| 89 | if (!isset($conf['cl_derivatives_sav'])){ |
---|
| 90 | $q = 'INSERT INTO '.CONFIG_TABLE.' (param, value, comment) |
---|
| 91 | VALUES ("cl_derivatives_sav","","derivatives save") |
---|
| 92 | ;'; |
---|
| 93 | pwg_query($q); |
---|
| 94 | |
---|
| 95 | $query = ' |
---|
| 96 | UPDATE '.CONFIG_TABLE.' |
---|
| 97 | SET value="'.addslashes(serialize($arr)).'" |
---|
| 98 | WHERE param = "cl_derivatives_sav" |
---|
| 99 | LIMIT 1'; |
---|
| 100 | pwg_query($query); |
---|
| 101 | |
---|
| 102 | $arr = @unserialize($conf['derivatives']); |
---|
| 103 | if(!isset($arr['d']['Autosize'])){ |
---|
| 104 | $arr['d']['SelMaxi']=ImageStdParams::get_custom(9,9); |
---|
| 105 | $arr['d']['Autosize']=ImageStdParams::get_custom(10, 10); |
---|
| 106 | $conf['derivatives']=serialize($arr); |
---|
| 107 | $arr = @unserialize($conf['derivatives']); |
---|
| 108 | $query = ' |
---|
| 109 | UPDATE '.CONFIG_TABLE.' |
---|
| 110 | SET value="'.addslashes(serialize($arr)).'" |
---|
| 111 | WHERE param = "derivatives" |
---|
| 112 | LIMIT 1'; |
---|
| 113 | pwg_query($query); |
---|
| 114 | } |
---|
| 115 | } |
---|
| 116 | } |
---|
| 117 | } |
---|
| 118 | } |
---|
| 119 | |
---|
[6912] | 120 | ?> |
---|