Dotclear

source: plugins/disclaimer/_install.php @ 2760

Revision 2760, 2.1 KB checked in by JcDenis, 13 years ago (diff)

disclaimer 0.6.1:

  • Fixed install on nightly build
  • Fixed some post fields
Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3# This file is part of disclaimer, a plugin for Dotclear 2.
4#
5# Copyright (c) 2009-2010 JC Denis and contributors
6# jcdenis@gdwd.com
7#
8# Licensed under the GPL version 2.0 license.
9# A copy of this license is available in LICENSE file or at
10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11# -- END LICENSE BLOCK ------------------------------------
12
13if (!defined('DC_CONTEXT_ADMIN')){return;}
14
15# Get new version
16$new_version = $core->plugins->moduleInfo('disclaimer','version');
17$old_version = $core->getVersion('disclaimer');
18
19# Compare versions
20if (version_compare($old_version,$new_version,'>=')) {return;}
21
22# Install or update
23try
24{
25     # Check DC version
26     if (version_compare(str_replace("-r","-p",DC_VERSION),'2.2-alpha','<'))
27     {
28          throw new Exception('disclaimer requires Dotclear 2.2');
29     }
30     
31     $bots =
32     'bot;Scooter;Slurp;Voila;WiseNut;Fast;Index;Teoma;'.
33     'Mirago;search;find;loader;archive;Spider;Crawler';
34
35     # Settings
36     $core->blog->settings->addNamespace('disclaimer');
37     $core->blog->settings->disclaimer->put('disclaimer_active',false,'boolean','Enable disclaimer plugin',false,true);
38     $core->blog->settings->disclaimer->put('disclaimer_remember',false,'boolean','Remember user who seen disclaimer',false,true);
39     $core->blog->settings->disclaimer->put('disclaimer_redir','http://google.com','string','Redirection if disclaimer is refused',false,true);
40     $core->blog->settings->disclaimer->put('disclaimer_title','Disclaimer','string','Title for disclaimer',false,true);
41     $core->blog->settings->disclaimer->put('disclaimer_text','You must accept this term before entering','string','Description for disclaimer',false,true);
42     $core->blog->settings->disclaimer->put('disclaimer_bots_unactive',false,'boolean','Bypass disclaimer for bots',false,true);
43     $core->blog->settings->disclaimer->put('disclaimer_bots_agents',$bots,'string','List of know bots',false,true);
44
45     # Version
46     $core->setVersion('disclaimer',$new_version);
47
48     return true;
49}
50catch (Exception $e)
51{
52     $core->error->add($e->getMessage());
53     return false;
54}
55?>
Note: See TracBrowser for help on using the repository browser.

Sites map