Dotclear

source: plugins/rateIt/_install.php @ 1865

Revision 1865, 4.7 KB checked in by JcDenis, 13 years ago (diff)

rateIt 0.9.7:

  • Added entryFirstImage to wigdet
  • Fixed bug with date sorting on widget
  • Fixed bug with plugin ativityReport
  • Removed about tabs and fixed typo
Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3# This file is part of rateIt, a plugin for Dotclear 2.
4#
5# Copyright (c) 2009 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//*
15if ($core->plugins->moduleExists('rateItComment') 
16 || $core->plugins->moduleExists('rateItCategory')
17 || $core->plugins->moduleExists('rateItTag')
18 || $core->plugins->moduleExists('rateItGallery')) {
19     throw new Exception('You must uninstall rateItComment, rateItCategory, rateItTag, rateItGallery before installing rateIt 0.9.5 and higher');
20     return false;
21}
22//*/
23$new_version = $core->plugins->moduleInfo('rateIt','version');
24$old_version = $core->getVersion('rateIt');
25
26if (version_compare($old_version,$new_version,'>=')) return;
27
28try {
29     # Is DC 2.1.5 ?
30     if (!version_compare(DC_VERSION,'2.1.5','>=')) {
31
32          throw new Exception('rateIt requires Dotclear 2.1.5');
33     }
34     # Database
35     $s = new dbStruct($core->con,$core->prefix);
36     $s->rateit
37          ->blog_id ('varchar',32,false)
38          ->rateit_id ('varchar',192,false)
39          ->rateit_type('varchar',16,false)
40          ->rateit_note ('float',0,false)
41          ->rateit_quotient ('float',0,false)
42          ->rateit_ip ('varchar',48,false)
43          ->rateit_time ('timestamp',0,false,'now()')
44          ->primary('pk_rateit','blog_id','rateit_type','rateit_id','rateit_ip') //mysql error 1071 limit key to 768.
45          ->index('idx_rateit_blog_id','btree','blog_id')
46          ->index('idx_rateit_rateit_type','btree','rateit_type')
47          ->index('idx_rateit_rateit_id','btree','rateit_id')
48          ->index('idx_rateit_rateit_ip','btree','rateit_ip');
49
50     $si = new dbStruct($core->con,$core->prefix);
51     $changes = $si->synchronize($s);
52
53     $core->blog->settings->setNameSpace('rateit');
54
55     # Settings main
56     $core->blog->settings->put('rateit_active',false,'boolean','rateit plugin enabled',false,true);
57     $core->blog->settings->put('rateit_importexport_active',true,'boolean','rateit import/export enabled',false,true);
58     $core->blog->settings->put('rateit_quotient',5,'integer','rateit maximum note',false,true);
59     $core->blog->settings->put('rateit_digit',1,'integer','rateit note digits number',false,true);
60     $core->blog->settings->put('rateit_msgthanks','Thank you for having voted','string','rateit message when voted',false,true);
61     $core->blog->settings->put('rateit_userident',0,'integer','rateit use cookie and/or ip',false,true);
62     $core->blog->settings->put('rateit_dispubjs',false,'boolean','disable rateit public javascript',false,true);
63     $core->blog->settings->put('rateit_dispubcss',false,'boolean','disable rateit public css',false,true);
64     # Settings for posts
65     $core->blog->settings->put('rateit_post_active',true,'boolean','Enabled post rating',false,true);
66     $core->blog->settings->put('rateit_poststpl',false,'boolean','rateit template on post on post page',false,true);
67     $core->blog->settings->put('rateit_homepoststpl',false,'boolean','rateit template on post on home page',false,true);
68     $core->blog->settings->put('rateit_tagpoststpl',false,'boolean','rateit template on post on tag page',false,true);
69     $core->blog->settings->put('rateit_categorypoststpl',false,'boolean','rateit template on post on category page',false,true);
70     $core->blog->settings->put('rateit_categorylimitposts',false,'integer','rateit limit post vote to one category',false,true);
71     # Settings for comments
72     $core->blog->settings->put('rateit_comment_active',false,'boolean','Enable comments rating',false,true);
73     $core->blog->settings->put('rateit_commentstpl',true,'boolean','Use comments behavior',false,true);
74     # Settings for categories
75     $core->blog->settings->put('rateit_category_active',false,'boolean','rateit category addon enabled',false,true);
76     # Settings for tags
77     $core->blog->settings->put('rateit_tag_active',false,'boolean','rateit tag addon enabled',false,true);
78     # Settings for galleries
79     $core->blog->settings->put('rateit_gal_active',false,'boolean','rateit addon gallery enabled',false,true);
80     $core->blog->settings->put('rateit_galitem_active',false,'boolean','rateit addon gallery item enabled',false,true);
81     $core->blog->settings->put('rateit_galtpl',true,'boolean','rateit template galleries page',false,true);
82     $core->blog->settings->put('rateit_galitemtpl',true,'boolean','rateit template gallery items page',false,true);
83
84     $core->blog->settings->setNameSpace('system');
85
86     # Version
87     $core->setVersion('rateIt',$core->plugins->moduleInfo('rateIt','version'));
88
89     return true;
90}
91catch (Exception $e) {
92     $core->error->add($e->getMessage());
93}
94return false;
95?>
Note: See TracBrowser for help on using the repository browser.

Sites map