Dotclear

source: plugins/blocNotes/_install.php @ 1183

Revision 1183, 2.5 KB checked in by Moe, 15 years ago (diff)

Bloc-Notes 1.0.2 :

  • fixed bug with line breaks broken when using about:config, the strings are now encoded
  • removed legacy code for Dotclear beta versions
  • moved library to inc/ directory
  • replaced <div class="message"> by <p class="message">
Line 
1<?php
2# ***** BEGIN LICENSE BLOCK *****
3#
4# This file is part of Bloc-Notes.
5# Copyright 2008,2009 Moe (http://gniark.net/)
6#
7# Bloc-Notes is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.
11#
12# Bloc-Notes is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19#
20# Icons (*.png) are from Tango Icon theme :
21#    http://tango.freedesktop.org/Tango_Icon_Gallery
22#
23# ***** END LICENSE BLOCK *****
24
25if (!defined('DC_CONTEXT_ADMIN')) {return;}
26
27# On lit la version du plugin
28$m_version = $core->plugins->moduleInfo('blocNotes','version');
29 
30# On lit la version du plugin dans la table des versions
31$i_version = $core->getVersion('blocNotes');
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é
36if (version_compare($i_version,$m_version,'>=')) {
37     return;
38}
39
40# encode settings to preserve new lines when editing about:config
41if (version_compare($i_version,'1.0.2','<'))
42{
43     # per-blog setting
44     $rs = $core->con->select('SELECT setting_value, setting_id, blog_id '.
45     'FROM '.$core->prefix.'setting '.
46     'WHERE setting_ns = \'blocnotes\' '.
47     'AND (setting_id = \'blocNotes_text\');');
48     
49     while($rs->fetch())
50     {
51          $cur = $core->con->openCursor($core->prefix.'setting');
52          $cur->setting_value = base64_encode($rs->setting_value);
53          $cur->update('WHERE setting_ns = \'blocnotes\' '.
54               'AND setting_id = \''.$rs->setting_id.'\''.
55               'AND blog_id = \''.$rs->blog_id.'\';');
56     }
57     
58     # users setting (global)
59     $rs = $core->con->select('SELECT setting_value, setting_id, blog_id '.
60     'FROM '.$core->prefix.'setting '.
61     'WHERE setting_ns = \'blocnotes\' '.
62     'AND (setting_id LIKE \'blocNotes_text_%\');');
63     
64     while($rs->fetch())
65     {
66          $cur = $core->con->openCursor($core->prefix.'setting');
67          $cur->setting_value = base64_encode($rs->setting_value);
68          $cur->update('WHERE setting_ns = \'blocnotes\' '.
69               'AND setting_id = \''.$rs->setting_id.'\';');
70     }
71}
72
73# La procédure d'installation commence vraiment là
74$core->setVersion('blocNotes',$m_version);
75
76return true;
77?>
Note: See TracBrowser for help on using the repository browser.

Sites map