1 | <?php |
---|
2 | # ***** BEGIN LICENSE BLOCK ***** |
---|
3 | # |
---|
4 | # This file is part of Popularity Contest, a plugin for Dotclear 2 |
---|
5 | # Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) |
---|
6 | # |
---|
7 | # Popularity Contest is free software; you can redistribute it and/or |
---|
8 | # modify it under the terms of the GNU General Public License v2.0 |
---|
9 | # as published by the Free Software Foundation. |
---|
10 | # |
---|
11 | # Popularity Contest is distributed in the hope that it will be useful, |
---|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | # GNU General Public License for more details. |
---|
15 | # |
---|
16 | # You should have received a copy of the GNU General Public |
---|
17 | # License along with this program. If not, see |
---|
18 | # <http://www.gnu.org/licenses/>. |
---|
19 | # |
---|
20 | # Icon (icon.png) and images are from Silk Icons : |
---|
21 | # <http://www.famfamfam.com/lab/icons/silk/> |
---|
22 | # |
---|
23 | # ***** END LICENSE BLOCK ***** |
---|
24 | |
---|
25 | if (!defined('DC_CONTEXT_ADMIN')) {return;} |
---|
26 | |
---|
27 | # On lit la version du plugin |
---|
28 | $m_version = $core->plugins->moduleInfo('popularityContest','version'); |
---|
29 | |
---|
30 | # On lit la version du plugin dans la table des versions |
---|
31 | $i_version = $core->getVersion('popularityContest'); |
---|
32 | |
---|
33 | # La version dans la table est supérieure ou égale à |
---|
34 | # celle du module, on ne fait rien puisque celui-ci |
---|
35 | # est installé |
---|
36 | if (version_compare($i_version,$m_version,'>=')) {return;} |
---|
37 | |
---|
38 | # default settings |
---|
39 | $core->blog->settings->setNameSpace('popularitycontest'); |
---|
40 | # Time interval in seconds between sends to Popularity Contest : 3 days |
---|
41 | $core->blog->settings->put('popularityContest_time_interval', |
---|
42 | (3*24*3600),'integer', |
---|
43 | 'Time interval in seconds between sends to Popularity Contest', |
---|
44 | # don't replace old value, global setting |
---|
45 | false,true); |
---|
46 | # Popularity Contest last report |
---|
47 | $core->blog->settings->put('popularityContest_last_report', |
---|
48 | strtotime('-1 month'),'integer', |
---|
49 | 'Popularity Contest last report (Unix timestamp)',false,true); |
---|
50 | # Popularity Contest last try |
---|
51 | $core->blog->settings->put('popularityContest_last_try', |
---|
52 | strtotime('-1 month'),'integer', |
---|
53 | 'Popularity Contest last try (Unix timestamp)',false,true); |
---|
54 | # Hide plugins |
---|
55 | $core->blog->settings->put('popularityContest_hidden_plugins', |
---|
56 | base64_encode(serialize(array(''))),'text','Hidden plugins',false,true); |
---|
57 | $core->blog->settings->setNameSpace('system'); |
---|
58 | |
---|
59 | # remove the file to force its update |
---|
60 | if (file_exists(dirname(__FILE__).'/xml/plugins.xml')) |
---|
61 | { |
---|
62 | unlink(dirname(__FILE__).'/xml/plugins.xml'); |
---|
63 | } |
---|
64 | |
---|
65 | # La procédure d'installation commence vraiment là |
---|
66 | $core->setVersion('popularityContest',$m_version); |
---|
67 | return true; |
---|
68 | ?> |
---|