Dotclear

source: plugins/blocNotes/inc/lib.blocNotes.php @ 1183

Revision 1183, 2.6 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 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
25class blocNotes
26     {
27          public static function adminDashboardIcons(&$core, &$icons)
28          {
29               $icons['blocNotes'] = array(__('Notebook'),
30                    'plugin.php?p=blocNotes',
31                    'index.php?pf=blocNotes/icon-big.png');
32          }
33
34          public static function form()
35          {
36               global $core;
37               
38               $set = $core->blog->settings;
39
40               echo '<p class="area" id="blocNotes_personal">'.
41                    '<label for="blocNotes_personal_text">'.
42                         __('Personal notebook (other users can\'t edit it) :').
43                    '</label>'.
44                    form::textarea('blocNotes_personal_text',80,5,
45                    html::escapeHTML(base64_decode(
46                         $set->{'blocNotes_text_'.$core->auth->userID()}),
47                    'maximal')).
48                    '</p>'.
49                    '<p class="area" id="blocNotes">'.
50                    '<label for="blocNotes_text">'.
51                         __('Blog-specific notebook (users of the blog can edit it) :').
52                    '</label>'.
53                    form::textarea('blocNotes_text',80,5,
54                    html::escapeHTML(base64_decode($set->blocNotes_text)),
55                    'maximal').
56                    '</p>'.
57                    '<p class="form-note">'.
58                    __('These notes may be read by anyone, don\'t write some sensitive information (password, personal information, etc.)').
59                    '</p>';
60          }
61
62          public static function putSettings()
63          {
64               global $core;
65
66               if (isset($_POST['blocNotes_text']))
67               {
68                    $core->blog->settings->setNameSpace('blocnotes');
69                    # Bloc-Notes' text
70                    $core->blog->settings->put(
71                         'blocNotes_text_'.$core->auth->userID(),
72                         base64_encode($_POST['blocNotes_personal_text']),'text',
73                         'Bloc-Notes\' personal text',true,true);
74                    $core->blog->settings->put('blocNotes_text',
75                         base64_encode($_POST['blocNotes_text']),'text',
76                         'Bloc-Notes\' text');
77               }
78          }
79
80          public static function adminPostHeaders()
81          {
82               return '<script type="text/javascript" '.
83                    'src="index.php?pf=blocNotes/post.js">'.
84                    '</script>'."\n";
85          }
86     }
87
88?>
Note: See TracBrowser for help on using the repository browser.

Sites map